| 200 | fdst_write(buf) |
| 201 | |
| 202 | def _samefile(src, dst): |
| 203 | # Macintosh, Unix. |
| 204 | if isinstance(src, os.DirEntry) and hasattr(os.path, 'samestat'): |
| 205 | try: |
| 206 | return os.path.samestat(src.stat(), os.stat(dst)) |
| 207 | except OSError: |
| 208 | return False |
| 209 | |
| 210 | if hasattr(os.path, 'samefile'): |
| 211 | try: |
| 212 | return os.path.samefile(src, dst) |
| 213 | except OSError: |
| 214 | return False |
| 215 | |
| 216 | # All other platforms: check for same pathname. |
| 217 | return (os.path.normcase(os.path.abspath(src)) == |
| 218 | os.path.normcase(os.path.abspath(dst))) |
| 219 | |
| 220 | def _stat(fn): |
| 221 | return fn.stat() if isinstance(fn, os.DirEntry) else os.stat(fn) |