[ python-Bugs-1105998 ] os.stat int/float oddity
SourceForge.net
noreply at sourceforge.net
Thu Jan 20 15:05:37 CET 2005
Bugs item #1105998, was opened at 2005-01-20 23:04
Message generated for change (Settings changed) made by quiver
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1105998&group_id=5470
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: George Yoshida (quiver)
>Assigned to: Martin v. Löwis (loewis)
Summary: os.stat int/float oddity
Initial Comment:
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)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1105998&group_id=5470
More information about the Python-bugs-list
mailing list