[issue11016] Re-implementation of the stat module in C
STINNER Victor added the comment: Can we re-close this issue? Or is there still something to do? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Christian Heimes added the comment: Let's close it. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
STINNER Victor added the comment: And stat_filemode() should detect integer overflow. Attached stat_mode_overflow.patch should fix this issue. (I would also suggest to inline fileperm() into stat_filemode(), or pass buf instead of buf[1]. But you may not agree, as you want :-)) -- Added file: http://bugs.python.org/file30675/stat_mode_overflow.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
STINNER Victor added the comment: My changeset e5427b0b2bf7 is not enough: import _stat still fail on Windows. See for example: http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/2164/steps/test/logs/stdio == ERROR: test_directory (test.test_stat.TestFilemodeCStat) -- Traceback (most recent call last): File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_stat.py, line 128, in test_directory st_mode, modestr = self.get_mode() File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_stat.py, line 67, in get_mode modestr = self.statmod.filemode(st_mode) AttributeError: 'NoneType' object has no attribute 'filemode' == ERROR: test_mode (test.test_stat.TestFilemodeCStat) -- Traceback (most recent call last): File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_stat.py, line 119, in test_mode st_mode, modestr = self.get_mode() File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_stat.py, line 67, in get_mode modestr = self.statmod.filemode(st_mode) AttributeError: 'NoneType' object has no attribute 'filemode' == ERROR: test_module_attributes (test.test_stat.TestFilemodeCStat) -- Traceback (most recent call last): File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_stat.py, line 169, in test_module_attributes modvalue = getattr(self.statmod, key) AttributeError: 'NoneType' object has no attribute 'ST_DEV' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
STINNER Victor added the comment: test_stat.test_devices() fail on Solaris: it looks like os.devnull is a symlink. You should probably use os.stat() instead of os.lstat() for this specific test. http://buildbot.python.org/all/builders/SPARC%20Solaris%2010%20%28cc%2C%2032b%29%20%5BSB%5D%203.x/builds/708/steps/test/logs/stdio == FAIL: test_devices (test.test_stat.TestFilemodeCStat) -- Traceback (most recent call last): File /home/cpython/buildslave/cc-32/3.x.snakebite-sol10-sparc-cc-32/build/Lib/test/test_stat.py, line 157, in test_devices self.assertEqual(modestr[0], 'c') AssertionError: 'l' != 'c' - l + c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Christian Heimes added the comment: I have addressed the Windows build issue in http://hg.python.org/cpython/rev/838f04e5a690 and the failing test on Solaris in http://hg.python.org/cpython/rev/6c23ca1982b3 (also 2.7 and default). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Roundup Robot added the comment: New changeset 44c8a9d80595 by Victor Stinner in branch 'default': Issue #11016: Detect integer conversion on conversion from Python int to C mode_t http://hg.python.org/cpython/rev/44c8a9d80595 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Roundup Robot added the comment: New changeset 75bc0ae02bcd by Christian Heimes in branch 'default': Issue #11016: Don't define macros and constants that are already set by pyport.h http://hg.python.org/cpython/rev/75bc0ae02bcd -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Changes by Christian Heimes li...@cheimes.de: Added file: http://bugs.python.org/file30666/statmodule4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Christian Heimes added the comment: New patch People demand a _stat module in C and now they are getting a _stat module in C. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Roundup Robot added the comment: New changeset 420f70a22b9d by Christian Heimes in branch 'default': Issue #11016: Add C implementation of the stat module as _stat http://hg.python.org/cpython/rev/420f70a22b9d -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
STINNER Victor added the comment: buf[9] is not initialized in stat_filemode(). Use a shorter buffer (9 bytes) or set it to NUL. Le 22 juin 2013 21:05, Roundup Robot rep...@bugs.python.org a écrit : Roundup Robot added the comment: New changeset 420f70a22b9d by Christian Heimes in branch 'default': Issue #11016: Add C implementation of the stat module as _stat http://hg.python.org/cpython/rev/420f70a22b9d -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Christian Heimes added the comment: All 10 chars are set: buf[0] = filetype(mode); fileperm(mode, buf[1]); buf[0] is set by filetype(). fileperm() sets 9 chars in buf[1] to buf[9]. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Roundup Robot added the comment: New changeset e5427b0b2bf7 by Victor Stinner in branch 'default': Issue #11016: Try to fix compilaton of the new _stat.c module on Windows http://hg.python.org/cpython/rev/e5427b0b2bf7 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
STINNER Victor added the comment: fileperm() sets 9 chars in buf[1] to buf[9]. Ah ok, fine, I missed the buf[1] hack. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
STINNER Victor added the comment: New changeset e5427b0b2bf7 by Victor Stinner in branch 'default': Issue #11016: Try to fix compilaton of the new _stat.c module on Windows http://hg.python.org/cpython/rev/e5427b0b2bf7 @Christian: Can you please review this commit? By the way, mode_t is also defined in import.c: #ifdef MS_WINDOWS /* for stat.st_mode */ typedef unsigned short mode_t; /* for _mkdir */ #include direct.h #endif And stat_filemode() should detect integer overflow. mode_t is a 32-bit unsigned integer on Linux, and now a 16-bit integer on Windows, whereas stat_filemode() uses an unsigned long (which 32 bit on Windows, and 32 or 64 bits on Linux). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Roundup Robot added the comment: New changeset f8ff61f44aca by Christian Heimes in branch '3.3': Add tests for untested features of the 'stat' module (part of issue #11016) http://hg.python.org/cpython/rev/f8ff61f44aca New changeset d15aee50e4a0 by Christian Heimes in branch 'default': Add tests for untested features of the 'stat' module (part of issue #11016) http://hg.python.org/cpython/rev/d15aee50e4a0 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Charles-François Natali added the comment: I still fail to understand why you just don't ditch the Python implementation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11016] Re-implementation of the stat module in C
Christian Heimes added the comment: The latest patch comes with more comments and documentation updates. The C implementation defines all existing constants to the hard coded values from stat.py if the platform doesn't provide them. The approach keeps maximum backward compatibility with the old stat module. I have also added the new constants and functions to the pure Python implementation for maximum compatibility with other Python implementation. -- title: stat module in C - Re-implementation of the stat module in C Added file: http://bugs.python.org/file30650/statmodule3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11016 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com