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

2to3 broken due to mixed 2.5 and 3.0 syntax #48086

Closed
bhy mannequin opened this issue Sep 11, 2008 · 4 comments
Closed

2to3 broken due to mixed 2.5 and 3.0 syntax #48086

bhy mannequin opened this issue Sep 11, 2008 · 4 comments
Assignees
Labels
topic-2to3 type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@bhy
Copy link
Mannequin

bhy mannequin commented Sep 11, 2008

BPO 3836
Nosy @benjaminp
Files
  • fix_syntax.diff: A patch on main.py to fix this
  • 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/benjaminp'
    closed_at = <Date 2008-09-11.21:05:49.934>
    created_at = <Date 2008-09-11.16:11:07.548>
    labels = ['expert-2to3', 'type-crash']
    title = '2to3 broken due to mixed 2.5 and 3.0 syntax'
    updated_at = <Date 2008-09-11.21:05:49.933>
    user = 'https://bugs.python.org/bhy'

    bugs.python.org fields:

    activity = <Date 2008-09-11.21:05:49.933>
    actor = 'benjamin.peterson'
    assignee = 'benjamin.peterson'
    closed = True
    closed_date = <Date 2008-09-11.21:05:49.934>
    closer = 'benjamin.peterson'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2008-09-11.16:11:07.548>
    creator = 'bhy'
    dependencies = []
    files = ['11464']
    hgrepos = []
    issue_num = 3836
    keywords = ['patch']
    message_count = 4.0
    messages = ['73037', '73042', '73056', '73059']
    nosy_count = 3.0
    nosy_names = ['collinwinter', 'benjamin.peterson', 'bhy']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue3836'
    versions = []

    @bhy
    Copy link
    Mannequin Author

    bhy mannequin commented Sep 11, 2008

    In the py3k SVN head(r66389) of lib2to3, the main.py used Python 2.x's
    print syntax, and the refactor.py used Python 3.0's exception syntax. So
    the 2to3 finally broken on both Python 2.5 and 3.0.

    Well, it able to run with Python 2.6, but also have a lot of errors like
    this:

    Traceback (most recent call last):
      File "/usr/bin/2to3", line 6, in <module>
        sys.exit(main("lib2to3.fixes"))
      File "/home/kid/python-site/lib2to3/main.py", line 71, in main
        rt = refactor.RefactoringTool(fixer_names, rt_opts, explicit=explicit)
      File "/home/kid/python-site/lib2to3/refactor.py", line 119, in __init__
        self.pre_order, self.post_order = self.get_fixers()
      File "/home/kid/python-site/lib2to3/refactor.py", line 138, in get_fixers
        mod = __import__(fix_mod_path, {}, {}, ["*"])
      File "/home/kid/python-site/lib2to3/fixes/fix_dict.py", line 38, in
    <module>
        class FixDict(fixer_base.BaseFix):
      File "/home/kid/python-site/lib2to3/fixes/fix_dict.py", line 76, in
    FixDict
        p1 = patcomp.compile_pattern(P1)
      File "/home/kid/python-site/lib2to3/patcomp.py", line 186, in
    compile_pattern
        return PatternCompiler().compile_pattern(pattern)
      File "/home/kid/python-site/lib2to3/patcomp.py", line 57, in
    compile_pattern
        root = self.driver.parse_tokens(tokens, debug=debug)
      File "/home/kid/python-site/lib2to3/pgen2/driver.py", line 45, in
    parse_tokens
        for quintuple in tokens:
      File "/home/kid/python-site/lib2to3/patcomp.py", line 34, in
    tokenize_wrapper
        tokens = tokenize.generate_tokens(driver.generate_lines(input).__next__)
    AttributeError: 'generator' object has no attribute '__next__'

    @bhy bhy mannequin assigned collinwinter Sep 11, 2008
    @bhy bhy mannequin added topic-2to3 type-crash A hard crash of the interpreter, possibly with a core dump labels Sep 11, 2008
    @bhy
    Copy link
    Mannequin Author

    bhy mannequin commented Sep 11, 2008

    A patch on main.py to fix this.

    @benjaminp
    Copy link
    Contributor

    main.py is really not a public interface, but it should be fixed.

    @benjaminp benjaminp assigned benjaminp and unassigned collinwinter Sep 11, 2008
    @benjaminp
    Copy link
    Contributor

    Fixed in r66392.

    @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
    topic-2to3 type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant