This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.stat int/float oddity
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: loewis, quiver
Priority: normal Keywords:

Created on 2005-01-20 14:04 by quiver, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg24010 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2005-01-20 14:04
Since the last change to posixmodule.c(Revision 2.332) 
by Martin,
test_os.py fails on my Linux box.

The reason is that when an os.stat object is accessed 
through
obj.attr or obj[index], they do not always represent the 
same
type.

Take, for example, st_atime, st_ctime and st_mtime.
With Martin's change, if they're accessed like 
stat_obj.st_atime,
it returns a float value.
On the other hand, stat_obj[stat.ST_ATIME] still 
remains to return
an integer value.

Here is the result of running test_os.py(abbreviated) ::

test_tempnam (__main__.TemporaryFileTests) ... ok
test_tmpfile (__main__.TemporaryFileTests) ... ok
test_tmpnam (__main__.TemporaryFileTests) ... ok
test_stat_attributes (__main__.StatAttributeTests) ... 
FAIL

[snip]

==========================================
============================
FAIL: test_stat_attributes (__main__.StatAttributeTests)
-------------------------------------------------------
---------------
Traceback (most recent call last):
  File "./test_os.py", line 115, in test_stat_attributes
    result[getattr(stat, name)])
AssertionError: 1106224156.927747 != 1106224156

-------------------------------------------------------
---------------
Ran 23 tests in 0.032s

FAILED (failures=1)
msg24011 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-01-23 09:29
Logged In: YES 
user_id=21627

Thanks for the report. Fixed in test_os.py 1.28
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41468
2005-01-20 14:04:05quivercreate