[issue19023] ctypes docs: Unimplemented and undocumented features

2015-02-20 Thread Martin Panter

Martin Panter added the comment:

Posting a new patch, rebased against the recent “default” (3.5) branch:

* Tweaked so that sentences start with a capital letter
* Added _Pointer.contents

--
Added file: http://bugs.python.org/file38195/arrays-pointers.v3.patch

___
Python tracker 

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



[issue22113] memoryview and struct.pack_into

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Benjamin, what are your thoughts as RM?

> Something similar should be applied to 3.x because PyObject_AsWriteBuffer() 
> is deprecated and not safe.

Done in issue22896.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue20204] pydocs fails for some C implemented classes

2015-02-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue15955] gzip, bz2, lzma: add option to limit output size

2015-02-20 Thread Nikolaus Rath

Nikolaus Rath added the comment:

Attached is a patch for the bz2 module.

--
Added file: http://bugs.python.org/file38194/issue15955_bz2.diff

___
Python tracker 

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



[issue16786] argparse doesn't offer localization interface for "version" action

2015-02-20 Thread Pavel Roskin

Pavel Roskin added the comment:

I have tested the patch. It fixes the problem for me.

You are right, new programs would just supply translated help to the version 
action. No effort would be saved.

But the programs updated from the deprecated syntax may rely on a separate 
string list for translating strings found in argparse.py. They would lose the 
translation for the "--version" help without any warning. 
Debugging and fixing that would take some effort.

--
nosy: +proski

___
Python tracker 

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



[issue21793] httplib client/server status refactor

2015-02-20 Thread Martin Panter

Martin Panter added the comment:

I think you will find the error logging was already fine, since it already uses 
%d:

127.0.0.1 - - [21/Feb/2015 04:02:06] code 404, message File not found
127.0.0.1 - - [21/Feb/2015 04:02:06] "GET /nonexistant HTTP/1.1" 
HTTPStatus.NOT_FOUND -

The new codes in the tests look okay though.

--

___
Python tracker 

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



[issue23484] SemLock acquire() keyword arg 'blocking' is invalid

2015-02-20 Thread Davin Potts

Davin Potts added the comment:

Of course, there's code in the wild that expects and uses the parameter named 
'block' so simply changing this keyword will result in breaking others' code.

Two potentially appealing options:
1) Document that acquire in multiprocessing differs from threading in this way.
2) Implement 'blocking' as a supported keyword argument though preserve support 
for 'block' as a deprecated keyword.

--

___
Python tracker 

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



[issue21793] httplib client/server status refactor

2015-02-20 Thread Demian Brecht

Demian Brecht added the comment:

Latest patch should address all comments. It also fixes the same issue in error 
logging which wasn’t previously accounted for. The test file has also been 
updated with using HTTPStatus where possible rather than hard coded ints. This 
is consistent with other areas in the http package.

--
Added file: http://bugs.python.org/file38193/issue21793_logfix_3.patch

___
Python tracker 

___diff -r 46bfddb14cbe Lib/http/server.py
--- a/Lib/http/server.pyFri Feb 20 10:34:20 2015 -0500
+++ b/Lib/http/server.pyFri Feb 20 17:37:25 2015 -0800
@@ -442,6 +442,10 @@
 message = shortmsg
 if explain is None:
 explain = longmsg
+
+if isinstance(code, HTTPStatus):
+code = code.value
+
 self.log_error("code %d, message %s", code, message)
 # using _quote_html to prevent Cross Site Scripting attacks (see bug 
#1100201)
 content = (self.error_message_format %
@@ -517,6 +521,8 @@
 This is called by send_response().
 
 """
+if isinstance(code, HTTPStatus):
+code = code.value
 
 self.log_message('"%s" %s %s',
  self.requestline, str(code), str(size))
diff -r 46bfddb14cbe Lib/test/test_httpservers.py
--- a/Lib/test/test_httpservers.py  Fri Feb 20 10:34:20 2015 -0500
+++ b/Lib/test/test_httpservers.py  Fri Feb 20 17:37:25 2015 -0800
@@ -6,7 +6,7 @@
 
 from http.server import BaseHTTPRequestHandler, HTTPServer, \
  SimpleHTTPRequestHandler, CGIHTTPRequestHandler
-from http import server
+from http import server, HTTPStatus
 
 import os
 import sys
@@ -79,13 +79,13 @@
 default_request_version = 'HTTP/1.1'
 
 def do_TEST(self):
-self.send_response(204)
+self.send_response(HTTPStatus.NO_CONTENT)
 self.send_header('Content-Type', 'text/html')
 self.send_header('Connection', 'close')
 self.end_headers()
 
 def do_KEEP(self):
-self.send_response(204)
+self.send_response(HTTPStatus.NO_CONTENT)
 self.send_header('Content-Type', 'text/html')
 self.send_header('Connection', 'keep-alive')
 self.end_headers()
@@ -94,7 +94,7 @@
 self.send_error(999)
 
 def do_NOTFOUND(self):
-self.send_error(404)
+self.send_error(HTTPStatus.NOT_FOUND)
 
 def do_EXPLAINERROR(self):
 self.send_error(999, "Short Message",
@@ -122,35 +122,35 @@
 def test_command(self):
 self.con.request('GET', '/')
 res = self.con.getresponse()
-self.assertEqual(res.status, 501)
+self.assertEqual(res.status, HTTPStatus.NOT_IMPLEMENTED)
 
 def test_request_line_trimming(self):
 self.con._http_vsn_str = 'HTTP/1.1\n'
 self.con.putrequest('XYZBOGUS', '/')
 self.con.endheaders()
 res = self.con.getresponse()
-self.assertEqual(res.status, 501)
+self.assertEqual(res.status, HTTPStatus.NOT_IMPLEMENTED)
 
 def test_version_bogus(self):
 self.con._http_vsn_str = 'FUBAR'
 self.con.putrequest('GET', '/')
 self.con.endheaders()
 res = self.con.getresponse()
-self.assertEqual(res.status, 400)
+self.assertEqual(res.status, HTTPStatus.BAD_REQUEST)
 
 def test_version_digits(self):
 self.con._http_vsn_str = 'HTTP/9.9.9'
 self.con.putrequest('GET', '/')
 self.con.endheaders()
 res = self.con.getresponse()
-self.assertEqual(res.status, 400)
+self.assertEqual(res.status, HTTPStatus.BAD_REQUEST)
 
 def test_version_none_get(self):
 self.con._http_vsn_str = ''
 self.con.putrequest('GET', '/')
 self.con.endheaders()
 res = self.con.getresponse()
-self.assertEqual(res.status, 501)
+self.assertEqual(res.status, HTTPStatus.NOT_IMPLEMENTED)
 
 def test_version_none(self):
 # Test that a valid method is rejected when not HTTP/1.x
@@ -158,7 +158,7 @@
 self.con.putrequest('CUSTOM', '/')
 self.con.endheaders()
 res = self.con.getresponse()
-self.assertEqual(res.status, 400)
+self.assertEqual(res.status, HTTPStatus.BAD_REQUEST)
 
 def test_version_invalid(self):
 self.con._http_vsn = 99
@@ -166,21 +166,21 @@
 self.con.putrequest('GET', '/')
 self.con.endheaders()
 res = self.con.getresponse()
-self.assertEqual(res.status, 505)
+self.assertEqual(res.status, HTTPStatus.HTTP_VERSION_NOT_SUPPORTED)
 
 def test_send_blank(self):
 self.con._http_vsn_str = ''
 self.con.putrequest('', '')
 self.con.endheaders()
 res = self.con.getresponse()
-self.assertEqual(res.status, 400)
+self.assertEqual(res.stat

[issue23495] The writer.writerows method should be documented as accepting any iterable (not only a list)

2015-02-20 Thread Steven Barker

Steven Barker added the comment:

Another Stack Overflow user pointed out that the DictWriter's writerows 
implementation (in pure Python) unnecessarily converts whatever its argument is 
into a list in memory before passing it on to the builtin writer.writerows 
method which would accept any iterable type. Probably it should be changed to 
use map or a generator expression instead.

So, perhaps this issue isn't purely documentation, but actually a small 
behavior enhancement as well.

--

___
Python tracker 

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-20 Thread Josh Rosenberg

Changes by Josh Rosenberg :


--
nosy: +josh.r

___
Python tracker 

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



[issue23493] optimize sort_keys in json module by using operator.itemgetter()

2015-02-20 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Is it even legal to have non-string keys in a JSON object? If they must be 
strings, and they must be unique, I don't think a key argument is necessary 
(and it would save the generation of the key array; not doing the work is 
faster than doing the work more efficiently after all), since the default tuple 
comparison would work fine; the first element would always be unequal, so the 
second elements would never be compared, right?

I'm not 100% on this with the rich comparison operator approach, but my 
attempts to trigger a failure haven't worked (TimSort or the tuple comparison, 
or both, are probably smarter about this than I am).

--
nosy: +josh.r

___
Python tracker 

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



[issue23489] atexit handlers are not executed when using multiprocessing.Pool.map.

2015-02-20 Thread Davin Potts

Davin Potts added the comment:

You make an overall valid point that despite reading the documentation, the 
resulting behavior of your code was not what you expected -- I take that 
specific complaint very seriously anytime anyone makes it.


Regarding your recommendations:

I) Unfortunately this is not a trivial topic; it has been discussed extensively 
elsewhere.  As you point out, this is a different topic.

II) Please do note the atexit documentation does not suggest it is a tool for 
triggering actions when a _process_ exits.  I don't think I'm a pedant but that 
kinda makes me sound like one.



Here are some suggestions on potential next steps:

1. If the documentation for atexit is inadequate in getting across its true 
nature and limitations, would you please open a new issue against atexit's 
documentation?  In it, please recommend what would have made it much clearer.

2. Detecting that atexit functionality has been invoked inside a process 
created using multiprocessing does not cover the full range of possibilities 
where atexit functionality is impacted and thus the originally-intended/desired 
behavior will not occur.  Ignoring the larger set of possible scenarios for the 
moment, I think a case could be made to add an atexit-like feature to 
multiprocessing that would give you specific control over what happens when a 
process created by multiprocessing is done and terminates.  If that appeals to 
you too, would you consider opening a new issue proposing this feature request 
and, given your use cases to date, please suggest things that would make it 
especially valuable?



Apologies if any choice of phrasing on my part added in any way to your 
frustration -- it was not my intention.  I do hope you'll be able to contribute 
something more, possibly along the lines I suggest.

--

___
Python tracker 

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



[issue23215] MemoryError with custom error handlers and multibyte codecs

2015-02-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue23215] MemoryError with custom error handlers and multibyte codecs

2015-02-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset af8089217cc6 by Serhiy Storchaka in branch '2.7':
Issue #23215: Multibyte codecs with custom error handlers that ignores errors
https://hg.python.org/cpython/rev/af8089217cc6

New changeset 4dc8b7ed8973 by Serhiy Storchaka in branch '3.4':
Issue #23215: Multibyte codecs with custom error handlers that ignores errors
https://hg.python.org/cpython/rev/4dc8b7ed8973

New changeset 5620691ce26b by Serhiy Storchaka in branch 'default':
Issue #23215: Multibyte codecs with custom error handlers that ignores errors
https://hg.python.org/cpython/rev/5620691ce26b

--

___
Python tracker 

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



[issue21934] OpenBSD has no /dev/full device

2015-02-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue21793] httplib client/server status refactor

2015-02-20 Thread Demian Brecht

Demian Brecht added the comment:

> On Feb 20, 2015, at 2:50 PM, Serhiy Storchaka  wrote:
> 
> if isinstance(code, HTTPStatus):
>code = '%d' % code

That’s what I’m intending on doing. It’s definitely not as contained as 
changing the __str__ implementation of HTTPStatus. That said, I understand the 
reasoning behind not doing so and this path is the next clearest.

--

___
Python tracker 

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



[issue21793] httplib client/server status refactor

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I would write just:

if isinstance(code, HTTPStatus):
code = '%d' % code

--

___
Python tracker 

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



[issue21793] httplib client/server status refactor

2015-02-20 Thread Martin Panter

Martin Panter added the comment:

One option might be changing log_request() from

self.log_message('"%s" %s %s',
 self.requestline, str(code), str(size))

to

self.log_message('"%s" %s %s',
 self.requestline, format(code), size)

Using str() is redundant with %s, and using format() instead invokes the int 
base class’s __format__() rather than the enum’s __repr__().

--

___
Python tracker 

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



[issue5700] io.FileIO calls flush() after file closed

2015-02-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue5700] io.FileIO calls flush() after file closed

2015-02-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7052206ad381 by Serhiy Storchaka in branch '2.7':
Issue #5700: io.FileIO() called flush() after closing the file.
https://hg.python.org/cpython/rev/7052206ad381

New changeset 36f5c36b7704 by Serhiy Storchaka in branch '3.4':
Issue #5700: io.FileIO() called flush() after closing the file.
https://hg.python.org/cpython/rev/36f5c36b7704

New changeset e1f08f5b6b62 by Serhiy Storchaka in branch 'default':
Issue #5700: io.FileIO() called flush() after closing the file.
https://hg.python.org/cpython/rev/e1f08f5b6b62

--
nosy: +python-dev

___
Python tracker 

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



[issue23297] ‘tokenize.detect_encoding’ is confused between text and bytes: no ‘startswith’ method on a byte string

2015-02-20 Thread R. David Murray

R. David Murray added the comment:

The error message could indeed be made clearer by turning it into a message 
that tokenize itself requires bytes input.  Or, more likely, the additional 
error handling needs to be in detect_encoding.

--

___
Python tracker 

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



[issue5700] io.FileIO calls flush() after file closed

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Agree, the test in test_fileio is redundant.

--

___
Python tracker 

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



[issue22834] Unexpected FileNotFoundError when current directory is removed

2015-02-20 Thread Martin Panter

Martin Panter added the comment:

+1 to EINVAL, also the bug reference comment is redundant with the one at the 
top of the test case :)

--

___
Python tracker 

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



[issue23489] atexit handlers are not executed when using multiprocessing.Pool.map.

2015-02-20 Thread juj

juj added the comment:

While the test case can be 'fixed' by changing the code to use "if __name__ == 
'__main__'", and I'm ok to do it in my code to work around the problem, I would 
argue the following:

1) calling this not a bug (or solving it only at documentation level) does not 
at all feel correct to reflect the situation, since the provided test case 
silently fails and does the unexpected. If atexit() does not work at all when 
invoked as a result of importing from multiprocessing.Pool.map(), then at 
minimum it would be better that calling atexit() in such a scenario should 
throw an exception "not available", rather than silently discarding the 
operation.

2) Why couldn't the atexit handlers be executed even on Windows when the 
multiprocessing processes quit, even if special code is required in python 
multiprocessing libraries to handle it? The explanation you are giving sounds 
like a lazy excuse. There should not be any technical obstacle why the cleanup 
handlers could not be tracked and honored here?

3) Saying that this should not be working like the (existing) documentation 
implies, is not at all obvious to the reader. I could not find it documented 
that processes that exit from multiprocessing would be somehow special, and the 
note that you pasted does is not in any way obvious to connect to this case, 
since a) I was not using signals, b) there was no internal error occurring, and 
c) I was not calling os._exit(). The documentation does not reflect that it is 
undefined whether atexit() handlers are executed or not when multiprocessing is 
used.

4) I would even argue that it is a bug that there is different cross platform 
observable behavior in terms of multiprocessing and script importing, but that 
is probably a different topic.

Overall, leaving this as a silent failure, instead of raising an exception, nor 
implementing the support on Windows, does not feel mature, since it leaves a 
hole of C/C++ style of undefined behavior in the libraries. For maturity, I 
would recommend something to be done, in the descending order of preference:

I) Fix multiprocessing importing on windows so that it is not a special case 
compared to other OSes.

II) If the above is not possible, fix the atexit() handlers so that they are 
executed when the processes quit on Windows.

III) If the above is not possible, make the atexit() function raise an 
exception if invoked from a script that has been spawned from multiprocessing, 
when it is known at atexit() call time that the script was spawned a as a 
result of multiprocessing, and the atexit() handlers will never be run.

If none of those are really not possible due to real technical reasons, then as 
a last resort, explicitly document both in the docs for atexit() and the docs 
for multiprocessing that the atexit() handlers are not executed if called on 
Windows when these two are used in conjunction.

Disregarding these kind of silent failure behavior especially when 
cross-platformness is involved with a shrug and a NotABug label is not a good 
practice!

--

___
Python tracker 

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e7b6b1f57268 by Serhiy Storchaka in branch '3.4':
Issue #23374: Fixed pydoc failure with non-ASCII files when stdout encoding
https://hg.python.org/cpython/rev/e7b6b1f57268

New changeset affe167a45f3 by Serhiy Storchaka in branch 'default':
Issue #23374: Fixed pydoc failure with non-ASCII files when stdout encoding
https://hg.python.org/cpython/rev/affe167a45f3

--
nosy: +python-dev

___
Python tracker 

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue11145] '%o' % user-defined instance

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, I didn't find any issues with the last patch. Could you please point on 
them?

--

___
Python tracker 

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



[issue23484] SemLock acquire() keyword arg 'blocking' is invalid

2015-02-20 Thread Davin Potts

Davin Potts added the comment:

Interesting!  The documentation in 3.4 as well as 2.7 indicates that the 
keyword should be 'blocking' yet the code implements this as 'block'.

Code to reproduce empirically what is actually implemented:
import multiprocessing
dummy_lock = multiprocessing.Lock()
dummy_lock.acquire(blocking=False)   # Raises a TypeError on invalid keyword

The same code changed to 'block=False' works happily.


The code should be changed to reflect the docs and a test probably added too 
that both exercises this keyword explicitly by name and tests to see if we've 
fallen out of sync with the threading module.

--
stage:  -> needs patch
versions: +Python 2.7, Python 3.5

___
Python tracker 

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



[issue23494] adding timedelta to datetime object is not timezone aware

2015-02-20 Thread R. David Murray

R. David Murray added the comment:

the tzinfo object is responsible for handling daylight savings time.  This 
looks like a bug in pytz.

--
components: +Library (Lib) -Distutils
nosy: +belopolsky, r.david.murray -dstufft, eric.araujo

___
Python tracker 

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



[issue23489] atexit handlers are not executed when using multiprocessing.Pool.map.

2015-02-20 Thread Davin Potts

Davin Potts added the comment:

I should have added in my prior comments:

juj:  thank you very much for providing the info about the platform you tested 
on and even an example piece of code that triggered the problem.  I wish all 
issues came with the level of info you provided.

--

___
Python tracker 

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



[issue23489] atexit handlers are not executed when using multiprocessing.Pool.map.

2015-02-20 Thread Davin Potts

Davin Potts added the comment:

There are at least two issues at play here.


Running the attached file on OS X produces starkly different results -- console 
prints:
CREATED TEMP DIRECTORY 
/var/folders/s4/tc1y5rjx25vfknpzvnfh1b14gn/T/temp_z6I0BA
task1
task2
ATEXIT: REMOVING TEMP DIRECTORY 
/var/folders/s4/tc1y5rjx25vfknpzvnfh1b14gn/T/temp_z6I0BA


The reason only one temp directory is created on OS X (or on other unix-y 
platforms) and more than one is created on Windows is described in more detail 
here:
https://docs.python.org/2/library/multiprocessing.html#windows

In short, on Windows 8.1, the processes you spawn via multiprocessing must 
import your main module ("task_spawn" in this case) and in so doing each 
executes both the line creating a temp directory and the lines following it 
(this is part of how import works).  I suspect you want instead to put these 
lines inside a "if __name__ == '__main__'" clause -- doing so will ensure only 
one temp dir is created and it will be properly cleaned up when the interpreter 
exits cleanly.  You will have consistent behavior across Windows and unix-y 
platforms this way too, not to mention your code will more clearly convey that 
you only want the main process to create a temp dir.  (Specifically see the 
section "Safe importing of main module" in the docs at the above link.)


That was the first issue -- on to the second.


The registering of functions with atexit means they'll be executed upon "normal 
interpreter termination".  Lifting a snippet from the atexit docs' introduction 
section (https://docs.python.org/2/library/atexit.html):

  Note: The functions registered via this module are not called when the 
program is killed by a signal not handled by Python, when a Python fatal 
internal error is detected, or when os._exit() is called.

When the processes created and managed via multiprocessing reach termination, 
that is quite different from "normal interpreter termination".  You are 
observing that when the interpreter's (main) process is done, it executes the 
function you registered with atexit -- that is how it should be.  Registering 
functions with atexit inside distinct processes will not cause them to be 
automagically registered with atexit in the parent interpreter process.



Hopefully with the above explanation in hand it will be possible to make the 
necessary changes to correct your code without breaking a sweat.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue23495] The writer.writerows method should be documented as accepting any iterable (not only a list)

2015-02-20 Thread Steven Barker

New submission from Steven Barker:

The documentation for the csv.writer.writerows method says that it expects "a 
list of row objects", when it really will accept any iterable that yields rows 
(such as a generator). While it's often nice for code to be more accepting than 
the documented requirements, I think the docs in this case should state that 
writerows() expects an iterable, rather than misinforming users that a list is 
required.

This documentation issue was brought up in a Stack Overflow question here: 
http://stackoverflow.com/questions/28636848/csv-writer-writerows-takes-iterator

I expect the necessary documentation patch will be pretty trivial, and if 
nobody else gets to it first, I will try to provide one when I have enough time 
to update my cpython checkout (not soon, alas).

--
assignee: docs@python
components: Documentation
messages: 236328
nosy: Steven.Barker, docs@python
priority: normal
severity: normal
status: open
title: The writer.writerows method should be documented as accepting any 
iterable (not only a list)
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue23476] SSL cert verify fail for "www.verisign.com"

2015-02-20 Thread John Nagle

John Nagle added the comment:

The "fix" in Ubuntu was to the Ubuntu certificate store, which is a directory 
tree with one cert per file, with lots of symbolic links with names based on 
hashes to express dependencies. Python's SSL isn't using that.  Python is 
taking in one big text file of SSL certs, with no link structure, and feeding 
it to OpenSSL.  

This is an option at

 SSLContext.load_verify_locations(cafile=None, capath=None, cadata=None)

I've been testing with "cafile".  "capath" is a path to a set of preprocessed 
certs laid out like the Ubuntu certificate store.  It may be that the directory 
parameter works but the single-file parameter does not.  It's possible to 
create such a directory from a single .pem file by splitting the big file into 
smaller files (the suggested tool is an "awk" script) and then running 
"c_rehash", which comes with OpenSSL.  See 
"https://www.openssl.org/docs/apps/c_rehash.html";  

So I tried a workaround, using Python 3.4.0 and Ubuntu 14.04 LTS.  I broke up 
"cacert.pem" into one file per cert with the suggested "awk" script, and used 
"c_rehash" to build all the links, creating a directory suitable for "capath". 
It didn't help.  Fails for "verisign.com", works for "python.org" and 
"google.com", just like the original single-file test. The "capath" version did 
exactly the same thing as the "cafile" version.

Python is definitely reading the cert file or directories; if I try an empty 
cert file or dir, everything fails, like it should.

Tried the same thing on Win7 x64. Same result. Tried the command line openssl 
tool using the cert directory. Same results as with the single file on both 
platforms.

So that's not it. 

A fix to OpenSSL was proposed in 2012, but no action was taken:

http://rt.openssl.org/Ticket/Display.html?id=2732 at
"Wed Jun 13 17:15:04 2012 Arne Becker - Correspondence added".

Any ideas?

--

___
Python tracker 

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



[issue23494] adding timedelta to datetime object is not timezone aware

2015-02-20 Thread Gil Shotan

New submission from Gil Shotan:

I encountered a strange bug involving timezone aware datetime objects and 
timedelta objects.

The crux of the matter is that daylight savings time is considered a different 
timezone, and therefore the timezone of a datetime object is date dependent. 
However, adding a timedelta object to a datetime object seems to do the simple 
thing which is preserve the timezone object. The bug manifests itself whenever 
adding a timedelta object crosses a daylight savings time boundary.

The following code illustrates the problem. Note that the transition between 
PDT (Pacific daylight time) and PST (Pacific savings time) occurs on March 9th 
(ish)

>>> from datetime import datetime, timedelta
>>> import pytz
>>> tz = pytz.timezone('America/Los_Angeles')
>>> before = tz.localize(datetime(year=2015, month=3, day=8))
>>> before
datetime.datetime(2015, 3, 8, 0, 0, tzinfo=)
>>> # notice PST timezone
>>> after_right = tz.localize(datetime(year=2015, month=3, day=10))
>>> after_right
datetime.datetime(2015, 3, 10, 0, 0, tzinfo=)
>>> # notice PDT timezone
>>> after_wrong = before + timedelta(days=2)
>>> after_wrong
datetime.datetime(2015, 3, 10, 0, 0, tzinfo=)
>>> # when calculated this way, the timezone remains at PST

--
components: Distutils
messages: 236326
nosy: dstufft, eric.araujo, gilsho
priority: normal
severity: normal
status: open
title: adding timedelta to datetime object is not timezone aware
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your report paul.

--
assignee:  -> serhiy.storchaka
components: +Interpreter Core
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +Python 3.5

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Can we use here then?

It is for PyObjects.

--

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 038297948389 by Serhiy Storchaka in branch '3.4':
Issue #23490: Fixed possible crashes related to interoperability between
https://hg.python.org/cpython/rev/038297948389

New changeset 56c6a4bce996 by Serhiy Storchaka in branch 'default':
Issue #23490: Fixed possible crashes related to interoperability between
https://hg.python.org/cpython/rev/56c6a4bce996

--
nosy: +python-dev

___
Python tracker 

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



[issue6820] Redefinition of HAVE_STRFTIME can cause compiler errors.

2015-02-20 Thread Mark Lawrence

Mark Lawrence added the comment:

Having had another look the patch is not acceptable as the majority of the 
changes are to whitespace only.

--

___
Python tracker 

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



[issue14484] missing return in win32_kill?

2015-02-20 Thread Mark Lawrence

Mark Lawrence added the comment:

#14480 "os.kill on Windows should accept zero as signal" references this.  It 
seems that we either go all the way and change the code as Victor has suggested 
or keep the status quo and change the docs as Zach has said.  Thoughts?

--
nosy: +steve.dower

___
Python tracker 

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



[issue23476] SSL cert verify fail for "www.verisign.com"

2015-02-20 Thread Laura Creighton

Laura Creighton added the comment:

In https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1014640
it says :

FIX:
Fixed in Ubuntu 14.04 apparently.
Openssl upstream, see http://rt.openssl.org/Ticket/Display.html?id=2732

But I think the person who wrote that launchpad note was mistaken, as
the rt.openssl.org ticket still is marked open when I looked at it.

--

___
Python tracker 

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



[issue23342] run() - unified high-level interface for subprocess

2015-02-20 Thread Thomas Kluyver

Thomas Kluyver added the comment:

Can I interest any of you in further review? I think I have responded to all 
comments so far. Thanks!

--

___
Python tracker 

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



[issue23476] SSL cert verify fail for "www.verisign.com"

2015-02-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> This may be related to a known, and fixed, OpenSSL bug.

Where do you see that the bug is fixed?

--
nosy: +pitrou

___
Python tracker 

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



[issue23476] SSL cert verify fail for "www.verisign.com"

2015-02-20 Thread Demian Brecht

Changes by Demian Brecht :


--
nosy: +demian.brecht

___
Python tracker 

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



[issue23458] [2.7] random: make the file descriptor non-inheritable (on POSIX)

2015-02-20 Thread Ed Maste

Ed Maste added the comment:

For reference, this fd leak was causing one of LLDB's tests to fail. It is now 
marked XFAIL pending a resolution of this issue: 
http://llvm.org/viewvc/llvm-project?view=revision&revision=229704

Linux is also affected, the Linux LLDB tests were previously running on an 
earlier Python version which did not demonstrate this problem.

--

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread Benjamin Peterson

Benjamin Peterson added the comment:

On Fri, Feb 20, 2015, at 12:39, Serhiy Storchaka wrote:
> 
> Serhiy Storchaka added the comment:
> 
> > I think it looks fine except why do you cast PyUnicode_LENGTH to size_t in
> > the comparison?
> 
> To silence compiler warning. PyUnicode_LENGTH is signed, right hand is 
> unsigned.

Okay.

> 
> > I also wonder if we should have PyObject_NEW now.
> 
> We have PyObject_NEW.

Can we use here then?

--

___
Python tracker 

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



[issue23458] [2.7] random: make the file descriptor non-inheritable (on POSIX)

2015-02-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is one step on long way. Second step will be to inline PyArg_Parse for 
some format codes ("i", "U", "y*", "O&", "O!"). Then we could try to expand 
PyArg_ParseTuple, at least for simple common cases. Then 
PyArg_ParseTupleAndKeywords. All this step will produce large diffs for 
generated code.

--

___
Python tracker 

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



[issue23458] [2.7] random: make the file descriptor non-inheritable (on POSIX)

2015-02-20 Thread Ed Maste

Changes by Ed Maste :


--
nosy: +Ed.Maste

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I think it looks fine except why do you cast PyUnicode_LENGTH to size_t in
> the comparison?

To silence compiler warning. PyUnicode_LENGTH is signed, right hand is 
unsigned.

> I also wonder if we should have PyObject_NEW now.

We have PyObject_NEW.

--

___
Python tracker 

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-20 Thread Larry Hastings

Larry Hastings added the comment:

I'm not opposed to the patch in principle.  I assume your goal is to make 
Python faster--do you have any data on how much faster?

I don't support immediately changing all uses of Argument Clinic to generate 
their code into a separate file.  I would want to see a consensus from the 
community first.  Perhaps we should discuss it (again?) on python-dev?

--

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I think it looks fine except why do you cast PyUnicode_LENGTH to size_t in the 
comparison?

I also wonder if we should have PyObject_NEW now.

--
stage: patch review -> 
versions:  -Python 3.5

___
Python tracker 

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



[issue23018] Add version info to python

2015-02-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 843a8ee94270 by Steve Dower in branch 'default':
Closes #23018: Replace copyright symbol with escape.
https://hg.python.org/cpython/rev/843a8ee94270

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-20 Thread Paul Moore

Paul Moore added the comment:

On 20 February 2015 at 16:31, Wolfgang Maier  wrote:
>> The scope of this PEP is just to make the "py" command (with no explicit 
>> version) use an active virtualenv before falling back to the default Python. 
>> This is specifically to allow people who don't put Python on their PATH but 
>> use virtualenvs to use "py" consistently, rather than having to switch to 
>> "python" when they are in a virtualenv. See the PEP (specifically the 
>> rationale section) for details.
>>
>
> Right, just that
>
> #!/usr/bin/env python3
>
> is a very plausible shebang line for a Python3 script for use under UNIX 
> where #!/usr/bin/env python typically means python2.

That seems completely reasonable. Presumably this works for Unix
because virtualenvs have a "python3" executable installed, not just a
"python" executable?

> So, with the current patch users could still not use the py launcher from a 
> virtual environment with scripts that are supposed to work under UNIX :(

Correct. That's not the problem this PEP is intended to solve. Another
PEP could be written to look at this, but I suspect it could be quite
hard to balance the various issues involved. As a start, maybe the
Python Windows installer should be writing a "python3.exe" as well as
"python.exe" and venv should put that in the virtualenv. (That's
certainly something that has been suggested in the past). That may be
a simpler solution than adding yet more complexity and special cases
to the launcher.

Personally, I don't have a need for this functionality, so I'm happy
to leave that PEP to someone else to write.

--

___
Python tracker 

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



[issue23018] Add version info to python

2015-02-20 Thread Steve Dower

Steve Dower added the comment:

Digging around the likely encodings to be running on Windows machines, it looks 
like 0xA9 is always the right symbol, so that change should be fine.

--

___
Python tracker 

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



[issue23491] PEP 441 - Improving Python Zip Application Support

2015-02-20 Thread Paul Moore

Paul Moore added the comment:

Thanks. Updated patch with the new mime-type.

Looks like there's disk errors on that file with the CRC check. Lovely :-)

--
Added file: http://bugs.python.org/file38192/pep441.patch

___
Python tracker 

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



[issue23018] Add version info to python

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I afraid that adding source file that can't be easy handled by Unix text tools 
(such as diff) is not good idea. Does "\xa9" work?

--

___
Python tracker 

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



[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-20 Thread Wolfgang Maier

Wolfgang Maier added the comment:

> Hmm, I didn't know that (although virtualenv-based environments don't have an 
> equivalent to pyvenv.cfg).

Well, that complicates things then :(
 
> But there's some confusion here. This patch only affects command line usage 
> (running "py.exe" to start Python). I don't really see a use case for making 
> "py -3" mean "the virtualenv if it's Python 3 otherwise ignore the virtualenv 
> and use the system Python 3".
> 
> For scripts, shebang processing isn't altered. Nothing uses a virtualenv 
> except "#!/usr/bin/env python". And that does so only because it searches 
> PATH before looking at the registry. If you use "#!/usr/bin/env python3" it 
> won't see a virtualenv because there is no python3.exe in a virtualenv...
>

Well, and that's exactly what I think is a mistake ...
 
> The scope of this PEP is just to make the "py" command (with no explicit 
> version) use an active virtualenv before falling back to the default Python. 
> This is specifically to allow people who don't put Python on their PATH but 
> use virtualenvs to use "py" consistently, rather than having to switch to 
> "python" when they are in a virtualenv. See the PEP (specifically the 
> rationale section) for details.
> 

Right, just that

#!/usr/bin/env python3

is a very plausible shebang line for a Python3 script for use under UNIX where 
#!/usr/bin/env python typically means python2.

So, with the current patch users could still not use the py launcher from a 
virtual environment with scripts that are supposed to work under UNIX :(

--

___
Python tracker 

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



[issue21793] httplib client/server status refactor

2015-02-20 Thread Demian Brecht

Demian Brecht added the comment:

The updated patch addresses comments which I’d somehow missed previously, but 
keeps the log fix to the __str__ implementation of HTTPStatus (using 
int.__str__ rather than format()).

> Does not changing __str__ to decimal representation (and in this case __str__ 
> = int.__str__ may be better) lost a part of the point of converting HTTP 
> status codes to enums?

I don’t think so. In the case of HTTPStatus in general, I think that the 
optimal string representation of an element of the enum is the stringified 
version of the status code. If nothing else, it’s consistent with the other 
type of status code that can be used (ints).

That does lead me to something that I think is a little odd about IntEnums in 
general but I’ll ask that question in python-dev rather than here as to not 
conflate this issue.

--
Added file: http://bugs.python.org/file38191/issue21793_logfix_2.patch

___
Python tracker 

___diff -r 46bfddb14cbe Lib/http/__init__.py
--- a/Lib/http/__init__.py  Fri Feb 20 10:34:20 2015 -0500
+++ b/Lib/http/__init__.py  Fri Feb 20 08:12:24 2015 -0800
@@ -24,6 +24,9 @@
 obj.description = description
 return obj
 
+def __str__(self):
+return int.__str__(self)
+
 # informational
 CONTINUE = 100, 'Continue', 'Request received, please continue'
 SWITCHING_PROTOCOLS = (101, 'Switching Protocols',
diff -r 46bfddb14cbe Lib/test/test_httpservers.py
--- a/Lib/test/test_httpservers.py  Fri Feb 20 10:34:20 2015 -0500
+++ b/Lib/test/test_httpservers.py  Fri Feb 20 08:12:24 2015 -0800
@@ -6,7 +6,7 @@
 
 from http.server import BaseHTTPRequestHandler, HTTPServer, \
  SimpleHTTPRequestHandler, CGIHTTPRequestHandler
-from http import server
+from http import server, HTTPStatus
 
 import os
 import sys
@@ -235,6 +235,27 @@
 self.assertEqual(int(res.getheader('Content-Length')), len(data))
 
 
+class RequestHandlerLoggingTestCase(BaseTestCase):
+class request_handler(BaseHTTPRequestHandler):
+protocol_version = 'HTTP/1.1'
+default_request_version = 'HTTP/1.1'
+
+def do_GET(self):
+self.send_response(HTTPStatus.OK)
+self.end_headers()
+
+def test_get(self):
+self.con = http.client.HTTPConnection(self.HOST, self.PORT)
+self.con.connect()
+
+with support.captured_stderr() as err:
+self.con.request('GET', '/')
+self.con.getresponse()
+
+self.assertTrue(
+err.getvalue().endswith('"GET / HTTP/1.1" 200 -\n'))
+
+
 class SimpleHTTPServerTestCase(BaseTestCase):
 class request_handler(NoLogRequestHandler, SimpleHTTPRequestHandler):
 pass
@@ -816,6 +837,7 @@
 cwd = os.getcwd()
 try:
 support.run_unittest(
+RequestHandlerLoggingTestCase,
 BaseHTTPRequestHandlerTestCase,
 BaseHTTPServerTestCase,
 SimpleHTTPServerTestCase,
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23488] Random objects twice as big as necessary on 64-bit builds

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch. It also optimizes getrandbit() and seed() as was originally 
proposed in issue16496.

--
stage:  -> patch review

___
Python tracker 

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



[issue23018] Add version info to python

2015-02-20 Thread Steve Dower

Steve Dower added the comment:

Looks like the .rc files should actually be UCS-2, since that's how the strings 
are going to be stored into the executables.

If I rename the .h file to .h_ (and change the encoding to UCS-2 with BOM), 
will it be ignored by argument clinic?

--

___
Python tracker 

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



[issue23493] optimize sort_keys in json module by using operator.itemgetter()

2015-02-20 Thread Wouter Bolsterlee

New submission from Wouter Bolsterlee:

The JSON encoder uses a lambda function for the sort(key=...) invocation used 
to sort the keys in a JSON object in case sort_keys=True is passed:

https://hg.python.org/cpython/file/46bfddb14cbe/Lib/json/encoder.py#l352

Instead of having a lambda, operator.itemgetter(0) can be used here, which is a 
minor performance gain. It should be noted that many other internals of the 
JSON encoder have also been fine-tuned (manually) for performance reasons.

--
components: Library (Lib)
messages: 236302
nosy: wbolster
priority: normal
severity: normal
status: open
title: optimize sort_keys in json module by using operator.itemgetter()
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue23491] PEP 441 - Improving Python Zip Application Support

2015-02-20 Thread Steve Dower

Steve Dower added the comment:

Either "application/zip" or "application/x-zip-compressed", I'm not sure 
exactly what the difference is, but the default .zip association has the latter.

The CRC error may be your machine or it may be because we're currently running 
on unstable WiX releases (hey, everything else is unstable right now :) ). If 
you can edit and re-save that file, I'd expect it to work, otherwise the 32-bit 
installer should be okay.

The exe/ comment is more a note for myself, sorry. Those strings are unused and 
should be removed (I'll do that now - got a few things to fix).

--

___
Python tracker 

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



[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-20 Thread Paul Moore

Paul Moore added the comment:

Hmm, I didn't know that (although virtualenv-based environments don't have an 
equivalent to pyvenv.cfg).

But there's some confusion here. This patch only affects command line usage 
(running "py.exe" to start Python). I don't really see a use case for making 
"py -3" mean "the virtualenv if it's Python 3 otherwise ignore the virtualenv 
and use the system Python 3".

For scripts, shebang processing isn't altered. Nothing uses a virtualenv except 
"#!/usr/bin/env python". And that does so only because it searches PATH before 
looking at the registry. If you use "#!/usr/bin/env python3" it won't see a 
virtualenv because there is no python3.exe in a virtualenv...

The scope of this PEP is just to make the "py" command (with no explicit 
version) use an active virtualenv before falling back to the default Python. 
This is specifically to allow people who don't put Python on their PATH but use 
virtualenvs to use "py" consistently, rather than having to switch to "python" 
when they are in a virtualenv. See the PEP (specifically the rationale section) 
for details.

--

___
Python tracker 

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



[issue22928] HTTP header injection in urrlib2/urllib/httplib/http.client

2015-02-20 Thread Demian Brecht

Changes by Demian Brecht :


Added file: http://bugs.python.org/file38190/issue22928_3.patch

___
Python tracker 

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



[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-20 Thread Wolfgang Maier

Wolfgang Maier added the comment:

isn't the pyvenv.cfg file specifying the version ?

--

___
Python tracker 

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



[issue23422] Clarify docs for importlib.import_module()

2015-02-20 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue21257] Document parse_headers function of http.client

2015-02-20 Thread Demian Brecht

Demian Brecht added the comment:

> On Feb 20, 2015, at 3:10 AM, Berker Peksag  wrote:
> This is a different issue than #23439. BaseHTTPRequestHandler.headers 
> documentation mentions about parse_headers function, the function itself is 
> not documented.

Not entirely sure what I was thinking here. I was under the impression that the 
docs for parse_headers had been added in the linked issue. Thanks for pointing 
that out.

--

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch. There is yet one similar bug in unicodeobject.c.

--
keywords: +patch
stage:  -> patch review
versions: +Python 3.5
Added file: http://bugs.python.org/file38189/issue23490.patch

___
Python tracker 

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



[issue23422] Clarify docs for importlib.import_module()

2015-02-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 46bfddb14cbe by Brett Cannon in branch 'default':
Issue #23422: Clarify some things around importlib.import_module()
https://hg.python.org/cpython/rev/46bfddb14cbe

--
nosy: +python-dev

___
Python tracker 

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



[issue3566] httplib persistent connections violate MUST in RFC2616 sec 8.1.4.

2015-02-20 Thread Demian Brecht

Demian Brecht added the comment:

> On Feb 19, 2015, at 8:08 PM, Martin Panter  wrote:
> I guess you saying RemoteDisconnected effectively means the same thing as 
> ConnectionResetError.

Exactly.

> Would it help if it was derived from ConnectionResetError, instead of the 
> ConnectionError base class? Or are you also worried about the multiple 
> inheritance or clutter of yet another type of exception?

My concern is more about consistency of exceptions and exception handling when 
using the client. Thinking about it from a user’s standpoint, when I issue a 
request and the remote socket closes, I would hope to get consistent exceptions 
for all remote resets. If I’m handling the lowest level errors independently of 
one another rather than catch-all ConnectionError, I don’t want to do something 
like this:

except (RemoteDisconnected, ConnectionResetError)

I /should/ be able to simply use ConnectionResetError. Reading the docs, the 
only real reason for this exception at all is for backwards compatibility. If 
we have a case to break backwards compatibility here, then that eliminates the 
need for the new exception and potential (minor) confusion.

In this special case, the behaviour that we see at the client socket level 
indicates a remote reset, but it’s only artificially known immediately due to 
the empty read. In my mind, because the client /knows/ that this is an early 
indicator of a ConnectionResetError, that is exactly the exception that should 
be used.

Hope that makes sense.

--

___
Python tracker 

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



[issue22834] Unexpected FileNotFoundError when current directory is removed

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be better use errno.EINVAL?

--

___
Python tracker 

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



[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-20 Thread Paul Moore

Paul Moore added the comment:

That's correct. The problem here is that it's not possible to know what version 
of Python a virtualenv has (at least, not without running it, which isn't 
appropriate in the launcher). So the only case it's possible to support is 
#!python.

--

___
Python tracker 

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



[issue22834] Unexpected FileNotFoundError when current directory is removed

2015-02-20 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the suggestion, Martin. Went with a variant of what you proposed.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue23491] PEP 441 - Improving Python Zip Application Support

2015-02-20 Thread Paul Moore

Paul Moore added the comment:

Thanks for checking, Steve. I don't get an installer because of the checksum 
error quoted, although I did get the component msi files.

As far as content type is concerned, I wasn't sure what effect it had so I just 
copied what was there. I guess application/zip might be better for .pyz files, 
based on what you said?

I'm not sure what you meant by the comment about exe/. All I did was mention 
.pyz as well as .py - although I don't see where the PathDescription string us 
used so I may be missing something important!

--

___
Python tracker 

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



[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-20 Thread Wolfgang Maier

Wolfgang Maier added the comment:

am I correct that when a script contains a shebang line like:

#! python3

or

#! python3.4

i.e., one indicating just a version of, but not a full path to the interpreter, 
the current patch would not use an active virtualenv even if it has a suitable 
version ?

If so, is that a desirable behaviour?
If I've misread the patch and the PEP, then sorry for the noise.

--
nosy: +wolma

___
Python tracker 

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



[issue22834] Unexpected FileNotFoundError when current directory is removed

2015-02-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f4f2096ab6f8 by Brett Cannon in branch 'default':
Issue #22834: Fix a failing test under Solaris due to the platform not
https://hg.python.org/cpython/rev/f4f2096ab6f8

--

___
Python tracker 

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



[issue23492] Argument Clinic: improve generated parser for 1-argument functions

2015-02-20 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch improve generated parsers for functions with single positional 
argument. Now they always generated as METH_O and PyArg_Parse() is used to 
parse single argument.

To avoid code churn in this and following changes it would be worth to extract 
all generated code in separated files.

--
components: Build
files: clinic_meth_o.patch
keywords: patch
messages: 236288
nosy: larry, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Argument Clinic: improve generated parser for 1-argument functions
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file38188/clinic_meth_o.patch

___
Python tracker 

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



[issue20699] Document that binary IO classes work with bytes-likes objects

2015-02-20 Thread R. David Murray

R. David Murray added the comment:

How about "the length of b in bytes"?

--

___
Python tracker 

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



[issue23489] atexit handlers are not executed when using multiprocessing.Pool.map.

2015-02-20 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +davin, sbt

___
Python tracker 

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



[issue23491] PEP 441 - Improving Python Zip Application Support

2015-02-20 Thread Steve Dower

Steve Dower added the comment:

The installer changes look fine, though there shouldn't be PATH related strings 
in exe/, so there's probably a separate issue there. Wix doesn't really have 
any editors that aren't just XML editors.

We probably want to update the ContentType value from text/plain for all the 
shortcuts, though I'm not sure what to (it affects the implicit associations 
and extra commands on the files, inc. Open With).

The easiest way to make sure the files are in the installer is to install it :) 
But if they're just .py files under Lib/ then they'll be there.

--

___
Python tracker 

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



[issue23491] PEP 441 - Improving Python Zip Application Support

2015-02-20 Thread Steve Dower

Steve Dower added the comment:

I haven't looked closely at the rest, btw. Will try and find time today or 
tomorrow.

--

___
Python tracker 

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



[issue23491] PEP 441 - Improving Python Zip Application Support

2015-02-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue21793] httplib client/server status refactor

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Does not changing __str__ to decimal representation (and in this case __str__ = 
int.__str__ may be better) lost a part of the point of converting HTTP status 
codes to enums?

--

___
Python tracker 

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



[issue20699] Document that binary IO classes work with bytes-likes objects

2015-02-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Because it is not len(b). I fixed several bugs in Python code which called 
len() for bytes-like argument and failed with array.array or memoryview with 
non-byte items.

The term "bytes-like object" is slightly misleading. In some cases it implies 
indexing and len, and iterating, and may be slicing -- common operations for 
bytes, bytearray, array('B'), memoryview().cast('B'). In more narrow meaning 
it may require such operations as concatenation (operator +) and .startswith() 
-- common for bytes and bytearray. In more general meaning it requires only 
the support of buffer protocol and contiguity. In more general meaning it may 
be even non-contiguous.

--

___
Python tracker 

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



[issue20699] Document that binary IO classes work with bytes-likes objects

2015-02-20 Thread Martin Panter

Martin Panter added the comment:

Using len(b) is fine if b is a bytes() or bytearray() object, but a bytes-like 
object can be anything that you can pass to memoryview(). In general len(b) is 
not part of that protocol, so can return some other value, or even be 
unimplemented:

>>> from array import array
>>> b = array("H", range(2))
>>> len(b)
2
>>> bytes(b)  # Actually 4 bytes = 2 items × 2 bytes
b'\x00\x00\x01\x00'
>>> from ctypes import c_int
>>> b = c_int(100)
>>> len(b)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: object of type 'c_long' has no len()
>>> bytes(b)  # 4 bytes despite not implementing len()
b'd\x00\x00\x00'

I see your point that “the number of bytes in b” can be misleading. I will 
think about the wording some more. Maybe we can come up with a third 
alternative, like “the number of bytes given” or something.

--

___
Python tracker 

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



[issue21793] httplib client/server status refactor

2015-02-20 Thread Berker Peksag

Berker Peksag added the comment:

LGTM. I left a comment for Serhiy on Rietveld.

--
stage: needs patch -> commit review

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +benjamin.peterson, haypo, serhiy.storchaka
type: crash -> security

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread paul

paul added the comment:

And a nice error:

Debug memory block at address p=0x805fc028: API 'o'
0 bytes originally requested
The 3 pad bytes at p-3 are FORBIDDENBYTE, as expected.
The 4 pad bytes at tail=0x805fc028 are not all FORBIDDENBYTE (0xfb):
at tail+0: 0x00 *** OUCH
at tail+1: 0x00 *** OUCH
at tail+2: 0x00 *** OUCH
at tail+3: 0x00 *** OUCH
The block was made by call #53454 to debug malloc/realloc.
Fatal Python error: bad trailing pad byte

--

___
Python tracker 

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



[issue20699] Document that binary IO classes work with bytes-likes objects

2015-02-20 Thread R. David Murray

R. David Murray added the comment:

What is your objection to "len(b)"?  When I read "len(b)" I know exactly what 
it means.  When I read "the number of bytes in b", I have to think about it it, 
because it could mean "the number of bytes that that b is long" or "the number 
of bytes that have been already written to b", and the latter is the meaning my 
mind goes to first, so it takes time for my mind to realize it is the first.

--

___
Python tracker 

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



[issue23442] http.client.REQUEST_HEADER_FIELDS_TOO_LARGE renamed in 3.5

2015-02-20 Thread Berker Peksag

Berker Peksag added the comment:

Fixed. Thanks to both of you :)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue23442] http.client.REQUEST_HEADER_FIELDS_TOO_LARGE renamed in 3.5

2015-02-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 52d37efaf939 by Berker Peksag in branch 'default':
Issue #23442: Rename two member names to stay backward compatible
https://hg.python.org/cpython/rev/52d37efaf939

--
nosy: +python-dev

___
Python tracker 

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



[issue23491] PEP 441 - Improving Python Zip Application Support

2015-02-20 Thread Paul Moore

New submission from Paul Moore:

This is the patch for PEP 441 (Zip Application Support).

Steve, could you check the installer changes, please? I haven't managed to get 
a setup where I can test the installer, and I'm not aware of any WiX coding 
tools, so I just edited the XML files by hand with grep and vim, and checked 
that Tools/buildmsi.bat doesn't error in anything I wrote... (There's a CRC 
check error in TCL, but that was there before I made changes)

  light.exe : error LGHT0216: An unexpected Win32 exception with error code 
0x17 occurred while accessing file 
'C:\Work\Projects\cpython\externals\tcltk64\lib\tcl8.6\tzdata\America\Detroit': 
Data error (cyclic redundancy check) 
[C:\Work\Projects\cpython\Tools\msi\tcltk\tcltk.wixproj]

Also, I don't *think* I need to do anything for the new files in Doc\Lib, Lib 
and Lib\test to get picked up, but I'm not sure how to check that.

--
assignee: steve.dower
components: Library (Lib)
files: pep441.patch
keywords: patch
messages: 236276
nosy: pmoore, steve.dower
priority: normal
severity: normal
status: open
title: PEP 441 - Improving Python Zip Application Support
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file38187/pep441.patch

___
Python tracker 

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



[issue22931] cookies with square brackets in value

2015-02-20 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage:  -> patch review
versions:  -Python 3.3, Python 3.6

___
Python tracker 

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



[issue22928] HTTP header injection in urrlib2/urllib/httplib/http.client

2015-02-20 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage:  -> patch review
versions:  -Python 3.6

___
Python tracker 

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



[issue23350] Content-length is incorrect when request body is a list or tuple

2015-02-20 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage:  -> patch review

___
Python tracker 

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



[issue23490] allocation (and overwrite) of a 0 byte buffer

2015-02-20 Thread paul

New submission from paul:

# Bug
# ---
# 
# Py_UNICODE *
# PyUnicode_AsUnicodeAndSize(PyObject *unicode, Py_ssize_t *size)
# {
# ...
# #endif
# wchar_t *w;
# wchar_t *wchar_end;
# 
# ...
# 1   _PyUnicode_WSTR(unicode) = (wchar_t *) 
PyObject_MALLOC(sizeof(wchar_t) *
#   (_PyUnicode_LENGTH(unicode) 
+ 1));
# ...
# w = _PyUnicode_WSTR(unicode);
# 2   wchar_end = w + _PyUnicode_LENGTH(unicode);
# 
# if (PyUnicode_KIND(unicode) == PyUnicode_1BYTE_KIND) {
# one_byte = PyUnicode_1BYTE_DATA(unicode);
# 3   for (; w < wchar_end; ++one_byte, ++w)
# *w = *one_byte;
# /* null-terminate the wstr */
# 4   *w = 0;
# }
# 
# 1. if length(unicode)==2**30-1, then malloced buffer has size equal to 
#4*(2^30-1+1)=2^32 == 0 (modulo 2^32)
# 2. wchar_end is equal to w-4 because of pointer arithmetic (nonexplicit 
#multiplication by 4)
# 3. w > wchar_end, so we don't enter the loop
# 4. 4 byte write to a 0 size buffer
# 
# GDB output
# --
# 
# 3860_PyUnicode_WSTR(unicode) = (wchar_t *) 
PyObject_MALLOC(sizeof(wchar_t) *
# ...
# (gdb) print sizeof(wchar_t)*(((PyASCIIObject*)(unicode))->length+1)
# $21 = 0
# ...
# (gdb) n
# 3868w = _PyUnicode_WSTR(unicode);
# (gdb) n
# 3869wchar_end = w + _PyUnicode_LENGTH(unicode);
# (gdb) n
# 3871if (PyUnicode_KIND(unicode) == PyUnicode_1BYTE_KIND) {
# (gdb) print w
# $22 = 0x805fc028 L"\xfbfbfbfb\xced0"
# (gdb) print wchar_end
# $23 = 0x805fc024 L"\xfbfbfb6f\xfbfbfbfb\xced0"
# ...
# 3876*w = 0;
#  
# )
# OS info
# ---
# 
# % ./python -V
# Python 3.4.1
#  
# % uname -a
# Linux ubuntu 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 
2013 i686 i686 i386 GNU/Linux
 
import locale
s='a'*(2**30-1)
locale.strxfrm(s)

--
files: poc_strxfrm.py
messages: 236275
nosy: pkt
priority: normal
severity: normal
status: open
title: allocation (and overwrite) of a 0 byte buffer
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file38186/poc_strxfrm.py

___
Python tracker 

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



[issue23489] atexit handlers are not executed when using multiprocessing.Pool.map.

2015-02-20 Thread juj

juj added the comment:

This was tested on Python 2.7.9 64-bit on Windows 8.1, however I believe that 
it occurs equally on OSX and Linux, since I am running servers with those OSes 
that also exhibit temp file leaking issues (although I did not specifically 
confirm if the root cause is the same as this).

--

___
Python tracker 

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



[issue23489] atexit handlers are not executed when using multiprocessing.Pool.map.

2015-02-20 Thread juj

New submission from juj:

When Multiprocessing.Pool.map is used for a script that registers atexit 
handlers, the atexit handlers are not executed when the pool threads quit.

STR:

1. Run attached file in Python 2.7 with 'python task_spawn.py'
2. Observe the printed output.

Observed:

Console prints:

CREATED TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_qef8r_
CREATED TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_axi9tt
CREATED TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_vx6fmu
task1
task2
ATEXIT: REMOVING TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_qef8r_

Expected:

Console should print:

CREATED TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_qef8r_
CREATED TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_axi9tt
CREATED TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_vx6fmu
task1
task2
ATEXIT: REMOVING TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_vx6fmu
ATEXIT: REMOVING TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_axi9tt
ATEXIT: REMOVING TEMP DIRECTORY c:\users\clb\appdata\local\temp\temp_qef8r_

--
components: Library (Lib)
files: task_spawn.py
messages: 236273
nosy: juj
priority: normal
severity: normal
status: open
title: atexit handlers are not executed when using multiprocessing.Pool.map.
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file38185/task_spawn.py

___
Python tracker 

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



[issue9119] Python download page needs to mention crypto code in Windows installer

2015-02-20 Thread Berker Peksag

Berker Peksag added the comment:

> Terry, would you like to move this forward with the Python.org webmasters ?

This is now a content issue and can be handled on GitHub: 
https://github.com/python/pythondotorg/issues

--
nosy: +berker.peksag
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue21257] Document parse_headers function of http.client

2015-02-20 Thread Berker Peksag

Berker Peksag added the comment:

This is a different issue than #23439. BaseHTTPRequestHandler.headers 
documentation mentions about parse_headers function, the function itself is not 
documented. See 
https://docs.python.org/3/library/http.server.html#http.server.BaseHTTPRequestHandler.headers

--
components: +Documentation
keywords: +easy
nosy: +berker.peksag
stage:  -> needs patch
type: behavior -> enhancement
versions: +Python 3.5 -Python 3.3

___
Python tracker 

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



  1   2   >