[New-bugs-announce] [issue10386] token module should define __all__

Alexander Belopolsky report at bugs.python.org
Thu Nov 11 05:08:44 CET 2010


New submission from Alexander Belopolsky <belopolsky at users.sourceforge.net>:

The token module appears to be designed to be used with import *.  In fact it is used this way in the tokenize module.  However it does not define __all__ and as a result, from token import * leaks symbol "main":

>>> import tokenize
>>> tokenize.main.__module__
'token'

Attached patch adds token.__all__ and "modernizes" generation of the tok_name dictionary.

I also renamed main to _main because it is hard to imagine that any user code would ever want to use it.

----------
components: Library (Lib)
files: token-all.diff
keywords: patch
messages: 120938
nosy: belopolsky
priority: normal
severity: normal
stage: patch review
status: open
title: token module should define __all__
versions: Python 3.2
Added file: http://bugs.python.org/file19568/token-all.diff

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


More information about the New-bugs-announce mailing list