Opened 3 years ago

Closed 3 years ago

#35320 closed Cleanup/optimization (fixed)

Remove unnecessary django.core.files.move._samefile() hook.

Reported by: bcail Owned by: bcail
Component: File uploads/storage Version: dev
Severity: Normal Keywords:
Cc: bcail Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently, there's a custom ​_samefile() function in core/files/move.py. It checks for whether os.path has a samefile function, and falls back to another implementation if it doesn't.

In 2012, Python ​was updated to put samefile in genericpath, so it's always available in os.path.

Could we remove the custom _samefile() function and always use the Python version?

Change History (8)

comment:1 by bcail, 3 years ago

Component: Uncategorized → File uploads/storage

comment:2 by bcail, 3 years ago

Type: Uncategorized → Cleanup/optimization
Version: 5.0 → dev

comment:3 by Mariusz Felisiak, 3 years ago

Owner: changed from nobody to bcail
Status: new → assigned
Triage Stage: Unreviewed → Accepted

Sounds reasonable.

comment:4 by Mariusz Felisiak, 3 years ago

Summary: Always use `os.path.samefile` in `core/files/move.py` → Remove unnecessary django.core.files.move._samefile() hook.

comment:5 by Mariusz Felisiak, 3 years ago

Has patch: set
Patch needs improvement: set

comment:6 by bcail, 3 years ago

Patch needs improvement: unset

Thanks, I changed it to OSError.

comment:7 by Mariusz Felisiak, 3 years ago

Triage Stage: Accepted → Ready for checkin

comment:8 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: → fixed
Status: assigned → closed

In 8dbfef4:

Fixed #35320 -- Removed unnecessary django.core.files.move._samefile() hook.

os.path.samefile() uses the same implementation on Windows as all other
platforms since Python 3.4.

Note: See TracTickets for help on using tickets.
Back to Top