[issue29031] 'from module import *' and __all__

2016-12-21 Thread Eryk Sun

Changes by Eryk Sun :


--
nosy: +eryksun
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29031] 'from module import *' and __all__

2016-12-21 Thread Thomas Heller

Thomas Heller added the comment:

Thanks Martin and eryk for correcting me and finding the real cause of
the problem.

Am 21.12.2016 um 13:04 schrieb eryk sun:
> ...  the private names _COORD, _FILETIME, _LARGE_INTEGER,
> _POINTL, _RECTL, _SMALL_RECT, and _ULARGE_INTEGER are skipped by a
> star import. That said, why are these private names (and also "tag"
> names) defined? And why isn't COORD defined instead of or in addition
> to _COORD?

These 'private' names and "tag" names were defined for compatibility
with the windows SDK C header files.  I didn't want to apply
the Python 'private' convention to the C names, so they were added to
the __all__ list.
It was an oversight that COORD wasn't defined, I developed a different
solution for the windows SDK names afterwards, but my code (which I'm
porting to Python 3) still uses 'from ctypes.wintypes import *'
and stumbled over the regression just now.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29031] 'from module import *' and __all__

2016-12-21 Thread eryk sun

eryk sun added the comment:

Python 3 does not skip names in __all__ that start with an underscore. 

wintypes in 2.x uses `from ctypes import *`, so it needs to define __all__. In 
3.x it uses `import ctypes`, so it doesn't define __all__, and the private 
names _COORD, _FILETIME, _LARGE_INTEGER, _POINTL, _RECTL, _SMALL_RECT, and 
_ULARGE_INTEGER are skipped by a star import. That said, why are these private 
names (and also "tag" names) defined? And why isn't COORD defined instead of or 
in addition to _COORD?

--
nosy: +eryk sun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29031] 'from module import *' and __all__

2016-12-21 Thread Martin Panter

Martin Panter added the comment:

Python 3 doesn’t have an __all__ list; it was removed in r85073 (Issue 3612).

I don’t understand why it was removed. Maybe Hirokazu didn’t understand what it 
does. Since this is a regression, perhaps it should be added back.

--
components: +Library (Lib) -Interpreter Core
nosy: +martin.panter
versions:  -Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29031] 'from module import *' and __all__

2016-12-21 Thread Thomas Heller

New submission from Thomas Heller:

The documentation states that 'from module import *' imports all symbols that 
are listed in the module's __all__ list.
In Python 3, unlike Python 2, only symbols that do NOT start with an underscore 
are actually imported.

The following code works in Python 2.7, but raises a NameError
in Python 3.5:
python -c "from ctypes.wintypes import *; print(_ULARGE_INTEGER)"

--
components: Interpreter Core
messages: 283721
nosy: theller
priority: normal
severity: normal
status: open
title: 'from module import *' and __all__
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com