Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#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: master
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


django/contrib/staticfiles/management/commands/ DeprecationWarning: stat_float_times() is deprecated

Change History (5)

comment:1 Changed 6 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

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.

comment:2 Changed 6 years ago by Aymeric Augustin

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 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 Changed 6 years ago by Aymeric Augustin <aymeric.augustin@…>

Resolution: fixed
Status: newclosed

In cebbec9b6122579a32a019a0449d4995dcf2191d:

Fixed #19540 -- Stopped using deprecated os.stat_float_times.

comment:4 Changed 5 years ago by hjwp2@…

I'm seeing this deprecation warning when running collectstatic.

os.stat_float_times is used at line 65 in contrib/staticfiles/management/commands/

reopen or open another bug?

comment:5 Changed 5 years ago by hjwp2@…

ah, that's the same line. I guess it just didn't make it into 1.5? sorry for being an idiot...

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