[issue13332] execfile fixer produces code that does not close the file

2011-11-03 Thread Vlada Peric

Changes by Vlada Peric :


--
nosy: +VPeric

___
Python tracker 
<http://bugs.python.org/issue13332>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12611] 2to3 crashes when converting doctest using reduce()

2011-07-22 Thread Vlada Peric

New submission from Vlada Peric :

2to3 crashes when run on a doctest which uses reduce(). This happens with both 
2.7 and 3.2's 2to3. I have the following code in a compatibility file, but even 
using that it fails with the same error: 

try:
from functools import reduce
except ImportError:
reduce = reduce

This is the traceback produced:

Traceback (most recent call last):
  File "/usr/local/bin/2to3", line 6, in 
sys.exit(main("lib2to3.fixes"))
  File "/usr/local/lib/python2.6/lib2to3/main.py", line 173, in main
options.processes)
  File "/usr/local/lib/python2.6/lib2to3/refactor.py", line 620, in refactor
items, write, doctests_only)
  File "/usr/local/lib/python2.6/lib2to3/refactor.py", line 275, in refactor
self.refactor_file(dir_or_file, write, doctests_only)
  File "/usr/local/lib/python2.6/lib2to3/refactor.py", line 661, in 
refactor_file
*args, **kwargs)
  File "/usr/local/lib/python2.6/lib2to3/refactor.py", line 321, in 
refactor_file
output = self.refactor_docstring(input, filename)
  File "/usr/local/lib/python2.6/lib2to3/refactor.py", line 500, in 
refactor_docstring
indent, filename))
  File "/usr/local/lib/python2.6/lib2to3/refactor.py", line 530, in 
refactor_doctest
assert clipped == [u"\n"] * (lineno-1), clipped
AssertionError: [u'from functools import reduce\n', u'\n', u'\n', u'\n', u'\n', 
u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', 
u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', u'\n', 
u'\n', u'\n', u'\n', u'\n', u'\n']

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 140892
nosy: VPeric
priority: normal
severity: normal
status: open
title: 2to3 crashes when converting doctest using reduce()
versions: Python 2.7, Python 3.2

___
Python tracker 
<http://bugs.python.org/issue12611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12613] itertools fixer fails

2011-07-22 Thread Vlada Peric

New submission from Vlada Peric :

The itertools fixer (izip -> zip, among others), fails for the following code:

from itertools import izip
print msg % str(bool(symbol_swapped) and list(izip(*swap_dict).next()) or 
symbols)

It gets converted to:

print(msg % str(bool(symbol_swapped) and list(next(izip(*swap_dict))) or 
symbols))

(note how izip is still there)

I've worked aroudn this by introducing tmp = izip(...) and using that, but it'd 
be nice if 2to3 caught it by default.

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 140897
nosy: VPeric
priority: normal
severity: normal
status: open
title: itertools fixer fails
versions: Python 2.7, Python 3.2

___
Python tracker 
<http://bugs.python.org/issue12613>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12616] zip fixer fails on zip()[:-1]

2011-07-22 Thread Vlada Peric

New submission from Vlada Peric :

The zip fixer fails on this code:

zip(B, D)[:-1]

I fixed this by wrapping explicitly with list(), but that creates a duplicate 
list on Python 2. 

(Like the other fixes I reported, I assume this also applies to 3.3, but I 
didn't test it so I don't know; adding Eric and Benjamin to nosy, though)

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 140919
nosy: VPeric, benjamin.peterson, eric.araujo
priority: normal
severity: normal
status: open
title: zip fixer fails on zip()[:-1]
versions: Python 2.7, Python 3.2

___
Python tracker 
<http://bugs.python.org/issue12616>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12611] 2to3 crashes when converting doctest using reduce()

2011-08-02 Thread Vlada Peric

Vlada Peric  added the comment:

Confirmed with the file Aaron linked to. I'm using "2to3-3.2 -w -n -d 
sympy/ntheory/factor_.py". This is what Python says about itself:

Python 3.2 (r32:88445, Jun  8 2011, 16:34:06) 
[GCC 4.5.1 20101208 [gcc-4_5-branch revision 167585]] on linux2

--
status: pending -> open

___
Python tracker 
<http://bugs.python.org/issue12611>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12771] 2to3 -d adds extra whitespace

2011-08-17 Thread Vlada Peric

New submission from Vlada Peric :

When running 2to3 -d on this doctest (from this file[0] in SymPy):

>>> class SzUpKet(Ket):
... def _represent_SzOp(self, basis, **options):
... return Matrix([1,0])
...

2to3 adds an extra space in the last line. This then raises an error for our 
automated whitespace tests (and is generally annoying). I haven't seen this 
happen anywhere else (and SymPy is a big codebase). 

It's really a minor issue, though (I can't set the priority myself, though).

[0] 
https://github.com/sympy/sympy/blob/master/sympy/physics/quantum/represent.py

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 142281
nosy: Aaron.Meurer, VPeric
priority: normal
severity: normal
status: open
title: 2to3 -d adds extra whitespace
versions: Python 2.7, Python 3.2

___
Python tracker 
<http://bugs.python.org/issue12771>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12942] Shebang line fixer for 2to3

2011-09-10 Thread Vlada Peric

Changes by Vlada Peric :


--
nosy: +VPeric

___
Python tracker 
<http://bugs.python.org/issue12942>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6668] locale.py: can't parse sr...@latin locale

2009-08-07 Thread Vlada Peric

New submission from Vlada Peric :

The sr_RS locale in glibc corresponds to the Cyrillic script, while the 
agreed upon locale for the Latin alphabet is sr...@latin. Unfortunately, 
the locale python module crashes when trying to parse this locale. Here 
is the traceback:

File "/usr/lib/python2.6/locale.py", line 497, in get locale
  return _parse_localename(localename)
File "usr/lib/python2.6/locale.py", line 410, in _parse_localename
  raise ValueError, 'unknown locale: %s' % localename

Looking at the code, it only checks for the @euro modifier and ignores 
all other modifiers (including @latin). This is all when I set 
lang=sr...@latin. If I use lang=sr_rs.u...@latin (also allowed by 
glibc), Python interprets this as the sr_RS locale (which is wrong, as 
that is for Cyrillic).

--
components: Unicode
messages: 91404
nosy: VPeric
severity: normal
status: open
title: locale.py: can't parse sr...@latin locale
type: crash
versions: Python 2.6

___
Python tracker 
<http://bugs.python.org/issue6668>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com