Commit c6ac8a78 authored by Tim Peters's avatar Tim Peters

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.
parent e877f8ba
...@@ -29,11 +29,8 @@ are recognized and imported modules are scanned as well, this ...@@ -29,11 +29,8 @@ are recognized and imported modules are scanned as well, this
shouldn't happen often. shouldn't happen often.
BUGS BUGS
- Continuation lines are not dealt with at all. - Continuation lines are not dealt with at all, except inside strings.
- While triple-quoted strings won't confuse it, lines that look like - Nested classes and functions can confuse it.
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.
- Code that doesn't pass tabnanny or python -t will confuse it, unless - 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 you set the module TABWIDTH vrbl (default 8) to the correct tab width
for the file. for the file.
...@@ -75,6 +72,10 @@ _getnext = re.compile(r""" ...@@ -75,6 +72,10 @@ _getnext = re.compile(r"""
[^'\\]* [^'\\]*
)* )*
''' '''
| " [^"\\\n]* (?: \\. [^"\\\n]*)* "
| ' [^'\\\n]* (?: \\. [^'\\\n]*)* '
) )
| (?P<Method> | (?P<Method>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment