[issue14807] Move tarfile.filemode() into stat module

Terry J. Reedy report at bugs.python.org
Mon May 14 20:00:01 CEST 2012


Terry J. Reedy <tjreedy at udel.edu> added the comment:

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.

----------
type:  -> enhancement

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14807>
_______________________________________


More information about the Python-bugs-list mailing list