| 257 | fdst_write(buf) |
| 258 | |
| 259 | def _samefile(src, dst): |
| 260 | # Macintosh, Unix. |
| 261 | if isinstance(src, os.DirEntry) and hasattr(os.path, 'samestat'): |
| 262 | try: |
| 263 | return os.path.samestat(src.stat(), os.stat(dst)) |
| 264 | except OSError: |
| 265 | return False |
| 266 | |
| 267 | if hasattr(os.path, 'samefile'): |
| 268 | try: |
| 269 | return os.path.samefile(src, dst) |
| 270 | except OSError: |
| 271 | return False |
| 272 | |
| 273 | # All other platforms: check for same pathname. |
| 274 | return (os.path.normcase(os.path.abspath(src)) == |
| 275 | os.path.normcase(os.path.abspath(dst))) |
| 276 | |
| 277 | def _stat(fn): |
| 278 | return fn.stat() if isinstance(fn, os.DirEntry) else os.stat(fn) |