New submission from Bogdan Opanchuk <[email protected]>:

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 <[email protected]>
<https://bugs.pypy.org/issue1729>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to