[Django] #35320: Always use `os.path.samefile` in `core/files/move.py`

14 views
Skip to first unread message

Django

unread,
Mar 20, 2024, 3:38:41 PM3/20/24
to django-...@googlegroups.com
#35320: Always use `os.path.samefile` in `core/files/move.py`
-----------------------------------------+------------------------
Reporter: bcail | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 5.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Currently, there's a custom
[https://github.com/django/django/blob/main/django/core/files/move.py#L16
_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
[https://github.com/python/cpython/commit/490b32a3976d84eaf1d6ca8cdcb00eac0ce5055b
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?
--
Ticket URL: <https://code.djangoproject.com/ticket/35320>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 20, 2024, 3:42:19 PM3/20/24
to django-...@googlegroups.com
#35320: Always use `os.path.samefile` in `core/files/move.py`
-------------------------------------+-------------------------------------
Reporter: bcail | Owner: nobody
Type: Uncategorized | Status: new
Component: File | Version: 5.0
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bcail):

* component: Uncategorized => File uploads/storage

--
Ticket URL: <https://code.djangoproject.com/ticket/35320#comment:1>

Django

unread,
Mar 20, 2024, 3:43:13 PM3/20/24
to django-...@googlegroups.com
#35320: Always use `os.path.samefile` in `core/files/move.py`
-------------------------------------+-------------------------------------
Reporter: bcail | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: File | Version: dev
uploads/storage |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by bcail):

* type: Uncategorized => Cleanup/optimization
* version: 5.0 => dev

--
Ticket URL: <https://code.djangoproject.com/ticket/35320#comment:2>

Django

unread,
Mar 21, 2024, 12:42:29 AM3/21/24
to django-...@googlegroups.com
#35320: Always use `os.path.samefile` in `core/files/move.py`
--------------------------------------+------------------------------------
Reporter: bcail | Owner: bcail
Type: Cleanup/optimization | Status: assigned
Component: File uploads/storage | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => bcail
* stage: Unreviewed => Accepted
* status: new => assigned

Comment:

Sounds reasonable.
--
Ticket URL: <https://code.djangoproject.com/ticket/35320#comment:3>
Reply all
Reply to author
Forward
0 new messages