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

parsermodule won't validate relative imports #48298

Closed
dbinger mannequin opened this issue Oct 5, 2008 · 3 comments
Closed

parsermodule won't validate relative imports #48298

dbinger mannequin opened this issue Oct 5, 2008 · 3 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@dbinger
Copy link
Mannequin

dbinger mannequin commented Oct 5, 2008

BPO 4048
Nosy @benjaminp
Files
  • parserdot.diff: Patch to parsermodule.c and test_parser.py.
  • 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 = None
    closed_at = <Date 2008-11-03.15:15:06.792>
    created_at = <Date 2008-10-05.22:15:19.616>
    labels = ['type-bug', 'library']
    title = "parsermodule won't validate relative imports"
    updated_at = <Date 2008-11-03.15:15:06.759>
    user = 'https://bugs.python.org/dbinger'

    bugs.python.org fields:

    activity = <Date 2008-11-03.15:15:06.759>
    actor = 'benjamin.peterson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-11-03.15:15:06.792>
    closer = 'benjamin.peterson'
    components = ['Library (Lib)']
    creation = <Date 2008-10-05.22:15:19.616>
    creator = 'dbinger'
    dependencies = []
    files = ['11705']
    hgrepos = []
    issue_num = 4048
    keywords = ['patch']
    message_count = 3.0
    messages = ['74354', '74356', '75465']
    nosy_count = 3.0
    nosy_names = ['david_k_hess', 'dbinger', 'benjamin.peterson']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue4048'
    versions = ['Python 2.6', 'Python 2.5', 'Python 3.0']

    @dbinger
    Copy link
    Mannequin Author

    dbinger mannequin commented Oct 5, 2008

    The parser module validates st instances that it builds from
    list or tuple structures. This validation fails for parse
    trees that include relative imports because it fails to correctly
    count the dots that immediately follow the "from" token.

    Here is a test and a patch.

    This bug probably extends back to all Python 2 versions that support
    relative import, but I have not checked it.

    Fixing this has immediate value to me because the QPY package
    depends on the parser module to convert list structures into st
    instances. (In the long run, I wonder if the verification
    part of the sequence2st() function could be made optional or dropped,
    since the current pattern requires to parser module to be updated
    every time the language grammer changes.)

    @dbinger dbinger mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 5, 2008
    @davidkhess
    Copy link
    Mannequin

    davidkhess mannequin commented Oct 6, 2008

    Confirmed the presence of this same problem in the source code of
    parsermodule.c in branches release25-maint and release26-maint.

    @benjaminp
    Copy link
    Contributor

    Thanks for the patch! Fixed in r67077.

    @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
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant