[issue7643] What is a Unicode line break character?

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

I don't know what to do about this:

>  - FS, GS, RS are combined marks (CM): “Prohibit a line break between
>the character and the preceding character”

I know they are not commonly used. So we can keep them as line breaks.
But if we comply strictly with UAX 14 we do not consider them as line breaks.

--
components: +Unicode
title: What is an ASCII linebreak? -> What is a Unicode line break character?

___
Python tracker 

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



[issue7582] [patch] diff.py to use iso timestamp

2010-01-10 Thread anatoly techtonik

anatoly techtonik  added the comment:

Brian, documentation says quite the opposite.

time.daylight
Nonzero if a DST timezone is defined.
http://docs.python.org/library/time.html?highlight=daylight#time.daylight

--

___
Python tracker 

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



[issue7664] python logger does not handle IOError Exception

2010-01-10 Thread Yateen V. Joshi

New submission from Yateen V. Joshi :

I am running an in house application that uses multiprocessing logger. 
This application ftp's files from a remote host and keep them on a local
disk. Here is the scenario - 
While pulling the files, I make the local disk full (100%). The application 
hangs, it can not log further. Apart from other exceptions, following are 
prominent ones. If I further create cleanup the disk, the application does not 
proceed. It 
remains hung. I have to restart the application. 

  File 
"/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py",
 line 1059, in error
self._log(ERROR, msg, args, **kwargs)
  File 
"/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py",
 line 1141, in _log
self.handle(record)
  File 
"/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py",
 line 1151, in handle
self.callHandlers(record)
  File 
"/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py",
 line 1188, in callHandlers
hdlr.handle(record)
  File 
"/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py",
 line 671, in handle
self.release()
  File "build/bdist.solaris-2.10-sun4u/egg/cloghandler.py", line 189, in release
self.stream.flush()


I tried looking into the logging module's code and could not find IOError 
exception handling there. After going through
various situations, and trial-errors (I am not a python Guru), I found 
following fix working - 
method handle(record), file logging/__init__.py, line#670
original code - 
rv = self.filter(record)
if rv:
self.acquire()
try:
self.emit(record)
finally:
self.release()
 
return rv

Modified code - 
rv = self.filter(record)
if rv:
self.acquire()
try:
self.emit(record)
finally:
try:
  self.release()
except (IOError, OSError):
  pass
return rv

What this tells is if there is an error in locks handling, simply leave it and 
proceed. With this fix, when the disk is 
cleaned up, application proceeds properly. 

What I want to know if this is an appropriate fix? Can I go ahead with it?

Thanks,
Yateen..

--
components: Extension Modules
messages: 97504
nosy: yateenjoshi
severity: normal
status: open
title: python logger does not handle IOError Exception
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue6965] tmpnam should not be used if tempfile or mkstemp are available

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

I get similar warnings while building on Debian AMD64:

(...)
libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
./Modules/posixmodule.c:7193: warning: the use of `tmpnam_r' is dangerous, 
better use `mkstemp'
libpython2.7.a(posixmodule.o): In function `posix_tempnam':
./Modules/posixmodule.c:7148: warning: the use of `tempnam' is dangerous, 
better use `mkstemp'
(...)

--
nosy: +flox

___
Python tracker 

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



[issue2973] _ssl compiler warnings

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

Still occurs on dev and py3k.
And patch applies correctly.

--
nosy: +flox
versions:  -Python 3.0

___
Python tracker 

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



[issue6965] tmpnam should not be used if tempfile or mkstemp are available

2010-01-10 Thread Florent Xicluna

Changes by Florent Xicluna :


--
type:  -> compile error

___
Python tracker 

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



[issue2973] _ssl compiler warnings

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

It occurs on Debian Lenny AMD64.

--

___
Python tracker 

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



[issue6965] tmpnam should not be used if tempfile or mkstemp are available

2010-01-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

The os.tmpnam and os.tempnam functions are already removed from Python 3.x:  
see issue 1318 for the discussion leading to that removal.  I don't see a way 
to remove them from 2.7 without breaking backwards compatibility.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue7662] time.utcoffset()

2010-01-10 Thread anatoly techtonik

anatoly techtonik  added the comment:

Answered in msg97503

In the meanwhile it looks like another proposal about RFC format in issue #7584 
doesn't account for proper timezone too.

--

___
Python tracker 

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



[issue6965] tmpnam should not be used if tempfile or mkstemp are available

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

Then close it as duplicate of issue486434, which was closed for the same reason.

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



[issue7532] Extended slicing with classic class behaves strangely

2010-01-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks!  Applied in r77408.

--
status: open -> closed

___
Python tracker 

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2010-01-10 Thread Mark Dickinson

Changes by Mark Dickinson :


--
priority: low -> normal

___
Python tracker 

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



[issue7661] compiling ctypes fails with non-ascii path

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

Patch attached.

--
keywords: +patch
nosy: +flox
stage: needs patch -> patch review
versions: +Python 3.2
Added file: http://bugs.python.org/file15815/issue7661_ctypes_path.diff

___
Python tracker 

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



[issue7661] compiling ctypes fails with non-ascii path

2010-01-10 Thread Florent Xicluna

Changes by Florent Xicluna :


--
components: +Build, ctypes

___
Python tracker 

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



[issue7661] compiling ctypes fails with non-ascii path

2010-01-10 Thread Florent Xicluna

Changes by Florent Xicluna :


Removed file: http://bugs.python.org/file15815/issue7661_ctypes_path.diff

___
Python tracker 

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



[issue7661] compiling ctypes fails with non-ascii path

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

Fixed typo in previous patch.

--
Added file: http://bugs.python.org/file15816/issue7661_ctypes_path.diff

___
Python tracker 

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



[issue7664] python logger does not handle IOError Exception

2010-01-10 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +vinay.sajip
priority:  -> normal
stage:  -> test needed

___
Python tracker 

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



[issue5683] Speed up cPickle's pickling generally

2010-01-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

There were a couple of comments on the Rietveld code review above.

--

___
Python tracker 

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



[issue5683] Speed up cPickle's pickling generally

2010-01-10 Thread Skip Montanaro

Skip Montanaro  added the comment:

Antoine> There were a couple of comments on the Rietveld code review
Antoine> above.

Indeed there are.  Given that the Unladen Swallow folks were focusing on the
2.6 branch and their goal was to improve performance I don't see any reason
to not accept what they've done, then tweak it for 2.7/3.1 assuming the
changes you and Alexandre suggested further improve performance.

Skip

--

___
Python tracker 

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



[issue5683] Speed up cPickle's pickling generally

2010-01-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Indeed there are.  Given that the Unladen Swallow folks were focusing on the
> 2.6 branch and their goal was to improve performance I don't see any reason
> to not accept what they've done, then tweak it for 2.7/3.1 assuming the
> changes you and Alexandre suggested further improve performance.

The main thing I'm worried about is the potentially unbounded buffering,
since it could reduce performance (or even thrash the machine) instead
of improving it.

--

___
Python tracker 

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



[issue5683] Speed up cPickle's pickling generally

2010-01-10 Thread Skip Montanaro

Skip Montanaro  added the comment:

Antoine> The main thing I'm worried about is the potentially unbounded
Antoine> buffering, since it could reduce performance (or even thrash
Antoine> the machine) instead of improving it.

Got a test case in mind?  If so, I'll code it up and compare 2.6 and Unladen
Swallow as well as offer it up for inclusion in the U-S test suite.

S

--

___
Python tracker 

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



[issue5683] Speed up cPickle's pickling generally

2010-01-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Got a test case in mind?  If so, I'll code it up and compare 2.6 and Unladen
> Swallow as well as offer it up for inclusion in the U-S test suite.

Trying to pickle a structure that's larger than half the RAM should do
the trick. Something like a list of large strings.

--

___
Python tracker 

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



[issue7661] compiling ctypes fails with non-ascii path

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

It fails if path contains space, too.

Additional patch fixes this case.

--
Added file: http://bugs.python.org/file15817/issue7661_ctypes_path_space.diff

___
Python tracker 

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



[issue5683] Speed up cPickle's pickling generally

2010-01-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Quick test on a 3GB machine:

Without patch ("top" shows the process reaches 1.2GB RAM max):

$ time ./python -c "import cPickle;l=['a'*1024 for i in 
xrange(100)];cPickle.dump(l, open('/dev/null', 'wb'))"
10.67user 1.47system 0:12.92elapsed 93%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+319042minor)pagefaults 0swaps

With the patch, the same command quickly swaps hopelessly and after 5 minutes 
of elapsed time I finally manage to kill the process.

--

___
Python tracker 

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



[issue7661] compiling ctypes fails with non-ascii path

2010-01-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The patch looks ok to me. Thomas, do you have any take on this?

--

___
Python tracker 

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



[issue7665] test_urllib2 fails if path contains "\"

2010-01-10 Thread Florent Xicluna

New submission from Florent Xicluna :

/tmp/py2u… → un\icode $ ./python Lib/test/regrtest.py test_urllib2
test_urllib2
test test_urllib2 failed -- Traceback (most recent call last):
  File "/tmp/py2u… → un\icode/Lib/test/test_urllib2.py", line 36, in 
test_trivial
f = urllib2.urlopen(file_url)
  File "/tmp/py2u… → un\icode/Lib/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
  File "/tmp/py2u… → un\icode/Lib/urllib2.py", line 391, in open
response = self._open(req, data)
  File "/tmp/py2u… → un\icode/Lib/urllib2.py", line 409, in _open
'_open', req)
  File "/tmp/py2u… → un\icode/Lib/urllib2.py", line 369, in _call_chain
result = func(*args)
  File "/tmp/py2u… → un\icode/Lib/urllib2.py", line 1260, in file_open
return self.open_local_file(req)
  File "/tmp/py2u… → un\icode/Lib/urllib2.py", line 1297, in open_local_file
raise URLError(msg)
URLError: 

1 test failed:
test_urllib2

--
components: Tests
messages: 97522
nosy: flox
severity: normal
status: open
title: test_urllib2 fails if path contains "\"
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



[issue7663] UTF-16 build incorrectly translates cases for non-BMP code points

2010-01-10 Thread Ezio Melotti

Changes by Ezio Melotti :


--
components: +Unicode
nosy: +amaury.forgeotdarc, ezio.melotti, loewis
priority:  -> normal
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



[issue7665] test_urllib2 fails if path contains "\"

2010-01-10 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti, orsenthil
priority:  -> normal
stage:  -> needs patch

___
Python tracker 

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



[issue6854] UnicodeDecodeError when retrieving binary data from cgi.FieldStorage()

2010-01-10 Thread R. David Murray

R. David Murray  added the comment:

This appears to be a duplicate of issue 4953.

--
nosy: +r.david.murray
priority:  -> normal
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> cgi module cannot handle POST with multipart/form-data in 3.0

___
Python tracker 

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

One more incorrectly rounded result, this time for a normal number:

AssertionError: Incorrectly rounded str->float conversion for 
4487665465554760717039532578546e-47: expected 
0x1.0p+0, got 0x1.fp-1

--

___
Python tracker 

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



[issue7666] test_lib2to3 fails if path contains space

2010-01-10 Thread Florent Xicluna

New submission from Florent Xicluna :

test_lib2to3
diff: opérande supplémentaire « unicode/Lib/lib2to3/pytree.py »
diff: Pour en savoir davantage, faites: « diff --help ».
test test_lib2to3 failed -- Traceback (most recent call last):
  File "/tmp/py2u… → un\icode/Lib/lib2to3/tests/test_parser.py", line 164, in 
test_all_project_files
self.fail("Idempotency failed: %s" % filepath)
AssertionError: Idempotency failed: /tmp/py2u… → un\icode/Lib/lib2to3/pytree.py


Patch attached.

--
components: Tests
files: lib2to3_path_with_space.py
messages: 97525
nosy: flox
severity: normal
stage: patch review
status: open
title: test_lib2to3 fails if path contains space
type: behavior
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file15818/lib2to3_path_with_space.py

___
Python tracker 

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



[issue7648] test_urllib2 fails on Windows if not run from C:

2010-01-10 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Fixed in revision 77411 for trunk. Will merge it to other branches.

--
versions: +Python 2.6, 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



[issue7648] test_urllib2 fails on Windows if not run from C:

2010-01-10 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
resolution:  -> fixed

___
Python tracker 

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



[issue7665] test_urllib2 and test_ntpath fail if path contains "\"

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

Similar issue with test_ntpath.

/tmp/py2u… → un\icode $ ./python Lib/test/regrtest.py test_ntpath
test_ntpath
test test_ntpath failed -- Traceback (most recent call last):
  File "/tmp/py2u… → un\icode/Lib/test/test_ntpath.py", line 171, in 
test_relpath
tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a')
  File "/tmp/py2u… → un\icode/Lib/test/test_ntpath.py", line 13, in tester
%(str(fn), str(wantResult), str(gotResult))
TestFailed: ntpath.relpath("a", "../b") should return: ..\py2u… → un\icode\a 
but returned: ..\icode\a

1 test failed:
test_ntpath

--
title: test_urllib2 fails if path contains "\" -> test_urllib2 and test_ntpath 
fail if path contains "\"

___
Python tracker 

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



[issue7119] email: msg.items() returns different values before and after msg.as_string()

2010-01-10 Thread R. David Murray

R. David Murray  added the comment:

Applied in r77412, with ie and eg changed to 'for example'.

--
resolution:  -> fixed
stage: patch review -> 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



[issue7663] UCS4 build incorrectly translates cases for non-BMP code points

2010-01-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

This is a duplicate of http://bugs.python.org/issue5127

--
nosy: +lemburg
resolution:  -> duplicate
status: open -> closed
title: UTF-16 build incorrectly translates cases for non-BMP code points -> 
UCS4 build incorrectly translates cases for non-BMP code points

___
Python tracker 

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



[issue7648] test_urllib2 fails on Windows if not run from C:

2010-01-10 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

merged it in other branches: r77413,r77414,r77415.
This fixes the errors in test_trivial tests. Verified on windows.

--
assignee:  -> orsenthil
status: open -> closed

___
Python tracker 

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



[issue5127] Use Py_UCS4 instead of Py_UNICODE in unicodectype.c

2010-01-10 Thread Ezio Melotti

Changes by Ezio Melotti :


--
superseder:  -> UCS4 build incorrectly translates cases for non-BMP code points

___
Python tracker 

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



[issue7643] What is a Unicode line break character?

2010-01-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Florent Xicluna wrote:
> 
> Florent Xicluna  added the comment:
> 
> I don't know what to do about this:
> 
>>  - FS, GS, RS are combined marks (CM): “Prohibit a line break between
>>the character and the preceding character”
> 
> I know they are not commonly used. So we can keep them as line breaks.
> But if we comply strictly with UAX 14 we do not consider them as line breaks.

Right. The only update we'd have to do is add FF and VT.

I am a little worried about the possible breakage this may cause,
though. E.g. if you look at a file with FFs in Emacs, the FFs don't
show up as line breaks. FFs in CSV files are currently also not regarded
as line breaks and thus don't need to be placed in quotes.

VTs are probably a non-issue, since they are not in common use.

--

___
Python tracker 

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



[issue7665] test_urllib2 and test_ntpath fail if path contains "\"

2010-01-10 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
assignee:  -> orsenthil

___
Python tracker 

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



[issue7648] test_urllib2 fails on Windows if not run from C:

2010-01-10 Thread Austin English

Austin English  added the comment:

Woohoo, thanks!

--

___
Python tracker 

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



[issue7667] test_doctest fails with non-ascii path

2010-01-10 Thread Florent Xicluna

New submission from Florent Xicluna :

/tmp/py2u…→unicode $ ./python Lib/test/regrtest.py test_doctest
test_doctest
**
File "/tmp/py2u…→unicode/Lib/test/test_doctest.py", line 2052, in 
test.test_doctest.test_DocFileSuite
Failed example:
suite.run(unittest.TestResult())
Expected:

Got:

**
1 items had failures:
   1 of  40 in test.test_doctest.test_DocFileSuite
***Test Failed*** 1 failures.
test test_doctest failed -- 1 of 421 doctests failed

1 test failed:
test_doctest

--
components: Tests
messages: 97533
nosy: flox
severity: normal
status: open
title: test_doctest fails with non-ascii path
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



[issue7648] test_urllib2 fails on Windows if not run from C:

2010-01-10 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Just a Note: test_file in py26 had problems with multiple ips in this scenario 
(execute test.test_urllib2 from different drive in windows), but not in the 
py3k version. I need to verify it py26-maint/trunk.

--

___
Python tracker 

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



[issue5127] Use Py_UCS4 instead of Py_UNICODE in unicodectype.c

2010-01-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Amaury Forgeot d'Arc wrote:
> 
> Amaury Forgeot d'Arc  added the comment:
> 
>> I don't see the point in changing the various conversion APIs in the
>> unicode database to return Py_UCS4 when there are no conversions that
>> map code points between BMP and non-BMP.
> 
> For consistency: if Py_UNICODE_ISPRINTABLE is changed to take Py_UCS4, 
> Py_UNICODE_TOLOWER should also take Py_UCS4, and must return the same type.
> 
>> In order to solve the problem in question (unicode_repr() failing), 
>> we should change the various property checking APIs to accept Py_UCS4
>> input data. This needlessly increases the type database size without
>> real benefit.
> [I'm not sure to understand. For me the 'real benefit' is that it solves the 
> problem in question.]

The problem in question is already solved by just changing the property
checking APIs. Changing the conversion APIs fixes a non-problem, since there
are no mappings that would require Py_UCS4 on a UCS2 build.

> Yes this increases the type database: there are 300 more "case" statements in 
> _PyUnicode_ToNumeric(), and the PyUnicode_TypeRecords array needs 1068 more 
> bytes.
> On Windows, VS9.0 release build, unicodectype.obj grows from 86Kb to 94Kb; 
> python32.dll is exactly 1.5Kb larger (from 2219Kb to 2221.5Kb);
> the memory usage of the just-started interpreter is about 32K larger (around 
> 5M).  These look reasonable figures to me.
> 
>> For that to work properly we'll have to either make sure that
>> extensions get recompiled if they use these changed APIs, or we
>> provide an additional set of UCS2 APIs that extend the Py_UNICODE
>> input value to a Py_UCS4 value before calling the underlying Py_UCS4
>> API.
> 
> Extensions that use these changed APIs need to be recompiled, or they won't 
> load: existing modules link with symbols like _PyUnicodeUCS2_IsPrintable, 
> when the future interpreter will define _PyUnicode_IsPrintable.

Hmm, that's a good point.

OK, you got me convinced: let's go for it then.

--

___
Python tracker 

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



[issue7668] test_httpservers fails with non-ascii path

2010-01-10 Thread Florent Xicluna

New submission from Florent Xicluna :

/tmp/py2u…→unicode $ ./python Lib/test/regrtest.py test_httpservers
test_httpservers
  File "/tmp/tmplX9agF/cgi-bin/file1.py", line 1
SyntaxError: Non-ASCII character '\xe2' in file /tmp/tmplX9agF/cgi-bin/file1.py 
on line 1, but no encoding declared; see 
http://www.python.org/peps/pep-0263.html for details
[17270 refs]
  File "/tmp/tmpVDMVU4/cgi-bin/file1.py", line 1
SyntaxError: Non-ASCII character '\xe2' in file /tmp/tmpVDMVU4/cgi-bin/file1.py 
on line 1, but no encoding declared; see 
http://www.python.org/peps/pep-0263.html for details
[17270 refs]
  File "/tmp/tmpAh6jTS/cgi-bin/file1.py", line 1
SyntaxError: Non-ASCII character '\xe2' in file /tmp/tmpAh6jTS/cgi-bin/file1.py 
on line 1, but no encoding declared; see 
http://www.python.org/peps/pep-0263.html for details
[17270 refs]
  File "/tmp/tmpLPF9CV/cgi-bin/file2.py", line 1
SyntaxError: Non-ASCII character '\xe2' in file /tmp/tmpLPF9CV/cgi-bin/file2.py 
on line 1, but no encoding declared; see 
http://www.python.org/peps/pep-0263.html for details
[17270 refs]
test test_httpservers failed -- multiple errors occurred; run in verbose mode 
for details

1 test failed:
test_httpservers

--
components: Tests
messages: 97536
nosy: flox
severity: normal
status: open
title: test_httpservers fails with non-ascii path
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



[issue7669] test_unicode_file fails with non-ascii path

2010-01-10 Thread Florent Xicluna

New submission from Florent Xicluna :

/tmp/py2u…→unicode $ ./python Lib/test/regrtest.py test_unicode_file
test_unicode_file
test test_unicode_file failed -- Traceback (most recent call last):
  File "/tmp/py2u…→unicode/Lib/test/test_unicode_file.py", line 173, in 
test_single_files
self._test_single(TESTFN_UNICODE)
  File "/tmp/py2u…→unicode/Lib/test/test_unicode_file.py", line 147, in 
_test_single
self._do_single(filename)
  File "/tmp/py2u…→unicode/Lib/test/test_unicode_file.py", line 48, in 
_do_single
self.assertTrue(os.path.exists(os.path.abspath(filename)))
  File "/tmp/py2u…→unicode/Lib/posixpath.py", line 338, in abspath
path = join(os.getcwd(), path)
  File "/tmp/py2u…→unicode/Lib/posixpath.py", line 70, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 29: 
ordinal not in range(128)

1 test failed:
test_unicode_file

--
components: Tests
messages: 97537
nosy: flox
severity: normal
status: open
title: test_unicode_file fails with non-ascii path
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



[issue7670] _sqlite3: Block *all* operations on a closed Connection object

2010-01-10 Thread STINNER Victor

New submission from STINNER Victor :

Add call to pysqlite_check_connection() on the follow methods:

 * create_function()
 * create_aggregate()
 * set_authorizer()
 * set_progress_handler()
 * __call__()

Eg. fix the following segfault:

   c = Connection("test")
   c.close()
   c.set_authorizer(func)

The patch includes unit tests to test all methods on a closed connection.

sqlite3 already raises an error for some operations on a closed socket (eg. 
connection.commit()), but not on all operations.

--
components: Extension Modules
files: sqlite_closed.patch
keywords: patch
messages: 97538
nosy: haypo
severity: normal
status: open
title: _sqlite3: Block *all* operations on a closed Connection object
type: crash
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file15819/sqlite_closed.patch

___
Python tracker 

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



[issue7582] [patch] diff.py to use iso timestamp

2010-01-10 Thread Brian Curtin

Brian Curtin  added the comment:

The documentation could use some work. It means that if the timezone does use a 
daylight savings time period, time.daylight specifies the amount of the offset. 
In my timezone this value is 1. However, time.localtime().is_dst is currently 
0, because we are not on savings time.

For that reason, using time.daylight in your patch gives an incorrect result 
for me.

--

___
Python tracker 

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



[issue7582] [patch] diff.py to use iso timestamp

2010-01-10 Thread Brian Curtin

Brian Curtin  added the comment:

http://msdn.microsoft.com/en-us/library/2t504ch6%28VS.80%29.aspx has some info 
for how this is implemented on Windows, and I get the same results on my Mac. 

On Linux an AttributeError is raised time.struct_time not having an attribute 
is_dst, and time.daylight matches the other two platforms.

--

___
Python tracker 

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



[issue7661] compiling ctypes fails with non-ascii path

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

Updated: added quotes on line 2319.

--
Added file: http://bugs.python.org/file15820/issue7661_ctypes_path_space.diff

___
Python tracker 

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



[issue7661] compiling ctypes fails with non-ascii path

2010-01-10 Thread Florent Xicluna

Changes by Florent Xicluna :


Removed file: http://bugs.python.org/file15817/issue7661_ctypes_path_space.diff

___
Python tracker 

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



[issue7664] python logger does not handle IOError Exception

2010-01-10 Thread Vinay Sajip

Vinay Sajip  added the comment:

Please clarify exsctly what you mean by "multiprocessing logger". Note that 
logging does not support logging to the same file from concurrent processes 
(threads *are* supported). See

http://docs.python.org/library/logging.html#logging-to-a-single-file-from-multiple-processes

for more information.

Also, I don't believe your fix is appropriate for the core logging module, and 
it's not clear to me why a lock failure would occur if the disk was full. It 
might be that way on Solaris (don't have use of a Solaris box), but not in 
general. In fact, this appears from your stack trace to be a problem in some 
custom handler you are using (defined in the file cloghandler.py on your 
system).

In any event, if you believe you can recover from the error, the right thing to 
do is to subclass the file handler you are using and override its handleError 
method to attempt recovery.

Did you post this problem on comp.lang.python? There are bound to be other 
Solaris users there who may be able to reproduce your problem and/or give you 
more advice about it.

Closing, as this is not a logging bug AFAICT.

--
assignee:  -> vinay.sajip
resolution:  -> invalid
stage: test needed -> 
status: open -> closed

___
Python tracker 

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



[issue7671] test_popen fails if path contains semi-colon ";"

2010-01-10 Thread Florent Xicluna

New submission from Florent Xicluna :

/tmp/semi;colon $ ./python -3 Lib/test/regrtest.py test_popen
test_popen
sh: /tmp/semi: Aucun fichier ou répertoire de ce type
sh: colon/python: Aucun fichier ou répertoire de ce type
test test_popen failed -- Traceback (most recent call last):
  File "/tmp/semi;colon/Lib/test/test_popen.py", line 31, in test_popen
["foo", "bar"]
  File "/tmp/semi;colon/Lib/test/test_popen.py", line 24, in 
_do_test_commandline
got = eval(data)[1:] # strip off argv[0]
  File "", line 0

   ^
SyntaxError: unexpected EOF while parsing

1 test failed:
test_popen

--
components: Tests
messages: 97543
nosy: flox
severity: normal
status: open
title: test_popen fails if path contains semi-colon ";"
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



[issue7670] _sqlite3: Block *all* operations on a closed Connection object

2010-01-10 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
assignee:  -> ghaering
nosy: +ghaering
stage:  -> patch review

___
Python tracker 

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-10 Thread Tim Peters

Tim Peters  added the comment:

Showing once again that a proof of FP code correctness is about as compelling 
as a proof of God's ontological status ;-)

Still, have to express surprised admiration for 
4487665465554760717039532578546e-47!  That one's not even close 
to being a "hard" case.

--
nosy: +tim_one

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-01-10 Thread Adam Olsen

Adam Olsen  added the comment:

Points against the subclassing argument:

* We have a null-termination invariant.  For byte strings this was part of the 
public API, and I'm not sure that's changed for unicode strings; aren't you 
arguing that we should maximize how much of our implementation is a public API? 
 This prevents lazy slicing.

* UTF-16 and UTF-32 are rarely used encodings, especially for longer strings 
(ie files).  For shorter strings (APIs) the unicode object overhead is more 
significant and we'd need a way to slave to the buffer's lifetime to that of 
the unicode object (hard to do).  For longer strings UTF-8 would be much more 
useful, but that's been shot down before.

* subclassing unicode so you can change the meaning of the fields (ie 
allocating your own buffer) is a gross hack.  It relies far too much on fine 
details of the implementation and is fragile (what if you miss the dummy byte 
needed by fastsearch?)  Most of the possible options could be, if they function 
correctly, applied directly to the basetype as a patch, so it's moot.

* If you dislike PyVarObject in general (I think the API is ugly too) you 
should argue for a general policy discouraging future use of it, not just get 
in the way of the one place where it's most appropriate

Terry: PyVarObjects would be much easier to subclass if the type object stored 
an offset to the beginning of the variable section, so it could be 
automatically recalculated for subclasses based on the size of the struct.  
This'd mean the PyBytesObject struct would no longer end with a char 
ob_sval[1].  The down side is a tiny bit more math when accessing the variable 
section (as the offset is no longer constant).

--
nosy: +Rhamphoryncus

___
Python tracker 

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



[issue7582] [patch] diff.py to use iso timestamp

2010-01-10 Thread Brian Curtin

Brian Curtin  added the comment:

Whoops, nevermind the Linux comment on that last one. My typo there caused the 
exception. The result there is the same as the other platforms.

--

___
Python tracker 

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



[issue7671] test_popen fails if path contains special char like ";"

2010-01-10 Thread Florent Xicluna

Florent Xicluna  added the comment:

Patch attached.

--
keywords: +patch
stage:  -> patch review
title: test_popen fails if path contains semi-colon ";" -> test_popen fails if 
path contains special char like ";"
Added file: http://bugs.python.org/file15821/issue7671_test_popen.diff

___
Python tracker 

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



[issue7610] Cannot use both read and readline method in same ZipExtFile object

2010-01-10 Thread Nir Aides

Nir Aides  added the comment:

If the sequence of readaheads is ['a\r', '\nb\n'], the first use of the pattern 
will consume 'a', then the peek(2) will trigger a read() and the next use of 
the pattern will consume '\r\n'.

I updated the patch and enhanced a little the inline comments to clear this up 
and added the suggested test.

I also ventured into a rewrite of the read() function since it seems to contain 
various latent bugs / problems, probably the result of ages of slow 
refactoring. For example, decompressor flush() depends on self.eof flag which 
is never set and the decrypter is fed by the raw buffer which is in turn set by 
the decompresser, thus theoretically feeding decrypted data back to the 
decrypter.

I also made it completely buffered so now small reads are significantly faster.

If this patch is good, i'll prepare a patch for python 3.x and 2.6

--
Added file: http://bugs.python.org/file15822/zipfile_7610_py27.diff

___
Python tracker 

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



[issue7671] test_popen fails if path contains special char like ";"

2010-01-10 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r77420.

--
nosy: +benjamin.peterson
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue7666] test_lib2to3 fails if path contains space

2010-01-10 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r77419.

--
nosy: +benjamin.peterson
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue7672] _ssl module causes segfault

2010-01-10 Thread Sean Soria

New submission from Sean Soria :

I seem to have a rather unique setup that causes this crash to be 100% 
reproducible. My application embeds python in order to execute user code. It is 
constantly loading and unloading the libraries so that they're only in memory 
during execution of user code. The problem I'm seeing is with the calls to 
CRYPTO_set_locking_callback and CRYPTO_set_id_callback in _setup_ssl_threads in 
_ssl.c. These calls will override whatever callbacks my application has already 
set up, and then when we unload python, callbacks are never restored. When my 
application later makes an SSL call that requires use of locking_callback or 
id_callback, it will attempt to call one of the functions in _ssl.so address 
space. Since nothing is there, this causes the program to crash. Worse yet 
would be if something were loaded into the same address space and arbitrary 
code were executed (though I don't see how malicious code could be executed in 
this way).

I haven't confirmed with other version of Python, but this was discovered while 
upgrading the embedded version from 2.4.5 to 2.6.4, so it's very likely to 
exist in many other version since the code was put in place in 2007.

--
components: Extension Modules
messages: 97551
nosy: janssen, ssoria
severity: normal
status: open
title: _ssl module causes segfault
type: crash
versions: Python 2.6

___
Python tracker 

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



[issue7632] dtoa.c: oversize b in quorem

2010-01-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

> Showing once again that a proof of FP code correctness is about as
> compelling as a proof of God's ontological status ;-)

Clearly we need a 1000-page Isabelle/HOL-style machine-checked formal proof, 
rather than a ten-page TeX proof.  Any takers?

All of the above bugs seem to have been introduced with the new 'bigcomp' code 
that arrived on March 16, 2009, just a couple of weeks before I downloaded the 
version that got adapted for Python;  in retrospect, I probably should have 
used the NO_STRTOD_BIGCOMP #define to bypass the new code.

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-01-10 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Adam Olsen wrote:
> 
> Adam Olsen  added the comment:
> 
> Points against the subclassing argument:
> 
> * We have a null-termination invariant.  For byte strings this was part of 
> the public API, and I'm not sure that's changed for unicode strings; aren't 
> you arguing that we should maximize how much of our implementation is a 
> public API?  This prevents lazy slicing.

Base type Unicode buffers end with a null-Py_UNICODE termination,
but this is not used anywhere, AFAIK. We could probably remove
that overallocation at some point.

There's no such thing as a null-termination invariant for Unicode.

> * subclassing unicode so you can change the meaning of the fields (ie 
> allocating your own buffer) is a gross hack.  It relies far too much on fine 
> details of the implementation and is fragile (what if you miss the dummy byte 
> needed by fastsearch?)  Most of the possible options could be, if they 
> function correctly, applied directly to the basetype as a patch, so it's moot.

Actually, Unicode objects were designed to be subclassable right
from the start and adjusting the buffer to point e.g. into some
other already allocated string was too. I removed this feature from
Fredrik's type implementation with the intent to readd it later on as
subclass.

See the prototype implementation of such a subclass uniref that I've
written to show how easy it is to add a subclass which can be used
to slice large Unicode objects without having to reallocate new
buffers all the time.

BTW, I'm not aware of any changes to the PyUnicodeObject by some
fastsearch implementation. Could you point me to this ?

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-01-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

> Base type Unicode buffers end with a null-Py_UNICODE termination,
> but this is not used anywhere, AFAIK
On Windows, code like 
   CreateDirectoryW(PyUnicode_AS_UNICODE(po), NULL)
is very common, at least in posixmodule.c.

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-01-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

I find that the null termination for 8-bit strings makes low-level parsing 
operations (e.g., parsing a numeric string) safer and easier:  for example, it 
makes skipping a series of digits with something like:

while (isdigit(*s)) ++s;

safe.  I'd imagine that null terminated PyUNICODE arrays would have similar 
benefits.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue5372] Distutils inappropriately reuses .o files between extension modules

2010-01-10 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

This optimization is indeed simplistic. 

I'll also remove _prep_compiler() in trunk, as I don't see a problem in 
removing it in the 2.7.x and 3.2.x series.

I also need to fix it in 2.6.x / 3.1.x, but I'll keep the private method there.

--
priority:  -> normal
resolution:  -> accepted
versions: +Python 2.6, 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



[issue2449] Improved serialization error logging in xmlrpclib

2010-01-10 Thread Brian Curtin

Brian Curtin  added the comment:

Christopher, are you willing to update your patch for the current trunk (2.7)?

--
nosy: +brian.curtin
stage:  -> needs patch
versions: +Python 2.7 -Python 2.4

___
Python tracker 

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



[issue7672] _ssl module causes segfault

2010-01-10 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Why do you think this is a bug in Python?

--
nosy: +loewis

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-01-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I find that the null termination for 8-bit strings makes low-level
> parsing operations (e.g., parsing a numeric string) safer and easier:

Not to mention faster. The new IO library makes use of it (for newline
detection), on both bytestrings and unicode strings.

--

___
Python tracker 

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



[issue7672] _ssl module causes segfault

2010-01-10 Thread Sean Soria

Sean Soria  added the comment:

Because Python is not cleaning up after itself. I don't see how a 
multi-threaded app could work around this issue. The only solution I can think 
of at the app level is to reset those callbacks once python exits, but a 
different thread could call an SSL function at any point and cause the crash 
between the time that _ssl.so is unloaded and the app resets the callbacks.

One solution for Python would be to call CRYPTO_get_id_callback and 
CRYPTO_get_locking_callback and check that they're NULL before setting them. 
However, it's also stated in the documentation that id_callback doesn't need to 
be set for all platforms, so a NULL value could still be safe there. I haven't 
looked at the callbacks python is setting up, so I can't be sure this solution 
would work.

--

___
Python tracker 

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



[issue5683] Speed up cPickle's pickling generally

2010-01-10 Thread Skip Montanaro

Skip Montanaro  added the comment:

Antoine> With the patch, the same command quickly swaps hopelessly and
Antoine> after 5 minutes of elapsed time I finally manage to kill the
Antoine> process.

Verified with an Unladen Swallow test case.  I'll see if I can fix it.

S

--

___
Python tracker 

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



[issue7672] _ssl module causes segfault

2010-01-10 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

What operating system is this on?

IIUC, Python has no chance to perform any cleanup. So it's not a bug that no 
cleanup happens.

I don't understand the proposal of not setting the callback if they are already 
set. If that is done, how can we be sure that the callbacks that have been 
installed work correctly?

--

___
Python tracker 

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



[issue7672] _ssl module causes segfault

2010-01-10 Thread Sean Soria

Sean Soria  added the comment:

The issue was debugged on AMD64 Linux, but I was seeing similar crashing on OSX 
but could not debug because I wasn't getting a proper stack trace (probably 
because something else was being loaded into that memory space). I have yet to 
test if not setting those functions on OSX fixes the crashing, but I will soon.

Well Python's installed callbacks don't work correctly, so wouldn't it be safe 
to assume that if an app has installed callbacks of their own that those work 
correctly, or at least better than Python's, i.e. they don't bring down the 
entire app when Python is unloaded.

--

___
Python tracker 

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



[issue7672] _ssl module causes segfault

2010-01-10 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

So how do you do cleanup on Linux, or on OSX, in a shared library?

I'd claim that the bug is in your application. It shouldn't unload a DLL that 
is still in use (by having a function pointer into it stored globally).

Testing for a prior pointer value may fix it for you. It won't fix it in the 
general case, i.e. when you unload the ssl module and *didn't* install your own 
callbacks, OpenSSl would still call Python's callback.

--

___
Python tracker 

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



[issue7672] _ssl module causes segfault

2010-01-10 Thread Sean Soria

Sean Soria  added the comment:

You've got init_* that Python calls whenever it loads a library, you could just 
as easily have destroy_*. But that would probably be overkill.

How would the application know that Python has created callbacks? This is just 
one instance. Who knows where else this is done in any number of libraries. You 
you suggest that any application which dynamically loads a library never unload 
it?

What is the general case that this would not be fixed in? If a multi-threaded 
app uses SSL and doesn't load its own callbacks then it is in violation as 
libcryto states that certain callbacks must be set. If it doesn't use SSL then 
it's never going to have a problem as the callbacks will never be called after 
_ssl.so is unloaded. So the remaining case is a single threaded app that 
doesn't load the callbacks because it's single-threaded. But in that case it 
should be using a single threaded python library or it is in violation as it 
can no longer be considered a single-threaded app, and therefore should have 
loaded its own callbacks.

--

___
Python tracker 

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



[issue7673] audioop: check that length is a multiple of the size

2010-01-10 Thread STINNER Victor

New submission from STINNER Victor :

Most functions of audioop takes as input a byte string (audio data) and a size 
argument (number of bytes of a sample). Functions don't check that the byte 
string length is a multiple of the size. It leads to read and write from/to 
uninitialised memory and might crash.

Example on writing into uninitilized memory:

$ python -c "import audioop; audioop.reverse('X', 2)"
Fatal Python error: Inconsistent interned string state.
Abandon

It allocates a string of 1 byte and write 2 bytes into this string => memory 
corruption.

Attached patch creates audioop_check_size() and audioop_check_parameters() 
functions.

--
components: Extension Modules
files: audioop_check_length.patch
keywords: patch
messages: 97566
nosy: haypo
severity: normal
status: open
title: audioop: check that length is a multiple of the size
type: crash
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file15823/audioop_check_length.patch

___
Python tracker 

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



[issue7544] Fatal error on thread creation in low memory condition

2010-01-10 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

The patch looks good; the line
tstate->thread_id = PyThread_get_thread_ident();
is needed because the tstate is created in the main thread, but used in another 
thread.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue7544] Fatal error on thread creation in low memory condition

2010-01-10 Thread STINNER Victor

STINNER Victor  added the comment:

> The patch looks good

I'm not sure about autoTLSkey value. PyThreadState_New() calls 
_PyGILState_NoteThreadState() which checks that autoTLSkey is not zero, but I 
don't know if autoTLSkey have the right value with my preallocation patch.

--

___
Python tracker 

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



[issue7544] Fatal error on thread creation in low memory condition

2010-01-10 Thread STINNER Victor

STINNER Victor  added the comment:

> I'm not sure about autoTLSkey value (...)

After some tests (printf fun), it looks ok.

--

There is another problem in _testcapi: test_thread_state() calls directly 
PyThread_start_new_thread() and the thread function calls PyGILState_Ensure(). 
PyGILState_Ensure() would then require to create a new thread state (call 
PyThreadState_New()) because it was not done by PyThread_start_new_thread(). On 
low memory condition, we hit the same bug here.

Only thread and _testcapi modules calls directly PyThread_start_new_thread(). 
_*test*capi is reserved to tests, so I consider that we don't care about bugs 
under low memory condition in this module.

--

___
Python tracker 

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



[issue7143] get_payload(decode=True) eats last newline

2010-01-10 Thread R. David Murray

R. David Murray  added the comment:

The behavior you object to is in fact correct per RFC 2046, 5.5.1:

   The boundary delimiter MUST occur at the beginning of a line, i.e.,
   following a CRLF, and the initial CRLF is considered to be attached
   to the boundary delimiter line rather than part of the preceding
   part.

So in your example message your attatched file does not in fact have a final 
newline.  Note that you do not get a newline regardless of whether decode is 
true ('p' is the part extracted from your sample message):

>>> p.get_payload()
'MTIzCg=='
>>> p.get_payload(decode=True)
'123'

--
nosy: +r.david.murray
priority:  -> normal
resolution:  -> invalid
stage:  -> 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



[issue3244] multipart/form-data encoding

2010-01-10 Thread R. David Murray

R. David Murray  added the comment:

Daniel suggested marking this as superseding issue 727898, and I agree.  But I 
want to note that in that issue Barry suggested that it was possible services 
from the email package could be useful in building this support, and that there 
might be a better place for it to live than urllib.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue727898] Support for sending multipart form data

2010-01-10 Thread R. David Murray

Changes by R. David Murray :


--
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> multipart/form-data encoding

___
Python tracker 

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



[issue2449] Improved serialization error logging in xmlrpclib

2010-01-10 Thread Brian Curtin

Brian Curtin  added the comment:

Here is blunck2's patch updated against r77393. Once I have a better 
understanding of the issue I'll see if I can write tests (eg. I don't know the 
significance of 8002 on line 675, etc).

--
stage: needs patch -> test needed

___
Python tracker 

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



[issue2449] Improved serialization error logging in xmlrpclib

2010-01-10 Thread Brian Curtin

Changes by Brian Curtin :


--
keywords: +patch
Added file: http://bugs.python.org/file15824/issue2449.diff

___
Python tracker 

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



[issue2644] errors from msync ignored in mmap_object_dealloc

2010-01-10 Thread Brian Curtin

Brian Curtin  added the comment:

Do you have a test case to reproduce the errors?

I see that we call msync followed by munmap, neither one checked.

--
nosy: +brian.curtin
stage:  -> test needed

___
Python tracker 

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



[issue2449] Improved serialization error logging in xmlrpclib

2010-01-10 Thread Ezio Melotti

Ezio Melotti  added the comment:

A few things about the patch:
1) the MarshallError class has a 'message' attribute that results in a warning 
on some Python versions, it should be renamed in something different (like 
'msg');
2) I'm not sure why the  in the exception 
message is necessary, but I didn't look at the code in xmlrpclib.py so it might 
be ok;
3) the first 'pos' is not used in the for loop where it is created but only 
some lines later inside the except, this is not immediately clear, so a short 
comment should be added;
4) the str(e) is redundant -- there's already %s;
5) the "except Exception, e:" look suspicious, a more specific exception(s) 
should probably be specified;
6) 'as' should be used instead of the comma in the 'except' statements.

--
nosy: +ezio.melotti, krisvale, loewis
priority:  -> normal

___
Python tracker 

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



[issue2449] Improved serialization error logging in xmlrpclib

2010-01-10 Thread Brian Curtin

Brian Curtin  added the comment:

This patch should address all but #2. I'm not exactly sure of the use-case 
blunck2 had in mind so I'm not sure how the message would be used.

--
Added file: http://bugs.python.org/file15825/issue2449_v2.diff

___
Python tracker 

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



[issue2449] Improved serialization error logging in xmlrpclib

2010-01-10 Thread Brian Curtin

Changes by Brian Curtin :


Removed file: http://bugs.python.org/file15824/issue2449.diff

___
Python tracker 

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



[issue2644] errors from msync ignored in mmap_object_dealloc

2010-01-10 Thread Brian Curtin

Changes by Brian Curtin :


--
priority:  -> normal

___
Python tracker 

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



[issue7664] python logger does not handle IOError Exception

2010-01-10 Thread Yateen V. Joshi

Yateen V. Joshi  added the comment:

ok, thanks. I will try with subclass for handler.
A question however, I do not see IOError exception being handled 
anywhere in the logging module. Is it not possible that the same would
occur when we are trying to 'emit' a record to a log file? Or some other
IO related processing is happening at logger level?

--

___
Python tracker 

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



[issue2698] Extension module build fails for MinGW: missing vcvarsall.bat

2010-01-10 Thread Craig McQueen

Craig McQueen  added the comment:

Eric sent a build_ext.py to me and Daniel26 by e-mail. Attached. The idea was 
to copy it over the one in C:\Python31\Lib\distutils\command.

I tried the file that he sent, but I'm getting the same issue that Daniel26 
described.

--
Added file: http://bugs.python.org/file15826/build_ext.py

___
Python tracker 

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



[issue7674] select.select() corner cases: duplicate fds, out-of-range fds

2010-01-10 Thread Chris Leary

New submission from Chris Leary :

I was just reading through this ACM article that enumerates some of the issues 
with the select function in .NET: 
http://cacm.acm.org/magazines/2009/5/24646-api-design-matters/fulltext

select.select() currently suffers from the same documentation problem where the 
behavior with duplicate and/or out-of-range file descriptors in one of the 
sequences (i.e. rlist) is not described.

Given the current implementation of seq2set in trunk it appears that:

1. A ValueError is raised when a given file descriptor is out of range. 
(Typically a result of the programmer passing a non-fd value, since FD_SETSIZE 
is "normally at least equal to the maximum number of descriptors supported by 
the system.")

2. Duplicate file descriptor numbers are collapsed into the fd_set, and are 
therefore idempotent at a system API level.

However, the language-level support code generally assumes no duplication, as 
there is a fixed size array of (FD_SETSIZE + 1) pylist entries (one additional 
for a sentinel value). Although there is a TODO to dynamically size that to the 
largest targeted file descriptor number, that would still assume one PyObject 
per file descriptor in the input sequences.

The set2list function used to produce a return value will, however, return 
duplicates: for each value in the input list, if the corresponding fd is set, 
that pyobject is added to the return list.


Proposed Changes


At a glance it would seem that the Right Thing to do is to collapse duplicates 
in the input, as if we created a set(AsFileDescriptor(o) for o in input_list), 
so that no duplicates will be returned in the result; however, you *can* have a 
heterogeneous input list with a fileno like 5 and a file-like object whose 
fileno() resolved to 5, in which case you don't want to arbitrarily choose only 
one of those PyObjects to return. Therefore, I'm thinking it's probably best to 
leave it as-is and document it.

In any case, if we want to explicitly allow duplicates in the input list we 
should probably make the pylist arrays into dynamically sized structures in the 
sizes of the corresponding input lists for correctness.

If this all makes sense I'll be happy to come up with a 
module/documentation/unit test patch.

--
assignee: georg.brandl
components: Documentation, Extension Modules
messages: 97578
nosy: cdleary, georg.brandl
severity: normal
status: open
title: select.select() corner cases: duplicate fds, out-of-range fds
type: behavior

___
Python tracker 

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



[issue7664] python logger does not handle IOError Exception

2010-01-10 Thread Vinay Sajip

Vinay Sajip  added the comment:

> From: Yateen V. Joshi 

> A question however, I do not see IOError exception being handled 
> anywhere in the logging module. Is it not possible that the same would
> occur when we are trying to 'emit' a record to a log file? Or some other
> IO related processing is happening at logger level?

If you look carefully at the code in the module, you will see code like

except:
self.handleError(record)

which *will* catch IOError. In handleError, you would have access to the 
exception via sys.exc_info().

--

___
Python tracker 

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



[issue7672] _ssl module causes segfault

2010-01-10 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> You you suggest that any application which
> dynamically loads a library never unload it?

Correct. Library unloading just don't work. Trying it anyway
is an endless uphill battle.

--

___
Python tracker 

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