This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: assertion error in 2to3
Type: Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ferringb, loewis
Priority: normal Keywords:

Created on 2010-01-31 23:23 by ferringb, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mappings.py ferringb, 2010-01-31 23:23 snakeoil/mappings.py
Messages (2)
msg98634 - (view) Author: Ferringb (ferringb) * Date: 2010-01-31 23:23
Under py3.1, translation of the attached file works fine- under py3.2, goes boom however.

Nothing custom in use here in terms of 2to3- there is some compatibility code in use w/in the module but that's not affecting the translator in my testing.

assertion error follows-

RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
Traceback (most recent call last):
  File "/usr/bin/2to3", line 6, in <module>
    sys.exit(main("lib2to3.fixes"))
  File "/home/ferringb/python-svn/Lib/lib2to3/main.py", line 165, in main
    options.processes)
  File "/home/ferringb/python-svn/Lib/lib2to3/refactor.py", line 613, in refactor
    items, write, doctests_only)
  File "/home/ferringb/python-svn/Lib/lib2to3/refactor.py", line 273, in refactor
    self.refactor_file(dir_or_file, write, doctests_only)
  File "/home/ferringb/python-svn/Lib/lib2to3/refactor.py", line 653, in refactor_file
    *args, **kwargs)
  File "/home/ferringb/python-svn/Lib/lib2to3/refactor.py", line 325, in refactor_file
    tree = self.refactor_string(input, filename)
  File "/home/ferringb/python-svn/Lib/lib2to3/refactor.py", line 355, in refactor_string
    self.refactor_tree(tree, name)
  File "/home/ferringb/python-svn/Lib/lib2to3/refactor.py", line 389, in refactor_tree
    self.traverse_by(self.post_order_heads, tree.post_order())
  File "/home/ferringb/python-svn/Lib/lib2to3/refactor.py", line 415, in traverse_by
    node.replace(new)
  File "/home/ferringb/python-svn/Lib/lib2to3/pytree.py", line 135, in replace
    assert self.parent is not None, str(self)
AssertionError:
    def __init__(self, get_keys_func, get_val_func):
        """
        @param get_keys_func: either a container, or func to call to get keys.
        @param get_val_func: a callable that is JIT called
            with the key requested.
        """
        if not isinstance(get_val_func, collections.Callable):
            raise TypeError("get_val_func isn't a callable")
        if hasattr(get_keys_func, "__iter__"):
            self._keys = get_keys_func
            self._keys_func = None
        else:
            if not isinstance(get_keys_func, collections.Callable):
                raise TypeError(
                    "get_keys_func isn't iterable or callable")
            self._keys_func = get_keys_func
        self._val_func = get_val_func
        self._vals = {}

If y'all need more than just the mappings.py file, this is from http://pkgcore.org/trac/pkgcore/browser/ferringb/snakeoil-dev/ , or just grab the most recent release at http://pkgcore.org/releases/snakeoil/snakeoil-0.3.6.tar.bz2 (both trunk and most recent blow up).
msg98640 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-02-01 01:21
Thanks for the report. This is now fixed in r77900.
History
Date User Action Args
2022-04-11 14:56:57adminsetgithub: 52072
2010-02-01 01:21:09loewissetstatus: open -> closed

nosy: + loewis
messages: + msg98640

resolution: fixed
2010-01-31 23:23:48ferringbcreate