[issue8570] 2to3 crashes with "AttributeError: 'int' object has no attribute 'startswith'"

rom16384 report at bugs.python.org
Thu Apr 29 16:57:21 CEST 2010


New submission from rom16384 <rom16384 at yahoo.com>:

The attached file crashes 2to3 with traceback:

Traceback (most recent call last):
  File "/usr/bin/2to3", line 6, in <module>
    sys.exit(main("lib2to3.fixes"))
  File "/usr/lib/python2.6/lib2to3/main.py", line 129, in main
    rt.refactor(args, options.write, options.doctests_only)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 196, in refactor
    self.refactor_file(dir_or_file, write, doctests_only)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 235, in refactor_file
    tree = self.refactor_string(input, filename)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 260, in refactor_string
    self.refactor_tree(tree, name)
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 294, in refactor_tree
    self.traverse_by(self.post_order_heads, tree.post_order())
  File "/usr/lib/python2.6/lib2to3/refactor.py", line 316, in traverse_by
    results = fixer.match(node)
  File "/usr/lib/python2.6/lib2to3/fixes/fix_numliterals.py", line 18, in match
    (node.value.startswith("0") or node.value[-1] in "Ll"))
AttributeError: 'int' object has no attribute 'startswith'


The code is from a version of pupynere, trimmed to reveal the traceback.
Python 2.6.4, OS: Ubuntu 9.10 (Karmic).

----------
components: 2to3 (2.x to 3.0 conversion tool)
files: 2to3_crash.py
messages: 104518
nosy: rom16384
priority: normal
severity: normal
status: open
title: 2to3 crashes with "AttributeError: 'int' object has no attribute 'startswith'"
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file17128/2to3_crash.py

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


More information about the Python-bugs-list mailing list