[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-13 Thread Pierre Quentel

Pierre Quentel pierre.quen...@gmail.com added the comment:

I knew the builtins hack was terrible, thanks for the replies...

I changed cgi.py with Glenn's IOMix class, and included the changes in 
make_file(). The patch is attached to this message

Is it really too late to include it in 3.2 ? Missing a working cgi module is 
really a problem for a wider 3.x adoption

--
Added file: http://bugs.python.org/file20383/cgi_20110113.diff

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-13 Thread Pierre Quentel

Pierre Quentel pierre.quen...@gmail.com added the comment:

diff for the updated version of test_cgi.py, compatible with cgi.py

--
Added file: http://bugs.python.org/file20384/test_cgi_20111013.diff

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-13 Thread Pierre Quentel

Pierre Quentel pierre.quen...@gmail.com added the comment:

zip file with the updated cgi_test.py and associated files

--
Added file: http://bugs.python.org/file20385/cgi_tests.zip

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2011-01-13 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

How about this?

Instead of just losing the data that's been read so far in readline(), this 
patch adds the data as a new field to the exception that is thrown - this way 
the semantics remain exactly the same but the data is not discarded when a 
timeout occurs, it is still accessible via the exception.

--
Added file: http://bugs.python.org/file20386/issue7322_new.patch

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-13 Thread Glenn Linderman

Glenn Linderman v+pyt...@g.nevcal.com added the comment:

Pierre,
Looking better.
I see you've retained the charset parameter, but do not pass it through to 
nested calls of FieldStorage.  This is good, because it wouldn't work if you 
did.  However, purists might still complain that FieldStorage should only ever 
use and affect stdin... however, since I'm a pragmatist, I'll note that the 
default charset value is None, which means it does nothing to stdout or stderr 
by default, and be content with that.

I've run a couple basic tests and it works, and the other things the code 
hasn't changed since your last iteration, but I'll test them again after I get 
some sleep.

I'll try setting the Version here back to 3.2 -- it is a bug in 3.2 -- and see 
if some committer will take pity on web developers that use CGI, and are hoping 
to be able to use Python 3.2 someday.

--
versions: +Python 3.2

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Small tip: To ease review, I recommend you work from a checkout of the
Subversion py3k branch, using svn add if you have new files and then
producing one svn diff of the whole checkout.  It’s easier than looking
at multiple files, even more so if they’re hidden in a zip.  We
programmers like text :)

You can also remove outdated patches from this page to make it clearer.

--
title: cgi module cannot handle POST with multipart/form-data in3.0 - 
cgi module cannot handle POST with multipart/form-data in 3.x

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



[issue10577] (Fancy) URL opener stuck when trying to open redirected url

2011-01-13 Thread Charles-Francois Natali

Charles-Francois Natali neolo...@free.fr added the comment:

It's a dupe of http://bugs.python.org/issue8035.

By the way, it works with 2.7 because urllib used HTTP 1.0 by default, and in 
py3k it now uses HTTP 1.1.
And from what I understood (by I'm by no means an http expert), in http 1.0 the 
server was required to close the connection following a 302, and this 
requirement was lifted in http 1.1.

--
nosy: +neologix

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Changes by Pierre Quentel pierre.quen...@gmail.com:


Removed file: http://bugs.python.org/file20229/cgi_diff.txt

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Changes by Pierre Quentel pierre.quen...@gmail.com:


Removed file: http://bugs.python.org/file20235/cgi_diff.txt

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Changes by Pierre Quentel pierre.quen...@gmail.com:


Removed file: http://bugs.python.org/file20322/cgi_diff_20110109.txt

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Changes by Pierre Quentel pierre.quen...@gmail.com:


Removed file: http://bugs.python.org/file20323/cgi_tests.zip

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Changes by Pierre Quentel pierre.quen...@gmail.com:


Removed file: http://bugs.python.org/file20356/cgi_diff_20110111.txt

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Changes by Pierre Quentel pierre.quen...@gmail.com:


Removed file: http://bugs.python.org/file20382/cgi_diff_20110112.txt

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Changes by Pierre Quentel pierre.quen...@gmail.com:


Removed file: http://bugs.python.org/file20383/cgi_20110113.diff

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Changes by Pierre Quentel pierre.quen...@gmail.com:


Removed file: http://bugs.python.org/file20384/test_cgi_20111013.diff

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Changes by Pierre Quentel pierre.quen...@gmail.com:


Removed file: http://bugs.python.org/file20244/cgi_diff.txt

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Pierre Quentel pierre.quen...@gmail.com added the comment:

Ok Eric, thanks for the tips

I attach the diff for the 2 modified modules (cgi.py and test_cgi.py). For the 
other tests, they are not in the branch and there are many test files so I 
leave the zip file

I removed outdated diffs

--
Added file: http://bugs.python.org/file20387/cgi_32.patch

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



[issue2650] re.escape should not escape underscore

2011-01-13 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

Here is the patch, including adjustment to the test.

--
Added file: http://bugs.python.org/file20388/issue2650.diff

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



[issue10899] No function type annotations in the standard library

2011-01-13 Thread Scott Dial

Scott Dial sc...@scottdial.com added the comment:

Raymond Hettinger wrote:
 I think those annotations should be replaced with comments.

In your revisions, you didn't do anything but blow away the annotations despite 
what you said here, which is an unfortunate loss of information for 
implementers and users of those interfaces.

--
nosy: +scott.dial

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2011-01-13 Thread David Beazley

David Beazley d...@dabeaz.com added the comment:

Have any other programming environments ever had a feature where a socket 
timeout returns an exception containing partial data?I'm not aware of one 
offhand and speaking as a systems programmer, something like this might be 
somewhat unexpected.

My concern is that in the presence of timeouts, the programmer will be forced 
to reassemble the message themselves from fragments returned in the exception.  
However, one reason for using readline() in the first place is precisely so 
that you don't have to do that sort of thing.

Is there any reason why the input buffer can't be preserved across calls?   
You've already got a file-like wrapper around the socket.  Just keep the 
unconsumed buffer in that instance.

--
nosy: +dabeaz

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2011-01-13 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

This is an interesting approach. The problem is that AFAICT the issue is not 
limited to readline. If you call e.g. read(1) and the socket times out 
after having returned the first 5000 bytes, then those 5000 bytes might get 
lost as well (depending on specifics e.g. buffer size in the IO stack).

Generally there is no guarantee that a buffered object works properly when 
the raw IO object raises some exception intermittently; perhaps this should be 
fixed in a systemic way, although this would complicate things quite a bit.

Also, I don't think people try to reuse a socket after a timeout (or even try 
to salvage whatever data could be read before the timeout); usually they would 
instead abort the connection and treat the remote resource as unavailable. IMO, 
that's the one obvious use case for socket timeouts.

--
nosy: +amaury.forgeotdarc
stage: needs patch - patch review
versions: +Python 3.3 -Python 2.7, Python 3.1, Python 3.2

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2011-01-13 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

By the way, I recently fixed the makefile() documentation:

“The socket must be in blocking mode; it can have a timeout, but the file 
object’s internal buffer may end up in a inconsistent state if a timeout 
occurs.”
(in http://docs.python.org/dev/library/socket.html#socket.socket.makefile)

I also added a small section dedicated to socket timeouts:
http://docs.python.org/dev/library/socket.html#notes-on-socket-timeouts

--

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

It getting in to 3.2 would be a release manager call, so I've set it to release 
blocker so Georg can make the call.  My opinion is that while I would *really* 
like to see this fixed in 3.2, the changes really should have a thorough 
*design* review as well as a code review.  

The argument for putting it in would be that it is broken as is (at least for 
binary file upload, possibly in other ways as well), and if we can get 
agreement on the API changes, we can fix any remaining bugs in 3.2.1.  However, 
making API changes at this point (post-beta) requires a significant exception 
to our normal development rules, and I don't like doing things this rushed and 
last minute.  But I also don't like the thought of having FieldStorage be 
broken in 3.2.

Georg, I'm really busy this week, and don't have time to do a review, 
unfortunately.  If you think it worth considering putting it in, I can try to 
take a look at the API changes tomorrow, but unfortunately can make no promise 
to do so.  Hopefully others can, if needed.

--
nosy: +georg.brandl
priority: high - release blocker

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



[issue10897] UNIX mmap unnecessarily dup() file descriptor

2011-01-13 Thread Ralf Schmitt

Changes by Ralf Schmitt sch...@gmail.com:


--
nosy: +schmir

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



[issue10013] fix `./libpython2.6.so: undefined reference to `_PyParser_Grammar´` in parallel builds

2011-01-13 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment:

This change was backported to 2.7 (r87701) and 3.1 (r87702).

--
nosy: +Arfrever

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



[issue10013] fix `./libpython2.6.so: undefined reference to `_PyParser_Grammar´` in parallel builds

2011-01-13 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
resolution:  - accepted
status: open - closed
versions: +Python 3.1, Python 3.2

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Pierre Quentel pierre.quen...@gmail.com added the comment:

Ok, thanks. Here is a summary of the API changes :

- the argument fp passed to FieldStorage is either an instance of (a subclass 
of) io.TextIOBase with a buffer attribute for the underlying binary layer 
(thus, it can't be a StringIO instance) ; or an object with read() and 
readline() methods that return bytes
Defaults to sys.stdin

- 2 additional arguments can be passed to the FieldStorage constructor :
. stream_encoding : the encoding used by the user agent to encode submitted 
data. It must be the same as the content-type of the HTML page where the form 
stands. Defaults to utf-8
. charset : the encoding used by the CGI script (the one used by the print() 
function to encode and send to sys.stdout). It must be the same as the charset 
in the content-type header sent by this script. Defaults to None, in which case 
the default encoding of sys.stdout is used

- the only change in the object returned by FieldStorage() is that, if a field 
represents a file (its argument filename is not None), the read() method on 
this field returns bytes, and its attribute value is a bytestring, not a 
string

--

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



[issue2650] re.escape should not escape underscore

2011-01-13 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


Removed file: http://bugs.python.org/file20388/issue2650.diff

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



[issue2650] re.escape should not escape underscore

2011-01-13 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

The naïve version of the code proposed was about 3 times slower than existing 
version. However, the test, I think, is valuable enough. So, I'm reinstating it.

--
Added file: http://bugs.python.org/file20389/test_re.diff

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



[issue10013] fix `./libpython2.6.so: undefined reference to `_PyParser_Grammar´` in parallel builds

2011-01-13 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
resolution: accepted - fixed

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



[issue2650] re.escape should not escape underscore

2011-01-13 Thread James Y Knight

James Y Knight f...@users.sourceforge.net added the comment:

Show your speed test? Looks 2.5x faster to me. But I'm running this on python 
2.6, so I guess it's possible that the re module's speed was decimated in Py3k.


python -m timeit -s $(printf import re\ndef escape(s):\n return 
re.sub('([][.^$*+?{}\\|()])', '\\\1', s)) 
'escape(!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*())'
10 loops, best of 3: 18.4 usec per loop


python -m timeit -s import re 
're.escape(!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*())'
1 loops, best of 3: 45.7 usec per loop

--

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



[issue10899] No function type annotations in the standard library

2011-01-13 Thread Guido van Rossum

Guido van Rossum gu...@python.org added the comment:

Yes, please add the lost info back to docstrings.

--

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



[issue10577] (Fancy) URL opener stuck when trying to open redirected url

2011-01-13 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Ok, closing as duplicate.

--
resolution:  - duplicate
status: open - closed
superseder:  - urllib.request.urlretrieve hangs

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



[issue8035] urllib.request.urlretrieve hangs waiting for connection close after a redirect

2011-01-13 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

issue10577 is a duplicate. See an URL allowing reproducing in msg122831.

--
nosy: +pitrou
priority: high - normal
stage: unit test needed - needs patch
title: urllib.request.urlretrieve hangs - urllib.request.urlretrieve hangs 
waiting for connection close after a redirect

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



[issue2650] re.escape should not escape underscore

2011-01-13 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

James, I think the setup statement should have been:

import re\ndef escape(s):\n return re.sub(r'([][.^$*+?{}\\|()])', r'\\\1', 
s))

note the raw string literals.

The timings that I got after applying file20388 
(http://bugs.python.org/file20388/issue2650.diff) were:
PCbuild\python.exe -m timeit -s import re, string 
re.escape(string.printable)
1 loops, best of 3: 63.3 usec per loop

python.exe -m timeit -s import re, string re.escape(string.printable)
10 loops, best of 3: 19.3 usec per loop

--

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



[issue2710] error: (10035, 'The socket operation could not complete without blocking')

2011-01-13 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

This can be reopened if the problem ever appears in a current issue.

--
resolution:  - out of date
status: open - closed

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



[issue10899] No function type annotations in the standard library

2011-01-13 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Will do :-)

--

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



[issue2650] re.escape should not escape underscore

2011-01-13 Thread James Y Knight

James Y Knight f...@users.sourceforge.net added the comment:

Right you are, it seems that python's regexp implementation is terribly slow 
when doing replacements with a substitution in them. (fixing the broken test, 
as you pointed out changed the timing to 97.6 usec vs the in-error-reported 
18.3usec.)

Oh well. I still think it's crazy not to use re for this in its own module. 
Someone just needs to fix re to not be horrifically slow, too. :)

--

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



[issue2650] re.escape should not escape underscore

2011-01-13 Thread yeswanth

yeswanth swamiyeswa...@yahoo.com added the comment:

@James test results for py3k 


python -m timeit -s $(printf import re\ndef escape(s):\n return 
re.sub('([][.^$*+?{}\\|()])', '\\\1', s)) 
'escape(!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*())'

10 loops, best of 3: 17.1 usec per loop


python -m timeit -s import re 
're.escape(!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*()!@#$%^*())'

1 loops, best of 3: 102 usec per loop

--

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



[issue10900] bz2 module fails to uncompress large files

2011-01-13 Thread wrobell

New submission from wrobell wrob...@pld-linux.org:

There is problem to uncompress large files with bz2 module.

For example, please download 13GB OpenStreetMap file using following torrent

http://osm-torrent.torres.voyager.hr/files/planet-latest.osm.bz2.torrent

Try to count lines in the compressed file with command...

   python3.2 bz2wc.py planet-110105.osm.bz2 
   3971

... but there is much more lines in that file

   bzip2 -dc  planet-110105.osm.bz2 | wc -l
   
The command

   bzip2 -t planet-110105.osm.bz2

validates the file successfully.

--
components: Library (Lib)
files: bz2wc.py
messages: 126186
nosy: wrobell
priority: normal
severity: normal
status: open
title: bz2 module fails to uncompress large files
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file20390/bz2wc.py

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



[issue10901] Python 3 MIME generator dies if not given boundary

2011-01-13 Thread Brandon Craig Rhodes

New submission from Brandon Craig Rhodes bran...@rhodesmill.org:

If you try doing msg.as_string() to a MIMEMultipart message that has not been 
given a boundary, then it dies with this exception:

Traceback (most recent call last):
  File mime_gen_alt.py, line 40, in module
print(msg.as_string())
  File /home/brandon/python3.2b2/lib/python3.2/email/message.py, line 164, in 
as_string
g.flatten(self, unixfrom=unixfrom)
  File /home/brandon/python3.2b2/lib/python3.2/email/generator.py, line 88, 
in flatten
self._write(msg)
  File /home/brandon/python3.2b2/lib/python3.2/email/generator.py, line 134, 
in _write
self._dispatch(msg)
  File /home/brandon/python3.2b2/lib/python3.2/email/generator.py, line 160, 
in _dispatch
meth(msg)
  File /home/brandon/python3.2b2/lib/python3.2/email/generator.py, line 234, 
in _handle_multipart
self.write('--' + boundary + self._NL)
TypeError: Can't convert 'NoneType' object to str implicitly

--
components: Library (Lib)
messages: 126187
nosy: brandon-rhodes
priority: normal
severity: normal
status: open
title: Python 3 MIME generator dies if not given boundary
type: crash
versions: Python 3.2

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



[issue10901] Python 3 MIME generator dies if not given boundary

2011-01-13 Thread Brandon Craig Rhodes

Brandon Craig Rhodes bran...@rhodesmill.org added the comment:

Here is a patch that fixes the problem. The problem probably only occurs if the 
MIMEMultipart is actually given several MIME parts to use in its interior.

--
keywords: +patch
Added file: http://bugs.python.org/file20391/email-boundary.diff

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



[issue2650] re.escape should not escape underscore

2011-01-13 Thread A.M. Kuchling

Changes by A.M. Kuchling li...@amk.ca:


--
nosy:  -akuchling

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



[issue10900] bz2 module fails to uncompress large files

2011-01-13 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
nosy: +gustavo

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



[issue10900] bz2 module fails to uncompress large files

2011-01-13 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
nosy: +niemeyer -gustavo

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



[issue10901] Python 3 MIME generator dies if not given boundary

2011-01-13 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

It is a duplicate of #1243654. Closing.

--
nosy: +SilentGhost
resolution:  - duplicate
status: open - closed
superseder:  - Faster output if message already has a boundary

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2011-01-13 Thread Gregory P. Smith

Gregory P. Smith g...@krypto.org added the comment:

Generally there is no guarantee that a buffered object works properly when 
the raw IO object raises some exception intermittently

I disagree.  EINTR is a classic case of this and is something that buffering IO 
layers deal with all the time.  (readline is just one example of a buffering io 
layer)

if there is a timeout and we can't determine if there is enough data to return 
for readline, we should buffer it and not return.

maybe this means we need to disallow readline() with timeouts on unbuffered 
sockets since we can't determine if data will need to be buffered or not due to 
such a condition in advance.

The normal behavior for code calling readline() on a socket with a timeout is 
likely going to be to close it.  Anything else does not make much sense.  
(someone may try, but really they're writing their I/O code wrong if they are 
using a socket timeout a poor form of task switching ;)

--

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



[issue1243654] Faster output if message already has a boundary

2011-01-13 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

Issue #10901 was closed as a duplicate of this issue.

--
nosy: +SilentGhost
versions: +Python 3.1, Python 3.2

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2011-01-13 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Generally there is no guarantee that a buffered object works
 properly when the raw IO object raises some exception
 intermittently
 
 I disagree.  EINTR is a classic case of this and is something that
 buffering IO layers deal with all the time.  (readline is just one
 example of a buffering io layer)

EINTR is a different matter. To handle EINTR in Python, it is enough to
call the signal handlers and then retry the system call (that's what is
done in SocketIO.readinto, although FileIO doesn't have such logic).
Only if the signal handler raises an exception (which it probably
shouldn't do, since asynchronous exceptions are very bad) do you abort
the operation.

You can't apply the same logic to a socket timeout; the timeout is
really an error condition and you certainly shouldn't retry the system
call (that would defeat the point of using a timeout). So, to handle it
in an entirely correct way, you need to add some out-of-band buffering
logic where you store the pending raw reads which have been done but
could not be returned to the user. That complicates things quite a bit,
especially given that it has to be grafted on at least two layers of the
IO stack (the raw IO layer, and the buffered IO layer). Ross' patch does
it, but incompletely (it lets the user handle the out-of-band data) and
only for readline() (while buffered read() would probably need it too).

 The normal behavior for code calling readline() on a socket with a
 timeout is likely going to be to close it.  Anything else does not
 make much sense.  (someone may try, but really they're writing their
 I/O code wrong if they are using a socket timeout a poor form of task
 switching ;)

That's my opinion too. So, instead, of doing the above surgery inside
the IO stack, the SocketIO layer could detect the timeout and disallow
further access. What do you think?

--

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



[issue10900] bz2 module fails to uncompress large files

2011-01-13 Thread wrobell

wrobell wrob...@pld-linux.org added the comment:

Forgot the mention the real amount of lines!

bzip2 -dc  planet-110105.osm.bz2 | wc -l
2783595867

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10900
___
___
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.

2011-01-13 Thread wrobell

wrobell wrob...@pld-linux.org added the comment:

A use case

wget -O http://planet.openstreetmap.org/planet-110112.osm.bz2 | tee 
planet.bz2 | osm2sql | psql osm

planet-*osm.bz2 files are 14GB at the moment. it would be great to read them 
from stdin while downloading from a server and uploading to a database at the 
same time.

Of course, you can insert bzip2 -d into the pipe... but then why to bother 
with bz2 module in Python? ;)

--
nosy: +wrobell

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5863
___
___
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.

2011-01-13 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

We’ve already agreed the feature is desirable; what’s missing is a patch, not 
user stories :)

--
nosy: +niemeyer
versions: +Python 3.3 -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5863
___
___
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.

2011-01-13 Thread wrobell

wrobell wrob...@pld-linux.org added the comment:

OK! :)

--

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2011-01-13 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

 That complicates things quite a bit,
 especially given that it has to be grafted on at least two layers of the
 IO stack (the raw IO layer, and the buffered IO layer).

Also the TextIO layer I think.

 That's my opinion too. So, instead, of doing the above surgery inside
 the IO stack, the SocketIO layer could detect the timeout and disallow
 further access. What do you think?

So after a timeout occurs the file-object basically becomes worthless? Would it 
make sense to automatically call the close method of the file-object after this 
occurs?

--

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2011-01-13 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

  That's my opinion too. So, instead, of doing the above surgery inside
  the IO stack, the SocketIO layer could detect the timeout and disallow
  further access. What do you think?
 
 So after a timeout occurs the file-object basically becomes worthless?
 Would it make sense to automatically call the close method of the
 file-object after this occurs?

Actually, we only need to forbid further reads (writes would always
work). I think we should still let the user call the close method
themselves.

--

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Andy Harrington

Andy Harrington ahar...@luc.edu added the comment:

I found a similar issue.  If you want more simple files demonstrating the 
issue, I have attached some.  If I start my localCGIServer.py, then I can use 
adder.html fine (uses get), but with adderpost.html (uses post) the cgi action 
file, adder.cgi (that worked fine with the get version) hangs.

--
nosy: +andyharrington
Added file: http://bugs.python.org/file20392/localCGIServer.py

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Andy Harrington

Changes by Andy Harrington ahar...@luc.edu:


Removed file: http://bugs.python.org/file20392/localCGIServer.py

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Andy Harrington

Changes by Andy Harrington ahar...@luc.edu:


Added file: http://bugs.python.org/file20393/adder.html

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Andy Harrington

Changes by Andy Harrington ahar...@luc.edu:


Added file: http://bugs.python.org/file20394/adderpost.html

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy:  -pitrou

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Andy Harrington

Changes by Andy Harrington ahar...@luc.edu:


Added file: http://bugs.python.org/file20395/localCGIServer.py

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Andy Harrington

Changes by Andy Harrington ahar...@luc.edu:


Added file: http://bugs.python.org/file20396/adder.cgi

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

But why? What's the reason for that? Why mislabel a type as a function?

--

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

staticmethod being a type or int being a function is really a CPython 
implementation detail.  If the docs say something is a class, it behaves as a 
class, you can subclass it and everything, and the other VMs implement it as a 
class, why would you want to consider the detail that it’s really a C function?

--
nosy: +eric.araujo
stage:  - committed/rejected
versions:  -Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 
3.3

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

I'm really confused by your comment.

int being a function is really a CPython implementation detail

I don't understand this. I should be able to do isinstance(x, int) in all 
implementations of Python, no? So `int` must be a class across all Python 
implementation, no?

why would you want to consider the detail that it’s really a C function?

I don't want to consider the detail that int is a C function, I thought that 
int is a class and expected it to be marked :class:`int` in the documentation.

--

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



[issue9268] Document annotation option to pickletools.dis

2011-01-13 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Committed documentation changes in revision 87990.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Okay, scratch the comment about int, it’s not been accurate for quite a number 
of years.  Going back to staticmethod, my point still applies: Follow what the 
docs say.

staticmethod is a type in CPython probably due to the way descriptors work; 
contextlib.closing is a class for simplicity and efficiency; both of these 
examples are irrelevant internal details, they’re marked up as functions, so 
you should treat them as functions.

--

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Ok, there are 10+ files attached, 20+ comments, no up-to-date patch. It's 
really too late for 3.2 IMO.

--
nosy: +pitrou
priority: release blocker - normal
stage: patch review - needs patch
versions:  -Python 3.2

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



[issue7936] sys.argv contains only scriptname

2011-01-13 Thread Pierre Bourgault

Pierre Bourgault pbourga...@quazal.com added the comment:

I had the same problem with another version of python on Windows 7.

We are using python 2.4.2 for production and it is installed in 
D:\Tools\Python. For experimentation purpose, I installed Python 2.7 in the 
usual location. It broke a few things and I uninstalled both python, and 
reinstalled only 2.4.2.

After that, using python 2.4.2, I got the problem described by this issue. None 
of my colleagues (who did not install Python 2.7) had the issue. 

The registry entry HKEY_CLASSES_ROOT\py_auto_file\shell\open\command was 
reading: D:\Tools\Python\python.exe %1

It was missing %*. I added it and my issue went away.

--
nosy: +pierrebourgault

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Pierre Quentel

Pierre Quentel pierre.quen...@gmail.com added the comment:

Comment ça, no up to date patch ? cgi_32.patch is up to date, the API changes 
are documented, the unittests work, what else do you want ?

--

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

So if int is officially a class, why not start doing :class:`int` instead of 
:func:`int`?

they’re marked up as functions, so you should treat them as functions.

Here, I've treated staticmethod as a function:

 assert isinstance(staticmethod, types.FunctionType)
Traceback (most recent call last):
  File pyshell#1, line 1, in module
assert isinstance(staticmethod, types.FunctionType)
AssertionError

I get an error.

So I understand that you are using Sphinx's :func: role in a liberal way; You 
consider it okay to use it to mark anything that is callable, regardless of 
whether it's a function or a class. Am I right?

This looks to me like an abuse of Sphinx notation. When I read documentation I 
don't want to be second-guessing the author's intentions. If someone writes 
:func:`whatever` I expect `whatever` to be a function and not a class.

Perhaps we need a :callable: role?

--
status: closed - open

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I don’t have enough experience to make a judgment call here.  Raymond or Georg, 
can you?

--
nosy: +georg.brandl
versions: +Python 2.7, Python 3.1, Python 3.2

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Comment ça, no up to date patch ? cgi_32.patch is up to date, the API
 changes are documented, the unittests work, what else do you want ?

The O_BINARY stuff looks obsolete to me.

--

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

That's just the way we do our markup.
Sorry, but this is a total non-issue.
You're trying to create finer distinctions
than the markup needs to support.

Besides, the distinction between types,
objects, callables, functions, instances,
descriptors and whatnot are much less
black and white than you might imagine.

--
nosy: +rhettinger
status: open - closed

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Glenn Linderman

Glenn Linderman v+pyt...@g.nevcal.com added the comment:

The O_BINARY stuff was probably necessary because issue 10841 is not yet in the 
build Pierre was using?  I agree it in not necessary with the fix for that 
issue, but neither does it hurt.

It could be stripped out, if you think that is best, Antoine.

But there is a working patch.

--

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fully agreed.

--

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Can one person please

1) Sum up the discussion and its outcome briefly

2) Remove all patches and replace them with one diff with docs, tests and code 
(even if you have new files, you don’t have to put them in a zip, use svn add 
and they will show up in the svn diff, which is really easier to review)

--

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file20288/unnamed

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Etienne Robillard

Etienne Robillard e...@gthcfoundation.org added the comment:

+1

--
title: cgi module cannot handle POST with multipart/form-data in 3.x - cgi 
module cannot handle POST with multipart/form-data in   3.x

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



[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-01-13 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

I am replacing issue6697-lsprof.diff with a (hopefully) more carefully written 
version that addresses the issues that Victor noted.

Victor,

I take your comment as +1 for adding PyModule_GetNameObject().


I started looking into adding unit tests that would exercise this code, but is 
does not seem possible to trigger the fn-m_self == NULL condition.  According 
to the comment in the code, this is supposed to be the case when fn is a 
builtin function, but I observe the following in the debugger when running 
test_cprofile:

(gdb) pyo fn
object  : built-in function exec
type: builtin_function_or_method
refcount: 4
address : 0x10038c678
$5 = void
(gdb) pyo fn-m_self 
object  : module 'builtins' (built-in)
type: module
refcount: 51
address : 0x100388ee8
$6 = void

--
Added file: http://bugs.python.org/file20397/issue6697-lsprof.diff

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



[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-01-13 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


Removed file: http://bugs.python.org/file19980/issue6697-lsprof.diff

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



[issue2292] Missing *-unpacking generalizations

2011-01-13 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue7662] time.utcoffset()

2011-01-13 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

This one is a different issue. Even though it can not be solved without by 
#9527, it is not superseded by it. So, better add to dependencies.

--
resolution: rejected - 
status: pending - open

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



[issue7662] time.utcoffset()

2011-01-13 Thread Brian Curtin

Changes by Brian Curtin cur...@acm.org:


--
nosy:  -brian.curtin

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



[issue7662] time.utcoffset()

2011-01-13 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

You can discuss within the comments whether this issue should be re-opened or 
not, but do not take it upon yourself to change the status on your own once a 
core developer has already closed an issue as their decision supersedes that of 
a regular user.

--
resolution:  - rejected
status: open - pending

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



[issue7662] time.utcoffset()

2011-01-13 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
nosy:  -brett.cannon
status: pending - open

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I tested cgi_32.patch on Windows with Apache:
 - a test with a binary file works: I get a binary file instead of a text file
 - a test with a non-ASCII character (a\xe9b) works: the text is correctly 
decoded

I used the test script from full_source_and_error.zip.

Comments on cgi_32.patch:

 - I don't understand why FieldStorage changes sys.stdout and sys.stderr (see 
remarks about IOMix above): please remove the charset argument (it is also 
confusing to have two encoding arguments). it should be done somewhere else
 - please remove the O_BINARY hack: the patch is for Python 3.2 and I closed 
issue #10841. If you would like a backport, another patch should be written 
later
 - encoding = 'latin-1' # ?: write a real comment or remove it
 - 'self.fp.read(...) # bytes': you should add a test on the type if you are 
not sure that fp.read() gives bytes
 - file: the file(-like) object from which you can read the data *as bytes*: 
you should mention that TextIOWrapper is also tolerated (accepted?)
 - you may set fp directly to sys.stdin.buffer (instead of sys.stdin) if fp is 
None (it will be easier after removing the O_BINARY thing)
 - the patch adds a tab in an empty line, please don't do that :-)
 - you should add a (private?) attribute to FieldStorage to decide if it works 
on bytes or unicode, instead of using self.filename is not None test (eg. 
self._use_bytes = (self.filename is not None)
 - i don't like the idea of having a generic self.__write() method supporting 
bytes and unicode. it would prefer two methods, eg. self.__write_text() and 
self.__write_binary() (they can share a third private method)
 - i don't like stream_encoding name: what is the stream here? do you 
process a file, a string or a stream? why not just self.encoding?
 - import email.parser,email.feedparser one import is useless here. I prefer 
from email.feedparser import FeedParser because you get directly a 
ImportError if the symbol is missing. And it's already faster to get FeedParser 
instead of email.feedparser.FeedParser in a loop (dummy micro-optimization)
 - even I like the following change, please do it in a separated patch:
-if type(value) is type([]):
+if isinstance(value,list):


I really don't like the IOMix thing:

 - sys.stdout.write() should not accept bytes
 - FieldStorage should not replace sys.stdout and sys.stderr: if you want to 
set the encoding of these files, set PYTHONIOENCODING environment variable 
before running your program (it changes also the encoding of sys.stdio)
 - IOMix should not accept bytes *and* unicode. It's better to have an explicit 
API like stdout.write('unicode') and stdout.buffer.write(b'bytes)


Most parts of the patch are correct and fix real bugs. Since cgi is broken 
currently (eg. it doesn't handle binary files correctly), anything making the 
situation better would be nice.

I vote +0 to commit the patch now (if the release manager agrees), and +1 if 
all of my remarks are fixed.

--

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



[issue7662] time.utcoffset()

2011-01-13 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

I am tired. Do as you wish.

--
status: open - closed

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



[issue7662] time.utcoffset()

2011-01-13 Thread anatoly techtonik

Changes by anatoly techtonik techto...@gmail.com:


--
nosy:  -techtonik

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



[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-01-13 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Le jeudi 13 janvier 2011 à 23:05 +, Alexander Belopolsky a écrit :
 I take your comment as +1 for adding PyModule_GetNameObject().

I wrote a similar patch to add PyModule_GetNameObject() (I am working on
another huge patch, to fix #3080). You have to document the new function
in Doc/c-api/module.rst.

Yes, it's better to work on unicode than encode unicode to bytes
(PyModule_GetName() with UTF-8) and then decode bytes from unicode
(PyUnicode_FromFormat with %s).

I am too tired to review the patch.

--

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



[issue4953] cgi module cannot handle POST with multipart/form-data in 3.x

2011-01-13 Thread Glenn Linderman

Glenn Linderman v+pyt...@g.nevcal.com added the comment:

Victor, thanks for your comments, and interest in this bug.  Other than the 
existence of the charset parameter, and whether or not to include IOMix, I 
think all of the others could be fixed later, and do not hurt at present.  So I 
will just comment on those two comments.

I would prefer to see FieldStorage not have the charset attribute also, but I 
don't have the practice to produce an alternate patch, and I can see that it 
would be a convenience for some CGI scripts to specify that parameter, and have 
one API call do all the work necessary to adjust the IO streams, and read all 
the parameters, and then the rest of the logic of the web app can follow.  
Personally, I adjust the stdout/stderr streams earlier in my scripts, and only 
optionally call FieldStorage, if I determine the request needs such.

I've been using IOMix for some months (I have a version for both Python 2 and 
3), and it solves a real problem in generating web page data streams... the 
data stream should be bytes, but a lot of the data is manipulated using str, 
which would then need to be decoded.  The default encoding of stdout is usually 
wrong, so must somehow be changed.  And when you have chunks of bytes (in my 
experience usually from a database or file) to copy to the output stream, if 
your prior write was str, and then you write bytes to sys.stdout.binary, you 
have to also remember to flush the TextIOBuffer first.  IOMix provides a 
convenient solution to all these problems, doing the flushing for you 
automatically, and just taking what comes and doing the right thing.  If I 
hadn't already invented IOMix to help write web pages, I would want to :)

--

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



[issue10278] add time.wallclock() method

2011-01-13 Thread Glenn Maynard

Glenn Maynard glennfmayn...@gmail.com added the comment:

I agree with Victor: Python should provide a function to supply monotonic time, 
which is what's really wanted for measuring time deltas.  Far too many 
applications incorrectly use the system clock for this, and Python makes this 
worse by not providing any standard library function to allow people to do this 
correctly.

In Windows, it should probably use GetTickCount64 if available, otherwise 
GetTickCount with logic to handle wrapping.  I think QueryPerformanceCounter is 
problematic as a general-purpose timer: depending on the hardware and Windows 
version, it can be offset differently across CPUs, and may not be reliable on 
some processors.  It may be fixed in Vista or Win7, I'm not sure; if so it's 
much higher resolution than GTC.

--
nosy: +glenn

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



[issue7662] time.utcoffset()

2011-01-13 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Just to clarify: Anatoly changed the resolution, not status (and I agree that 
was not appropriate.)  The status was set to pending and that would change to 
open automatically if a new comment is posted.

As for the substance of Anatoly's objection - I agree that this proposal is 
different from #9527.   That is why I set resolution to rejected rathe than 
duplicate.  This issue can probably be properly classified as a duplicate of 
#1647654, but I consider #9527 the most promising solution to the problem of 
finding the system timezone offset.

--
stage: needs patch - committed/rejected

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



[issue1647654] No obvious and correct way to get the time zone offset

2011-01-13 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Closing this in favor of #9527.  See msg126064 for more details.

--
stage: patch review - committed/rejected

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



[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2011-01-13 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Let me summarize the issue: the PyArg_ParseTuple format code 'O' returns a 
borrowed reference.  However, when the 'O' code appears inside parenthesis, 
there may not be an object to hold the reference to borrow from.  This is what 
happens in the test-functools.py crasher:  partial.__setstate__() takes a 
4-tuple argument that is unpacked using a () format.  The test case 
passes an instance instead of a tuple that supports the sequence methods, but 
does not hold the reference to the items that its []-operator returns.  This 
is not a problem at the top level because args argument to PyArg_ParseTuple is 
always a real tuple.

I think that rather than deprecating the use of 'O' format inside parentheses, 
(..O..) unpacking should reject to unpack arguments other than tuples or 
maybe lists.

--
nosy: +belopolsky
stage:  - needs patch

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



[issue9844] calling nonexisting function under __INSURE__

2011-01-13 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

This code is in Modules/main.c, function Py_Main.


In 2.7, only _Py_ReleaseInternedStrings is called, and this function is defined 
in Objects/stringobject.c

In 3k, the two functions are called as specified above. 
_Py_ReleaseInternedStrings doesn't exist in 3k, and 
_Py_ReleaseInternedUnicodeStrings is defined in Objects/unicodeobject.c

I will now supply a patch that removes the call.

--
nosy: +ncoghlan

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2011-01-13 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

Attached patch disallows further reads after a timeout.

--
Added file: http://bugs.python.org/file20398/i7322.patch

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



[issue7936] sys.argv contains only scriptname

2011-01-13 Thread Bill Hayes

Bill Hayes bhaye...@yahoo.com added the comment:

I finally found a solution from a page on StackOverflow.
I had to add the two characters  %*
to the end of the Data value for the Windows registry key:
  HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command
So the Data value is now:
   C:\Python26\python.exe %1 %*
just as it appears above including the two sets of double quotes.

I had modified or added six other keys but only the one above solved the 
problem.
I am running Python 2.6 under MS Windows Vista Home Premium 32 bit.
For completeness I tested potential fixes as follows:
I had a program show_args.py which had the two lines:
  import sys
  print 'argv length is ', len(sys.argv)
In order for show_args.py to receive args from the command line invocation 
(before I did the registry fix) I had to explicitly call the python 
interpreter, so ...

Before the fix:
C:\...python show_args.py aaa bbb ccc
argv length is 4
C:\...show_args.py aaa bbb ccc
argv length is 1

After the fix:
C:\...show_args.py aaa bbb ccc
argv length is 4

In hindsight I should have searched the registry for python paths that didn't 
have the ending %*.

Very briefly, for those unfamiliar with Windows' RegEdit:
Click the Start button and enter   regeditin the Search box and the 
Regedit.exe name will appear in the list above - click it.
Repeatedly do Edit/Find   python.exe   
until you find a python path of the form: ...\python.exe %1
instead of the form ...\python.exe %1 %*
In the right pane of Regedit, under Name click the word (Default), it will turn 
blue, then select Edit/Modify...
Simply add a space and the two chars  %* to the end of the entry in the Value 
data box, then click OK.
Changes take effect immediately; you don't have to reboot or re-open your 
prompt window, but if you are using IDLE or another IDE you probably have to 
close and restart it.

--
versions: +Python 2.6 -Python 3.1

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



[issue9844] calling nonexisting function under __INSURE__

2011-01-13 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Attaching a patch that removes the call of the non-existing function in py3k. I 
ran the test suite and make patchcheck.

I don't remove the whole __INSURE__ since someone might still want it in (and I 
don't have the tool to play around with it). But the call should definitely go, 
since it won't compile this way.

Nick, Terry - your approval - and I'll commit this.

--
keywords: +patch
Added file: http://bugs.python.org/file20399/issue9844.py3k.1.patch

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



[issue7936] sys.argv contains only scriptname

2011-01-13 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3 -Python 2.6

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



  1   2   >