python / cpython

The Python programming language
https://www.python.org
Other
62.42k stars 29.97k forks source link

parser module fails to validate "with" statements. #48646

Closed 8da14b1c-d517-4b5e-bf68-382766190f91 closed 15 years ago

8da14b1c-d517-4b5e-bf68-382766190f91 commented 15 years ago
BPO 4396
Nosy @benjaminp
Files
  • parsewith.diff: suggested patch with unit test.
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = created_at = labels = ['type-bug', 'library'] title = 'parser module fails to validate "with" statements.' updated_at = user = 'https://bugs.python.org/dbinger' ``` bugs.python.org fields: ```python activity = actor = 'benjamin.peterson' assignee = 'none' closed = True closed_date = closer = 'benjamin.peterson' components = ['Library (Lib)'] creation = creator = 'dbinger' dependencies = [] files = ['12111'] hgrepos = [] issue_num = 4396 keywords = ['patch'] message_count = 4.0 messages = ['76271', '76296', '76334', '76335'] nosy_count = 2.0 nosy_names = ['dbinger', 'benjamin.peterson'] pr_nums = [] priority = 'normal' resolution = 'fixed' stage = None status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue4396' versions = ['Python 3.0'] ```

    8da14b1c-d517-4b5e-bf68-382766190f91 commented 15 years ago

    The parser module validates node trees when they are built from sequences. The validator must, unfortunately, be updated every time there is a change in the grammar. The current validator fails to validate "with" statements. This bug probably exists in earlier versions of python that support "with", but I haven't checked.

    Here is a patch with a unit test for py3k. Files involved: parsermodule.c, test_parser.py.

    benjaminp commented 15 years ago

    Thanks for the patch! Fixed in r67365.

    8da14b1c-d517-4b5e-bf68-382766190f91 commented 15 years ago

    Thanks, Benjamin.

    I see that you applied this to the main python branch, which is probably okay (though I haven't tested it), but I wrote the patch against the py3k code. Did you mean to apply it to py3k?

    On Nov 23, 2008, at 11:09 PM, Benjamin Peterson wrote:

    Benjamin Peterson \musiccomposition@gmail.com\ added the comment:

    Thanks for the patch! Fixed in r67365.

    ---------- nosy: +benjamin.peterson resolution: -> fixed status: open -> closed


    Python tracker \report@bugs.python.org\ \http://bugs.python.org/issue4396\


    benjaminp commented 15 years ago

    On Mon, Nov 24, 2008 at 10:21 AM, David Binger \report@bugs.python.org\ wrote:

    David Binger \davidbinger@mac.com\ added the comment:

    Thanks, Benjamin.

    I see that you applied this to the main python branch, which is probably okay (though I haven't tested it), but I wrote the patch against the py3k code. Did you mean to apply it to py3k?

    Yes, I applied it to the trunk because it was a problem there, too. It will be merged into py3k eventually.