[New-bugs-announce] [issue7824] assertion error in 2to3

Brian Harring report at bugs.python.org
Mon Feb 1 00:23:49 CET 2010


New submission from Brian Harring <ferringb at gmail.com>:

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).

----------
components: 2to3 (2.x to 3.0 conversion tool)
files: mappings.py
messages: 98634
nosy: ferringb
severity: normal
status: open
title: assertion error in 2to3
versions: Python 3.2
Added file: http://bugs.python.org/file16073/mappings.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7824>
_______________________________________


More information about the New-bugs-announce mailing list