[pypy-issue] [issue1729] An AST with no line number attributes is not copyable

Bogdan Opanchuk tracker at bugs.pypy.org
Mon Apr 7 03:46:07 CEST 2014


New submission from Bogdan Opanchuk <mantihor at gmail.com>:

Tested on PyPy-2.2.1

Code:

    import copy
    import ast

    func = ast.FunctionDef(
        name='__wrapper',
        args=ast.arguments(args=[], vararg=None, kwarg=None, defaults=[]),
        decorator_list=[],
        body=[ast.Pass()])

    func2 = copy.deepcopy(func)

The last line raises the following exception:

    Traceback (most recent call last):
      File "app_main.py", line 72, in run_toplevel
      File "t2.py", line 10, in <module>
        func2 = copy.deepcopy(func)
      File "/Users/bogdan/.pyenv/versions/pypy-2.2.1/lib-python/2.7/copy.py",
line 182, in deepcopy
        rv = reductor(2)
    AttributeError: 'FunctionDef' object has no attribute 'lineno'

No exception is raised in CPython 2.7.6 and 3.4.0.

----------
messages: 6683
nosy: bogdan, pypy-issue
priority: bug
release: 2.2
status: unread
title: An AST with no line number attributes is not copyable

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1729>
________________________________________


More information about the pypy-issue mailing list