Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser module fails on short relative imports #53376

Closed
mdickinson opened this issue Jun 30, 2010 · 4 comments
Closed

Parser module fails on short relative imports #53376

mdickinson opened this issue Jun 30, 2010 · 4 comments
Assignees
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@mdickinson
Copy link
Member

BPO 9130
Nosy @mdickinson
Files
  • parser_relative_imports.patch
  • 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:

    assignee = 'https://github.com/mdickinson'
    closed_at = <Date 2010-07-04.18:40:56.019>
    created_at = <Date 2010-06-30.19:31:05.718>
    labels = ['extension-modules', 'type-bug']
    title = 'Parser module fails on short relative imports'
    updated_at = <Date 2010-07-04.18:40:56.017>
    user = 'https://github.com/mdickinson'

    bugs.python.org fields:

    activity = <Date 2010-07-04.18:40:56.017>
    actor = 'mark.dickinson'
    assignee = 'mark.dickinson'
    closed = True
    closed_date = <Date 2010-07-04.18:40:56.019>
    closer = 'mark.dickinson'
    components = ['Extension Modules']
    creation = <Date 2010-06-30.19:31:05.718>
    creator = 'mark.dickinson'
    dependencies = []
    files = ['17821']
    hgrepos = []
    issue_num = 9130
    keywords = ['patch']
    message_count = 4.0
    messages = ['109006', '109007', '109252', '109253']
    nosy_count = 1.0
    nosy_names = ['mark.dickinson']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue9130'
    versions = ['Python 2.6', 'Python 3.1', 'Python 2.7', 'Python 3.2']

    @mdickinson
    Copy link
    Member Author

    Python 2.7rc2+ (trunk:82399M, Jun 30 2010, 17:10:13) 
    [GCC 4.2.1 (Apple Inc. build 5659)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import parser
    [35303 refs]
    >>> parser.sequence2st(parser.suite("from . import me").totuple())
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    parser.ParserError: VALIDATION FAILURE: report this to the maintainer!
    [35341 refs]

    Patch attached.

    @mdickinson mdickinson self-assigned this Jun 30, 2010
    @mdickinson mdickinson added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Jun 30, 2010
    @mdickinson
    Copy link
    Member Author

    With this patch, and the one in bpo-9128, the parser module roundtrips correctly on all Lib/.py and all Lib/test/.py files (except for Lib/test/bad*.py). Tested by doing:

    ./python.exe Demo/parser/test_parser.py Lib/*.py

    and

    ./python.exe Demo/parser/test_parser.py Lib/test/*.py

    (the latter after deleting the Lib/test/bad*.py files)

    @mdickinson
    Copy link
    Member Author

    Fixed in revisions r82543, r82546, r82552, r82553, r82554.

    Leaving open because I'm suspicious that the parser module isn't handling relative imports with more than three dots correctly in py3k (since ... gets parsed as an ellipsis token).

    @mdickinson
    Copy link
    Member Author

    Ellipsis token validation fixed in r82555 (py3k), r82556 (release31-maint).

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant