From report at bugs.python.org Sun Sep 1 00:26:14 2013 From: report at bugs.python.org (Martin Mokrejs) Date: Sat, 31 Aug 2013 22:26:14 +0000 Subject: [New-bugs-announce] [issue18897] Illegal instruction at Python-2.7.5/Modules/_sre.c:1173 Message-ID: <1377987974.98.0.815254157912.issue18897@psf.upfronthosting.co.za> New submission from Martin Mokrejs: I was trying to use DUMA to find errors in python runtime and it indeed killed python-based utility called emerge. Let's see what you say now: # export LD_PRELOAD=/usr/lib64/libduma.so.0.0.0 # sysctl -w vm.max_map_count=1000000 # emerge dev-lang/python:2.7 DUMA 2.5.15 (shared library, NO_LEAKDETECTION) Copyright (C) 2006 Michael Eddington Copyright (C) 2002-2008 Hayati Ayguen , Procitec GmbH Copyright (C) 1987-1999 Bruce Perens DUMA 2.5.15 (shared library, NO_LEAKDETECTION) Copyright (C) 2006 Michael Eddington Copyright (C) 2002-2008 Hayati Ayguen , Procitec GmbH Copyright (C) 1987-1999 Bruce Perens DUMA 2.5.15 (shared library, NO_LEAKDETECTION) Copyright (C) 2006 Michael Eddington Copyright (C) 2002-2008 Hayati Ayguen , Procitec GmbH Copyright (C) 1987-1999 Bruce Perens DUMA Aborting: mprotect() failed: Cannot allocate memory. Check README section 'MEMORY USAGE AND EXECUTION SPEED' if your (Linux) system may limit the number of different page mappings per process Illegal instruction (core dumped) # ulimit -a core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 127104 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 127104 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited # (gdb) where #0 0x00007febd6ed84d7 in kill () from /lib64/libc.so.6 #1 0x00007febd78e2f9c in DUMA_Abort () from /usr/lib64/libduma.so.0.0.0 #2 0x00007febd78e1b77 in _duma_allocate () from /usr/lib64/libduma.so.0.0.0 #3 0x00007febd78e1fef in _duma_malloc () from /usr/lib64/libduma.so.0.0.0 #4 0x00007febd7626c60 in sre_umatch (state=0x7fff96f0de10, pattern=0x7feb2804ecb8) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_sre.c:1173 #5 0x00007febd762932f in pattern_match (self=0x7feb2804ec58, args=(u'>=gnome-base/libbonobo-2.32::gentoo-haskell',), kw=0x0) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_sre.c:1896 #6 0x00007febd751ffcc in PyCFunction_Call (func=, arg=(u'>=gnome-base/libbonobo-2.32::gentoo-haskell',), kw=0x0) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/methodobject.c:85 #7 0x00007febd75c4b81 in call_function (pp_stack=0x7fff96f0e6d0, oparg=1) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Python/ceval.c:4021 #8 0x00007febd75bf6c6 in PyEval_EvalFrameEx (f=Frame 0x7feb374ebce8, for file /usr/lib64/portage/pym/portage/dep/__init__.py, line 1227, in __init__ (self=, s=u'>=gnome-base/libbonobo-2.32::gentoo-haskell', unevaluated_atom=None, allow_wildcard=True, allow_repo=True, _use=None, eapi=None, is_valid_flag=None, eapi_attrs=<_eapi_attrs at remote 0x7feb31931f48>, atom_re=<_sre.SRE_Pattern at remote 0x7feb2804ec58>, blocker_prefix=u'', blocker=False), throwflag=0) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Python/ceval.c:2666 [cut] (gdb) bt full #0 0x00007febd6ed84d7 in kill () from /lib64/libc.so.6 No symbol table info available. #1 0x00007febd78e2f9c in DUMA_Abort () from /usr/lib64/libduma.so.0.0.0 No symbol table info available. #2 0x00007febd78e1b77 in _duma_allocate () from /usr/lib64/libduma.so.0.0.0 No symbol table info available. #3 0x00007febd78e1fef in _duma_malloc () from /usr/lib64/libduma.so.0.0.0 No symbol table info available. #4 0x00007febd7626c60 in sre_umatch (state=0x7fff96f0de10, pattern=0x7feb2804ecb8) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_sre.c:1173 end = 0x7fea931cfffc alloc_pos = 1648 ctx_pos = 1648 i = 128 ret = 0 jump = 2 sigcount = 187 ctx = 0x7fea931fbcf8 nextctx = 0x7fea931fbcf8 __PRETTY_FUNCTION__ = "sre_umatch" #5 0x00007febd762932f in pattern_match (self=0x7feb2804ec58, args=(u'>=gnome-base/libbonobo-2.32::gentoo-haskell',), kw=0x0) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Modules/_sre.c:1896 state = {ptr = 0x7fea931cffbc, beginning = 0x7fea931cff50, start = 0x7fea931cff50, end = 0x7fea931cfffc, string = u'>=gnome-base/libbonobo-2.32::gentoo-haskell', pos = 0, endpos = 43, charsize = 4, lastindex = 2, lastmark = 43, mark = {0x7fea931cff50, 0x0, 0x7fea931cff50, 0x7fea931cffbc, 0x7fea931cff50, 0x7fea931cff58, 0x7fea931cff58, 0x7fea931cffbc, 0x7fea931cff58, 0x7fea931cffa8, 0x0 , 0x7fea931cffac, 0x7fea931cffb0, 0x7fea931cffb0, 0x7fea931cffbc, 0x7fea931cffb0, 0x7fea931cffbc, 0x7fea931cffbc, 0x7fea931cffbc, 0x7fea931cffbc, 0x7fea931cffbc, 0x0 , 0x7fea931cffbc, 0x0, 0x7fea931cffc0, 0x0 }, data_stack = 0x7fea931fb688 "\377\377\377\377\377\377\377\377", data_stack_size = 2424, data_stack_base = 1712, repeat = 0x0, lower = 0x7febd7620852 } status = 32746 string = u'>=gnome-base/libbonobo-2.32::gentoo-haskell' start = 0 end = 9223372036854775807 kwlist = {0x7febd7660ad8 "pattern", 0x7febd7660cd9 "pos", 0x7febd7660cdd "endpos", 0x0} #6 0x00007febd751ffcc in PyCFunction_Call (func=, arg=(u'>=gnome-base/libbonobo-2.32::gentoo-haskell',), kw=0x0) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Objects/methodobject.c:85 f = 0x7feb37087fc8 meth = 0x7febd76291f7 self = <_sre.SRE_Pattern at remote 0x7feb2804ec58> size = -1282872823 #7 0x00007febd75c4b81 in call_function (pp_stack=0x7fff96f0e6d0, oparg=1) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Python/ceval.c:4021 callargs = (u'>=gnome-base/libbonobo-2.32::gentoo-haskell',) flags = 3 tstate = 0x7febd7bd1f58 na = 1 nk = 0 n = 1 pfunc = 0x7feb374ebf88 func = x = <_sre.SRE_Pattern at remote 0x7feb2804ec58> w = 0x0 #8 0x00007febd75bf6c6 in PyEval_EvalFrameEx (f=Frame 0x7feb374ebce8, for file /usr/lib64/portage/pym/portage/dep/__init__.py, line 1227, in __init__ (self=, s=u'>=gnome-base/libbonobo-2.32::gentoo-haskell', unevaluated_atom=None, allow_wildcard=True, allow_repo=True, _use=None, eapi=None, is_valid_flag=None, eapi_attrs=<_eapi_attrs at remote 0x7feb31931f48>, atom_re=<_sre.SRE_Pattern at remote 0x7feb2804ec58>, blocker_prefix=u'', blocker=False), throwflag=0) at /mnt/1TB/var/tmp/portage/dev-lang/python-2.7.5-r2/work/Python-2.7.5/Python/ceval.c:2666 sp = 0x7feb374ebf90 stack_pointer = 0x7feb374ebf98 next_instr = 0x7feb930726fd "}\f" opcode = 131 oparg = 1 why = WHY_NOT err = 0 x = u'>=gnome-base/libbonobo-2.32::gentoo-haskell' v = w = 'match' u = False t = stream = 0x0 fastlocals = 0x7feb374ebe70 freevars = 0x7feb374ebf88 retval = 0x0 tstate = 0x7febd7bd1f58 co = 0x7feb92e96f70 instr_ub = -1 instr_lb = 0 instr_prev = -1 [cut] ---------- components: Interpreter Core files: core.emerge.4097.gdb.txt messages: 196684 nosy: mmokrejs priority: normal severity: normal status: open title: Illegal instruction at Python-2.7.5/Modules/_sre.c:1173 type: crash versions: Python 2.7 Added file: http://bugs.python.org/file31540/core.emerge.4097.gdb.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Sep 1 07:14:53 2013 From: report at bugs.python.org (Raymond Hettinger) Date: Sun, 01 Sep 2013 05:14:53 +0000 Subject: [New-bugs-announce] [issue18898] Apply the setobject optimizations to dictionaries Message-ID: <1378012493.62.0.577402281969.issue18898@psf.upfronthosting.co.za> New submission from Raymond Hettinger: Once http://bugs.python.org/issue18835 is resolved, I would like to see the various set optimizations applied to dictionaries as well: * Move the key before the hash in the dict struct (the key is accessed more frequently in the code and being in the first struct position allows it to be looked-up without a struct offset). * Don't INCREF and DECREF dummy objects. Only one reference needs to be held. See http://bugs.python.org/issue18797 * Reduce the cost of hash collisions by inspecting nearby dict entries for matches prior to moving on to other probes elsewhere in memory. See http://bugs.python.org/issue18771 * Make the previous improvement more effective by using aligned memory allocations for the dict tables. See http://bugs.python.org/issue18835 Collectively, these optimizations can substantially improve dictionary performance. ---------- components: Interpreter Core messages: 196706 nosy: haypo, pitrou, rhettinger, tim.peters priority: low severity: normal status: open title: Apply the setobject optimizations to dictionaries type: performance versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Sep 1 19:34:51 2013 From: report at bugs.python.org (Stefan Behnel) Date: Sun, 01 Sep 2013 17:34:51 +0000 Subject: [New-bugs-announce] [issue18899] make pystone.py Py3 compatible in benchmark suite Message-ID: <1378056891.98.0.165106942337.issue18899@psf.upfronthosting.co.za> New submission from Stefan Behnel: diff --git a/performance/pystone.py b/performance/pystone.py --- a/performance/pystone.py +++ b/performance/pystone.py @@ -59,9 +59,9 @@ def main(loops=LOOPS): benchtime, stones = pystones(loops) - print "Pystone(%s) time for %d passes = %g" % \ - (__version__, loops, benchtime) - print "This machine benchmarks at %g pystones/second" % stones + print("Pystone(%s) time for %d passes = %g" % + (__version__, loops, benchtime)) + print("This machine benchmarks at %g pystones/second" % stones) def pystones(loops=LOOPS): @@ -72,7 +72,7 @@ Char1Glob = '\0' Char2Glob = '\0' Array1Glob = [0]*51 -Array2Glob = map(lambda x: x[:], [Array1Glob]*51) +Array2Glob = list(map(lambda x: x[:], [Array1Glob]*51)) PtrGlb = None PtrGlbNext = None ---------- components: Benchmarks messages: 196723 nosy: scoder priority: normal severity: normal status: open title: make pystone.py Py3 compatible in benchmark suite type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Sep 1 20:49:28 2013 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 01 Sep 2013 18:49:28 +0000 Subject: [New-bugs-announce] [issue18900] Add the random.distrib module Message-ID: <1378061368.61.0.991913209917.issue18900@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: In some functions in the random module checking input arguments and precomputation takes a considerable portion of time. Here is a sample implementation of new random.distrib module which provides alternative faster interface to generating of random distributed values. It contains generators which generates values with same distributions as functions with same name in the random module. Benchmark results: random distrib random() 0.061 0.055 1.12 randrange(0, 100, 5) 1.494 0.620 2.41 randint(1, 100) 1.283 0.551 2.33 uniform(-10.0, 10.0) 0.332 0.121 2.73 triangular(0.0, 10.0, 6.0) 0.661 0.317 2.09 gauss(5.0, 2.0) 0.707 0.280 2.53 normalvariate(5.0, 2.0) 0.867 0.553 1.57 lognormvariate(5.0, 2.0) 1.078 0.640 1.68 expovariate(0.1,) 0.508 0.293 1.73 vonmisesvariate(1.0, 1.0) 1.201 0.671 1.79 gammavariate(0.35, 1.45) 1.117 0.508 2.20 betavariate(2.71828, 3.14159) 2.868 1.776 1.61 paretovariate(5.0,) 0.493 0.238 2.07 weibullvariate(1.0, 3.0) 0.670 0.402 1.67 choice([0, 1, 2, 3, 4, 5, 6... 0.887 0.594 1.49 Distrib functions are 1.5-2.8 times faster than random functions. Weighted choice() function (see issue18844) can be even dozens times faster (depends on size of the input). In additional some random generators (i.e. gauss()) looks simpler when implemented as generators. distrib.gauss() is twice faster than distrib.normalvariate() (both generates numbers with same distribution) and I think some other generators can be implemented more efficient in generator style. ---------- components: Library (Lib) files: distrib.py messages: 196727 nosy: mark.dickinson, rhettinger, serhiy.storchaka priority: normal severity: normal status: open title: Add the random.distrib module type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file31549/distrib.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Sep 1 21:20:23 2013 From: report at bugs.python.org (Claudiu.Popa) Date: Sun, 01 Sep 2013 19:20:23 +0000 Subject: [New-bugs-announce] [issue18901] sunau.getparams should return a namedtuple Message-ID: <1378063223.81.0.0712073256156.issue18901@psf.upfronthosting.co.za> New submission from Claudiu.Popa: This is similar to what was done for issue17818 and issue17487 and will gain for all the three audio libraries, aifc, wave and sunau a similar API. Patch and tests attached. ---------- components: Library (Lib) files: sunau.patch keywords: patch messages: 196729 nosy: Claudiu.Popa priority: normal severity: normal status: open title: sunau.getparams should return a namedtuple versions: Python 3.4 Added file: http://bugs.python.org/file31551/sunau.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Sep 2 02:03:41 2013 From: report at bugs.python.org (Eli Bendersky) Date: Mon, 02 Sep 2013 00:03:41 +0000 Subject: [New-bugs-announce] [issue18902] Make ET event handling more modular to allow custom targets for the non-blocking parser Message-ID: <1378080221.59.0.577633252217.issue18902@psf.upfronthosting.co.za> New submission from Eli Bendersky: As issue #17741 shows in detail, there's a number of implementation problems in the current ET that make a fully non-blocking parser more difficult to implement than it should be. The main problem is that XMLParser._setevents relies on internal implementation details of the default TreeBuilder to do some of its tasks. This has to be decoupled from implementation details completely. An XMLParser already has a non-blocking input side (feed/close) and a callback "push" API to the target. The API has to be fully expanded to include start-ns/end-ns and any other events that are required to allow custom tree builders as targets. This would make it possible to layer XMLPullParser on top of the stock XMLParser coupled with a special target that collects "events" from the callback calls. ---------- components: Library (Lib) messages: 196758 nosy: eli.bendersky priority: normal severity: normal stage: needs patch status: open title: Make ET event handling more modular to allow custom targets for the non-blocking parser type: behavior versions: Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Sep 2 03:33:35 2013 From: report at bugs.python.org (=?utf-8?q?Westley_Mart=C3=ADnez?=) Date: Mon, 02 Sep 2013 01:33:35 +0000 Subject: [New-bugs-announce] [issue18903] IDLE file-completion is case-sensitive in Windows Message-ID: <1378085615.28.0.091077723559.issue18903@psf.upfronthosting.co.za> New submission from Westley Mart?nez: Hi, I'm not sure if this would be considered a bug or a feature request, but IDLE's file-completion is case-sensitive in Windows (e.g. if I have a file named ABBA and I type in 'abb' + tab, ABBA won't pop up. Since Windows files systems are not case-sensitive, it might make sense for the file-completion to disregard case as well. I'm not sure if this behaviour is preferred, however, so I'll leave that up for discussion. I tested the behaviour on 3.3 and 3.4; I assume it's the same for other versions as well. ---------- components: IDLE, Windows messages: 196765 nosy: anikom15 priority: normal severity: normal status: open title: IDLE file-completion is case-sensitive in Windows type: enhancement versions: Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Sep 2 05:39:34 2013 From: report at bugs.python.org (Vajrasky Kok) Date: Mon, 02 Sep 2013 03:39:34 +0000 Subject: [New-bugs-announce] [issue18904] Unnecessary test in file descriptor inheritance test Message-ID: <1378093174.83.0.0549924253558.issue18904@psf.upfronthosting.co.za> New submission from Vajrasky Kok: In Lib/test/test_os.py in class FDInheritanceTests, we have an unnecessary test, which is test_set_inheritable. What test_set_inheritable tests is already being covered by test_get_inheritable. Also, I think test_get_inheritable should be renamed to test_set_inheritable. Please, see the patch to see what I mean. ---------- components: Tests files: remove_unnecessary_test_fd_inheritable.patch keywords: patch messages: 196768 nosy: haypo, vajrasky priority: normal severity: normal status: open title: Unnecessary test in file descriptor inheritance test versions: Python 3.4 Added file: http://bugs.python.org/file31553/remove_unnecessary_test_fd_inheritable.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Sep 2 18:49:20 2013 From: report at bugs.python.org (Wieland Hoffmann) Date: Mon, 02 Sep 2013 16:49:20 +0000 Subject: [New-bugs-announce] [issue18905] pydoc -p 0 says the server is available at localhost:0 Message-ID: <1378140560.28.0.729434187467.issue18905@psf.upfronthosting.co.za> New submission from Wieland Hoffmann: In Python 3 one can use `pydoc -p 0` to start a pydoc HTTP server on an arbitrary unused port. This works (somewhat) in Python 2 as well, except that pydoc doesn't tell you which port it's listening on. Applying the attached patch makes pydoc print the correct port. ---------- components: Library (Lib) files: pydoc-port.patch keywords: patch messages: 196789 nosy: Wieland.Hoffmann priority: normal severity: normal status: open title: pydoc -p 0 says the server is available at localhost:0 type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file31556/pydoc-port.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Sep 2 19:17:17 2013 From: report at bugs.python.org (Eli Bendersky) Date: Mon, 02 Sep 2013 17:17:17 +0000 Subject: [New-bugs-announce] [issue18906] Create a way to always run tests in subprocesses within regrtest Message-ID: <1378142237.02.0.163660197957.issue18906@psf.upfronthosting.co.za> New submission from Eli Bendersky: There were numerous discussions and issues in the past about the cross-test dependencies that sometimes exist because some tests need to muck with import caches (both on the Python and C level). Some examples: http://mail.python.org/pipermail/python-dev/2013-January/123409.html http://mail.python.org/pipermail/python-dev/2013-August/127766.html Issue #15651 is an example of a hack that has to stay in the code to allow tests to pass. Other things are also difficult - such as simulating situations where some optional modules don't exist (like pyexpat). ---- I suggest to add a capability to regrtest that will allow certain tests to request always being run inside a subprocess. Most of the infrastructure is already in place, since this is what regrtest uses to run with -jN today. An alternative would be to add some test.support utility to help with this, but then test execution would not be uniform between -j1 and -jN and also some things would be difficult to track, such as -R executions (currently all -R runs of a single test have to be within a single process for the refcount tracking to work). ---------- assignee: eli.bendersky components: Tests messages: 196793 nosy: eli.bendersky, ncoghlan, serhiy.storchaka priority: normal severity: normal status: open title: Create a way to always run tests in subprocesses within regrtest versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Sep 2 20:18:51 2013 From: report at bugs.python.org (John Nagle) Date: Mon, 02 Sep 2013 18:18:51 +0000 Subject: [New-bugs-announce] [issue18907] urllib2.open FTP open times out at 20 secs despite timeout parameter Message-ID: <1378145931.18.0.826598432393.issue18907@psf.upfronthosting.co.za> New submission from John Nagle: urllib2.open for an FTP url does not obey the timeout parameter. Attached test program times out on FTP open after 21 seconds, even though the specified timeout is 60 seconds. Timing is consistent; times have ranged from 21.03 to 21.05 seconds. Python documentation (http://docs.python.org/2/library/urllib2.html) says "The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used). This actually only works for HTTP, HTTPS and FTP connections." The documentation for Python 3 reads the same. Open of ftp://ftp.sec.gov/edgar/daily-index failed after 21.05 seconds: This was on Windows 7, but the same result is observed on Linux. (The FTP server at the U.S. Securities and Exchange Commission is now imposing a 20-second connection delay during busy periods. This is causing our Python code that retrieves new SEC filings to fail. It may be necessary to run the program at different times of the day to reproduce the problem.) ---------- components: Library (Lib) files: edgartimeouttest.py messages: 196800 nosy: nagle priority: normal severity: normal status: open title: urllib2.open FTP open times out at 20 secs despite timeout parameter versions: Python 2.7 Added file: http://bugs.python.org/file31558/edgartimeouttest.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Sep 3 00:40:00 2013 From: report at bugs.python.org (Elazar Gershuni) Date: Mon, 02 Sep 2013 22:40:00 +0000 Subject: [New-bugs-announce] [issue18908] Enum docs: sections leak out Message-ID: <1378161600.59.0.237500625913.issue18908@psf.upfronthosting.co.za> New submission from Elazar Gershuni: Inner sections "leak" out from enum to the general datatypes index: http://docs.python.org/3.4/library/datatypes.html (sections 8.14 - 8.17) ---------- assignee: docs at python components: Documentation messages: 196816 nosy: docs at python, elazar priority: normal severity: normal status: open title: Enum docs: sections leak out _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Sep 3 03:25:03 2013 From: report at bugs.python.org (Christoph Gohlke) Date: Tue, 03 Sep 2013 01:25:03 +0000 Subject: [New-bugs-announce] [issue18909] Segfaults on win-amd64 due to corrupt pointer to Tkapp_Interp Message-ID: <1378171503.23.0.926493949821.issue18909@psf.upfronthosting.co.za> New submission from Christoph Gohlke: Using 64 bit CPython 2.6.6, 2.7.5, 3.2.5 or 3.3.2, numpy 1.7.1 and matplotlib 1.3.0 on Windows 8 64 bit, the following script segfaults most of the times: ``` # allocate ~4GB fragmented data import numpy a = [numpy.zeros(2**i, 'uint8') for i in range(1, 31)] b = [numpy.zeros(131072, 'float64') for i in range(2048)] # plot using TkAgg import matplotlib matplotlib.use('TkAgg') from matplotlib import pyplot pyplot.plot() pyplot.show() ``` ``` Fatal Python error: Segmentation fault Current thread 0x00036c5c: File "X:\Python33\lib\site-packages\matplotlib\backends\tkagg.py", line 17 in blit File "X:\Python33\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 349 in draw File "X:\Python33\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 276 in resize File "X:\Python33\lib\tkinter\__init__.py", line 1475 in __call__ File "X:\Python33\lib\tkinter\__init__.py", line 965 in update File "X:\Python33\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 574 in show File "X:\Python33\lib\site-packages\matplotlib\backend_bases.py", line 87 in __call__ File "X:\Python33\lib\site-packages\matplotlib\pyplot.py", line 145 in show File "tk_crash_win-amd64.py", line 14 in ``` The pointer returned by Python's _tkinter.tkapp.interpaddr() is often wrong because the 64 bit pointer is cast to 32 bit long and returned as PyInt. Instead, the pointer should be cast to Py_ssize_t and returned as PyLong on win-amd64. The following patches for win-amd64-py2.7.5 and win-amd64-py3.3.2 fix the issue: ``` --- a/Modules/_tkinter.c Sun Sep 01 19:06:35 2013 -0400 +++ b/Modules/_tkinter.c Mon Sep 02 17:44:53 2013 -0700 @@ -2814,7 +2814,7 @@ if (!PyArg_ParseTuple(args, ":interpaddr")) return NULL; - return PyInt_FromLong((long)Tkapp_Interp(self)); + return PyInt_FromSsize_t((Py_ssize_t)Tkapp_Interp(self)); } ``` ``` --- a/Modules/_tkinter.c Sun Sep 01 19:03:41 2013 -0400 +++ b/Modules/_tkinter.c Mon Sep 02 17:44:02 2013 -0700 @@ -2688,7 +2688,7 @@ if (!PyArg_ParseTuple(args, ":interpaddr")) return NULL; - return PyLong_FromLong((long)Tkapp_Interp(self)); + return PyLong_FromSsize_t((Py_ssize_t)Tkapp_Interp(self)); } ``` Updated _tkinter.pyd files are available at . ---------- messages: 196819 nosy: cgohlke priority: normal severity: normal status: open title: Segfaults on win-amd64 due to corrupt pointer to Tkapp_Interp type: crash versions: Python 2.6, Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Sep 3 03:56:46 2013 From: report at bugs.python.org (Phil Webster) Date: Tue, 03 Sep 2013 01:56:46 +0000 Subject: [New-bugs-announce] [issue18910] IDLE: Unit test for textView.py Message-ID: <1378173406.38.0.908315708817.issue18910@psf.upfronthosting.co.za> New submission from Phil Webster: Started writing the tests for textView.py. ---------- components: IDLE files: test_textview.patch keywords: patch messages: 196820 nosy: JayKrish, Todd.Rovito, philwebster, terry.reedy priority: normal severity: normal status: open title: IDLE: Unit test for textView.py type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file31569/test_textview.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Sep 3 07:36:59 2013 From: report at bugs.python.org (Brian Vanderburg) Date: Tue, 03 Sep 2013 05:36:59 +0000 Subject: [New-bugs-announce] [issue18911] minidom does not encode correctly when calling Document.writexml Message-ID: <1378186619.58.0.930376227557.issue18911@psf.upfronthosting.co.za> New submission from Brian Vanderburg: When I have unicode data to save, it seems that it does not save correctly, giving an encode error. I know this exists on 2.7 and from checking the code in xml/dom/minidom.py it looks like it does in 3.2 as well. The method call that seem to be problematic is doc.writexml(open(filename, "wb"), "", " ", "utf-8") Currently I found this to work: doc.writexml(codecs.open(filename, "w", "utf-8"), "", " ", "utf-8") It seems like this should be handled by the writexml method since it already has the specified encoding. ---------- components: XML messages: 196824 nosy: brianvanderburg2 priority: normal severity: normal status: open title: minidom does not encode correctly when calling Document.writexml type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Sep 3 10:08:26 2013 From: report at bugs.python.org (Jeroen Van Goey) Date: Tue, 03 Sep 2013 08:08:26 +0000 Subject: [New-bugs-announce] [issue18912] Intendation issue in example code in itertools.count documentation Message-ID: <1378195706.84.0.122771342837.issue18912@psf.upfronthosting.co.za> New submission from Jeroen Van Goey: The sample code in the itertools.count documentation should be indented by 4 spaces. For 2.7.4: lines 3429 till 3432 in http://hg.python.org/releasing/2.7.4/file/026ee0057e2d/Modules/itertoolsmodule.c#l3429 For 3.4.0a1: lines 3981 till 3984 in http://hg.python.org/releasing/py3.4.0a1/file/edc668a667ad/Modules/itertoolsmodule.c#l3981 Also, the example code uses the arguments 'firstval' and 'step' whereas the documentation of the function itself uses the arguments 'start' and 'step'. Maybe better be consistent and use as first argument 'start' in both cases? ---------- assignee: docs at python components: Documentation hgrepos: 207 messages: 196826 nosy: docs at python, jeroen-vangoey priority: normal severity: normal status: open title: Intendation issue in example code in itertools.count documentation type: enhancement versions: Python 2.7, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Sep 3 13:46:41 2013 From: report at bugs.python.org (=?utf-8?q?Mat=C4=9Bj_Stuchl=C3=ADk?=) Date: Tue, 03 Sep 2013 11:46:41 +0000 Subject: [New-bugs-announce] [issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6 Message-ID: <1378208801.81.0.941164435803.issue18913@psf.upfronthosting.co.za> New submission from Mat?j Stuchl?k: Doing 'valgrind --suppressions=Misc/valgrind-python.supp ./python Lib/tests/test_ssl.py' I'm getting: ==322== LEAK SUMMARY: ==322== definitely lost: 32 bytes in 1 blocks ==322== indirectly lost: 392 bytes in 16 blocks ==322== possibly lost: 1,617,191 bytes in 1,052 blocks ==322== still reachable: 4,068,239 bytes in 3,201 blocks ==322== suppressed: 0 bytes in 0 blocks I managed to reduce that to a shorter reproducer: """ import os import ssl NULLBYTECERT = os.path.join(os.path.dirname(__file__) or os.curdir, "nullbytecert.pem") p = ssl._ssl._test_decode_cert(NULLBYTECERT) """ where NULLBYTECERT is the cert introduced in issue18709. Python 2.7 does not leak like this, and the PySSL_test_decode_certificate function looks the same there as in Python 2.6, so I assume it's something else that does the actual leaking. ---------- components: Extension Modules messages: 196837 nosy: sYnfo priority: normal severity: normal status: open title: ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6 type: resource usage versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Sep 3 19:30:20 2013 From: report at bugs.python.org (Brian Mingus) Date: Tue, 03 Sep 2013 17:30:20 +0000 Subject: [New-bugs-announce] [issue18914] Python docs link to terrible outsi Message-ID: <1378229420.77.0.30621022035.issue18914@psf.upfronthosting.co.za> New submission from Brian Mingus: The python documentation links to an outside website for info and examples on http basic auth. This documentation is terrible and confusing. The link should be removed, and user's should be advised to use the Requests library. # this example is from http://www.voidspace.org.uk/python/articles/authentication.shtml # which is linked to by the official python docs http://docs.python.org/2/howto/urllib2.html import urllib2 theurl = 'http://www.someserver.com/toplevelurl/somepage.htm' username = 'johnny' password = 'XXXXXX' # a great password passman = urllib2.HTTPPasswordMgrWithDefaultRealm() # this creates a password manager passman.add_password(None, theurl, username, password) # because we have put None at the start it will always # use this username/password combination for urls # for which `theurl` is a super-url authhandler = urllib2.HTTPBasicAuthHandler(passman) # create the AuthHandler opener = urllib2.build_opener(authhandler) urllib2.install_opener(opener) # All calls to urllib2.urlopen will now use our handler # Make sure not to include the protocol in with the URL, or # HTTPPasswordMgrWithDefaultRealm will be very confused. # You must (of course) use it when fetching the page though. pagehandle = urllib2.urlopen(theurl) # authentication is now handled automatically for us ---------- assignee: docs at python components: Documentation messages: 196854 nosy: docs at python, mingus priority: normal severity: normal status: open title: Python docs link to terrible outsi versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 01:15:19 2013 From: report at bugs.python.org (mpb) Date: Tue, 03 Sep 2013 23:15:19 +0000 Subject: [New-bugs-announce] [issue18915] ssl.wrap_socket, pass in certfile and keyfile as PEM strings Message-ID: <1378250119.17.0.25988823326.issue18915@psf.upfronthosting.co.za> New submission from mpb: It would be nice to be able to pass ssl.wrap_socket the key and certificate as PEM encoded strings, rather than as paths to files. Similarly for SSLContext.load_cert_chain. ---------- components: Library (Lib) messages: 196878 nosy: mpb priority: normal severity: normal status: open title: ssl.wrap_socket, pass in certfile and keyfile as PEM strings type: enhancement versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 02:39:05 2013 From: report at bugs.python.org (Tim Peters) Date: Wed, 04 Sep 2013 00:39:05 +0000 Subject: [New-bugs-announce] [issue18916] Various out-of-date Lock text in 3.2+ Message-ID: <1378255145.39.0.17069692986.issue18916@psf.upfronthosting.co.za> New submission from Tim Peters: Here under 3.3.2: """ >>> from threading import Lock >>> help(Lock) Help on built-in function allocate_lock in module _thread: allocate_lock(...) allocate_lock() -> lock object (allocate() is an obsolete synonym) Create a new lock object. See help(LockType) for information about locks. """ But there is no relevant LockType anymore. The type is now: """ >>> type(Lock()) """ The docs should probably say "help(type(Lock())" instead of "help(LockType)" now. So let's try that: """ >>> help(type(Lock())) Help on class lock in module _thread: class lock(builtins.object) | A lock object is a synchronization primitive. To create a lock, | call the PyThread_allocate_lock() function. """ That's a problem: PyThread_allocate_lock() is a C function, not available (under that name) to Python code. A Python user should probably stick to threading.Lock(). Skipping most other output: """ ... | acquire(...) | acquire([wait]) -> bool | (acquire_lock() is an obsolete synonym) | | Lock the lock. Without argument, this blocks if the lock is already | locked (even by the same thread), waiting for another thread to release | the lock, and return True once the lock is acquired. | With an argument, this will only block if the argument is true, | and the return value reflects whether the lock is acquired. | The blocking operation is interruptible. ... """ That's not the right signature for acquire anymore. Should be acquire(blocking=True, timeout=-1) which is what the threading module docs say. That is, the docs are up-to-date, but the help strings in the code aren't. Since 3.2 is the first version introducing the timeout option, that's the earliest version I selected on this report. I'm going to leave this for someone who wants an easy patch exercise - you're welcome ;-) ---------- components: Interpreter Core keywords: easy messages: 196881 nosy: tim.peters priority: low severity: normal stage: needs patch status: open title: Various out-of-date Lock text in 3.2+ type: behavior versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 05:59:43 2013 From: report at bugs.python.org (Nick) Date: Wed, 04 Sep 2013 03:59:43 +0000 Subject: [New-bugs-announce] [issue18917] python won't display greek characters in apache under windows Message-ID: <1378267183.66.0.904044097978.issue18917@psf.upfronthosting.co.za> New submission from Nick: I've set up apache on Windows 7 and I'm running python with cgi. I have a script that contains this: #!C:\Python34\python.exe print ("Content-Type: text/html; charset=utf-8\n") print ("??????") Pretty simple, right? When I'm opening the page to my browser in stead of "??????" I get weird ??? symbols (when the browser is set on UTF-8) If I set my browser to ISO-8859-7 I will get the normal greek letters. "sys.stdout.encoding" will display "cp1253" instead of "utf-8" as it probably should. scripts with only english characters will work totally fine. the problems seems to be on non-english characters. it displays them as ISO-8859-7. this doesn't seem to be an apache or windows issue as PHP and Lua will run just fine and all the scripts will display greek characters in my browser. the problem occurs only with python. ---------- messages: 196886 nosy: nickl1 priority: normal severity: normal status: open title: python won't display greek characters in apache under windows type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 06:40:20 2013 From: report at bugs.python.org (bussau) Date: Wed, 04 Sep 2013 04:40:20 +0000 Subject: [New-bugs-announce] [issue18918] help('FILES') finds no documentation Message-ID: <1378269620.52.0.763555902483.issue18918@psf.upfronthosting.co.za> New submission from bussau: Calling for help() about the topic 'FILES' returns no documentation found for 'FILES' ------------------------------ Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> help('topics') Here is a list of available topics. Enter any topic name to get more help. ASSERTION DEBUGGING LITERALS SEQUENCEMETHODS2 ASSIGNMENT DELETION LOOPING SEQUENCES ATTRIBUTEMETHODS DICTIONARIES MAPPINGMETHODS SHIFTING ATTRIBUTES DICTIONARYLITERALS MAPPINGS SLICINGS AUGMENTEDASSIGNMENT DYNAMICFEATURES METHODS SPECIALATTRIBUTES BACKQUOTES ELLIPSIS MODULES SPECIALIDENTIFIERS BASICMETHODS EXCEPTIONS NAMESPACES SPECIALMETHODS BINARY EXECUTION NONE STRINGMETHODS BITWISE EXPRESSIONS NUMBERMETHODS STRINGS BOOLEAN FILES NUMBERS SUBSCRIPTS CALLABLEMETHODS FLOAT OBJECTS TRACEBACKS CALLS FORMATTING OPERATORS TRUTHVALUE CLASSES FRAMEOBJECTS PACKAGES TUPLELITERALS CODEOBJECTS FRAMES POWER TUPLES COERCIONS FUNCTIONS PRECEDENCE TYPEOBJECTS COMPARISON IDENTIFIERS PRINTING TYPES COMPLEX IMPORTING PRIVATENAMES UNARY CONDITIONAL INTEGER RETURNING UNICODE CONTEXTMANAGERS LISTLITERALS SCOPING CONVERSIONS LISTS SEQUENCEMETHODS1 >>> help('FILES') no documentation found for 'FILES' -------------------------------------------------------- best regards stephan ---------- assignee: docs at python components: Documentation, Interpreter Core messages: 196888 nosy: docs at python, st.sempert at gmail.com priority: normal severity: normal status: open title: help('FILES') finds no documentation type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 13:11:50 2013 From: report at bugs.python.org (Serhiy Storchaka) Date: Wed, 04 Sep 2013 11:11:50 +0000 Subject: [New-bugs-announce] [issue18919] Unify audio modules tests Message-ID: <1378293110.61.0.780572869606.issue18919@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Three audio modules, aifc, sunau and wave, have similar interfaces and poor tests. The proposed patch introduces new file Lib/test/audiotests.py with common audio tests. New testing exposes some bugs and discrepancy between different audio modules. For example aifc uses bytes for compression type and name, while sunau and wave use strings (issue8934). aifc closes underlied file object on close(), while sunau and wave don't. wave rounds a framerate, while aifc and sunau truncate it. Different modules have different behaviors when process framedata with length which is not divisible by frame size. ---------- assignee: serhiy.storchaka components: Tests files: audiotests.patch keywords: patch messages: 196900 nosy: Claudiu.Popa, r.david.murray, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Unify audio modules tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file31584/audiotests.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 14:30:47 2013 From: report at bugs.python.org (Wolfgang Maier) Date: Wed, 04 Sep 2013 12:30:47 +0000 Subject: [New-bugs-announce] [issue18920] argparse module version action Message-ID: <1378297847.46.0.268237187871.issue18920@psf.upfronthosting.co.za> New submission from Wolfgang Maier: Hi, I just noticed that version output generated via the **'version' action** of the **argparse** module is routed to stderr. I'd expect regular output to go to stdout instead. The current behavior also seems inconsistent to me because --help prints to stdout. Best, Wolfgang ---------- messages: 196905 nosy: wolma priority: normal severity: normal status: open title: argparse module version action type: behavior versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 16:27:30 2013 From: report at bugs.python.org (Steven Murdoch) Date: Wed, 04 Sep 2013 14:27:30 +0000 Subject: [New-bugs-announce] [issue18921] In imaplib, cached capabilities may be out of date after login Message-ID: <1378304850.85.0.68028293284.issue18921@psf.upfronthosting.co.za> New submission from Steven Murdoch: When an IMAP server is behind a proxy, the proxy's capabilities may differ from that of the actual IMAP server. However, in Python imaplib, the client will ignore any updates to available capabilities in the response to the LOGIN command (see rfc3501, section 6.2.3). As a result, imaplib will incorrectly assume that certain features are not available (including the IDLE patch in issue 11245, and as implemented in getmail 4.43.0). imaplib should refresh its capability list either based on the result of the login command or by explicitly sending a CAPABILITY command following login. ---------- components: Library (Lib) messages: 196920 nosy: sjmurdoch priority: normal severity: normal status: open title: In imaplib, cached capabilities may be out of date after login type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 16:49:28 2013 From: report at bugs.python.org (Serhiy Storchaka) Date: Wed, 04 Sep 2013 14:49:28 +0000 Subject: [New-bugs-announce] [issue18922] Output versions of scripts to stdout Message-ID: <1378306168.12.0.839885180116.issue18922@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The Lib/smtpd.py and Tools/i18n/msgfmt.py scripts write their version strings to stderr. It should be changed to stdout for consistency with most common practice. See also issue18338 and issue18920. ---------- components: Demos and Tools, Library (Lib) keywords: easy messages: 196922 nosy: serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: Output versions of scripts to stdout type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 20:41:35 2013 From: report at bugs.python.org (STINNER Victor) Date: Wed, 04 Sep 2013 18:41:35 +0000 Subject: [New-bugs-announce] [issue18923] Use the new selectors module in the subprocess module Message-ID: <1378320095.08.0.301150241372.issue18923@psf.upfronthosting.co.za> New submission from STINNER Victor: Python 3.4 has a new selectors module (issue #16853). It would be nice to use it instead of select.poll or select.select in the subprocess module. ---------- messages: 196936 nosy: haypo priority: normal severity: normal status: open title: Use the new selectors module in the subprocess module type: enhancement versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 21:47:27 2013 From: report at bugs.python.org (Ethan Furman) Date: Wed, 04 Sep 2013 19:47:27 +0000 Subject: [New-bugs-announce] [issue18924] Enum members are easily replaced Message-ID: <1378324047.44.0.111510450424.issue18924@psf.upfronthosting.co.za> New submission from Ethan Furman: Python 3.4.0a1+ (default:33727fbb4668+, Aug 31 2013, 12:34:55) [GCC 4.7.3] on linux Type "help", "copyright", "credits" or "license" for more information. --> import enum --> class Test(enum.Enum): ... this = 'that' ... --> Test.this --> Test.this = 9 --> Test.this 9 I'm pretty sure we don't want that. ---------- assignee: ethan.furman messages: 196945 nosy: barry, eli.bendersky, ethan.furman priority: normal severity: normal status: open title: Enum members are easily replaced type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 22:53:57 2013 From: report at bugs.python.org (Giampaolo Rodola') Date: Wed, 04 Sep 2013 20:53:57 +0000 Subject: [New-bugs-announce] [issue18925] select.poll.modify is not documented Message-ID: <1378328037.99.0.424927131422.issue18925@psf.upfronthosting.co.za> New submission from Giampaolo Rodola': It was introduced in Python 2.6: http://bugs.python.org/issue1657 Will commit a patch soon. ---------- assignee: docs at python components: Documentation messages: 196953 nosy: docs at python, giampaolo.rodola priority: normal severity: normal status: open title: select.poll.modify is not documented versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 23:51:08 2013 From: report at bugs.python.org (Raymond Piller) Date: Wed, 04 Sep 2013 21:51:08 +0000 Subject: [New-bugs-announce] [issue18926] plistlib - str converted to bool Message-ID: <1378331468.16.0.119656145942.issue18926@psf.upfronthosting.co.za> New submission from Raymond Piller: A plist with: My key False will parse to a dict as: {'My key': False} Expected: {'My key': 'False'} If bool(False) is needed, the plist should say: My key ---------- messages: 196959 nosy: VertigoRay priority: normal severity: normal status: open title: plistlib - str converted to bool versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Sep 4 23:54:08 2013 From: report at bugs.python.org (Tim Peters) Date: Wed, 04 Sep 2013 21:54:08 +0000 Subject: [New-bugs-announce] [issue18927] Lock.acquire() docs incorrect about negative timeout Message-ID: <1378331648.69.0.879815072803.issue18927@psf.upfronthosting.co.za> New submission from Tim Peters: Here from the 3.3.2 docs for threading.Lock: """ acquire(blocking=True, timeout=-1) Acquire a lock, blocking or non-blocking. ... When invoked with the floating-point timeout argument set to a positive value, block for at most the number of seconds specified by timeout and as long as the lock cannot be acquired. A negative timeout argument specifies an unbounded wait. ... """ However, that's not what the code does for a negative timeout: >>> from threading import Lock >>> x = Lock() >>> x.acquire(1, -0.2) Traceback (most recent call last): File "", line 1, in ValueError: timeout value must be strictly positive The only negative value the code allows is -1, in lock_PyThread_acquire_lock(): if (timeout < 0 && timeout != -1) { PyErr_SetString(PyExc_ValueError, "timeout value must be " "strictly positive"); return NULL; } The docs should change to say that -1 is special ;-) ---------- assignee: docs at python components: Documentation keywords: easy messages: 196960 nosy: docs at python, tim.peters priority: normal severity: normal status: open title: Lock.acquire() docs incorrect about negative timeout type: behavior versions: Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 02:18:34 2013 From: report at bugs.python.org (David Benbennick) Date: Thu, 05 Sep 2013 00:18:34 +0000 Subject: [New-bugs-announce] [issue18928] Remove misleading documentation for random.shuffle Message-ID: <1378340314.25.0.0317280223826.issue18928@psf.upfronthosting.co.za> New submission from David Benbennick: Since Python 2.1 [1], when random.shuffle was added, the documentation has said: """Note that for even rather small len(x), the total number of permutations of x is larger than the period of most random number generators; this implies that most permutations of a long sequence can never be generated.""" This comment is incorrect and misleading. In fact, I claim that shuffle can produce "all" permutations for any representable sequence. To shuffle a sequence of length N requires log(N!) ~ N * log(N/e) bits of randomness [2]. The random module provides a generator with "a period of 2**19937-1", meaning you can get 2**19937 bits of randomness out of it before it starts repeating. All of which is to say that any representable sequence, say N < 2**50, will need no more than 2**60 bits of randomness to shuffle. That is well within the period of the random number generator. Attached is a patch that deletes the comment. An illustration of this misconception is at [3]. 1: http://docs.python.org/release/2.1/lib/module-random.html 2: https://en.wikipedia.org/wiki/Factorial#Rate_of_growth_and_approximations_for_large_n 3: http://stackoverflow.com/questions/3062741/maximal-length-of-list-to-shuffle-with-python-random-shuffle ---------- assignee: docs at python components: Documentation files: mywork.patch keywords: patch messages: 196971 nosy: dbenbenn, docs at python priority: normal severity: normal status: open title: Remove misleading documentation for random.shuffle Added file: http://bugs.python.org/file31593/mywork.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 04:51:02 2013 From: report at bugs.python.org (Ethan Furman) Date: Thu, 05 Sep 2013 02:51:02 +0000 Subject: [New-bugs-announce] [issue18929] inspect.classify_class_attrs ignores metaclass Message-ID: <1378349462.72.0.930877473496.issue18929@psf.upfronthosting.co.za> New submission from Ethan Furman: Part of the solution for Issue18693 is to have `inspect.classify_class_attrs()` properly consider the metaclass (or type) of the class when searching for the origination point of class attributes. The fix is changing line 325: - for base in (cls,) + mro: + for base in (cls,) + mro + (type(cls),): or line 361: - return cls.__mro__ + return cls.__mro__ + (type(cls), ) Should we target previous Pythons with this fix? ---------- messages: 196973 nosy: eli.bendersky, ethan.furman priority: normal severity: normal status: open title: inspect.classify_class_attrs ignores metaclass type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 12:52:34 2013 From: report at bugs.python.org (Stefan Schukat) Date: Thu, 05 Sep 2013 10:52:34 +0000 Subject: [New-bugs-announce] [issue18930] os.spawnXX functions terminates process if second argument is empty list Message-ID: <1378378354.78.0.544374922966.issue18930@psf.upfronthosting.co.za> New submission from Stefan Schukat: If os.spawnv or os.spawnve is called with an empty second argument the process terminates in release builds under Windows. This is simple to reproduce: >>> import os >>> nPath = os.path.join(os.environ["windir"], "notepad.exe") >>> os.spawnv(os.P_NOWAIT, nPath, []) # or os.spawnv(os.P_NOWAIT, nPath, [], {}) This has the same cause as the bug reported for execv http://bugs.python.org/issue1039 and could be fixed in the same way. ---------- components: Interpreter Core messages: 196988 nosy: SSchukat priority: normal severity: normal status: open title: os.spawnXX functions terminates process if second argument is empty list versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 12:58:35 2013 From: report at bugs.python.org (Giampaolo Rodola') Date: Thu, 05 Sep 2013 10:58:35 +0000 Subject: [New-bugs-announce] [issue18931] new selectors module should support devpoll on Solaris Message-ID: <1378378715.64.0.328227872693.issue18931@psf.upfronthosting.co.za> New submission from Giampaolo Rodola': This is a follow up of issue 16853. I will try to see whether I can come up with a patch later today. ---------- messages: 196989 nosy: christian.heimes, felipecruz, giampaolo.rodola, gvanrossum, haypo, meador.inge, neologix, pitrou, python-dev, rosslagerwall, sbt priority: normal severity: normal status: open title: new selectors module should support devpoll on Solaris versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 13:01:54 2013 From: report at bugs.python.org (Giampaolo Rodola') Date: Thu, 05 Sep 2013 11:01:54 +0000 Subject: [New-bugs-announce] [issue18932] selectors and modify() Message-ID: <1378378914.54.0.524373723237.issue18932@psf.upfronthosting.co.za> New submission from Giampaolo Rodola': This is a follow up of issue 16853 (see comment http://bugs.python.org/issue16853#msg196984). ---------- messages: 196990 nosy: christian.heimes, felipecruz, giampaolo.rodola, gvanrossum, haypo, meador.inge, neologix, pitrou, python-dev, rosslagerwall, sbt priority: normal severity: normal status: open title: selectors and modify() versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 16:10:06 2013 From: report at bugs.python.org (Jonathan Frere) Date: Thu, 05 Sep 2013 14:10:06 +0000 Subject: [New-bugs-announce] [issue18933] Add link to source code in logging documentation Message-ID: <1378390206.88.0.825858805448.issue18933@psf.upfronthosting.co.za> New submission from Jonathan Frere: The logging module documentation is probably best accompanied by the source that it is meant to be documenting. Could a link to either the package directory (http://hg.python.org/cpython/file/2.7/Lib/logging/) or the __init__.py file in that directory (http://hg.python.org/cpython/file/2.7/Lib/logging/__init__.py), I'd argue the __init__.py file. ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 197000 nosy: Johz, docs at python, vinay.sajip priority: normal severity: normal status: open title: Add link to source code in logging documentation type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 18:46:25 2013 From: report at bugs.python.org (=?utf-8?q?Charles-Fran=C3=A7ois_Natali?=) Date: Thu, 05 Sep 2013 16:46:25 +0000 Subject: [New-bugs-announce] [issue18934] multiprocessing: use selectors module Message-ID: <1378399585.11.0.596283488282.issue18934@psf.upfronthosting.co.za> New submission from Charles-Fran?ois Natali: Here's a patch. ---------- components: Library (Lib) files: selectors_multiprocessing.diff keywords: needs review, patch messages: 197012 nosy: neologix, sbt priority: normal severity: normal stage: patch review status: open title: multiprocessing: use selectors module type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file31616/selectors_multiprocessing.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 18:59:58 2013 From: report at bugs.python.org (=?utf-8?q?Charles-Fran=C3=A7ois_Natali?=) Date: Thu, 05 Sep 2013 16:59:58 +0000 Subject: [New-bugs-announce] [issue18935] test_regrtest.test_timeout failure Message-ID: <1378400398.96.0.0580722992203.issue18935@psf.upfronthosting.co.za> New submission from Charles-Fran?ois Natali: http://buildbot.python.org/all/builders/AMD64 Fedora without threads 3.x/builds/5074/steps/test/logs/stdio """ ====================================================================== FAIL: test_timeout (test.test_regrtest.ParseArgsTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.krah-fedora/build/Lib/test/test_regrtest.py", line 30, in test_timeout self.assertEqual(ns.timeout, 4.2) AssertionError: None != 4.2 """ That's because the "--timeout" isn't supported if Python is built --without-threads. Possible patch attached. ---------- components: Tests files: test_timeout.diff keywords: needs review, patch messages: 197013 nosy: haypo, neologix, pitrou priority: normal severity: normal stage: patch review status: open title: test_regrtest.test_timeout failure type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file31617/test_timeout.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 22:03:08 2013 From: report at bugs.python.org (Jason R. Coombs) Date: Thu, 05 Sep 2013 20:03:08 +0000 Subject: [New-bugs-announce] [issue18936] getopt chokes on unicode option names Message-ID: <1378411388.86.0.748005801735.issue18936@psf.upfronthosting.co.za> New submission from Jason R. Coombs: Today I encountered a bug where I was using a Distutils.Command subclass, which uses getopt for option parsing. The implementation is here: https://bitbucket.org/jaraco/jaraco.packaging/src/2.2/jaraco/packaging/depends.py?at=default Around line 59, the options are defined, but because the syntax is Python 3 style with unicode literals, under Python 2.7, those get created as unicode objects. When I invoke that Command under Python 2.7, I get this error: Traceback (most recent call last): File "setup.py", line 160, in setup(**setup_params) File "/usr/lib/python2.7/distutils/core.py", line 138, in setup ok = dist.parse_command_line() File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 250, in parse_command_line File "/usr/lib/python2.7/distutils/dist.py", line 467, in parse_command_line args = self._parse_command_opts(parser, args) File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 533, in _parse_command_opts File "/usr/lib/python2.7/distutils/dist.py", line 564, in _parse_command_opts (args, opts) = parser.getopt(args[1:]) File "/usr/lib/python2.7/distutils/fancy_getopt.py", line 253, in getopt self._grok_option_table() File "/usr/lib/python2.7/distutils/fancy_getopt.py", line 171, in _grok_option_table "must be a string of length >= 2") % long distutils.errors.DistutilsGetoptError: invalid long option 'requirement=': must be a string of length >= 2 That error is raised because 'requirement=' is a Unicode, but the test in fancy_getopt is isinstance(opt, str). I can work around the issue by wrapping all of the options in str() calls, which leaves them unchanged on Python 3 and downcasts them to strings on Python 2, but that's not pretty. I suggest that fancy_getopt should either include 'unicode' in the isinstance test or (if unicode values really aren't supported), encode unicode values first. ---------- components: Library (Lib) messages: 197020 nosy: jason.coombs priority: low severity: normal status: open title: getopt chokes on unicode option names versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 22:26:01 2013 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 05 Sep 2013 20:26:01 +0000 Subject: [New-bugs-announce] [issue18937] add unittest assertion for logging Message-ID: <1378412761.53.0.263834884699.issue18937@psf.upfronthosting.co.za> New submission from Antoine Pitrou: It is sometimes useful to check for the log messages emitted by some piece of code (especially a library). Would it be a good idea to add a dedicated assertion method for that? I would propose the following API: with self.assertLogging("logger.name", level="WARN") as cm: ... The `cm` context manager could give access to all the log records and formatted output lines for the given logger name (and children) and at least the given logging level. I have something like that here, except not with a dedicated assertion method: https://bitbucket.org/optiflowsrd/obelus/src/c2a2f78068123264adde8cc3ece4889c61773f00/obelus/test/__init__.py?at=default#cl-20 ---------- components: Library (Lib) messages: 197022 nosy: ezio.melotti, michael.foord, pitrou, vinay.sajip priority: normal severity: normal status: open title: add unittest assertion for logging type: enhancement versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Sep 5 23:11:25 2013 From: report at bugs.python.org (Johnny Boy) Date: Thu, 05 Sep 2013 21:11:25 +0000 Subject: [New-bugs-announce] [issue18938] Prepend Is Not A Word Message-ID: <1378415485.5.0.896501812591.issue18938@psf.upfronthosting.co.za> New submission from Johnny Boy: If you do a custom install on Windows and click "Add python.exe to Path" the text below says "Prepend c:\Python33\ to the system Path variable" Prepend is not a word! The word you are looking for is Prefix. http://encyclopedia2.thefreedictionary.com/prepend " Although it sounds correct, prepend is not an English word. It was created to sound like the opposite of "append," which means to add to the end. The correct English word is "prefix;" " ---------- components: Installation messages: 197025 nosy: opticyclic priority: normal severity: normal status: open title: Prepend Is Not A Word versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 6 00:02:40 2013 From: report at bugs.python.org (Graham Wideman) Date: Thu, 05 Sep 2013 22:02:40 +0000 Subject: [New-bugs-announce] [issue18939] Venv docs regarding original python install Message-ID: <1378418560.94.0.0370764034466.issue18939@psf.upfronthosting.co.za> New submission from Graham Wideman: http://docs.python.org/dev/library/venv.html More detail needed regarding the original python environment The article explains how to use venv to create a new python installation with independent libraries etc, and a means to activate one or another virtual python environment. However, there are some points regarding the original python environment which are cloudy. (1) After pyvenv, what status does the original python installation have? Does pyvenv turn it into just one of now two or more virtual environments? Or is the original one special? Must it be specifically deactivated in order to activate a (different) virtual environment? (2) The motivation behind venv seems to be to create virtual enviroments that can be substantially or completely separate from the system site directories or from the original python that pyvenv was run from. Yet elsewhere the doc discusses how pyvenv creates a pyvenv.cfg file with a home key pointing back to the originating Python installation, and "sys.base_prefix and sys.base_exec_prefix point to the non-venv Python installation which was used to create the venv."... which suggest that a venv is _not_ independent of its creating Python installation. It would be helpful to provide some context for this seemingly contradictory information. Perhaps there are scenarios with differing degrees of independence, in which these pointers back to the originating Python installation may or may not be relevant? (3) How do you proceed to create virtual environments from scratch when you have no initial python installation, or no python installation of that python version? -- Hope these suggestions help. ---------- assignee: docs at python components: Documentation messages: 197030 nosy: docs at python, gwideman priority: normal severity: normal status: open title: Venv docs regarding original python install type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 6 01:49:27 2013 From: report at bugs.python.org (Joshua Olson) Date: Thu, 05 Sep 2013 23:49:27 +0000 Subject: [New-bugs-announce] [issue18940] TimedRotatingFileHandler fails to doRollover if a logger has delay=True and no logs in that time. Message-ID: <1378424967.99.0.0736879617379.issue18940@psf.upfronthosting.co.za> New submission from Joshua Olson: In TimedRotatingFileHandler if you have a low volume logger than hasn't written to the log within the interval time doRollover will fail because there is no file to rotate. os.rename(self.baseFilename, dfn) should be something like if os.path.exists(self.base_fileName): os.rename(self.baseFilename, dfn I have included a unit test file. This test fails on 2.7.1 and 2.7.3. I have not tried 2.7.5. ---------- components: Library (Lib) files: logging_test.py messages: 197035 nosy: solarmist priority: normal severity: normal status: open title: TimedRotatingFileHandler fails to doRollover if a logger has delay=True and no logs in that time. versions: Python 2.7 Added file: http://bugs.python.org/file31620/logging_test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 6 01:56:08 2013 From: report at bugs.python.org (Joshua Olson) Date: Thu, 05 Sep 2013 23:56:08 +0000 Subject: [New-bugs-announce] [issue18941] RotatingFileHandler and TimedRotatingFileHandler do not respect delay on rollover Message-ID: <1378425368.84.0.428778978895.issue18941@psf.upfronthosting.co.za> New submission from Joshua Olson: For low volume loggers RotatingFileHandler and TimedRotatingFileHandler will create possibly unnecessary files on doRollover, since they don't check the value of delay when opening the new self.stream. self.stream = self._open() should be something like if not self.delay: self.stream = self._open() ---------- messages: 197036 nosy: solarmist priority: normal severity: normal status: open title: RotatingFileHandler and TimedRotatingFileHandler do not respect delay on rollover _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 6 05:46:24 2013 From: report at bugs.python.org (Tim Peters) Date: Fri, 06 Sep 2013 03:46:24 +0000 Subject: [New-bugs-announce] [issue18942] _debugmallocstats() gibberish output on Windows Message-ID: <1378439184.72.0.614374936253.issue18942@psf.upfronthosting.co.za> New submission from Tim Peters: On Windows, _debugmallocstats() output ends with lines like this: 0 free 12-sized PyTupleObjects * zd bytes each = 0 0 free 13-sized PyTupleObjects * zd bytes each = 0 "zd" is senseless. Betting it's due to using a %zd format code, which MS doesn't support (but Python itself supports in other printf-like functions, like PyErr_Format()). I'll track it down and fix it :-) ---------- assignee: tim.peters messages: 197048 nosy: tim.peters priority: normal severity: normal stage: needs patch status: open title: _debugmallocstats() gibberish output on Windows type: behavior versions: Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 6 11:00:02 2013 From: report at bugs.python.org (Armin Rigo) Date: Fri, 06 Sep 2013 09:00:02 +0000 Subject: [New-bugs-announce] [issue18943] argparse: default args in mutually exclusive groups Message-ID: <1378458002.17.0.371205806782.issue18943@psf.upfronthosting.co.za> New submission from Armin Rigo: In argparse, default arguments have a strange behavior that shows up in mutually exclusive groups: specifying explicitly on the command-line an argument, but giving it its default value, is sometimes equivalent to not specifying the argument at all, and sometimes not. See the attached test diff: it contains two apparently equivalent pieces of code, but one passes and one fails. The difference is that, in CPython, int("42") is 42 but int("4200") is not 4200 (in the sense of the operator "is"). The line that uses "is" in this way is this line in argparse.py (line 1783 in 2.7 head): if argument_values is not action.default: ---------- files: test_argparse.diff keywords: patch messages: 197058 nosy: arigo priority: normal severity: normal status: open title: argparse: default args in mutually exclusive groups versions: Python 2.7, Python 3.5 Added file: http://bugs.python.org/file31626/test_argparse.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 6 11:12:51 2013 From: report at bugs.python.org (Armin Rigo) Date: Fri, 06 Sep 2013 09:12:51 +0000 Subject: [New-bugs-announce] [issue18944] Minor mistake in test_set.py Message-ID: <1378458771.78.0.221134021979.issue18944@psf.upfronthosting.co.za> New submission from Armin Rigo: Found a minor mistake in test_set.py. Patch attached. ---------- components: Interpreter Core files: test_set.diff keywords: patch messages: 197060 nosy: arigo priority: normal severity: normal status: open title: Minor mistake in test_set.py versions: Python 3.5 Added file: http://bugs.python.org/file31627/test_set.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 6 11:34:12 2013 From: report at bugs.python.org (Vlad Shcherbina) Date: Fri, 06 Sep 2013 09:34:12 +0000 Subject: [New-bugs-announce] [issue18945] Name collision handling in tempfile is not covered by tests Message-ID: <1378460052.66.0.943377543243.issue18945@psf.upfronthosting.co.za> New submission from Vlad Shcherbina: I intend to add test for (existing dir)-(new file) collision in http://bugs.python.org/issue18849, but file-file, file-dir and dir-dir collisions are yet to be covered. ---------- components: Tests messages: 197062 nosy: vlad priority: normal severity: normal status: open title: Name collision handling in tempfile is not covered by tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Sep 6 18:10:43 2013 From: report at bugs.python.org (James Lu) Date: Fri, 06 Sep 2013 16:10:43 +0000 Subject: [New-bugs-announce] [issue18946] HTMLParser should ignore errors when parsing text in