[issue2943] Distutils should generate a better error message when the SDK is not installed

2014-09-11 Thread Piotr Dobrogost

Changes by Piotr Dobrogost :


--
nosy: +piotr.dobrogost

___
Python tracker 

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



[issue22381] update zlib in 2.7 to 1.2.8

2014-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 769126143656 by doko in branch '2.7':
- Issue #22381: Update zlib to 1.2.8.
http://hg.python.org/cpython/rev/769126143656

--

___
Python tracker 

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



[issue9951] introduce bytes.hex method

2014-09-11 Thread Chris Lasher

Chris Lasher added the comment:

int has int.from_bytes and int.to_bytes.

Currently, bytes has bytes.fromhex. Would the core developers please consider 
naming the method "bytes.tohex" instead of "bytes.hex", so there's at least a 
modicum of consistency in the method names of Python's builtin types?

--

___
Python tracker 

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



[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +eric.smith

___
Python tracker 

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



[issue22386] Python 3.4 logging.getLevelName() no longer maps string to level.

2014-09-11 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread Eric V. Smith

Eric V. Smith added the comment:

I think this would need to be implemented by adding bytes.__format__. I can't 
think of a way to make it work on bytes-like objects in general.

--

___
Python tracker 

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



[issue16662] load_tests not invoked in package/__init__.py

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

The changeset d0ff527c53da5b925b61a8a70afc686ca6e05960 related to this issue 
introduced a regression in test_unittest. The test now fails on Windows. 
Example:

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/5065/steps/test/logs/stdio


==
ERROR: test_discover_with_init_module_that_raises_SkipTest_on_import 
(unittest.test.test_discovery.TestDiscovery)
--
Traceback (most recent call last):
  File 
"C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\test\test_discovery.py",
 line 451, in test_discover_with_init_module_that_raises_SkipTest_on_import
suite = loader.discover('/foo')
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\loader.py", 
line 284, in discover
tests = list(self._find_tests(start_dir, pattern))
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\loader.py", 
line 319, in _find_tests
paths = sorted(os.listdir(start_dir))
  File 
"C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\test\test_discovery.py",
 line 388, in list_dir
return list(vfs[path])
KeyError: 'C:\\foo'

--
nosy: +haypo
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

> ".precision": chunks output, placing a space after every  bytes

I dislike this option. There is already "%.s" in Python 2 and Python 
3 (and printf of the C language) which truncates the string.

If you need such special output, please write your own function.

--
nosy: +haypo

___
Python tracker 

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



[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread Eric V. Smith

Eric V. Smith added the comment:

I'm not particularly wild about the .precision syntax either, but I think the 
feature is generally useful.

Adding bytes.__format__ is exactly what "special output for bytes" _is_, as far 
as format() is concerned.

Another option would be to invent a new format specification for bytes. There's 
no reason it needs to follow the same syntax as for str, int, etc., except for 
ease of remembering the syntax, and some code reuse.

For example, although it's insane, you could do:

format(b'abcdwxyz', 'use_spaces,grouping=4,add_prefix')
  -> '0x61626364 0x7778797a'

--

___
Python tracker 

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



[issue9951] introduce bytes.hex method

2014-09-11 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 11.09.2014 01:04, Nick Coghlan wrote:
> 
> Nick Coghlan added the comment:
> 
> Just as a recap of at least some of the *current* ways to do a bytes -> hex 
> conversion:
> 
 import codecs
 codecs.encode(b"abc", "hex")
> b'616263'
 import binascii
 binascii.hexlify(b"abc")
> b'616263'
 import base64
 base64.b16encode(b"abc")
> b'616263'
 hex(int.from_bytes(b"abc", "big"))
> '0x616263'
 hex(int.from_bytes(b"abc", "little"))
> '0x636261'
> 
> Thus, the underlying purpose of this proposal is to provide a single "more 
> obvious way to do it". As per the recent discussion on python-ideas, the 
> point where that is most useful is in debugging output.
> 
> However, rather than a new method on bytes/bytearray/memoryview for this, I 
> instead suggest it would be appropriate to extend the default handling of the 
> "x" and "X" format characters to accept arbitrary bytes-like objects. The 
> processing of these characters would be as follows:
> 
> "x": display a-f as lowercase digits
> "X": display A-F as uppercase digits
> "#": includes 0x prefix
> ".precision": chunks output, placing a space after every  bytes
> ",": uses a comma as the separator, rather than a space

Hmm, but those would then work for str.format() as well, right ?

Since "x" and "X" are already used to convert numbers to hex
representation, opening these up for bytes sounds like it could
easily mask TypeErrors for cases where you really want an integer
to be formatted as hex and not bytes.

--
nosy: +lemburg

___
Python tracker 

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



[issue22379] Empty exception message of str.join

2014-09-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +pitrou

___
Python tracker 

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



[issue21951] tcl test change crashes AIX

2014-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ee969a717cb5 by Serhiy Storchaka in branch '2.7':
Issue #21951: Use attemptckalloc() instead of ckalloc() in Tkinter.
http://hg.python.org/cpython/rev/ee969a717cb5

New changeset 1223c882253f by Serhiy Storchaka in branch '3.4':
Issue #21951: Use attemptckalloc() instead of ckalloc() in Tkinter.
http://hg.python.org/cpython/rev/1223c882253f

New changeset 499b60b7d067 by Serhiy Storchaka in branch 'default':
Issue #21951: Use attemptckalloc() instead of ckalloc() in Tkinter.
http://hg.python.org/cpython/rev/499b60b7d067

New changeset d6c7ab5a2065 by Serhiy Storchaka in branch '2.7':
Issue #21951: Fixed a crash in Tkinter on AIX when called Tcl command with
http://hg.python.org/cpython/rev/d6c7ab5a2065

New changeset 6a96c28f9474 by Serhiy Storchaka in branch '3.4':
Issue #21951: Fixed a crash in Tkinter on AIX when called Tcl command with
http://hg.python.org/cpython/rev/6a96c28f9474

New changeset 7b7bae546959 by Serhiy Storchaka in branch 'default':
Issue #21951: Fixed a crash in Tkinter on AIX when called Tcl command with
http://hg.python.org/cpython/rev/7b7bae546959

--

___
Python tracker 

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



[issue22387] Making tempfile.NamedTemporaryFile a class

2014-09-11 Thread Antony Lee

New submission from Antony Lee:

Currently, tempfile.TemporaryFile and tempfile.NamedTemporaryFile are 
functions, not classes, despite what their names suggest, preventing 
subclassing.  It would arguably be not so easy to make TemporaryFile a class, 
as its return value is whatever "_io.open" returns, which can be of various 
types, but NamedTemporaryFile can trivially converted into a class by reusing 
the body of _TemporaryFileWrapper (which is not used elsewhere).

--
components: Library (Lib)
messages: 226752
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Making tempfile.NamedTemporaryFile a class
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



[issue22336] _tkinter should use Python PyMem_Malloc() instead of Tcl ckalloc()

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is updated patch which is synchronized with the tip after changes made in 
issue21951 and addresses my comments.

--
Added file: http://bugs.python.org/file36596/tkinter_pymem_2.patch

___
Python tracker 

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



[issue21951] tcl test change crashes AIX

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed these two changes as separate patches.

--
stage: patch review -> commit review

___
Python tracker 

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



[issue21228] Missing enumeration of HTTPResponse Objects methods of urllib.request.urlopen's http.client.HTTPResponse?

2014-09-11 Thread Martin Panter

Martin Panter added the comment:

Fair enough, challenge accepted! Here is my attempt. I have explicitly made the 
info(), geturl() and getcode() methods available for all cases, and used 
Evens’s wording for the modified “msg” attribute, but dropped mentioning the 
“url” attribute.

--
Added file: http://bugs.python.org/file36597/addinfourl-first.patch

___
Python tracker 

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



[issue22387] Making tempfile.NamedTemporaryFile a class

2014-09-11 Thread Eric V. Smith

Eric V. Smith added the comment:

Can you explain why you want to subclass them?

--
nosy: +eric.smith
type:  -> enhancement

___
Python tracker 

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



[issue13968] Support recursive globs

2014-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ff4b9d654691 by Serhiy Storchaka in branch 'default':
Issue #13968: The glob module now supports recursive search in
http://hg.python.org/cpython/rev/ff4b9d654691

--
nosy: +python-dev

___
Python tracker 

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



[issue22387] Making tempfile.NamedTemporaryFile a class

2014-09-11 Thread Antony Lee

Antony Lee added the comment:

The initial idea was to solve #14243 (NamedTemporaryFile would be more useful 
on Windows if you could close it without deleting) by adding a "closed" keyword 
argument to the constructor of a subclass, that would set "delete" to False and 
then close it, e.g.

class NTF(NamedTemporaryFile):
def __init__(self, *args, closed=False, **kwargs):
if closed: kwargs["delete"] = True
super().__init__(*args, **kwargs)
if closed: self.close()

Actually, there are some not-so-nice interactions with the context-manager 
protocol though, as the file cannot be reopened.  So it's not clear that this 
is such a good idea.

Still, it somewhat confusing that a CamelCase object is not actually a type 
(especially when TemporaryDirectory is one).

--

___
Python tracker 

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



[issue13968] Support recursive globs

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your review Nick.

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



[issue22385] Allow 'x' and 'X' to accept bytes-like objects in string formatting

2014-09-11 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue21147] sqlite3 doesn't complain if the request contains a null character

2014-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 430865e9ea9f by Serhiy Storchaka in branch '2.7':
Issue #21147: sqlite3 now raises an exception if the request contains a null
http://hg.python.org/cpython/rev/430865e9ea9f

New changeset 517f216d45ea by Serhiy Storchaka in branch '3.4':
Issue #21147: sqlite3 now raises an exception if the request contains a null
http://hg.python.org/cpython/rev/517f216d45ea

New changeset b81f5652c2d7 by Serhiy Storchaka in branch 'default':
Issue #21147: sqlite3 now raises an exception if the request contains a null
http://hg.python.org/cpython/rev/b81f5652c2d7

--
nosy: +python-dev

___
Python tracker 

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



[issue13968] Support recursive globs

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

The test failed on a buildbot, I reopen the issue.

http://buildbot.python.org/all/builders/x86%20Ubuntu%20Shared%203.x/builds/10607/steps/test/logs/stdio

==
FAIL: test_selflink (test.test_glob.SymlinkLoopGlobTests)
--
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_glob.py", 
line 284, in test_selflink
self.assertIn(path, results)
AssertionError: 
'@test_23056_tmp_dir/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/link/file'
 not found in {'noodly2', '@test_23056_tmp-\udcff.py', '__pycache__'}

--
nosy: +haypo
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue21951] tcl test change crashes AIX

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

> Committed these two changes as separate patches.

Thanks, it's clearer like that.

--

___
Python tracker 

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



[issue21951] tcl test change crashes AIX

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

test_tcl now pass on AIX:
http://buildbot.python.org/all/builders/PPC64%20AIX%203.x/builds/2592/steps/test/logs/stdio

Thanks Serhiy for the fix.

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

___
Python tracker 

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



[issue22336] _tkinter should use Python PyMem_Malloc() instead of Tcl ckalloc()

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

I read tkinter_pymem_2.patch.

Remaining calls to ckalloc():

* they are only used to allocate events passed later to Tcl_ThreadQueueEvent(). 
Tcl_ThreadQueueEvent doc explicitly says that the memory must be allocated by 
Tcl_Alloc or ckalloc, so it's correct (PyMem cannot be used).

Remaining calls to ckfree():

* Tkapp_SplitList() calls ckfree() on memory allocated by Tcl_SplitList(), it's 
correct.

* Tkapp_CallDeallocArgs() ckfree() on memory allocated by PyMem_Malloc() => 
wrong (see my review on Rietveld).

--

___
Python tracker 

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



[issue21951] tcl test change crashes AIX

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Victor for great investigation of this issue.

--

___
Python tracker 

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



[issue22387] Making tempfile.NamedTemporaryFile a class

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

You can do this with a function too:

def NTF(*args, closed=False, **kwargs):
if closed: kwargs["delete"] = True
ntf = NamedTemporaryFile(*args, **kwargs)
if closed: ntf.close()
return ntf

--
nosy: +georg.brandl, ncoghlan, serhiy.storchaka

___
Python tracker 

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



[issue22388] Unify style of "Contributed by" notes

2014-09-11 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Here is a patch which converts "Contributed by" notes in whatsnews to most 
prevalent style. This means:

* Previous sentence ends by a period and the "Contributed" is titled.
* The note ends by a period and it is placed before closing parent.
* The note is separated from previous sentence by two spaces or newline (as any 
sentences).

Overwhelming majority of "Contributed by" notes are written in this style 
(except of unfinished 3.5 whatsnews).

--
assignee: docs@python
components: Documentation
files: doc_contributed_by_style.patch
keywords: patch
messages: 226767
nosy: docs@python, r.david.murray, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Unify style of "Contributed by" notes
type: enhancement
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36598/doc_contributed_by_style.patch

___
Python tracker 

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



[issue13968] Support recursive globs

2014-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 180f5bf7d1b9 by Serhiy Storchaka in branch 'default':
Issue #13968: Fixed newly added recursive glob test.
http://hg.python.org/cpython/rev/180f5bf7d1b9

--

___
Python tracker 

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



[issue13968] Support recursive globs

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Victor. The test was failed also when run it directly, omitting the 
test.regrtest module (which run a test inside temporary directory):

./python Lib/test/test_glob.py

Now it is fixed.

However perhaps we should consider as a bug if a test ran by regrtest doesn't 
clean created files or directories ('noodly2', '@test_23056_tmp-\udcff.py', and 
'__pycache__' are created by some previous tests).

--

___
Python tracker 

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



[issue21228] Missing enumeration of HTTPResponse Objects methods of urllib.request.urlopen's http.client.HTTPResponse?

2014-09-11 Thread Evens Fortuné

Evens Fortuné added the comment:

I'm satisfied with this new patch.

--

___
Python tracker 

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



[issue22336] _tkinter should use Python PyMem_Malloc() instead of Tcl ckalloc()

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> * Tkapp_CallDeallocArgs() ckfree() on memory allocated by PyMem_Malloc() =>
> wrong 

Oh, you are right, thanks.

> (see my review on Rietveld).

Perhaps you forgot to press the "Publish" button.

--
Added file: http://bugs.python.org/file36599/tkinter_pymem_3.patch

___
Python tracker 

___diff -r 180f5bf7d1b9 Modules/_tkinter.c
--- a/Modules/_tkinter.cThu Sep 11 14:33:02 2014 +0300
+++ b/Modules/_tkinter.cThu Sep 11 15:49:49 2014 +0300
@@ -605,7 +605,7 @@
 Tcl_SetVar(v->interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
 
 /* This is used to get the application class for Tk 4.1 and up */
-argv0 = (char*)attemptckalloc(strlen(className) + 1);
+argv0 = (char*)PyMem_Malloc(strlen(className) + 1);
 if (!argv0) {
 PyErr_NoMemory();
 Py_DECREF(v);
@@ -616,7 +616,7 @@
 if (Py_ISUPPER(Py_CHARMASK(argv0[0])))
 argv0[0] = Py_TOLOWER(Py_CHARMASK(argv0[0]));
 Tcl_SetVar(v->interp, "argv0", argv0, TCL_GLOBAL_ONLY);
-ckfree(argv0);
+PyMem_Free(argv0);
 
 if (! wantTk) {
 Tcl_SetVar(v->interp,
@@ -639,7 +639,7 @@
 if (use)
 len += strlen(use) + sizeof "-use ";
 
-args = (char*)attemptckalloc(len);
+args = (char*)PyMem_Malloc(len);
 if (!args) {
 PyErr_NoMemory();
 Py_DECREF(v);
@@ -657,7 +657,7 @@
 }
 
 Tcl_SetVar(v->interp, "argv", args, TCL_GLOBAL_ONLY);
-ckfree(args);
+PyMem_Free(args);
 }
 
 if (Tcl_AppInit(v->interp) != TCL_OK) {
@@ -914,15 +914,15 @@
"list is too long");
 return NULL;
 }
-argv = (Tcl_Obj **) attemptckalloc(((size_t)size) * sizeof(Tcl_Obj *));
-if(!argv) {
+argv = (Tcl_Obj **) PyMem_Malloc(((size_t)size) * sizeof(Tcl_Obj *));
+if (!argv) {
   PyErr_NoMemory();
   return NULL;
 }
 for (i = 0; i < size; i++)
   argv[i] = AsObj(PySequence_Fast_GET_ITEM(value,i));
 result = Tcl_NewListObj(size, argv);
-ckfree(FREECAST argv);
+PyMem_Free(argv);
 return result;
 }
 else if (PyUnicode_Check(value)) {
@@ -948,7 +948,7 @@
 if (kind == sizeof(Tcl_UniChar))
 return Tcl_NewUnicodeObj(inbuf, size);
 allocsize = ((size_t)size) * sizeof(Tcl_UniChar);
-outbuf = (Tcl_UniChar*)attemptckalloc(allocsize);
+outbuf = (Tcl_UniChar*)PyMem_Malloc(allocsize);
 /* Else overflow occurred, and we take the next exit */
 if (!outbuf) {
 PyErr_NoMemory();
@@ -965,14 +965,14 @@
  "character U+%x is above the range "
  "(U+-U+) allowed by Tcl",
  ch);
-ckfree(FREECAST outbuf);
+PyMem_Free(outbuf);
 return NULL;
 }
 #endif
 outbuf[i] = ch;
 }
 result = Tcl_NewUnicodeObj(outbuf, size);
-ckfree(FREECAST outbuf);
+PyMem_Free(outbuf);
 return result;
 }
 else if(PyTclObject_Check(value)) {
@@ -1084,7 +1084,7 @@
 for (i = 0; i < objc; i++)
 Tcl_DecrRefCount(objv[i]);
 if (objv != objStore)
-ckfree(FREECAST objv);
+PyMem_Free(objv);
 }
 
 /* Convert Python objects to Tcl objects. This must happen in the
@@ -1115,7 +1115,7 @@
   "list is too long");
 return NULL;
 }
-objv = (Tcl_Obj **)attemptckalloc(((size_t)objc) * sizeof(Tcl_Obj 
*));
+objv = (Tcl_Obj **)PyMem_Malloc(((size_t)objc) * sizeof(Tcl_Obj 
*));
 if (objv == NULL) {
 PyErr_NoMemory();
 objc = 0;
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22384] Tk.report_callback_exception kills process when run with pythonw.exe

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be this patch would help.

--
assignee:  -> serhiy.storchaka
keywords: +patch
nosy: +serhiy.storchaka
stage:  -> patch review
type: crash -> behavior
versions: +Python 2.7, Python 3.5
Added file: 
http://bugs.python.org/file36600/tkinter_report_callback_exception.patch

___
Python tracker 

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



[issue21199] Python on 64-bit Windows uses signed 32-bit type for read length

2014-09-11 Thread Larry Hastings

Larry Hastings added the comment:

Ping?

--

___
Python tracker 

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



[issue22389] Generalize contextlib.redirect_stdout

2014-09-11 Thread Barry A. Warsaw

New submission from Barry A. Warsaw:

redirect_stdout is almost exactly what I want, except I want to redirect 
stderr!  redirect_stdout.__init__() should take a 'stream_name' argument 
(possibly keyword-only) which could be set to 'stderr'.  I propose it's 
implemented as setattr(sys, stream_name, new_target)

--
components: Library (Lib)
messages: 226774
nosy: barry
priority: normal
severity: normal
status: open
title: Generalize contextlib.redirect_stdout
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



[issue22389] Generalize contextlib.redirect_stdout

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

Why not adding a new redirect_stderr() function?

--
nosy: +haypo

___
Python tracker 

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



[issue22389] Generalize contextlib.redirect_stdout

2014-09-11 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Sep 11, 2014, at 02:25 PM, STINNER Victor wrote:

>Why not adding a new redirect_stderr() function?

With a little refactoring redirect_stdout into a subclass, that would work
too.

--

___
Python tracker 

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



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread STINNER Victor

New submission from STINNER Victor:

A change in test_glob of issue #13968 started to fail because a previous test 
created temporary files but didn't remove them.

test.regrtest should at least emit a warning if the temporary directory used to 
run tests is not empty before removing it.

--
components: Tests
messages: 226777
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: test.regrtest should complain if a test doesn't remove temporary files
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



[issue13968] Support recursive globs

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

> However perhaps we should consider as a bug if a test ran by regrtest doesn't 
> clean created files or directories

=> yes, I opened the issue #22390.

--

___
Python tracker 

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



[issue22336] _tkinter should use Python PyMem_Malloc() instead of Tcl ckalloc()

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

tkinter_pymem_3.patch looks good to me.

--

___
Python tracker 

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



[issue22382] sqlite3 connection built from apsw connection should raise IntegrityError, not DatabaseError

2014-09-11 Thread william tonkin

william tonkin added the comment:

sqlite3 allows a connection to be built from an apsw.Connection().  Using an 
apsw.Connection() to build an sqlite3.connect() implies that the underlying 
sqlite database engine will have extended error codes turned on (the default if 
for them to be turned off.)

The problem is that Modules/_sqlite/util.c:_pysqlite_seterror() is not extended 
error code aware.  In particular, the extended error code 
SQLITE_CONSTRAINT_CHECK will not be recognized as a kind of constraint 
violation and will fall into the "default:" arm of the case statement.  This 
will result in raising the exception DatabaseError when the correct exception 
to raise is IntegrityError.

One simple solution would be to convert the extended error code back to the 
base error code, that is:
 "errorcode = 0xffu % sqlite3_errcode(db);"

--
status: closed -> open
type:  -> behavior

___
Python tracker 

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



[issue21199] Python on 64-bit Windows uses signed 32-bit type for read length

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I added comments to test on Rietveld.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue22336] _tkinter should use Python PyMem_Malloc() instead of Tcl ckalloc()

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And to me too. Please commit it, this is mainly your patch.

--

___
Python tracker 

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



[issue22387] Making tempfile.NamedTemporaryFile a class

2014-09-11 Thread Antony Lee

Antony Lee added the comment:

Yes, but this will make the context-manager approach (with 
NamedTemporaryFile(closed=True): ) unusable, because the underlying 
file object will be closed before calling __enter__.  I think the only 
reasonable way to implement this would be to have __enter__ return the file 
name (as for TemporaryDirectory), instead of the file object (which is 
reasonable because if I pass closed=True, it probably means all I care is that 
a file exists here for some other process to use!).
But, with the function approach, I cannot override __enter__.

--

___
Python tracker 

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



[issue22336] _tkinter should use Python PyMem_Malloc() instead of Tcl ckalloc()

2014-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9f1d3e6e6ce6 by Victor Stinner in branch 'default':
Closes #22336: attemptckalloc() with PyMem_Malloc() in _tkinter
http://hg.python.org/cpython/rev/9f1d3e6e6ce6

--
nosy: +python-dev
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



[issue22336] _tkinter should use Python PyMem_Malloc() instead of Tcl ckalloc()

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

> And to me too. Please commit it, this is mainly your patch.

Ok, thanks, done.

--

___
Python tracker 

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



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch. It warns if new files or directories are left after test run 
in current directory and removes those of them which starts with TESTFN (i.e. 
TESTFN_UNICODE, TESTFN + "2", TESTFN + ".py" and other names used in tests).

--
keywords: +patch
nosy: +ezio.melotti, michael.foord, pitrou
stage:  -> patch review
type:  -> enhancement
versions: +Python 2.7, Python 3.4
Added file: http://bugs.python.org/file36601/regrtest_warn_lost_files.patch

___
Python tracker 

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



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

I would prefer to fix tests instead of trying to remove arbitrary files. I'm 
not sure that "fn.startswith(support.TESTFN)" check is safe enough.

Maybe we should not remove TESTFN neither. You are supposed to be able to run 
tests without regrtest.

--

___
Python tracker 

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



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread STINNER Victor

STINNER Victor added the comment:

I ran the test suite with the patch applied:

7 tests altered the execution environment:
test_imp test_import test_pdb test_posix test_source_encoding
test_support test_threaded_import

I will try to investigate these warnings.

--

___
Python tracker 

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



[issue22391] MSILIB truncates last character in summary information stream

2014-09-11 Thread Kevin Phillips

New submission from Kevin Phillips:

I recently exploited a subtle bug with the msilib module's GetProperty method 
on the SummaryInformation class. When retrieving string-typed properties from 
the stream the last character in the string gets truncated, replaced by a 
null-byte.

I am using Python v3.2.5 64bit on Windows 7, and I've managed to reproduce the 
error with the following code snippet:

filename = "sample.msp"
patch_database = msilib.OpenDatabase(filename, msilib.MSIDBOPEN_READONLY | 
msilib.MSIDBOPEN_PATCHFILE)
summary_info = patch_database.GetSummaryInformation(20)
print (summary_info.GetProperty(msilib.PID_REVNUMBER))

The PID_REVNUMBER returns the patch-GUID for the Windows Installer patch file. 
In this example the GUID is returned properly however the character string is 
supposed to be delimited by curly braces - { }. Examination of the returned 
byte array shows that the leading curly brace is included by the final curly 
brace is not. Closer examination also shows that the last character in the byte 
array is \x00.

While it is possible, in this situation, to circumvent the bug by simply 
removing the trailing bytes and replacing them with a closing curly brace, this 
may not be so easy to work around for general character strings if the last 
character in the sequence is not static. As such I'd highly recommend fixing 
this in the source for the msilib module.

--
components: Library (Lib), Windows
messages: 226789
nosy: Kevin.Phillips
priority: normal
severity: normal
status: open
title: MSILIB truncates last character in summary information stream
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue22364] Unify error messages of re and regex

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> By the way, which is preferred, "cannot" or "can't"? The regex module always
> uses "can't", but re module uses "cannot" except for "TypeError: can't use
> a bytes pattern on a string-like object", I think.

It's interesting question. Grepping in CPython sources got results:

Cannot  210
cannot  865
Can't   216
can't   796

Lowercase wins uppercase with score 4:1 and short and long forms are 
equivalent.

I left the decision to English speakers.

> Also, you said that one of the re module's messages was better, but didn't
> say which! Did you mean this one?
> > re:expected bytes, bytearray, or an object with the buffer interface,
> > str found
> > regex: expected bytes instance, str found

Both are not good. re variant is too verbose, but it is more correct.

May be 6, 7, 8, 10, 11, 16, 18 are better in re.

--

___
Python tracker 

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



[issue22391] MSILIB truncates last character in summary information stream

2014-09-11 Thread Kevin Phillips

Kevin Phillips added the comment:

I should mention that I did discover some source code on GitHub, presumably for 
this wrapper module, and I believe I found a few questionable parts in the 
logic for this library that may help explain the cause of this problem:

https://github.com/python-git/python/blob/master/PC/_msi.c

Here are some snippets from the summary_getproperty function that may help:

char sbuf[1000];
char *sval = sbuf;
DWORD ssize = sizeof(sval);

First, here, I believe the ssize value is not going to be initialized as one 
would expect at first glance. Since sval is a pointer and sizeof() returns the 
size of it's parameter, in this case a pointer, ssize will represent the 
pointer size on the target platform. In this case, on a 64bit OS, it's likely 
going to be set to 8, which I suspect the expected value for ssize is going to 
be 1000 - the size of the static array sbuff.

status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, 
&fval, sval, &ssize);
if (status == ERROR_MORE_DATA) {
sval = malloc(ssize);
status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, 
&fval, sval, &ssize);
}

Now, in this snippet it tries to load the string value from the file, and if 
the input buffer is not of sufficient size it reallocates the pointer to an 
appropriate size. Given the fact that ssize is probably initialized to 8 (or 
less) it is pretty safe to assume the first call to MsiSummaryInfoGetProperty 
changes this value to the length of the data stored in the file. Closer 
examination of the documentation for this Windows API function reveals that in 
this case ssize will be set to the number of characters required 'not including 
the terminating null character'. 
(http://msdn.microsoft.com/en-us/library/aa370409(v=vs.85).aspx)

result = PyString_FromStringAndSize(sval, ssize);

Then finally I noticed this function call. I suspect the problem may lie here. 
I'm not too familiar with the Python SDK but it sounds like when using Unicode 
strings - as all string are in Python 3 - you are supposed to use 
PyUnicode_FromStringAndSize instead. So perhaps there might be something 
getting lost in the translation, either via the use of this function or perhaps 
subsequent marshalling of the string object into the Python runtime, due to the 
encoding changes... not sure. It could be something as simple as one of the 
function calls used therein assume that the 'size' count includes a null-byte 
while others don't. It's hard to say without digging into the libs some more.

I hope this helps.

--

___
Python tracker 

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



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I would prefer to fix tests instead of trying to remove arbitrary files. I'm
> not sure that "fn.startswith(support.TESTFN)" check is safe enough.

This allow other tests which leaks the same file to be reported too.

support.TESTFN contains process ID so it is unique enough.

--

___
Python tracker 

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



[issue22390] test.regrtest should complain if a test doesn't remove temporary files

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I will try to investigate these warnings.

Run tests with the -vv option.

--

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2014-09-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

You should certainly create a new issue!

--

___
Python tracker 

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



[issue22391] MSILIB truncates last character in summary information stream

2014-09-11 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy: +steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue13968] Support recursive globs

2014-09-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue21147] sqlite3 doesn't complain if the request contains a null character

2014-09-11 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



[issue22386] Python 3.4 logging.getLevelName() no longer maps string to level.

2014-09-11 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +larry
priority: normal -> release blocker
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



[issue22392] Clarify documentation of __getinitargs__

2014-09-11 Thread David Gilman

New submission from David Gilman:

Implementations of __getinitargs__ return a tuple of the positional arguments 
for __init__.   This wasn't initially apparent to me after reading the docs: I 
thought you were passing a tuple (args, kwargs) that would get called f(*args, 
**kwargs) and had to go to the pickle implementation to find out what you were 
supposed to do.

The proposed documentation enhancement: mention that you're just supposed to 
return a tuple of positional args and that it doesn't support kwargs.

--
assignee: docs@python
components: Documentation
messages: 226795
nosy: David.Gilman, docs@python
priority: normal
severity: normal
status: open
title: Clarify documentation of __getinitargs__
type: enhancement
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



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Really, the test for whether to keep or remove the prefix should be to 
> remove the prefix and try and resolve the path again. If it succeeds, 
> remove the prefix; otherwise, keep it. This can only really be done as 
> part of the resolve() call, which would address the original issue,
> but it may be quite a perf. hit. 

It would also be prone to race conditions. All in all it sounds like a bad idea.
I still think it should be asked for explicitly. I don't know how the method 
should be called, .extended() perhaps?

--

___
Python tracker 

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



[issue22359] Remove incorrect uses of recursive make

2014-09-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Martin, Matthias, do you think this would break any legitimate use?

--
nosy: +loewis, pitrou
stage:  -> patch review
type: compile error -> behavior

___
Python tracker 

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



[issue22362] Warn about octal escapes > 0o377 in re

2014-09-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think we should simply raise ValueError in 3.5. There's no reason to accept 
such invalid escapes.

--

___
Python tracker 

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



[issue22299] resolve() on Windows makes some pathological paths unusable

2014-09-11 Thread Steve Dower

Steve Dower added the comment:

Another alternative is to always leave the prefix there after calling resolve() 
(as opposed to the current behaviour which is to always remove it). If the 
Win32 API says that the path should include the prefix, then it should. There's 
no reliable way for a developer to decide that an arbitrary path should include 
the prefix other than by resolving it.

I still like the idea of a format character to omit the prefix, as that 
correctly implies that the only reason you should remove it is for displaying 
to the user. Alternatively, a ".without_prefix" property seems like a safer 
route than requiring the user to add it. Long paths are the only time you may 
want to add it, but even that doesn't guarantee that the path will work.

--

___
Python tracker 

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



[issue22391] MSILIB truncates last character in summary information stream

2014-09-11 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +loewis

___
Python tracker 

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



[issue22382] sqlite3 connection built from apsw connection should raise IntegrityError, not DatabaseError

2014-09-11 Thread william tonkin

william tonkin added the comment:

The following worked for me:


--- util.c  2014-09-11 15:15:11.480266548 -0400
+++ util.c.fixed2014-09-11 15:17:19.214878592 -0400
@@ -54,7 +54,7 @@
 (void)sqlite3_reset(st);
 }

-errorcode = sqlite3_errcode(db);
+errorcode = 0xffu & sqlite3_errcode(db);

 switch (errorcode)
 {

--

___
Python tracker 

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



[issue22362] Warn about octal escapes > 0o377 in re

2014-09-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Well, here is a patch which makes re raise an exception on suspicious octals.

--
Added file: 
http://bugs.python.org/file36602/re_octal_escape_overflow_raise.patch

___
Python tracker 

___diff -r 180f5bf7d1b9 Lib/sre_parse.py
--- a/Lib/sre_parse.py  Thu Sep 11 14:33:02 2014 +0300
+++ b/Lib/sre_parse.py  Thu Sep 11 23:31:31 2014 +0300
@@ -283,7 +283,11 @@ def _class_escape(source, escape):
 elif c in OCTDIGITS:
 # octal escape (up to three digits)
 escape += source.getwhile(2, OCTDIGITS)
-return LITERAL, int(escape[1:], 8) & 0xff
+c = int(escape[1:], 8)
+if c > 0o377:
+raise error('octal escape value %r outside of '
+'range 0-0o377' % escape)
+return LITERAL, c
 elif c in DIGITS:
 raise ValueError
 if len(escape) == 2:
@@ -325,7 +329,7 @@ def _escape(source, escape, state):
 elif c == "0":
 # octal escape
 escape += source.getwhile(2, OCTDIGITS)
-return LITERAL, int(escape[1:], 8) & 0xff
+return LITERAL, int(escape[1:], 8)
 elif c in DIGITS:
 # octal escape *or* decimal group reference (sigh)
 if source.next in DIGITS:
@@ -334,7 +338,11 @@ def _escape(source, escape, state):
 source.next in OCTDIGITS):
 # got three octal digits; this is an octal escape
 escape = escape + source.get()
-return LITERAL, int(escape[1:], 8) & 0xff
+c = int(escape[1:], 8)
+if c > 0o377:
+raise error('octal escape value %r outside of '
+'range 0-0o377' % escape)
+return LITERAL, c
 # not an octal escape, so this is a group reference
 group = int(escape[1:])
 if group < state.groups:
@@ -825,7 +833,11 @@ def parse_template(source, pattern):
 s.next in OCTDIGITS):
 this += sget()
 isoctal = True
-lappend(chr(int(this[1:], 8) & 0xff))
+c = int(this[1:], 8)
+if c > 0o377:
+raise error('octal escape value %r outside of '
+'range 0-0o377' % this)
+lappend(chr(c))
 if not isoctal:
 addgroup(int(this[1:]))
 else:
diff -r 180f5bf7d1b9 Lib/test/test_re.py
--- a/Lib/test/test_re.py   Thu Sep 11 14:33:02 2014 +0300
+++ b/Lib/test/test_re.py   Thu Sep 11 23:31:31 2014 +0300
@@ -154,8 +154,8 @@ class ReTests(unittest.TestCase):
 self.assertEqual(re.sub('x', r'\09', 'x'), '\0' + '9')
 self.assertEqual(re.sub('x', r'\0a', 'x'), '\0' + 'a')
 
-self.assertEqual(re.sub('x', r'\400', 'x'), '\0')
-self.assertEqual(re.sub('x', r'\777', 'x'), '\377')
+self.assertRaises(re.error, re.sub, 'x', r'\400', 'x')
+self.assertRaises(re.error, re.sub, 'x', r'\777', 'x')
 
 self.assertRaises(re.error, re.sub, 'x', r'\1', 'x')
 self.assertRaises(re.error, re.sub, 'x', r'\8', 'x')
@@ -691,7 +691,7 @@ class ReTests(unittest.TestCase):
 self.assertIsNotNone(re.match(r"\08", "\0008"))
 self.assertIsNotNone(re.match(r"\01", "\001"))
 self.assertIsNotNone(re.match(r"\018", "\0018"))
-self.assertIsNotNone(re.match(r"\567", chr(0o167)))
+self.assertRaises(re.error, re.match, r"\567", "")
 self.assertRaises(re.error, re.match, r"\911", "")
 self.assertRaises(re.error, re.match, r"\x1", "")
 self.assertRaises(re.error, re.match, r"\x1z", "")
@@ -719,6 +719,7 @@ class ReTests(unittest.TestCase):
 self.assertIsNotNone(re.match(r"[\U%08x]" % i, chr(i)))
 self.assertIsNotNone(re.match(r"[\U%08x0]" % i, chr(i)+"0"))
 self.assertIsNotNone(re.match(r"[\U%08xz]" % i, chr(i)+"z"))
+self.assertRaises(re.error, re.match, r"[\567]", "")
 self.assertIsNotNone(re.match(r"[\U0001d49c-\U0001d4b5]", 
"\U0001d49e"))
 self.assertRaises(re.error, re.match, r"[\911]", "")
 self.assertRaises(re.error, re.match, r"[\x1z]", "")
@@ -740,7 +741,7 @@ class ReTests(unittest.TestCase):
 self.assertIsNotNone(re.match(br"\08", b"\0008"))
 self.assertIsNotNone(re.match(br"\01", b"\001"))
 self.assertIsNotNone(re.match(br"\018", b"\0018"))
-self.assertIsNotNone(re.match(br"\567", bytes([0o167])))
+self.assertRaises(re.error, re.match, br"\567", b"")
 self.assertRaises(re.error, re.match, br"\911", b"")
 self.assertRaises(re.error, re.match, br"\x1", b"")

[issue16662] load_tests not invoked in package/__init__.py

2014-09-11 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Sep 11, 2014, at 07:23 AM, STINNER Victor wrote:

>The changeset d0ff527c53da5b925b61a8a70afc686ca6e05960 related to this issue
>introduced a regression in test_unittest. The test now fails on
>Windows.

Darn.  I don't have Windows handy to work out a fix.  I'll try to get a VM
running but wouldn't mind if someone beats me to it. :)

--

___
Python tracker 

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



[issue21270] unittest.mock.call object has inherited count method

2014-09-11 Thread Michael Foord

Michael Foord added the comment:

Thanks for this Kushal. It's not quite right though, count and index need to do 
the same as other attributes looked up with __getattr__. In fact delegating to 
__getattr__ is probably the easiest way of achieving that. (With the current 
patch the calls will be incorrect for call.foo.index() or similar I believe.)

--

___
Python tracker 

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



[issue22386] Python 3.4 logging.getLevelName() no longer maps string to level.

2014-09-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a4c5effb8698 by Vinay Sajip in branch '3.4':
Issue #22386: fixed regression.
http://hg.python.org/cpython/rev/a4c5effb8698

New changeset 070fed5b7b9d by Vinay Sajip in branch 'default':
Closes #22386: merged fix from 3.4.
http://hg.python.org/cpython/rev/070fed5b7b9d

--
nosy: +python-dev
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



[issue22393] multiprocessing.Pool shouldn't hang forever if a worker process dies unexpectedly

2014-09-11 Thread Dan O'Reilly

New submission from Dan O'Reilly:

This is essentially a dupe of issue9205, but it was suggested I open a new 
issue, since that one ended up being used to fix this same problem in 
concurrent.futures, and was subsequently closed.

Right now, should a worker process in a Pool unexpectedly get terminated while 
a blocking Pool method is running (e.g. apply, map), the method will hang 
forever. This isn't a normal occurrence, but it does occasionally happen 
(either because someone  sends a SIGTERM, or because of a bug in the 
interpreter or a C-extension). It would be preferable for multiprocessing to 
follow the lead of concurrent.futures.ProcessPoolExecutor when this happens, 
and abort all running tasks and close down the Pool.

Attached is a patch that implements this behavior. Should a process in a Pool 
unexpectedly exit (meaning, *not* because of hitting the maxtasksperchild 
limit), the Pool will be closed/terminated and all cached/running tasks will 
raise a BrokenProcessPool exception. These changes also prevent the Pool from 
going into a bad state if the "initializer" function raises an exception 
(previously, the pool would end up infinitely starting new processes, which 
would immediately die because of the exception).

One concern with the patch: The way timings are altered with these changes, the 
Pool seems to be particularly susceptible to issue6721 in certain cases. If 
processes in the Pool are being restarted due to maxtasksperchild just as the 
worker is being closed or joined, there is a chance the worker will be forked 
while some of the debug logging inside of Pool is running (and holding locks on 
either sys.stdout or sys.stderr). When this happens, the worker deadlocks on 
startup, which will hang the whole program. I believe the current 
implementation is susceptible to this as well, but I could reproduce it much 
more consistently with this patch. I think its rare enough in practice that it 
shouldn't prevent the patch from being accepted, but thought I should point it 
out. 

(I do think issue6721 should be addressed, or at the very least internal  I/O 
locks should always reset after forking.)

--
components: Library (Lib)
files: multiproc_broken_pool.diff
keywords: patch
messages: 226805
nosy: dan.oreilly, jnoller, pitrou, sbt
priority: normal
severity: normal
status: open
title: multiprocessing.Pool shouldn't hang forever if a worker process dies 
unexpectedly
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file36603/multiproc_broken_pool.diff

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2014-09-11 Thread Dan O'Reilly

Dan O'Reilly added the comment:

Thanks, Antoine. I've opened issue22393.

--

___
Python tracker 

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



[issue22224] docs.python.org is prone to political blocking in Russia

2014-09-11 Thread Donald Stufft

Donald Stufft added the comment:

Just to close the gap on this, most of the PSF web properties that go through 
Fastly have been switched over to a set of IP addresses that are dedicated to 
the PSF. So if someone does an IP ban they are blocking us.

I just made the switch in DNS so it'll take hold as that propagates.

--

___
Python tracker 

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



[issue22379] Empty exception message of str.join

2014-09-11 Thread Yongzhi Pan

Changes by Yongzhi Pan :


--
versions: +Python 3.5
Added file: http://bugs.python.org/file36604/str_join_exception_message_1.diff

___
Python tracker 

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