[issue17343] Add a version of str.split which returns an iterator

2013-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> While not required, It'd be useful if the implementation of this pre-scanned 
> the data internally so that the length of the generated sequence was known up 
> front.  This could imply an internal bitset of vector of split indices is 
> kept for the life of the generator (implementation detail left up to the 
> implementor) if scanning over the input data more than once is undesirable.

bytearray can be modified between iterations.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue17344] checking size of size_t... configure: error:

2013-03-03 Thread shilpi

shilpi added the comment:

Hi ,
Currently we are using thi version
cat /etc/release
   Oracle Solaris 10 8/11 s10s_u10wos_17b SPARC
  Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
Assembled 23 August 2011
Regards
Shilpi
-Original Message-
From: Ezio Melotti [mailto:rep...@bugs.python.org] 
Sent: Monday, March 04, 2013 12:20 PM
To: Shilpi Singh (WT01 - GMT-Telecom Equipment)
Subject: [issue17344] checking size of size_t... configure: error:

Ezio Melotti added the comment:

Can you provide more information about your operating system/platform?
Python 2.6 only receives security fixes, so even if it's a bug it can't be 
fixed there (it could be fixed on 2.7 though).

--

___
Python tracker 

___

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com

--

___
Python tracker 

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



[issue16098] Bisect optimization in heapq.nsmallest is never used

2013-03-03 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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



[issue16098] Bisect optimization in heapq.nsmallest is never used

2013-03-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 362826298fdb by Raymond Hettinger in branch 'default':
Issue #16098:  Update heapq.nsmallest to use the same algorithm as nlargest.
http://hg.python.org/cpython/rev/362826298fdb

--
nosy: +python-dev

___
Python tracker 

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



[issue7897] Support parametrized tests in unittest

2013-03-03 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue16997] subtests

2013-03-03 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue17344] checking size of size_t... configure: error:

2013-03-03 Thread Ezio Melotti

Ezio Melotti added the comment:

Can you provide more information about your operating system/platform?
Python 2.6 only receives security fixes, so even if it's a bug it can't be 
fixed there (it could be fixed on 2.7 though).

--

___
Python tracker 

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



[issue17344] checking size of size_t... configure: error:

2013-03-03 Thread shilpi

shilpi added the comment:

I have not tried with Python2.7.
Our requirement that we need python2.6.
If you have any idea or clue for this issue 
Regards
Shilpi

--

___
Python tracker 

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



[issue17344] checking size of size_t... configure: error:

2013-03-03 Thread Ezio Melotti

Ezio Melotti added the comment:

Have you tried with Python 2.7?

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

___
Python tracker 

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



[issue17344] checking size of size_t... configure: error:

2013-03-03 Thread shilpi

New submission from shilpi:

Hi 
we are facing "checking size of size_t error" in building python2.6
checking size of size_t... configure: error: in 
`/var/tmp/python_build/Python-2.6.8':
configure: error: cannot compute sizeof (size_t). Is there any fix for this 
issue or anysolution

--
messages: 183417
nosy: shilpi
priority: normal
severity: normal
status: open
title: checking size of size_t... configure: error:
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



[issue16278] os.rename documentation slightly inaccurate

2013-03-03 Thread Todd Rovito

Todd Rovito added the comment:

Combined the test cases and document changes into a single patch.  As suggested 
by Mr. Terry Reedy I used a table and removed the text.  The table still needs 
some work but it is a good start.  As suggested by Mr. Jerdonek I tried to make 
the test cases WETter by setting up the files and directories one time in the 
setup method then only changing that setup in the actual test case only if 
needed.  

This patch needs still needs some work but I wanted people to know I had not 
quit yet.  It still needs to be tested on Windows, which I will do ASAP.  
Thanks.

--
Added file: http://bugs.python.org/file29301/16278OSRenameDocsTest.patch

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread karl

karl added the comment:

R. David Murray,

You are right it is not specific to the client library. HTTP headers are part 
of the message (Request/Response) with both the same constraints. Constraints 
are put on receivers (receiving a message) and senders (sending a message) of 
the message (which is not specifically related to client or server).

Maybe the way forward in the future is to have a header factory shared by all 
HTTP libs? I noticed that http.client and http.server had similar issues: 

in http.server
   send_header
in http.client
   putheader

Which are similar features aka constructing headers for sending with the 
message. 


And what would be the elegant way to solve this current bug?

Ah… before I forget… The WG is having a meeting in 2 weeks. To make a summary 
of the HTTPBIS work. See the agenda. 
http://tools.ietf.org/wg/httpbis/agenda?item=agenda-86-httpbis.html

The current documents are in Last Call with no issues unresolved.
http://trac.tools.ietf.org/wg/httpbis/trac/report/20

So if R. David is worried that it will change, we can wait a bit more before 
taking actions, if we are going the way of removing leading/trailing spaces.

--

___
Python tracker 

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



[issue16278] os.rename documentation slightly inaccurate

2013-03-03 Thread Todd Rovito

Changes by Todd Rovito :


Removed file: http://bugs.python.org/file28071/OSRenameDocs3point4.patch

___
Python tracker 

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



[issue16278] os.rename documentation slightly inaccurate

2013-03-03 Thread Todd Rovito

Changes by Todd Rovito :


Removed file: http://bugs.python.org/file27890/OSRename_test_os_3point4.patch

___
Python tracker 

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



[issue17343] Add a version of str.split which returns an iterator

2013-03-03 Thread Gregory P. Smith

Gregory P. Smith added the comment:

The bytes (and bytearray?) version of this should generate memoryview's instead 
of new bytes objects to avoid a copy.

While not required, It'd be useful if the implementation of this pre-scanned 
the data internally so that the length of the generated sequence was known up 
front.  This could imply an internal bitset of vector of split indices is kept 
for the life of the generator (implementation detail left up to the 
implementor) if scanning over the input data more than once is undesirable.

Start with a pure python proof of concept to work everywhere, then write a 
native version.

--
nosy: +gregory.p.smith
stage:  -> needs patch
versions: +Python 3.4

___
Python tracker 

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



[issue14645] Generator does not translate linesep characters in certain circumstances

2013-03-03 Thread R. David Murray

R. David Murray added the comment:

Here's a patch, against 3.2.  It definitely does affect smtplib.send_message.

--
keywords: +patch
priority: normal -> high
stage: needs patch -> patch review
Added file: http://bugs.python.org/file29300/generator_lineneds.patch

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread R. David Murray

R. David Murray added the comment:

It is a bug in the program, though, and not particularly in the client library. 
 As mentioned, it can even be useful for testing servers.

In the email package we faithfully reproduce such headers if they are passed 
in.  The only one we disallow is something that looks like a field label 
preceded by a newline, since that could be used for a header injection attack 
if the field value comes from user input.

--

___
Python tracker 

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



[issue17343] Add a version of str.split which returns an iterator

2013-03-03 Thread Alex Gaynor

New submission from Alex Gaynor:

str.split returns a list, which is inefficient when you just want to process 
items one be one. You could emulate this with str.find and tracking indexes 
manually, but this should really be a builtin behavior.

--
messages: 183411
nosy: alex
priority: normal
severity: normal
status: open
title: Add a version of str.split which returns an iterator
type: enhancement

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread karl

karl added the comment:

OK. I'm inclined to think that we should both remove trailing and leading 
spaces/tabs should be removed.

Reasons: 

1. Production rules forbid them.
2. Trailing spaces 
   2.a Conformant servers will ignore with a 400 bad request (opportunity for 
another bugs?)
   2.b Conformant proxies will rewrite the header by removing spaces.
3. Leading spaces are continuation lines. See below.

I had completely missed that. The syntax for headers is:

header-field   = field-name ":" OWS field-value BWS
field-name = token
field-value= *( field-content / obs-fold )
field-content  = *( HTAB / SP / VCHAR / obs-text )
obs-fold   = CRLF ( SP / HTAB )
   ; obsolete line folding
   ; see Section 3.2.4

obs-fold is about line folding which is basically a header that would look like:

foo: bar\n
 blah: something

which could be the equivalent of:

foo: bar blah: something

with "foo" the header field-name and "bar blah: something" the header 
field-value.

which is clearly not the intent of an author doing:

request.add_header('Accept', 'text/html')
request.add_header(' User-Agent', 'foobar/1.0')

because this would be parsed by a conformant server as

Accept: text/html User-Agent: foobar/1.0

--

___
Python tracker 

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



[issue10590] Parameter type error for xml.sax.parseString(string, ...)

2013-03-03 Thread Christian Heimes

Christian Heimes added the comment:

Please hold of any modifications of XML code until we have decided how we are 
going to fix the XML exploits.

Also I think this is a new feature and not a fix. parseString() is documented 
as 'parses from a buffer string'. It doesn't say that it can parse text.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue10590] Parameter type error for xml.sax.parseString(string, ...)

2013-03-03 Thread Eli Bendersky

Eli Bendersky added the comment:

I'm not very knowledgeable in other XML modules, but I hate to see this patch 
linger. Also it's a pre-requisite for #16986, it seems.

Serhiy, since the patch is large could you give a short summary of the things 
it fixes? Note that the best approach IMHO is to submit and push minimal 
patches that fix specific issues and not lump several fixes together, unless it 
doesn't make sense to separate them.

--
nosy: +eli.bendersky

___
Python tracker 

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



[issue12768] docstrings for the threading module

2013-03-03 Thread Eli Bendersky

Eli Bendersky added the comment:

moijes, did you address the review comments?

Does your patch apply to 3.2?

--

___
Python tracker 

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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Ezio Melotti

Ezio Melotti added the comment:

Thanks for the fix -- that solved the problem here too.

--

___
Python tracker 

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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Nadeem Vawda

Nadeem Vawda added the comment:

> You could add a comment explaining the issue.

Done.

This doesn't seem to affect 2.7. Marking as fixed in 3.2/3.3/3.4.

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed
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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 69f737f410f0 by Nadeem Vawda in branch 'default':
Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu.
http://hg.python.org/cpython/rev/69f737f410f0

--

___
Python tracker 

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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 77cbb3ba5d40 by Nadeem Vawda in branch '3.3':
Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu.
http://hg.python.org/cpython/rev/77cbb3ba5d40

--

___
Python tracker 

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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fa24c1382bd3 by Nadeem Vawda in branch '3.2':
Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu.
http://hg.python.org/cpython/rev/fa24c1382bd3

--
nosy: +python-dev

___
Python tracker 

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



[issue17278] SIGSEGV in _heapqmodule.c

2013-03-03 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Antoine, thanks for the patch.  This looks like a reasonable solution that is 
fast and prevents segfaults.

The error message should say more than just that the size changed. it should 
also note that the heap may no longer be in the heap condition since it was 
interrupted in the middle of an update.

I'm also wondering whether a stronger check is needed than detecting a length 
change (perhaps something akin to the logic used in Py_ReprEnter and 
Py_ReprLeave).

--

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread Senthil Kumaran

Senthil Kumaran added the comment:

The curl example also suggest to think about "pragamatic de-facto"
stuff. Will removing the spaces cause any breakage? I can say for
sure. But if someone can think of it, it would be good for at least us
know.

--

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Oh wow. Thank you very much Karl for the care. I am having the same
inclination are you too, but determining a definite answer is really
helpful before going ahead into making the change.

--

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread karl

karl added the comment:

Hello,

So I tested a bit. The production rules defined by the specification are clear. 
Spaces before and after are forbidden. 

header-field   = field-name ":" OWS field-value BWS
field-name = token
field-value= *( field-content / obs-fold )
field-content  = *( HTAB / SP / VCHAR / obs-text )
obs-fold   = CRLF ( SP / HTAB )
   ; obsolete line folding
   ; see Section 3.2.4

and 

  token = 1*tchar

and tchar as 

  tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
   "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA

Here are the production rules for HTTP headers for messages (so both Request 
and Responses). 

You can have funky headers, I guess that would be interesting to add to the 
urllib tests too. Basically to have something in the library, which check if 
header contains the tchar characters and sends back a warning of exception when 
not part of it.

curl has a bug too, IMHO. Though, one might argue that it is practical for 
testing bugs. :)

On the side of parsing it's clear for the trailing space but unknown for the 
leading spaces. I sent a long email explaining the issue to the HTTP WG.

See http://lists.w3.org/Archives/Public/ietf-http-wg/2013JanMar/1166.html

Let's see what will be the answers

--

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Looks like curl is sending the headers without removing spaces. 
Check Raw here link here. (The link would probably be online a week)

http://requestb.in/1kfodmj1?inspect

$ curl --header "X-MyHeader: 123" http://requestb.in/1kfodmj1
ok
$ curl --header "  X-MyHeader:123"http://requestb.in/1kfodmj1
ok
$ curl --header "  X-MyHeader\nY-Header:123" 
http://requestb.in/1kfodmj1
ok

--

___
Python tracker 

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



[issue16447] SEGFAULT when setting type.__name__

2013-03-03 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue16447] SEGFAULT when setting type.__name__

2013-03-03 Thread Mark Dickinson

Changes by Mark Dickinson :


--
stage: needs patch -> commit review

___
Python tracker 

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



[issue16962] _posixsubprocess module uses outdated getdents system call

2013-03-03 Thread Gregory P. Smith

Gregory P. Smith added the comment:

looks sane and cleaner than the silly x32 hack in there, i'll take care of it.  
FYI - your patch forgot to add the "unsigned char d_type;" struct member before 
name.  fixed and applied.

When i wrote that code I was probably assuming that sticking with the ancient 
syscall made more sense for compatibility.  I'm happy to see that compatibility 
goes the other way on this one.

--
assignee:  -> gregory.p.smith
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



[issue16962] _posixsubprocess module uses outdated getdents system call

2013-03-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 30e643e36bae by Gregory P. Smith in branch '3.3':
Issue #16962: Use getdents64 instead of the obsolete getdents syscall in
http://hg.python.org/cpython/rev/30e643e36bae

New changeset 7ab1c55fcf82 by Gregory P. Smith in branch 'default':
Fixes Issue #16962: Use getdents64 instead of the obsolete getdents syscall
http://hg.python.org/cpython/rev/7ab1c55fcf82

--
nosy: +python-dev

___
Python tracker 

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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Yes, it's certainly reasonable. You could add a comment explaining the issue.

--

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread R. David Murray

R. David Murray added the comment:

Good point.  Seeing what curl does sounds like a good idea.

--

___
Python tracker 

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



[issue16962] _posixsubprocess module uses outdated getdents system call

2013-03-03 Thread Charles-François Natali

Charles-François Natali added the comment:

Gregory, do you have time to take care of this?

--
nosy: +neologix

___
Python tracker 

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



[issue15448] utimes() functions fail with ENOSYS even when detected by configure

2013-03-03 Thread Charles-François Natali

Charles-François Natali added the comment:

Alright, closing.

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



[issue16860] Use O_CLOEXEC in the tempfile module

2013-03-03 Thread Charles-François Natali

Charles-François Natali added the comment:

Closing.
Let's keep O_NOFOLLOW: it doesn't buy much, and might be useful for some arcane 
reason on some weird platform...

--
resolution:  -> fixed
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



[issue14123] Indicate that there are no current plans to deprecate printf-style formatting

2013-03-03 Thread Mark Lawrence

Mark Lawrence added the comment:

I can't see too much sense in leaving this open, what are your opinions?

--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Nadeem Vawda

Nadeem Vawda added the comment:

This change fixes the problem (and doesn't break anything else that I can see):

--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -979,7 +979,7 @@
 self.sslconn = self.server.context.wrap_socket(
 self.sock, server_side=True)
 
self.server.selected_protocols.append(self.sslconn.selected_npn_protocol())
-except ssl.SSLError as e:
+except (ssl.SSLError, ConnectionResetError) as e:
 # XXX Various errors can have happened here, for example
 # a mismatching protocol version, an invalid certificate,
 # or a low-level bug. This should be made more 
discriminating.

Does that look reasonable?

--
stage: needs patch -> patch review

___
Python tracker 

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



[issue16447] SEGFAULT when setting type.__name__

2013-03-03 Thread Mark Dickinson

Mark Dickinson added the comment:

And the corresponding patch against 3.2 (applies cleanly to 3.3 and default, 
modulo Misc/NEWS fixes).

--
Added file: http://bugs.python.org/file29299/issue16447_32.patch

___
Python tracker 

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



[issue16447] SEGFAULT when setting type.__name__

2013-03-03 Thread Mark Dickinson

Mark Dickinson added the comment:

Patch for the immediate issue, for Python 2.7.  The Py_DECREF is delayed until 
after setting *both* ht_name and tp_name.

--
Added file: http://bugs.python.org/file29298/issue16447_27.patch

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread Senthil Kumaran

Senthil Kumaran added the comment:

David & Karl - 

I had been thinking on this. My understanding of the RFC implies that "server" 
should reject when the headers contain the whitespace and I had a little 
concern if the client library should feel free to cleanup a wrongly set 
headers? Would it be a good idea to see what curl is doing?

--

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread R. David Murray

R. David Murray added the comment:

Here is a modified patch with the tests moved to test_urllib2.  I'll give 
people some time to comment on whether this should be applied at all, and if so 
if it should be backported.  I'm leaning toward doing both, at the moment.

Karl, thanks for the report and patch.  The urllib tests could use a bit of 
reorganization to make them more discoverable, but I don't know that that is 
very likely to happen :)

The case of doing an add_header with newlines in it is probably worth a 
separate issue.  We fixed a similar issue in the email package a while back, 
but that one was much more likely to be an issue since it is much more likely 
for a program to be adding headers to an email message based on user input than 
it is to be adding headers to a Request based on user input.  But I'm sure it 
does happen, so it is probably worth fixing.

--
Added file: http://bugs.python.org/file29297/request_header_space_removal.patch

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread R. David Murray

R. David Murray added the comment:

Ah, but that's a draft and not approved.  Hmm.  There is a possibility this 
change would break code, if the code tries to look up a header by the same key 
it used to set it.  On the other hand, the key use for the set is already 
modified by the existing code...difficult call.

Having looked in more detail at the test, I think it actually belongs in 
test_urllib2.

--

___
Python tracker 

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



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-03 Thread R. David Murray

R. David Murray added the comment:

Given that this is an RFC violation it looks appropriate as a bug fix for all 
active versions to me.  The patch looks good, though I might decide to break up 
the test.

--
nosy: +r.david.murray
stage:  -> commit review
type:  -> behavior
versions: +Python 2.7, Python 3.2, Python 3.4

___
Python tracker 

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



[issue17341] Poor error message when compiling invalid regex

2013-03-03 Thread R. David Murray

R. David Murray added the comment:

The error is that '<' is not legal in a group name, and the parser is parsing 
the P= form.  The error message could be improved by including the bad 
character in the message.

--
keywords: +easy
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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Ezio Melotti

Changes by Ezio Melotti :


--
priority: normal -> low
versions: +Python 2.7, Python 3.4

___
Python tracker 

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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Ezio Melotti

Ezio Melotti added the comment:

The first traceback comes from 

try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False,
   client_options=ssl.OP_NO_SSLv3)

in test_protocol_sslv3.  The test is marked with the @skip_if_broken_ubuntu_ssl 
decorator, but this seems to be some different kind of brokenness.

--
priority: low -> normal
versions:  -Python 2.7, Python 3.4

___
Python tracker 

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



[issue17342] datetime.strptime does not implement %z

2013-03-03 Thread Zbyněk Winkler

New submission from Zbyněk Winkler:

According to 
http://docs.python.org/2/library/datetime.html#strftime-strptime-behavior the 
%z directive is used to specify the timezone offset  of the form +HHMM or 
-HHMM. However it is not implemented in datetime.strptime.

I'd prefer to have %z available in strptime but if not having it is a 
deliberate decision I think it should be mentioned in the documentation as not 
to confuse users.

--
components: Library (Lib)
messages: 183379
nosy: zwn
priority: normal
severity: normal
status: open
title: datetime.strptime does not implement %z
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



[issue6419] Broken test_kqueue.py on OpenBSD

2013-03-03 Thread Charles-François Natali

Charles-François Natali added the comment:

The test assumes that the input flags (EV_ADD, EV_ENABLE...) will be returned 
in the output events. It's apparently not the case on OpenBSD and NetBSD (and 
probably on OS-X neither, because this check is disabled on this platform), and 
I can't see anything in the kqueue man pages hinting to this behavior (only 
specific flags will be set on output, like EV_ERROR). Knowing which flag was 
specified is not really useful actually.

The patch attached just removes this check (we keep checking the file 
descriptors and filter, of course).

--
keywords: +needs review, patch
Added file: http://bugs.python.org/file29296/kqueue_flags.diff

___
Python tracker 

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



[issue17094] sys._current_frames() reports too many/wrong stack frames

2013-03-03 Thread Charles-François Natali

Charles-François Natali added the comment:

> Did you forget to attach the patch?

Oops...

--
Added file: http://bugs.python.org/file29295/tstate_after_fork.diff

___
Python tracker 

___diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -728,6 +728,31 @@
 for t in threads:
 t.join()
 
+@unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()")
+def test_clear_threads_states_after_fork(self):
+# Issue #17094: check that threads states are cleared after fork()
+
+# start a bunch of threads
+threads = []
+for i in range(16):
+t = threading.Thread(target=lambda : time.sleep(0.3))
+threads.append(t)
+t.start()
+
+pid = os.fork()
+if pid == 0:
+# check that threads states have been cleared
+if len(sys._current_frames()) == 1:
+os._exit(0)
+else:
+os._exit(1)
+else:
+_, status = os.waitpid(pid, 0)
+self.assertEqual(0, status)
+
+for t in threads:
+t.join()
+
 
 class ThreadingExceptionTests(BaseTestCase):
 # A RuntimeError should be raised if Thread.start() is called
diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -364,29 +364,29 @@
 drop_gil(tstate);
 }
 
-/* This function is called from PyOS_AfterFork to ensure that newly
-   created child processes don't hold locks referring to threads which
-   are not running in the child process.  (This could also be done using
-   pthread_atfork mechanism, at least for the pthreads implementation.) */
+/* This function is called from PyOS_AfterFork to destroy all threads which are
+ * not running in the child process, and clear internal locks which might be
+ * held by those threads. (This could also be done using pthread_atfork
+ * mechanism, at least for the pthreads implementation.) */
 
 void
 PyEval_ReInitThreads(void)
 {
 _Py_IDENTIFIER(_after_fork);
 PyObject *threading, *result;
-PyThreadState *tstate = PyThreadState_GET();
+PyThreadState *current_tstate = PyThreadState_GET();
+PyThreadState *tstate, *tstate_next;
 
 if (!gil_created())
 return;
 recreate_gil();
 pending_lock = PyThread_allocate_lock();
-take_gil(tstate);
+take_gil(current_tstate);
 main_thread = PyThread_get_thread_ident();
 
 /* Update the threading module with the new state.
  */
-tstate = PyThreadState_GET();
-threading = PyMapping_GetItemString(tstate->interp->modules,
+threading = PyMapping_GetItemString(current_tstate->interp->modules,
 "threading");
 if (threading == NULL) {
 /* threading not imported */
@@ -399,6 +399,16 @@
 else
 Py_DECREF(result);
 Py_DECREF(threading);
+
+/* destroy all threads except the current one */
+for (tstate = PyInterpreterState_ThreadHead(current_tstate->interp);
+ tstate; tstate = tstate_next) {
+tstate_next = PyThreadState_Next(tstate);
+if (tstate != current_tstate) {
+PyThreadState_Clear(tstate);
+PyThreadState_Delete(tstate);
+}
+}
 }
 
 #else
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16763] test_ssl with connect_ex don't handle unreachable server correctly

2013-03-03 Thread Ezio Melotti

Ezio Melotti added the comment:

Is this still an issue?

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue17341] Poor error message when compiling invalid regex

2013-03-03 Thread Roy Smith

New submission from Roy Smith:

>>> re.compile('(?P=)')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/roy/env/python/lib/python2.7/re.py", line 190, in compile
return _compile(pattern, flags)
  File "/home/roy/env/python/lib/python2.7/re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: bad character in group name


The error here is that I put a "=" where it shouldn't be.  The error message is 
misleading.  The "group name" is the stuff between the <>'s.  That part's fine. 
 What's broken is the stuff outside of the <>'s.

Unclear if it's reasonable to expect such precise error reporting here, but 
this one seems particularly misleading, so opening a ticket to record the 
observation.

--
components: Regular Expressions
messages: 183375
nosy: ezio.melotti, mrabarnett, roysmith
priority: normal
severity: normal
status: open
title: Poor error message when compiling invalid regex
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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ezio, Nadeem, do you want to provide a patch?

--
priority: normal -> low
versions: +Python 2.7, Python 3.4

___
Python tracker 

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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, I guess we could handle the ConnectionResetError as a SSLError for the 
purpose of those tests. What probably happens is that OpenSSL versions, instead 
of answering "sorry, I can't talk to you", brutally reset the connections.

--

___
Python tracker 

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



[issue17032] Misleading error message: global name 'X' is not defined

2013-03-03 Thread Ram Rachum

Ram Rachum added the comment:

Awesome, thanks!

--

___
Python tracker 

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



[issue13898] Ignored exception in test_ssl

2013-03-03 Thread Ezio Melotti

Ezio Melotti added the comment:

I see these failures too on Ubuntu, both in verbose and non-verbose mode:
$ ./python -m test -v test_ssl
== CPython 3.4.0a0 (default:1c71882938eb+, Mar 3 2013, 14:21:46) [GCC 4.6.3]
==   Linux-3.2.0-38-generic-i686-with-debian-wheezy-sid little-endian
==   /home/wolf/dev/py/py3k/build/test_python_21756
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, 
dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, 
verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)
[1/1] test_ssl
test_ssl: testing with 'OpenSSL 1.0.1 14 Mar 2012' (1, 0, 1, 0, 15)
  under Linux ('debian', 'wheezy/sid', '')
  HAS_SNI = True
test_ciphers (test.test_ssl.ContextTests) ... ok
[...]
test_protocol_sslv3 (test.test_ssl.ThreadedTests)
Connecting to an SSLv3 server with various client options ... 
 SSLv3->SSLv3 CERT_NONE
 SSLv3->SSLv3 CERT_OPTIONAL
 SSLv3->SSLv3 CERT_REQUIRED
 {SSLv23->SSLv3} CERT_NONE
Exception in thread Thread-62:
Traceback (most recent call last):
  File "/home/wolf/dev/py/py3k/Lib/threading.py", line 639, in _bootstrap_inner
self.run()
  File "/home/wolf/dev/py/py3k/Lib/test/test_ssl.py", line 1029, in run
if not self.wrap_conn():
  File "/home/wolf/dev/py/py3k/Lib/test/test_ssl.py", line 980, in wrap_conn
self.sock, server_side=True)
  File "/home/wolf/dev/py/py3k/Lib/ssl.py", line 232, in wrap_socket
_context=self)
  File "/home/wolf/dev/py/py3k/Lib/ssl.py", line 332, in __init__
raise x
  File "/home/wolf/dev/py/py3k/Lib/ssl.py", line 328, in __init__
self.do_handshake()
  File "/home/wolf/dev/py/py3k/Lib/ssl.py", line 543, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

 {TLSv1->SSLv3} CERT_NONE
 SSLv23->SSLv3 CERT_NONE
ok
test_protocol_tlsv1 (test.test_ssl.ThreadedTests)
Connecting to a TLSv1 server with various client options ... 
 TLSv1->TLSv1 CERT_NONE
 TLSv1->TLSv1 CERT_OPTIONAL
 TLSv1->TLSv1 CERT_REQUIRED
 {SSLv3->TLSv1} CERT_NONE
 {SSLv23->TLSv1} CERT_NONE
Exception in thread Thread-76:
Traceback (most recent call last):
  File "/home/wolf/dev/py/py3k/Lib/threading.py", line 639, in _bootstrap_inner
self.run()
  File "/home/wolf/dev/py/py3k/Lib/test/test_ssl.py", line 1029, in run
if not self.wrap_conn():
  File "/home/wolf/dev/py/py3k/Lib/test/test_ssl.py", line 980, in wrap_conn
self.sock, server_side=True)
  File "/home/wolf/dev/py/py3k/Lib/ssl.py", line 232, in wrap_socket
_context=self)
  File "/home/wolf/dev/py/py3k/Lib/ssl.py", line 332, in __init__
raise x
  File "/home/wolf/dev/py/py3k/Lib/ssl.py", line 328, in __init__
self.do_handshake()
  File "/home/wolf/dev/py/py3k/Lib/ssl.py", line 543, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

ok
test_recv_send (test.test_ssl.ThreadedTests)
[...]
--
Ran 58 tests in 2.080s

OK (skipped=1)
1 test OK.

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue17032] Misleading error message: global name 'X' is not defined

2013-03-03 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!

--
assignee:  -> ezio.melotti
resolution:  -> fixed
stage: commit 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



[issue17032] Misleading error message: global name 'X' is not defined

2013-03-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f1d3fbcd837d by Ezio Melotti in branch 'default':
#17032: The "global" in the "NameError: global name 'x' is not defined" error 
message has been removed.  Patch by Ram Rachum.
http://hg.python.org/cpython/rev/f1d3fbcd837d

--
nosy: +python-dev

___
Python tracker 

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



[issue16445] SEGFAULT when deleting Exception.message

2013-03-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0e41c4466d58 by Mark Dickinson in branch '2.7':
Issue #16445: Fix potential segmentation fault when deleting an exception 
message.
http://hg.python.org/cpython/rev/0e41c4466d58

--
nosy: +python-dev

___
Python tracker 

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



[issue17340] Handle malformed cookie

2013-03-03 Thread keakon

New submission from keakon:

One of my user told me that she couldn't login to my website yesterday. I 
logged her cookie, and found it began with ',BRIDGE_R=;' which was a malformed 
cookie.
Tornado uses Cookie.SimpleCookie.load() to parse her cookie, and returns an 
empty dict when catching an exception such as CookieError.

In that case, Tornado has to treat her as a new user since it believes she 
didn't provide any cookies.
Even after Tornado tried to set cookie (like user_id) for her, it still 
couldn't parse her cookie the next time.

I checked Issue2193 and found the patch provided by spookylukey could fix the 
bug, but it was rejected.
Why not add a default parameter like strict=True, and let users to decide 
whether to ignore invalid keys or to raise an error?

I believe SimpleCookie is useless for handling malformed cookies right now.
If it's still not acceptable, should I implement my own Cookie class for 
Tornado like Django did 
(https://github.com/django/django/blob/master/django/http/cookie.py)?

--
components: Library (Lib)
messages: 183367
nosy: georg.brandl, keakon, spookylukey
priority: normal
severity: normal
status: open
title: Handle malformed cookie
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



[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2013-03-03 Thread Alex Gaynor

Alex Gaynor added the comment:

That strategy only works if you know the exact count, it fails if you only have 
an estimate (as __length_hint__ gives you).

--

___
Python tracker 

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



[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2013-03-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> There's an obvious need for this, CPython uses optimizations like this
> internally, as does PyPy.

I don't know if it's a need or if it's just "nice to have".
By the way, in the list case it also makes C code simpler, since once
the list is preallocated you just have to call PyList_SET_ITEM to
populate it, and there's no error return to worry about.

Also, lists are easy to pre-allocate in pure Python as well:

l = [None] * N
# populate
for i in range(N):
l[i] = ...

--

___
Python tracker 

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