[issue11730] Setting Invalid sys.stdin in interactive mode => loop forever.

2011-04-02 Thread STINNER Victor

STINNER Victor  added the comment:

I think that it is a duplicate of #8070.

--
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue8070] Infinite loop in PyRun_InteractiveLoopFlags() if PyRun_InteractiveOneFlags() raises an error

2011-04-02 Thread STINNER Victor

STINNER Victor  added the comment:

Issue #11730 has been marked as duplicate.

--

___
Python tracker 

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



[issue8070] Infinite loop in PyRun_InteractiveLoopFlags() if PyRun_InteractiveOneFlags() raises an error

2011-04-02 Thread ysj.ray

ysj.ray  added the comment:

I'd prefer not exit program but try to use Py_FileSystemDefaultEncoding as enc 
when sys.stdin is invalid. On most cases, setting sys.stdin to some other 
invalid value does means the program could not continue running.

--

___
Python tracker 

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



[issue8070] Infinite loop in PyRun_InteractiveLoopFlags() if PyRun_InteractiveOneFlags() raises an error

2011-04-02 Thread ysj.ray

ysj.ray  added the comment:

> On most cases, setting sys.stdin to some other invalid value does means the 
> program could not continue running.


Sorry, it should be:

On most cases, setting sys.stdin to some other invalid value does not mean the 
program could not continue running.

--

___
Python tracker 

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



[issue7443] test.support.unlink issue on Windows platform

2011-04-02 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

FYI: implementation of unlink already has multiple calls for unicode version to 
process symlinks. Ansi version is the simple DeleteFileA call.
Now we have different behavior for unicode and ansi variants as I can see.

Now I'm working on unlink implementations partially borrowed from cygwin as 
Martin suggested. I still not have a final patch covering all known cases. 
Perhaps I can introduce it next week.

--

___
Python tracker 

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



[issue10791] Wrapping TextIOWrapper around gzip files

2011-04-02 Thread Nadeem Vawda

Changes by Nadeem Vawda :


--
nosy: +nvawda

___
Python tracker 

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



[issue11740] difflib html diff takes extremely long

2011-04-02 Thread Filip Gruszczyński

Filip Gruszczyński  added the comment:

The culprit seems to be Differ._fancy_replace. There is a nasty quadratic loop 
there, that has pretty complex internal code. I have done a quick a fix, that 
makes example run below a second at the expense of not calling _fancy_replace 
for longer chunks and using _plain_replace instead.

Another solution for long chunks would be to split them into smaller parts and 
process separately. This way quadratic time will be smaller and we still can 
benefit from _fancy_helper logic.

--
keywords: +patch
Added file: http://bugs.python.org/file21501/11740.patch

___
Python tracker 

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



[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

Here is an updated patch that adds read1() to BZ2File. This should fix things
for issue10791 from the bz2 side. I also took the opportunity to clean up
_read_block() to be more readable. As per Martin's suggestion on python-dev, I
put the copyright notice in the patch header, rather than in the code itself.

--
Added file: http://bugs.python.org/file21502/bz2-v5.diff

___
Python tracker 

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



[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

Updated documentation.

--
Added file: http://bugs.python.org/file21503/bz2-v5-doc.diff

___
Python tracker 

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



[issue8905] difflib should accept arbitrary line iterators

2011-04-02 Thread Filip Gruszczyński

Changes by Filip Gruszczyński :


--
nosy: +gruszczy

___
Python tracker 

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



[issue6931] dreadful performance in difflib: ndiff and HtmlDiff

2011-04-02 Thread Filip Gruszczyński

Filip Gruszczyński  added the comment:

Check also this:

http://bugs.python.org/issue11740

--
nosy: +gruszczy

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2011-04-02 Thread cournapeau david

cournapeau david  added the comment:

Hi Martin,

It was nice meeting you at Pycon.

I finally took the time to set up a windows 64 bits environment, and here are 
the exact steps I needed to do to reproduce the issue, and fix it by hand:

  - Start fresh from windows 7 64 bits
  - clone python hg repository, and checkout the 2.6 branch (path referred as 
$PYTHON_ROOT from now on).
  - build python with VS 2008 pro, 64 bits (release mode)
  - install mingw-w64. I used this exact version: 
mingw-w64-1.0-bin_i686-mingw_20110328.zip (release 1.0, targetting win64 but 
running in 32 bits native mode), and unzipped it in C:¥
  - I compiled a trivial C extension in foo.c as follows:

C:\mingw-w64\bin\x86_64-w64-mingw32-gcc.exe foo.c -I $PYTHON_ROOT\Include -I 
$PYTHON_ROOT\PC -shared -o foo.pyd  $PYTHON_ROOT\PCbuild\amd64\python26.lib 
-DMS_WIN64

The patch removes the need for defining MS_WIN64. I don't know exactly the 
policies for which branch this could be applied - anything below 2.6 does not 
make much sense since most win64 users use 2.6 at least. Ideally, it could be 
backported to 2.6, 2.7 and 3.1 ?

--
nosy: +cournape

___
Python tracker 

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



[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Adam Matan

New submission from Adam Matan :

shutil.copy2(file, dest) fails when dest has unicode characters:

[2011-04-02 17:19:54 adam@adam-laptop ~/personal :) ]$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import glob
>>> import shutil
>>> files=glob.glob('*.ods')
>>> for file in files:
... shutil.copy2(file, 'א') # This works, but:
...
>>> for file in files:
... shutil.copy2(file, u'א')
... 
Traceback (most recent call last):
  File "", line 2, in 
  File "/usr/lib/python2.6/shutil.py", line 98, in copy2
dst = os.path.join(dst, os.path.basename(src))
  File "/usr/lib/python2.6/posixpath.py", line 70, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 1: ordinal 
not in range(128)


See discussion here: 
http://stackoverflow.com/questions/5523373/python-how-to-move-a-file-with-unicode-filename-to-a-unicode-folder/5523385#5523385

--
components: Extension Modules
messages: 132799
nosy: Adam.Matan
priority: normal
severity: normal
status: open
title: shutil2.copy fails with destination filenames
versions: Python 2.7

___
Python tracker 

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



[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti

Changes by Ezio Melotti :


--
components: +Library (Lib) -Extension Modules
nosy: +ezio.melotti
stage:  -> test needed
type:  -> behavior

___
Python tracker 

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



[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti

Ezio Melotti  added the comment:

The problem here is that you are mixing byte strings and unicode.
glob.glob('*.ods') returns a list of strings, so in shutil.copy2(file, 'א') you 
are passing two byte strings and everything works fine.
In shutil.copy2(file, u'א') instead, file is a byte string, and u'א' is 
unicode, so the copy fails.
If you want to use u'א', you can pass u'*.ods' to glob.glob() in order to get a 
list of unicode strings from there too.

--
resolution:  -> invalid
stage: test needed -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Adam Matan

Adam Matan  added the comment:

Don't you think that shutil should be able to handle mixed data types, for 
example byte string as file name and unicode destination directory? This is, in 
my opinion, a very common scenario.

Would you consider converting all arguments to Unicode?

--

___
Python tracker 

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



[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti

Ezio Melotti  added the comment:

I should have added that both 'א' and u'א' work as long as the file names in 
the list returned by glob() are ASCII: if u'א' is used they are simply coerced 
to unicode.
If there are non-ASCII file names in the glob() list, the copy fails because 
Python 2 tries to coerce the name to unicode decoding it implicitly with the 
'ascii' codec, and that fails.

--

___
Python tracker 

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



[issue11742] Possible bug in Python/import.c

2011-04-02 Thread Andrew Sommerville

New submission from Andrew Sommerville :

Around line 1509 in Python/import.c, function "find_module", the importer is 
trying to fail with "No module named...". It is possible for "fp" to be NULL 
and "fdp" (the return value) to be non-NULL, which callers would see as success.

Solution: add "fdp=NULL;" to this block:
if (fp == NULL) {
PyErr_Format(PyExc_ImportError,
 "No module named %.200s", name);
}

(my apologies if this is not the correct place to post...)

--
components: Interpreter Core
messages: 132803
nosy: aksommerville
priority: normal
severity: normal
status: open
title: Possible bug in Python/import.c
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue8631] subprocess.Popen.communicate(...) hangs on Windows

2011-04-02 Thread Patrick Gansterer

Patrick Gansterer  added the comment:

I can reproduce this on WinXP with 2.5, 2.7 and 3.2. On my other box (Win7 
64bit) the same code works without problems.
This problem happens only when I make a subprocess.call() to executables from 
my msysgit installation (e.g. echo, git). A call to 'notepad' or 'svn' works 
without problems.

After entering the following python does not respond to any input:
>>> import subprocess
>>> subprocess.call('echo')

--
nosy: +paroga
versions: +Python 2.5, Python 2.7, Python 3.2

___
Python tracker 

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



[issue11678] Add support for Arch Linux to platform.linux_distributions()

2011-04-02 Thread Georg Brandl

Georg Brandl  added the comment:

And we all laughed :)

--
nosy: +georg.brandl

___
Python tracker 

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



[issue10963] "subprocess" can raise OSError (EPIPE) when communicating with short-lived processes

2011-04-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I think it's best to remove all this inconsistency and fix it so that
> EPIPE is never generated and then backport it to 2.7, 3.1, 3.2.
> 
> Attached is a patch which fixes it for poll, select, windows and adds
> two tests.

The patch looks good to me.

--

___
Python tracker 

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



[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Here is an updated patch that adds read1() to BZ2File. This should fix things
> for issue10791 from the bz2 side. I also took the opportunity to clean up
> _read_block() to be more readable. As per Martin's suggestion on python-dev, I
> put the copyright notice in the patch header, rather than in the code itself.

Thank you! A couple of comments:
- please avoid C++-style comments ("// ..."), some compilers don't like
them
- BZ2Decompressor.eof would be better as a T_BOOL than a T_INT, IMO
- BZ2Decompressor.eof should be documented as new in 3.3
- instead of using PyObject_GetBuffer(), I think it's better to call
PyArg_ParseTuple with the "y*" typecode: it makes sure it does the right
thing
- instead of "int(size)", use "size = size.__index__()" so as to forbid
floats

--

___
Python tracker 

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



[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Adam Matan

Adam Matan  added the comment:

Don't you think it should be changed in Python 2.x, so that the ASCII filename 
will be automatically converted to to Unicode?

--

___
Python tracker 

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



[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti

Ezio Melotti  added the comment:

The ASCII filename is already converted to unicode, but in your case the 
program was most likely failing with some non-ASCII filename.

--

___
Python tracker 

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



[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Adam Matan

Adam Matan  added the comment:

Do you think it should be fixed at the module level?

--

___
Python tracker 

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



[issue11707] Create C version of functools.cmp_to_key()

2011-04-02 Thread Filip Gruszczyński

Filip Gruszczyński  added the comment:

Here is a patch that passes functools tests. I'll be happy to work on it 
further.

--
keywords: +patch
Added file: http://bugs.python.org/file21504/11707.patch

___
Python tracker 

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



[issue11741] shutil2.copy fails with destination filenames

2011-04-02 Thread Ezio Melotti

Ezio Melotti  added the comment:

Mixing byte and unicode strings should always be avoided, because the implicit 
coercion to unicode works only if the byte strings contains only ASCII, and 
fails otherwise.
Several modules -- including shutil, glob, and os.path -- have API that work 
with both byte and unicode strings, but fail when you mix the two:
>>> os.path.join('א', 'א')  # both byte strings -- works
'\xd7\x90/\xd7\x90'
>>> os.path.join(u'א', u'א')  # both unicode -- works
u'\u05d0/\u05d0'
>>> os.path.join('a', u'א')  # mixed, ASCII-only byte string -- works
u'a/\u05d0'

>>> os.path.join(u'א', 'א')  # mixed, non-ASCII -- fails
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/posixpath.py", line 70, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 1: ordinal 
not in range(128)
>>> os.path.join('א', u'א')  # mixed, non-ASCII -- fails
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/posixpath.py", line 70, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 0: ordinal 
not in range(128)
>>>

--

___
Python tracker 

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



[issue11282] 3.3 unittest document not kept consist with code

2011-04-02 Thread Ezio Melotti

Ezio Melotti  added the comment:

Guido decided to leave the fail* methods and assertDictContainsSubset in 3.3 
(and possibly even in the following versions), so that people moving from 2.7 
to 3.3 don't have to change their code because these methods are missing.
Since assertSameElements is not in 2.7, it can be removed in 3.3.

I will therefore backout r88451 and add back the fail* methods and 
assertDictContainsSubset.

--
nosy: +gvanrossum, rhettinger

___
Python tracker 

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



[issue11707] Create C version of functools.cmp_to_key()

2011-04-02 Thread Eric Smith

Eric Smith  added the comment:

I haven't had time to look at this in detail, but the concept appears sound. 
I'll try to devote some time to it, but hopefully someone else on 
core-mentorship with more familiarity with this code will also be able to 
review it.

One thing: You don't want to delete the pure Python version, as that can be 
used by alternate implementations. You want to leave it in place, and then 
after it try to import the C version. If the import fails, the Python version 
will be used, if it succeeds, the C version will be used. I'm reasonably sure 
there are examples of testing both implementations elsewhere in the stdlib. 
Maybe ask on core-mentorship for pointers.

Thanks for working on this!

--
nosy: +eric.smith

___
Python tracker 

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



[issue11707] Create C version of functools.cmp_to_key()

2011-04-02 Thread Filip Gruszczyński

Filip Gruszczyński  added the comment:

Ok, here is patch that keep python implementation of cmp_to_key if C version 
can't be imported.

Thanks again for you help :-)

--
Added file: http://bugs.python.org/file21505/11707_2.patch

___
Python tracker 

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



[issue11743] Rewrite PipeConnection and Connection in pure Python

2011-04-02 Thread Antoine Pitrou

New submission from Antoine Pitrou :

Here is a rewrite of multiprocessing.{PipeConnection,Connection} in pure 
Python, for ease of maintenance and improvement.

--
components: Library (Lib)
files: mpconn.patch
keywords: patch
messages: 132816
nosy: asksol, brian.curtin, jnoller, pitrou, tim.golden
priority: normal
severity: normal
stage: patch review
status: open
title: Rewrite PipeConnection and Connection in pure Python
type: feature request
versions: Python 3.3
Added file: http://bugs.python.org/file21506/mpconn.patch

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-04-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
dependencies: +Rewrite PipeConnection and Connection in pure Python

___
Python tracker 

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



[issue11707] Create C version of functools.cmp_to_key()

2011-04-02 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Nice work.  There are a few nits (dealloc and traverse need to address both 
python objects in the struct).  I will look at the patch in detail when I get a 
chance (in the next week or so).

It would be great if more tests were added (in general, C equivalents require 
more testing than their pure Python counterparts).

If you get a chance, it would be great if we could see some timings to 
demonstrate that we're getting a significant improvement (that being the 
primary motivation for the patch).

--

___
Python tracker 

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



[issue2736] datetime needs an "epoch" method

2011-04-02 Thread Ka-Ping Yee

Ka-Ping Yee  added the comment:

> no one has come up with a satisfactory solution

Plenty have proposed a satisfactory solution.  No one has come up with a 
solution that is satisfactory to *you*, because you have overconstrained the 
problem.  The reason we still have no utctotimestamp() after all these years is 
that you, and you alone as far as I know, refuse to accept a method that 
inverts utcfromtimestamp() with microsecond precision over its working range.  
Such a method is a perfectly reasonable and acceptable solution and would add a 
lot of value to Python as a language.

I suspect you don't realize just how much pain you have unintentionally caused 
the world of Python users by singlehandedly blocking progress on this issue.  
I've seen them: students, friends, coworkers -- even very smart and capable 
people are stymied by it.  No one thinks of looking in the calendar module.  
Maybe if you watched some of them struggle with this, you would understand.

> leave it as an exercise to the reader to solve

To take this perspective is to miss the point of Python.

--

___
Python tracker 

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



[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

Thanks for the review. I've made most of the changes you suggested, but there's
one thing I wanted to check about:

> - instead of "int(size)", use "size = size.__index__()" so as to forbid floats

The tests for readline() and readlines() expect a TypeError if size is None.
Calling size.__index__() in this case raises an AttributeError instead. Should I
change the tests to expect an AttributeError? Alternatively, something like this
would more closely match the behaviour of the old code:

try:
size = size.__index__()
except AttributeError:
raise TypeError("Integer argument expected")

--

___
Python tracker 

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



[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> The tests for readline() and readlines() expect a TypeError if size is None.
> Calling size.__index__() in this case raises an AttributeError instead. 
> Should I
> change the tests to expect an AttributeError? Alternatively, something like 
> this
> would more closely match the behaviour of the old code:
> 
> try:
> size = size.__index__()
> except AttributeError:
> raise TypeError("Integer argument expected")

Ah, you're right, TypeError should be raised.

--

___
Python tracker 

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



[issue10712] 2to3 fixer for deprecated unittest method names

2011-04-02 Thread Ezio Melotti

Changes by Ezio Melotti :


--
assignee:  -> ezio.melotti

___
Python tracker 

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



[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

Here's the updated patch.

--
Added file: http://bugs.python.org/file21507/bz2-v6.diff

___
Python tracker 

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



[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-04-02 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

... and the corresponding updated documentation patch.

--
Added file: http://bugs.python.org/file21508/bz2-v6-doc.diff

___
Python tracker 

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



[issue10762] strftime('%f') segfault

2011-04-02 Thread Santoso Wijaya

Santoso Wijaya  added the comment:

There does not seem to be any mention of what an ANSI behavior should be upon 
encountering a non-supported format string. Hence, perhaps, the discrepancy 
among different platforms.

--

___
Python tracker 

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



[issue10762] strftime('%f') segfault

2011-04-02 Thread Santoso Wijaya

Changes by Santoso Wijaya :


--
versions: +Python 3.3

___
Python tracker 

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



[issue10762] strftime('%f') segfault

2011-04-02 Thread Santoso Wijaya

Santoso Wijaya  added the comment:

I don't think this is a Windows "bug" per se, because the behavior is undefined 
in the standards. The burden is up to us to validate the format string inputted 
[w]strftime and currently, our code mistakenly clears "%f" as valid.

I'm attaching a patch against 2.7 branch.

--
keywords: +patch
Added file: http://bugs.python.org/file21509/issue11703.patch

___
Python tracker 

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



[issue10762] strftime('%f') segfault

2011-04-02 Thread Santoso Wijaya

Changes by Santoso Wijaya :


Removed file: http://bugs.python.org/file21509/issue11703.patch

___
Python tracker 

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



[issue10762] strftime('%f') segfault

2011-04-02 Thread Santoso Wijaya

Santoso Wijaya  added the comment:

Wrong filename. Attaching again: against 2.7 and 3.1 branches.

--
Added file: http://bugs.python.org/file21510/issue10762_py27.patch

___
Python tracker 

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



[issue10762] strftime('%f') segfault

2011-04-02 Thread Santoso Wijaya

Changes by Santoso Wijaya :


Added file: http://bugs.python.org/file21511/issue10762_py31.patch

___
Python tracker 

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



[issue11744] re.LOCALE doesn't reflect locale.setlocale(...)

2011-04-02 Thread Vlastimil Brom

New submission from Vlastimil Brom :

Hi,
I just noticed a behaviour of the re.LOCALE flag I can't understand; I first 
reported this to the new regex implementation, which, however, only mimics the 
standard lib re in this case:
http://code.google.com/p/mrab-regex-hg/issues/detail?id=6
I also couldn't find anything relevant in the tracker, other than some older, 
already fixed issues; I'm sorry, if I missed something.
I thought, the search pattern (?L)\w would match any of the respective 
string.letters according to the current locale (and possibly additionally 
[0-9_]).

However, the locale doesn't seem to be reflected in an expected way.

>>> unicode_BMP = " " + "".join(unichr(i)for i in range(1, 0x1))
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'Czech_Czech Republic.1250'
>>> import re
>>> print("".join(re.findall(r"(?L)\w", unicode_BMP)))
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzŠŒŽšœžŸ£¥ª¯³µ¹º¼¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ
>>> locale.setlocale(locale.LC_ALL, "Greek")
'Greek_Greece.1253'
>>> print("".join(re.findall(r"(?L)\w", unicode_BMP)))
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzƒ¢²³µ¸¹º¼¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ
>>> 

>>> unicode_BMP = " " + "".join(unichr(i)for i in range(1, 0x1))

>>> locale.setlocale(locale.LC_ALL, "")
'Czech_Czech Republic.1250'
>>> print unicode(string.letters, "windows-1250")
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzŠŚŤŽŹšśťžźŁĄŞŻłµąşĽľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőöřůúűüýţ
>>> locale.setlocale(locale.LC_ALL, "Greek")
'Greek_Greece.1253'
>>> print unicode(string.letters, "windows-1253")
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒΆµΈΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ
>>> 

It seems that the nearest letter set to the result of the re/regex LOCALE flags 
migt be ascii or US locale:

>>> locale.setlocale(locale.LC_ALL, "US")
'English_United States.1252'
>>> print unicode(string.letters, "windows-1252")
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ
>>> 

however, there are some differences too, namely between zƒ and À
re (?L)\w : 
Czech
zŠŒŽšœžŸ£¥ª¯³µ¹º¼¾¿À
Greek
zƒ¢²³µ¸¹º¼¾¿À
string.letters -- US locale
zƒŠŒŽšœžŸªµºÀ
(as displayed in tkinter Idle shell)
(in either case, there are some items, one wouldn't consider usual word 
characters, cf. ¿)

I am not sure whether there are no other issues (like some encoding/displaying 
peculiarities in Tkinter), but the re matching using the LOCALE flag don't 
reflect the locale.setlocale(...) in a transparent way.

Is it supposed to work this way and is there another possibility to get the 
expected locale aware matching, as one might expect according to:
http://docs.python.org/library/re.html#re.LOCALE
"""
Make \w, \W, \b, \B, \s and \S dependent on the current locale.
"""


using Python 2.7.1, 32 bit;  win 7 Home Premium 64-bit, Czech.

in Python 3.1.3 as well as 3.2 the result is the same (with the appropriately 
modified code): ...
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'Czech_Czech Republic.1250'
>>> import re
>>> print("".join(re.findall(r"(?L)\w", unicode_BMP)))
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyzŠŒŽšœžŸ£¥ª¯³µ¹º¼¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ
>>> 

However, in Python 3, there is no comparison with string.letters available 
anymore.

Regards,
Vlastimil Brom

--
components: Regular Expressions, Unicode
messages: 132826
nosy: vbr
priority: normal
severity: normal
status: open
title: re.LOCALE doesn't reflect locale.setlocale(...)
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue11744] re.LOCALE doesn't reflect locale.setlocale(...)

2011-04-02 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti, mrabarnett

___
Python tracker 

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



[issue1647489] zero-length match confuses re.finditer()

2011-04-02 Thread Denver Coneybeare

Denver Coneybeare  added the comment:

I just re-tested this issue in trunk at changeset 053bc5ca199b and the issue is 
still exactly reproducible as originally reported.  That is, the match to the 
empty string skips a character of the match:

>>> import re
>>> [m.groups() for m in re.finditer(r'(^z*)|(\w+)', 'abc')]
[('', None), (None, 'bc')]

--
nosy: +denversc

___
Python tracker 

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



[issue11745] idlelib/PyShell.py: incorrect module name reported in error message: Tkinter should be tkinter

2011-04-02 Thread Denver Coneybeare

New submission from Denver Coneybeare :

Just a very minor bug.  The error message in idlelib/PyShell.py that is printed 
when importing tkinter fails says that it failed to import "Tkinter", but the 
actual module name is "tkinter" (with a lowercase t).  

try:
from tkinter import *
except ImportError:
print("** IDLE can't import Tkinter.  " \
  "Your Python may not be configured for Tk. **", file=sys.__stderr__)

A patch is attached.

--
components: IDLE
messages: 132828
nosy: denversc
priority: normal
severity: normal
status: open
title: idlelib/PyShell.py: incorrect module name reported in error message: 
Tkinter should be tkinter
versions: Python 3.3

___
Python tracker 

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



[issue11745] idlelib/PyShell.py: incorrect module name reported in error message: Tkinter should be tkinter

2011-04-02 Thread Denver Coneybeare

Changes by Denver Coneybeare :


--
keywords: +patch
Added file: http://bugs.python.org/file21512/patch_idle_tkinter_import_v1.patch

___
Python tracker 

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



[issue11745] idlelib/PyShell.py: incorrect module name reported in error message: Tkinter should be tkinter

2011-04-02 Thread Denver Coneybeare

Changes by Denver Coneybeare :


--
type:  -> behavior

___
Python tracker 

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



[issue11745] idlelib/PyShell.py: incorrect module name reported in error message: Tkinter should be tkinter

2011-04-02 Thread Ezio Melotti

Ezio Melotti  added the comment:

I think in this case "Tkinter" refers to the "Tkinter" library, rather than the 
"tkinter" module.

--
nosy: +ezio.melotti
type: behavior -> 

___
Python tracker 

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



[issue11707] Create C version of functools.cmp_to_key()

2011-04-02 Thread Nick Coghlan

Changes by Nick Coghlan :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue11746] ssl library load_cert_chain cannot use elliptic curve type private key

2011-04-02 Thread umedoblock

New submission from umedoblock :

ssl library load_cert_chain cannot use elliptic curve type private key.

I resolved the problem, I attached patch file

--
components: Library (Lib)
files: _ssl.c.diff
keywords: patch
messages: 132830
nosy: umedoblock
priority: normal
severity: normal
status: open
title: ssl library load_cert_chain cannot use elliptic curve type private key
versions: Python 3.2
Added file: http://bugs.python.org/file21513/_ssl.c.diff

___
Python tracker 

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



[issue6501] Fatal error on startup with invalid PYTHONIOENCODING

2011-04-02 Thread Daniel Goertzen

Daniel Goertzen  added the comment:

It turns out that cx-freeze deliberately sets Py_IgnoreEnvironmentFlag to 
ensure that the final executable is really an isolated, standalone executable 
(ie, it can't be subverted by setting PYTHONPATH.)  Therefore the 
PYTHONIOENCODING work-around does not work in this situation.

I am currently using a cx-freeze work-around from the author to enable the 
PYTHONIOENCODING work-around.  Altogether not that pleasant.

Could Python 3 could just default to some reasonable encoding and keep on 
chugging?

--

___
Python tracker 

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



[issue11747] unified_diff function product incorrect range information

2011-04-02 Thread Jan Koprowski

New submission from Jan Koprowski :

Python:
---
>>> import difflib
>>> dl = difflib.unified_diff([], ['a\n', 'b\n'])
>>> print ''.join(dl),
---
+++
@@ -1,0 +1,2 @@
+a
+b

Gnu diff:
---
$diff -uN a b
--- a   1970-01-01 01:00:00.0 +0100
+++ b   2011-04-03 06:56:28.330543000 +0200
@@ -0,0 +1,2 @@
+a
+b

--
components: Library (Lib)
messages: 132832
nosy: jan.koprowski
priority: normal
severity: normal
status: open
title: unified_diff function product incorrect range information
versions: Python 2.7

___
Python tracker 

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



[issue11707] Create C version of functools.cmp_to_key()

2011-04-02 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Filip, can you please submit a contributor agreement?

http://docs.python.org/devguide/coredev.html#sign-a-contributor-agreement

--

___
Python tracker 

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