Issue 14807: Move tarfile.filemode() into stat module (original) (raw)

Created on 2012-05-14 13:04 by giampaolo.rodola, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
filemode.patch giampaolo.rodola,2012-05-14 13:04 review
filemode.patch giampaolo.rodola,2012-05-14 18:59 review
Messages (13)
msg160621 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2012-05-14 13:04
As per: http://mail.python.org/pipermail/python-ideas/2012-May/015104.html Patch is in attachment.
msg160643 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-14 17:28
I'm not sure filemode() is the best name for this. On the other hand, I don't have any suggestion. I don't understand why you're using atexit. tearDown() and addCleanup() are your friends. The call_safely thing also looks unwarranted. support.unlink() should be able to help you.
msg160650 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-05-14 18:00
1. After careful check, I am convince that converted _filemode_table (now private) is correct. Ditto for copied filemode function with adjusted docstring. 2. New test_stat.py is nice. I believe there is a new style of actually running the tests that somehow collects the list of TestCase subclasses without having to hand edit the run_unittest() call when new ones are added. I think it was briefly discussed on pydev list, but remenber nothing else. I mention this because I wonder if you think stat should have more tests (and TestCase classes). If so, a new issue could be opened after this is applied and mentioned on mentor list as an entry level issue for newer contributors. 3. I think the back compatibility alias should be wrapped with a deprecation warning. I believe the standard method would be something like the following import warnings def filemode(mode): "Deprecated in this location; use stat.filemode." warnings.warn("The undocumented tarfile.filemode function\n" "has been moved to stat and documented there.", DeprecationWarning, 2) return stat.filemode(mode) Removal could be scheduled for 3.5 if not 3.4. There apparently is a way (unknown to me) to add a test that will fail in the future as a reminder. 4. Misc/NEWS entry suggestion: - Issue 14807: Move undocumented tarfile.filemode() to stat.filemode() and add doc entry. Add tarfile.filemode alias with deprecation warning. Schedule alias for removal in 3.5. 5. stat module doc entry.
msg160656 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2012-05-14 18:59
Updated patch in attachment.
msg160658 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-05-14 19:16
Looks good enough to me except for the alias docstring. If someone does dir(tarfile) and help(filemode), they should get the message that it is a deprecated alias and should not use it.
msg160726 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-15 13:30
New changeset 492e6c6a01bb by Giampaolo Rodola' in branch 'default': #14807: move undocumented tarfile.filemode() to stat.filemode(). Add tarfile.filemode alias with deprecation warning. http://hg.python.org/cpython/rev/492e6c6a01bb
msg160757 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-15 20:03
Buildbot failures: http://www.python.org/dev/buildbot/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/2540 http://www.python.org/dev/buildbot/all/builders/x86%20Tiger%203.x/builds/4572
msg160759 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-15 20:21
New changeset 539fbd6e58f6 by Giampaolo Rodola' in branch 'default': #14807: fix bb failure due to symlink test relying on hard-coded permissions http://hg.python.org/cpython/rev/539fbd6e58f6
msg160760 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2012-05-15 20:21
Thanks. It should now be fixed.
msg160840 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-16 12:12
And there are test failures under Windows too :) ====================================================================== ERROR: test_link (test.test_stat.TestFilemode) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_stat.py", line 42, in test_link os.symlink(os.getcwd(), TESTFN) NotImplementedError: CreateSymbolicLinkW not found ====================================================================== FAIL: test_directory (test.test_stat.TestFilemode) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_stat.py", line 38, in test_directory self.assertEqual(get_mode(), 'drwx------') AssertionError: 'drwxrwxrwx' != 'drwx------' - drwxrwxrwx + drwx------ ====================================================================== FAIL: test_mode (test.test_stat.TestFilemode) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_stat.py", line 27, in test_mode self.assertEqual(get_mode(), '-rwx------') AssertionError: '-rw-rw-rw-' != '-rwx------' - -rw-rw-rw- + -rwx------ http://www.python.org/dev/buildbot/all/builders/x86%20Windows7%203.x/builds/4962/steps/test/logs/stdio
msg160864 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-16 14:03
New changeset 39d24533c6b7 by Giampaolo Rodola' in branch 'default': #14807: fix BB failures on Windows - avoid to to rely too many details of the mode string. http://hg.python.org/cpython/rev/39d24533c6b7
msg160865 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2012-05-16 14:04
Let's see how it goes now.
msg179040 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2013-01-04 16:30
Previous issue should have been fixed by now. Closing.
History
Date User Action Args
2022-04-11 14:57:30 admin set github: 59012
2013-01-04 16:30:09 giampaolo.rodola set status: pending -> closedmessages: +
2013-01-04 15:13:14 serhiy.storchaka set status: open -> pending
2012-05-16 14:04:48 giampaolo.rodola set messages: +
2012-05-16 14:03:13 python-dev set messages: +
2012-05-16 12:12:42 pitrou set status: closed -> openmessages: +
2012-05-15 20:21:41 giampaolo.rodola set status: open -> closedmessages: +
2012-05-15 20:21:08 python-dev set messages: +
2012-05-15 20:03:56 pitrou set status: closed -> openmessages: +
2012-05-15 13:34:44 giampaolo.rodola set assignee: giampaolo.rodola
2012-05-15 13:33:48 giampaolo.rodola set status: open -> closedresolution: fixedstage: patch review -> resolved
2012-05-15 13:30:30 python-dev set nosy: + python-devmessages: +
2012-05-14 19:16:42 terry.reedy set messages: +
2012-05-14 18:59:10 giampaolo.rodola set files: + filemode.patchmessages: +
2012-05-14 18:00:01 terry.reedy set type: enhancementmessages: +
2012-05-14 17:30:42 lars.gustaebel set nosy: + lars.gustaebel
2012-05-14 17:28:16 pitrou set nosy: + pitroumessages: + stage: patch review
2012-05-14 13:04:37 giampaolo.rodola create