#19540 closed Bug (fixed)
Deprecation warning in the test suite under Python 3.3
Reported by: | Aymeric Augustin | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
django/contrib/staticfiles/management/commands/collectstatic.py:65: DeprecationWarning: stat_float_times() is deprecated os.stat_float_times(False)
Change History (5)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 12 years ago
os.stat_float_times()
was deprecated in Python 3.3 because it was just a temporary solution to make the upgrade to Python 2.3 easier and no one's supposed to be using it :/
The original report in #14665 didn't provide a way to reproduce the issue but I assume is has to do with comparing mtimes across different storage backends, which may store them with more or less precision.
For the built-in backends, the modification time of the files is obtained by os.path.getmtime (in django.core.files.storage.FileSystemStorage
). For custom backends, everything is possible.
Rather than relying on a process-wide modification of the behavior of os.path.getmtime
— which may not work as expected with remote storage backends — I'm going to round mtimes to integers before comparing them.
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 by , 11 years ago
I'm seeing this deprecation warning when running collectstatic
.
os.stat_float_times is used at line 65 in contrib/staticfiles/management/commands/collectstatic.py.
reopen or open another bug?
comment:5 by , 11 years ago
ah, that's the same line. I guess it just didn't make it into 1.5? sorry for being an idiot...
This call was introduced to fix #14665. We cannot simply remove it under Python 3 without causing a regression.
An alternative fix for that bug would consist in casting modification times to integers where they're computed.