[issue1966] infinite loop in httplib

2008-01-30 Thread Mike Klaas

Mike Klaas added the comment:

I wouldn't advocate that it go in to 2.3/2.4.  The only security issue is 
a possible DoS, but I think that is unlikely.  There is already an attack 
vector for python code using (timeout-less) httplib by simply returning 
the response very slowly (1byte/sec).

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1966
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1966] infinite loop in httplib

2008-01-29 Thread Mike Klaas

New submission from Mike Klaas:

There are a small number of sites that do not send the trailing \r\n when 
using chunked transfer encoding (say 1 in 500,000).  This unfortunately, 
causes httplib to go into an infinite loop.

Fixed by checking for EOF (3 line patch)

--
components: Library (Lib)
files: httplib_chunked.patch
messages: 61824
nosy: klaas
severity: major
status: open
title: infinite loop in httplib
type: behavior
versions: Python 2.3, Python 2.4, Python 2.5, Python 2.6, Python 3.0
Added file: http://bugs.python.org/file9318/httplib_chunked.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1966
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1663329] subprocess/popen close_fds perform poor if SC_OPEN_MAX is hi

2008-01-04 Thread Mike Klaas

Mike Klaas added the comment:

Updated patch, now with documentation and test.  Patch is against 
2.6trunk, but probably will apply against 3.0 as well

--
components: +Library (Lib) -Interpreter Core
versions: +Python 2.6 -Python 2.5
Added file: http://bugs.python.org/file9070/posix_closerange.patch

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1663329
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1516330] Module uuid: functions for retrieving MAC addres

2007-10-31 Thread Mike Klaas

Mike Klaas added the comment:

Is this meant to be inserted into uuid.py?  It seems more like a snippet 
from unrelated code: code coventions do not follow PEP 8; there are no 
tests; code does not run as-is (references non-existent variable '_os'--
why no 'import os'?); etc.

--
nosy: +klaas

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1516330
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1516327] Module uuid: reduce pickle footprint

2007-10-31 Thread Mike Klaas

Mike Klaas added the comment:

Is the footprint of UUID an issue?

Note that changing the pickle format of UUID will require code that can 
unpickle both versions, for compatibility.  I don't really see the need.

Also, no real patch provided.

--
nosy: +klaas

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1516327
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1705170] contextmanager eats StopIteration

2007-10-31 Thread Mike Klaas

Mike Klaas added the comment:

Verified on 2.5.0.  The problem stems from contextmanager.__exit__:

 def __exit__(self, type, value, traceback):
if type is None:
try:
self.gen.next()
except StopIteration:
return
else:
raise RuntimeError(generator didn't stop)
else:
try:
self.gen.throw(type, value, traceback)
raise RuntimeError(generator didn't stop after throw
())
except StopIteration, exc:
# Suppress the exception *unless* it's the same 
exception that
# was passed to throw().  This prevents a StopIteration
# raised inside the with statement from being 
suppressed
return exc is not value
except:
# only re-raise if it's *not* the exception that was
# passed to throw(), because __exit__() must not raise
# an exception unless __exit__() itself failed.  But 
throw()
# has to raise the exception to signal propagation, so 
this
# fixes the impedance mismatch between the throw() 
protocol
# and the __exit__() protocol.
#
if sys.exc_info()[1] is not value:
raise

Conjecture: internal StopIteration exceptions are always the same 
instance (PyExc_StopIteration) when propagated to python, invalidating 
the return exc is not value
check.

--
nosy: +klaas

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1705170
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1773632] Remove references to _xmlrpclib from xmlrpclib.py

2007-10-31 Thread Mike Klaas

Mike Klaas added the comment:

Patch applies to 2.5 cleanly, test_xmlrpc passes.

--
nosy: +klaas

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1773632
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue738948] Logic Variable Thread Synchronization

2007-10-31 Thread Mike Klaas

Mike Klaas added the comment:

PEPs should be proposed on python-list and python-dev.  This is a four-
year-old idea that seems quite profound in the changes proposed.  
Recommend closing.

--
nosy: +klaas


Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue738948

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



[issue1663329] subprocess/popen close_fds perform poor if SC_OPEN_MAX is hi

2007-10-15 Thread Mike Klaas

Mike Klaas added the comment:

This problem has also afflicted us.

Attached is a patch which adds closerange(fd_low, fd_high) to the posix 
(and consequently os) module, and modifies subprocess to use it.  Patch 
is against trunk but should work for 2.5maint.

I don't really think that this is useful enough to add to the public 
api, but it results in a huge performance benefit for subprocess:

[python-trunk]$ ./python -m timeit -s 'import python_close' 
'python_close.go(10)'
10 loops, best of 3: 358 msec per loop
[python-trunk]$ ./python -m timeit -s 'import os' 'os.closerange(4, 
10)'
10 loops, best of 3: 20.7 msec per loop
[python-trunk]$ ./python -m timeit -s 'import python_close' 
'python_close.go(30)'
10 loops, best of 3: 1.05 sec per loop
[python-trunk]$ ./python -m timeit -s 'import os' 'os.closerange(4, 
30)'10 loops, best of 3: 63 msec per loop

[python-trunk]$ cat python_close.py
import os, sys
def go(N):
for i in xrange(4, N):
try:
os.close(i)
except:
pass

--
nosy: +klaas

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1663329
_

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



[issue1663329] subprocess/popen close_fds perform poor if SC_OPEN_MAX is hi

2007-10-15 Thread Mike Klaas

Mike Klaas added the comment:

I see that some spaces crept in to the patch.  I can fix that (and perhaps 
rename the function to start with an underscore) if desired.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1663329
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1663329] subprocess/popen close_fds perform poor if SC_OPEN_MAX is hi

2007-10-15 Thread Mike Klaas

Mike Klaas added the comment:

Finally, I did not include any platform-specific optimizations, as I don't 
have AIX or solaris boxes on which to test them (and they can easily be 
added later).  An order-mag speedup on all *nix platforms is a good start.

_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1663329
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com