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: 2to3 should detect and delete import of removed statvfs module
Type: enhancement Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.0
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, r.david.murray, sjt, terry.reedy
Priority: low Keywords:

Created on 2009-02-13 18:27 by sjt, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg81959 - (view) Author: Stephen J. Turnbull (sjt) * (Python triager) Date: 2009-02-13 18:27
It should also try to convert stuff like

from statvfs import F_BAVAIL, F_FRSIZE
status = os.statvfs(directory)
available = status[F_BAVAIL]/((1024*1024)/status[F_FRSIZE]
msg81967 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-02-13 19:29
Hmm. 2to3 doesn't currently mess with the stat module and os.stat the
more common function. Also the new interface (attributes on the objects
returned) has been around since 2.2.
msg82006 - (view) Author: Stephen J. Turnbull (sjt) * (Python triager) Date: 2009-02-14 10:33
Benjamin Peterson writes:

 > Hmm. 2to3 doesn't currently mess with the stat module and os.stat the
 > more common function. Also the new interface (attributes on the objects
 > returned) has been around since 2.2.

So what?  You *can't* import a nonexistent module, so the import
statement should be removed to save the programmer the trouble.
msg82045 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-02-14 13:33
On Sat, Feb 14, 2009 at 4:33 AM, Stephen J. Turnbull
<report@bugs.python.org> wrote:
>
> Stephen J. Turnbull <stephen@xemacs.org> added the comment:
>
> Benjamin Peterson writes:
>
>  > Hmm. 2to3 doesn't currently mess with the stat module and os.stat the
>  > more common function. Also the new interface (attributes on the objects
>  > returned) has been around since 2.2.
>
> So what?  You *can't* import a nonexistent module, so the import
> statement should be removed to save the programmer the trouble.

No, the programmer should remove the import statement when he's
porting it to use the attributes of the statvfs call.
msg145517 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-10-14 14:03
Benjamin, you seem to have rejected this feature request. Close it?
msg266641 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-05-29 22:08
Closing based on Benjamin's comments.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49502
2016-05-29 22:08:25r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg266641

resolution: rejected
stage: resolved
2011-10-14 14:03:01terry.reedysetnosy: + terry.reedy
messages: + msg145517
2009-02-14 13:33:13benjamin.petersonsetmessages: + msg82045
2009-02-14 10:33:42sjtsetmessages: + msg82006
2009-02-13 19:29:13benjamin.petersonsetpriority: low
nosy: + benjamin.peterson
messages: + msg81967
2009-02-13 18:27:05sjtcreate