summaryrefslogtreecommitdiffstats
path: root/Lib/tokenize.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-11-11 14:07:41 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2010-11-11 14:07:41 (GMT)
commitb9d10d08c4eb0dedaea3b1bcde0f13b033e16c85 (patch)
treeac679156d755c597b585a4d0d346919ea2cb3e84 /Lib/tokenize.py
parentbb27c128a5524470673618c40a2043e0cfaf96a4 (diff)
downloadcpython-b9d10d08c4eb0dedaea3b1bcde0f13b033e16c85.zip
cpython-b9d10d08c4eb0dedaea3b1bcde0f13b033e16c85.tar.gz
cpython-b9d10d08c4eb0dedaea3b1bcde0f13b033e16c85.tar.bz2
Issue #10386: Added __all__ to token module; this simplifies importing
in tokenize module and prevents leaking of private names through import *.
Diffstat (limited to 'Lib/tokenize.py')
-rw-r--r--Lib/tokenize.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/tokenize.py b/Lib/tokenize.py
index 7745412..506aa6a 100644
--- a/Lib/tokenize.py
+++ b/Lib/tokenize.py
@@ -33,9 +33,8 @@ from io import TextIOWrapper
cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
import token
-__all__ = [x for x in dir(token) if not x.startswith("_")]
-__all__.extend(["COMMENT", "tokenize", "detect_encoding", "NL", "untokenize",
- "ENCODING", "TokenInfo"])
+__all__ = token.__all__ + ["COMMENT", "tokenize", "detect_encoding",
+ "NL", "untokenize", "ENCODING", "TokenInfo"]
del token
COMMENT = N_TOKENS