diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2004-09-07 15:28:01 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2004-09-07 15:28:01 (GMT) |
commit | 566d934745378df72fbbf7d3f834e7d08f7e42d1 (patch) | |
tree | 495591bd3b0dfcc198f36c5a904dae9cac617036 /Lib/test/test_transformer.py | |
parent | 2ad68e69b975b1714d3da1cd5e419c8294a5f2c1 (diff) | |
download | cpython-566d934745378df72fbbf7d3f834e7d08f7e42d1.zip cpython-566d934745378df72fbbf7d3f834e7d08f7e42d1.tar.gz cpython-566d934745378df72fbbf7d3f834e7d08f7e42d1.tar.bz2 |
compiler.transformer: correct lineno attribute when possible
SF patch #1015989
The basic idea of this patch is to compute lineno attributes for all AST nodes. The actual
implementation lead to a lot of restructing and code cleanup.
The generated AST nodes now have an optional lineno argument to constructor. Remove the
top-level asList(), since it didn't seem to serve any purpose. Add an __iter__ to ast nodes.
Use isinstance() instead of explicit type tests.
Change transformer to use the new lineno attribute, which replaces three lines of code with one.
Use universal newlines so that we can get rid of special-case code for line endings. Use
lookup_node() in a few more frequently called, but simple com_xxx methods(). Change string
exception to class exception.
Diffstat (limited to 'Lib/test/test_transformer.py')
-rw-r--r-- | Lib/test/test_transformer.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/test/test_transformer.py b/Lib/test/test_transformer.py index 6a8c98a..909cda5 100644 --- a/Lib/test/test_transformer.py +++ b/Lib/test/test_transformer.py @@ -29,9 +29,7 @@ class Tests(unittest.TestCase): assert vals['b'] == 2 def test_main(): - test_support.run_unittest( - Tests - ) + test_support.run_unittest(Tests) if __name__ == "__main__": test_main() |