Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#19540 closed Bug (fixed)

Deprecation warning in the test suite under Python 3.3

Reported by: aaugustin 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

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 Changed 3 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

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 3 years ago by aaugustin

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

  • Resolution set to fixed
  • Status changed from new to closed

In cebbec9b6122579a32a019a0449d4995dcf2191d:

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

comment:4 Changed 2 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/collectstatic.py.

reopen or open another bug?

comment:5 Changed 2 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