classification
Title: os.__all__ is missing some names
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: loewis, meador.inge, petri.lehtinen, python-dev
Priority: normal Keywords: easy, patch

Created on 2012-05-20 10:20 by petri.lehtinen, last changed 2012-05-23 18:38 by petri.lehtinen. This issue is now closed.

Files
File name Uploaded Description Edit
issue14862.patch meador.inge, 2012-05-21 14:09 patch against 3.3 tip review
issue14862_v2.patch petri.lehtinen, 2012-05-21 18:54 review
Messages (8)
msg161196 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-05-20 10:20
>>> from os import *
>>> fdopen
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'fdopen' is not defined
msg161218 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-20 17:02
While this is technically probably a bug, I'm -0 on fixing it in bugfix releases, as it has the risk of breaking working code.
msg161219 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2012-05-20 17:38
I think this came in when we moved os.fdopen and os.popen from native C code to Python code in http://hg.python.org/cpython/rev/1f7891d84d93.  This works fine in 2.7.  The same issue exist with os.popen, but that is deprecated.
msg161246 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-05-21 05:58
> While this is technically probably a bug, I'm -0 on fixing it in bugfix
> releases, as it has the risk of breaking working code.

I don't feel strongly about in which release this should be fixed, but
can you give me an example of how it could break working code?
msg161274 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2012-05-21 14:09
> can you give me an example of how it could break working code?

This is a bit contrived, but:

# my fdopen
def fdopen(fd):
    pass

fdopen(1)

# some stuff

from os import *

# more stuff

fdopen(1)

Here is a patch for 3.3 tip.  After reviewing the 'os' module documentation I found a few more cases.
msg161281 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-05-21 15:45
Perhaps a little less contrived

from libc_wrapper import fdopen
from os import *

where libc_wrapper might be a module built on top of ctypes.
msg161287 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-05-21 18:54
I found two more: P_NOWAITO and _exit. Attached an updated patch.
msg161448 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-23 18:38
New changeset 352147bbefdb by Petri Lehtinen in branch 'default':
#14862: Add missing names to os.__all__
http://hg.python.org/cpython/rev/352147bbefdb
History
Date User Action Args
2012-05-23 18:38:37petri.lehtinensetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2012-05-23 18:38:08python-devsetnosy: + python-dev
messages: + msg161448
2012-05-23 18:27:36petri.lehtinensettitle: fdopen not listed in __all__ of os.py -> os.__all__ is missing some names
2012-05-21 18:54:49petri.lehtinensetfiles: + issue14862_v2.patch

messages: + msg161287
2012-05-21 15:45:13loewissetmessages: + msg161281
2012-05-21 14:09:30meador.ingesetfiles: + issue14862.patch
keywords: + patch
messages: + msg161274
2012-05-21 05:58:41petri.lehtinensetmessages: + msg161246
2012-05-20 17:38:28meador.ingesetversions: - Python 2.7
nosy: + meador.inge

messages: + msg161219

stage: needs patch
2012-05-20 17:02:36loewissetnosy: + loewis
messages: + msg161218
2012-05-20 10:20:58petri.lehtinensettitle: fdopen not listed in__all__ of os.py -> fdopen not listed in __all__ of os.py
2012-05-20 10:20:31petri.lehtinencreate