From ce6f5854443ec52829ad371851aba9f3380c9c94 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 23 Jun 2018 18:25:30 -0700 Subject: [PATCH] Merge pull request #894 from tianzhuqiao/py Fix a bug in py.introspect.getTokens (cherry picked from commit 4b436717465b26fb2bdf5dfc2a999f067cfa4b9a) --- CHANGES.rst | 1 + wx/py/introspect.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 459049ec..af7d2358 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -59,6 +59,7 @@ Changes in this release include the following: * Sort pages by dock_pos when added to automatic (agw.aui) notebook. (#882) +* Fix a bug in py.introspect.getTokens. (#889) diff --git a/wx/py/introspect.py b/wx/py/introspect.py index d5548cd9..0c809672 100644 --- a/wx/py/introspect.py +++ b/wx/py/introspect.py @@ -325,7 +325,8 @@ def getTokens(command): tokens.append(args) tokenize.tokenize_loop(f.readline, eater) else: - tokens = list(tokenize.tokenize(f.readline)) + for t in tokenize.tokenize(f.readline): + tokens.append(t) except tokenize.TokenError: # This is due to a premature EOF, which we expect since we are # feeding in fragments of Python code.