summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-10-24 20:22:40 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-10-24 20:22:40 (GMT)
commitc6ac8a78f668123ec5c2c3d5a824e7886e9a1c60 (patch)
tree91ab96cc6dc4914bb875876a2e79c56a2d146420 /Lib
parente877f8ba3306be0c76476c1f841d6f5388b675b7 (diff)
downloadcpython-c6ac8a78f668123ec5c2c3d5a824e7886e9a1c60.zip
cpython-c6ac8a78f668123ec5c2c3d5a824e7886e9a1c60.tar.gz
cpython-c6ac8a78f668123ec5c2c3d5a824e7886e9a1c60.tar.bz2
SF bug #473525 pyclbr broken
As the comments in the module implied, pyclbr was easily confused by "strange stuff" inside single- (but not triple-) quoted strings. It isn't anymore. Its behavior remains flaky in the presence of nested functions and classes, though. Bugfix candidate.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/pyclbr.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/pyclbr.py b/Lib/pyclbr.py
index 95479a7..31fad46 100644
--- a/Lib/pyclbr.py
+++ b/Lib/pyclbr.py
@@ -29,11 +29,8 @@ are recognized and imported modules are scanned as well, this
shouldn't happen often.
BUGS
-- Continuation lines are not dealt with at all.
-- While triple-quoted strings won't confuse it, lines that look like
- def, class, import or "from ... import" stmts inside backslash-continued
- single-quoted strings are treated like code. The expense of stopping
- that isn't worth it.
+- Continuation lines are not dealt with at all, except inside strings.
+- Nested classes and functions can confuse it.
- Code that doesn't pass tabnanny or python -t will confuse it, unless
you set the module TABWIDTH vrbl (default 8) to the correct tab width
for the file.
@@ -75,6 +72,10 @@ _getnext = re.compile(r"""
[^'\\]*
)*
'''
+
+ | " [^"\\\n]* (?: \\. [^"\\\n]*)* "
+
+ | ' [^'\\\n]* (?: \\. [^'\\\n]*)* '
)
| (?P<Method>