Opened 8 months ago

Closed 8 months 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, 8 months ago

Component: UncategorizedFile uploads/storage

comment:2 by bcail, 8 months ago

Type: UncategorizedCleanup/optimization
Version: 5.0dev

comment:3 by Mariusz Felisiak, 8 months ago

Owner: changed from nobody to bcail
Status: newassigned
Triage Stage: UnreviewedAccepted

Sounds reasonable.

comment:4 by Mariusz Felisiak, 8 months 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, 8 months ago

Has patch: set
Patch needs improvement: set

comment:6 by bcail, 8 months ago

Patch needs improvement: unset

Thanks, I changed it to OSError.

comment:7 by Mariusz Felisiak, 8 months ago

Triage Stage: AcceptedReady for checkin

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

Resolution: fixed
Status: assignedclosed

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