[issue18594] C accelerator for collections.Counter is slow

2013-07-30 Thread Stefan Behnel

New submission from Stefan Behnel:

The C accelerator for the collections.Counter class (_count_elements() in 
_collections.c) is slower than the pure Python versions for data that has many 
unique entries. This is because the fast path for dicts is not taken (Counter 
is a subtype of dict) and the slower fallback path raises exceptions for each 
value that wasn't previously seen. This can apparently make it slower than 
calling get() on Python side.

My suggestion is to drop the fallback path from the accelerator completely and 
to only call the C function when it's safe to use it, e.g. when type(self) is 
Counter and not a subclass.

--
components: Library (Lib)
messages: 193914
nosy: scoder, serhiy.storchaka
priority: normal
severity: normal
status: open
title: C accelerator for collections.Counter is slow
type: performance
versions: Python 3.4

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



[issue18595] zipfile: symlinks etc.

2013-07-30 Thread Ronald Oussoren

New submission from Ronald Oussoren:

The zipfile format (as described by .zip file format specification) allows for 
storing extra unix data, such as symlinks and device nodes in zipfile.

Storing at least symlinks would be useful, and is supported by the infozip 
tools as well (the command-line zip and unzip commands on Linux systems).

An implementation would use the UNIX Extra Field (0x000d) to store this 
information.

--
components: Library (Lib)
messages: 193915
nosy: ronaldoussoren
priority: normal
severity: normal
stage: test needed
status: open
title: zipfile: symlinks etc.
type: enhancement
versions: Python 3.4

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



[issue18570] OverflowError in division: wrong message

2013-07-30 Thread Mark Dickinson

Mark Dickinson added the comment:

 I think we might be better with two consistently behaving float classes

That sounds a bit extreme.  Personally, I'd look for a solution involving only 
one float class and a with float.nonstopmode: ... setting under which we get 
infinities and nans as prescribed by IEEE 754;  the default would be to produce 
exceptions in places where IEEE 754 would signal a floating-point exception 
(any of divide-by-zero, overflow or invalid-operation, but not for inexact or 
underflow).  This is definitely PEP territory, though;  and someone needs to 
undertake to implement it, which is distinctly nontrivial.

For this issue, I'd avoid making any small changes to current behaviour without 
having at least a clear vision set out of where we want to end up.

--

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



[issue18596] enable usage of AddressSanitizer in CPython [PATCH]

2013-07-30 Thread halfie

New submission from halfie:

Hi,

When trying to build CPython tip with AddressSanitizer enabled, I get the 
following crash,

make Parser/pgen
make[1]: Entering directory `/scratch/repos/cpython'
make[1]: `Parser/pgen' is up to date.
make[1]: Leaving directory `/scratch/repos/cpython'
Parser/pgen ./Grammar/Grammar Include/graminit.h Python/graminit.c
=
==1375== ERROR: AddressSanitizer: heap-buffer-overflow on address 
0x6038f020 at pc 0x40b260 bp 0x7fff6e6cbbf0 sp 0x7fff6e6cbbe8
READ of size 4 at 0x6038f020 thread T0
#0 0x40b25f in _PyObject_Realloc 
/scratch/repos/cpython/Objects/obmalloc.c:1551
#1 0x403048 in PyNode_AddChild /scratch/repos/cpython/Parser/node.c:98
#2 0x4037fe in push /scratch/repos/cpython/Parser/parser.c:126
#3 0x4121bd in parsetok /scratch/repos/cpython/Parser/parsetok.c:211
#4 0x413344 in PyParser_ParseFileFlags 
/scratch/repos/cpython/Parser/parsetok.c:86
#5 0x413422 in getgrammar /scratch/repos/cpython/Parser/pgenmain.c:92
#6 0x401860 in main /scratch/repos/cpython/Parser/pgenmain.c:55
#7 0x3cb2221b74 in ?? ??:0
#8 0x401994 in _start ??:?
0x6038f020 is located 96 bytes to the left of 0-byte region 
[0x6038f080,0x6038f080)
==1375== AddressSanitizer CHECK failed: 
../../../../libsanitizer/asan/asan_allocator2.cc:216 ((id)) != (0) (0x0, 0x0)
#0 0x3ab681237d in ?? ??:0
#1 0x3ab68191b3 in ?? ??:0
#2 0x3ab680563b in ?? ??:0
#3 0x3ab6816e8f in ?? ??:0
#4 0x3ab6817ff1 in ?? ??:0
#5 0x3ab6812763 in ?? ??:0
#6 0x40b25f in _PyObject_Realloc 
/scratch/repos/cpython/Objects/obmalloc.c:1551
#7 0x403048 in PyNode_AddChild /scratch/repos/cpython/Parser/node.c:98
#8 0x4037fe in push /scratch/repos/cpython/Parser/parser.c:126
#9 0x4121bd in parsetok /scratch/repos/cpython/Parser/parsetok.c:211
#10 0x413344 in PyParser_ParseFileFlags 
/scratch/repos/cpython/Parser/parsetok.c:86
#11 0x413422 in getgrammar /scratch/repos/cpython/Parser/pgenmain.c:92
#12 0x401860 in main /scratch/repos/cpython/Parser/pgenmain.c:55
#13 0x3cb2221b74 in ?? ??:0
#14 0x401994 in _start ??:?
make: *** [Include/graminit.h] Error 1

...

AddressSanitizer is a fast memory error detector. See 
http://clang.llvm.org/docs/AddressSanitizer.html for details.


Build options used
==

export CFLAGS=-fsanitize=address -g

export LDFLAGS=-fsanitize=address

./configure --prefix=/opt/python --with-valgrind


Software Versions
==

$ hg log

changeset:   84902:6e1dd1ce95b8
branch:  2.7
tag: tip
parent:  84893:1dbcb0299088
user:Terry Jan Reedy tjre...@udel.edu
date:Tue Jul 30 01:37:36 2013 -0400
summary: Make all idle test case names end with 'Test'.

$ gcc --version
gcc (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)

$ cat /etc/redhat-release 
Fedora release 19 (Schrödinger’s Cat)

Fix / Work-around
=

See 
http://code.google.com/p/address-sanitizer/wiki/AddressSanitizer#Turning_off_instrumentation

Turning off the instrumentation for _PyObject_Free and  _PyObject_Realloc is 
required.

Advantages
==

AddressSanitizer can *now* be used to test and debug CPython.

AddressSanitizer has helped me find a large number of bugs in other softwares.

--
components: Interpreter Core
files: enable-ASAN-in-CPython.diff
keywords: patch
messages: 193917
nosy: halfie
priority: normal
severity: normal
status: open
title: enable usage of AddressSanitizer in CPython [PATCH]
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file31083/enable-ASAN-in-CPython.diff

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



[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2013-07-30 Thread Drekin

New submission from Drekin:

When I run sys.stdin.readline() interactivelly (on Windows and Python 3.3.2) 
and hit Ctrl-C, sometimes it returns an empty string just before 
KeyboardInterrupt is raised. Sometimes it isn't even raised and instead after 
hitting Return some weird SyntaxtError: unknown decode error (on line 0) 
occurs. Seems like propagation of KeyboardInterrupt is somehow out of sync. 
sys.stdin.read(n) has the same issue. May be related to recently fixed 
http://bugs.python.org/issue17619 where was similar situation with input().

--
components: Windows
messages: 193918
nosy: Drekin
priority: normal
severity: normal
status: open
title: On Windows sys.stdin.readline() doesn't handle Ctrl-C properly
versions: Python 3.3

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



[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2013-07-30 Thread Tim Golden

Tim Golden added the comment:

The Ctrl-C handling in Python on Windows is a bit strange in places. I'll add 
this to my list of things to look at. If you'd care to walk through the code to 
produce a patch or at least to point to suspect code, that would make it more 
likely that it be fixed.

--
assignee:  - tim.golden
nosy: +tim.golden
stage:  - needs patch
type:  - behavior

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



[issue18585] Add a text truncation function

2013-07-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Oops, sorry, I was mistaken. There is no bug actually here:

 textwrap.summarize('hello  world!', width=10)
'(...)'

'hello (...)' cannot be the right answer since its len() is 11, greater than 10.

--

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



[issue18585] Add a text truncation function

2013-07-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated patch to not add any space before the placeholder, with  (...) as 
default placeholder value.

--
Added file: http://bugs.python.org/file31084/summarize2.patch

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



[issue18594] C accelerator for collections.Counter is slow

2013-07-30 Thread Antoine Pitrou

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


--
nosy: +rhettinger
priority: normal - high

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



[issue18598] Importlib, more verbosity please

2013-07-30 Thread Lukáš Němec

New submission from Lukáš Němec:

Hello,

recently I filed this bugreport to Django, but they clarified this by pointing 
me to commits for new version of Django that uses python builtin importlib 
(import_module)

But since most of their import_module code is done like [import_module(x) for y 
if blahblah], it is very difficult for me to debug code where Django tries to 
import some package, and all I get back is message relative imports require 
the 'package' argument

This message tells me exactly nothing :), just that something somewhere, even 
3rd party app tried to do relative imports ...

what did it import, with what parameters?

I edited this locally for debugging, and changed it to this:
relative imports require the 'package' argument, package: %s % name

This simple change of the message allowed me to find the problem in a few 
seconds..

Would you please consider adding something similar to importlib for better 
debugging?

Thank you :)

--
components: Library (Lib)
messages: 193922
nosy: Lukáš.Němec
priority: normal
severity: normal
status: open
title: Importlib, more verbosity please
type: enhancement

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



[issue6643] Throw away more radioactive locks that could be held across a fork in threading.py

2013-07-30 Thread Maciej Bliziński

Maciej Bliziński added the comment:

Python version: 2.7.5
OS: Solaris 9

I'm still observing this issue (or Issue5114) on Solaris 9. The symptom is that 
test_threading hangs indefinitely (tested: overnight) and running pstack on the 
process, I'm seeing:

-  lwp# 1 / thread# 1  
 ff3dc734 lwp_park (0, 0, 0)
 ff3d3c74 s9_lwp_park (0, 0, 0, 1, feed4f48, 18f5a4) + 28
 ff3dc698 s9_handler (0, 0, 0, 1, feed4f48, 18f5a4) + 90
 ff1dea70 _sema_wait (0, feee66a0, fed6b054, feee6000, 2a298478, d1f20) + 1d4
 ff1dec30 sema_wait (81aa8, ff1dec24, 722a5b4b, 1101c, feed4f48, 134d60) + c
 feed4f48 sem_wait (81aa8, 0, fed6b1ac, 0, 0, 1) + 20
 ff050890 PyThread_acquire_lock (81aa8, 1, fed6b214, 2, 0, 1ae778) + 5c
 ff05524c lock_PyThread_acquire_lock (0, 22030, 0, 13ee40, 16a298, 55150) + 50
 fefa779c PyCFunction_Call (1ae788, 22030, 0, ff0d8eb8, 55150, ff0551fc) + e4
 ff016b14 PyEval_EvalFrameEx (18f5a0, 0, 0, d4f66, 16a298, 22030) + 5ee8
 ff0185d0 PyEval_EvalCodeEx (12c968, 0, 18f5a0, 4, 1, 18f5a4) + 924
 ff0168f8 PyEval_EvalFrameEx (1902b8, 0, 1, 1765c0, 16a298, 1b12d0) + 5ccc
 ff0185d0 PyEval_EvalCodeEx (13f608, 0, 1902b8, 4, 1, 1902bc) + 924
 ff0168f8 PyEval_EvalFrameEx (154748, 0, 1, 31f7f, 16a298, 1b1250) + 5ccc
 ff0185d0 PyEval_EvalCodeEx (10d650, 54a50, 154748, 2203c, 0, 2203c) + 924
 fef8e11c function_call (22038, 22030, 1386f0, 2203c, 130730, 22030) + 168
 fef604e8 PyObject_Call (130730, 22030, 1386f0, ff0e0340, fef8dfb4, 0) + 60
 ff0137dc PyEval_EvalFrameEx (169110, 0, 22030, 10e62d, 16a298, 22030) + 2bb0
 ff017478 PyEval_EvalFrameEx (168f80, 0, 169114, 1769fa, 16a298, 16a298) + 684c
 ff017478 PyEval_EvalFrameEx (176cb0, 0, 168f84, 12a2c0, 16a298, 16a298) + 684c
 ff0185d0 PyEval_EvalCodeEx (13f410, 176cb4, 176cb0, 13433c, 1, 0) + 924
 fef8e040 function_call (1b26f0, 134330, 0, ff1bc000, 1b26f0, 0) + 8c
 fef604e8 PyObject_Call (1b26f0, 134330, 0, ff0e0340, fef8dfb4, 134320) + 60
 fef6e530 instancemethod_call (0, 134330, 0, 0, 1b26f0, 134bd0) + a4
 fef604e8 PyObject_Call (c3b48, 22030, 0, ff0e0340, fef6e48c, 0) + 60
 ff01051c PyEval_CallObjectWithKeywords (c3b48, 22030, 0, 0, 0, 0) + 68
 ff05568c t_bootstrap (63bd0, 0, 0, 0, 16a298, ff0e2804) + 4c
 ff1e53a4 _lwp_start (0, 0, 0, 0, 0, 0)
-  lwp# 2 / thread# 2  
 ff3dc734 lwp_park (0, 0, 0)
 ff3d3c74 s9_lwp_park (0, 0, 0, 1, b64a0d58, 136818) + 28
 ff3dc698 s9_handler (0, 0, 0, 1, b64a0d58, 136818) + 90
 ff1dea70 _sema_wait (0, feee66a0, fec6b054, feee6000, 2a298478, d1f20) + 1d4
 ff1dec30 sema_wait (8ab00, ff1dec24, 722a5b4b, 1101c, feed4f48, 134d60) + c
 feed4f48 sem_wait (8ab00, 0, fec6b1ac, 0, 0, 1) + 20
 ff050890 PyThread_acquire_lock (8ab00, 1, fec6b214, 2, 0, 1ae610) + 5c
 ff05524c lock_PyThread_acquire_lock (0, 22030, 0, 13ee40, 156168, 55160) + 50
 fefa779c PyCFunction_Call (1ae620, 22030, 0, ff0d8eb8, 55160, ff0551fc) + e4
 ff016b14 PyEval_EvalFrameEx (18fe60, 0, 0, d4f66, 156168, 22030) + 5ee8
 ff0185d0 PyEval_EvalCodeEx (12c968, 0, 18fe60, 4, 1, 18fe64) + 924
 ff0168f8 PyEval_EvalFrameEx (18fce8, 0, 1, 1765c0, 156168, 1b11b0) + 5ccc
 ff0185d0 PyEval_EvalCodeEx (13f608, 0, 18fce8, 4, 1, 18fcec) + 924
 ff0168f8 PyEval_EvalFrameEx (18fb88, 0, 1, 136155, 156168, 1a2930) + 5ccc
 ff0185d0 PyEval_EvalCodeEx (48b60, 18fb8c, 18fb88, 19d41c, 1, 2203c) + 924
 fef8e11c function_call (22038, 19d410, 1b3c00, 2203c, 130370, 22030) + 168
 fef604e8 PyObject_Call (130370, 19d410, 1b3c00, ff0e0340, fef8dfb4, 19d400) + 
60
 ff0137dc PyEval_EvalFrameEx (18fa20, 0, 19d410, 10e62d, 156168, 134950) + 2bb0
 ff017478 PyEval_EvalFrameEx (18f890, 0, 18fa24, 1769fa, 156168, 156168) + 684c
 ff017478 PyEval_EvalFrameEx (18f728, 0, 18f894, 12a2c0, 156168, 156168) + 684c
 ff0185d0 PyEval_EvalCodeEx (13f410, 18f72c, 18f728, 19d3fc, 1, 0) + 924
 fef8e040 function_call (1b26f0, 19d3f0, 0, ff1bc000, 1b26f0, 0) + 8c
 fef604e8 PyObject_Call (1b26f0, 19d3f0, 0, ff0e0340, fef8dfb4, 19d3e0) + 60
 fef6e530 instancemethod_call (0, 19d3f0, 0, 0, 1b26f0, 1b1250) + a4
 fef604e8 PyObject_Call (1aeaf8, 22030, 0, ff0e0340, fef6e48c, 0) + 60
 ff01051c PyEval_CallObjectWithKeywords (1aeaf8, 22030, 0, 0, 0, 0) + 68
 ff05568c t_bootstrap (63c30, 0, 0, 0, 156168, ff0e2804) + 4c
 ff1e53a4 _lwp_start (0, 0, 0, 0, 0, 0)

The problem does not occur on Solaris 10.

--
nosy: +automatthias

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



[issue8713] multiprocessing needs option to eschew fork() under Linux

2013-07-30 Thread Richard Oudkerk

Richard Oudkerk added the comment:

The spawn branch is in decent shape, although the documentation is not 
up-to-date.

I would like to commit before the first alpha.

--

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



[issue18598] Importlib, more verbosity please

2013-07-30 Thread Brett Cannon

Brett Cannon added the comment:

It could be changed to something like the 'package' argument is required to 
perform a relative import for {!r}.format(name) . Would that have made it more 
clear?

--
assignee:  - brett.cannon
nosy: +brett.cannon
priority: normal - low
stage:  - needs patch
versions: +Python 3.4

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



[issue18598] Importlib, more verbosity please

2013-07-30 Thread Lukáš Němec

Lukáš Němec added the comment:

Yes, absolutely,

that is what was I needed to debug it easily, the name parameter

Thank you :)

--

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



[issue18598] Importlib, more verbosity please

2013-07-30 Thread Lukáš Němec

Lukáš Němec added the comment:

Also, please do not forget on backports for python 2.6+ :)

--

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



[issue18594] C accelerator for collections.Counter is slow

2013-07-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Are there any cases where the counter class with the C accelerator is faster 
than the pure Python version? Here is a benchmarking script (modification of 
Roy Smith's script [1]) and looks as the pure Python version is faster even for 
data that has not many unique entries.

[1] http://permalink.gmane.org/gmane.comp.python.general/738820

--
Added file: http://bugs.python.org/file31085/counterbench.py

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



[issue18594] C accelerator for collections.Counter is slow

2013-07-30 Thread Eli Bendersky

Eli Bendersky added the comment:

That sounds like a good idea, Stefan.

--
nosy: +eli.bendersky

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



[issue18599] _sha1module report SHA as its name

2013-07-30 Thread Christian Heimes

New submission from Christian Heimes:

I found the issue while I was working on unit tests. It looks like a honest 
mistake ... :)

PyUnicode_FromStringAndSize(SHA1, 3);

--
files: sha1name.patch
keywords: patch
messages: 193930
nosy: christian.heimes, gregory.p.smith, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: _sha1module report SHA as its name
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file31086/sha1name.patch

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



[issue9035] os.path.ismount on windows doesn't support windows mount points

2013-07-30 Thread Tim Golden

Tim Golden added the comment:

I put a bit of work in on this this morning, following Mark's suggestion 
(msg138197) since that's the canonical approach. Unfortunately, it completely 
fails to work for the most common case: the root folder of a drive! The 
documentation for FindFirstFile explicitly precludes that possibility.

It looks as though  GetVolumePathName is the way to go. I thought I'd 
previously found some instance where that failed but, ad hoc, I can't make it 
fail now. I'll try to rework Atsuo's patch against the current posixmodule.c.

--

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



[issue18593] Typo in Lib/multiprocessing/heap.py

2013-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 634d6307730d by Eli Bendersky in branch '3.3':
Issue #18593: fix typo in comment
http://hg.python.org/cpython/rev/634d6307730d

New changeset b805bace07c5 by Eli Bendersky in branch 'default':
Issue #18593: fix typo in comment
http://hg.python.org/cpython/rev/b805bace07c5

--
nosy: +python-dev

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



[issue18593] Typo in Lib/multiprocessing/heap.py

2013-07-30 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
versions: +Python 3.3

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



[issue18596] enable usage of AddressSanitizer in CPython [PATCH]

2013-07-30 Thread Antoine Pitrou

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


--
nosy: +christian.heimes, haypo
stage:  - patch review
type: crash - enhancement

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



[issue18598] Importlib, more verbosity please

2013-07-30 Thread Brett Cannon

Brett Cannon added the comment:

Sorry, I can't backport this change as it's not a bugfix but an enhancement and 
it could break someone's code who relies on the specific format of the 
exception message.

--

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



[issue18599] _sha1module report SHA as its name

2013-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c34c018a8390 by Christian Heimes in branch '3.3':
Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns
http://hg.python.org/cpython/rev/c34c018a8390

New changeset 5fbf23e947d8 by Christian Heimes in branch 'default':
Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns
http://hg.python.org/cpython/rev/5fbf23e947d8

--
nosy: +python-dev

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



[issue18599] _sha1module report SHA as its name

2013-07-30 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


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

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



[issue18596] enable usage of AddressSanitizer in CPython [PATCH]

2013-07-30 Thread halfie

halfie added the comment:

This patch should only be applied if we are sure that the allocator is fine and 
doing such things by design.

--
type: enhancement - crash

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



[issue18596] enable usage of AddressSanitizer in CPython [PATCH]

2013-07-30 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
type: crash - enhancement

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



[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2013-07-30 Thread Drekin

Drekin added the comment:

I haven't experience with Python C code but I tried to find some clues in the 
code. First for input(): it call PyOS_Readline which may call 
PyOS_StdioReadline  my_fgets  fgets in Parser/myreadline.c. There is Windows 
related comment on line 56:

“Ctrl-C anywhere on the line or Ctrl-Z if the only character on a line will set 
ERROR_OPERATION_ABORTED. Under normal circumstances Ctrl-C will also have 
caused the SIGINT handler to fire which will have set the event object returned 
by _PyOS_SigintEvent. This signal fires in another thread and is not guaranteed 
to have occurred before this point in the code. 
Therefore: check whether the event is set with a small timeout. If it is, 
assume this is a Ctrl-C and reset the event. If it isn't set assume that this 
is a Ctrl-Z on its own and drop through to check for EOF.”

For sys.stdin.readline and .read: it goes down the IO machinery from text IO, 
buffered IO and raw IO (in this case FileIO) to Modules/_io/fileio.c where it 
ends calling function read(fd, buf, len), probably from unistd. I don't know 
how read is implemented on Windows.

I also tried calling ReadConsoleW from winapi via ctypes to read Unicode 
charactes from console (see http://bugs.python.org/issue1602). And there was 
similar issue with Ctrl-C occurring. What seems to work here is to put 
time.sleep(0.01) after ReadConsoleW.

So the general pattern is following: when calling some low-level Windows 
function to read input from user and when he hits Ctrl-C, the function returns 
and SIGINT is generated. However it takes time for this signal to arrive. 
Because it may arrive anywhere in the following code, the strange behaviour may 
occur. In the input() case, when PyOS_Readline returns, it was probably enough 
time, so added PyErr_CheckSignals() catched that SIGINT/KeyboardInterrupt.

We can find out about Ctrl-C having been pressed by calling winapi function 
GetLastError() and testing against ERROR_OPERATION_ABORTED. Then we should wait 
for the signal.

--

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



[issue18600] email.policy doc example passes 'policy' to as_string, but that doesn't work

2013-07-30 Thread R. David Murray

New submission from R. David Murray:

When I wrote those docs I intended to add a policy argument to as_string, but 
did not do it by the time 3.3 was released.  The docs for 3.3 need to be 
corrected, and I need to decide if I do want to add that keyword to as_string 
in 3.4 (the answer is probably yes, but I may check with the email-sig first).

--
assignee: docs@python
components: Documentation, email
messages: 193937
nosy: barry, docs@python, r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: email.policy doc example passes 'policy' to as_string, but that doesn't 
work
type: behavior
versions: Python 3.3, Python 3.4

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



[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2013-07-30 Thread Tim Golden

Tim Golden added the comment:

Thanks for doing the investigation. Yes, that comment was added by me
as part of the fix for issue1677. I'll try to have a look at the
codepath you describe to see if we can add a similar workaround. The
Ctrl-C / SIGINT handling on Windows is less than ideal, I admit.

There was a similar problem in issue18040 which I closed as won't fix
since the fix was arguably too intrusive for the extremely unlikely
problem it was fixing. It might be worth seeing if the same root cause
applies, though.

--

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



[issue9035] os.path.ismount on windows doesn't support windows mount points

2013-07-30 Thread Tim Golden

Tim Golden added the comment:

issue9035.2.patch is an updated version of Atsuo's patch. 

Known issues:

* I haven't reworked it for the new memory-management API
* There's no test for a non-root mount point (which is really the basis for 
this issue). It's difficult to see how to do that in a robust way on an 
arbitrary machine without quite a bit of support machinery. I've done ad hoc 
tests which succeed.

--
Added file: http://bugs.python.org/file31087/issue9035.2.patch

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



[issue18369] X509 cert class for ssl module

2013-07-30 Thread Derek Wilson

Derek Wilson added the comment:

actually, i suppose rather than change a bunch of existing functions/methods to 
handle X509 certs it would make more sense to add new methods to the X509 cert 
class (like match_hostname) so that old stuff doesn't break.

--

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



[issue18570] OverflowError in division: wrong message

2013-07-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I would prefer one type too, if it can be done gracefully enough. I had thought 
of a set-mode function (method), but anticipate objection to such modal 
action-at-distance behavior. A context manager, which I had not thought of, 
somewhat alleviates that objection, though not entirely. If code written in 
try-except manner is imported and run under the context manager, it might or 
might not work. My toy example would, in that the final array might contain 
Nans rather than Nones, which would be all right since the user would 
anticipate that, having asked for that. But if the imported code used 
exceptions to switch algorithms, switching from exceptions to inf/nan might not 
work so well.

Consistently replacing 'return inf/nan' and 'raise FPException' (where 
appropriate) with if flag: return inf/nam; else: raise FPException seems not 
too difficult ;-). But yes, a PEP rather than more piecemeal changes.

--

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



[issue18112] PEP 442 implementation

2013-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3f994367a979 by Antoine Pitrou in branch 'default':
Issue #18112: PEP 442 implementation (safe object finalization).
http://hg.python.org/cpython/rev/3f994367a979

--
nosy: +python-dev

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



[issue18112] PEP 442 implementation

2013-07-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Committed with a couple further doc changes!

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

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



[issue18533] Avoid error from repr() of recursive dictview

2013-07-30 Thread Ben North

Changes by Ben North b...@redfrontdoor.org:


Added file: http://bugs.python.org/file31089/against-9bf89c909bd4-3.3-1.patch

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



[issue18533] Avoid error from repr() of recursive dictview

2013-07-30 Thread Ben North

Ben North added the comment:

I'll attach fresh patches, one against latest 2.7 and one against
latest 3.3 (unchanged apart from headers from previous patch).

Both branches pass

./python -m test.regrtest -R20:30 test_dictviews

--

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



[issue18533] Avoid error from repr() of recursive dictview

2013-07-30 Thread Ben North

Changes by Ben North b...@redfrontdoor.org:


Added file: http://bugs.python.org/file31088/against-6e1dd1ce95b8-2.7-1.patch

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



[issue18214] Stop purging modules which are garbage collected before shutdown

2013-07-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Now that PEP 442 is committed, here is the patch.

--
Added file: http://bugs.python.org/file31090/module_cleanup.patch

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



[issue18214] Stop purging modules which are garbage collected before shutdown

2013-07-30 Thread Antoine Pitrou

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


--
components: +Interpreter Core
nosy: +amaury.forgeotdarc, gregory.p.smith
stage:  - patch review
type:  - enhancement

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



[issue812369] module shutdown procedure based on GC

2013-07-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Superceded by patch in issue 18214.

--
resolution:  - duplicate
status: open - closed
superseder:  - module shutdown procedure based on GC

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



[issue18584] examples in email.policy doc are fu'd

2013-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7b86be4e822c by R David Murray in branch '3.3':
#18584: s/testcleanup/testsetup/ until we switch to Sphinx 1.1.
http://hg.python.org/cpython/rev/7b86be4e822c

New changeset 1901a04a3b4a by R David Murray in branch 'default':
Merge #18584: s/testcleanup/testsetup/ until we switch to Sphinx 1.1.
http://hg.python.org/cpython/rev/1901a04a3b4a

--

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



[issue18601] Example command-line interface to difflib has typographical error

2013-07-30 Thread Stephen Paul Chappell

New submission from Stephen Paul Chappell:

The example at the bottom is good but has a line with a bad variable it is 
name. It says:

with open(fromlines) as fromf, open(tofile) as tof:
fromlines, tolines = list(fromf), list(tof)

In the first line, fromlines does no even exist yet. should say:

with open(fromlines) as fromf, open(tofile) as tof:
from, tolines = list(fromf), list(tof)

--
assignee: docs@python
components: Demos and Tools, Documentation
messages: 193948
nosy: Zero, docs@python
priority: normal
severity: normal
status: open
title: Example command-line interface to difflib has typographical error
versions: Python 3.3

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



[issue18601] Example command-line interface to difflib has typographical error

2013-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0e1f0faacb0d by R David Murray in branch '3.3':
#18601: fix error made when difflib example was converted to use 'with'.
http://hg.python.org/cpython/rev/0e1f0faacb0d

New changeset c4f377d710da by R David Murray in branch 'default':
Merge: #18601: fix error made when difflib example was converted to use 'with'.
http://hg.python.org/cpython/rev/c4f377d710da

--
nosy: +python-dev

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



[issue18601] Example command-line interface to difflib has typographical error

2013-07-30 Thread R. David Murray

R. David Murray added the comment:

Thanks for the report.  Actually that first 'fromlines' should be 'fromfile'.  
Looks like someone made a typo when converting the example to use the 'with' 
statement.

--
nosy: +r.david.murray
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
type:  - behavior

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



[issue16273] f.tell() returning negative number on Windows build

2013-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 81bc2d64c006 by R David Murray in branch '3.3':
#16273: Fix tutorial discussion of seek/tell (opaque text-mode values).
http://hg.python.org/cpython/rev/81bc2d64c006

New changeset c7d9a2159c6c by R David Murray in branch 'default':
Merge: #16273: Fix tutorial discussion of seek/tell (opaque text-mode values).
http://hg.python.org/cpython/rev/c7d9a2159c6c

--
nosy: +python-dev

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



[issue18602] _io module names itself io

2013-07-30 Thread Antoine Pitrou

New submission from Antoine Pitrou:

In Modules/_io/_iomodule.c, the name field of the module struct is initialized 
to io rather than _io. The change should intuitively be harmless, but 
perhaps there's a reason why it is like that?

--
components: Library (Lib)
messages: 193953
nosy: pitrou
priority: low
severity: normal
status: open
title: _io module names itself io
type: behavior
versions: Python 3.4

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



[issue18214] Stop purging modules which are garbage collected before shutdown

2013-07-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Slightly better patch.

Also, as I pointed out in python-dev 
(http://mail.python.org/pipermail/python-dev/2013-July/127673.html), this is 
still imperfect due to various ways modules can be kept alive from long-lived C 
variables.

--
Added file: http://bugs.python.org/file31091/module_cleanup2.patch

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



[issue9035] os.path.ismount on windows doesn't support windows mount points

2013-07-30 Thread Tim Golden

Tim Golden added the comment:

issue9035.3.patch has switched to the new memory management API and has 
tweaked the tests slightly for robustness.

This approach does introduce a behavioural change: the root of a SUBSTed 
drive (essentially a symlink into the Dos namespace) will raise an 
OSError because GetVolumePathName returns error 87: invalid parameter. 
So os.path.ismount(F:\\) will fail where F: is the result of running, 
eg, SUBST F: C:\temp.

I think the simplest thing is to special-case drive roots (which are 
always mount points) and then to apply the new GetVolumePathName logic.

--
Added file: http://bugs.python.org/file31092/issue9035.3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9035
___diff --git a/Lib/ntpath.py b/Lib/ntpath.py
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -336,15 +336,26 @@
 return True
 
 # Is a path a mount point?  Either a root (with or without drive letter)
-# or an UNC path with at most a / or \ after the mount point.
+# or an UNC path with at most a / or \ after the mount point or a mounted
+# drive. The canonical approach which detects the IO_REPARSE_TAG_MOUNT_POINT
+# fails for drive roots.
 
-def ismount(path):
-Test whether a path is a mount point (defined as root of drive)
-seps = _get_bothseps(path)
-root, rest = splitdrive(path)
-if root and root[0] in seps:
-return (not rest) or (rest in seps)
-return rest in seps
+try:
+from nt import _getvolumepathname
+def ismount(path):
+#
+# GetVolumePathName will return the directory itself
+# if it is a mount point (including a drive root).
+#
+return abspath(path).rstrip(sep) == 
abspath(_getvolumepathname(path)).rstrip(sep)
+except ImportError:
+def ismount(path):
+Test whether a path is a mount point (defined as root of drive)
+seps = _get_bothseps(path)
+root, rest = splitdrive(path)
+if root and root[0] in seps:
+return (not rest) or (rest in seps)
+return rest in seps
 
 
 # Expand paths beginning with '~' or '~user'.
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -256,6 +256,29 @@
 # dialogs (#4804)
 ntpath.sameopenfile(-1, -1)
 
+def test_ismount(self):
+self.assertTrue(ntpath.ismount(c:\\))
+self.assertTrue(ntpath.ismount(C:\\))
+self.assertTrue(ntpath.ismount(c:/))
+self.assertTrue(ntpath.ismount(C:/))
+self.assertTrue(ntpath.ismount(.\\c:\\))
+self.assertTrue(ntpath.ismount(.\\C:\\))
+
+with support.temp_dir() as d:
+self.assertFalse(ntpath.ismount(d))
+
+#
+# Make sure the current folder isn't the root folder
+# (or any other volume root). The drive-relative
+# locations below cannot then refer to mount points
+#
+drive, path = ntpath.splitdrive(sys.executable)
+with support.change_cwd(os.path.dirname(sys.executable)):
+self.assertFalse(ntpath.ismount(drive.lower()))
+self.assertFalse(ntpath.ismount(drive.upper()))
+
+self.assertTrue(ntpath.ismount(localhost\\c$))
+self.assertTrue(ntpath.ismount(localhost\\c$\\))
 
 class NtCommonTest(test_genericpath.CommonTest, unittest.TestCase):
 pathmodule = ntpath
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -3711,6 +3711,47 @@
 else
 Py_RETURN_FALSE;
 }
+
+PyDoc_STRVAR(posix__getvolumepathname__doc__,
+Return volume mount point of the specified path.);
+
+/* A helper function for ismount on windows */
+static PyObject *
+posix__getvolumepathname(PyObject *self, PyObject *args)
+{
+PyObject *po, *result;
+wchar_t *path, *mountpath=NULL;
+size_t bufsize;
+BOOL ret;
+
+if (!PyArg_ParseTuple(args, U|:_getvolumepathname, po))
+return NULL;
+path = PyUnicode_AsUnicode(po);
+if (path == NULL)
+return NULL;
+
+/* Volume path should be shorter than entire path */
+bufsize = max(MAX_PATH, wcslen(path) * 2 * sizeof(wchar_t)+1);
+mountpath = (wchar_t *)PyMem_Malloc(bufsize);
+if (mountpath == NULL)
+return PyErr_NoMemory();
+
+Py_BEGIN_ALLOW_THREADS
+ret = GetVolumePathNameW(path, mountpath, bufsize);
+Py_END_ALLOW_THREADS
+
+if (!ret) {
+result = win32_error_object(_getvolumepathname, po);
+goto exit;
+}
+result = PyUnicode_FromWideChar(mountpath, wcslen(mountpath));
+
+exit:
+PyMem_Free(mountpath);
+return result;
+}
+/* end of posix__getvolumepathname */
+
 #endif /* MS_WINDOWS */
 
 PyDoc_STRVAR(posix_mkdir__doc__,
@@ -10884,6 +10925,7 @@
 {_getfinalpathname,   posix__getfinalpathname, METH_VARARGS, NULL},
 {_isdir,   

[issue9253] argparse: optional subparsers

2013-07-30 Thread paul j3

paul j3 added the comment:

msg113512 - (view) Author: Steven Bethard (bethard) 
Seems like there's minimally the bug that argparse should currently throw an 
error if you add an argument after subparsers (since that argument will never 
be parsed under the current semantics).

This isn't quite right.  If the main usage signature is:

usage: PROG [-h] foo {one,two} ... baz

the parser._match_arguments_partial() method will allocate the 1st string to 
'foo', the last to 'baz', and pass the rest to the subparser(s).  It doesn't 
know how many the subparsers can use, but it knows that 'baz' requires one.  
From the standpoint of matching argument strings and arguments, a subparser is 
essentially a '+' positional.

On the other hand if 'baz' (the positional after the subparser) was '*' or '?' 
it would not get any strings.

If it is possible that subparser(s) doesn't need all the strings passed to it, 
the user could use 'parse_known_args', and deal with the unparsed strings 
themselves (possibly with another parser).

--

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-30 Thread Ned Deily

Ned Deily added the comment:

The changes for this issue appear to have changed the behavior of test_sqlite.  
Prior to 5643e873f06e on OS X 10.4 Tiger with the system libsqlite (3.1.3), all 
test cases of test_sqlite pass.  As of current tip on the same platform, there 
are now two failures in test_sqlite:

$ ./python -m test -v test_sqlite
== CPython 3.4.0a0 (default:c7d9a2159c6c, Jul 30 2013, 14:20:52) [GCC 4.0.1 
(Apple Computer, Inc. build 5370)]
==   Darwin-8.11.0-Power_Macintosh-powerpc-32bit big-endian
==   /Volumes/cache/py/main4/3x/unix/source/build/test_python_4328
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, 
dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, 
verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)
[1/1] test_sqlite
test_sqlite: testing with version '2.6.0', sqlite_version '3.1.3'
[...]
==
FAIL: CheckAggrExceptionInFinalize (sqlite3.test.userfunctions.AggregateTests)
--
Traceback (most recent call last):
  File 
/Volumes/cache/py/main4/3x/unix/source/Lib/sqlite3/test/userfunctions.py, 
line 336, in CheckAggrExceptionInFinalize
self.fail(should have raised an OperationalError)
AssertionError: should have raised an OperationalError

==
FAIL: CheckAggrNoFinalize (sqlite3.test.userfunctions.AggregateTests)
--
Traceback (most recent call last):
  File 
/Volumes/cache/py/main4/3x/unix/source/Lib/sqlite3/test/userfunctions.py, 
line 309, in CheckAggrNoFinalize
self.fail(should have raised an OperationalError)
AssertionError: should have raised an OperationalError

--
Ran 232 tests in 2.988s

FAILED (failures=2, skipped=1)
test test_sqlite failed

--
resolution: fixed - 
status: closed - open

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



[issue18580] distutils compilers are unicode strings on OS X since Python 2.7.4

2013-07-30 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
Removed message: http://bugs.python.org/msg193830

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



[issue18580] distutils compilers are unicode strings on OS X since Python 2.7.4

2013-07-30 Thread Ned Deily

Ned Deily added the comment:

Thanks for the analysis.  I'm consolidating this issue with Issue18071.

--
status: open - closed

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



[issue18214] Stop purging modules which are garbage collected before shutdown

2013-07-30 Thread Antoine Pitrou

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


Added file: http://bugs.python.org/file31093/module_cleanup3.patch

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-30 Thread R. David Murray

R. David Murray added the comment:

Heh, that's the kind of behavior change I was worried about :(.

--

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



[issue18481] lcov report

2013-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 85ec2b5bfcd2 by Christian Heimes in branch 'default':
Issue #18481: Add C coverage reporting with gcov and lcov. A new make target
http://hg.python.org/cpython/rev/85ec2b5bfcd2

--
nosy: +python-dev

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



[issue18481] lcov report

2013-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 116b05b98bea by Christian Heimes in branch 'default':
Issue #18481: document new C coverage make targets
http://hg.python.org/devguide/rev/116b05b98bea

--

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



[issue18481] lcov report

2013-07-30 Thread Christian Heimes

Christian Heimes added the comment:

I have add two new make targets and documented the new stuff in our devguide. 
I'm going to run and upload the report every now and then.

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

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



[issue18603] PyOS_mystricmp unused and no longer available

2013-07-30 Thread Christian Heimes

New submission from Christian Heimes:

The two functions PyOS_strnicmp() and PyOS_stricmp() from Python/pystrcmp.c are 
no longer used by any function in the core. Because no module references any 
object from Python/pystrcmp.c the object file is not included in the Python 
binary:

$ nm -P python | grep ^PyOS | sort
PyOS_AfterFork T 0044040e 0036
PyOS_double_to_string T 005da3de 0119
PyOS_FiniInterrupts T 00440380 000b
PyOS_getsig T 00423994 0041
PyOS_InitInterrupts T 004402f5 008b
PyOS_InputHook B 0095d478 0008
PyOS_InterruptOccurred T 0044038b 003e
PyOS_ReadlineFunctionPointer B 0095d5c8 0008
PyOS_Readline T 0063ffb5 012e
PyOS_setsig T 004239d5 0078
PyOS_snprintf T 0041c7bc 00b8
PyOS_StdioReadline T 0063fe1c 0199
PyOS_string_to_double T 005d9b50 0146
PyOS_strtol T 005d3ded 00d6
PyOS_strtoul T 005d3a00 03ed
PyOS_vsnprintf T 0041c874 00c4

Neither Python 2.7 nor 3.3+ include the functions in their binaries. 2.6 and 
3.2 are not affected. The functions are part of the documented and stable API 
but apparently they are not used very often.

--
keywords: 3.3regression
messages: 193965
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: PyOS_mystricmp unused and no longer available
type: compile error
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue18604] Consolidate gui available checks in test.support

2013-07-30 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Current situation:

test.support.requires starts with
 if resource == 'gui' and not _is_gui_available():

On windows, _is_gui_available() uses ctypes to determine that there really is a 
graphics screen. On other systems, it just returns True, even when it should 
return False. The _is_gui_available check is repeated with each requires('gui') 
call even though all after the first would be redundant if False were somehow 
recorded. I think it should be. 

test/test_ttkguionly first tries to import _tkinter, as does test_idle, which 
initializes tcl/tk. It then calls tkinter.test.support.check_tk_availability. 
That either does a 'darwin'-ctypes check similar to the one for Windows in 
_is_gui_available (again to avoid a crash), or it tries to create a tk widget 
and looks for a TclError. Given that tcl has already been initialized 
successfully, the widget creation check is a gui-available check for non-Darwin 
systems. A global in tkinter.test.support records the result of the check so it 
is only run once.

If 'gui' is in use_resources, test_idle just does the widget check for *nix gui 
availability. It records a negative result by removing 'gui' from use_resources.

The tkinter system does not work for Idle because Idle tests use unittest test 
discovery instead of tkinter's custom test discovery. Given that, splitting 
test_idle into test_idle_text and test_idle_gui seems to not be possible. 
Anyway, if test_idle were to be split, categories like '_windows', '_dialogs', 
and '_extensions' would be much more sensible and useful.


For this issue, I propose:

1. Move the custom darwin gui check to test.support, after the custom windows 
gui check. It should be noted that a) Both of these are gui-framework 
independent; and b) Neither seems to be needed for any current buildbots (which 
makes it hard to verify that they work on current systems). However, they were 
needed in the past and might be again in the future, so each should be checked 
*once* in each regrtest run with 'gui' set.

2. If the crash-avoidance checks pass, run tkinter.Tk() as a final check on all 
systems (but especially those not covered by the first checks). But note in 
comments that this will have to change if tk is augmented or optionally 
replaced by another gui framework.

3. In requires(), run the above if 'gui' is set and requested, and record a 
negative result by unsetting 'gui' (removing it from use_resources). Perhaps 
output a note that this has been done. Subsequent gui requests will skip. I 
considered putting this logic in regrtest instead, but see 4.

4. Currently, requires never skips when the caller is the main module. Perhaps 
requires('gui') should skip even then when there is no gui system. This could 
happen if a no-gui system ran a console script with python -m test.text_xxx.

5. Remove the current gui check from test_idle. Idle tests should continue to 
work as they are.

6. Revising test_tk and test_ttk_guionly to use the revised test.support would 
be a larger patch. It might best be done while modernizing the tkinter test 
system to use unittest discovery and .main, in another issue. I am still 
learning the details of the tkinter test system.

-
To avoid immediate controversy, I marked this as an 'enhancement' for 3.4. But 
if the Mac 'darwin' check were currently needed, I would consider it a bug that 
it is buried in a tkinter function whose API is not right for Idle, instead of 
being in test.support. (And in 2.7, the function is buried in a module in a 
package with an illegal name.) So I think backporting should be considered.

--
messages: 193966
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Consolidate gui available checks in test.support
type: enhancement
versions: Python 3.4

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This is working, so closing. I opened #18604 for consolidating gui checks in 
test.support.

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

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



[issue16472] Distutils+mingw links agains msvcr90, while python27.dll is linked agains msvcrt

2013-07-30 Thread Marek Marczykowski-Górecki

Marek Marczykowski-Górecki added the comment:

I can confirm that when a module is linked against msvcr90, it crashes with 
invalid access to memory. When removed that library from the linker options 
(that is - no explicit msvcr, in any version) - module worked perfectly.

Note that comment on 
http://hg.python.org/cpython/file/6e1dd1ce95b8/Lib/distutils/cygwinccompiler.py#l333
 (Minge32CComiler class) already says no additional libraries needed, but 3 
lines later it sets dll_libraries to msvcr90 (via get_msvcr). So just removing 
lines 336:338 works great. Patch attached. Any chances to get this fixed in the 
next python 2.7.x release?

My system is Windows 7 64bit, Python 2.7.5 64bit (from official msi installer)

--
keywords: +patch
nosy: +marmarek
Added file: http://bugs.python.org/file31094/python-distutils-mingw32.patch

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



[issue18573] In unittest.TestCase.assertWarns doc there is some text about assertRaises()

2013-07-30 Thread py.user

py.user added the comment:

What about the second line?
It doesn't catch any exception


utest.py

#!/usr/bin/env python3

import unittest

class Test(unittest.TestCase):

def test_warning(self):
import warnings

with self.assertWarns(RuntimeWarning) as cm:
raise ValueError('f')
warnings.warn('f', RuntimeWarning)
print(repr(cm.warning))


[guest@localhost py]$ python3 -m unittest utest
E
==
ERROR: test_warning (utest.Test)
--
Traceback (most recent call last):
  File ./utest.py, line 11, in test_warning
raise ValueError('f')
ValueError: f

--
Ran 1 test in 0.000s

FAILED (errors=1)
[guest@localhost py]$


with commented raise

[guest@localhost py]$ python3 -m unittest utest
RuntimeWarning('f',)
.
--
Ran 1 test in 0.000s

OK
[guest@localhost py]$


in the patch I copied terms from the first sentence of the paragraph

--

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



[issue11955] 3.3 : test_argparse.py fails 'make test'

2013-07-30 Thread paul j3

paul j3 added the comment:

The test names are:

FAIL: test_failures_many_groups_listargs (__main__.TestFileTypeW) 
FAIL: test_failures_many_groups_sysargs (__main__.TestFileTypeW)  
FAIL: test_failures_no_groups_listargs (__main__.TestFileTypeW)   
FAIL: test_failures_no_groups_sysargs (__main__.TestFileTypeW)
FAIL: test_failures_one_group_listargs (__main__.TestFileTypeW)   
FAIL: test_failures_one_group_sysargs (__main__.TestFileTypeW)

So they differ by [many_groups, no_groups, one_group] and [listargs, sysargs]

There are about 170 tests in test_argparse that get multiplied by 6 in this 
way.  If this replication was removed it would cut the number of tests and time 
to nearly a third.

This replication is not useful.  listargs and sysargs differ only in how a list 
of arguments is passed to parse_args, either directly, or via sys.argv.  It 
should be sufficient to test these alternatives once, not 170 times.

'one group' creates an argument group, and adds all arguments to that.  'many 
groups' creates an argument group for each added argument.  But argument groups 
are not used for 'parse_args'.  They are only used when formatting help.  By 
default all the arguments of parser are already put into one of two groups, 
'optional arguments' or 'positional arguments'.

There are tests for the help formatting, but they don't use this 
ParserTesterMetaclass.  

I would recommend removing this test replication.  It is both unnecessary and a 
source of confusion.  The simplest would be to change the end of the 
ParserTesterMetaclass.  

class ParserTesterMetaclass
def __init__()

for add_arguments in [no_groups]:
for parse_args in [listargs]:
AddTests(cls, add_arguments, parse_args)

I suspect there is some confusion among users and developers as to what 
argument groups do.  

As for the TestFileTypeW error, I suspect it has to do with file writing 
privileges.  I haven't encountered it, but I running tests in my own directory.

--
nosy: +paul.j3

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



[issue18573] In unittest.TestCase.assertWarns doc there is some text about assertRaises()

2013-07-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

 What about the second line?
What second line?
 It doesn't catch any exception
It? I do not understand your point. Your example works as documented, including 
any unexpected exception is an error.

Actually, that should be 'any exception' as none is expected.

Also, additional checks on the exception raised: should be 'warning caught'

--

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



[issue18573] In unittest.TestCase.assertWarns doc there is some text about assertRaises()

2013-07-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 366beee880aa by Terry Jan Reedy in branch '3.3':
Issue #18573: More copy-paste fixes to assertWarns entry.
http://hg.python.org/cpython/rev/366beee880aa

--

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



[issue18596] enable usage of AddressSanitizer in CPython [PATCH]

2013-07-30 Thread Charles-François Natali

Charles-François Natali added the comment:

The warning is due to the Py_ADDRESS_IN_RANGE() macro: it's a know limitation, 
we have the same problem with valgrind.

This would be a nice neature. It would IMO be even nicer to have an 
ASAN-enabled buildbot.

--
nosy: +neologix

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