From report at bugs.python.org Tue Mar 1 04:06:35 2011 From: report at bugs.python.org (Kelsey) Date: Tue, 01 Mar 2011 03:06:35 +0000 Subject: [New-bugs-announce] [issue11357] Add support for PEP 381 -- Mirror Authenticity In-Reply-To: <1298948795.56.0.864012658533.issue11357@psf.upfronthosting.co.za> Message-ID: <1298948795.56.0.864012658533.issue11357@psf.upfronthosting.co.za> New submission from Kelsey : Distutils2 should provide support for verifying a mirrors authenticity as described in PEP 381 -- Mirror Authenticity. ---------- assignee: tarek components: Distutils2 messages: 129736 nosy: alexis, eric.araujo, kelseyhightower, tarek priority: normal severity: normal status: open title: Add support for PEP 381 -- Mirror Authenticity type: feature request versions: 3rd party, Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 1 07:51:43 2011 From: report at bugs.python.org (david) Date: Tue, 01 Mar 2011 06:51:43 +0000 Subject: [New-bugs-announce] [issue11358] Please replace the use of pickle in multiprocessing with json. In-Reply-To: <1298962303.49.0.457457869343.issue11358@psf.upfronthosting.co.za> Message-ID: <1298962303.49.0.457457869343.issue11358@psf.upfronthosting.co.za> New submission from david : Please replace the use of pickle in multiprocessing with json. ---------- messages: 129742 nosy: db priority: normal severity: normal status: open title: Please replace the use of pickle in multiprocessing with json. _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 1 08:02:25 2011 From: report at bugs.python.org (david) Date: Tue, 01 Mar 2011 07:02:25 +0000 Subject: [New-bugs-announce] [issue11359] Please replace the use of pickle in subprocess with json. In-Reply-To: <1298962945.05.0.373214818345.issue11359@psf.upfronthosting.co.za> Message-ID: <1298962945.05.0.373214818345.issue11359@psf.upfronthosting.co.za> New submission from david : Please replace the use of pickle in subprocess with json. ---------- messages: 129744 nosy: db priority: normal severity: normal status: open title: Please replace the use of pickle in subprocess with json. _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 1 13:28:23 2011 From: report at bugs.python.org (Daniel Haertle) Date: Tue, 01 Mar 2011 12:28:23 +0000 Subject: [New-bugs-announce] [issue11360] In documentation of getopt, advertise argparse instead of optparse In-Reply-To: <1298982503.08.0.830578820579.issue11360@psf.upfronthosting.co.za> Message-ID: <1298982503.08.0.830578820579.issue11360@psf.upfronthosting.co.za> New submission from Daniel Haertle : At the beginning of http://docs.python.org/dev/library/getopt.html the line "A more convenient, flexible, and powerful alternative is the optparse module." routes the user to optparse. Since optparse is deprecated in favor of argparse, this line is no more up-to-date. The best is to remove this line completely, since there already is a note routing to argparse. ---------- assignee: docs at python components: Documentation messages: 129753 nosy: Danh, docs at python priority: normal severity: normal status: open title: In documentation of getopt, advertise argparse instead of optparse versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 1 14:30:21 2011 From: report at bugs.python.org (Igor) Date: Tue, 01 Mar 2011 13:30:21 +0000 Subject: [New-bugs-announce] [issue11361] suggestion for os.kill(pid, CTRL_C_EVENT) In-Reply-To: <1298986221.06.0.20392871991.issue11361@psf.upfronthosting.co.za> Message-ID: <1298986221.06.0.20392871991.issue11361@psf.upfronthosting.co.za> New submission from Igor : Hello! I see some 'skip' in test_os.py @unittest.skip("subprocesses aren't inheriting CTRL+C property") def test_CTRL_C_EVENT(self): I think, problem with calling SetConsoleCtrlHandler(NULL,0) in parent process, rather in child. If call SetConsoleCtrlHandler(NULL, 0). Calling SetConsoleCtrlHandler(ctrl_handler, 1) is not enough. Need first call SetConsoleCtrlHandler(NULL, 0). My patch for this test fixture: (may be, not so good, but it works) H:\usr\python27\Lib\test>diff win_console_handler.py win_console_handler.py_orig 26,27d25 < elif sig == signal.SIGINT: < pass 34,35d31 < def ctrl_handler_int(sig, obj): < sys.exit(1) 40d35 < NULL = ctypes.POINTER(ctypes.c_int)() 43,53d37 < # Calling this with NULL and FALSE causes the calling process to < # handle CTRL+C, rather than ignore it. This property isn't inherited < # by subprocesses, if it's created with CREATE_NEW_PROCESS_GROUP flag < SetConsoleCtrlHandler.argtypes = (ctypes.POINTER(ctypes.c_int), wintypes.B OOL) < if not SetConsoleCtrlHandler(NULL, 0): < print("Unable to restore SetConsoleCtrlHandler") < exit(-1) < < signal.signal(signal.SIGINT, ctrl_handler_int) < < SetConsoleCtrlHandler.argtypes = (HandlerRoutine, wintypes.BOOL) 57a42 > And on my machine (win2003 32bit): ... test_CTRL_BREAK_EVENT (__main__.Win32KillTests) ... ok test_CTRL_C_EVENT (__main__.Win32KillTests) ... ok test_kill_int (__main__.Win32KillTests) ... ok test_kill_sigterm (__main__.Win32KillTests) ... ok ---------------------------------------------------------------------- Ran 61 tests in 2.344s OK ---------- components: IO messages: 129761 nosy: iigor priority: normal severity: normal status: open title: suggestion for os.kill(pid,CTRL_C_EVENT) type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 1 19:07:49 2011 From: report at bugs.python.org (Richard Rabbat) Date: Tue, 01 Mar 2011 18:07:49 +0000 Subject: [New-bugs-announce] [issue11362] image/webp missing from mimetypes.py In-Reply-To: <1299002869.89.0.906487136823.issue11362@psf.upfronthosting.co.za> Message-ID: <1299002869.89.0.906487136823.issue11362@psf.upfronthosting.co.za> New submission from Richard Rabbat : image/webp is missing from the mimetypes.py list of valid mimetypes. webp is an open-source image format and uses vp8 as a codec. ---------- components: Library (Lib) messages: 129786 nosy: Richard.Rabbat priority: normal severity: normal status: open title: image/webp missing from mimetypes.py type: feature request versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 1 19:50:02 2011 From: report at bugs.python.org (Sandro Tosi) Date: Tue, 01 Mar 2011 18:50:02 +0000 Subject: [New-bugs-announce] [issue11363] Curses - add missing functions to doc In-Reply-To: <1299005402.55.0.443028099437.issue11363@psf.upfronthosting.co.za> Message-ID: <1299005402.55.0.443028099437.issue11363@psf.upfronthosting.co.za> New submission from Sandro Tosi : Following up http://mail.python.org/pipermail/docs/2011-January/002922.html , I did a check on all the documented functions of curses and those available from the module, and wrote a patch to include in the doc the missing ones (text is mainly brought by manpages). IMHO, it should be backported to the currently maintained versions (but I didn't check what's 2.7 status). ---------- assignee: docs at python components: Documentation files: curses_missing_functs-py3k.patch keywords: patch messages: 129791 nosy: docs at python, sandro.tosi priority: low severity: normal stage: patch review status: open title: Curses - add missing functions to doc versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file20962/curses_missing_functs-py3k.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 1 20:08:18 2011 From: report at bugs.python.org (=?utf-8?q?=C3=89ric_Araujo?=) Date: Tue, 01 Mar 2011 19:08:18 +0000 Subject: [New-bugs-announce] [issue11364] Move from distutils.sysconfig to sysconfig in test_osx_env In-Reply-To: <1299006498.24.0.394079395841.issue11364@psf.upfronthosting.co.za> Message-ID: <1299006498.24.0.394079395841.issue11364@psf.upfronthosting.co.za> New submission from ?ric Araujo : I?m working on removing uses of distutils from the standard library. I found only one remaining use of distutils.sysconfig; changing it to use sysconfig should not change the behavior of the test, but I can?t test, so please review attached patch. ---------- assignee: eric.araujo components: Macintosh, Tests files: remove-distutils.sysconfig-traces.diff keywords: patch messages: 129795 nosy: eric.araujo, tarek priority: normal severity: normal stage: commit review status: open title: Move from distutils.sysconfig to sysconfig in test_osx_env versions: Python 3.3 Added file: http://bugs.python.org/file20963/remove-distutils.sysconfig-traces.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 1 22:40:33 2011 From: report at bugs.python.org (STINNER Victor) Date: Tue, 01 Mar 2011 21:40:33 +0000 Subject: [New-bugs-announce] [issue11365] Integrate Buildroot patches (cross-compilation) In-Reply-To: <1299015633.09.0.58407944374.issue11365@psf.upfronthosting.co.za> Message-ID: <1299015633.09.0.58407944374.issue11365@psf.upfronthosting.co.za> New submission from STINNER Victor : "Buildroot: Making Embedded Linux easy" has patches for Python 2.7 to simplify the cross-compilation of Python: http://git.buildroot.net/buildroot/tree/package/python The maintainer, Thomas Petazzoni, told me that the 12 first patches are the most important. Other patches are to disable some features. ---------- components: Build messages: 129811 nosy: haypo priority: normal severity: normal status: open title: Integrate Buildroot patches (cross-compilation) versions: Python 2.7, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 02:30:22 2011 From: report at bugs.python.org (anatoly techtonik) Date: Wed, 02 Mar 2011 01:30:22 +0000 Subject: [New-bugs-announce] [issue11366] xml.etree.ElementTree.Element: docs should mention immediate subelement In-Reply-To: <1299029422.8.0.159025283655.issue11366@psf.upfronthosting.co.za> Message-ID: <1299029422.8.0.159025283655.issue11366@psf.upfronthosting.co.za> New submission from anatoly techtonik : >From xml.etree.ElementTree.Element docs it is not obvious that find() and fundall() functions all return immediate children of current element. ---------- messages: 129845 nosy: techtonik priority: normal severity: normal status: open title: xml.etree.ElementTree.Element: docs should mention immediate subelement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 02:44:31 2011 From: report at bugs.python.org (anatoly techtonik) Date: Wed, 02 Mar 2011 01:44:31 +0000 Subject: [New-bugs-announce] [issue11367] xml.etree.ElementTree.find(all): docs are wrong In-Reply-To: <1299030271.87.0.648664421014.issue11367@psf.upfronthosting.co.za> Message-ID: <1299030271.87.0.648664421014.issue11367@psf.upfronthosting.co.za> New submission from anatoly techtonik : ElementTree.find(path) docs say: "Finds the first toplevel element with given tag. Same as getroot().find(path). path is the element to look for." That's not true. path can take the form of "//tag" to find any child element with given tag, not strictly top level. ---------- assignee: docs at python components: Documentation messages: 129847 nosy: docs at python, techtonik priority: normal severity: normal status: open title: xml.etree.ElementTree.find(all): docs are wrong versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 02:58:36 2011 From: report at bugs.python.org (anatoly techtonik) Date: Wed, 02 Mar 2011 01:58:36 +0000 Subject: [New-bugs-announce] [issue11368] xml.etree.ElementTree.Element should have a reference to parent In-Reply-To: <1299031116.52.0.175842807219.issue11368@psf.upfronthosting.co.za> Message-ID: <1299031116.52.0.175842807219.issue11368@psf.upfronthosting.co.za> New submission from anatoly techtonik : There is no way to get parent element from xml.etree.ElementTree.Element. This is one of the essential functions for XML support. ---------- components: XML messages: 129848 nosy: techtonik priority: normal severity: normal status: open title: xml.etree.ElementTree.Element should have a reference to parent _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 04:03:36 2011 From: report at bugs.python.org (William Hart) Date: Wed, 02 Mar 2011 03:03:36 +0000 Subject: [New-bugs-announce] [issue11369] Add caching for the isEnabledFor() computation In-Reply-To: <1299035016.51.0.282905880953.issue11369@psf.upfronthosting.co.za> Message-ID: <1299035016.51.0.282905880953.issue11369@psf.upfronthosting.co.za> New submission from William Hart : I recently started using logging extensively in the Coopr software, and I ran into some performance issues when logging was used within frequently used kernels in the code. After profiling, it became clear that the performance of the logging package could be improved by simply caching the value of the Logger.isEnabledFor() method. I've created a draft version of this cachine mechanism based on a snapshot of logging that I took from Python 2.7.1. This is currently hosted in pytuilib.logging, though I'd love to see this migrate into the Python library (see https://software.sandia.gov/trac/pyutilib/browser/pyutilib.logging/trunk/pyutilib/logging). Basically, I did the following: 1. Added a counter to the Manager class (status) that is incremented whenever the manager object has its level set 2. Add a counter to the Logger class (level_status) that represents the value of the manger status when the Logger's cache was last updated 3. Rework the isEnabledFor() method to update the cache if the logger status is older than the manager status. I moved the present isEnabledFor logic into the _isEnabledFor() method for simplicity. The attached file shows the diffs. Note that there were a few other diffs due to an effort to make pyutilib.logging work on Python 2.5-2.7. --Bill ---------- components: Library (Lib) files: logging__init__diffs.txt messages: 129851 nosy: William.Hart priority: normal severity: normal status: open title: Add caching for the isEnabledFor() computation versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file20967/logging__init__diffs.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 11:08:25 2011 From: report at bugs.python.org (John Szakmeister) Date: Wed, 02 Mar 2011 10:08:25 +0000 Subject: [New-bugs-announce] [issue11370] Fix distutils to carry configure's LIBS through to extension modules. In-Reply-To: <1299060505.33.0.495928925765.issue11370@psf.upfronthosting.co.za> Message-ID: <1299060505.33.0.495928925765.issue11370@psf.upfronthosting.co.za> New submission from John Szakmeister : This is a port of r301 from unladen swallow to the py3k-jit branch. On the Mac, there was an extra '-framework CoreFoundation' that was being passed in python3 (maybe it wasn't there in Python 2.x?). At any rate, I changed the logic to ignore anything that didn't start with a "-l" or end with a ".a". Not sure if that's the best answer, or if we should allow -framework and friends to pass through. I put this under distutils, but it's really targeted towards the py3k-jit branch... which hasn't been updated since June. :-( ---------- assignee: tarek components: Distutils files: libs-to-extension.patch keywords: patch messages: 129863 nosy: eric.araujo, jszakmeister, tarek priority: normal severity: normal status: open title: Fix distutils to carry configure's LIBS through to extension modules. type: feature request Added file: http://bugs.python.org/file20971/libs-to-extension.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 11:31:46 2011 From: report at bugs.python.org (=?utf-8?q?Filip_Gruszczy=C5=84ski?=) Date: Wed, 02 Mar 2011 10:31:46 +0000 Subject: [New-bugs-announce] [issue11371] Localization of error messages in getopt In-Reply-To: <1299061906.55.0.616256394732.issue11371@psf.upfronthosting.co.za> Message-ID: <1299061906.55.0.616256394732.issue11371@psf.upfronthosting.co.za> New submission from Filip Gruszczy?ski : In http://bugs.python.org/issue8841 Eric asked to open a new ticket about localisation of getopt error messages. I attach a patch. ---------- files: 8841.patch keywords: patch messages: 129865 nosy: eric.araujo, gruszczy priority: normal severity: normal status: open title: Localization of error messages in getopt type: feature request Added file: http://bugs.python.org/file20972/8841.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 12:32:03 2011 From: report at bugs.python.org (Ross Lagerwall) Date: Wed, 02 Mar 2011 11:32:03 +0000 Subject: [New-bugs-announce] [issue11372] Remove xrange from argparse docs In-Reply-To: <1299065523.43.0.68544574367.issue11372@psf.upfronthosting.co.za> Message-ID: <1299065523.43.0.68544574367.issue11372@psf.upfronthosting.co.za> New submission from Ross Lagerwall : As the title says, this patch replaces xrange with range for the 3.3 docs. ---------- assignee: docs at python components: Documentation files: doc.patch keywords: patch messages: 129876 nosy: docs at python, rosslagerwall priority: normal severity: normal status: open title: Remove xrange from argparse docs versions: Python 3.3 Added file: http://bugs.python.org/file20974/doc.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 13:44:28 2011 From: report at bugs.python.org (=?utf-8?q?Bo=C5=A1tjan_Mejak?=) Date: Wed, 02 Mar 2011 12:44:28 +0000 Subject: [New-bugs-announce] [issue11373] Fix 2 new typos in the docs In-Reply-To: <1299069868.83.0.520444195077.issue11373@psf.upfronthosting.co.za> Message-ID: <1299069868.83.0.520444195077.issue11373@psf.upfronthosting.co.za> New submission from Bo?tjan Mejak : Try to fix this in every Python documentation that you can. The typo was found here: http://docs.python.org/library/stdtypes.html#memoryview "Create a memoryview that references obj. obj must support the buffer protocol. Builtin objects that /.../." Fix this to "Create a memoryview that references obj, which must support the buffer protocol. Built-in objects that /.../." Thank you. ---------- assignee: docs at python components: Documentation messages: 129886 nosy: Retro, docs at python priority: normal severity: normal status: open title: Fix 2 new typos in the docs versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 15:31:08 2011 From: report at bugs.python.org (Alexandre Badez) Date: Wed, 02 Mar 2011 14:31:08 +0000 Subject: [New-bugs-announce] [issue11374] pkgutil.extend_path do not recognize py{c, o} file In-Reply-To: <1299076268.23.0.272938075364.issue11374@psf.upfronthosting.co.za> Message-ID: <1299076268.23.0.272938075364.issue11374@psf.upfronthosting.co.za> New submission from Alexandre Badez : extend_path only test if "init.py" files exist, but it should also test "init.pyc" and/or "init.pyo". ---------- components: Library (Lib) messages: 129896 nosy: Alexandre.Badez priority: normal severity: normal status: open title: pkgutil.extend_path do not recognize py{c,o} file versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 15:51:48 2011 From: report at bugs.python.org (OJW) Date: Wed, 02 Mar 2011 14:51:48 +0000 Subject: [New-bugs-announce] [issue11375] urllib2 over SOCKS doesn't use proxy for DNS In-Reply-To: <1299077508.41.0.756366246736.issue11375@psf.upfronthosting.co.za> Message-ID: <1299077508.41.0.756366246736.issue11375@psf.upfronthosting.co.za> New submission from OJW : #!/usr/bin/python import socks import socket socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS4, "127.0.0.1", 9050, True) socket.socket = socks.socksocket import urllib2 print urllib2.urlopen("http://example.com/").read() Expected result: all network communications go through SOCKS4A proxy Actual result: DNS lookup of example.com goes through default gateway, followed by HTTP connection via the proxy ---------- components: Library (Lib) messages: 129899 nosy: OJW priority: normal severity: normal status: open title: urllib2 over SOCKS doesn't use proxy for DNS type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 17:19:29 2011 From: report at bugs.python.org (Dave Abrahams) Date: Wed, 02 Mar 2011 16:19:29 +0000 Subject: [New-bugs-announce] [issue11376] Solaris/GCC/shared lib problem In-Reply-To: <1299082769.75.0.912514538655.issue11376@psf.upfronthosting.co.za> Message-ID: <1299082769.75.0.912514538655.issue11376@psf.upfronthosting.co.za> New submission from Dave Abrahams : http://twistedmatrix.com/trac/ticket/4916#comment:2 suggests that maybe there's a bug in distutils. Something in the build process for twisted is deciding that I have Sun CC installed instead of letting pycc, which can handle the job of picking the correct PIC flag, do it properly: /usr/lib/python2.6/pycc -DNDEBUG -KPIC -I/usr/include/python2.6 -c conftest.c -o conftest.o gcc: unrecognized option `-KPIC' ---------- assignee: tarek components: Distutils messages: 129903 nosy: dabrahams, eric.araujo, tarek priority: normal severity: normal status: open title: Solaris/GCC/shared lib problem type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 18:29:26 2011 From: report at bugs.python.org (STINNER Victor) Date: Wed, 02 Mar 2011 17:29:26 +0000 Subject: [New-bugs-announce] [issue11377] Deprecate (remove?) platform.popen() In-Reply-To: <1299086966.45.0.602666513721.issue11377@psf.upfronthosting.co.za> Message-ID: <1299086966.45.0.602666513721.issue11377@psf.upfronthosting.co.za> New submission from STINNER Victor : Extract of the documentation: ---- 15.14.3.1. Win95/98 specific platform.popen(cmd, mode='r', bufsize=None) Portable popen() interface. Find a working popen implementation preferring win32pipe.popen(). On Windows NT, win32pipe.popen() should work; on Windows 9x it hangs due to bugs in the MS C library. ---- Python 3 doesn't support Windows 9x/Me anymore: we should deprecate it, or maybe directly remove it. subprocess.Popen() is a better alternative: it supports Unicode, it handles EINTR, etc. ---------- components: Library (Lib) messages: 129905 nosy: haypo, lemburg priority: normal severity: normal status: open title: Deprecate (remove?) platform.popen() versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 18:45:03 2011 From: report at bugs.python.org (Alessandro Forghieri) Date: Wed, 02 Mar 2011 17:45:03 +0000 Subject: [New-bugs-announce] [issue11378] os.path.join when second starts with '/' (linux/unix) In-Reply-To: <1299087903.65.0.23161954685.issue11378@psf.upfronthosting.co.za> Message-ID: <1299087903.65.0.23161954685.issue11378@psf.upfronthosting.co.za> New submission from Alessandro Forghieri : Observed behavior: >>>>>>os.path.join('/foo/bar', '/baz') '/baz' Expected behavior: should return '/foo/bar/baz' or (suboptimally) raise an exception. Why: Observed beahvior violates the minimal surprise principle and does not appear to respond to any particular rationale (by the same token it could return /foo/bar as well) ---------- components: Library (Lib) messages: 129906 nosy: al_form2000 priority: normal severity: normal status: open title: os.path.join when second starts with '/' (linux/unix) type: behavior versions: Python 2.5, Python 2.6, Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 2 20:25:08 2011 From: report at bugs.python.org (Stefan Behnel) Date: Wed, 02 Mar 2011 19:25:08 +0000 Subject: [New-bugs-announce] [issue11379] Remove "lightweight" from minidom description In-Reply-To: <1299093908.17.0.828802315354.issue11379@psf.upfronthosting.co.za> Message-ID: <1299093908.17.0.828802315354.issue11379@psf.upfronthosting.co.za> New submission from Stefan Behnel : http://docs.python.org/library/xml.dom.minidom.html presents MiniDOM as a "Lightweight DOM implementation". The word "lightweight" is easily misunderstood as meaning "efficient" or "memory friendly". MiniDOM is well known to be neither of the two. The first paragraph then continues: """ xml.dom.minidom is a light-weight implementation of the Document Object Model interface. It is intended to be simpler than the full DOM and also significantly smaller. """ Again, "smaller" can be misread as "low memory footprint", whereas it is actually supposed to refer to an incomplete DOM API implementation. And "simpler" is also clearly exaggerated when compared to the alternative ElementTree package. I would like to see this changed and combined with a clear and visible comment that MiniDOM has very high resource profile, e.g. """ 19.7. xml.dom.minidom ? Pure Python DOM implementation xml.dom.minidom is a pure Python implementation of the Document Object Model interface, as known from other programming languages. It is intended to provide a smaller API than the full DOM. Note, however, that MiniDOM has a very large memory footprint compared to other Python XML libraries. If you need a fast and memory friendly XML tree implementation with a vastly simpler API, use the xml.etree package instead. """ ---------- assignee: docs at python components: Documentation messages: 129914 nosy: docs at python, scoder priority: normal severity: normal status: open title: Remove "lightweight" from minidom description versions: Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 02:32:46 2011 From: report at bugs.python.org (ulidtko) Date: Thu, 03 Mar 2011 01:32:46 +0000 Subject: [New-bugs-announce] [issue11380] "close failed in file object destructor" when "Broken pipe" happens on stdout In-Reply-To: <1299115966.12.0.337666295395.issue11380@psf.upfronthosting.co.za> Message-ID: <1299115966.12.0.337666295395.issue11380@psf.upfronthosting.co.za> New submission from ulidtko : The following script fails: from time import sleep try: while True: sleep(0.1) print "blah" except KeyboardInterrupt: pass when being launched with redirections like this: $ python test.py | tee /dev/null and the tee process gots killed *before* the python process (by e.g. hitting ^C in most shells). The output is: close failed in file object destructor: sys.excepthook is missing lost sys.stderr When the python process is SIGINTed prior to the tee process, everything goes as expected: buffered output to stdout gots flushed and seen on the console, the script finishes successfully, with zero exit status, tee finishes too. When the tee receives SIGINT first, and then python, script loses the output and prints the mentioned message. strace shows that python is receiving (but probably not handling properly) "Broken pipe" error in response to write(2): [pid 17874] write(1, "blah\nblah\nblah\nblah\nblah\nblah\nbl"..., 680) = -1 EPIPE (Broken pipe) ---------- components: IO messages: 129930 nosy: ulidtko priority: normal severity: normal status: open title: "close failed in file object destructor" when "Broken pipe" happens on stdout type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 06:44:40 2011 From: report at bugs.python.org (Abafei) Date: Thu, 03 Mar 2011 05:44:40 +0000 Subject: [New-bugs-announce] [issue11381] pretending the "not" operator is a function behaves surprisingly In-Reply-To: <1299131080.86.0.627193173962.issue11381@psf.upfronthosting.co.za> Message-ID: <1299131080.86.0.627193173962.issue11381@psf.upfronthosting.co.za> New submission from Abafei : I'm not sure if this is a bug per se, since I don't think pretending operators are callable is in the docs, but: pretending an operator (at least the "not" operator) is callable, like so: not(True) can be surprising: >>> (not 1) == 9 False >>> not(1) == 9 True Now, I know this is valid because Python is very lenient about whitespace (and the parenthenses are really just "eval '1' first") , but, this is still confusing behavior to someone who does not know about that. I think the same problem may be possible in the case of statements. A possible solution is to make sure there is at least some white-space between "alphabetical" operators and statements. ---------- messages: 129933 nosy: abafei priority: normal severity: normal status: open title: pretending the "not" operator is a function behaves surprisingly type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 11:11:55 2011 From: report at bugs.python.org (Charles-Francois Natali) Date: Thu, 03 Mar 2011 10:11:55 +0000 Subject: [New-bugs-announce] [issue11382] some posix module functions Message-ID: <1299147115.66.0.965600750268.issue11382@psf.upfronthosting.co.za> Changes by Charles-Francois Natali : ---------- nosy: neologix priority: normal severity: normal status: open title: some posix module functions _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 11:56:46 2011 From: report at bugs.python.org (Nick Coghlan) Date: Thu, 03 Mar 2011 10:56:46 +0000 Subject: [New-bugs-announce] [issue11383] compilation seg faults on insanely large expressions In-Reply-To: <1299149806.17.0.789738887671.issue11383@psf.upfronthosting.co.za> Message-ID: <1299149806.17.0.789738887671.issue11383@psf.upfronthosting.co.za> New submission from Nick Coghlan : ~/devel/py3k$ ./python -c "compile('1*'*100000+'1', 'broken', 'eval')" Segmentation fault Going by the gdb stack trace we're blowing the stack due to the recursive descent in "compiler_visit_expr". ---------- messages: 129950 nosy: ncoghlan priority: normal severity: normal status: open title: compilation seg faults on insanely large expressions _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 12:29:09 2011 From: report at bugs.python.org (STINNER Victor) Date: Thu, 03 Mar 2011 11:29:09 +0000 Subject: [New-bugs-announce] [issue11384] Deprecate, remove or document (correctly) os.popen In-Reply-To: <1299151749.56.0.94984256295.issue11384@psf.upfronthosting.co.za> Message-ID: <1299151749.56.0.94984256295.issue11384@psf.upfronthosting.co.za> New submission from STINNER Victor : os.popen() was deprecated in Python 2.6 but it does still exist in Python 3.3. The function is no more documented: there is an entry in os documentation, but the entry is not in the index, and it has a reference to the "file object creation" section which doesn't have an paragraph about os.popen(). I prefer subprocess.Popen() over os.popen() because subprocess has much more options to control the child process creation (eg. change the current directory), it closes all files by default (which is more secure), it restores the signal handlers, etc. I don't know if we can directly remove os.popen() from Python 3.3, because it is no more marked as deprecated in Python 3! ---------- components: Library (Lib) messages: 129955 nosy: haypo priority: normal severity: normal status: open title: Deprecate, remove or document (correctly) os.popen versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 19:25:34 2011 From: report at bugs.python.org (anatoly techtonik) Date: Thu, 03 Mar 2011 18:25:34 +0000 Subject: [New-bugs-announce] [issue11385] TextTestRunner methods are not documented In-Reply-To: <1299176734.52.0.359265322214.issue11385@psf.upfronthosting.co.za> Message-ID: <1299176734.52.0.359265322214.issue11385@psf.upfronthosting.co.za> New submission from anatoly techtonik : TextTestRunner has a run method, which is not documented. It is also is not clear how to add suite to TextTestRunner to be executed later by unittest.main() ---------- assignee: docs at python components: Documentation, Tests messages: 129988 nosy: docs at python, techtonik priority: normal severity: normal status: open title: TextTestRunner methods are not documented versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 19:29:03 2011 From: report at bugs.python.org (Eli Bendersky) Date: Thu, 03 Mar 2011 18:29:03 +0000 Subject: [New-bugs-announce] [issue11386] Fix exception thrown by bytearray.pop() for empty bytearrays In-Reply-To: <1299176943.63.0.780548363822.issue11386@psf.upfronthosting.co.za> Message-ID: <1299176943.63.0.780548363822.issue11386@psf.upfronthosting.co.za> New submission from Eli Bendersky : bytearray.pop() currently throws OverflowError when popping an empty bytearray, instead of IndexError. See Issue #10516 for reference discussion. ---------- assignee: rhettinger components: Interpreter Core keywords: easy, needs review messages: 129989 nosy: eli.bendersky, georg.brandl, ncoghlan, rhettinger, terry.reedy priority: normal severity: normal stage: patch review status: open title: Fix exception thrown by bytearray.pop() for empty bytearrays type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 19:30:14 2011 From: report at bugs.python.org (Nikolay Fomichev) Date: Thu, 03 Mar 2011 18:30:14 +0000 Subject: [New-bugs-announce] [issue11387] Tkinter, callback functions In-Reply-To: <1299177014.21.0.99633865764.issue11387@psf.upfronthosting.co.za> Message-ID: <1299177014.21.0.99633865764.issue11387@psf.upfronthosting.co.za> New submission from Nikolay Fomichev : A simple code: class App(): def __init__(self): self.root = tk.Tk() self.btn = tk.Button(self.root, text='Click me') self.btn.pack() self.btn.bind('', self.click) self.root.mainloop() def click(self, event): # Messagebox or filedialog pass When the button is clicked, it calls the function where a filedialog or messagebox is called. After the function is done the button changes - it looks like it's pressed. Its relief is sunken. Something like "self.btn.config(relief=tk.RAISED)" has no effect - relief is raised, but the button still looks pressed. If no dialogs are called, all is fine. But... if instead of "bind" I use config option "command", it works - the function goes well with dialogs, etc and the button is really raised. I checked this in 2.6.6, 2.7, 3.1.2 and 3.2 on Linux and Win, everywhere is the same tune. ---------- components: Tkinter messages: 129990 nosy: Nikolay.Fomichev priority: normal severity: normal status: open title: Tkinter, callback functions versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 19:36:47 2011 From: report at bugs.python.org (Eli Bendersky) Date: Thu, 03 Mar 2011 18:36:47 +0000 Subject: [New-bugs-announce] [issue11388] Implement MutableSequence.clear() In-Reply-To: <1299177407.5.0.868573551727.issue11388@psf.upfronthosting.co.za> Message-ID: <1299177407.5.0.868573551727.issue11388@psf.upfronthosting.co.za> New submission from Eli Bendersky : Now that both list and bytearray support the clear() method (see issue #10516), MutableSequence.clear() has to be implemented. This is pending on commit for issue #11386, which fixes the exception thrown by bytearray.pop() when the bytearray is empty. ---------- assignee: eli.bendersky components: Library (Lib) keywords: easy messages: 129994 nosy: eli.bendersky, georg.brandl, ncoghlan, rhettinger, terry.reedy priority: normal severity: normal stage: needs patch status: open title: Implement MutableSequence.clear() type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 20:57:25 2011 From: report at bugs.python.org (anatoly techtonik) Date: Thu, 03 Mar 2011 19:57:25 +0000 Subject: [New-bugs-announce] [issue11389] unittest: no way to control verbosity of doctests from cmd In-Reply-To: <1299182245.29.0.387603597674.issue11389@psf.upfronthosting.co.za> Message-ID: <1299182245.29.0.387603597674.issue11389@psf.upfronthosting.co.za> New submission from anatoly techtonik : I can't find a way to execute DocTests contained in a separate README.txt file using unittest.main() function. That doesn't allow to control verbosity for debugging. I am doing it this way in the tests.py import doctest import unittest if __name__ == '__main__': runner = unittest.TextTestRunner() runner.run(doctest.DocFileSuite('README.txt', optionflags=doctest.ELLIPSIS)) I could find a way to subclass TestLoader.loadTestsFromNames() by looking at the source code of undocumented TestProgram. I'd like to see this use case at least covered by documentation if not properly developed for stdlib of Python4. ---------- assignee: docs at python components: Documentation, Tests messages: 130001 nosy: docs at python, techtonik priority: normal severity: normal status: open title: unittest: no way to control verbosity of doctests from cmd _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 21:33:46 2011 From: report at bugs.python.org (anatoly techtonik) Date: Thu, 03 Mar 2011 20:33:46 +0000 Subject: [New-bugs-announce] [issue11390] doctest: add cmdline parameters In-Reply-To: <1299184426.69.0.480744886707.issue11390@psf.upfronthosting.co.za> Message-ID: <1299184426.69.0.480744886707.issue11390@psf.upfronthosting.co.za> New submission from anatoly techtonik : doctest module need to parse -h/--help parameters, and accept flags like ELLIPSIS from command line. Otherwise it very hard to debug tests like contained in the attached README. It is also worth to make it parameter compatible with unittest.main() Usage: tests.py [options] [test] [...] Options: -h, --help Show this message -v, --verbose Verbose output -q, --quiet Minimal output -f, --failfast Stop on first failure -c, --catch Catch control-C and display results -b, --buffer Buffer stdout and stderr during test runs ---------- files: README.txt messages: 130002 nosy: techtonik priority: normal severity: normal status: open title: doctest: add cmdline parameters versions: Python 2.7, Python 3.2 Added file: http://bugs.python.org/file20989/README.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 3 23:20:29 2011 From: report at bugs.python.org (Charles-Francois Natali) Date: Thu, 03 Mar 2011 22:20:29 +0000 Subject: [New-bugs-announce] [issue11391] mmap write segfaults if PROT_WRITE bit is not set in prot In-Reply-To: <1299190829.31.0.825165631256.issue11391@psf.upfronthosting.co.za> Message-ID: <1299190829.31.0.825165631256.issue11391@psf.upfronthosting.co.za> New submission from Charles-Francois Natali : $ cat /tmp/test_mmap.py import mmap m = mmap.mmap(-1, 1024, prot=mmap.PROT_READ|mmap.PROT_EXEC) m[0] = 0 $ ./python /tmp/test_mmap.py Segmentation fault When trying to perform a write, is_writable is called to check that we can indeed write to the mmaped area. is_writable just checks the access mode, and if it's not ACCESS_READ, we go ahead and proceed to the write. The problem is that under Unix, it's possible to pass ACCESS_DEFAULT, and in that case no check is done on prot value. In that case, is_writable will return true (since ACCESS_DEFAULT != ACCESS_READ), but if prot doesn't include PROT_WRITE bit, we'll segfault. Attached is a patch including fix and specific test. ---------- files: mmap_check_prot_py3k.diff keywords: patch messages: 130008 nosy: neologix priority: normal severity: normal status: open title: mmap write segfaults if PROT_WRITE bit is not set in prot Added file: http://bugs.python.org/file20991/mmap_check_prot_py3k.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 00:13:22 2011 From: report at bugs.python.org (Sandro Tosi) Date: Thu, 03 Mar 2011 23:13:22 +0000 Subject: [New-bugs-announce] [issue11392] Turtle - better explain 'chaos' demo In-Reply-To: <1299194002.65.0.446288192224.issue11392@psf.upfronthosting.co.za> Message-ID: <1299194002.65.0.446288192224.issue11392@psf.upfronthosting.co.za> New submission from Sandro Tosi : Following up http://mail.python.org/pipermail/docs/2011-January/002786.html I prepared this patch to - correct Verhulst name - explain that the results can be against common sense Also, what's exactly related to "world coordinates" in this example? ---------- assignee: docs at python components: Documentation files: turle_demo_chaos-py3k.patch keywords: patch messages: 130012 nosy: docs at python, sandro.tosi priority: low severity: normal stage: patch review status: open title: Turtle - better explain 'chaos' demo versions: Python 2.7, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file20992/turle_demo_chaos-py3k.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 00:19:45 2011 From: report at bugs.python.org (STINNER Victor) Date: Thu, 03 Mar 2011 23:19:45 +0000 Subject: [New-bugs-announce] [issue11393] Integrate faulthandler module into Python 3.3 In-Reply-To: <1299194385.57.0.300728524683.issue11393@psf.upfronthosting.co.za> Message-ID: <1299194385.57.0.300728524683.issue11393@psf.upfronthosting.co.za> New submission from STINNER Victor : << Fault handler for SIGSEGV, SIGFPE, SIGBUS and SIGILL signals: display the Python backtrace and restore the previous handler. Allocate an alternate stack for this handler, if sigaltstack() is available, to be able to allocate memory on the stack, even on stack overflow (not available on Windows). Import the module and call faulthandler.enable() to enable the fault handler. The fault handler is called on catastrophic cases and so it can only use signal-safe functions (eg. it doesn't allocate memory on the heap). That's why the backtrace is limited: it only supports ASCII encoding (use the backslashreplace error handler for non-ASCII characters), doesn't print the source code in the backtrace (only the filename, the function name and the line number), is limited to 100 frames and 100 threads. By default, the Python backtrace is written to the standard error stream. Start your graphical applications in a terminal and run your server in foreground to see the backtrace, or pass a file to faulthandler.enable(). faulthandler is implemented in C using signal handlers to be able to dump a backtrace on a crash or when Python is blocked (eg. deadlock). >> https://github.com/haypo/faulthandler faulthandler works on Python 2.5 .. 3.3. -- faulthandler is an alternative to gdb7 + python-gdb.py to dump the backtrace. faulthandler already helped me to debug a PyQt crash on Windows: I don't know how to install gdb on Windows, especially with faulthandler! But I didn't get a lot of feedbacks. -- I don't know if the whole module should be included or not. TODO list: * add something to enable faulthandler on the command line: an option on the command line (eg. python -x faulthandler script.py) or an environment variable (PYTHONFAULTHANDLER=y python script.py)? * decide what to do with child processes: disable the faulthandler after a fork? * use something else than Py_AtExit() to unload the module? * dump the Python backtrace on a fatal error (and/or maybe catch SIGABRT) * use maybe something else than alarm()+SIGARLM for dumpbacktrace_later() because it interrupts the current system call -- History of this module. I first proposed a segfault handler using setjmp/longjmp to raise a classic Python exception. So it was possible to execute Python code after a segfault (including stack overflow). But the idea was rejected because the Python internal state may be corrupted if the segfault was an invalid memory write (buffer overflow?), and anyway we cannot warranty that the internal state is still consistent after a long jump. => http://bugs.python.org/issue3999 (sept. 2009) After that, I proposed to just display the Python backtrace on segfault. The signal handler was enabled by default. Because some people was concerned about possible bugs or security vulnerabilities introduced by the signal handler, I proposed options to disable it. Finally, I proposed to disable it by default and add options to enable it, but it was too late for an inclusion into Python 3.2. Anyways, the project (a patch) was young and the API not correctly defined. => http://bugs.python.org/issue8863 (may 2010) I converted my patch into a module. During this conversion, I realized that a module API is more natural than options using environment variables or functions in the sys module (I proposed sys.setfaulthandlerenabled(), an horrible name :-)). And it becomes more natural to enable the faulthandler by importing a module and calling a function (faulthandler.enable()). Later I added functions to display the Python backtrace not only on a crash, but after a certain amount of time, or when an user signal is raised. You can also call the function directly to dump the backtrace. And finally, I added many option to configure how the backtrace is displayed: current thread of all threads, sys.stderr or another file, ... -- I hope that this module will help to understand multiprocessing issues on the buildbots! ---------- components: Library (Lib) messages: 130013 nosy: haypo priority: normal severity: normal status: open title: Integrate faulthandler module into Python 3.3 versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 06:37:00 2011 From: report at bugs.python.org (anatoly techtonik) Date: Fri, 04 Mar 2011 05:37:00 +0000 Subject: [New-bugs-announce] [issue11394] No Tools/demo on Windows In-Reply-To: <1299217020.84.0.644136523007.issue11394@psf.upfronthosting.co.za> Message-ID: <1299217020.84.0.644136523007.issue11394@psf.upfronthosting.co.za> New submission from anatoly techtonik : Changelog for Python 3.2 contains this paragraph: "- Issue #7962: The Demo directory is gone. Most of the old and unmaintained demos have been removed, others integrated in documentation or a new Tools/demo subdirectory." However, there is no "demo" inside of Tools directory in fresh install of Python 3.2 on Windows. ---------- components: Demos and Tools messages: 130025 nosy: techtonik priority: normal severity: normal status: open title: No Tools/demo on Windows versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 06:47:43 2011 From: report at bugs.python.org (Case Van Horsen) Date: Fri, 04 Mar 2011 05:47:43 +0000 Subject: [New-bugs-announce] [issue11395] print(s) fails on Windows with long strings In-Reply-To: <1299217663.52.0.355409591746.issue11395@psf.upfronthosting.co.za> Message-ID: <1299217663.52.0.355409591746.issue11395@psf.upfronthosting.co.za> New submission from Case Van Horsen : Python 3.2 fails when printing long strings. C:\Python32>python Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print("a"*66000) Traceback (most recent call last): File "", line 1, in IOError: [Errno 12] Not enough space >>> Some observations: 1) 3.2 on Linux prints just fine. 2) 2.7.1 and 3.1.3 on Windows x64 are fine 3) The 32-bit interpreter for 3.2 also fails. 4) On 32-bit Windows, a length of 62733 works correctly but 62734, and higher, fail. 5) On 64-bit Windows, the output is visibly corrupted when the length reaches 62801 but the error does not occur until the length reaches 65536. 6) While experimenting with various lengths, I was able to crash the interpreter once. ---------- messages: 130029 nosy: casevh priority: normal severity: normal status: open title: print(s) fails on Windows with long strings type: crash versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 16:18:52 2011 From: report at bugs.python.org (nestor) Date: Fri, 04 Mar 2011 15:18:52 +0000 Subject: [New-bugs-announce] [issue11396] add format handler to bytes object In-Reply-To: <1299251932.57.0.908834065422.issue11396@psf.upfronthosting.co.za> Message-ID: <1299251932.57.0.908834065422.issue11396@psf.upfronthosting.co.za> New submission from nestor : Many programs written for Python 2.x use simple string interpolation to create byte strings with specific layout, this is gone in 3.x. Is it possible to support the format method but maybe only supporting field names like '{}' '{1}{2}' '{name}' and not conversion and formatting for the bytes type? Examples: http://mail.python.org/pipermail/python-list/2011-March/1267308.html and the "get_current_url" function at this post: http://lucumr.pocoo.org/2010/5/25/wsgi-on-python-3/ ---------- messages: 130055 nosy: nestor priority: normal severity: normal status: open title: add format handler to bytes object type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 18:17:18 2011 From: report at bugs.python.org (Mikhail Kovtun) Date: Fri, 04 Mar 2011 17:17:18 +0000 Subject: [New-bugs-announce] [issue11397] os.path.realpath() may produce incorrect results In-Reply-To: <1299259038.05.0.675723191983.issue11397@psf.upfronthosting.co.za> Message-ID: <1299259038.05.0.675723191983.issue11397@psf.upfronthosting.co.za> New submission from Mikhail Kovtun : This bug appears in Python 2.4, 2.5, 2.6; not tested in Python 2.7. How to reproduce on Linux: {{{ $ mkdir ~/testsymlinks $ cd ~/testsymlinks $ mkdir adir $ ln -s ../adir adir/blink $ mkdir -p adir/cdir/ddir $ ln -s adir/cdir/ddir/.. xlink $ ln -s xlink/../blink zlink }}} Then: {{{ $ readlink zlink -f /home/user/testsymlinks/adir }}} but: {{{ $ python Python 2.4.3 (#1, Sep 3 2009, 15:37:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os.path >>> os.path.realpath('zlink') '/home/user/testsymlinks/blink' >>> }}} ---------- components: Extension Modules messages: 130060 nosy: mkovtun priority: normal severity: normal status: open title: os.path.realpath() may produce incorrect results type: behavior versions: Python 2.5, Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 19:35:12 2011 From: report at bugs.python.org (chris nojima) Date: Fri, 04 Mar 2011 18:35:12 +0000 Subject: [New-bugs-announce] [issue11398] http_proxy on windows won't function due to incorrect case handling In-Reply-To: <1299263712.38.0.425713656967.issue11398@psf.upfronthosting.co.za> Message-ID: <1299263712.38.0.425713656967.issue11398@psf.upfronthosting.co.za> New submission from chris nojima : There is an issue where on windows os.environ keys are all uppercase. If i run set a="hello", in python it will appear as a key "A". urllib.request.getproxies_environment looks for all _proxy environment vars by looking for "_proxy". Since windows uppercases, it's impossible to set this var (it will be HTTP_PROXY and won't match, etc). This is stopping me from running some install scripts ---------- components: Library (Lib) messages: 130067 nosy: chris.nojima priority: normal severity: normal status: open title: http_proxy on windows won't function due to incorrect case handling type: behavior versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 20:00:08 2011 From: report at bugs.python.org (Santoso Wijaya) Date: Fri, 04 Mar 2011 19:00:08 +0000 Subject: [New-bugs-announce] [issue11399] python.exe -u fails to parse input to the interactive interpreter In-Reply-To: <1299265208.56.0.328818913289.issue11399@psf.upfronthosting.co.za> Message-ID: <1299265208.56.0.328818913289.issue11399@psf.upfronthosting.co.za> New submission from Santoso Wijaya : Observe: C:\Users\santa>C:\Python27\python.exe -u Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print 'Hello world' File "", line 1 print 'Hello world' ^ SyntaxError: invalid syntax >>> ---------- components: Windows messages: 130068 nosy: santa4nt priority: normal severity: normal status: open title: python.exe -u fails to parse input to the interactive interpreter versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 21:44:51 2011 From: report at bugs.python.org (Terry J. Reedy) Date: Fri, 04 Mar 2011 20:44:51 +0000 Subject: [New-bugs-announce] [issue11400] Remove reference to pre 1.5 assignment behavior In-Reply-To: <1299271491.28.0.280932939056.issue11400@psf.upfronthosting.co.za> Message-ID: <1299271491.28.0.280932939056.issue11400@psf.upfronthosting.co.za> New submission from Terry J. Reedy : In Language Ref, 6.2 assignments, delete "(This rule is relaxed as of Python 1.5; in earlier versions, the object had to be a tuple. Since strings are sequences, an assignment like a, b = "xy" is now legal as long as the string has the right length.)" ---------- assignee: docs at python components: Documentation messages: 130071 nosy: docs at python, terry.reedy priority: normal severity: normal status: open title: Remove reference to pre 1.5 assignment behavior versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 4 21:49:46 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Fri, 04 Mar 2011 20:49:46 +0000 Subject: [New-bugs-announce] [issue11401] email.header error during .flatten() In-Reply-To: <1299271786.04.0.494304301507.issue11401@psf.upfronthosting.co.za> Message-ID: <1299271786.04.0.494304301507.issue11401@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : Hello, David, the error from Issue 11116 occurred again, and it still can be healed with the patch file20675. (I'm opening a new issue because 11116 turned over to the mailbox fix. My repo and installation is at: 21:34 ~/arena/code.extern.repos/py3k.hg $ hg identify ddd8bf84e27d+ (py3k) tip 21:34 ~/arena/code.extern.repos/py3k.hg $ hg slog -r tip changeset: 10028:ddd8bf84e27d branch: py3k tag: tip user: eli.bendersky date: Fri Mar 04 11:38:14 2011 +0100 summary: [svn r88742] Here is the dump: | Opening mbox mailbox /private/var/folders/Da/DaZX3-k5G8a57zw6MSmjJ++++TM/-Tmp-/mail/test David: <-> PANIC: [box] test: message-add failed. Traceback (most recent call last): File "/Users/steffen/usr/bin/s-postman.py", line 1093, in save_ticket mb.add(ticket.message()) ... try: print('David:', type(mb), ' <-> ', type(ticket.message())) mb.add(ticket.message()) mb.flush() except Exception as e: efun('[box] ', self.id, ': message-add failed.\n', extb=E()) finally: mb.unlock() ... File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 595, in add self._toc[self._next_key] = self._append_message(message) File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 733, in _append_message offsets = self._install_message(message) File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 805, in _install_message self._dump_message(message, self._file, self._mangle_from_) File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 215, in _dump_message gen.flatten(message) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 88, in flatten self._write(msg) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 141, in _write self._write_headers(msg) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 373, in _write_headers self.write(header.encode(linesep=self._NL)+self._NL) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 317, in encode formatter.feed(lines[0], charset) Exception: IndexError: list index out of range In the meanwhile the thing has dispatched tens of thousands of mails, and no error did ever occur (reading from MBox, storing as Maildir). This happened when saving the first message read from a Maildir mailbox to a MBox one. I think i'll gonna do some round-trip tests tomorrow and monday evening+. Anyway, patching in file20675 heals the problem and the thing finishs gracefully. ---------- components: Library (Lib) messages: 130072 nosy: r.david.murray, sdaoden priority: normal severity: normal status: open title: email.header error during .flatten() type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 5 01:10:49 2011 From: report at bugs.python.org (Daniel Stutzbach) Date: Sat, 05 Mar 2011 00:10:49 +0000 Subject: [New-bugs-announce] [issue11402] _PyUnicode_Init leaks a little memory once In-Reply-To: <1299283849.1.0.295176765442.issue11402@psf.upfronthosting.co.za> Message-ID: <1299283849.1.0.295176765442.issue11402@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : By the time _PyUnicode_Init is called and does the following: /* Init the implementation */ free_list = NULL; numfree = 0; free_list is already in use. _PyUnicode_Init clobbers whatever was stored there, leaking memory. In Python 2, this was not an issue because no unicode functions were called prior to initialization. In Python 3, Unicode objects are created when initializing other types. I found this using valgrind to search for "definitely lost" memory. I'd like to fix all of those cases, to make it easier to run valgrind on a regular basis. I'll upload a patch momentarily. ---------- assignee: stutzbach components: Interpreter Core messages: 130090 nosy: stutzbach priority: normal severity: normal stage: patch review status: open title: _PyUnicode_Init leaks a little memory once type: resource usage versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 5 03:08:37 2011 From: report at bugs.python.org (Santoso Wijaya) Date: Sat, 05 Mar 2011 02:08:37 +0000 Subject: [New-bugs-announce] [issue11403] Add some generated files in PC/ to .hgignore. In-Reply-To: <1299290917.79.0.524609028857.issue11403@psf.upfronthosting.co.za> Message-ID: <1299290917.79.0.524609028857.issue11403@psf.upfronthosting.co.za> New submission from Santoso Wijaya : Here's a patch for .hgignore file to include some more build files emitted on Windows. ---------- components: None files: pcignore.patch keywords: patch messages: 130097 nosy: santa4nt priority: normal severity: normal status: open title: Add some generated files in PC/ to .hgignore. versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21000/pcignore.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 5 05:40:30 2011 From: report at bugs.python.org (=?utf-8?b?0JzQsNGA0Log0JrQvtGA0LXQvdCx0LXRgNCz?=) Date: Sat, 05 Mar 2011 04:40:30 +0000 Subject: [New-bugs-announce] [issue11404] support /dev/null for subprocess.call() and friends In-Reply-To: <1299300030.49.0.347847357367.issue11404@psf.upfronthosting.co.za> Message-ID: <1299300030.49.0.347847357367.issue11404@psf.upfronthosting.co.za> New submission from ???? ????????? : allow to call subprocess.check_call(stderr=subprocess.DEVNULL) ---------- components: Library (Lib) messages: 130101 nosy: mmarkk priority: normal severity: normal status: open title: support /dev/null for subprocess.call() and friends type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 5 06:44:11 2011 From: report at bugs.python.org (INADA Naoki) Date: Sat, 05 Mar 2011 05:44:11 +0000 Subject: [New-bugs-announce] [issue11405] Wrong reference to string module in tutorial/inputoutput.rst In-Reply-To: <1299303851.53.0.103129334097.issue11405@psf.upfronthosting.co.za> Message-ID: <1299303851.53.0.103129334097.issue11405@psf.upfronthosting.co.za> New submission from INADA Naoki : http://docs.python.org/py3k/tutorial/inputoutput.html#fancier-output-formatting > The standard module string contains some useful operations for padding strings to a given column width; these will be discussed shortly. The document uses str.rjust, ljust, zfill methods and not use string module for padding. ---------- assignee: docs at python components: Documentation messages: 130105 nosy: docs at python, naoki priority: normal severity: normal status: open title: Wrong reference to string module in tutorial/inputoutput.rst versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 5 11:17:58 2011 From: report at bugs.python.org (=?utf-8?b?0JzQsNGA0Log0JrQvtGA0LXQvdCx0LXRgNCz?=) Date: Sat, 05 Mar 2011 10:17:58 +0000 Subject: [New-bugs-announce] [issue11406] There is no os.listdir() equivalent returning generator instead of list In-Reply-To: <1299320278.86.0.403600489598.issue11406@psf.upfronthosting.co.za> Message-ID: <1299320278.86.0.403600489598.issue11406@psf.upfronthosting.co.za> New submission from ???? ????????? : Big dirs are really slow to read at once. If user wants to read items one by one like here: -------------- for i in os.listdir() use(i) -------------- having generator will gain performance, as big directories often very fragmented on disk. Also, dir_cache in kernel used more effectively. ---------- components: Library (Lib) messages: 130111 nosy: mmarkk priority: normal severity: normal status: open title: There is no os.listdir() equivalent returning generator instead of list type: performance versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 5 14:43:31 2011 From: report at bugs.python.org (Michael Foord) Date: Sat, 05 Mar 2011 13:43:31 +0000 Subject: [New-bugs-announce] [issue11407] unittest.TestCase.run should return result In-Reply-To: <1299332611.94.0.0298919007686.issue11407@psf.upfronthosting.co.za> Message-ID: <1299332611.94.0.0298919007686.issue11407@psf.upfronthosting.co.za> New submission from Michael Foord : If you call TestCase.run without an argument it will create a default TestResult and use it to execute the test. It should return the result so that you can introspect it. ---------- assignee: michael.foord messages: 130120 nosy: michael.foord priority: normal severity: normal status: open title: unittest.TestCase.run should return result type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 5 15:09:07 2011 From: report at bugs.python.org (Charles-Francois Natali) Date: Sat, 05 Mar 2011 14:09:07 +0000 Subject: [New-bugs-announce] [issue11408] python locks: blocking acquire calls useless gettimeofday In-Reply-To: <1299334147.69.0.216828112107.issue11408@psf.upfronthosting.co.za> Message-ID: <1299334147.69.0.216828112107.issue11408@psf.upfronthosting.co.za> New submission from Charles-Francois Natali : While tracing a program using multiprocessing queues, I noticed that there were many calls to gettimeofday. It turns out that acquire_timed, used by lock_PyThread_acquire_lock and rlock_acquire, always call gettimeofday, even if no timeout argument is given. Here's an example of the performance impact (I know it's a contrived example :-): $ cat /tmp/test_lock.py import threading lock = threading.Lock() i = 0 def do_loop(): global i for j in range(500000): lock.acquire() i += 1 lock.release() t1 = threading.Thread(target=do_loop) t2 = threading.Thread(target=do_loop) t1.start() t2.start() t1.join() t2.join() With current code: $ time ./python /tmp/test_lock.py real 0m5.200s user 0m3.288s sys 0m1.896s Without useless calls to gettimeofday: $ time ./python /tmp/test_lock.py real 0m3.091s user 0m3.056s sys 0m0.020s Note that the actual gain depends on the kernel, hardware and clocksource in use (the above measurements are on a Linux 2.6.32 kernel, using acpi_pm as clocksource). Attached is a patch removing useless calls to gettimeofday. Note that I also removed the check for expired timeout following trylock in case of PY_LOCK_INTR, since according to http://pubs.opengroup.org/onlinepubs/009695399/functions/sem_wait.html, it seems that only sem_wait is interruptible, not sem_trywait (e.g. on Linux, sem_trywait is implemented using futex which handle non-contended case in user-space). Windows locking primitives can't return PY_LOCK_INTR. Anyway, even if it happend once in a blue moon, we would just retry a trylock, which kind of makes sense. ---------- files: lock_gettimeofday_py3k.diff keywords: patch messages: 130121 nosy: neologix, pitrou priority: normal severity: normal status: open title: python locks: blocking acquire calls useless gettimeofday type: performance Added file: http://bugs.python.org/file21007/lock_gettimeofday_py3k.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 5 19:29:10 2011 From: report at bugs.python.org (Kelsey) Date: Sat, 05 Mar 2011 18:29:10 +0000 Subject: [New-bugs-announce] [issue11409] pysetup --search should return non-zero when a dist is not installed and print a message stating the fact. In-Reply-To: <1299349750.25.0.306966867422.issue11409@psf.upfronthosting.co.za> Message-ID: <1299349750.25.0.306966867422.issue11409@psf.upfronthosting.co.za> New submission from Kelsey : I would like to make pysetup easier to work with when called from shell scripts or similar tools that wish to take action based on the exit code of the pysetup --search command. In this case return 0 if a match is found and 1 otherwise. As an enhancement, print a message to stdout that the dist is not installed. Example: # pysetup -s Mako Mako is not installed # echo $? 1 Please review my patch in my d2 patch queue: https://bitbucket.org/khightower/distutils2-patch-queue/qseries?apply=t&qs_apply=pysetup-search ---------- assignee: tarek components: Distutils2 files: pysetup-search.patch keywords: patch messages: 130127 nosy: alexis, eric.araujo, kelseyhightower, tarek priority: normal severity: normal status: open title: pysetup --search should return non-zero when a dist is not installed and print a message stating the fact. type: behavior versions: 3rd party, Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21009/pysetup-search.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 6 07:12:25 2011 From: report at bugs.python.org (Thomas Wouters) Date: Sun, 06 Mar 2011 06:12:25 +0000 Subject: [New-bugs-announce] [issue11410] Use GCC visibility attrs in PyAPI_* In-Reply-To: <1299391945.72.0.037942723875.issue11410@psf.upfronthosting.co.za> Message-ID: <1299391945.72.0.037942723875.issue11410@psf.upfronthosting.co.za> New submission from Thomas Wouters : This patch adds support for the GCC visibility attributes to the PyAPI_* macros (currently only used for Windows.) GCC's default visibility is 'public', but can be changed to 'hidden' with the '-fvisibility=hidden' argument; see http://gcc.gnu.org/wiki/Visibility. This patch does not make the build use that, it merely makes Python function correctly when the default visibility *is* changed. (The benefit of building Python with -fvisibility=hidden is very small, as it causes only a handful of symbols to not be exported. When embedding Python, though, this can make a lot of difference.) The patch also fixes a few modules that don't use PyMODINIT_FUNC for their module-init function definitions, like they should. ---------- files: gcc-visibility.diff keywords: needs review, patch messages: 130143 nosy: twouters priority: normal severity: normal status: open title: Use GCC visibility attrs in PyAPI_* Added file: http://bugs.python.org/file21014/gcc-visibility.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 6 07:18:29 2011 From: report at bugs.python.org (Thomas Wouters) Date: Sun, 06 Mar 2011 06:18:29 +0000 Subject: [New-bugs-announce] [issue11411] Fix typo in Makefile In-Reply-To: <1299392309.1.0.575503746889.issue11411@psf.upfronthosting.co.za> Message-ID: <1299392309.1.0.575503746889.issue11411@psf.upfronthosting.co.za> New submission from Thomas Wouters : Fix a (double) typo in the Makefile, which prevents 'make DESTDIR=relative/path' from working correctly. ---------- files: destdir.diff keywords: easy, needs review, patch messages: 130146 nosy: twouters priority: normal severity: normal status: open title: Fix typo in Makefile Added file: http://bugs.python.org/file21015/destdir.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 6 07:47:38 2011 From: report at bugs.python.org (Raymond Hettinger) Date: Sun, 06 Mar 2011 06:47:38 +0000 Subject: [New-bugs-announce] [issue11412] Section numbers in the Library Reference have a trailing period In-Reply-To: <1299394058.19.0.712525080124.issue11412@psf.upfronthosting.co.za> Message-ID: <1299394058.19.0.712525080124.issue11412@psf.upfronthosting.co.za> New submission from Raymond Hettinger : The section headings all look like this: 4.11. Other Built-in Types 4.11.1. Modules ... http://docs.python.org/dev/library/stdtypes.html#classes-and-class-instances It looks like there is one dot to many ---------- assignee: georg.brandl components: Documentation messages: 130147 nosy: georg.brandl, rhettinger priority: normal severity: normal status: open title: Section numbers in the Library Reference have a trailing period type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 6 12:05:49 2011 From: report at bugs.python.org (Chris) Date: Sun, 06 Mar 2011 11:05:49 +0000 Subject: [New-bugs-announce] [issue11413] Idle doesn't start In-Reply-To: <1299409549.56.0.0846654522522.issue11413@psf.upfronthosting.co.za> Message-ID: <1299409549.56.0.0846654522522.issue11413@psf.upfronthosting.co.za> New submission from Chris : Hi, I just installed Python 3.1.1 via link in the book Python Programming for the absolute beginner third edition. But Idle won't start. When I try to open Idle the Windows "hourglass" just flash briefly but nothing happens after that. No error messages. My operating system is XP Professional Version 2002 Service Pack 3. I have uninstalled and reinstalled several times but nothing changes. I select "Install for All Users" during the installation. I have also tried installing instead the 3.2 version from the python.org website but the same issue arises - idle doesn't launch. Does anyone know what the problem is? Really want to get going with the program! ---------- components: IDLE messages: 130165 nosy: Chris priority: normal severity: normal status: open title: Idle doesn't start type: behavior versions: Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 6 17:29:23 2011 From: report at bugs.python.org (Scott Kitterman) Date: Sun, 06 Mar 2011 16:29:23 +0000 Subject: [New-bugs-announce] [issue11414] Add import fix for email.Message In-Reply-To: <1299428963.38.0.740283733384.issue11414@psf.upfronthosting.co.za> Message-ID: <1299428963.38.0.740283733384.issue11414@psf.upfronthosting.co.za> New submission from Scott Kitterman : email.Message was dropped in python3. from email.Message import Message now fails. Changing email.Message to email.message seems to be all that's needed. ---------- components: 2to3 (2.x to 3.0 conversion tool) messages: 130179 nosy: kitterma priority: normal severity: normal status: open title: Add import fix for email.Message _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 6 19:24:13 2011 From: report at bugs.python.org (=?utf-8?q?Jes=C3=BAs_Legan=C3=A9s_Combarro?=) Date: Sun, 06 Mar 2011 18:24:13 +0000 Subject: [New-bugs-announce] [issue11415] ZipFile don't overwrite compresed files at create In-Reply-To: <1299435853.5.0.715190951157.issue11415@psf.upfronthosting.co.za> Message-ID: <1299435853.5.0.715190951157.issue11415@psf.upfronthosting.co.za> New submission from Jes?s Legan?s Combarro : I've created a new, compresed ZipFile in memory (using StringIO) and added several files to it with ZipFile.write(), later i've added a new file with the same name of one of the previous ones just to overwrite it with some dinamic data using ZipFile.writestr(), and finally i've closed the StringIO ZipFile and writen to the hard disk. Secondly, i've opened it with FileRoller and found that the overwritten file is twice inside the ZipFile, the first and the second one, with different sizes and timestamp. Luckily, extracting one of them just get only the more recent one, but the fact is that the old one is already there and it's listed instead being overwritten with the last, new one, and i don't know if it's a bug (i think so) or just a feature. ---------- messages: 130182 nosy: piranna priority: normal severity: normal status: open title: ZipFile don't overwrite compresed files at create type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 6 22:14:07 2011 From: report at bugs.python.org (saffroy) Date: Sun, 06 Mar 2011 21:14:07 +0000 Subject: [New-bugs-announce] [issue11416] netrc module does not handle multiple entries for a single host In-Reply-To: <1299446047.69.0.767438398088.issue11416@psf.upfronthosting.co.za> Message-ID: <1299446047.69.0.767438398088.issue11416@psf.upfronthosting.co.za> New submission from saffroy : I have a netrc file with two entries for the same host. The netrc module only returns the last entry. $ cat > .netrc machine host.com login foo password foo machine host.com login bar password bar $ python -c 'import netrc; print netrc.netrc()' machine host.com login 'bar' password 'bar' My Linux ftp clients (ftp, lftp) always use the first entry for a given host. Also lftp can use the password from the proper entry if I supply the host and login. With the netrc module in Python 2.6.6 (as tested on Debian Squeeze), I can only retrieve the last entry. ---------- components: Library (Lib) messages: 130193 nosy: saffroy priority: normal severity: normal status: open title: netrc module does not handle multiple entries for a single host type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 00:14:53 2011 From: report at bugs.python.org (Thomas Wouters) Date: Sun, 06 Mar 2011 23:14:53 +0000 Subject: [New-bugs-announce] [issue11417] distutils' bdist_rpm fails when running with PYTHONDONTWRITEBYTECODE In-Reply-To: <1299453293.78.0.56952795246.issue11417@psf.upfronthosting.co.za> Message-ID: <1299453293.78.0.56952795246.issue11417@psf.upfronthosting.co.za> New submission from Thomas Wouters : According to distutils' test_bdist_rpm, bdist_rpm fails when running Python with -B/PYTHONDONTWRITEBYTECODE. (bdist_rpm or its test doesn't pass -B along but also doesn't use -E, so the test-failure shows up when setting the PYTHONDONTWRITEBYTECODE environment variable.) It looks like (somewhere in distutils) something relies on .pyc files being written, instead of explicitly using (say) py_compile.compile(). ---------- assignee: tarek components: Distutils messages: 130198 nosy: eric.araujo, tarek, twouters priority: normal severity: normal status: open title: distutils' bdist_rpm fails when running with PYTHONDONTWRITEBYTECODE _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 00:28:21 2011 From: report at bugs.python.org (INADA Naoki) Date: Sun, 06 Mar 2011 23:28:21 +0000 Subject: [New-bugs-announce] [issue11418] Method's global scope is module containing function definition, not class. In-Reply-To: <1299454101.64.0.841920247259.issue11418@psf.upfronthosting.co.za> Message-ID: <1299454101.64.0.841920247259.issue11418@psf.upfronthosting.co.za> New submission from INADA Naoki : http://docs.python.org/py3k/tutorial/classes.html#random-remarks > Methods may reference global names in the same way as ordinary > functions. The global scope associated with a method is the module > containing the class definition. (The class itself is never used > as a global scope.) Method's function can be defined outside the module containing class definition. And then the method's global scope is module containing method's function definition. ---------- messages: 130201 nosy: naoki priority: normal severity: normal status: open title: Method's global scope is module containing function definition, not class. _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 00:47:54 2011 From: report at bugs.python.org (Skip Montanaro) Date: Sun, 06 Mar 2011 23:47:54 +0000 Subject: [New-bugs-announce] [issue11419] Python-ast.[ch] out-of-date w.r.t. sources in fresh 2.5 checkout In-Reply-To: <1299455274.97.0.594517189551.issue11419@psf.upfronthosting.co.za> Message-ID: <1299455274.97.0.594517189551.issue11419@psf.upfronthosting.co.za> New submission from Skip Montanaro : I'm working my way through the steps necessary to check out and build all versions of Python since 2.4 using Mercurial checkouts. I encountered my first problem with 2.5. It seems the Mercurial checkout creates the Python-ast.[ch] files before the files they depend on. This causes an initial checkout to try and run Python. I don't know if Mercurial can be tweaked to guarantee checkout order or not. Would be nice if it could. The workaround is simple, just touch the two files. ---------- messages: 130203 nosy: skip.montanaro priority: normal severity: normal status: open title: Python-ast.[ch] out-of-date w.r.t. sources in fresh 2.5 checkout _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 00:48:10 2011 From: report at bugs.python.org (Thomas Wouters) Date: Sun, 06 Mar 2011 23:48:10 +0000 Subject: [New-bugs-announce] [issue11420] Make testsuite pass with -B/DONTWRITEBYTECODE set. In-Reply-To: <1299455290.18.0.767171934256.issue11420@psf.upfronthosting.co.za> Message-ID: <1299455290.18.0.767171934256.issue11420@psf.upfronthosting.co.za> New submission from Thomas Wouters : This patch tweaks a few tests that currently rely on .pyc files being written, causing them to fail (or crash) when running 'make test TESTPYTHONOPTS=-B'. All these are purely test failures, not failures in the tested code (unlike issue #11417, which is a failure in bdist_rpm instead of the test.) (This patch is for 3.1; the patch for 3.2/default is slightly different. I also have the same patch for Python 2.6/2.7, but I'm not sure if it's worth applying.) ---------- components: Tests files: py31-dontwritebytecode.diff keywords: patch messages: 130204 nosy: twouters priority: normal severity: normal status: open title: Make testsuite pass with -B/DONTWRITEBYTECODE set. versions: Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21022/py31-dontwritebytecode.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 00:50:47 2011 From: report at bugs.python.org (Skip Montanaro) Date: Sun, 06 Mar 2011 23:50:47 +0000 Subject: [New-bugs-announce] [issue11421] Subversion keywords missing on 2.5 checkout In-Reply-To: <1299455447.55.0.905017085345.issue11421@psf.upfronthosting.co.za> Message-ID: <1299455447.55.0.905017085345.issue11421@psf.upfronthosting.co.za> New submission from Skip Montanaro : Trying to build Python 2.5 from a fresh Mercurial checkout I get the following error trying to build modules using setup.py build: % nice make case $MAKEFLAGS in \ *-s*) CC='gcc' LDSHARED='gcc -L/opt/local/lib -bundle -undefined dynamic_lookup' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' ./python.exe -E ./setup.py -q build;; \ *) CC='gcc' LDSHARED='gcc -L/opt/local/lib -bundle -undefined dynamic_lookup' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' ./python.exe -E ./setup.py build;; \ esac Fatal Python error: subversion keywords missing /bin/sh: line 1: 48054 Abort trap CC='gcc' LDSHARED='gcc -L/opt/local/lib -bundle -undefined dynamic_lookup' OPT='-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes' ./python.exe -E ./setup.py build make: *** [sharedmods] Error 134 Even if no release is made I think this should be fixed in Mercurial if possible. ---------- messages: 130207 nosy: skip.montanaro priority: normal severity: normal status: open title: Subversion keywords missing on 2.5 checkout versions: Python 2.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 04:22:38 2011 From: report at bugs.python.org (Victor) Date: Mon, 07 Mar 2011 03:22:38 +0000 Subject: [New-bugs-announce] [issue11422] indentation problem in if, elif, else statements In-Reply-To: <1299468158.04.0.349961961476.issue11422@psf.upfronthosting.co.za> Message-ID: <1299468158.04.0.349961961476.issue11422@psf.upfronthosting.co.za> New submission from Victor : Hi dear developers, "Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32" Hello, Several days ago I downloaded Python 3.2, the standard windows installer, for windows vista. Here's the bug: in the Python-command line, the following works: " >>>if 2==2:print('yes') ...else:print('n') ... yes " Now, in the Python shell (IDLE-python gui, the standard one included with the installer of python), the only way it works is: >>> if 2==2:print('yes') else:print('n') yes So, it requires me to put "else" unindented. On the other hand, if the "if--else" statement is included in the definition of a function, then it requires that "else" be exactly under "if". Same is true when using "elif". This was frustrating, when trying to learn "if-else" statement, because it took me half an hour of experimenting. Shouldn't it be consistent? Victor ---------- components: Regular Expressions messages: 130219 nosy: victorywin priority: normal severity: normal status: open title: indentation problem in if, elif, else statements type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 04:32:37 2011 From: report at bugs.python.org (Victor) Date: Mon, 07 Mar 2011 03:32:37 +0000 Subject: [New-bugs-announce] [issue11423] .py file does not open on click In-Reply-To: <1299468757.88.0.336708457311.issue11423@psf.upfronthosting.co.za> Message-ID: <1299468757.88.0.336708457311.issue11423@psf.upfronthosting.co.za> New submission from Victor : Hi dear developers, **Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32** (windows vista; standard python installer for windows) I am new to python. In the documentation I read that a .py file should run just on clicking it. I do so, but nothing happens (or at most, I can see something opening for just a fraction of second, then it immediately closes). Same when I try to open it (with the right-click open menu) with python, pythonw. Is that normal? The way I do then, is to open the IDLE (python shell) and from there--"open file". (Also, I don't manage to use the "from file_name import*" command (in python shell IDLE), but I guess that will be another report.) ---------- components: None messages: 130220 nosy: victorywin priority: normal severity: normal status: open title: .py file does not open on click type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 05:52:28 2011 From: report at bugs.python.org (Mark Hammond) Date: Mon, 07 Mar 2011 04:52:28 +0000 Subject: [New-bugs-announce] [issue11424] logging fileConfig may not correctly detect children In-Reply-To: <1299473548.03.0.703750848821.issue11424@psf.upfronthosting.co.za> Message-ID: <1299473548.03.0.703750848821.issue11424@psf.upfronthosting.co.za> New submission from Mark Hammond : fileConfig has code to detect existing "child" loggers and ensure they are enabled if the parent is configured. However, the approach it takes of sorting the log names can fail in some cases. eg, if 3 loggers exist with names like "bar", "bar.child" and "bar-etc", "bar.child" is not detected as a child of "bar" as "bar-etc" sorts in between "bar" and "bar.child". Attaching a test case demonstrating this - things work correctly for "foo" and "foo.child" but not for "bar" and "bar.child" given the fact that "bar-etc" exists. ---------- files: log_test.py messages: 130224 nosy: mhammond, vinay.sajip priority: normal severity: normal status: open title: logging fileConfig may not correctly detect children type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21026/log_test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 06:44:53 2011 From: report at bugs.python.org (INADA Naoki) Date: Mon, 07 Mar 2011 05:44:53 +0000 Subject: [New-bugs-announce] [issue11425] Cleanup sample codes in tutorial. In-Reply-To: <1299476693.61.0.829631562481.issue11425@psf.upfronthosting.co.za> Message-ID: <1299476693.61.0.829631562481.issue11425@psf.upfronthosting.co.za> New submission from INADA Naoki : * Insert spaces around operators and after commas. * Split one liner blocks (ex. def foo(x, y): return x + y) to multi-line blocks. * Insert empty line after def block for scripts (not interactive mode). * Use new-style raise (s/ralse KeyboardInterrupt/raise KeyboardInterrupt()/) * Use x ** 3 instead of x * x * x. Attached patch is for Python 2.6. I'll make same changes for Python 3.1 if this patch is accepted. ---------- assignee: docs at python components: Documentation files: cleanup_tutorial_codes.patch keywords: patch messages: 130225 nosy: docs at python, naoki priority: normal severity: normal status: open title: Cleanup sample codes in tutorial. versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21027/cleanup_tutorial_codes.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 07:19:32 2011 From: report at bugs.python.org (Graham Wideman) Date: Mon, 07 Mar 2011 06:19:32 +0000 Subject: [New-bugs-announce] [issue11426] CSV examples can't close their files In-Reply-To: <1299478772.2.0.158667289214.issue11426@psf.upfronthosting.co.za> Message-ID: <1299478772.2.0.158667289214.issue11426@psf.upfronthosting.co.za> New submission from Graham Wideman : On the csv doc page (.../library/csv.html) most of the examples show creation of an anonymous file object within the csv.reader or csv.writer function, for example... spamWriter = csv.writer(open('eggs.csv', 'w'), delimiter=' ',.... This anonymity prevents later closing the file, which seems especially problematic for a writer. It also confuses users as to whether there's some sort of close function on a csv.reader or csv.writer object which should be called, or perhaps some other magic behind the scenes. I'm pretty sure that it's the doc that is incorrect here. This issue was raised pernthetically here http://bugs.python.org/issue7198#msg124678 by sjmachin, though mysteriously overlooked in his later suggested patch http://bugs.python.org/issue7198#msg126593 I suggest changing all examples to include the complete cycle of opening an explicit file, and later closing it. ---------- assignee: docs at python components: Documentation messages: 130228 nosy: docs at python, gwideman priority: normal severity: normal status: open title: CSV examples can't close their files type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 08:11:25 2011 From: report at bugs.python.org (benrg) Date: Mon, 07 Mar 2011 07:11:25 +0000 Subject: [New-bugs-announce] [issue11427] ctypes from_buffer no longer accepts bytes In-Reply-To: <1299481885.21.0.0627562040827.issue11427@psf.upfronthosting.co.za> Message-ID: <1299481885.21.0.0627562040827.issue11427@psf.upfronthosting.co.za> New submission from benrg : In Python 3.1.3, (c_char*5).from_buffer(b'abcde') worked. In 3.2 it fails with "TypeError: expected an object with a writable buffer interface". This seems to represent a significant decrease in the functionality of ctypes, since, if I understand correctly, it has no notion of a const array or a const char. I used from_buffer with a bytes argument in 3.1 and it was far from obvious how to port to 3.2 without introducing expensive copying. I understand the motivation behind requiring a writable buffer, but I think it's a bad idea. If you take this to its logical conclusion, it should not be possible to pass bytes or str values directly to C functions, since there's no way to be sure they won't write through the pointer. ---------- assignee: theller components: ctypes messages: 130229 nosy: benrg, theller priority: normal severity: normal status: open title: ctypes from_buffer no longer accepts bytes type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 08:19:17 2011 From: report at bugs.python.org (benrg) Date: Mon, 07 Mar 2011 07:19:17 +0000 Subject: [New-bugs-announce] [issue11428] with statement looks up __exit__ incorrectly In-Reply-To: <1299482357.23.0.863939671026.issue11428@psf.upfronthosting.co.za> Message-ID: <1299482357.23.0.863939671026.issue11428@psf.upfronthosting.co.za> New submission from benrg : class MakeContextHandler: def __init__(self, enter, exit): self.__enter__ = enter self.__exit__ = exit with MakeContextHandler(lambda: None, lambda *e: None): pass In 3.1.3 this worked; in 3.2 it raises AttributeError('__exit__'), which appears to be a bug. ---------- components: Interpreter Core messages: 130231 nosy: benrg priority: normal severity: normal status: open title: with statement looks up __exit__ incorrectly type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 08:49:01 2011 From: report at bugs.python.org (benrg) Date: Mon, 07 Mar 2011 07:49:01 +0000 Subject: [New-bugs-announce] [issue11429] ctypes is highly eclectic in its raw-memory support In-Reply-To: <1299484141.33.0.394671210882.issue11429@psf.upfronthosting.co.za> Message-ID: <1299484141.33.0.394671210882.issue11429@psf.upfronthosting.co.za> New submission from benrg : ctypes accepts bytes objects as arguments to C functions, but not bytearray objects. It has its own array types but seems to be unaware of array.array. It doesn't even understand memoryview objects. I think that all of these types should be passable to C code. Additionally, while passing a pointer to a bytes value to a C function is easy, it's remarkably difficult to pass that same pointer with an offset added to it. I first tried byref(buf, offset), but byref wouldn't accept bytes. Then I tried addressof(buf), but that didn't work either, even though ctypes is clearly able to obtain this address when it has to. After banging my head against the wall for longer than I care to think about, I finally came up with something like byref((c_char*length).from_buffer(buf), offset). But that broke in 3.2. After wasting even more time, I came up with addressof(cast(buf, POINTER(c_char)).contents) + offset. This is nuts. There should be a simple and documented way to do this. My first preference would be for the byref method, since it was the first thing I tried, and would have saved me the most time. Ideally both byref and addressof should work for bytes objects as they do for ctypes arrays (and also for bytearray, memoryview, etc.) ---------- assignee: theller components: ctypes messages: 130236 nosy: benrg, theller priority: normal severity: normal status: open title: ctypes is highly eclectic in its raw-memory support type: feature request versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 09:12:35 2011 From: report at bugs.python.org (benrg) Date: Mon, 07 Mar 2011 08:12:35 +0000 Subject: [New-bugs-announce] [issue11430] can't change the sizeof a Structure that doesn't own its buffer In-Reply-To: <1299485555.71.0.597497356789.issue11430@psf.upfronthosting.co.za> Message-ID: <1299485555.71.0.597497356789.issue11430@psf.upfronthosting.co.za> New submission from benrg : A struct that is resized knows its new size; among other things, the new size is returned by sizeof. But it seems to be impossible to increase the size of a struct that doesn't own its buffer. resize fails in this case. This would not be too bad if the size were merely informational, but unfortunately ctypes also uses it for bounds checking. This makes from_buffer and from_address a lot less useful than they would otherwise be. I think that either resize should succeed when the underlying buffer is already large enough (or unconditionally in the case of from_address), or else from_buffer and from_address should take a size argument, or possibly both. ---------- assignee: theller components: ctypes messages: 130237 nosy: benrg, theller priority: normal severity: normal status: open title: can't change the sizeof a Structure that doesn't own its buffer type: feature request versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 09:22:14 2011 From: report at bugs.python.org (Andrew Lih) Date: Mon, 07 Mar 2011 08:22:14 +0000 Subject: [New-bugs-announce] [issue11431] Python 3.2 (r32:88452) F5 crashes In-Reply-To: <1299486134.18.0.144025685513.issue11431@psf.upfronthosting.co.za> Message-ID: <1299486134.18.0.144025685513.issue11431@psf.upfronthosting.co.za> New submission from Andrew Lih : "Run Module" causes the IDLE to freeze when I start "Run Module" by pressing F5 on the keyboard. But clicking "Run Module" via "Run" on the menu bar have no freezing issue. Mac 10.6.6 ---------- components: IDLE messages: 130240 nosy: andrewlih priority: normal severity: normal status: open title: Python 3.2 (r32:88452) F5 crashes type: crash versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 10:30:27 2011 From: report at bugs.python.org (Campbell Barton) Date: Mon, 07 Mar 2011 09:30:27 +0000 Subject: [New-bugs-announce] [issue11432] webbrowser.open on unix fails. In-Reply-To: <1299490227.13.0.250987694391.issue11432@psf.upfronthosting.co.za> Message-ID: <1299490227.13.0.250987694391.issue11432@psf.upfronthosting.co.za> New submission from Campbell Barton : On Linux - tested on: Arch linux @ Debian Squeeze, this fails python -c "__import__('webbrowser').open('http://python.org')" The exception thats raised is: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.2/webbrowser.py", line 70, in open_new_tab return open(url, 2) File "/usr/lib/python3.2/webbrowser.py", line 62, in open if browser.open(url, new, autoraise): File "/usr/lib/python3.2/webbrowser.py", line 276, in open success = self._invoke(args, True, autoraise) File "/usr/lib/python3.2/webbrowser.py", line 239, in _invoke stderr=inout, preexec_fn=setsid) File "/usr/lib/python3.2/subprocess.py", line 736, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.2/subprocess.py", line 1330, in _execute_child raise child_exception_type(errno_num, err_msg) OSError: [Errno 9] Bad file descriptor Noticed that this wont raise an error when stdin arg isn't passed to Popen: line 237: p = subprocess.Popen(cmdline, close_fds=True, stdin=inout, Removing tdin=inout makes firefox load ok, however this is there for a reason so its not a useful fix ofcourse. ---------- components: Extension Modules messages: 130245 nosy: ideasman42 priority: normal severity: normal status: open title: webbrowser.open on unix fails. versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 17:54:44 2011 From: report at bugs.python.org (Victor) Date: Mon, 07 Mar 2011 16:54:44 +0000 Subject: [New-bugs-announce] [issue11433] syntax error at "while" statement in IDLE/python shell In-Reply-To: <1299516884.35.0.66577076049.issue11433@psf.upfronthosting.co.za> Message-ID: <1299516884.35.0.66577076049.issue11433@psf.upfronthosting.co.za> New submission from Victor : Hi and please help me understand if it is a bug, or..,as someone said, there's a 'bug' in my understanding: (Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32) (windows vista, the regular windows python installer) It's about the following code: while True: s = input('Enter something : ') if s == 'quit': break print('Length of the string is', len(s)) print('Done') when I put it in the IDLE's editor, and run it from there ("Run module F5"), it runs fine; but when I try to type it in the python shell (IDLE), or in the python command line, it gives errors, though I tried to edit it differently: >>> while True: s = input('Enter something : ') if s == 'quit': break print('Length of the string is', len(s)) print('Done') SyntaxError: invalid syntax >>> while True: s = input('Enter something : ') if s == 'quit': break print('Length of the string is', len(s)) print('Done') SyntaxError: unindent does not match any outer indentation level >>> The only way I noticed it would accept is to set the last "print" statement directly under/in the block of "while": which is not the intention. (According to the docs, while statement should work without the "else" option). Is this a bug? Thanks, Victor p.s. the example is taken from http://swaroopch.com/notes/Python_en:Control_Flow ---------- components: IDLE messages: 130261 nosy: victorywin priority: normal severity: normal status: open title: syntax error at "while" statement in IDLE/python shell type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 18:22:23 2011 From: report at bugs.python.org (Joshua Logan) Date: Mon, 07 Mar 2011 17:22:23 +0000 Subject: [New-bugs-announce] [issue11434] Python 3.2 input() does not remove "\r" at the end of returned string. In-Reply-To: <1299518543.64.0.9351532362.issue11434@psf.upfronthosting.co.za> Message-ID: <1299518543.64.0.9351532362.issue11434@psf.upfronthosting.co.za> New submission from Joshua Logan : Hello, It is mentioned in the documentation for input() ( http://docs.python.org/py3k/library/functions.html#input ) that the newline is stripped from the end of the returned string. However, on Windows, it used to trim '\r\n'. Now it no longer trims '\r'. See output below: C:\>python Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 >>> name = input("What's your name? ") What's your name? Josh >>> print(name) Josh >>> print(list(name)) ['J', 'o', 's', 'h', '\r'] ---------- components: Windows messages: 130265 nosy: jaylogan priority: normal severity: normal status: open title: Python 3.2 input() does not remove "\r" at the end of returned string. type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 18:31:31 2011 From: report at bugs.python.org (SilentGhost) Date: Mon, 07 Mar 2011 17:31:31 +0000 Subject: [New-bugs-announce] [issue11435] Links to source code should now point to hg repo In-Reply-To: <1299519091.7.0.295996410449.issue11435@psf.upfronthosting.co.za> Message-ID: <1299519091.7.0.295996410449.issue11435@psf.upfronthosting.co.za> New submission from SilentGhost : With the conversion to mercurial source links in documentation should now point to hg.python.org Here is the patch. ---------- assignee: docs at python components: Documentation files: docs_sourcename.diff keywords: patch messages: 130268 nosy: SilentGhost, docs at python priority: normal severity: normal stage: patch review status: open title: Links to source code should now point to hg repo Added file: http://bugs.python.org/file21033/docs_sourcename.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 7 19:29:38 2011 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 07 Mar 2011 18:29:38 +0000 Subject: [New-bugs-announce] [issue11436] Clarify struct doc for format 's'. In-Reply-To: <1299522578.2.0.51699411527.issue11436@psf.upfronthosting.co.za> Message-ID: <1299522578.2.0.51699411527.issue11436@psf.upfronthosting.co.za> New submission from Terry J. Reedy : The struct doc does not specify the meaning of 's', without a count. The attached patch adds the sentence: If a count is not given, it defaults to 1; ``'s'`` means the same as ``'1s'``. (Until I experimented, I had thought no count meant indefinite length). >>> struct.pack('sss', b'', b'a', b'ab') b'\x00aa' >>> struct.pack('1s1s1s', b'', b'a', b'ab') b'\x00aa' ---------- messages: 130275 nosy: terry.reedy priority: normal severity: normal status: open title: Clarify struct doc for format 's'. versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 8 01:14:03 2011 From: report at bugs.python.org (George Dhoore) Date: Tue, 08 Mar 2011 00:14:03 +0000 Subject: [New-bugs-announce] [issue11437] IDLE crash on startup with typo in config-keys.cfg In-Reply-To: <1299543243.52.0.970222997696.issue11437@psf.upfronthosting.co.za> Message-ID: <1299543243.52.0.970222997696.issue11437@psf.upfronthosting.co.za> New submission from George Dhoore : If the user makes a typo when setting a custom keybind (in this case "" instead of "") IDLE will silently crash. From the command-line the error shows as: Traceback (most recent call last): File "C:\Python32\Lib\idlelib\idle.py", line 11, in idlelib.PyShell.main() File "C:\Python32\Lib\idlelib\PyShell.py", line 1388, in main shell = flist.open_shell() File "C:\Python32\Lib\idlelib\PyShell.py", line 277, in open_shell self.pyshell = PyShell(self) File "C:\Python32\Lib\idlelib\PyShell.py", line 856, in __init__ self.history = self.History(self.text) File "C:\Python32\Lib\idlelib\IdleHistory.py", line 12, in __init__ text.bind("<>", self.history_prev) File "C:\Python32\Lib\idlelib\MultiCall.py", line 332, in bind self.__binders[triplet[1]].bind(triplet, func) File "C:\Python32\Lib\idlelib\MultiCall.py", line 213, in bind seq, handler))) File "C:\Python32\Lib\tkinter\__init__.py", line 977, in bind return self._bind(('bind', self._w), sequence, func, add) File "C:\Python32\Lib\tkinter\__init__.py", line 932, in _bind self.tk.call(what + (sequence, cmd)) _tkinter.TclError: bad event type or keysym "up" This is doubly confusing as case sensitivity seems to be applied at random in config-keys.cfg. Expected behavior: Ideally case sensitivity shouldn't matter in config-keys.cfg and if there is an error in the config syntax, that particular line should be ignored and the rest of the file tried. If IDLE is still able to start, some user friendly error should be displayed indicating the problem line. ---------- components: IDLE, Tkinter files: config-keys.cfg messages: 130301 nosy: George.Dhoore priority: normal severity: normal status: open title: IDLE crash on startup with typo in config-keys.cfg type: crash versions: Python 3.2 Added file: http://bugs.python.org/file21039/config-keys.cfg _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 8 03:56:25 2011 From: report at bugs.python.org (Steve Dower) Date: Tue, 08 Mar 2011 02:56:25 +0000 Subject: [New-bugs-announce] [issue11438] 2to3 does not fix izip_longest In-Reply-To: <1299552985.81.0.590298886377.issue11438@psf.upfronthosting.co.za> Message-ID: <1299552985.81.0.590298886377.issue11438@psf.upfronthosting.co.za> New submission from Steve Dower : Running 2to3 on the attached file makes no modifications, which then causes an error (since itertools.izip_longest is now itertools.zip_longest) ---------- components: 2to3 (2.x to 3.0 conversion tool) files: test.py messages: 130304 nosy: Steve.Dower priority: normal severity: normal status: open title: 2to3 does not fix izip_longest type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file21040/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 8 16:10:22 2011 From: report at bugs.python.org (Stefan Krah) Date: Tue, 08 Mar 2011 15:10:22 +0000 Subject: [New-bugs-announce] [issue11439] subversion keyword breakage In-Reply-To: <1299597022.39.0.100246713924.issue11439@psf.upfronthosting.co.za> Message-ID: <1299597022.39.0.100246713924.issue11439@psf.upfronthosting.co.za> New submission from Stefan Krah : Several files rely on properly substituted subversion keywords. In the cpython clone the keywords aren't substituted. 3.3 example: ============ $ find . -name "*.c" | xargs grep -n '"\$' ./Modules/_bsddb.c:102:static char *rcs_id = "$Id$"; ./Modules/pyexpat.c:1818: static char *rcsid = "$Revision$"; ./Modules/getbuildinfo.c:28:#define SVNVERSION "$WCRANGE$$WCMODS?M:$" ./Modules/_hotshot.c:1402: static char *rcsid = "$Revision$"; ./Python/sysmodule.c:1147:static const char headurl[] = "$HeadURL$"; Python 3.3a0 (default:a69ef22b60e3, Mar 8 2011, 15:40:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pyexpat >>> pyexpat.__version__ '400s)' >>> 2.5 example: ============ Python does not build without at least changing Include/patchlevel.h and Python/sysmodule.c. ---------- components: Interpreter Core messages: 130335 nosy: georg.brandl, pitrou, skrah priority: critical severity: normal stage: needs patch status: open title: subversion keyword breakage type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 8 17:08:08 2011 From: report at bugs.python.org (SilentGhost) Date: Tue, 08 Mar 2011 16:08:08 +0000 Subject: [New-bugs-announce] [issue11440] fix_callable should be dropped from lib2to3 / changed In-Reply-To: <1299600488.07.0.0466070744973.issue11440@psf.upfronthosting.co.za> Message-ID: <1299600488.07.0.0466070744973.issue11440@psf.upfronthosting.co.za> New submission from SilentGhost : Since the callable return in 3.2, should the fix_callable be dropped from lib2to3 or should it be adjusted to make distinction between 3.1 and 3.2 situation? I'm not sure if latter is possible. ---------- components: 2to3 (2.x to 3.0 conversion tool) messages: 130340 nosy: SilentGhost, pitrou priority: normal severity: normal status: open title: fix_callable should be dropped from lib2to3 / changed versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 8 17:24:44 2011 From: report at bugs.python.org (July Tikhonov) Date: Tue, 08 Mar 2011 16:24:44 +0000 Subject: [New-bugs-announce] [issue11441] compile() raises SystemError if called from except clause In-Reply-To: <1299601484.28.0.341696706995.issue11441@psf.upfronthosting.co.za> Message-ID: <1299601484.28.0.341696706995.issue11441@psf.upfronthosting.co.za> New submission from July Tikhonov : Normal: >>> compile('1 = 1', '', 'exec') Traceback (most recent call last): File "", line 1, in File "", line 1 SyntaxError: can't assign to literal SystemError is raised instead of SyntaxError: >>> try: abcde ... except NameError: ... compile('1 = 1', '', 'exec') ... Traceback (most recent call last): File "", line 1, in NameError: name 'abcde' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 3, in SystemError: Objects/tupleobject.c:126: bad argument to internal function Error can be discovered by calling dis.dis('1 = 1'). ---------- components: Library (Lib) messages: 130342 nosy: july priority: normal severity: normal status: open title: compile() raises SystemError if called from except clause type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 8 20:05:15 2011 From: report at bugs.python.org (Guido van Rossum) Date: Tue, 08 Mar 2011 19:05:15 +0000 Subject: [New-bugs-announce] [issue11442] list_directory() in SimpleHTTPServer.py should add charset=... to Content-type header In-Reply-To: <1299611115.64.0.389023379939.issue11442@psf.upfronthosting.co.za> Message-ID: <1299611115.64.0.389023379939.issue11442@psf.upfronthosting.co.za> New submission from Guido van Rossum : The security list received a report about SimpleHTTPServer's list_directory(). It needs to add a charset parameter to the Content-type header. This is already done in Python 3 (where this code lives in http/server.py) but not in any Python 2 versions I can find. A simple backport of the code in Python 3 should hopefully suffice. I'm marking this tentatively as a release blocker, but I don't see it's necessary to issue an urgent release. It should just be fixed before the next scheduled releases of 2.5, 2.6, 2.7. ---------- messages: 130347 nosy: barry, benjamin.peterson, gvanrossum priority: release blocker severity: normal stage: needs patch status: open title: list_directory() in SimpleHTTPServer.py should add charset=... to Content-type header type: security versions: Python 2.5, Python 2.6, Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 8 20:53:21 2011 From: report at bugs.python.org (Yaroslav) Date: Tue, 08 Mar 2011 19:53:21 +0000 Subject: [New-bugs-announce] [issue11443] Zip password issue In-Reply-To: <1299614001.15.0.390773224903.issue11443@psf.upfronthosting.co.za> Message-ID: <1299614001.15.0.390773224903.issue11443@psf.upfronthosting.co.za> New submission from Yaroslav : There's issue while setting password. I brute-force different passwords for that arhive-file, and it pass with different, not correct password. For that arhive password is: "pass", but that arhive is correct in python and even extract files from that with not correct passwords: ('Password is:', 'aafy') ('Password is:', 'aakv') ('Password is:', 'aavu') ('Password is:', 'aazs') ('Password is:', 'abgj') ('Password is:', 'abmr') ('Password is:', 'abzo') ('Password is:', 'acds') ('Password is:', 'acdu') ('Password is:', 'ace') ('Password is:', 'achc') ('Password is:', 'acue') ('Password is:', 'acxi') ('Password is:', 'adcj') ('Password is:', 'adcl') ('Password is:', 'adde') ('Password is:', 'advx') ('Password is:', 'aenu') ('Password is:', 'afbl') ('Password is:', 'afqg') ('Password is:', 'afyl') ('Password is:', 'agef') ('Password is:', 'agtv') ('Password is:', 'aimo') ('Password is:', 'aizr') ('Password is:', 'ajjt') ('Password is:', 'ajlj') ('Password is:', 'akqr') ... Of course content of file is not correct ("Q1E?85??M???o??H*] 5Q???  ?? ??X">_+x???????I?k?~L>?? "). z = zipfile.ZipFile("data.zip", 'r') z.setpassword("aafy") print(z.read("secretfile.txt")) ---------- messages: 130361 nosy: sbojchuk priority: normal severity: normal status: open title: Zip password issue versions: Python 2.5, Python 2.6, Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 8 20:54:34 2011 From: report at bugs.python.org (Adam Ernst) Date: Tue, 08 Mar 2011 19:54:34 +0000 Subject: [New-bugs-announce] [issue11444] logging FileHandler.close should acquire its lock before closing stream In-Reply-To: <1299614074.11.0.136259749977.issue11444@psf.upfronthosting.co.za> Message-ID: <1299614074.11.0.136259749977.issue11444@psf.upfronthosting.co.za> New submission from Adam Ernst : This is my first report, apologies if I missed any tracker etiquette. The logging module registers shutdown() to run via atexit. shutdown() calls flush() and close() on each handler. However if a FileHandler is writing to a file while shutdown() is executing, an IOError will be raised as the file is being closed while written to. (This can happen if you use daemon threads, which can still be running while exiting.) Traceback (most recent call last): File "/usr/local/lib/python2.7/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/local/lib/python2.7/logging/__init__.py", line 1616, in shutdown h.close() File "/usr/local/lib/python2.7/logging/__init__.py", line 898, in close self.stream.close() IOError: close() called during concurrent operation on the same file object. I'm not familiar with the internals of logging, but it seems that FileHandler should call self.acquire()/self.release() around its close and flush operations. Otherwise a daemon thread might be emitting a record while closing the handler. ---------- components: Library (Lib) messages: 130362 nosy: Adam.Ernst priority: normal severity: normal status: open title: logging FileHandler.close should acquire its lock before closing stream type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 8 23:24:53 2011 From: report at bugs.python.org (Skip Montanaro) Date: Tue, 08 Mar 2011 22:24:53 +0000 Subject: [New-bugs-announce] [issue11445] Something changed w.r.t. /pythonN.M/site-packages in the Hg switch In-Reply-To: <19830.44206.997189.286834@montanaro.dyndns.org> Message-ID: <19830.44206.997189.286834@montanaro.dyndns.org> New submission from Skip Montanaro : I routinely configure Python like so on my Mac (10.5.8): ./configure --prefix=/Users/skip/local --enable-shared LDFLAGS=-L/opt/local/lib CPPFLAGS=-I/opt/local/include This has always worked for me. Now, after installing from my Mercurial sandbox I have to set PYTHONPATH to get my /python2.7/site-packages directory in sys.path. Here's sys.path in a vanilla python2.7 session when installed from a svn sandbox: ['/Users/skip/misc/python/python2', '/Users/skip/misc/python', '', '/Users/skip/local/lib/python2.7/site-packages/ZODB3-3.8.1b8-py2.7-macosx-10.3-i386.egg', '/Users/skip/local/lib/python2.7/site-packages/zdaemon-2.0.2-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/ZConfig-2.6.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/zope.testing-3.7.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/zope.proxy-3.4.2-py2.7-macosx-10.3-i386.egg', '/Users/skip/local/lib/python2.7/site-packages/zope.interface-3.4.1-py2.7-macosx-10.3-i386.egg', '/Users/skip/local/lib/python2.7/site-packages/yolk-0.4.1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/SQLAlchemy-0.5.0rc2-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/decorator-2.3.1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/dnspython-1.6.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/spambayes-1.1b1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/py2app-0.3.6-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/bdist_mpkg-0.4.3-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/macholib-1.1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/modulegraph-0.7-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/altgraph-0.6.7-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/python_dateutil-1.4.1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/coverage-2.85-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/pycallgraph-0.5.1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/see-0.4.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/mercurial-unknown-py2.7-macosx-10.3-i386.egg', '/Users/skip/local/lib/python2.7/site-packages/Pyjamas-0.5-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/Cheetah-2.0.1-py2.7-macosx-10.3-i386.egg', '/Users/skip/local/lib/python2.7/site-packages/mock-0.4.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/pydns-2.3.3-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/Importing-1.9.2-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/docutils-0.6-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/MiniMock-1.2.5-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/nose-0.11.2.dev-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/pytz-2010b-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/pip-0.6.3-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/xlrd-0.7.1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/apipkg-1.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/argparse-1.1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/virtualenv-1.5.1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/tox-0.9-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/py-1.4.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/virtualenv5-1.3.4.5-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/pylint-0.22.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/logilab_astng-0.21.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/logilab_common-0.53.0-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/unittest2-0.5.1-py2.7.egg', '/Users/skip/local/lib/python2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.4-i386.egg', '/Users/skip/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/Users/skip/local/lib/python2.7', '/Users/skip/local/lib/python2.7/plat-darwin', '/Users/skip/local/lib/python2.7/plat-mac', '/Users/skip/local/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/skip/local/lib/python2.7/lib-tk', '/Users/skip/local/lib/python2.7/lib-old', '/Users/skip/local/lib/python2.7/lib-dynload', '/Users/skip/.local/lib/python2.7/site-packages', '/Users/skip/local/lib/python2.7/site-packages', '/Users/skip/local/lib/python2.7/site-packages/PIL'] Here it is when installed from a Mercurial sandbox: ['/Users/skip/misc/python/python2', '/Users/skip/misc/python', '', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/skip/.local/lib/python2.7/site-packages', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages'] Note that every directory in sys.path involving has been completely muffed (last element in sys.path). That /opt/local/Library/... directory does exist some some sort-of-recent build by MacPorts, not me. That shouldn't impact the installation of Python into my own directory space however. I've confirmed that identical configure commands were used for both the svn and hg builds. Skip ---------- messages: 130379 nosy: skip.montanaro priority: normal severity: normal status: open title: Something changed w.r.t. /pythonN.M/site-packages in the Hg switch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 00:12:29 2011 From: report at bugs.python.org (Terrence Cole) Date: Tue, 08 Mar 2011 23:12:29 +0000 Subject: [New-bugs-announce] [issue11446] Incorrect PEP link in Language Reference section 7.7 In-Reply-To: <1299625949.4.0.356508747283.issue11446@psf.upfronthosting.co.za> Message-ID: <1299625949.4.0.356508747283.issue11446@psf.upfronthosting.co.za> New submission from Terrence Cole : At the bottom of section 7.7 Class Definitions in the Python Language Reference: http://docs.python.org/py3k/reference/compound_stmts.html#class-definitions The text is: See also: PEP 3116 - Metaclasses in Python 3 PEP 3129 - Class Decorators This appears to be a typo. PEP 3116 is "New I/O", not "Metaclasses in Python3000" -- the correct PEP number is 3115. ---------- assignee: docs at python components: Documentation messages: 130385 nosy: docs at python, terrence priority: normal severity: normal status: open title: Incorrect PEP link in Language Reference section 7.7 type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 01:26:22 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 09 Mar 2011 00:26:22 +0000 Subject: [New-bugs-announce] [issue11447] test_pydoc refleak In-Reply-To: <1299630382.79.0.412893020199.issue11447@psf.upfronthosting.co.za> Message-ID: <1299630382.79.0.412893020199.issue11447@psf.upfronthosting.co.za> New submission from Antoine Pitrou : This appear to be caused by a5a3ae9be1fb ("Improve Pydoc interactive browsing (#2001). Patch by Ron Adam."). $ ./python -m test.regrtest -uall -R 3:3 test_pydoc [1/1] test_pydoc [46430 refs] [46431 refs] [46431 refs] [46430 refs] [46431 refs] [46426 refs] [46426 refs] /home/antoine/cpython/default/Lib/pydoc.py:1302: ResourceWarning: unclosed def _docdescriptor(self, name, value, mod): beginning 6 repetitions 123456 [46430 refs] [46431 refs] [46431 refs] [46430 refs] [46431 refs] [46426 refs] [46426 refs] ./home/antoine/cpython/default/Lib/test/regrtest.py:1146: ResourceWarning: unclosed gc.collect() [46430 refs] [46431 refs] [46431 refs] [46430 refs] [46431 refs] [46426 refs] [46426 refs] ./home/antoine/cpython/default/Lib/test/regrtest.py:1146: ResourceWarning: unclosed gc.collect() [46430 refs] [46431 refs] [46431 refs] [46430 refs] [46431 refs] [46426 refs] [46426 refs] ./home/antoine/cpython/default/Lib/test/regrtest.py:1146: ResourceWarning: unclosed gc.collect() [46430 refs] [46431 refs] [46431 refs] [46430 refs] [46431 refs] [46426 refs] [46426 refs] ./home/antoine/cpython/default/Lib/test/regrtest.py:1146: ResourceWarning: unclosed gc.collect() [46430 refs] [46431 refs] [46431 refs] [46430 refs] [46431 refs] [46426 refs] [46426 refs] ./home/antoine/cpython/default/Lib/test/regrtest.py:1146: ResourceWarning: unclosed gc.collect() [46430 refs] [46431 refs] [46431 refs] [46430 refs] [46431 refs] [46426 refs] [46426 refs] ./home/antoine/cpython/default/Lib/test/regrtest.py:1146: ResourceWarning: unclosed gc.collect() test_pydoc leaked [10, 10, 10] references, sum=30 ---------- components: Library (Lib), Tests messages: 130389 nosy: ncoghlan, pitrou, ron_adam, ronadam priority: normal severity: normal stage: needs patch status: open title: test_pydoc refleak type: resource usage versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 03:08:49 2011 From: report at bugs.python.org (Ryan Kelly) Date: Wed, 09 Mar 2011 02:08:49 +0000 Subject: [New-bugs-announce] [issue11448] docs for HTTPConnection.set_tunnel are ambiguous In-Reply-To: <1299636529.48.0.302129596868.issue11448@psf.upfronthosting.co.za> Message-ID: <1299636529.48.0.302129596868.issue11448@psf.upfronthosting.co.za> New submission from Ryan Kelly : The docs for HTTPConnection.set_tunnel(host,port) are ambiguous. They simply say "Set the host and the port for HTTP Connect Tunnelling". But should I specify the address of the server *through* which I want to tunnel, or the address of the *endpoint* of the tunnel? Turns out it's the latter, but I just wasted an hour "debugging" thinking it was the former :-( Attached is a simple doc patch to try to clarify this issue. ---------- assignee: docs at python components: Documentation files: set_tunnel_doc.diff keywords: patch messages: 130396 nosy: docs at python, rfk priority: normal severity: normal status: open title: docs for HTTPConnection.set_tunnel are ambiguous versions: Python 3.3 Added file: http://bugs.python.org/file21056/set_tunnel_doc.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 06:00:12 2011 From: report at bugs.python.org (Dan Stromberg) Date: Wed, 09 Mar 2011 05:00:12 +0000 Subject: [New-bugs-announce] [issue11449] tarfile tries to file_.tell() even when creating a new archive In-Reply-To: <1299646812.24.0.118802902773.issue11449@psf.upfronthosting.co.za> Message-ID: <1299646812.24.0.118802902773.issue11449@psf.upfronthosting.co.za> New submission from Dan Stromberg : The attached file demonstrates the problem in 2.5, 2.5, 2.7, 3.0, 3.1 and 3.2. In short, I believe when you're creating a new tar archive (say, to a pipe), there should be no need for a file_.tell() (which blows up when it's a pipe). I have a workaround, as demonstrated in the file, but probably others shouldn't have to work around this also in the future. Suggested fix: Only do the tell when you're appending or performing other operations that require subsequent seek's. ---------- components: Extension Modules files: tar-test messages: 130422 nosy: strombrg priority: normal severity: normal status: open title: tarfile tries to file_.tell() even when creating a new archive type: crash versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2 Added file: http://bugs.python.org/file21059/tar-test _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 09:10:17 2011 From: report at bugs.python.org (Scott Dial) Date: Wed, 09 Mar 2011 08:10:17 +0000 Subject: [New-bugs-announce] [issue11450] Py_GetBuildInfo() truncates when there are many hg tags In-Reply-To: <1299658217.91.0.742598203261.issue11450@psf.upfronthosting.co.za> Message-ID: <1299658217.91.0.742598203261.issue11450@psf.upfronthosting.co.za> New submission from Scott Dial : I'm not sure if it's intended to be a supported workflow, but I personally have come to like using "mq" for projects where I am an outsider submitting small changes as patches. However, this appears to be a broken workflow due to way getbuildinfo module choose to limit the buildinfo string to 50 characters: $ hg qnew dummy-patch $ echo "/* dummy change */" >> Modules/getbuildinfo.c $ ./python -c 'import sys; print(sys.version)' 3.3a0 (dummy-patch qbase qtip tip:191f047a07b4+, Mar 9 ) [GCC 4.4.5] This breaks the platform module and therefore breaks the regrtest code, which makes it a show-stopper for using mq to manage your workflow. Is there any reason that length of buildinfo can't be chosen at compile-time based on the sizeof(HGTAG)? ---------- components: Build messages: 130432 nosy: scott.dial priority: normal severity: normal status: open title: Py_GetBuildInfo() truncates when there are many hg tags type: feature request _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 11:49:45 2011 From: report at bugs.python.org (Graham Wideman) Date: Wed, 09 Mar 2011 10:49:45 +0000 Subject: [New-bugs-announce] [issue11451] Raw string parsing fails with backslash as last character In-Reply-To: <1299667785.36.0.781840050661.issue11451@psf.upfronthosting.co.za> Message-ID: <1299667785.36.0.781840050661.issue11451@psf.upfronthosting.co.za> New submission from Graham Wideman : This is a copy of issue 1271 because I couldn't find a way to reopen it. So, repeating my comment here: As it currently stands, backslash at end of string is prohibited, apparently in the interests of supposedly allowing backslash to escape quotes that might be embedded within the string. But the supposedly beneficial backslash-escaping-embedded quote behavior is broken because the backslash remains in the string. Consider: (a) We already have the ability to use either single or double quotes around the string which gives that chance to use the other quote within the string. (b) The "principle of least surprise" for raw string would be to have raw mean "Never Escape Anything" (c) backslash on end of string is currently a trap waiting to happen for Windows paths. So I think there is strong motivation to abandon the currently broken "backslash escapes quote" behavior and just let raw strings be totally raw. Furthermore, it's hard to imagine that such a move would break anything. (Famous last words, I know... but I challenge anyone to contrive such a scenario!) ---------- components: Interpreter Core messages: 130443 nosy: QuantumTim, facundobatista, georg.brandl, gwideman priority: normal severity: normal status: open title: Raw string parsing fails with backslash as last character type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 13:26:56 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Wed, 09 Mar 2011 12:26:56 +0000 Subject: [New-bugs-announce] [issue11452] Test suite not symlink-install clean In-Reply-To: <1299673616.41.0.947003469207.issue11452@psf.upfronthosting.co.za> Message-ID: <1299673616.41.0.947003469207.issue11452@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : I'm now using a completely brain-damaged way to have two 3.x python(1)s installed: symlinks; i.e. 3.2rc2 is ~/usr/opt/.py-3.2rc2 and tip is ~/usr/opt/.cpython. Whenever i need to test the thing i'm working on in my free time with the old version i'm temporarily replacing a ~/usr/opt/py3k symlink (which points to .cpython otherwise). (I'm doing this because only py3k is in $PATH, $LD_LIBRARY_PATH etc., but like i said...) I don't know if you consider this to be misbehaviour, but a moment ago i've run the test suite on an installed python(1) tip and got these symlink-path is not --prefix-path related errors, just if anyone is concerned (stripping output a bit): ====================================================================== FAIL: test_getsourcefile (test.test_inspect.TestRetrievingSourceCode) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/steffen/usr/opt/.cpython/lib/python3.3/test/test_inspect.py", line 279, in test_getsourcefile self.assertEqual(normcase(inspect.getsourcefile(mod.spam)), modfile) AssertionError: '/Users/steffen/usr/opt/.cpython/lib/python3.3/test/inspect_fodder.py' != '/Users/steffen/usr/opt/py3k/lib/python3.3/test/inspect_fodder.py' - /Users/steffen/usr/opt/.cpython/lib/python3.3/test/inspect_fodder.py ? -- ^^^^ + /Users/steffen/usr/opt/py3k/lib/python3.3/test/inspect_fodder.py ? ^^ ====================================================================== FAIL: test_findsource_code_in_linecache (test.test_inspect.TestBuggyCases) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/steffen/usr/opt/.cpython/lib/python3.3/test/test_inspect.py", line 387, in test_findsource_code_in_linecache self.assertRaises(IOError, inspect.findsource, co) AssertionError: IOError not raised by findsource ====================================================================== FAIL: test_stack (test.test_inspect.TestInterpreterStack) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/steffen/usr/opt/.cpython/lib/python3.3/test/test_inspect.py", line 163, in test_stack (modfile, 16, 'eggs', [' st = inspect.stack()\n'], 0)) AssertionError: Tuples differ: ('/Users/steffen/usr/opt/.cpyt... != ('/Users/steffen/usr/opt/py3k/... First differing element 0: /Users/steffen/usr/opt/.cpython/lib/python3.3/test/inspect_fodder.py /Users/steffen/usr/opt/py3k/lib/python3.3/test/inspect_fodder.py - ('/Users/steffen/usr/opt/.cpython/lib/python3.3/test/inspect_fodder.py', ? -- ^^^^ + ('/Users/steffen/usr/opt/py3k/lib/python3.3/test/inspect_fodder.py', ? ^^ ====================================================================== FAIL: test_trace (test.test_inspect.TestInterpreterStack) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/steffen/usr/opt/.cpython/lib/python3.3/test/test_inspect.py", line 174, in test_trace (modfile, 43, 'argue', [' spam(a, b, c)\n'], 0)) AssertionError: Tuples differ: ('/Users/steffen/usr/opt/.cpyt... != ('/Users/steffen/usr/opt/py3k/... First differing element 0: /Users/steffen/usr/opt/.cpython/lib/python3.3/test/inspect_fodder.py /Users/steffen/usr/opt/py3k/lib/python3.3/test/inspect_fodder.py - ('/Users/steffen/usr/opt/.cpython/lib/python3.3/test/inspect_fodder.py', ? -- ^^^^ + ('/Users/steffen/usr/opt/py3k/lib/python3.3/test/inspect_fodder.py', ? ^^ ... ====================================================================== FAIL: test_loop_caller_importing (test.test_trace.TestCallers) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_trace.py", line 286, in test_loop_caller_importing self.assertEqual(self.tracer.results().callers, expected) AssertionError: {(('/Users/steffen/usr/opt/.cpython/lib/python3.3/trace.py', 'trace', 'Trace.run [truncated]... != {(('/Users/steffen/usr/opt/py3k/lib/python3.3/test/test_trace.py', 'test_trace', [truncated]... ---------- components: Tests messages: 130452 nosy: sdaoden priority: normal severity: normal status: open title: Test suite not symlink-install clean type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 20:29:53 2011 From: report at bugs.python.org (Aldona Majorek) Date: Wed, 09 Mar 2011 19:29:53 +0000 Subject: [New-bugs-announce] [issue11453] asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does. In-Reply-To: <1299698993.48.0.0930746174281.issue11453@psf.upfronthosting.co.za> Message-ID: <1299698993.48.0.0930746174281.issue11453@psf.upfronthosting.co.za> New submission from Aldona Majorek : asyncore.file_wrapper duplicates file descriptor of given file and closes it in it's close method. But unlike socket.socket class it does not automatically call close when object is garbage collected. Users of regular sockets and asyncore.dispatcher do not experience resource leaks when they forget to call self.close() in handle_close(). But people using file_dispatcher do loose file descriptor every time file_wrapper object is garbage collected without calling self.close() first. ---------- components: Library (Lib) messages: 130458 nosy: amajorek priority: normal severity: normal status: open title: asyncore.file_wrapper should implement __del__ and call close there to prevent resource leaks and behave like socket.socket does. type: resource usage versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 21:07:17 2011 From: report at bugs.python.org (Ross Lagerwall) Date: Wed, 09 Mar 2011 20:07:17 +0000 Subject: [New-bugs-announce] [issue11454] urllib.request import time In-Reply-To: <1299701237.24.0.992920521308.issue11454@psf.upfronthosting.co.za> Message-ID: <1299701237.24.0.992920521308.issue11454@psf.upfronthosting.co.za> New submission from Ross Lagerwall : While importing most modules has little effect on the start up time, importing urllib.request seems to take a considerable time. E.g.: without importing urllib.request: real 0m0.072s user 0m0.070s sys 0m0.000s with importing urllib.request: real 0m0.127s user 0m0.120s sys 0m0.010s ---------- components: Library (Lib) messages: 130461 nosy: orsenthil, rosslagerwall priority: normal severity: normal status: open title: urllib.request import time type: resource usage versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 21:53:48 2011 From: report at bugs.python.org (Michael Foord) Date: Wed, 09 Mar 2011 20:53:48 +0000 Subject: [New-bugs-announce] [issue11455] issue a warning when populating a CPython type dict with non-string keys In-Reply-To: <1299704028.56.0.168922481621.issue11455@psf.upfronthosting.co.za> Message-ID: <1299704028.56.0.168922481621.issue11455@psf.upfronthosting.co.za> New submission from Michael Foord : It is valid in CPython to create a new type with non-string keys in the dict. This is a problem for other implementations (neither pypy nor jython support it). This should raise a warning. ---------- components: Interpreter Core messages: 130462 nosy: michael.foord priority: normal severity: normal status: open title: issue a warning when populating a CPython type dict with non-string keys type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 9 23:28:02 2011 From: report at bugs.python.org (Tony Wallace) Date: Wed, 09 Mar 2011 22:28:02 +0000 Subject: [New-bugs-announce] [issue11456] Documentation csv RFC4180 In-Reply-To: <1299709682.27.0.368718810764.issue11456@psf.upfronthosting.co.za> Message-ID: <1299709682.27.0.368718810764.issue11456@psf.upfronthosting.co.za> New submission from Tony Wallace : Change to documentation preamble for csv module: From: There is no ?CSV standard?, so the format is operationally defined by the many applications which read and write it. The lack of a standard means that subtle differences often exist in the data produced and consumed by different applications. To: CSV has been used for many years prior to attempts to standardise it in RFC4180. This has resulted in subtle differences often exist in the data produced and consumed by different applications. ---------- assignee: docs at python components: Documentation messages: 130469 nosy: docs at python, tonywallace priority: normal severity: normal status: open title: Documentation csv RFC4180 type: feature request versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 10 01:05:28 2011 From: report at bugs.python.org (Kris Henriksson) Date: Thu, 10 Mar 2011 00:05:28 +0000 Subject: [New-bugs-announce] [issue11457] Expose nanosecond precision from system calls In-Reply-To: <1299715528.65.0.317038011667.issue11457@psf.upfronthosting.co.za> Message-ID: <1299715528.65.0.317038011667.issue11457@psf.upfronthosting.co.za> New submission from Kris Henriksson : The most recent (issue 7) release of the POSIX standard mandates support for nanosecond precision in certain system calls. For example, the stat structure include a timespec struct for each of mtime, atime, and ctime that provides such nanosecond precision.[1] There is also an futimens call that allows setting the time accurate to the nanosecond.[2] Support for such precision is available at the least on 2.6 Linux kernels. 1. http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html 2. http://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html Currently, the Python float type is used everywhere to express times in a single value (such as the result from os.stat). However, since this is implemented in CPython using type double (and possibly similarly elsewhere) it is impossible to obtain sufficient precision using a float. Therefore, it would be useful to expose the number of seconds and nanoseconds separately to allow full precision. Perhaps adding these values as additional members to the return value from os.stat would be most useful, something like .st_atimensec that Linux sometimes uses, or else just follow the POSIX standard to include a sub-struct. This is important for example with the tarfile module with the pax tar format. The POSIX tar standard[3] mandates storing the mtime in the extended header (if it is not an integer) with as much precision as is available in the underlying file system, and likewise to restore this time properly upon extraction. Currently this is not possible. 3. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html ---------- components: Library (Lib) messages: 130478 nosy: khenriksson priority: normal severity: normal status: open title: Expose nanosecond precision from system calls type: feature request _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 10 03:33:59 2011 From: report at bugs.python.org (Alex Leach) Date: Thu, 10 Mar 2011 02:33:59 +0000 Subject: [New-bugs-announce] [issue11458] tarfile with socket incompatability In-Reply-To: <1299724439.89.0.965974216357.issue11458@psf.upfronthosting.co.za> Message-ID: <1299724439.89.0.965974216357.issue11458@psf.upfronthosting.co.za> New submission from Alex Leach : Hi, I'm trying to parse the contents of tar archives (.tgz) on the fly, and failing to do so. The tar archives in question have directory hierarchies, and only if a TarInfo object is a file (.isreg() ) will I try and read it's contents. I figured a sensible idea would be to pass a socket(.makefile()) object to the fileobj attribute of tarfile.open. This doesn't work because a socket file descriptor does not have a tell() method. I understand that a socket object shouldn't need to have a tell method, but why should the fileobj passed to tarfile.open need it? Code:- def get_headers( self, file_name ): sock = socket.socket() sock.bind(('localhost',0)) fd = sock.makefile() handle = tarfile.open( file_name,'r',fileobj=fd ) # This line breaks I'm currently testing on Python v2.6.6 EPD 6.3-2 64 bit, on an Autumn 2010 Mac Pro. My dirty bug-fix idea is to subclass tarfile.TarFile, and give it a tell() method, to just return 0. I don't want to have to do that. Any alternative suggestions would be greatly appreciated. Cheers, Alex ---------- components: Extension Modules messages: 130482 nosy: Alex.Leach priority: normal severity: normal status: open title: tarfile with socket incompatability _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 10 06:04:28 2011 From: report at bugs.python.org (Novimir Pablant) Date: Thu, 10 Mar 2011 05:04:28 +0000 Subject: [New-bugs-announce] [issue11459] Python select.select does not correctly report read readyness In-Reply-To: <1299733468.5.0.410115611849.issue11459@psf.upfronthosting.co.za> Message-ID: <1299733468.5.0.410115611849.issue11459@psf.upfronthosting.co.za> New submission from Novimir Pablant : I am trying to get the output from an external program into python using `subprocess.Popen` and `select.select`. For some reason though select.select is at times telling me that stdout is not ready to read, even when it is (reading from it works). This problem exists in python 3.1 & 3.2 but not in python 2.7. For my particular application I am connecting to external program via ssh. I would not expect that the ssh connection would be an issue. The program that I am calling produces some output and eventually asks for user input. In the example below I only get a portion of the output, then at some point select.select tells me that read is not available. If I try to read anyway I can keep getting more output. As soon as I press a key (passing something to stdin), select.select tells me that I can read again and I get the rest of the output. Any ideas? def wrapExternal(host=None): command = ["ssh", "-t", host, "some_program"] child = subprocess.Popen(command ,bufsize=0 ,stdout=subprocess.PIPE ,stderr=subprocess.STDOUT) out = '' while True: r, w, x = select.select([child.stdout], [], [], 1.0) if child.poll() is not None: break if r: out = child.stdout.read(1) print(out.decode(), end='') sys.stdout.flush() return child.returncode ---------- components: Library (Lib) messages: 130488 nosy: amicitas priority: normal severity: normal status: open title: Python select.select does not correctly report read readyness type: behavior versions: Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 10 10:13:18 2011 From: report at bugs.python.org (saradayerramalle) Date: Thu, 10 Mar 2011 09:13:18 +0000 Subject: [New-bugs-announce] [issue11460] Attribute Error In-Reply-To: <1299748398.42.0.872980855635.issue11460@psf.upfronthosting.co.za> Message-ID: <1299748398.42.0.872980855635.issue11460@psf.upfronthosting.co.za> New submission from saradayerramalle : Hi. I am new to Python. I have an ABC.py file in which it has a checkbox. An instance of the "wx.CheckBox" is created with name "chkbox1". Initial value is set and its binded to the "wx.EVT_CHECKBOX" with a function xxx(). Now, I am importing ABC.py to XYZ.py. How to access the event of the checkbox XYZ.py? If i try to access it as ABC.chkbox1.SetVaule(), its giving the error as ""Attribute Error: type object 'ABC' has no attribute 'chkbox1'"". Please help me ASAP. ---------- messages: 130494 nosy: syerrama priority: normal severity: normal status: open title: Attribute Error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 10 11:19:58 2011 From: report at bugs.python.org (Yuriy Pilgun) Date: Thu, 10 Mar 2011 10:19:58 +0000 Subject: [New-bugs-announce] [issue11461] Reading UTF-16 with codecs.readline() breaks on surrogate pairs In-Reply-To: <1299752398.22.0.888282532941.issue11461@psf.upfronthosting.co.za> Message-ID: <1299752398.22.0.888282532941.issue11461@psf.upfronthosting.co.za> New submission from Yuriy Pilgun : Reading UTF-16 text file with module 'codecs' fails, if surrogate pair is located at 72-character boundary. Attached python script fails with message: UnicodeDecodeError: 'utf16' codec can't decode bytes in position 70-71: unexpected end of data The reason is splitting of input data for readline() into chunks, namely readsize = size or 72 ---------- components: Library (Lib), Unicode files: testutf16.py messages: 130498 nosy: ply priority: normal severity: normal status: open title: Reading UTF-16 with codecs.readline() breaks on surrogate pairs type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file21070/testutf16.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 01:55:59 2011 From: report at bugs.python.org (Eugene Toder) Date: Fri, 11 Mar 2011 00:55:59 +0000 Subject: [New-bugs-announce] [issue11462] Peephole creates duplicate and unused constants In-Reply-To: <1299804959.52.0.82978036846.issue11462@psf.upfronthosting.co.za> Message-ID: <1299804959.52.0.82978036846.issue11462@psf.upfronthosting.co.za> New submission from Eugene Toder : Peephole optimizer performs constant folding, however 1) When it replaces operation with LOAD_CONST it always adds a new constant to co_consts, even if constant with the same value is already there. It also can add the same constant multiple times. 2) It does not remove constants that are no longer used after the operation was folded. The result is that code object after folding has more constants that it needs and so uses more memory. Attached are patches to address this. Patch for 1) comes in 2 versions. PlanA is simple (it only needs changes in peephole.c), but does linear searches through co_consts and duplicates some logic from compiler.c. PlanB needs changes in both peephole.c and compiler.c, but is free from such problems. I favour PlanB. Patch for 2) can be applied on top of either A or B. ---------- components: Interpreter Core messages: 130537 nosy: eltoder priority: normal severity: normal status: open title: Peephole creates duplicate and unused constants type: performance versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 03:02:29 2011 From: report at bugs.python.org (=?utf-8?q?Lu=C3=ADs_Ant=C3=B4nio_Ara=C3=BAjo_de_Brito?=) Date: Fri, 11 Mar 2011 02:02:29 +0000 Subject: [New-bugs-announce] [issue11463] IncompleteRead: IncompleteRead(168 bytes read) In-Reply-To: <1299808949.88.0.712644029925.issue11463@psf.upfronthosting.co.za> Message-ID: <1299808949.88.0.712644029925.issue11463@psf.upfronthosting.co.za> New submission from Lu?s Ant?nio Ara?jo de Brito : Hi folks, I have an app that talk with cPanel for create/suspend/unsuspend/kill domaind.. So when I use the urllib2 to get response for cPanel and read it. It show the IncompleteRead except. I get the same URL in a browser and the response is ok. With lib it's broked. The Code Sample ------------------ auth = "WHM my_user:%s" % "HASHHASHHASHHASH" _opener = urllib2.build_opener() _opener.addheaders = [('Authorization', auth)] url = "http://my_cpanel_url/scripts/remote_suspend?user=%s" % "user_on_cpanel_name" try: f = _opener.open(url) except urllib2.HTTPError, e: raise OperationError(e) result = f.read() # <-- IncompleteRead except HERE f.close() print result.strip() ----------------- ---------- messages: 130540 nosy: caitifbrito priority: normal severity: normal status: open title: IncompleteRead: IncompleteRead(168 bytes read) type: resource usage versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 06:52:46 2011 From: report at bugs.python.org (yufun) Date: Fri, 11 Mar 2011 05:52:46 +0000 Subject: [New-bugs-announce] [issue11464] Call Mac API Crash via ctypes In-Reply-To: <1299822766.36.0.452129324753.issue11464@psf.upfronthosting.co.za> Message-ID: <1299822766.36.0.452129324753.issue11464@psf.upfronthosting.co.za> New submission from yufun : appsLib =cdll.LoadLibrary(util.find_library('ApplicationServices')) event = appsLib.CGEventCreate(None); pt = appsLib.CGEventGetLocation(event); Crash after execute above python code. But these code works well in python3.13. ---------- assignee: theller components: ctypes messages: 130546 nosy: heyt1981, theller priority: normal severity: normal status: open title: Call Mac API Crash via ctypes versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 11:04:36 2011 From: report at bugs.python.org (Thomas Guettler) Date: Fri, 11 Mar 2011 10:04:36 +0000 Subject: [New-bugs-announce] [issue11465] Set documentation: Link to wikipedia In-Reply-To: <1299837876.85.0.251184172401.issue11465@psf.upfronthosting.co.za> Message-ID: <1299837876.85.0.251184172401.issue11465@psf.upfronthosting.co.za> New submission from Thomas Guettler : A link from http://docs.python.org/library/stdtypes.html#set.union to http://en.wikipedia.org/wiki/Union_%28set_theory%29 would help young people to understand sets. Of course it is the same for intersection(), difference(), and symmetric_difference(). The images of the wikipedia article explain it very good. ---------- assignee: docs at python components: Documentation messages: 130555 nosy: docs at python, guettli priority: normal severity: normal status: open title: Set documentation: Link to wikipedia versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 12:54:52 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Fri, 11 Mar 2011 11:54:52 +0000 Subject: [New-bugs-announce] [issue11466] getpass.getpass doesn't close tty file In-Reply-To: <1299844492.32.0.259676792362.issue11466@psf.upfronthosting.co.za> Message-ID: <1299844492.32.0.259676792362.issue11466@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : Here is a patch which cures the following ResourceWarning: unclosed file <_io.TextIOWrapper name=3 mode='w+' encoding='UTF-8'> (This only fixes the bug, not the rest of this code...) I did not try it out, but according to some hg cat's this also applies to at least v3.2. ---------- components: Library (Lib) files: getpass_fdclose.patch keywords: patch messages: 130560 nosy: eric.araujo, sdaoden priority: normal severity: normal status: open title: getpass.getpass doesn't close tty file type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21079/getpass_fdclose.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 14:47:42 2011 From: report at bugs.python.org (Bastian Kleineidam) Date: Fri, 11 Mar 2011 13:47:42 +0000 Subject: [New-bugs-announce] [issue11467] urlparse.urlsplit() regression for paths consisting of digits In-Reply-To: <1299851262.1.0.3225912326.issue11467@psf.upfronthosting.co.za> Message-ID: <1299851262.1.0.3225912326.issue11467@psf.upfronthosting.co.za> New submission from Bastian Kleineidam : When using a javascript URL with only digits as paths, the urlsplit() functions behaves different in Python 2.7 than in 2.6: $ python2.6 -c "import urlparse; print urlparse.urlsplit('javascript:123')" SplitResult(scheme='javascript', netloc='', path='123', query='', fragment='') $ python2.7 -c "import urlparse; print urlparse.urlsplit('javascript:123')" SplitResult(scheme='', netloc='', path='javascript:123', query='', fragment='') Python 3.2 has the same regression: $ python3.2 -c "import urllib.parse; print(urllib.parse.urlsplit('javascript:123'))" SplitResult(scheme='', netloc='', path='javascript:123', query='', fragment='') I consider the Python 2.6 behaviour to be correct, ie. the current behaviour is buggy. ---------- components: Library (Lib) messages: 130570 nosy: calvin priority: normal severity: normal status: open title: urlparse.urlsplit() regression for paths consisting of digits type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 19:15:42 2011 From: report at bugs.python.org (Ezio Melotti) Date: Fri, 11 Mar 2011 18:15:42 +0000 Subject: [New-bugs-announce] [issue11468] Improve unittest basic example in the doc In-Reply-To: <1299867342.41.0.388080450116.issue11468@psf.upfronthosting.co.za> Message-ID: <1299867342.41.0.388080450116.issue11468@psf.upfronthosting.co.za> New submission from Ezio Melotti : The current example[0] uses assertTrue(element in self.seq) but it would be better to use assertIn instead. The whole example could be changed to something simpler that uses only the assertTrue/assertEqual/assertRaises methods correctly, e.g.: import unittest class TestStringMethods(unittest.TestCase): def test_upper(self): self.assertEqual('foo'.upper(), 'FOO') def test_isupper(self): self.assertTrue('FOO'.isupper()) self.assertFalse('Foo'.isupper()) def test_split(self): s = 'hello world' self.assertEqual(s.split(), ['hello', 'world']) # check that s.split fails when the separator is not a string with self.assertRaises(TypeError): s.split(2) if __name__ == '__main__': unittest.main() [0]: http://docs.python.org/py3k/library/unittest.html#basic-example ---------- assignee: docs at python components: Documentation keywords: easy messages: 130598 nosy: docs at python, eric.araujo, ezio.melotti, michael.foord, ncoghlan, rhettinger priority: low severity: normal stage: needs patch status: open title: Improve unittest basic example in the doc type: feature request versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 19:51:33 2011 From: report at bugs.python.org (brian.curtin.test) Date: Fri, 11 Mar 2011 18:51:33 +0000 Subject: [New-bugs-announce] [issue11469] Fix resource warning in test_trailers In-Reply-To: <1299869493.16.0.824147350306.issue11469@psf.upfronthosting.co.za> Message-ID: <1299869493.16.0.824147350306.issue11469@psf.upfronthosting.co.za> New submission from brian.curtin.test : There is an unclosed file in test_trailers. Attaching a patch to fix this. ---------- components: Tests files: test_trailers_resourcefix.diff keywords: patch messages: 130602 nosy: brian.curtin.test priority: normal severity: normal status: open title: Fix resource warning in test_trailers type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21084/test_trailers_resourcefix.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 20:22:09 2011 From: report at bugs.python.org (Thomas Wouters) Date: Fri, 11 Mar 2011 19:22:09 +0000 Subject: [New-bugs-announce] [issue11470] Flag inappropriate uses of callable class attributes In-Reply-To: <1299871329.74.0.464645573136.issue11470@psf.upfronthosting.co.za> Message-ID: <1299871329.74.0.464645573136.issue11470@psf.upfronthosting.co.za> New submission from Thomas Wouters : As discussed at the language summit at PyCon 2011, some code takes some liberties with setting class attributes to callable objects, like CFunctions, that (C)Python does not turn into methods. This is problematic because 1) CPython can't then turn that CFunction into a regular function, and 2) other implementations have to specialcase the builtins to emulate the behaviour. This patch adds a warning when a non-descriptor, non-class callable attribute is accessed in a context that would have fired the descriptor. It also fixes a bunch of these warnings that show up when running the testsuite. Some of these warnings are obviously (to me) incorrect code -- like the io testsuite, which uses staticmethod around pyio.open but not io.open, or the encoding classes that use an encode function from an extension module as a class attribute. Some of the warnings are debatable, but have an obvious fix (wrap in staticmethod.) Some could be considered false-positives because they actually use (what amounts to) a a bound instance method as a class attribute (for example, re.compile('...').match.) The patch is still a work in progress, I'm just uploading to start the discussion sooner rather than later. ---------- components: Interpreter Core files: nonmethod-warn.diff keywords: patch messages: 130606 nosy: twouters priority: normal severity: normal status: open title: Flag inappropriate uses of callable class attributes type: feature request versions: Python 3.3 Added file: http://bugs.python.org/file21085/nonmethod-warn.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 22:49:16 2011 From: report at bugs.python.org (Eugene Toder) Date: Fri, 11 Mar 2011 21:49:16 +0000 Subject: [New-bugs-announce] [issue11471] If without else generates redundant jump In-Reply-To: <1299880156.4.0.0999870554397.issue11471@psf.upfronthosting.co.za> Message-ID: <1299880156.4.0.0999870554397.issue11471@psf.upfronthosting.co.za> New submission from Eugene Toder : If statement without else part generates unnecessary JUMP_FORWARD insn with jumps right to the next insn: >>> def foo(x): if x: x = 1 >>> dis(foo) 2 0 LOAD_FAST 0 (x) 3 POP_JUMP_IF_FALSE 15 6 LOAD_CONST 1 (1) 9 STORE_FAST 0 (x) 12 JUMP_FORWARD 0 (to 15) >> 15 LOAD_CONST 0 (None) 18 RETURN_VALUE This patch suppresses generation of this jump. Testing revealed another issue: when AST is produced from string empty 'orelse' sequences are represented with NULLs. However when AST is converted from Python AST objects empty 'orelse' is a pointer to 0-length sequence. I've changed this to produce NULL pointers, like in the string case. This uses less memory and doesn't introduce different code path in compiler. Without this change test_compile failed with my first change. make test passes. ---------- components: Interpreter Core files: if_no_else.patch keywords: patch messages: 130623 nosy: eltoder priority: normal severity: normal status: open title: If without else generates redundant jump type: performance versions: Python 3.3 Added file: http://bugs.python.org/file21091/if_no_else.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 23:27:09 2011 From: report at bugs.python.org (Jason R. Coombs) Date: Fri, 11 Mar 2011 22:27:09 +0000 Subject: [New-bugs-announce] [issue11472] upload command fails to read auth information from .pypirc In-Reply-To: <1299882429.66.0.49580074551.issue11472@psf.upfronthosting.co.za> Message-ID: <1299882429.66.0.49580074551.issue11472@psf.upfronthosting.co.za> New submission from Jason R. Coombs : It appears that distutils isn't loading the authentication information from .pypirc. I ran this test on Python 3.2 64-bit on Windows. PS C:\Users\jaraco\projects\hgtools> python -m pdb setup.py sdist upload > c:\users\jaraco\projects\hgtools\setup.py(7)() -> """ (Pdb) b distutils/command/upload.py:179 Breakpoint 1 at c:\python\lib\distutils\command\upload.py:179 (Pdb) c running sdist running egg_info # lines elided Writing hgtools-1.0b1\setup.cfg creating 'dist\hgtools-1.0b1.zip' and adding 'hgtools-1.0b1' to it adding 'hgtools-1.0b1\.hgignore' # lines elided removing 'hgtools-1.0b1' (and everything under it) running upload Submitting dist\hgtools-1.0b1.zip to http://pypi.python.org/pypi > c:\python\lib\distutils\command\upload.py(179)upload_file() -> loglevel = log.INFO (Pdb) auth 'Basic Og==' (Pdb) user_pass b':' (Pdb) c Upload failed (401): You must be identified to edit package information The program finished and will be restarted > c:\users\jaraco\projects\hgtools\setup.py(7)() I have a valid .pypirc that works in Python 2.7: C:\Users\jaraco\projects\hgtools> cat C:\Users\jaraco\.pypirc [server-login] username=jason.coombs password=omitted [distutils] index-servers = pypi [pypi] username: jaraco password: omitted I tried adding repository=http://www.python.org/pypi in [pypi], or supplying -r http://www.python.org/pypi, but that had no effect. I tried adding -r pypi, but that elicited a new error. ---------- assignee: tarek components: Distutils messages: 130633 nosy: eric.araujo, jaraco, tarek priority: normal severity: normal status: open title: upload command fails to read auth information from .pypirc versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 11 23:31:57 2011 From: report at bugs.python.org (Jason R. Coombs) Date: Fri, 11 Mar 2011 22:31:57 +0000 Subject: [New-bugs-announce] [issue11473] upload command no longer accepts repository by section name In-Reply-To: <1299882717.19.0.490703720004.issue11473@psf.upfronthosting.co.za> Message-ID: <1299882717.19.0.490703720004.issue11473@psf.upfronthosting.co.za> New submission from Jason R. Coombs : It appears that with Python 3.2 (Windows 64-bit), the distutils upload -r command no longer accepts the repository section name, but instead only attempts to parse it as a URL. This is a regression from Python 2.7. PS C:\Users\jaraco\projects\hgtools> python -m pdb setup.py sdist upload -r pypi > c:\users\jaraco\projects\hgtools\setup.py(7)() -> """ (Pdb) c running sdist running egg_info # lines elided running upload Submitting dist\hgtools-1.0b1.zip to pypi Traceback (most recent call last): File "c:\python\lib\pdb.py", line 1556, in main pdb._runscript(mainpyfile) File "c:\python\lib\pdb.py", line 1437, in _runscript self.run(statement) File "c:\python\lib\bdb.py", line 392, in run exec(cmd, globals, locals) File "", line 1, in File "c:\users\jaraco\projects\hgtools\setup.py", line 7, in """ File "c:\python\lib\distutils\core.py", line 149, in setup dist.run_commands() File "c:\python\lib\distutils\dist.py", line 919, in run_commands self.run_command(cmd) File "c:\python\lib\distutils\dist.py", line 938, in run_command cmd_obj.run() File "c:\python\lib\distutils\command\upload.py", line 66, in run self.upload_file(command, pyversion, filename) File "c:\python\lib\distutils\command\upload.py", line 176, in upload_file raise AssertionError("unsupported schema "+schema) AssertionError: unsupported schema Uncaught exception. Entering post mortem debugging Running 'cont' or 'step' will restart the program > c:\python\lib\distutils\command\upload.py(176)upload_file() -> raise AssertionError("unsupported schema "+schema) (Pdb) self.repository 'pypi' (Pdb) schema '' (Pdb) q ---------- assignee: tarek components: Distutils messages: 130635 nosy: eric.araujo, jaraco, tarek priority: normal severity: normal status: open title: upload command no longer accepts repository by section name _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 12 16:30:23 2011 From: report at bugs.python.org (Bastian Kleineidam) Date: Sat, 12 Mar 2011 15:30:23 +0000 Subject: [New-bugs-announce] [issue11474] url2pathname() handling of '/C|/' on Windows In-Reply-To: <1299943823.36.0.437320049664.issue11474@psf.upfronthosting.co.za> Message-ID: <1299943823.36.0.437320049664.issue11474@psf.upfronthosting.co.za> New submission from Bastian Kleineidam : Python 2.7 on Windows converts the URL path '/C|/' to a naked drive letter 'C:'. C:\src>c:\Python27\python.exe -c "import urllib;print urllib.url2pathname('/C|/')" C: C:\src> Expected and I believe the correct output would be C:\, not C:. Reason is that a naked drive letter C: means "current directory in drive C:", whereas C:\ means "root directory in drive C:". So if you happen to start your application in "C:\src" for example, the output "C:" is interpreted as "C:\src", not as "C:\". ---------- components: Library (Lib) messages: 130684 nosy: calvin priority: normal severity: normal status: open title: url2pathname() handling of '/C|/' on Windows versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 12 17:52:32 2011 From: report at bugs.python.org (MATSUI Tetsushi) Date: Sat, 12 Mar 2011 16:52:32 +0000 Subject: [New-bugs-announce] [issue11475] trunc in documentation of numbers.Real should math.trunc In-Reply-To: <1299948752.38.0.816571509541.issue11475@psf.upfronthosting.co.za> Message-ID: <1299948752.38.0.816571509541.issue11475@psf.upfronthosting.co.za> New submission from MATSUI Tetsushi : In the documentation of numbers.Real: "In short, those are: a conversion to float, trunc(), round(), math.floor(), math.ceil(), divmod(), //, %, <, <=, >, and >=." where only "trunc" is not linked if we look at it in html pages. This is because the function trunc is not in built-in namespace, but in math module. So we should call it math.trunc similarly to math.floor, etc. ---------- assignee: docs at python components: Documentation messages: 130690 nosy: docs at python, mft priority: normal severity: normal status: open title: trunc in documentation of numbers.Real should math.trunc versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 12 18:12:48 2011 From: report at bugs.python.org (follower) Date: Sat, 12 Mar 2011 17:12:48 +0000 Subject: [New-bugs-announce] [issue11476] StreamHandler code broken by change of parameter name In-Reply-To: <1299949968.72.0.952611916951.issue11476@psf.upfronthosting.co.za> Message-ID: <1299949968.72.0.952611916951.issue11476@psf.upfronthosting.co.za> New submission from follower : The following change broke pre-existing code that used "strm" as the parameter name (as documented http://docs.python.org/release/2.6.6/library/logging.html#streamhandler): http://hg.python.org/cpython/diff/7391436d8a74/Lib/logging/__init__.py The parameter name was changed with no documentation note that it had changed in 2.7: http://docs.python.org/library/logging.html#stream-handler This breaks existing code with the error: TypeError: __init__() got an unexpected keyword argument 'strm' I encountered it in pyres but it broke Ubuntu bug reporting too: https://bugs.launchpad.net/ubuntu/+source/launchpad-integration/+bug/702455 ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 130691 nosy: docs at python, follower priority: normal severity: normal status: open title: StreamHandler code broken by change of parameter name type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 12 22:24:51 2011 From: report at bugs.python.org (Terry J. Reedy) Date: Sat, 12 Mar 2011 21:24:51 +0000 Subject: [New-bugs-announce] [issue11477] Bug in code dispatching based on internal slots In-Reply-To: <1299965091.63.0.267715976543.issue11477@psf.upfronthosting.co.za> Message-ID: <1299965091.63.0.267715976543.issue11477@psf.upfronthosting.co.za> New submission from Terry J. Reedy : Example (which can serve as testcase with buggy output corrected). class C(object): def __iter__(self): yield 'yes!' def __radd__(self, other): other.append('bug!') return other def __rmul__(self, other): other *= 2 return other def __index__(self): return 3 class L(list): def __iadd__(self, other): list.__iadd__(self,other) return self def __mul__(self, other): return L(list.__imul__(self,other)) z1, z2, c = [], L(), C() z1 += c z2 += c print(z1, z2, [1]*c, L([1])*c) >>> ['bug!'] ['yes!'] [1, 1] [1, 1, 1] # PyPy prints ['yes!'], [1, 1, 1] Cause was diagnosed by Greg Price in http://codespeak.net/pipermail/pypy-dev/2011q1/006958.html as checking forward and reverse numeric slots before checking sequence slots for C-coded classes. Such a difference does not exist in Python itself. In "About raising NotPortableWarning for CPython specific code" pydev thread starting at http://codespeak.net/pipermail/pypy-dev/2011q1/006958.html Nick Coghlin identified the fix as "When a given operation has multiple C level slots, shouldn't we be checking all the LHS slots before checking any of the RHS slots?" Guido replied "Yeah, indeed, on everything you said. The code dispatching based on internal slots is horribly ad-hoc and likely wrong in subtle ways." I personally think fix should be backported to 2.7 and 3.2, but did not select them because that may be controversial. ---------- components: Interpreter Core messages: 130698 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: Bug in code dispatching based on internal slots type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 03:44:48 2011 From: report at bugs.python.org (Thomas Wouters) Date: Sun, 13 Mar 2011 02:44:48 +0000 Subject: [New-bugs-announce] [issue11478] Docs list nonexistant PyObject_CopyToData function In-Reply-To: <1299984288.28.0.0947094207419.issue11478@psf.upfronthosting.co.za> Message-ID: <1299984288.28.0.0947094207419.issue11478@psf.upfronthosting.co.za> New submission from Thomas Wouters : The buffer docs on http://docs.python.org/c-api/buffer.html list PyObject_CopyToData, but no such function seems to exist. ---------- assignee: docs at python components: Documentation messages: 130717 nosy: docs at python, twouters priority: normal severity: normal status: open title: Docs list nonexistant PyObject_CopyToData function _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 04:10:03 2011 From: report at bugs.python.org (R. David Murray) Date: Sun, 13 Mar 2011 03:10:03 +0000 Subject: [New-bugs-announce] [issue11479] Add discussion of trailing slash in raw string to tutorial In-Reply-To: <1299985803.24.0.199507309731.issue11479@psf.upfronthosting.co.za> Message-ID: <1299985803.24.0.199507309731.issue11479@psf.upfronthosting.co.za> New submission from R. David Murray : Here is a proposed addition to the tutorial noting the problem with using raw strings for windows paths and how to work around it. ---------- assignee: docs at python components: Documentation files: tutorial-raw-string.patch keywords: patch messages: 130720 nosy: QuantumTim, docs at python, facundobatista, georg.brandl, gwideman, r.david.murray, v+python priority: normal severity: normal stage: patch review status: open title: Add discussion of trailing slash in raw string to tutorial type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21097/tutorial-raw-string.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 10:04:20 2011 From: report at bugs.python.org (Daniel Urban) Date: Sun, 13 Mar 2011 09:04:20 +0000 Subject: [New-bugs-announce] [issue11480] Cannot copy a class with a metaclass other than type In-Reply-To: <1300007060.0.0.461224143225.issue11480@psf.upfronthosting.co.za> Message-ID: <1300007060.0.0.461224143225.issue11480@psf.upfronthosting.co.za> New submission from Daniel Urban : copy.copy cannot copy a class which have a metaclass other than type: >>> import abc >>> import copy >>> >>> class C(metaclass=abc.ABCMeta): ... pass ... >>> copy.copy(C) Traceback (most recent call last): ... TypeError: can't pickle int objects The reason seems to be, as described in msg8329 (issue494904) that the __reduce_ex__ function inherited from object will be called instead of the method bound to the class object (that's the reason of the strange error message). (See also issue7689.) The interesting thing is, that copy.deepcopy was already fixed in 4680ef4fe90a. I'm attaching a patch, that does basically the same for copy that was done with deepcopy (it also includes a test). ---------- components: Library (Lib) files: copy_metaclass.patch keywords: patch messages: 130731 nosy: durban priority: normal severity: normal status: open title: Cannot copy a class with a metaclass other than type type: behavior versions: Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21100/copy_metaclass.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 10:47:50 2011 From: report at bugs.python.org (Daniel Urban) Date: Sun, 13 Mar 2011 09:47:50 +0000 Subject: [New-bugs-announce] [issue11481] The copy module already uses copyreg In-Reply-To: <1300009670.98.0.0546201477777.issue11481@psf.upfronthosting.co.za> Message-ID: <1300009670.98.0.0546201477777.issue11481@psf.upfronthosting.co.za> New submission from Daniel Urban : In the copyreg documentation there is this sentence: "The copy module is likely to use this in the future as well." (http://docs.python.org/dev/py3k/library/copyreg) But the copy module already uses the copyreg module. ---------- assignee: docs at python components: Documentation messages: 130732 nosy: docs at python, durban priority: normal severity: normal status: open title: The copy module already uses copyreg versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 11:04:34 2011 From: report at bugs.python.org (Lu Feng) Date: Sun, 13 Mar 2011 10:04:34 +0000 Subject: [New-bugs-announce] [issue11482] Float Plus Error In-Reply-To: <1300010674.9.0.974387122856.issue11482@psf.upfronthosting.co.za> Message-ID: <1300010674.9.0.974387122856.issue11482@psf.upfronthosting.co.za> New submission from Lu Feng : Run 1.1 + 3.2, result is 4.300000000000001 And when Run [x * 0.1 for x in range(0, 10)], the result is [0.0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5, 0.6000000000000001, 0.7000000000000001, 0.8, 0.9] ---------- messages: 130734 nosy: lufengxa at gmail.com priority: normal severity: normal status: open title: Float Plus Error versions: Python 2.5, Python 2.6, Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 13:37:02 2011 From: report at bugs.python.org (nw) Date: Sun, 13 Mar 2011 12:37:02 +0000 Subject: [New-bugs-announce] [issue11483] python fails to follow symlinks on windows In-Reply-To: <1300019822.58.0.0683421948663.issue11483@psf.upfronthosting.co.za> Message-ID: <1300019822.58.0.0683421948663.issue11483@psf.upfronthosting.co.za> New submission from nw : Go to C:/Python2.7/Lib create directory foo + __init__.py Make a symlink: mklink /D bar foo. Start Python. import foo # works import bar # fails (no module named bar) ---------- components: Windows messages: 130740 nosy: nw priority: normal severity: normal status: open title: python fails to follow symlinks on windows versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 21:17:52 2011 From: report at bugs.python.org (Jonas H.) Date: Sun, 13 Mar 2011 20:17:52 +0000 Subject: [New-bugs-announce] [issue11484] `with_traceback` in 2.7 docs but not implemented In-Reply-To: <1300047472.09.0.42501037917.issue11484@psf.upfronthosting.co.za> Message-ID: <1300047472.09.0.42501037917.issue11484@psf.upfronthosting.co.za> New submission from Jonas H. : Either a `BaseException.with_traceback` implementation is missing or the docs are wrong. http://docs.python.org/library/exceptions.html?highlight=with_traceback#exceptions.BaseException.with_traceback python3 -c 'print("with_traceback" in dir(BaseException))' True python2 -c 'print("with_traceback" in dir(BaseException))' False ---------- assignee: docs at python components: Documentation messages: 130760 nosy: docs at python, jonash priority: normal severity: normal status: open title: `with_traceback` in 2.7 docs but not implemented versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 22:28:16 2011 From: report at bugs.python.org (Ronald Oussoren) Date: Sun, 13 Mar 2011 21:28:16 +0000 Subject: [New-bugs-announce] [issue11485] Default SDK value on MacOSX needs changing In-Reply-To: <1300051696.43.0.599185291628.issue11485@psf.upfronthosting.co.za> Message-ID: <1300051696.43.0.599185291628.issue11485@psf.upfronthosting.co.za> New submission from Ronald Oussoren : (based on the fruitfull meating I had with Ned after the language summit at Pycon '11) Running configure on a MacOSX system will set MACOSX_DEPLOYMENT_TARGET to 10.4, which is probably not optimal for anyone on a recentish system. It would be better to set the deployment target to something more recent. There seem to be two options: * set the deployment target to the current OS release by default (that is, 10.6 on a Snow Leopard system, 10.4 on a Tiger system) * set the deployment target to 10.4 on OSX 10.4 and 10.5 on later versions. Setting it to the version of the current OS is probably the least surprising. Related to this: configure --enable-universalsdk selects the 10.4u SDK by default. That would have to be changed at the same time, setting the deployment target to 10.6 while still trying to use files from the 10.4u SDK is not very useful. I'd set the default value of the SDK to '/' on anything newer than OSX 10.4 and keep the 10.4u SDK on OSX 10.4 (because you cannot build universal binaries using the default system headers on a lot of 10.4 systems). I'll work on a patch for the default branch during the sprints, and interesting question is if this should be backported. ---------- assignee: ronaldoussoren components: Build, Macintosh messages: 130764 nosy: ned.deily, ronaldoussoren priority: normal severity: normal stage: needs patch status: open title: Default SDK value on MacOSX needs changing type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 22:32:21 2011 From: report at bugs.python.org (Ronald Oussoren) Date: Sun, 13 Mar 2011 21:32:21 +0000 Subject: [New-bugs-announce] [issue11486] Add option to not install into /Applications In-Reply-To: <1300051941.49.0.427500618783.issue11486@psf.upfronthosting.co.za> Message-ID: <1300051941.49.0.427500618783.issue11486@psf.upfronthosting.co.za> New submission from Ronald Oussoren : It would be nice if it were possible to install a framework installation from source without also installing files into /Applications. This could be done by adding an option to configure --without-macosx-applications. The primairy usecase for this is development: I have a rather large set of Python frameworks on my machine with different build options and all of those install a copy of of IDLE and other application bundles into /Applications. ---------- assignee: ronaldoussoren components: Build, Macintosh messages: 130765 nosy: ned.deily, ronaldoussoren priority: normal severity: normal stage: needs patch status: open title: Add option to not install into /Applications type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 13 23:02:56 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Sun, 13 Mar 2011 22:02:56 +0000 Subject: [New-bugs-announce] [issue11487] build_installer.py should avoid relying on a young Python In-Reply-To: <1300053776.08.0.54704271531.issue11487@psf.upfronthosting.co.za> Message-ID: <1300053776.08.0.54704271531.issue11487@psf.upfronthosting.co.za> New submission from Antoine Pitrou : There was this failure in the daily DMG builder: http://www.python.org/dev/buildbot/all/builders/3.x.dmg/builds/423/steps/compile/logs/stdio The problem is that asdl_c.py gets run by the Makefile with the standard Python, which on this machine is 2.3.5 (according to David). The easy solution would be to freshen the timestamps of Include/Python-ast.* in build_installer.py. ---------- assignee: ronaldoussoren components: Build, Macintosh keywords: buildbot messages: 130766 nosy: db3l, ned.deily, pitrou, ronaldoussoren priority: low severity: normal status: open title: build_installer.py should avoid relying on a young Python type: compile error versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 00:08:07 2011 From: report at bugs.python.org (ev) Date: Sun, 13 Mar 2011 23:08:07 +0000 Subject: [New-bugs-announce] [issue11488] Add writelines test coverage in tempfile In-Reply-To: <1300057687.18.0.251649532354.issue11488@psf.upfronthosting.co.za> Message-ID: <1300057687.18.0.251649532354.issue11488@psf.upfronthosting.co.za> New submission from ev : Ran coverage.py and noticed that writelines had no coverage in tempfile, so I added it in. ---------- components: Tests files: test_tempfile_writelines.patch keywords: patch messages: 130778 nosy: brian.curtin, ev, georg.brandl priority: normal severity: normal status: open title: Add writelines test coverage in tempfile type: behavior Added file: http://bugs.python.org/file21106/test_tempfile_writelines.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 00:17:20 2011 From: report at bugs.python.org (Brian Merrell) Date: Sun, 13 Mar 2011 23:17:20 +0000 Subject: [New-bugs-announce] [issue11489] json.dumps not parsable by json.loads (on Linux only) In-Reply-To: <1300058240.59.0.513243746739.issue11489@psf.upfronthosting.co.za> Message-ID: <1300058240.59.0.513243746739.issue11489@psf.upfronthosting.co.za> New submission from Brian Merrell : The following works on Win7x64 Python 2.6.5 and breaks on Ubuntu 10.04x64-2.6.5. This raises three issues: 1) Shouldn't anything generated by json.dumps be parsed by json.loads? 2) It appears this is an invalid unicode character. Shouldn't this be caught by decode("utf8") 3) Why does Windows raise no issue with this and Linux does? import json unicode_bytes = '\xed\xa8\x80' unicode_string = unicode_bytes.decode("utf8") json_encoded = json.dumps("my_key":unicode_string) json.loads(json_encoded) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/json/__init__.py", line 307, in loads return _default_decoder.decode(s) File "/usr/lib/python2.6/json/decoder.py", line 319, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.6/json/decoder.py", line 336, in raw_decode obj, end = self._scanner.iterscan(s, **kw).next() File "/usr/lib/python2.6/json/scanner.py", line 55, in iterscan rval, next_pos = action(m, context) File "/usr/lib/python2.6/json/decoder.py", line 183, in JSONObject value, end = iterscan(s, idx=end, context=context).next() File "/usr/lib/python2.6/json/scanner.py", line 55, in iterscan rval, next_pos = action(m, context) File "/usr/lib/python2.6/json/decoder.py", line 155, in JSONString return scanstring(match.string, match.end(), encoding, strict) ValueError: Invalid \uXXXX escape: line 1 column 14 (char 14) ---------- components: Library (Lib), Unicode, Windows messages: 130779 nosy: Brian.Merrell priority: normal severity: normal status: open title: json.dumps not parsable by json.loads (on Linux only) type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 02:49:22 2011 From: report at bugs.python.org (R. David Murray) Date: Mon, 14 Mar 2011 01:49:22 +0000 Subject: [New-bugs-announce] [issue11490] subprocess test_leaking_fds_on_error fails if last directory in path is not accessible In-Reply-To: <1300067362.71.0.164097383701.issue11490@psf.upfronthosting.co.za> Message-ID: <1300067362.71.0.164097383701.issue11490@psf.upfronthosting.co.za> New submission from R. David Murray : test_subprocess was failing for me on my laptop, and my laptop only. With some guidance from haypo on using strace, I tracked the problem down to the fact that the last directory in my path is a directory to which I don't have permission. So the error subprocess was getting from trying to access the non-existent file was "permission denied" (errno 13) instead of not found (errno 2). It is possible this is an error in subprocess as well, since the shell, for example, returns command not found in that case. But I don't think that it is, since I think the errno is being returned by the exec call. So, I think the test just needs to be changed to ignore errno 13 as well (by name, of course). ---------- components: Tests keywords: easy messages: 130784 nosy: r.david.murray priority: low severity: normal stage: needs patch status: open title: subprocess test_leaking_fds_on_error fails if last directory in path is not accessible type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 07:42:42 2011 From: report at bugs.python.org (Denver Coneybeare) Date: Mon, 14 Mar 2011 06:42:42 +0000 Subject: [New-bugs-announce] [issue11491] dbm.open(..., flag="n") raises dbm.error if file exists and is rejected by whichdb In-Reply-To: <1300084962.92.0.477782999731.issue11491@psf.upfronthosting.co.za> Message-ID: <1300084962.92.0.477782999731.issue11491@psf.upfronthosting.co.za> New submission from Denver Coneybeare : dbm.open() with flag="n" raises dbm.error if the given file exists but whichdb doesn't recognize it. In the documentation for dbm.open() the "n" flag is documented to "Always create a new, empty database, open for reading and writing". To me, this implies that if the file exists it will unconditionally be overwritten with a newly-created database, irrespective of its contents. The code below illustrates a scenario (and indeed the scenario that I ran into) where dbm.open(..., flag="n") will throw dbm.error when it should just blow away the existing file and create a new, empty database: import dbm open("test.db", "w").close() # create empty file dbm.open("test.db", flag="n") The cause of the exception is that within dbm.open() there is a call to whichdb to determine the file type. The fix would be to skip this whichdb check if the "n" flag is specified. I don't think that this change will cause backward compatibility issues, since I find it hard to believe that existing applications would rely on this exception being raised in this scenario. However, to *guarantee* no compatibility break an alternate fix could leave the current behavior of the "n" flag and introduce a new flag, perhaps "o" for "overwrite", with this "unconditional overwrite" behavior. A proposed patch is attached: dbm_open_n_flag_error_invalid_file_fix_v1.patch ---------- components: Library (Lib) files: dbm_open_n_flag_error_invalid_file_fix_v1.patch keywords: patch messages: 130791 nosy: denversc priority: normal severity: normal status: open title: dbm.open(..., flag="n") raises dbm.error if file exists and is rejected by whichdb type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21108/dbm_open_n_flag_error_invalid_file_fix_v1.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 08:32:58 2011 From: report at bugs.python.org (Scott Kitterman) Date: Mon, 14 Mar 2011 07:32:58 +0000 Subject: [New-bugs-announce] [issue11492] email.header.Header doesn't fold headers In-Reply-To: <1300087978.39.0.703069545984.issue11492@psf.upfronthosting.co.za> Message-ID: <1300087978.39.0.703069545984.issue11492@psf.upfronthosting.co.za> New submission from Scott Kitterman : Header folding is very different (non-existent as far as I've found so far) in Python3. Here's a short example: #!/usr/bin/python # -*- coding: ISO-8859-1 from email.header import Header hdrin = 'Received: from mailout00.controlledmail.com (mailout00.controlledmail.com [72.81.252.19]) by mailwash7.pair.com (Postfix) with ESMTP id 16BB5BAD5 for ; Sun, 13 Mar 2011 23:46:05 -0400 (EDT)' print(Header(hdrin)) With python2.6 the output is: Received: from mailout00.controlledmail.com (mailout00.controlledmail.com [72.81.252.19]) by mailwash7.pair.com (Postfix) with ESMTP id 16BB5BAD5 for ; Sun, 13 Mar 2011 23:46:05 -0400 (EDT) With python3.1 or 3.2 the output is one line: Received: from mailout00.controlledmail.com (mailout00.controlledmail.com [72.81.252.19]) by mailwash7.pair.com (Postfix) with ESMTP id 16BB5BAD5 for ; Sun, 13 Mar 2011 23:46:05 -0400 (EDT) This makes it very difficult to write header processing code that works for both Python2 and Python3 even if one can fold headers at all in Python3. ---------- components: None messages: 130793 nosy: kitterma priority: normal severity: normal status: open title: email.header.Header doesn't fold headers _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 08:38:22 2011 From: report at bugs.python.org (Santoso Wijaya) Date: Mon, 14 Mar 2011 07:38:22 +0000 Subject: [New-bugs-announce] [issue11493] Add python.exe-gdb.py to .hgignore In-Reply-To: <1300088302.91.0.551103844028.issue11493@psf.upfronthosting.co.za> Message-ID: <1300088302.91.0.551103844028.issue11493@psf.upfronthosting.co.za> New submission from Santoso Wijaya : The 3.x branch has python.exe-gdb.py entry in its .hgignore file, but the 2.7 branch does not. Can we please add it? ---------- components: Build files: gdbignore.patch keywords: patch messages: 130794 nosy: santa4nt priority: normal severity: normal status: open title: Add python.exe-gdb.py to .hgignore versions: Python 2.7 Added file: http://bugs.python.org/file21109/gdbignore.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 11:47:52 2011 From: report at bugs.python.org (Gerrit Holl) Date: Mon, 14 Mar 2011 10:47:52 +0000 Subject: [New-bugs-announce] [issue11494] Confusing error message from warnings.warn In-Reply-To: <1300099672.81.0.525272322656.issue11494@psf.upfronthosting.co.za> Message-ID: <1300099672.81.0.525272322656.issue11494@psf.upfronthosting.co.za> New submission from Gerrit Holl : When accidentally passing a string to warnings.warn where one should pass a Warning-class, the error message is rather confusing: $ ./python Python 2.7.1+ (release27-maint:88766, Mar 8 2011, 16:51:59) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import warnings >>> warnings.warn("aaa", "bbb") Traceback (most recent call last): File "", line 1, in TypeError: issubclass() arg 1 must be a class It would be better for the error message to say TypeError: warnings must be classes inherited from ... or something like that. ---------- components: Interpreter Core, Library (Lib) messages: 130800 nosy: Gerrit.Holl priority: normal severity: normal status: open title: Confusing error message from warnings.warn type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 13:57:05 2011 From: report at bugs.python.org (=?utf-8?b?SmVzw7pzIENlYSBBdmnDs24=?=) Date: Mon, 14 Mar 2011 12:57:05 +0000 Subject: [New-bugs-announce] [issue11495] Remove OSF support completelly In-Reply-To: <1300107425.29.0.800437634415.issue11495@psf.upfronthosting.co.za> Message-ID: <1300107425.29.0.800437634415.issue11495@psf.upfronthosting.co.za> New submission from Jes?s Cea Avi?n : OSF was deprecated in Python 3.2, following the PEP11. Now we must delete the support completelly for python 3.3. ---------- assignee: jcea messages: 130804 nosy: jcea priority: normal severity: normal stage: needs patch status: open title: Remove OSF support completelly versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 15:33:14 2011 From: report at bugs.python.org (Natalia B. Bidart) Date: Mon, 14 Mar 2011 14:33:14 +0000 Subject: [New-bugs-announce] [issue11496] test_readline fails when readline was installed after running configure (and was not re-run) In-Reply-To: <1300113194.23.0.0786902583175.issue11496@psf.upfronthosting.co.za> Message-ID: <1300113194.23.0.0786902583175.issue11496@psf.upfronthosting.co.za> New submission from Natalia B. Bidart : If libreadline-dev was installed after configure was run, and the latter is not re-run, test_readline fails with: [1/1] test_readline test test_readline failed -- Traceback (most recent call last): File "/home/nessita/pycon/sprint/cpython/Lib/test/test_readline.py", line 16, in testHistoryUpdates readline.clear_history() AttributeError: 'module' object has no attribute 'clear_history' 1 test failed: test_readline ---------- components: Tests messages: 130817 nosy: nessita priority: normal severity: normal status: open title: test_readline fails when readline was installed after running configure (and was not re-run) type: crash versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 15:38:48 2011 From: report at bugs.python.org (Matias Bordese) Date: Mon, 14 Mar 2011 14:38:48 +0000 Subject: [New-bugs-announce] [issue11497] Devguide: re-run configure in Unix setup step after installing deps In-Reply-To: <1300113528.98.0.0552782381076.issue11497@psf.upfronthosting.co.za> Message-ID: <1300113528.98.0.0552782381076.issue11497@psf.upfronthosting.co.za> New submission from Matias Bordese : When setting up dev environment in Unix and there are missing dependencies after running make, you may need to re-run configure before a new make (relates to #11496). ---------- assignee: docs at python components: Documentation messages: 130820 nosy: docs at python, matiasb priority: normal severity: normal status: open title: Devguide: re-run configure in Unix setup step after installing deps type: resource usage _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 16:39:46 2011 From: report at bugs.python.org (Natalia B. Bidart) Date: Mon, 14 Mar 2011 15:39:46 +0000 Subject: [New-bugs-announce] [issue11498] test_zipfile.test_unicode_filenames should be skipped of no zlib In-Reply-To: <1300117186.88.0.720141947876.issue11498@psf.upfronthosting.co.za> Message-ID: <1300117186.88.0.720141947876.issue11498@psf.upfronthosting.co.za> New submission from Natalia B. Bidart : When running the test suite, if zlib is not available, we get this failure: [1/1] test_zipfile test test_zipfile failed -- Traceback (most recent call last): File "/home/nessita/pycon/sprint/cpython/Lib/test/test_zipfile.py", line 498, in test_unicode_filenames zipfp.open(name).close() File "/home/nessita/pycon/sprint/cpython/Lib/zipfile.py", line 978, in open close_fileobj=not self._filePassed) File "/home/nessita/pycon/sprint/cpython/Lib/zipfile.py", line 487, in __init__ self._decompressor = zlib.decompressobj(-15) AttributeError: 'NoneType' object has no attribute 'decompressobj' 1 test failed: test_zipfile ---------- components: Tests messages: 130831 nosy: nessita priority: normal severity: normal status: open title: test_zipfile.test_unicode_filenames should be skipped of no zlib type: crash versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 17:00:35 2011 From: report at bugs.python.org (Jason R. Coombs) Date: Mon, 14 Mar 2011 16:00:35 +0000 Subject: [New-bugs-announce] [issue11499] reassignment to bool is left in the file In-Reply-To: <1300118435.38.0.980268462188.issue11499@psf.upfronthosting.co.za> Message-ID: <1300118435.38.0.980268462188.issue11499@psf.upfronthosting.co.za> New submission from Jason R. Coombs : Consider the Python file #!python True = 1 False = 0 The 2to3 script returns an empty diff for this file. These lines (especially when the values are canonical), are clearly for backward compatibility to early Python 2.x editions (2.2.1 and earlier). These statements cause an error in Python 3. It would be nice if 2to3 could either remove these lines or log a warning. ---------- components: 2to3 (2.x to 3.0 conversion tool) messages: 130838 nosy: jaraco priority: normal severity: normal status: open title: reassignment to bool is left in the file type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 17:07:18 2011 From: report at bugs.python.org (Scott Wilson) Date: Mon, 14 Mar 2011 16:07:18 +0000 Subject: [New-bugs-announce] [issue11500] Fixes failing urllib2 proxy tests on OSX In-Reply-To: <1300118838.46.0.0361667974376.issue11500@psf.upfronthosting.co.za> Message-ID: <1300118838.46.0.0361667974376.issue11500@psf.upfronthosting.co.za> New submission from Scott Wilson : Fixes a bug in the os x proxy bypass code for fully qualified IP addresses in the proxy exception list. Tests that fail on os x without this patch: test_urllib2.HandlerTests.test_proxy_https test_urllib2.HandlerTests.test_proxy_https_proxy_authorization Will create a separate issue to improve test coverage in this area. ---------- assignee: ronaldoussoren components: Macintosh files: proxy_bypass_osx.diff keywords: patch messages: 130841 nosy: ronaldoussoren, rswilson priority: normal severity: normal status: open title: Fixes failing urllib2 proxy tests on OSX versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21120/proxy_bypass_osx.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 17:19:38 2011 From: report at bugs.python.org (Natalia B. Bidart) Date: Mon, 14 Mar 2011 16:19:38 +0000 Subject: [New-bugs-announce] [issue11501] distutils.archive_util should handle absence of zlib module In-Reply-To: <1300119578.93.0.647722087652.issue11501@psf.upfronthosting.co.za> Message-ID: <1300119578.93.0.647722087652.issue11501@psf.upfronthosting.co.za> New submission from Natalia B. Bidart : When creating a zipfile, the code: zip = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) does not handle the potential RuntimeError casued by: "If ZIP_DEFLATED is specified but the zlib module is not available, RuntimeError is also raised." ---------- assignee: tarek components: Distutils2 messages: 130847 nosy: alexis, eric.araujo, nessita, tarek priority: normal severity: normal status: open title: distutils.archive_util should handle absence of zlib module type: crash versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 17:31:32 2011 From: report at bugs.python.org (Jason R. Coombs) Date: Mon, 14 Mar 2011 16:31:32 +0000 Subject: [New-bugs-announce] [issue11502] assignment of winreg module to another name causes NameError In-Reply-To: <1300120292.26.0.949538054065.issue11502@psf.upfronthosting.co.za> Message-ID: <1300120292.26.0.949538054065.issue11502@psf.upfronthosting.co.za> New submission from Jason R. Coombs : Consider the Python file: import _winreg _winreg.foo x = _winreg Currently, 2to3 converts this to: import winreg winreg.foo x = _winreg The result will elicit a NameError on line 3 (if line 2 is valid). Is it possible to support this case? ---------- components: 2to3 (2.x to 3.0 conversion tool) messages: 130849 nosy: jaraco priority: normal severity: normal status: open title: assignment of winreg module to another name causes NameError _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 17:58:14 2011 From: report at bugs.python.org (Evan Dandrea) Date: Mon, 14 Mar 2011 16:58:14 +0000 Subject: [New-bugs-announce] [issue11503] Expand test coverage in posixpath In-Reply-To: <1300121894.11.0.790910098275.issue11503@psf.upfronthosting.co.za> Message-ID: <1300121894.11.0.790910098275.issue11503@psf.upfronthosting.co.za> New submission from Evan Dandrea : I've expanded the coverage of the posixpath test. The following scenarios have been added: - lexists with a non-existent file. - ismount with binary data. - ismount with a directory that is not a mountpoint. - ismount with a non-existent file. - ismount with a symlink. - expanduser with $HOME unset. - realpath with a relative path. - sameopenfile with a basic test. I have tested it on Ubuntu natty (20110311) and Mac OSX 10.6.6. ---------- components: Tests files: test_posixpath.patch keywords: patch messages: 130856 nosy: ev priority: normal severity: normal status: open title: Expand test coverage in posixpath type: behavior Added file: http://bugs.python.org/file21122/test_posixpath.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 18:13:59 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 14 Mar 2011 17:13:59 +0000 Subject: [New-bugs-announce] [issue11504] test_subprocess failure In-Reply-To: <1300122839.15.0.162000856682.issue11504@psf.upfronthosting.co.za> Message-ID: <1300122839.15.0.162000856682.issue11504@psf.upfronthosting.co.za> New submission from Antoine Pitrou : http://www.python.org/dev/buildbot/all/builders/x86%20debian%20parallel%203.x/builds/1678/steps/test/logs/stdio ====================================================================== FAIL: test_check_output_timeout (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/test/test_subprocess.py", line 133, in test_check_output_timeout self.assertEqual(c.exception.output, b'BDFL') AssertionError: b'' != b'BDFL' ====================================================================== FAIL: test_check_output_timeout (test.test_subprocess.ProcessTestCasePOSIXPurePython) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/test/test_subprocess.py", line 133, in test_check_output_timeout self.assertEqual(c.exception.output, b'BDFL') AssertionError: b'' != b'BDFL' ====================================================================== FAIL: test_check_output_timeout (test.test_subprocess.ContextManagerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot2/slave/3.x.loewis-parallel/build/Lib/test/test_subprocess.py", line 133, in test_check_output_timeout self.assertEqual(c.exception.output, b'BDFL') AssertionError: b'' != b'BDFL' ---------- assignee: rnk components: Library (Lib), Tests keywords: buildbot messages: 130859 nosy: pitrou, rnk priority: normal severity: normal stage: needs patch status: open title: test_subprocess failure type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 20:37:40 2011 From: report at bugs.python.org (Alicia Arlen) Date: Mon, 14 Mar 2011 19:37:40 +0000 Subject: [New-bugs-announce] [issue11505] string.py increased test coverage In-Reply-To: <1300131460.79.0.278218518064.issue11505@psf.upfronthosting.co.za> Message-ID: <1300131460.79.0.278218518064.issue11505@psf.upfronthosting.co.za> New submission from Alicia Arlen : Started from coverage.py results. Only 6 groups of lines did not have coverage. Since the Template class originated in PEP292, those tests were added in test_pep292.py. All Formatter class tests were added in test_string.py. _invalid test (Lines 89-90): This error does not naturally occur, so the regex for pattern was overloaded to create the scenario where the format fails on the first character. _vformat test (line 174): Forced recursion_depth negative to raise the error. convert_field (lines 226, 299): Sent in appropriate convversion requests. get_field (lines 256-257, 259): Added fieldname variations to test getattr and getitem lookups. ---------- components: Tests files: string_test_coverage.diff keywords: patch messages: 130880 nosy: Alicia.Arlen, brian.curtin, georg.brandl priority: normal severity: normal status: open title: string.py increased test coverage type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21130/string_test_coverage.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 20:41:36 2011 From: report at bugs.python.org (Nick Coghlan) Date: Mon, 14 Mar 2011 19:41:36 +0000 Subject: [New-bugs-announce] [issue11506] b'' += gives SystemError instead of SyntaxError In-Reply-To: <1300131696.51.0.411697636242.issue11506@psf.upfronthosting.co.za> Message-ID: <1300131696.51.0.411697636242.issue11506@psf.upfronthosting.co.za> New submission from Nick Coghlan : b'' += source gives SystemError instead of SyntaxError ---------- messages: 130881 nosy: ncoghlan priority: normal severity: normal status: open title: b'' += gives SystemError instead of SyntaxError _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 20:57:52 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Mon, 14 Mar 2011 19:57:52 +0000 Subject: [New-bugs-announce] [issue11507] Misspelled exercises Message-ID: <1300132672.42.0.871044090522.issue11507@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_exercises.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled exercises type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file21132/misspelled_exercises.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 21:31:31 2011 From: report at bugs.python.org (Kent Frazier) Date: Mon, 14 Mar 2011 20:31:31 +0000 Subject: [New-bugs-announce] [issue11508] Virtual Interfaces cause uuid._find_mac to raise a ValueError under Linux In-Reply-To: <1300134691.76.0.567990674923.issue11508@psf.upfronthosting.co.za> Message-ID: <1300134691.76.0.567990674923.issue11508@psf.upfronthosting.co.za> New submission from Kent Frazier : If a virtual interface is present in the system, such as if the user is connected to a VPN, then there may be entries in ifconfig that do not conform to the expected `HWAddr 01:23:45:67:89:ab` MAC address format expected by uuid._find_mac. For instance, under Ubuntu 10.10 on my Acer Eee 1005HA, using Cisco's AnyConnect VPN client, I have the following entry in ifconfig: cscotun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 Not only is this more than 6 bytes long, it also uses dashes as a delimiter rather than the colons used by MAC address. After reading the relevant parts of RFC4122's definition of the algorithm for UUID1, I think we probably should be ignoring these virtual interfaces, since I doubt they are guaranteed to be unique. The attached patch assumes that it is correct to ignore these entries. If this is not appropriate, it might be better to strip all colons and dashes before the int conversion. I tried to write a test to demonstrate this issue, but had difficulty figuring out how to make it work. The import of `os` is at the function level rather than at the top of the uuid module, so mocking out the module didn't seem feasible. I also tried replacing the call to ifconfig with a call to echo with the appropriate strings to emulate this result, but echo is typically not within any of the hard-coded list of directories that _find_mac looks in. If anyone has a good idea of how to write a test for this issue, I would be happy to write one with some guidance, but I was stumped. This is my first patch submission to CPython, so if I did anything incorrectly, please let me know and I will try to correct my error. ---------- components: Library (Lib) files: uuid_ValueError_fix.diff keywords: patch messages: 130892 nosy: kfrazier priority: normal severity: normal status: open title: Virtual Interfaces cause uuid._find_mac to raise a ValueError under Linux type: crash versions: Python 3.3 Added file: http://bugs.python.org/file21136/uuid_ValueError_fix.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 21:46:38 2011 From: report at bugs.python.org (Denver Coneybeare) Date: Mon, 14 Mar 2011 20:46:38 +0000 Subject: [New-bugs-announce] [issue11509] fileinput module unit test coverage improvements In-Reply-To: <1300135598.09.0.545633299021.issue11509@psf.upfronthosting.co.za> Message-ID: <1300135598.09.0.545633299021.issue11509@psf.upfronthosting.co.za> New submission from Denver Coneybeare : As part of the CPython sprints at PyCon 2011 I am improving the unit test coverage for the fileinput module. Primarily, this will be adding unit tests for the global functions, which right now are almost completely untested. I will be adding incremental patches and will update once my work is complete, when the final patch can be committed. ---------- components: Tests files: fileinput_unittests_v1.patch keywords: patch messages: 130895 nosy: brian.curtin, denversc, michael.foord priority: normal severity: normal status: open title: fileinput module unit test coverage improvements type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21138/fileinput_unittests_v1.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 23:06:03 2011 From: report at bugs.python.org (Eugene Toder) Date: Mon, 14 Mar 2011 22:06:03 +0000 Subject: [New-bugs-announce] [issue11510] Peephole breaks set unpacking In-Reply-To: <1300140363.98.0.218128326427.issue11510@psf.upfronthosting.co.za> Message-ID: <1300140363.98.0.218128326427.issue11510@psf.upfronthosting.co.za> New submission from Eugene Toder : Since the time 'x in set' optimization was added to peephole it has the following bug with set unpacking: >>> def foo(x,y): a,b = {x,y} return a,b >>> dis(foo) 2 0 LOAD_FAST 0 (x) 3 LOAD_FAST 1 (y) 6 ROT_TWO 7 STORE_FAST 2 (a) 10 STORE_FAST 3 (b) 3 13 LOAD_FAST 2 (a) 16 LOAD_FAST 3 (b) 19 BUILD_TUPLE 2 22 RETURN_VALUE That is, unpacking of literal set of sizes 2 and 3 is changed to ROT instructions. This, however, changes the semantics, as construction of set would eliminate duplicates. The difference can be demonstrated like this: Python 3.1 >>> foo(1,1) Traceback (most recent call last): File "", line 1, in File "", line 2, in foo ValueError: need more than 1 value to unpack Python 3.2 >>> foo(1,1) (1, 1) ---------- components: Interpreter Core messages: 130917 nosy: eltoder priority: normal severity: normal status: open title: Peephole breaks set unpacking type: compile error versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 14 23:08:14 2011 From: report at bugs.python.org (Scott Wilson) Date: Mon, 14 Mar 2011 22:08:14 +0000 Subject: [New-bugs-announce] [issue11511] Proposal for exposing proxy bypass settings in ProxyHandler In-Reply-To: <1300140494.17.0.372378902251.issue11511@psf.upfronthosting.co.za> Message-ID: <1300140494.17.0.372378902251.issue11511@psf.upfronthosting.co.za> New submission from Scott Wilson : Several proxy tests in test_urllib2_localnet were failing for me on osx due to spurious interference of my configured proxy settings. Attaching a patch that proposes exposing the proxy bypass settings in the same manner as the proxies when constructing ProxyHandler. An alternate solution to just fix the tests would be to monkeypatch urllib.request.proxy_bypass = urllib.request.proxy_bypass_environment in test_urllib2_localnet to avoid interference from mac/windows settings. ---------- components: Library (Lib) files: proxy_bypass_override.diff keywords: patch messages: 130919 nosy: orsenthil, rswilson priority: normal severity: normal status: open title: Proposal for exposing proxy bypass settings in ProxyHandler type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21148/proxy_bypass_override.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 00:04:54 2011 From: report at bugs.python.org (Robbie Clemons) Date: Mon, 14 Mar 2011 23:04:54 +0000 Subject: [New-bugs-announce] [issue11512] adding test suite for cgitb In-Reply-To: <1300143894.4.0.405606166364.issue11512@psf.upfronthosting.co.za> Message-ID: <1300143894.4.0.405606166364.issue11512@psf.upfronthosting.co.za> New submission from Robbie Clemons : Added a test suite for cgitb that provides 75% test coverage according to coverage.py. ---------- components: Tests files: test_cgitb.diff keywords: patch messages: 130926 nosy: brian.curtin, robquad priority: normal severity: normal status: open title: adding test suite for cgitb type: behavior Added file: http://bugs.python.org/file21152/test_cgitb.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 00:40:32 2011 From: report at bugs.python.org (Evan Dandrea) Date: Mon, 14 Mar 2011 23:40:32 +0000 Subject: [New-bugs-announce] [issue11513] Infinite recursion around raising an exception in tarfile In-Reply-To: <1300146032.78.0.080952835314.issue11513@psf.upfronthosting.co.za> Message-ID: <1300146032.78.0.080952835314.issue11513@psf.upfronthosting.co.za> New submission from Evan Dandrea : Using Python tip from Sunday, I noticed that tarfile does not elegantly handle ENOENT by raising a single exception: >>> tarfile.TarFile.gzopen('fdsfd', 'r') Traceback (most recent call last): File "/home/evan/hg/cpython/Lib/tarfile.py", line 1808, in gzopen fileobj = gzip.GzipFile(name, mode + "b", compresslevel, fileobj) File "/home/evan/hg/cpython/Lib/gzip.py", line 157, in __init__ fileobj = self.myfileobj = builtins.open(filename, mode or 'rb') IOError: [Errno 2] No such file or directory: 'fdsfd' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/home/evan/hg/cpython/Lib/tarfile.py", line 1812, in gzopen fileobj.close() AttributeError: 'NoneType' object has no attribute 'close' I tried to fix this in a cross-platform way, by attempting to open the file before processing it, and letting the with statement handle calling close: diff -r 955547e57cff Lib/tarfile.py --- a/Lib/tarfile.py Sun Mar 13 19:32:21 2011 +0100 +++ b/Lib/tarfile.py Mon Mar 14 19:33:21 2011 -0400 @@ -1793,6 +1793,10 @@ if len(mode) > 1 or mode not in "rw": raise ValueError("mode must be 'r' or 'w'") + if mode == "r": + # force an exception if the file does not exist. + with open(name): + pass try: import gzip gzip.GzipFile However, this produces infinite recursion: ... File "/home/evan/hg/cpython/Lib/tarfile.py", line 1738, in open return func(name, "r", fileobj, **kwargs) File "/home/evan/hg/cpython/Lib/tarfile.py", line 1798, in gzopen with open(name): File "/home/evan/hg/cpython/Lib/tarfile.py", line 1738, in open return func(name, "r", fileobj, **kwargs) RuntimeError: maximum recursion depth exceeded Curiously, if I force the ValueError in that same function to be triggered (by passing a three character string for the mode), that exception is raised fine. I am therefore wondering if this is a bug in the exit processing. Unfortunately, my attempts at producing a general test case have been unsuccessful thusfar. ---------- components: Interpreter Core messages: 130932 nosy: ev priority: normal severity: normal status: open title: Infinite recursion around raising an exception in tarfile _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:21:28 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:21:28 +0000 Subject: [New-bugs-announce] [issue11514] Misspelled access In-Reply-To: <1300148488.43.0.557309982046.issue11514@psf.upfronthosting.co.za> Message-ID: <1300148488.43.0.557309982046.issue11514@psf.upfronthosting.co.za> New submission from Piotr Kasprzyk : Misspelled: access ---------- components: Extension Modules files: misspelled_access.patch keywords: patch messages: 130933 nosy: kwadrat priority: normal severity: normal status: open title: Misspelled access type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21155/misspelled_access.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:24:14 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:24:14 +0000 Subject: [New-bugs-announce] [issue11515] Misspelled actually Message-ID: <1300148654.03.0.395838019663.issue11515@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_actually.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled actually versions: Python 3.3 Added file: http://bugs.python.org/file21156/misspelled_actually.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:26:30 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:26:30 +0000 Subject: [New-bugs-announce] [issue11516] Misspelled additionally Message-ID: <1300148790.19.0.888042259325.issue11516@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Windows files: misspelled_additionally.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled additionally type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21157/misspelled_additionally.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:27:15 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:27:15 +0000 Subject: [New-bugs-announce] [issue11517] Misspelled Message-ID: <1300148835.71.0.387911766664.issue11517@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- assignee: ronaldoussoren components: Extension Modules, Macintosh nosy: kwadrat, ronaldoussoren priority: normal severity: normal status: open title: Misspelled type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:30:44 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:30:44 +0000 Subject: [New-bugs-announce] [issue11518] Misspelled algorithm 2 Message-ID: <1300149044.26.0.639205230291.issue11518@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_algorithm2.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled algorithm 2 type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21159/misspelled_algorithm2.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:31:37 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:31:37 +0000 Subject: [New-bugs-announce] [issue11519] Misspelled algorithm Message-ID: <1300149097.29.0.994114628056.issue11519@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_algorithm.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled algorithm type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21160/misspelled_algorithm.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:32:34 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:32:34 +0000 Subject: [New-bugs-announce] [issue11520] Misspelled alignment 2 Message-ID: <1300149154.17.0.0604843435658.issue11520@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_alignment2.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled alignment 2 type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21161/misspelled_alignment2.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:32:53 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:32:53 +0000 Subject: [New-bugs-announce] [issue11521] Misspelled alignment3 Message-ID: <1300149173.67.0.0518264465243.issue11521@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- nosy: kwadrat priority: normal severity: normal status: open title: Misspelled alignment3 type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:37:16 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:37:16 +0000 Subject: [New-bugs-announce] [issue11522] Misspelled alignment 4 Message-ID: <1300149436.41.0.430690231929.issue11522@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Extension Modules files: misspelled_alignment4.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled alignment 4 type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21164/misspelled_alignment4.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:38:24 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:38:24 +0000 Subject: [New-bugs-announce] [issue11523] Misspelled alignment 5 Message-ID: <1300149504.56.0.989452646108.issue11523@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Extension Modules files: misspelled_alignment5.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled alignment 5 type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21165/misspelled_alignment5.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:39:25 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:39:25 +0000 Subject: [New-bugs-announce] [issue11524] Misspelled alignment 6 Message-ID: <1300149565.16.0.0508872307735.issue11524@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Extension Modules files: misspelled_alignment6.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled alignment 6 type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21166/misspelled_alignment6.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:40:04 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:40:04 +0000 Subject: [New-bugs-announce] [issue11525] Misspelled alignment Message-ID: <1300149604.39.0.873856483799.issue11525@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Extension Modules files: misspelled_alignment.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled alignment type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21167/misspelled_alignment.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:40:05 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:40:05 +0000 Subject: [New-bugs-announce] [issue11526] Misspelled alignment Message-ID: <1300149605.49.0.988509934767.issue11526@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Extension Modules files: misspelled_alignment.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled alignment type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21168/misspelled_alignment.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:43:03 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:43:03 +0000 Subject: [New-bugs-announce] [issue11527] Misspelled ambiguous Message-ID: <1300149783.1.0.49457966417.issue11527@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Installation files: misspelled_ambiguous.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled ambiguous type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21170/misspelled_ambiguous.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:44:12 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:44:12 +0000 Subject: [New-bugs-announce] [issue11528] Misspelled anonymously Message-ID: <1300149852.61.0.628055190352.issue11528@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_anonymously.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled anonymously type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21171/misspelled_anonymously.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:45:42 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:45:42 +0000 Subject: [New-bugs-announce] [issue11529] Misspelled application 2 Message-ID: <1300149942.88.0.234206407819.issue11529@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_application2.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled application 2 type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21172/misspelled_application2.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:47:04 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:47:04 +0000 Subject: [New-bugs-announce] [issue11530] Misspelled application Message-ID: <1300150024.89.0.923426326693.issue11530@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_application.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled application type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21173/misspelled_application.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:47:50 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:47:50 +0000 Subject: [New-bugs-announce] [issue11531] Misspelled applications Message-ID: <1300150070.13.0.827915251553.issue11531@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_applications.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled applications type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21174/misspelled_applications.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:51:58 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:51:58 +0000 Subject: [New-bugs-announce] [issue11532] Misspelled arbitrary 2 Message-ID: <1300150318.48.0.165724868749.issue11532@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Interpreter Core files: misspelled_arbitrary2.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled arbitrary 2 type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21175/misspelled_arbitrary2.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:52:38 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:52:38 +0000 Subject: [New-bugs-announce] [issue11533] Misspelled arbitrary Message-ID: <1300150358.18.0.171669338185.issue11533@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Interpreter Core files: misspelled_arbitrary.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled arbitrary type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21176/misspelled_arbitrary.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:54:15 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:54:15 +0000 Subject: [New-bugs-announce] [issue11534] Misspelled architecture, control Message-ID: <1300150455.22.0.233088790586.issue11534@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- assignee: ronaldoussoren components: Macintosh files: misspelled_architecture_control.patch keywords: patch nosy: kwadrat, ronaldoussoren priority: normal severity: normal status: open title: Misspelled architecture, control type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21177/misspelled_architecture_control.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:56:06 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:56:06 +0000 Subject: [New-bugs-announce] [issue11535] Misspelled architecture Message-ID: <1300150566.09.0.60425490531.issue11535@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Windows files: misspelled_architecture.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled architecture type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21178/misspelled_architecture.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:57:17 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:57:17 +0000 Subject: [New-bugs-announce] [issue11536] Misspelled arguments 2 Message-ID: <1300150637.92.0.681021170218.issue11536@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_arguments2.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled arguments 2 type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21179/misspelled_arguments2.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 01:58:14 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 00:58:14 +0000 Subject: [New-bugs-announce] [issue11537] Misspelled arguments Message-ID: <1300150694.65.0.0474174746081.issue11537@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Extension Modules files: misspelled_arguments.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled arguments type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21180/misspelled_arguments.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:00:29 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:00:29 +0000 Subject: [New-bugs-announce] [issue11538] Misspelled assign Message-ID: <1300150829.28.0.617442382785.issue11538@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_assign.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled assign type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21181/misspelled_assign.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:01:20 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:01:20 +0000 Subject: [New-bugs-announce] [issue11539] Misspelled associated Message-ID: <1300150880.42.0.722085365958.issue11539@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- nosy: kwadrat priority: normal severity: normal status: open title: Misspelled associated type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:02:46 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:02:46 +0000 Subject: [New-bugs-announce] [issue11540] Misspelled assume Message-ID: <1300150966.14.0.494000434761.issue11540@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- assignee: ronaldoussoren components: Macintosh files: misspelled_assume.patch keywords: patch nosy: kwadrat, ronaldoussoren priority: normal severity: normal status: open title: Misspelled assume type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21183/misspelled_assume.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:03:51 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:03:51 +0000 Subject: [New-bugs-announce] [issue11541] Misspelled attribute Message-ID: <1300151031.44.0.692216700552.issue11541@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_attribute.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled attribute type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21184/misspelled_attribute.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:04:47 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:04:47 +0000 Subject: [New-bugs-announce] [issue11542] Misspelled augmented Message-ID: <1300151087.29.0.926734773149.issue11542@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Extension Modules files: misspelled_augmented.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled augmented type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21185/misspelled_augmented.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:06:21 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:06:21 +0000 Subject: [New-bugs-announce] [issue11543] Misspelled available, instances Message-ID: <1300151181.18.0.733381545795.issue11543@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_available_instances.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled available, instances type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21186/misspelled_available_instances.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:07:40 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:07:40 +0000 Subject: [New-bugs-announce] [issue11544] Misspelled avoid Message-ID: <1300151260.33.0.899662527296.issue11544@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_avoid.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled avoid type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21187/misspelled_avoid.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:08:32 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:08:32 +0000 Subject: [New-bugs-announce] [issue11545] Misspelled backtracking Message-ID: <1300151312.99.0.591618639322.issue11545@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Interpreter Core files: misspelled_backtracking.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled backtracking type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21189/misspelled_backtracking.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:10:08 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:10:08 +0000 Subject: [New-bugs-announce] [issue11546] Misspelled between Message-ID: <1300151408.6.0.466069388504.issue11546@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_between.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled between type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21190/misspelled_between.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 02:10:09 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 01:10:09 +0000 Subject: [New-bugs-announce] [issue11547] Misspelled between Message-ID: <1300151409.67.0.936515877835.issue11547@psf.upfronthosting.co.za> Changes by Piotr Kasprzyk : ---------- components: Library (Lib) files: misspelled_between.patch keywords: patch nosy: kwadrat priority: normal severity: normal status: open title: Misspelled between type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21191/misspelled_between.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 04:30:26 2011 From: report at bugs.python.org (Evan Dandrea) Date: Tue, 15 Mar 2011 03:30:26 +0000 Subject: [New-bugs-announce] [issue11548] Passing format= to unpack_archive fails In-Reply-To: <1300159826.82.0.743719260919.issue11548@psf.upfronthosting.co.za> Message-ID: <1300159826.82.0.743719260919.issue11548@psf.upfronthosting.co.za> New submission from Evan Dandrea : Passing the format keyword parameter to shutil.unpack_archive triggers an exception: Traceback (most recent call last): File "Lib/test/test_shutil.py", line 650, in test_unpack_archive unpack_archive(filename, tmpdir2, format=format) File "/home/evan/hg/cpython/Lib/shutil.py", line 741, in unpack_archive func(filename, extract_dir, **dict(format_info[1])) TypeError: 'function' object is not iterable This is due to that function incorrectly using the _UNPACK_FORMATS dictionary, which is fixed with the attached patch and test case. ---------- components: Library (Lib) files: fix_unpack_with_format.patch keywords: patch messages: 130948 nosy: ev, tarek priority: normal severity: normal status: open title: Passing format= to unpack_archive fails type: crash Added file: http://bugs.python.org/file21196/fix_unpack_with_format.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 05:46:42 2011 From: report at bugs.python.org (Eugene Toder) Date: Tue, 15 Mar 2011 04:46:42 +0000 Subject: [New-bugs-announce] [issue11549] Rewrite peephole to work on AST In-Reply-To: <1300164402.79.0.766591131661.issue11549@psf.upfronthosting.co.za> Message-ID: <1300164402.79.0.766591131661.issue11549@psf.upfronthosting.co.za> New submission from Eugene Toder : As pointed out by Raymond, constant folding should be done on AST rather than on generated bytecode. Here's a patch to do that. It's rather long, so overview first. The patch replaces existing peephole pass with a folding pass on AST and a few changes in compiler. Feature-wise it should be on par with old peepholer, applying optimizations more consistently and thoroughly, but maybe missing some others. It passes all peepholer tests (though they seem not very extensive) and 'make test', but more testing is, of course, needed. I've split it in 5 pieces for easier reviewing, but these are not 5 separate patches, they should all be applied together. I can upload it somewhere for review or split it in other ways, let me know. Also, patches are versus 1e00b161f5f5, I will redo against head. TOC: 1. Changes to AST 2. Folding pass 3. Changes to compiler 4. Generated files (since they're checked in) 5. Tests In detail: 1. I needed to make some changes to AST to enable constant folding. These are a) Merge Num, Str, Bytes and Ellipsis constructors into a single Lit (literal) that can hold anything. For one thing, this removes a good deal of copy-paste in the code, since these are always treated the same. (There were a couple of places where Bytes ctor was missing for no apparent reason, I think it was forgotten.) Otherwise, I would have to introduce at least 4 more node types: None, Bool, TupleConst, SetConst. This seemed excessive. b) Docstring is now an attribute of Module, FunctionDef and ClassDef, rather than a first statement. Docstring is a special syntactic construction, it's not an executable code, so it makes sense to separate it. Otherwise, optimizer would have to take extra care not to introduce, change or remove docstring. For example: def foo(): "doc" + "string" Without optimizations foo doesn't have a docstring. After folding, however, the first statement in foo is a string literal. This means that docstring depends on the level of optimizations. Making it an attribute avoids the problem. c) 'None', 'True' and 'False' are parsed as literals instead of names, even without optimizations. Since they are not redefineable, I think it makes most sense to treat them as literals. This isn't strictly needed for folding, and I haven't removed all the artefacts, in case this turns out controversial. 2. Constant folding (and a couple of other tweaks) is performed by a visitor. The visitor is auto-generated from ASDL and a C template. C template (Python/ast_opt.ct) provides code for optimizations and rules on how to call it. Parser/asdl_ct.py takes this and ASDL and generates a visitor, that visits only nodes which have associated rules (but visits them via all paths). The code for optimizations itself is pretty straight-forward. The generator can probably be used for symtable.c too, removing ~200 tedious lines of code. 3. Changes to compiler are in 3 categories a) Updates for AST changes. b) Changes to generate better code and not need any optimizations. This includes tuple unpacking optimization and if/while conditions. c) Simple peephole pass on compiler internal structures. This is a better form for doing this, than a bytecode. The pass only deals with jumps to jumps/returns and trivial dead code. I've also made 'raise' recognized as a terminator, so that 'return None' is not inserted after it. 4, 5. No big surprises here. ---------- components: Interpreter Core messages: 130955 nosy: eltoder priority: normal severity: normal status: open title: Rewrite peephole to work on AST versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 06:02:31 2011 From: report at bugs.python.org (Ben Hayden) Date: Tue, 15 Mar 2011 05:02:31 +0000 Subject: [New-bugs-announce] [issue11550] Fix ResourceWarning in test_pulldom In-Reply-To: <1300165351.26.0.408898655743.issue11550@psf.upfronthosting.co.za> Message-ID: <1300165351.26.0.408898655743.issue11550@psf.upfronthosting.co.za> New submission from Ben Hayden : When running the test_pulldom test with a latest checkout of cpython from hg.python.org on Ubuntu 10.10 x64, the following ResourceWarning is thrown: test_parse (test.test_pulldom.PullDOMTestCase) Minimal test of DOMEventStream.parse() ... /home/benhayden/Documents/cpython/Lib/test/test_pulldom.py:35: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/benhayden/Documents/cpython/Lib/test/xmltestdata/test.xml' mode='r' encoding='UTF-8'> list(pulldom.parse(tstfile)) ok This is because pulldom.parse returns an open file object if the argument it is passed is a string & not a file object. Attached is a patch that makes sure that file is closed. ---------- components: Tests files: test_pulldom_resource_warning.patch keywords: patch messages: 130956 nosy: beardedp priority: normal severity: normal status: open title: Fix ResourceWarning in test_pulldom type: resource usage versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file21203/test_pulldom_resource_warning.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 06:31:16 2011 From: report at bugs.python.org (Denver Coneybeare) Date: Tue, 15 Mar 2011 05:31:16 +0000 Subject: [New-bugs-announce] [issue11551] test_dummy_thread.py test coverage improvement In-Reply-To: <1300167076.06.0.564640850905.issue11551@psf.upfronthosting.co.za> Message-ID: <1300167076.06.0.564640850905.issue11551@psf.upfronthosting.co.za> New submission from Denver Coneybeare : The attached patch increases the test coverage of the module _dummy_thread from 78% to 100%. ---------- components: Tests files: test_dummy_thread_test_coverage_improvement.patch keywords: patch messages: 130957 nosy: brian.curtin, denversc priority: normal severity: normal status: open title: test_dummy_thread.py test coverage improvement type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21204/test_dummy_thread_test_coverage_improvement.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 06:44:43 2011 From: report at bugs.python.org (cournapeau david) Date: Tue, 15 Mar 2011 05:44:43 +0000 Subject: [New-bugs-announce] [issue11552] Confusing error message when hook module cannot be loaded In-Reply-To: <1300167883.89.0.288687435402.issue11552@psf.upfronthosting.co.za> Message-ID: <1300167883.89.0.288687435402.issue11552@psf.upfronthosting.co.za> New submission from cournapeau david : The following simple example: setup.cfg [global] setup_hook = hooks.foo and the following hooks.py file def foo(content): pass Traceback (most recent call last): File "../distutils2/distutils2/pysetup", line 5, in main() File "/Users/david/src/projects/distutils2/distutils2/run.py", line 486, in main return dispatcher() File "/Users/david/src/projects/distutils2/distutils2/run.py", line 477, in __call__ return func(self, self.args) File "/Users/david/src/projects/distutils2/distutils2/run.py", line 161, in _run dist.parse_config_files() File "/Users/david/src/projects/distutils2/distutils2/dist.py", line 317, in parse_config_files return self.config.parse_config_files(filenames) File "/Users/david/src/projects/distutils2/distutils2/config.py", line 258, in parse_config_files self._read_setup_cfg(parser, filename) File "/Users/david/src/projects/distutils2/distutils2/config.py", line 120, in _read_setup_cfg self.setup_hook = resolve_name(setup_hook) File "/Users/david/src/projects/distutils2/distutils2/util.py", line 644, in resolve_name raise ImportError(exc) ImportError: 'str' object has no attribute 'foo' I don't understand how it works exactly, but the current code cannot work, as ret needs to be a module package after the __import__ (i.e. the codepath following line 632 and later in util.py (resolve_name function)) ---------- assignee: tarek components: Distutils2 messages: 130958 nosy: alexis, cournape, eric.araujo, tarek priority: normal severity: normal status: open title: Confusing error message when hook module cannot be loaded type: crash _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 12:39:50 2011 From: report at bugs.python.org (Graham Wideman) Date: Tue, 15 Mar 2011 11:39:50 +0000 Subject: [New-bugs-announce] [issue11553] Docs for: import, packages, site.py, .pth files In-Reply-To: <1300189190.68.0.0305569633639.issue11553@psf.upfronthosting.co.za> Message-ID: <1300189190.68.0.0305569633639.issue11553@psf.upfronthosting.co.za> New submission from Graham Wideman : The overall scope of this issue is that current Python documentation gives vague, sometimes incorrect, information about the set of Python features involved in modularizing functionality. This issue presents an obstacle to programmers making smooth transitions from a single module, to collections of modules and packages, then on to neatly organized common packages shared between projects. The problem affects documentation of: import and from...import statements ------------------------------------ The Language Reference is way too complicated for the mainstream case. Exactly what variants of arguments are possible, and what are their effects? What are the interactions with package features, such as whether or not modules have been explicitly imported into package __init_.py? sys.path --------- Typical consituents; range of alternatives for adding more dirs Module site.py -------------- Multiple serious errors in the file docstring, relating to site-packages directories and .pth files .pth files ----------- Incorrectly described in site.py, and then vaguely described in other docs. Are .pth files processed everywhere on sys.path? Can they be interative? (No to both). package structure ----------------- Details of package structure have evidently changed over Python versions. Current docs are unclear on points such as: -- is __init__.py needed on subpackage directories? -- the __all__ variable: Does it act generally to limit visibility of a module or package's attributes, or does pertain only to the 'from...import *' statement? Details: ========= Language Reference ------------------- http://docs.python.org/py3k/reference/simple_stmts.html#the-import-statement The description of the import statement is extensive, but dauntingly complicated for the reader trying to understand the mainstream case of simply importing modules or packages that are on sys.path. This is because the algorithm for finding modules tries numerous esoteric strategies before falling back on the plain-old-file-system method. (Even now that I have a good understanding of the plain-old-file variations of import, I reread this and find it hard to comprehend, and disorganized and incomplete in presenting the available variations of the statement.) Grammar issue: the grammar shown for the import statement shows: relative_module ::= "."* module | "."+ ... which implies that relative module could have zero leading dots. I believe an actual relative path is required to have at least one dot (PEP 328). Evidently, in this grammar, 'relative_module' really means "relative or absolute path to module or package", so it would be quite helpful to change to: relative_path ::= "."+ module | "."+ from_path ::= (relative_path | module) etc. (Really 'module' is not quite right here either since it's used to mean module-or-package.) site.py: -------- Module site.py implements the site-package related features. The docstring has multiple problems with consequences in other docs. 1. Does not mention user-specific site-package directories (implemented by addusersitepackages() ) 2. Seriously misleading discussion of .pth files. In the docstring the example shows using pth files, called "package configuration files" in their comments, to point to actual package directories bar and foo located within the site-packages directory. This is an absolutely incorrect use of pth files: If foo and bar are packages in .../site-packages/, they do not need to be pointed to, they are already on sys.path. If the package dirs ARE pointed to by foo.pth and bar.pth, the modules inside them will be exposed directly to sys.path, possibly precipitating name collisions. Further, programmers following this example will create packages in which import statements will appear to magically perform relative imports without leading dots, leading to confusion over how the import statement is supposed to work. It may be that this discussion is held over from a time when "package" perhaps meant "Just a Bunch of Files in a Directory"? 3. The docstring (or other docs) should make clear that .pth files are ONLY processed within site-package directories (ie: only by site.py). 4. Bug: Minor: In addsitepackages(), the library directory for Windows (the else clause) is shown as lower-case 'lib' instead of 'Lib'. This has some possibility of causing problems when running from a case-sensitive server. In any case, if read as documentation it is misleading. Tutorial --------- 6. Modules: http://docs.python.org/py3k/tutorial/modules.html 1. Discussion (6.1.2. The Module Search Path) is good as far as it goes, but it doesn't mention the site-package directories. 2. Section 6.4. Packages: Discussion of __init__.py does describe the purpose of these files. However, the discussion in relation to subpackages should mention that for subdirectories to be accessible they must in fact be made into subpackages. I.e.: there is not form of import that can reach into a subdir of a package *unless* it's flagged as a subpackage using __init__.py. I have read elsewhere that there were some versions of Python where __init__.py was not needed on subdirs within a package. 3. Section 6.4. Packages: The discussion of __all__ should note that it works *only* in conjunction with 'from...import *', and is not a general mechanism for limiting visibility of attributes. Attributes not in the __all__ list are still accessible using other forms of import. 4. Section 6.4. Packages: "Note that when using from package import item" and following. Draws a contrast between: from package import item vs import item.subitem.subsubitem However, this muddles the roles of the arguments to import, and notably uses 'item' in two different ways. Instead the discussion can be presented as a comparison of: from PackageOrModule import ModuleOrAttribute vs import PackageOrModule ... where it can be pointed out that the PackageOrModule 'dotted path' argument follows the *same* rules in both cases (except for relative paths). The *salient* contrast is that only the 'from' form has a *second* argument which can be an attribute. 5. Footnote: (somewhat unrelated, but...) says "the execution of a module-level function enters the function name in the module?s global symbol table." This is surely incorrect -- it is the execution of the function's *def* that enters the function name in the symbol table. Standard Library Reference --------------------------- 1) 27.13. site ? Site-specific configuration hook http://docs.python.org/py3k/library/site.html This is documentation for site.py, and is a page that might well come up in a search for '.pth'. 1a) This page may simply be importing the docstring from site.py? In any case it repeats the ommissions and errors noted above for site.py. 2) 27.1. sys ? System-specific parameters and functions http://docs.python.org/py3k/library/sys.html Documentation for sys.path. OK as far as it goes, but: 2a) Could helpfully point to a discussion of the typical items to be found in sys.path under normal circumstances 2b) It does point to the site.py module documentation as the authoritative info on using .pth files (which is seriously flawed as noted above). 3) 29.3. pkgutil ? Package extension utility. http://docs.python.org/py3k/library/pkgutil.html 3a) The info for pkgutil.extend_path() describes how .pkg files are similar to .pth files, and their entries should point to package directories. As I noted above, so far as I can see, package directories should be within a directory on sys,path, but should not themselves be included in the path, otherwise it breaks their capability to work properly as packages. 'Installing Python Modules' document: -------------------------------------- http://docs.python.org/py3k/install/index.html This may well be consulted for info on how to organize source files, though it is basically the doc for Distutils. 1. Main problem is that it seems quite out-of-date; "Windows has no concept of a user?s home directory, " and so on. 2. 'How installation works' > table. For Windows suggests 'prefix' (default: C:\Python) as an installation directory. This is indeed one of the possible 'site-package' directories, but surely it is deprecated in favor of C:\Python\Lib\site-packages, which this section does not mention. 3. Does not mention user-specific site-package directories. 4. 'Modifying Python's Search Path' > "The most convenient way is to add a path configuration file to a directory that?s already on Python?s path". This is incorrect. (a) .pth files are only processed in site-package directories. (b) Clarifying an additional point of confusion -- as a consequence of (a) .pth files cannot be chained. 5. Points to docs for site.py... with it's flaws noted above. PEP 302 New Import Hooks ------------------------ Given the vagueness elsewhere in the docs, one might go hunting for ground truth in the PEPs. One must allow for PEPs having been superceeded, but nonetheless, outdated info that is now wrong is an additional stumbling block for learners. 1. Section 'Specification part 1: The importer Protocol'. Discussion says that in an import statement, a path (with no leading '.') is first treated as relative. This is now incorrect (as spelled out in PEP 328.) It would be helpful to insert a note in PEP 302 pointing out that the later revision invalidates this passage. ---------- assignee: docs at python components: Documentation messages: 130964 nosy: docs at python, gwideman priority: normal severity: normal status: open title: Docs for: import, packages, site.py, .pth files type: behavior versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 16:07:49 2011 From: report at bugs.python.org (Michael Henry) Date: Tue, 15 Mar 2011 15:07:49 +0000 Subject: [New-bugs-announce] [issue11554] Port email module's test_email_codecs.py to Python 3 In-Reply-To: <1300201669.88.0.875643607067.issue11554@psf.upfronthosting.co.za> Message-ID: <1300201669.88.0.875643607067.issue11554@psf.upfronthosting.co.za> New submission from Michael Henry : test_email_codecs.py in the email module should be ported to Python 3. The attached patch ports test_email_codecs.py and hooks it into the email test suite. ---------- components: Library (Lib) files: port-test_email_codecs.py.patch keywords: patch messages: 130980 nosy: michael.henry, r.david.murray priority: normal severity: normal status: open title: Port email module's test_email_codecs.py to Python 3 versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21213/port-test_email_codecs.py.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 16:15:43 2011 From: report at bugs.python.org (Michael Henry) Date: Tue, 15 Mar 2011 15:15:43 +0000 Subject: [New-bugs-announce] [issue11555] email.Message.as_string no longer mangles "From " (doc fix) In-Reply-To: <1300202143.89.0.407309500097.issue11555@psf.upfronthosting.co.za> Message-ID: <1300202143.89.0.407309500097.issue11555@psf.upfronthosting.co.za> New submission from Michael Henry : The function email.Message.as_string has an out-of-date comment: """ This is a convenience method and may not generate the message exactly as you intend because by default it mangles lines that begin with "From ". For more flexibility, use the flatten() method of a Generator instance. """ The functionality has changed such that "From " mangling is no longer done. ---------- components: Library (Lib) messages: 130981 nosy: michael.henry, r.david.murray priority: normal severity: normal status: open title: email.Message.as_string no longer mangles "From " (doc fix) _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 16:20:06 2011 From: report at bugs.python.org (Michael Henry) Date: Tue, 15 Mar 2011 15:20:06 +0000 Subject: [New-bugs-announce] [issue11556] email.Message.get_payload can handle bytes payloads (minor doc fix) In-Reply-To: <1300202406.57.0.384288441541.issue11556@psf.upfronthosting.co.za> Message-ID: <1300202406.57.0.384288441541.issue11556@psf.upfronthosting.co.za> New submission from Michael Henry : In email.Message.get_payload, there is the following out-of-date comment: """ # payload can be bytes here, (I wonder if that is actually a bug?) """ The code can actually handle bytes payloads. ---------- components: Library (Lib) messages: 130982 nosy: michael.henry, r.david.murray priority: normal severity: normal status: open title: email.Message.get_payload can handle bytes payloads (minor doc fix) _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 16:20:55 2011 From: report at bugs.python.org (Natalia B. Bidart) Date: Tue, 15 Mar 2011 15:20:55 +0000 Subject: [New-bugs-announce] [issue11557] Increase coverage in logging module In-Reply-To: <1300202455.33.0.229381478379.issue11557@psf.upfronthosting.co.za> Message-ID: <1300202455.33.0.229381478379.issue11557@psf.upfronthosting.co.za> New submission from Natalia B. Bidart : Current coverage is: Name Stmts Miss Cover ------------------------------------------ Lib/logging/__init__ 739 162 78% Lib/logging/config 571 98 83% Lib/logging/handlers 601 325 46% ------------------------------------------ TOTAL 1911 585 69% ---------- components: Tests messages: 130983 nosy: nessita priority: normal severity: normal status: open title: Increase coverage in logging module type: resource usage versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 16:34:16 2011 From: report at bugs.python.org (Michael Henry) Date: Tue, 15 Mar 2011 15:34:16 +0000 Subject: [New-bugs-announce] [issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload("some string") In-Reply-To: <1300203256.19.0.481262547299.issue11558@psf.upfronthosting.co.za> Message-ID: <1300203256.19.0.481262547299.issue11558@psf.upfronthosting.co.za> New submission from Michael Henry : The attached test program, test_email_attach_to_string.py, demonstrates the desire for email.message.Message.attach to raise a more helpful exception when the user incorrectly invokes attach() after setting the payload to a string. ---------- components: Library (Lib) files: test_email_attach_to_string.py messages: 130984 nosy: michael.henry, r.david.murray priority: normal severity: normal status: open title: Raise a more helpful exception in email.message.Message.attach after set_payload("some string") Added file: http://bugs.python.org/file21214/test_email_attach_to_string.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 19:50:26 2011 From: report at bugs.python.org (Matias Bordese) Date: Tue, 15 Mar 2011 18:50:26 +0000 Subject: [New-bugs-announce] [issue11559] Increase test coverage in dis module In-Reply-To: <1300215026.87.0.930221718655.issue11559@psf.upfronthosting.co.za> Message-ID: <1300215026.87.0.930221718655.issue11559@psf.upfronthosting.co.za> New submission from Matias Bordese : Attaching patch to add new tests for dis module. ---------- components: Tests files: add_dis_tests.patch keywords: patch messages: 131018 nosy: matiasb priority: normal severity: normal status: open title: Increase test coverage in dis module type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21224/add_dis_tests.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 22:31:49 2011 From: report at bugs.python.org (Evan Dandrea) Date: Tue, 15 Mar 2011 21:31:49 +0000 Subject: [New-bugs-announce] [issue11560] Expand test coverage in shutil In-Reply-To: <1300224709.18.0.233736639142.issue11560@psf.upfronthosting.co.za> Message-ID: <1300224709.18.0.233736639142.issue11560@psf.upfronthosting.co.za> New submission from Evan Dandrea : The attached patch increases the coverage in shutil. It makes the following changes: - Tests the code paths for file and directory copies across filesystems by mocking out rename. - Adds a test for shutil.copy. - Adds a test for shutil.copy2. - Tests shutil.unpack_archive with the format specified. - Tests the code path for creating the target directory in _make_tarball. I have tested this on Ubuntu natty and OSX 10.6.6. Note that this will fail until http://bugs.python.org/issue11548 is applied. ---------- components: Tests files: increase_test_shutil_coverage.patch keywords: patch messages: 131041 nosy: ev, tarek priority: normal severity: normal status: open title: Expand test coverage in shutil Added file: http://bugs.python.org/file21229/increase_test_shutil_coverage.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 23:09:10 2011 From: report at bugs.python.org (Brandon Craig Rhodes) Date: Tue, 15 Mar 2011 22:09:10 +0000 Subject: [New-bugs-announce] [issue11561] "coverage" of Python regrtest cannot see initial import of libs In-Reply-To: <1300226950.96.0.51096652956.issue11561@psf.upfronthosting.co.za> Message-ID: <1300226950.96.0.51096652956.issue11561@psf.upfronthosting.co.za> New submission from Brandon Craig Rhodes : When running the Python regression tests in "coverage", the initial outer level of interpreted code in several standard library modules shows as not having been covered by the tests, because they were imported during the Python boot process and were already loaded when the "coverage" command got control. ---------- messages: 131051 nosy: brandon-rhodes priority: normal severity: normal status: open title: "coverage" of Python regrtest cannot see initial import of libs _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 23:20:49 2011 From: report at bugs.python.org (Mike Smith) Date: Tue, 15 Mar 2011 22:20:49 +0000 Subject: [New-bugs-announce] [issue11562] += on list inside a tuple raises TypeError but succeds anyway In-Reply-To: <1300227649.12.0.439926761488.issue11562@psf.upfronthosting.co.za> Message-ID: <1300227649.12.0.439926761488.issue11562@psf.upfronthosting.co.za> New submission from Mike Smith : Using += to append to a list inside a tuple raises a TypeError but succeeds in appending the value anyway: >>> t = (1, [2, 3, 4]) >>> t[1].append(5) >>> t[1] += [6] Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object does not support item assignment >>> t (1, [2, 3, 4, 5, 6]) I have reproduced this on all the Python interpreters available to me (CPython 2.6, 2.7, and 3.1). ---------- components: Interpreter Core messages: 131055 nosy: scgtrp priority: normal severity: normal status: open title: += on list inside a tuple raises TypeError but succeds anyway type: behavior versions: Python 2.6, Python 2.7, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 23:57:37 2011 From: report at bugs.python.org (Brett Cannon) Date: Tue, 15 Mar 2011 22:57:37 +0000 Subject: [New-bugs-announce] [issue11563] test_urllibnet is triggering a ResourceWarning In-Reply-To: <1300229857.13.0.482456727872.issue11563@psf.upfronthosting.co.za> Message-ID: <1300229857.13.0.482456727872.issue11563@psf.upfronthosting.co.za> New submission from Brett Cannon : test.test_urllibnet.urlopenNetworkTests.test_getcode() is leaving a socket open. My guess is that the error condition being triggered is somehow leaving the socket open but I can't find where. ---------- components: Library (Lib) messages: 131059 nosy: brett.cannon priority: normal severity: normal stage: needs patch status: open title: test_urllibnet is triggering a ResourceWarning _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 15 23:58:29 2011 From: report at bugs.python.org (Nik Galitsky) Date: Tue, 15 Mar 2011 22:58:29 +0000 Subject: [New-bugs-announce] [issue11564] pickle limits most datatypes In-Reply-To: <1300229909.71.0.853987934234.issue11564@psf.upfronthosting.co.za> Message-ID: <1300229909.71.0.853987934234.issue11564@psf.upfronthosting.co.za> New submission from Nik Galitsky : Python 3.2 on linux (RHEL 5.3) x86_64 build from source code. Configure options: ./configure --prefix=/scratch/Python-3.2 --enable-big-digits=30 --with-universal-archs=all --with-fpectl --enable-shared Built with GCC 4.3.3 with major options -g3 -O3 -m64 -fPIC. Testcase that shows the issue: #import numpy import pickle print("begin") #a = numpy.zeros((2.5e9 / 8,), dtype = numpy.float64) a = ('a' * (2 ** 31)) print("allocated") #print(a); pickle.dumps(a, pickle.DEFAULT_PROTOCOL) print("end") The problem as I can see it is that in pickle.py most types defined either as 2 bytes, or 4 bytes. For example it is peppered with lines like: self.write(SOMETYPE + pack("\0\1\0\0\0\300>\0\0\0\0\0\0"..., 832) = 832 fstat(5, {st_mode=S_IFREG|0755, st_size=412939, ...}) = 0 mmap(NULL, 2185384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 5, 0) = 0x2b05b5f68000 mprotect(0x2b05b5f7b000, 2093056, PROT_NONE) = 0 mmap(0x2b05b617a000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 5, 0x12000) = 0x2b05b617a000 close(5) = 0 close(4) = 0 close(3) = 0 write(1, "begin\n", 6begin ) = 6 mmap(NULL, 4294971392, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b05b617e000 write(1, "allocated\n", 10allocated ) = 10 mmap(NULL, 8589938688, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b06b617f000 mremap(0x2b06b617f000, 8589938688, 2147487744, MREMAP_MAYMOVE) = 0x2b06b617f000 mmap(NULL, 4294971392, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b0736180000 munmap(0x2b06b617f000, 2147487744) = 0 munmap(0x2b0736180000, 4294971392) = 0 write(2, "Traceback (most recent call last"..., 35Traceback (most recent call last): ) = 35 write(2, " File \"pickle_long.py\", line 9,"..., 45 File "pickle_long.py", line 9, in ) = 45 open("pickle_long.py", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=251, ...}) = 0 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7ffff9f7c9e0) = -1 ENOTTY (Inappropriate ioctl for device) fstat(3, {st_mode=S_IFREG|0644, st_size=251, ...}) = 0 lseek(3, 0, SEEK_CUR) = 0 dup(3) = 4 fcntl(4, F_GETFL) = 0x8000 (flags O_RDONLY|O_LARGEFILE) fstat(4, {st_mode=S_IFREG|0644, st_size=251, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b06b617f000 lseek(4, 0, SEEK_CUR) = 0 read(4, "#import numpy\n\nimport pickle\npri"..., 4096) = 251 close(4) = 0 munmap(0x2b06b617f000, 4096) = 0 lseek(3, 0, SEEK_SET) = 0 lseek(3, 0, SEEK_CUR) = 0 read(3, "#import numpy\n\nimport pickle\npri"..., 4096) = 251 close(3) = 0 write(2, " pickle.dumps(a, pickle.DEFAU"..., 45 pickle.dumps(a, pickle.DEFAULT_PROTOCOL) ) = 45 write(2, "SystemError: error return withou"..., 48SystemError: error return without exception set ) = 48 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x2b05b118e4c0}, {0x2b05b0e7a570, [], SA_RESTORER, 0x2b05b118e4c0}, 8) = 0 munmap(0x2b05b617e000, 4294971392) = 0 exit_group(1) = ? Why is this limitation? Please advise. ---------- components: Interpreter Core messages: 131060 nosy: nyevik priority: normal severity: normal status: open title: pickle limits most datatypes type: crash versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 00:00:31 2011 From: report at bugs.python.org (Piotr Kasprzyk) Date: Tue, 15 Mar 2011 23:00:31 +0000 Subject: [New-bugs-announce] [issue11565] Another (the last) group of misspellings In-Reply-To: <1300230031.73.0.170115051748.issue11565@psf.upfronthosting.co.za> Message-ID: <1300230031.73.0.170115051748.issue11565@psf.upfronthosting.co.za> New submission from Piotr Kasprzyk : This it the second (and last) part of misspellings. Please also close/reject issue 11507 - it is outdated. ---------- components: None files: another_misspellings.patch keywords: patch messages: 131061 nosy: ezio.melotti, kwadrat priority: normal severity: normal status: open title: Another (the last) group of misspellings type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21233/another_misspellings.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 00:39:16 2011 From: report at bugs.python.org (Ralf Schmitt) Date: Tue, 15 Mar 2011 23:39:16 +0000 Subject: [New-bugs-announce] [issue11566] hypot define in pyconfig.h clashes with g++'s cmath In-Reply-To: <1300232356.74.0.516279839285.issue11566@psf.upfronthosting.co.za> Message-ID: <1300232356.74.0.516279839285.issue11566@psf.upfronthosting.co.za> New submission from Ralf Schmitt : The following program #include #include results in the following error when compiled with g++ and -std=gnu++0x: $ g++ -std=gnu++0x -c t.cc -I /c/Python27/Include In file included from c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/include/c++/cmath:629:0, from t.cc:2: c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/include/c++/tr1_impl/cmath:203:11: error: '::hypot' has not been declared The problem is, that pyconfig.h has the following define: #define hypot _hypot It should probably just be removed when using gcc. ---------- components: None messages: 131067 nosy: schmir priority: normal severity: normal status: open title: hypot define in pyconfig.h clashes with g++'s cmath type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 04:36:56 2011 From: report at bugs.python.org (Ivan Radigales Creus) Date: Wed, 16 Mar 2011 03:36:56 +0000 Subject: [New-bugs-announce] [issue11567] http.server error message format In-Reply-To: <1300246616.21.0.232989758604.issue11567@psf.upfronthosting.co.za> Message-ID: <1300246616.21.0.232989758604.issue11567@psf.upfronthosting.co.za> New submission from Ivan Radigales Creus : The global variable DEFAULT_ERROR_MESSAGE on the module http.server is set to a non W3C standard value. It would be better to use something like: DEFAULT_ERROR_MESSAGE = """\ Error response

Error response

Error code %(code)d.

Message: %(message)s.

Error code explanation: %(code)s = %(explain)s.

""" That follows the W3C standards and validates successful on the http://validator.w3.org Thanks! ---------- components: Library (Lib) messages: 131086 nosy: Ivan.Radigales.Creus priority: normal severity: normal status: open title: http.server error message format type: performance versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 11:39:22 2011 From: report at bugs.python.org (Markus Korn) Date: Wed, 16 Mar 2011 10:39:22 +0000 Subject: [New-bugs-announce] [issue11568] docstring of select.epoll.register() is wrong In-Reply-To: <1300271962.07.0.948411199474.issue11568@psf.upfronthosting.co.za> Message-ID: <1300271962.07.0.948411199474.issue11568@psf.upfronthosting.co.za> New submission from Markus Korn : select.epoll.register raises an IOError for already registered fds, however the docstring says the fd gets modified: Python 2.7.1+ (r271:86832, Feb 24 2011, 15:00:15) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import select >>> print select.epoll.register.__doc__ register(fd[, eventmask]) -> None Registers a new fd or modifies an already registered fd. fd is the target file descriptor of the operation. events is a bit set composed of the various EPOLL constants; the default is EPOLL_IN | EPOLL_OUT | EPOLL_PRI. The epoll interface supports all file descriptors that support poll. >>> ---------- messages: 131100 nosy: thekorn priority: normal severity: normal status: open title: docstring of select.epoll.register() is wrong _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 13:03:51 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Wed, 16 Mar 2011 12:03:51 +0000 Subject: [New-bugs-announce] [issue11569] multiprocessing/darwin: sysctl(8) mislocation In-Reply-To: <1300277031.68.0.482799934053.issue11569@psf.upfronthosting.co.za> Message-ID: <1300277031.68.0.482799934053.issue11569@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : Hello Mac OS X gurus, multiprocessing/__init__py. searches for sysctl(8) via os.popen(), which will fail since the moist fruits provide sysctl(8) in /usr/sbin! The applied patch multiproc_sysctl.patch uses an absolute path. (This may be better anyway, what do you think of that???) ---------- components: Library (Lib) files: multiproc_sysctl.patch keywords: patch messages: 131104 nosy: ned.deily, ronaldoussoren, sdaoden priority: normal severity: normal status: open title: multiprocessing/darwin: sysctl(8) mislocation versions: Python 3.3 Added file: http://bugs.python.org/file21237/multiproc_sysctl.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 13:22:51 2011 From: report at bugs.python.org (=?utf-8?b?SmVzw7pzIENlYSBBdmnDs24=?=) Date: Wed, 16 Mar 2011 12:22:51 +0000 Subject: [New-bugs-announce] [issue11570] Lib/test/test_distutils.py tries to mix 32 and 64 bits object files, doesn't obey LDFLAGS In-Reply-To: <1300278171.06.0.772927158799.issue11570@psf.upfronthosting.co.za> Message-ID: <1300278171.06.0.772927158799.issue11570@psf.upfronthosting.co.za> New submission from Jes?s Cea Avi?n : Example of faulting build: http://www.python.org/dev/buildbot/all/builders/AMD64%20OpenIndiana%203.1/builds/297 Problem: "test_distutils.py" tests the generation of shared libraries. It correctly compile the ".c" to ".o" as 64 bits, but when linking the resulting file object, it tries to link in 32 bits mode, failing miserably. Manually adding: """ --- a/Lib/distutils/unixccompiler.py Wed Mar 16 12:48:54 2011 +0200 +++ b/Lib/distutils/unixccompiler.py Wed Mar 16 12:14:37 2011 +0000 @@ -251,6 +252,8 @@ if sys.platform == 'darwin': linker = _darwin_compiler_fixup(linker, ld_args) + print("*****************", repr(linker + ld_args)) + ld_args = ["-m64"]+ld_args self.spawn(linker + ld_args) except DistutilsExecError as msg: raise LinkError(msg) """ solves the issue. Notes: - Python is compiled with this configuration: ./configure --with-pydebug --with-computed-gotos "CFLAGS=-I/usr/local/include/ncursesw -m64" LDFLAGS=-m64 - "test_distutils.py" compilation step works OK, and obey CFLAGS. The command line used is "['gcc', '-I/usr/local/include/ncursesw', '-m64', '-g', '-Wall', '-Wstrict-prototypes', '-fPIC', '-IInclude', '-I/tmp/z/3.1', '-c', '/tmp/tmp8M7aOH/xxmodule.c', '-o', '/tmp/tmp8M7aOH/tmp/tmp8M7aOH/xxmodule.o']". - "test_distutils.py" linking steps fails. The command line used is "'gcc', '-shared', '/tmp/tmp8M7aOH/tmp/tmp8M7aOH/xxmodule.o', '-o', '/tmp/tmp8M7aOH/xx.so'". It doesn't include the "LDFLAGS" parameter we want. - Modifying the source code to add a "-m64" to the linking step solved the issue. - Python 2.7, 3.2 and 3.x works ok. ---------- components: Tests keywords: easy messages: 131106 nosy: jcea priority: normal severity: normal stage: needs patch status: open title: Lib/test/test_distutils.py tries to mix 32 and 64 bits object files, doesn't obey LDFLAGS type: compile error versions: Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 15:57:31 2011 From: report at bugs.python.org (Alexander Belopolsky) Date: Wed, 16 Mar 2011 14:57:31 +0000 Subject: [New-bugs-announce] [issue11571] Turtle window pops under the terminal on OSX In-Reply-To: <1300287451.35.0.164099198094.issue11571@psf.upfronthosting.co.za> Message-ID: <1300287451.35.0.164099198094.issue11571@psf.upfronthosting.co.za> New submission from Alexander Belopolsky : If you have a large enough terminal window and run $ python -m turtle on OSX, you will see nothing because turtle screen pops under the terminal. Ned Deily suggested in msg130421 that this can be fixed by setting "-topmost" WM attribute on the root window. However, if you apply the following patch: diff -r 71b182134853 Lib/turtle.py --- a/Lib/turtle.py Wed Mar 16 09:44:26 2011 -0400 +++ b/Lib/turtle.py Wed Mar 16 10:49:22 2011 -0400 @@ -993,6 +993,7 @@ self._colormode = _CFG["colormode"] self._keys = [] self.clear() + cv._rootwindow.call('wm', 'attributes', '.', '-topmost', '1') def clear(self): """Delete all drawings and all turtles from the TurtleScreen. The result is that turtle window stays on top even if you shift focus back to the terminal. The correct behavior would be for the turtle screen to pop on top, ideally without receiving the focus, but allow users to obscure it with another window if they wish. ---------- assignee: ronaldoussoren components: Library (Lib), Macintosh messages: 131124 nosy: belopolsky, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Turtle window pops under the terminal on OSX type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 17:32:32 2011 From: report at bugs.python.org (Brandon Craig Rhodes) Date: Wed, 16 Mar 2011 16:32:32 +0000 Subject: [New-bugs-announce] [issue11572] bring Lib/copy.py to 100% coverage In-Reply-To: <1300293152.7.0.733550751317.issue11572@psf.upfronthosting.co.za> Message-ID: <1300293152.7.0.733550751317.issue11572@psf.upfronthosting.co.za> New submission from Brandon Craig Rhodes : The attached patch will bring Lib/copy.py to 100% test coverage. A bug in "coverage" results in its only reporting 99% at the moment; see coverage issue #122 on bitbucket: https://bitbucket.org/ned/coveragepy/issue/122/for-else-always-reports-missing-branch This patch makes several minor improvements to "copy": when doing getattr lookups with a default of "None", it now uses an "is" comparison against None which is both faster and more correct; several special cases have been removed since Python 3 always has "CodeType" available; and an ancient obsolete test suite that had been appended to copy.py in ancient times has been removed. ---------- files: test_copy.patch keywords: patch messages: 131135 nosy: brandon-rhodes priority: normal severity: normal status: open title: bring Lib/copy.py to 100% coverage versions: Python 3.3 Added file: http://bugs.python.org/file21244/test_copy.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 18:15:42 2011 From: report at bugs.python.org (Armin Ronacher) Date: Wed, 16 Mar 2011 17:15:42 +0000 Subject: [New-bugs-announce] [issue11573] Improve Unicode Documentation with Known Caveats In-Reply-To: <1300295742.01.0.225887630619.issue11573@psf.upfronthosting.co.za> Message-ID: <1300295742.01.0.225887630619.issue11573@psf.upfronthosting.co.za> New submission from Armin Ronacher : The documentation should explain some of the common problems with Unicode on Python 3. * locale's affect the text default encoding * SSH clients can set the locale on a remote server * filesystem encoding is set by the SSH client as well ---------- components: Unicode messages: 131143 nosy: aronacher priority: normal severity: normal stage: needs patch status: open title: Improve Unicode Documentation with Known Caveats versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 18:26:35 2011 From: report at bugs.python.org (Armin Ronacher) Date: Wed, 16 Mar 2011 17:26:35 +0000 Subject: [New-bugs-announce] [issue11574] Unicode Fallback Encoding on Python 3.3 In-Reply-To: <1300296395.6.0.964785890032.issue11574@psf.upfronthosting.co.za> Message-ID: <1300296395.6.0.964785890032.issue11574@psf.upfronthosting.co.za> New submission from Armin Ronacher : Right now Python happily falls back to ASCII if it can not parse your LC_CTYPE or something similar happens. Instead of falling back to ASCII it would be better if it falls back to UTF-8. Alternatively it should at least give a warning that it's falling back to ASCII. This issue was discussed at PyCon and the consensus so far was that falling back to UTF-8 in 3.3 might be a good idea and should not break much code as UTF-8 is a superset of ASCII. ---------- components: Unicode messages: 131144 nosy: aronacher priority: normal severity: normal status: open title: Unicode Fallback Encoding on Python 3.3 versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 18:28:56 2011 From: report at bugs.python.org (Skip Montanaro) Date: Wed, 16 Mar 2011 17:28:56 +0000 Subject: [New-bugs-announce] [issue11575] addresses.txt file leaks into search engines In-Reply-To: <1300296536.31.0.787284858931.issue11575@psf.upfronthosting.co.za> Message-ID: <1300296536.31.0.787284858931.issue11575@psf.upfronthosting.co.za> New submission from Skip Montanaro : The python.org postmaster received this email today: -------------------- From: Tom Pinckney To: postmaster at python.org Subject: public email addresses Date: Wed, 16 Mar 2011 13:03:21 -0400 X-Spambayes-Classification: ham; 0.13 Kind of sucks that this file 1) exists 2) is indexed by google and 3) my email is in i\t. I found it by googling my email address to see what would come up. http://hg.python.org/pymigr/file/e727de0dfeec/addresses.txt ------------ I've asked the website team to see if they can adjust the robots.txt file, but is there something we can do to a) make it less likely that this file is harvested, or b) increase the obfuscation of the email addresses? (Maybe the entire file could be rot13?) ---------- messages: 131145 nosy: skip.montanaro priority: normal severity: normal status: open title: addresses.txt file leaks into search engines _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 19:32:54 2011 From: report at bugs.python.org (Enrico Zini) Date: Wed, 16 Mar 2011 18:32:54 +0000 Subject: [New-bugs-announce] [issue11576] timedelta subtraction glitch on big timedelta values In-Reply-To: <1300300374.42.0.323592740228.issue11576@psf.upfronthosting.co.za> Message-ID: <1300300374.42.0.323592740228.issue11576@psf.upfronthosting.co.za> New submission from Enrico Zini : Hello, I was testing edge case behaviour of some code of mine and stumbled into this unexpected domain error from timedelta: >>> from datetime import * >>> timedelta(999999999, 86399, 999999) - timedelta(999999999, 86399, 999998) Traceback (most recent call last): File "", line 1, in ? OverflowError: days=-1000000000; must have magnitude <= 999999999 >>> The expected result is of course timedelta(0, 0, 1): >>> timedelta(999999999, 86399, 999998) + timedelta(0, 0, 1) datetime.timedelta(999999999, 86399, 999999) Both time deltas are within the range documented in /usr/share/doc/python-doc/html/lib/datetime-timedelta.html I could reproduce it on 2.6.6 and 3.1.3. I don't have access to other python versions. Ciao, Enrico Note: I reported it 4 years ago in the Debian BTS (http://bugs.debian.org/408872) but I noticed now that the Debian maintainer doesn't seem to have bothered forwarding it here :( ---------- messages: 131155 nosy: enrico priority: normal severity: normal status: open title: timedelta subtraction glitch on big timedelta values type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 20:36:25 2011 From: report at bugs.python.org (Arkady Koplyarov) Date: Wed, 16 Mar 2011 19:36:25 +0000 Subject: [New-bugs-announce] [issue11577] testcase for exception binhex.Error In-Reply-To: <1300304185.45.0.991113451225.issue11577@psf.upfronthosting.co.za> Message-ID: <1300304185.45.0.991113451225.issue11577@psf.upfronthosting.co.za> New submission from Arkady Koplyarov : Testcase for exception binhex.Error to increase test coverage. ---------- components: Library (Lib), Tests files: testcase_for_binhex_module.patch keywords: patch messages: 131159 nosy: arkady.koplyarov priority: normal severity: normal status: open title: testcase for exception binhex.Error versions: Python 2.7 Added file: http://bugs.python.org/file21248/testcase_for_binhex_module.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 16 21:27:07 2011 From: report at bugs.python.org (Michael Henry) Date: Wed, 16 Mar 2011 20:27:07 +0000 Subject: [New-bugs-announce] [issue11578] Increase test coverage for timeit.py In-Reply-To: <1300307227.56.0.233218695639.issue11578@psf.upfronthosting.co.za> Message-ID: <1300307227.56.0.233218695639.issue11578@psf.upfronthosting.co.za> New submission from Michael Henry : The timeit.py module has no specific tests. The attached patch adds Lib/test/test_timeit.py for unit testing, along with slight modifications to timeit.py to support predictable unit testing. ---------- components: Library (Lib) files: timeit_unit_test.patch keywords: patch messages: 131171 nosy: michael.henry, r.david.murray priority: normal severity: normal status: open title: Increase test coverage for timeit.py Added file: http://bugs.python.org/file21251/timeit_unit_test.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 05:27:10 2011 From: report at bugs.python.org (Senthil Kumaran) Date: Thu, 17 Mar 2011 04:27:10 +0000 Subject: [New-bugs-announce] [issue11579] python 2.5 does not build from hg - looks for subversion keywords In-Reply-To: <1300336030.91.0.421236681435.issue11579@psf.upfronthosting.co.za> Message-ID: <1300336030.91.0.421236681435.issue11579@psf.upfronthosting.co.za> New submission from Senthil Kumaran : Here is the make log and a patch to ignore looking for subversion keyword and assume some defaults (same is done in 2.6 + higher). ---------- components: Installation files: make-error.log messages: 131216 nosy: loewis, orsenthil priority: normal severity: normal stage: needs patch status: open title: python 2.5 does not build from hg - looks for subversion keywords type: compile error versions: Python 2.5 Added file: http://bugs.python.org/file21259/make-error.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 05:39:50 2011 From: report at bugs.python.org (Ray.Allen) Date: Thu, 17 Mar 2011 04:39:50 +0000 Subject: [New-bugs-announce] [issue11580] Add width and precision formatters to PyBytes_FromFormatV() In-Reply-To: <1300336790.91.0.426926031366.issue11580@psf.upfronthosting.co.za> Message-ID: <1300336790.91.0.426926031366.issue11580@psf.upfronthosting.co.za> New submission from Ray.Allen : By working on some PyUnicode_FromFormatV() related issue(#7330, #10829), I found some same problems with PyBytes_FromFormatV(): It doesn't support width formatter for %u, %i, %x, %d, %s, also it doesn't support %lld and %llu. Attached patch fix the problem: Add width formatter for %u, %i, %x, %d Add width and precision formatter for %s Add %lld and %llu support. It copies the same idea from #10829: add the parse_format_flags() function. ---------- components: Interpreter Core files: pybytes_fromformatv.diff keywords: patch messages: 131218 nosy: ysj.ray priority: normal severity: normal status: open title: Add width and precision formatters to PyBytes_FromFormatV() versions: Python 3.3 Added file: http://bugs.python.org/file21261/pybytes_fromformatv.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 08:02:20 2011 From: report at bugs.python.org (Senthil Kumaran) Date: Thu, 17 Mar 2011 07:02:20 +0000 Subject: [New-bugs-announce] [issue11581] buildbot error when pushing to 2.5 branch? In-Reply-To: <20110317070211.GC3754@kevin> Message-ID: <20110317070211.GC3754@kevin> New submission from Senthil Kumaran : When pushed a change to 2.5 branch, I got an error, which I think has to do with buildbot not available for 2.5 codeline. It asked me to notify the tracker and here it is. remote: state = method(*args, **kw) remote: File "/data/buildbot/master/master.cfg", line 87, in perspective_addChange remote: changedict['category'] = branch_to_category[changedict['branch']] remote: exceptions.KeyError: '2.5' remote: ] remote: sent email to roundup at report at bugs.python.org ---------- files: bb-error.txt messages: 131229 nosy: orsenthil, python-dev priority: normal severity: normal status: open title: buildbot error when pushing to 2.5 branch? Added file: http://bugs.python.org/file21263/bb-error.txt _______________________________________ Python tracker _______________________________________ -------------- next part -------------- pushing to ssh://hg at hg.python.org/cpython searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 4 changesets with 2 changes to 1 files remote: change(s) NOT sent, something went wrong: remote: [Failure instance: Traceback from remote host -- Traceback (most recent call last): remote: File "/usr/lib/python2.6/dist-packages/twisted/spread/banana.py", line 153, in gotItem remote: self.callExpressionReceived(item) remote: File "/usr/lib/python2.6/dist-packages/twisted/spread/banana.py", line 116, in callExpressionReceived remote: self.expressionReceived(obj) remote: File "/usr/lib/python2.6/dist-packages/twisted/spread/pb.py", line 514, in expressionReceived remote: method(*sexp[1:]) remote: File "/usr/lib/python2.6/dist-packages/twisted/spread/pb.py", line 826, in proto_message remote: self._recvMessage(self.localObjectForID, requestID, objectID, message, answerRequired, netArgs, netKw) remote: --- --- remote: File "/usr/lib/python2.6/dist-packages/twisted/spread/pb.py", line 840, in _recvMessage remote: netResult = object.remoteMessageReceived(self, message, netArgs, netKw) remote: File "/usr/lib/python2.6/dist-packages/twisted/spread/pb.py", line 225, in perspectiveMessageReceived remote: state = method(*args, **kw) remote: File "/data/buildbot/master/master.cfg", line 87, in perspective_addChange remote: changedict['category'] = branch_to_category[changedict['branch']] remote: exceptions.KeyError: '2.5' remote: ] remote: sent email to roundup at report at bugs.python.org remote: notified python-checkins at python.org of incoming changeset e9724d7abbc2 remote: notified python-checkins at python.org of incoming changeset 8cdb95cf096e remote: notified python-checkins at python.org of incoming changeset 6cd7de9deb1a remote: notified python-checkins at python.org of incoming changeset 1148131b1099 From report at bugs.python.org Thu Mar 17 08:04:05 2011 From: report at bugs.python.org (knickerkicker) Date: Thu, 17 Mar 2011 07:04:05 +0000 Subject: [New-bugs-announce] [issue11582] Boilerplate code replaced in Python/ceval.c In-Reply-To: <1300345445.4.0.401745683259.issue11582@psf.upfronthosting.co.za> Message-ID: <1300345445.4.0.401745683259.issue11582@psf.upfronthosting.co.za> New submission from knickerkicker : Replaced boilerplate implementations of several BINARY_* and INPLACE_* opcodes with two macros. The result shaves off 154 lines from Python/ceval.c. ---------- components: Interpreter Core files: 20110317_ceval.patch keywords: patch messages: 131230 nosy: knicker.kicker priority: normal severity: normal status: open title: Boilerplate code replaced in Python/ceval.c versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file21264/20110317_ceval.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 10:38:33 2011 From: report at bugs.python.org (Eli Bendersky) Date: Thu, 17 Mar 2011 09:38:33 +0000 Subject: [New-bugs-announce] [issue11583] os.path.isdir() is slow on windows In-Reply-To: <1300354713.42.0.570312056806.issue11583@psf.upfronthosting.co.za> Message-ID: <1300354713.42.0.570312056806.issue11583@psf.upfronthosting.co.za> New submission from Eli Bendersky : Report here: http://stackoverflow.com/questions/5316928/python-os-path-isdir-is-slow-on-windows It could be a problem with Windows itself, but I'm opening this to keep track of the issue, just to be on the safe side. ---------- components: Library (Lib) messages: 131238 nosy: brian.curtin, eli.bendersky, tim.golden priority: normal severity: normal status: open title: os.path.isdir() is slow on windows type: performance versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 12:53:47 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Thu, 17 Mar 2011 11:53:47 +0000 Subject: [New-bugs-announce] [issue11584] email/header.py: missing str()ification, and bogus encode()s In-Reply-To: <1300362827.23.0.229630674906.issue11584@psf.upfronthosting.co.za> Message-ID: <1300362827.23.0.229630674906.issue11584@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : My minimal failing test case dragged yet another EMAIL error to the light!!! Man, man, man - it's really great that QNX fund money so that you have the time to fix this broken thing! It's got washed away, but http://bugs.python.org/file21210/email_header.diff can be used on top of 42cd61b96e54 to fix the following: ______ Traceback (most recent call last): [FOREIGN CODE] File "/Users/steffen/usr/bin/s-postman.py", line 1765, in _bewitch_msg self._msg[n] = email.header.make_header(email.header.decode_header(b)) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 73, in decode_header if not ecre.search(header): Exception: TypeError: expected string or buffer ______ However, if that's patched in, we end up here ______ Traceback (most recent call last): [FOREIGN CODE] File "/Users/steffen/usr/bin/s-postman.py", line 1765, in _bewitch_msg self._msg[n] = email.header.make_header(email.header.decode_header(b)) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 154, in make_header h.append(s, charset) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py", line 278, in append s.encode(output_charset, errors) Exception: UnicodeEncodeError: 'ascii' codec can't encode character '\ufffd' in position 7: ordinal not in range(128) ______ Let me know if you want that '456943 17 Mar 12:51 rdm-postman.tbz' thing, it's waiting for you. It contains a digest mbox, a config and the patched S-Postman. Maybe i can strip it to 420000 if i spend some more time on it. ---------- components: Library (Lib) messages: 131242 nosy: r.david.murray, sdaoden priority: normal severity: normal status: open title: email/header.py: missing str()ification, and bogus encode()s versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 14:40:08 2011 From: report at bugs.python.org (Clive Darke) Date: Thu, 17 Mar 2011 13:40:08 +0000 Subject: [New-bugs-announce] [issue11585] Documentation 1.8 shows Python 2 example In-Reply-To: <1300369208.25.0.790450898206.issue11585@psf.upfronthosting.co.za> Message-ID: <1300369208.25.0.790450898206.issue11585@psf.upfronthosting.co.za> New submission from Clive Darke : Python 3.2 version attached ---------- assignee: docs at python components: Documentation files: parrot.c messages: 131246 nosy: cdarke, docs at python priority: normal severity: normal status: open title: Documentation 1.8 shows Python 2 example versions: Python 3.1, Python 3.2 Added file: http://bugs.python.org/file21267/parrot.c _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 15:17:19 2011 From: report at bugs.python.org (Ray.Allen) Date: Thu, 17 Mar 2011 14:17:19 +0000 Subject: [New-bugs-announce] [issue11586] Python/pythonrun.c: get_codec_name() typo In-Reply-To: <1300371439.34.0.145092588247.issue11586@psf.upfronthosting.co.za> Message-ID: <1300371439.34.0.145092588247.issue11586@psf.upfronthosting.co.za> New submission from Ray.Allen : I guess there is a typo in the source of this function: Python/pythonrun.c: get_codec_name() diff -r 48970d754841 Python/pythonrun.c --- a/Python/pythonrun.c Thu Mar 17 17:06:27 2011 +0800 +++ b/Python/pythonrun.c Thu Mar 17 22:11:15 2011 +0800 @@ -147,7 +147,7 @@ goto error; name_utf8 = _PyUnicode_AsString(name); - if (name == NULL) + if (name_utf8 == NULL) goto error; name_str = strdup(name_utf8); Py_DECREF(name); ---------- components: Interpreter Core messages: 131252 nosy: ysj.ray priority: normal severity: normal status: open title: Python/pythonrun.c: get_codec_name() typo versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 15:17:30 2011 From: report at bugs.python.org (Clive Darke) Date: Thu, 17 Mar 2011 14:17:30 +0000 Subject: [New-bugs-announce] [issue11587] METH_KEYWORDS alone gives "METH_OLDARGS is no longer supported!" In-Reply-To: <1300371450.74.0.196347407425.issue11587@psf.upfronthosting.co.za> Message-ID: <1300371450.74.0.196347407425.issue11587@psf.upfronthosting.co.za> New submission from Clive Darke : In the PyMethodDef struct, METH_VARARGS | METH_KEYWORDS works fine. METH_KEYWORDS on its own gives: "SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer supported!" METH_KEYWORDS on its own tested OK on 2.6 and 2.7, fails as described on 3.1.2 and 3.2. ---------- components: Extension Modules messages: 131253 nosy: cdarke priority: normal severity: normal status: open title: METH_KEYWORDS alone gives "METH_OLDARGS is no longer supported!" type: compile error versions: Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 16:51:32 2011 From: report at bugs.python.org (John Didion) Date: Thu, 17 Mar 2011 15:51:32 +0000 Subject: [New-bugs-announce] [issue11588] Add "necessarily inclusive" groups to argparse In-Reply-To: <1300377092.03.0.159307937388.issue11588@psf.upfronthosting.co.za> Message-ID: <1300377092.03.0.159307937388.issue11588@psf.upfronthosting.co.za> New submission from John Didion : Just as some options are mutually exclusive, there are others that are "necessarily inclusive," i.e. all or nothing. I propose the addition of ArgumentParser.add_necessarily_inclusive_group(required=True). This also means that argparse will need to support nested groups. For example, if I want to set up options such that the user has to provide an output file OR (an output directory AND (an output file pattern OR an output file extension)): output_group = parser.add_mutually_exclusive_group(required=True) output_group.add_argument("-o", "--outfile") outdir_group = output_group.add_necessarily_inclusive_group() outdir_group.add_argument("-O", "--outdir") outfile_group = outdir_group.add_mutually_exclusive_group(required=True) outfile_group.add_argument("-p", "--outpattern") outfile_group.add_argument("-s", "--outsuffix") The usage should then look like: (-o FILE | (-O DIR & (-p PATTERN | -s SUFFIX)) ---------- messages: 131262 nosy: John.Didion priority: normal severity: normal status: open title: Add "necessarily inclusive" groups to argparse type: feature request versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 16:55:50 2011 From: report at bugs.python.org (Michael Henry) Date: Thu, 17 Mar 2011 15:55:50 +0000 Subject: [New-bugs-announce] [issue11589] Unit test extensions for email module In-Reply-To: <1300377350.1.0.876625755844.issue11589@psf.upfronthosting.co.za> Message-ID: <1300377350.1.0.876625755844.issue11589@psf.upfronthosting.co.za> New submission from Michael Henry : The attached patch includes additional unit tests for the email module, and splits pre-existing test_header_encode() and test_decode() functions into individual test functions. ---------- components: Library (Lib) files: test_email_additional_tests.patch keywords: patch messages: 131263 nosy: michael.henry, r.david.murray priority: normal severity: normal status: open title: Unit test extensions for email module Added file: http://bugs.python.org/file21269/test_email_additional_tests.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 17:30:11 2011 From: report at bugs.python.org (Michael Henry) Date: Thu, 17 Mar 2011 16:30:11 +0000 Subject: [New-bugs-announce] [issue11590] email quoprimime.py patch for header_encode of empty string, decode with different eol In-Reply-To: <1300379411.81.0.498480234952.issue11590@psf.upfronthosting.co.za> Message-ID: <1300379411.81.0.498480234952.issue11590@psf.upfronthosting.co.za> New submission from Michael Henry : The attached patch adds unit tests and some minor fixes for the email module's quoprimime.py file. The header_encode() function did not properly return an empty string when given an empty string. The decode() function did not properly detect the input string's EOL character. This patch depends on application of the patch in issue #11589. ---------- components: Library (Lib) files: quoprimime_patch_header_encode_decode.patch keywords: patch messages: 131265 nosy: michael.henry, r.david.murray priority: normal severity: normal status: open title: email quoprimime.py patch for header_encode of empty string, decode with different eol Added file: http://bugs.python.org/file21270/quoprimime_patch_header_encode_decode.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 20:47:00 2011 From: report at bugs.python.org (Carl Meyer) Date: Thu, 17 Mar 2011 19:47:00 +0000 Subject: [New-bugs-announce] [issue11591] "python -S" should be robust against e.g. "from site import addsitedir" In-Reply-To: <1300391220.57.0.0581670249847.issue11591@psf.upfronthosting.co.za> Message-ID: <1300391220.57.0.0581670249847.issue11591@psf.upfronthosting.co.za> New submission from Carl Meyer : If python is run with the -S flag, that declares the intent of the user to not have site-specific additions to sys.path. However, some code in that process may have a legitimate need for a function defined in site.py - for instance, addsitedir. But the act of importing site.py, as a side effect, adds the standard site-specific directories to sys.path. python -S would be more useful and reliable if it prevented importing site from automatically making the sys.path additions. There is no loss of flexibility here, as user code could still explicitly call site.main() to achieve all of the current side-effects of "import site". The fix is a one-liner, and is in the linked hg repository. ---------- components: Library (Lib) hgrepos: 4 messages: 131281 nosy: carljm priority: normal severity: normal status: open title: "python -S" should be robust against e.g. "from site import addsitedir" type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 17 22:44:31 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 17 Mar 2011 21:44:31 +0000 Subject: [New-bugs-announce] [issue11592] Compilation warnings in os module In-Reply-To: <1300398271.32.0.210972675155.issue11592@psf.upfronthosting.co.za> Message-ID: <1300398271.32.0.210972675155.issue11592@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Under Linux: ./Modules/posixmodule.c: In function ?posix_readv?: ./Modules/posixmodule.c:6239: attention : implicit declaration of function ?readv? ./Modules/posixmodule.c: In function ?posix_writev?: ./Modules/posixmodule.c:6583: attention : implicit declaration of function ?writev? Yet the presence of sys/uio.h seems correctly detected: $ grep UIO pyconfig.h #define HAVE_SYS_UIO_H 1 ---------- assignee: rosslagerwall messages: 131287 nosy: pitrou, rosslagerwall priority: normal severity: normal status: open title: Compilation warnings in os module type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 05:53:45 2011 From: report at bugs.python.org (Samuel Michaels) Date: Fri, 18 Mar 2011 04:53:45 +0000 Subject: [New-bugs-announce] [issue11593] Add encoding parameter to logging.basicConfig In-Reply-To: <1300424025.83.0.489741781073.issue11593@psf.upfronthosting.co.za> Message-ID: <1300424025.83.0.489741781073.issue11593@psf.upfronthosting.co.za> New submission from Samuel Michaels : Yes, you could just make a custom logging.FileHandler object, but this way is much easier for those who are following the basic logging tutorial. ---------- components: Library (Lib) files: __init__.patch keywords: patch messages: 131314 nosy: Samuel.Michaels priority: normal severity: normal status: open title: Add encoding parameter to logging.basicConfig type: feature request versions: Python 3.2 Added file: http://bugs.python.org/file21275/__init__.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 17:27:28 2011 From: report at bugs.python.org (Alexander Belchenko) Date: Fri, 18 Mar 2011 16:27:28 +0000 Subject: [New-bugs-announce] [issue11594] 2to3 tool does not preserve line-endings In-Reply-To: <1300465648.02.0.83291128633.issue11594@psf.upfronthosting.co.za> Message-ID: <1300465648.02.0.83291128633.issue11594@psf.upfronthosting.co.za> New submission from Alexander Belchenko : I'm using LF-only line-endings for development of my IntelHex library. I'm working on Windows most of the time. After 2to3 tool has been ran on my library it has not only changed the Python syntax, but it also saved all files with CRLF line-endings. As result I have all changed files completelly modified and diff shows change in every line. 2to3 tool should respect my line-endings and must not use simple open(xxx, "wt") mode for writing modified files. ---------- components: 2to3 (2.x to 3.0 conversion tool) messages: 131335 nosy: bialix priority: normal severity: normal status: open title: 2to3 tool does not preserve line-endings type: behavior versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 17:38:37 2011 From: report at bugs.python.org (Erik Bray) Date: Fri, 18 Mar 2011 16:38:37 +0000 Subject: [New-bugs-announce] [issue11595] Miscellaneous bugs in cfg_to_args() utility function In-Reply-To: <1300466317.84.0.72161184259.issue11595@psf.upfronthosting.co.za> Message-ID: <1300466317.84.0.72161184259.issue11595@psf.upfronthosting.co.za> New submission from Erik Bray : Attached is a patch that fixes a few miscellaneous bugs in cfg_to_args() that were holding me up. Namely: * A bad variable name (file -> path) * A few more fields needed to be in MULTI_FIELDS * Added support for packages_root -> package_dir conversion This also adds a unit test for cfg_to_args(). ---------- assignee: tarek components: Distutils2 files: cfg_to_args.patch keywords: patch messages: 131336 nosy: Erik.Bray, alexis, eric.araujo, tarek priority: normal severity: normal status: open title: Miscellaneous bugs in cfg_to_args() utility function Added file: http://bugs.python.org/file21278/cfg_to_args.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 17:56:28 2011 From: report at bugs.python.org (Lorenz) Date: Fri, 18 Mar 2011 16:56:28 +0000 Subject: [New-bugs-announce] [issue11596] import error in test_fileinput.py when bz2 not installed (windows) In-Reply-To: <1300467388.91.0.848437619379.issue11596@psf.upfronthosting.co.za> Message-ID: <1300467388.91.0.848437619379.issue11596@psf.upfronthosting.co.za> New submission from Lorenz : there is an ImportError when there is no bz2 lib and the test_fileinput is running. ---------- components: Tests files: check_bz2_lib_available.diff keywords: patch messages: 131338 nosy: DaMutz priority: normal severity: normal status: open title: import error in test_fileinput.py when bz2 not installed (windows) type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21279/check_bz2_lib_available.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 18:08:04 2011 From: report at bugs.python.org (the_isz) Date: Fri, 18 Mar 2011 17:08:04 +0000 Subject: [New-bugs-announce] [issue11597] Can't get ConfigParser.write to write unicode strings In-Reply-To: <1300468084.29.0.517380899901.issue11597@psf.upfronthosting.co.za> Message-ID: <1300468084.29.0.517380899901.issue11597@psf.upfronthosting.co.za> New submission from the_isz : Hey everyone, I'm having issues writing unicode strings with ConfigParser.write. I don't know if this is python's fault or my own but I couldn't find help on this, neither by googling, nor by asking on the python irc channels. Attached to this description I'll add an example script reproducing the error and hope that someone will enlighten me on what I'm doing wrong. It seems that this only occurs in python2, doing the same with python3 (omitting the u before the unicode string), everything works fine. Thanks in advance! ---------- components: Extension Modules files: test.py messages: 131339 nosy: the_isz priority: normal severity: normal status: open title: Can't get ConfigParser.write to write unicode strings type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file21280/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 19:28:46 2011 From: report at bugs.python.org (Carl Meyer) Date: Fri, 18 Mar 2011 18:28:46 +0000 Subject: [New-bugs-announce] [issue11598] missing afxres.h error when building bdist_wininst in Visual Studio 2008 Express In-Reply-To: <1300472926.52.0.331223446631.issue11598@psf.upfronthosting.co.za> Message-ID: <1300472926.52.0.331223446631.issue11598@psf.upfronthosting.co.za> New submission from Carl Meyer : By opening up pcbuild.sln in VS2008 Express, I was able to successfully build python and pythonw, but when I tried to build bdist_wininst it failed with "Fatal Error RC1015: cannot open include file afxres.h" Googling turned up a number of comments about how this file is part of MFC, which is really not supposed to be used with VS2008. The recommended "fix" that seemed to work for most people online was to replace "afxres.h" with "windows.h" in the rc file. I did this in PC/bdist_wininst/install.rc, and then it failed with a different error about a missing IDC_STATIC token. I have very little experience with Windows, so it's entirely possible I'm just doing something wrong, but I was asked in #python-dev to file a bug here. ---------- components: Build, Windows messages: 131351 nosy: carljm priority: normal severity: normal status: open title: missing afxres.h error when building bdist_wininst in Visual Studio 2008 Express versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 19:33:56 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Fri, 18 Mar 2011 18:33:56 +0000 Subject: [New-bugs-announce] [issue11599] Useless error message when distutils fails compiling In-Reply-To: <1300473236.84.0.248517729635.issue11599@psf.upfronthosting.co.za> Message-ID: <1300473236.84.0.248517729635.issue11599@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Really, can't distutils at least display the command-line that failed to execute? Traceback (most recent call last): File "/home/antoine/cpython/default/Lib/distutils/unixccompiler.py", line 176, in _compile extra_postargs) File "/home/antoine/cpython/default/Lib/distutils/ccompiler.py", line 911, in spawn spawn(cmd, dry_run=self.dry_run) File "/home/antoine/cpython/default/Lib/distutils/spawn.py", line 34, in spawn _spawn_posix(cmd, search_path, dry_run=dry_run) File "/home/antoine/cpython/default/Lib/distutils/spawn.py", line 138, in _spawn_posix % (cmd[0], exit_status)) distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/antoine/cpython/default/Lib/test/test_embed.py", line 42, in test_subinterps exe = self.make_exe("embed1.c") File "/home/antoine/cpython/default/Lib/test/test_embed.py", line 29, in make_exe compiler.compile([srcpath], output_dir=build_dir) File "/home/antoine/cpython/default/Lib/distutils/ccompiler.py", line 576, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/home/antoine/cpython/default/Lib/distutils/unixccompiler.py", line 178, in _compile raise CompileError(msg) distutils.errors.CompileError: command 'gcc' failed with exit status 1 ---------- assignee: tarek components: Distutils messages: 131352 nosy: eric.araujo, pitrou, tarek priority: normal severity: normal stage: needs patch status: open title: Useless error message when distutils fails compiling type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 19:47:19 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Fri, 18 Mar 2011 18:47:19 +0000 Subject: [New-bugs-announce] [issue11600] PY_CFLAGS and PY_CPPFLAGS inconsistent In-Reply-To: <1300474039.66.0.607700128709.issue11600@psf.upfronthosting.co.za> Message-ID: <1300474039.66.0.607700128709.issue11600@psf.upfronthosting.co.za> New submission from Antoine Pitrou : One contains the include dirs for Python, not the other: >>> distutils.sysconfig.get_config_var('PY_CFLAGS') '-g -O0 -Wall -Wstrict-prototypes' >>> distutils.sysconfig.get_config_var('PY_CPPFLAGS') '-I. -IInclude -I./Include' In Python 2.7 and 3.1, PY_CFLAGS did contain the include dirs, so this seems to be a regression: >>> distutils.sysconfig.get_config_var('PY_CFLAGS') '-g -O2 -g -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE' ---------- assignee: tarek components: Distutils messages: 131354 nosy: eric.araujo, pitrou, tarek priority: high severity: normal stage: needs patch status: open title: PY_CFLAGS and PY_CPPFLAGS inconsistent type: behavior versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 20:04:14 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Fri, 18 Mar 2011 19:04:14 +0000 Subject: [New-bugs-announce] [issue11601] UnixCCompiler always uses compiler_so, not compiler In-Reply-To: <1300475054.67.0.598192564175.issue11601@psf.upfronthosting.co.za> Message-ID: <1300475054.67.0.598192564175.issue11601@psf.upfronthosting.co.za> New submission from Antoine Pitrou : UnixCCompiler always uses "compiler_so", not "compiler", even when creating a .o file. It is misleading and begs the question why compiler even exists. ---------- assignee: tarek components: Distutils messages: 131355 nosy: eric.araujo, pitrou, tarek priority: normal severity: normal stage: needs patch status: open title: UnixCCompiler always uses compiler_so, not compiler type: behavior versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 20:11:18 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Fri, 18 Mar 2011 19:11:18 +0000 Subject: [New-bugs-announce] [issue11602] python-config code should be in sysconfig In-Reply-To: <1300475478.49.0.935411639754.issue11602@psf.upfronthosting.co.za> Message-ID: <1300475478.49.0.935411639754.issue11602@psf.upfronthosting.co.za> New submission from Antoine Pitrou : python-config has the following non-trivial code for discovery of cflags/ldflags, which should be callable as a sysconfig API instead: elif opt in ('--includes', '--cflags'): flags = ['-I' + sysconfig.get_path('include'), '-I' + sysconfig.get_path('platinclude')] if opt == '--cflags': flags.extend(getvar('CFLAGS').split()) print(' '.join(flags)) elif opt in ('--libs', '--ldflags'): libs = getvar('LIBS').split() + getvar('SYSLIBS').split() libs.append('-lpython' + pyver + sys.abiflags) # add the prefix/lib/pythonX.Y/config dir, but only if there is no # shared library in prefix/lib/. if opt == '--ldflags': if not getvar('Py_ENABLE_SHARED'): libs.insert(0, '-L' + getvar('LIBPL')) libs.extend(getvar('LINKFORSHARED').split()) print(' '.join(libs)) Also, it begs the question why distutils doesn't use the same code in its compiler class, or even in customize_compiler()... ---------- assignee: tarek components: Distutils messages: 131357 nosy: eric.araujo, pitrou, tarek priority: normal severity: normal stage: needs patch status: open title: python-config code should be in sysconfig type: behavior versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 18 22:15:17 2011 From: report at bugs.python.org (Carl Banks) Date: Fri, 18 Mar 2011 21:15:17 +0000 Subject: [New-bugs-announce] [issue11603] Python crashes or hangs when rebinding __repr__ as __str__ In-Reply-To: <1300482917.38.0.116490632242.issue11603@psf.upfronthosting.co.za> Message-ID: <1300482917.38.0.116490632242.issue11603@psf.upfronthosting.co.za> New submission from Carl Banks : The issue was raised by J Peyret on the following c.l.python thread: http://groups.google.com/group/comp.lang.python/browse_frm/thread/459e5ec433e7dcab?hl=en# Several posters reported that the following code either hangs or crashes Python (versions 2.7, 2.6, and 3.2, on Windows and Linux) were tested: ------------- class Foo(object): pass Foo.__repr__ = Foo.__str__ foo = Foo() print(str(foo)) ------------- ---------- components: Interpreter Core messages: 131364 nosy: aerojockey priority: normal severity: normal status: open title: Python crashes or hangs when rebinding __repr__ as __str__ type: crash versions: Python 2.6, Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 19 03:13:57 2011 From: report at bugs.python.org (Terry J. Reedy) Date: Sat, 19 Mar 2011 02:13:57 +0000 Subject: [New-bugs-announce] [issue11604] Have type(n, b, d) check for type(b[i]) is module In-Reply-To: <1300500837.93.0.136999770094.issue11604@psf.upfronthosting.co.za> Message-ID: <1300500837.93.0.136999770094.issue11604@psf.upfronthosting.co.za> New submission from Terry J. Reedy : People occasionally ask on python-list about the following error message when trying to create a class: > TypeError: Error when calling the metaclass bases > module.__init__() takes at most 2 arguments (3 given) It is a bit cryptic. It is also accidental: if module.__init__ happened to take 3 args instead of 2, the exception would be delayed until ??? The cause is using a module as a superclass, as in import UserDict class MyDict(UserDict): pass This seems to happen mostly because of duplicate (or only case-different) module/class names. Suggestion: insert a specific module type check for bases in type_new() in typeobject.c. In Python: if basetype is module: # where 'module' is the module class raise TypeError('Cannot subclass module') I see 2 possible places to put the check: 1. for all bases - after tmp = PyTuple_GET_ITEM(bases, i); tmptype = Py_TYPE(tmp); Advantage: can add (name of) tmp to the error message. 2. Before the return call in if (winner != metatype) { if (winner->tp_new != type_new) /* Pass it to the winner */ return winner->tp_new(winner, args, kwds); Advantage: only add extra check when module is the winner and are about to call it as a metaclass, which raises the current error. Any test would be CPython specific and would require checking something about the message text. I am only suggesting a check for module because the is the only mistake I remember anyone reporting. Passing a number as a base class gives a similar message, but no one does that. And as far as I know, there is no way in general to detect whether a callable works as a metaclass except by calling it with name, bases, and dict. ---------- components: Interpreter Core messages: 131381 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: Have type(n,b,d) check for type(b[i]) is module type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 19 11:55:56 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Sat, 19 Mar 2011 10:55:56 +0000 Subject: [New-bugs-announce] [issue11605] EMail generator.flatten() disintegrates over UTF-8 multipart/alternative In-Reply-To: <1300532156.44.0.386489107075.issue11605@psf.upfronthosting.co.za> Message-ID: <1300532156.44.0.386489107075.issue11605@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : Hi David, i'm having real problems here! Got a multipart mail and i get this: ______ Traceback (most recent call last): File "/Users/steffen/usr/bin/s-postman.py", line 1239, in save_ticket mb.add(ticket.message()) File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 279, in add self._dump_message(message, tmp_file) File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 215, in _dump_message gen.flatten(message) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 91, in flatten self._write(msg) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 137, in _write self._dispatch(msg) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 163, in _dispatch meth(msg) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 224, in _handle_multipart g.flatten(part, unixfrom=False, linesep=self._NL) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 91, in flatten self._write(msg) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 137, in _write self._dispatch(msg) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 163, in _dispatch meth(msg) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 388, in _handle_text super(BytesGenerator,self)._handle_text(msg) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 201, in _handle_text self.write(payload) File "/Users/steffen/usr/opt/py3k/lib/python3.3/email/generator.py", line 349, in write self._fp.write(s.encode('ascii', 'surrogateescape')) Exception: UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 21: ordinal not in range(128) ______ I'll attach that mail. I don't know wether your version of my postman reproduces it (though it should, but hey, it's broken!), i'm using tag 0.4.0a1 (revision 420fcd870797). I would be thankful for a hint on what this is and how i can avoid this. ---------- components: Library (Lib) files: generator_booom.mbox messages: 131406 nosy: r.david.murray, sdaoden priority: normal severity: normal status: open title: EMail generator.flatten() disintegrates over UTF-8 multipart/alternative type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21288/generator_booom.mbox _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 19 13:13:16 2011 From: report at bugs.python.org (Michael Henry) Date: Sat, 19 Mar 2011 12:13:16 +0000 Subject: [New-bugs-announce] [issue11606] maxlinelen exceeded by email module's body_encode() function In-Reply-To: <1300536796.56.0.211033588078.issue11606@psf.upfronthosting.co.za> Message-ID: <1300536796.56.0.211033588078.issue11606@psf.upfronthosting.co.za> New submission from Michael Henry : The email module's body_encode() function (found in quoprimime.py) can generate oversized encoded lines that exceed the maximum line length specified by the maxlinelen parameter. The attached test case 'test_encode_trailing_space_at_maxlinelen' demonstrates the problem. When encoding the body 'abcd \n1234' with maxlinelen=5, the erroneous output is 'abcd =\n\n1234', with 6 characters in the first output line. The attached patch provides unit tests and a fix for body_encode(). Note: This patch depends on application of the patch in Issue #11590. ---------- components: Library (Lib) files: quoprimime_patch_body_encode.patch keywords: patch messages: 131407 nosy: michael.henry, r.david.murray priority: normal severity: normal status: open title: maxlinelen exceeded by email module's body_encode() function Added file: http://bugs.python.org/file21289/quoprimime_patch_body_encode.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 19 17:10:00 2011 From: report at bugs.python.org (roobman26) Date: Sat, 19 Mar 2011 16:10:00 +0000 Subject: [New-bugs-announce] [issue11607] Apllication crashes when saving file In-Reply-To: <1300551000.41.0.0747067514323.issue11607@psf.upfronthosting.co.za> Message-ID: <1300551000.41.0.0747067514323.issue11607@psf.upfronthosting.co.za> New submission from roobman26 : when i try to save a file it saves, but then the application crashes. The same thing happens when I try to open a saved file. ---------- assignee: ronaldoussoren components: Macintosh messages: 131424 nosy: ronaldoussoren, roobman26 priority: normal severity: normal status: open title: Apllication crashes when saving file type: crash versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 19 17:18:50 2011 From: report at bugs.python.org (Enrico Zini) Date: Sat, 19 Mar 2011 16:18:50 +0000 Subject: [New-bugs-announce] [issue11608] GzipFile cannot be used for streaming In-Reply-To: <1300551530.42.0.377999323642.issue11608@psf.upfronthosting.co.za> Message-ID: <1300551530.42.0.377999323642.issue11608@psf.upfronthosting.co.za> New submission from Enrico Zini : Hello, this snippet does not work, because GzipFile wants a file-like object that can do tell() and seek(): #!/usr/bin/python import gzip from urllib import urlopen zfd = urlopen("http://ftp.debian.org/debian/dists/sid/Contents-udeb.gz") fd = gzip.GzipFile(fileobj=zfd, mode="r") for line in fd: foobar(line) It must be possible to build a decompressing file-like object wrapper that can do without seeking, since it is obviously not a limitation of gzip decompression libraries. It would be extremely useful to have such a thing, as shown in the example snippet above. Some more details (including a very annoying misrepresentation of the issue found in Dive Into Python) can be found at http://www.enricozini.org/2011/cazzeggio/python-gzip/ (I apologise about the ranting tone of the post). ---------- components: Library (Lib) messages: 131427 nosy: enrico priority: normal severity: normal status: open title: GzipFile cannot be used for streaming type: behavior versions: Python 2.5, Python 2.6, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 19 18:52:38 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Sat, 19 Mar 2011 17:52:38 +0000 Subject: [New-bugs-announce] [issue11609] urllib-related buildbot failures In-Reply-To: <1300557158.6.0.238527704194.issue11609@psf.upfronthosting.co.za> Message-ID: <1300557158.6.0.238527704194.issue11609@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Many urllib-related buildbot failures recently, this seems to be cause by one of the recent urllib commits. 3.2 and 3.3 are affected. http://www.python.org/dev/buildbot/all/builders/AMD64%20Gentoo%20Wide%203.x/builds/1255 ---------- assignee: orsenthil components: Library (Lib), Tests keywords: buildbot messages: 131430 nosy: georg.brandl, orsenthil, pitrou priority: release blocker severity: normal stage: needs patch status: open title: urllib-related buildbot failures type: behavior versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 19 19:49:11 2011 From: report at bugs.python.org (Darren Dale) Date: Sat, 19 Mar 2011 18:49:11 +0000 Subject: [New-bugs-announce] [issue11610] Improving property to accept abstract methods In-Reply-To: <1300560551.62.0.116291646024.issue11610@psf.upfronthosting.co.za> Message-ID: <1300560551.62.0.116291646024.issue11610@psf.upfronthosting.co.za> New submission from Darren Dale : I posted a suggestion at python-ideas that the declaration of abstract properties could be improved in such a way that they could be declared with either the long-form or decorator syntax using the built-in property and abc.abstractmethod: {{{ class MyProperty(property): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) for f in (self.fget, self.fset, self.fdel): if getattr(f, '__isabstractmethod__', False): self.__isabstractmethod__ = True break class C(metaclass=ABCMeta): @MyProperty @abstractmethod def x(self): pass @x.setter @abstractmethod def x(self, val): pass # this syntax would also be supported: #@abstractmethod #def getx(self): # pass #@abstractmethod #def setx(self, val): # pass #x = MyProperty(getx, setx) class D(C): 'D does not define a concrete setter and cannot be instantiated' @C.x.setter def x(self): return 1 class E(D): 'E has a concrete getter and setter, and can be instantiated' @D.x.setter def x(self, val): pass }}} It is hopefully evident that a relatively minor extension can be made to the built-in property such that @abstractproperty would no longer be needed. I have prepared a patch, complete with documentation and unit tests, but unfortunately I have not been able to test it because I have not been able to build Python from a mercurial checkout on either Ubuntu 11.04 or OS X 10.6.6 (for reasons unrelated to the patch.) BDFL thought the idea sounded good for inclusion in Python-3.3, and requested I submit the patch here. ---------- components: Library (Lib) files: property_with_abstractmethod.patch keywords: patch messages: 131436 nosy: dsdale24 priority: normal severity: normal status: open title: Improving property to accept abstract methods type: feature request versions: Python 3.3 Added file: http://bugs.python.org/file21293/property_with_abstractmethod.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 19 21:37:57 2011 From: report at bugs.python.org (Arif Zaman) Date: Sat, 19 Mar 2011 20:37:57 +0000 Subject: [New-bugs-announce] [issue11611] wxPython PropertyGrid Demo error and fix In-Reply-To: <1300567077.69.0.560043007986.issue11611@psf.upfronthosting.co.za> Message-ID: <1300567077.69.0.560043007986.issue11611@psf.upfronthosting.co.za> New submission from Arif Zaman : In the wxPython Demo the PropertyGrid code has the lines # # Let's use some simple custom editor # # NOTE: Editor must be registered *before* adding a property that # uses it. pg.RegisterEditor(TrivialPropertyEditor) pg.RegisterEditor(SampleMultiButtonEditor) pg.RegisterEditor(LargeImageEditor) The first time you look at this demo, it runs. Then if you go to some other demo, and return back to this (in the same session), it tries to register the same editors. Since they are already registered this causes an AssertionError. I fixed it by # # Let's use some simple custom editor # # NOTE: Editor must be registered *before* adding a property that # uses it. try: pg.RegisterEditor(TrivialPropertyEditor) pg.RegisterEditor(SampleMultiButtonEditor) pg.RegisterEditor(LargeImageEditor) except AssertionError: pass although I am sure you can probably do better. PS: This is my first visit to this site, so if I have posted this with some incorrect area, please just let me know kindly. ---------- components: Demos and Tools messages: 131441 nosy: Arif.Zaman priority: normal severity: normal status: open title: wxPython PropertyGrid Demo error and fix type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 20 06:47:33 2011 From: report at bugs.python.org (Campbell Barton) Date: Sun, 20 Mar 2011 05:47:33 +0000 Subject: [New-bugs-announce] [issue11612] xml.dom.minidom fail to parse SVG file. In-Reply-To: <1300600053.35.0.927050616565.issue11612@psf.upfronthosting.co.za> Message-ID: <1300600053.35.0.927050616565.issue11612@psf.upfronthosting.co.za> New submission from Campbell Barton : python3.2mu -c "import xml.dom.minidom ; xml.dom.minidom.parse('gnome-cpu-frequency-applet.svg')" --- gives the following traceback Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.2/xml/dom/minidom.py", line 1939, in parse return expatbuilder.parse(file) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 924, in parse result = builder.parseFile(fp) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 207, in parseFile parser.Parse(buffer, 0) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 354, in first_element_handler self.start_element_handler(name, attributes) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 779, in start_element_handler uri, localname, prefix, qname = _parse_ns_name(self, aname) File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 127, in _parse_ns_name uri, localname = parts ValueError: too many values to unpack (expected 2) ---------- components: Extension Modules files: gnome-cpu-frequency-applet.svg messages: 131479 nosy: ideasman42 priority: normal severity: normal status: open title: xml.dom.minidom fail to parse SVG file. type: crash versions: Python 3.2 Added file: http://bugs.python.org/file21302/gnome-cpu-frequency-applet.svg _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 20 13:05:50 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Sun, 20 Mar 2011 12:05:50 +0000 Subject: [New-bugs-announce] [issue11613] test_subprocess fails under Windows In-Reply-To: <1300622750.75.0.243521099474.issue11613@psf.upfronthosting.co.za> Message-ID: <1300622750.75.0.243521099474.issue11613@psf.upfronthosting.co.za> New submission from Antoine Pitrou : There seem to be some buglets in the timeout code: http://www.python.org/dev/buildbot/all/builders/x86%20Windows7%203.x/builds/2783/steps/test/logs/stdio ====================================================================== ERROR: test_check_output_timeout (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 135, in test_check_output_timeout timeout=3) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 533, in check_output output, unused_err = process.communicate(timeout=timeout) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate raise TimeoutExpired(self.args) TypeError: __init__() takes at least 3 arguments (2 given) ====================================================================== ERROR: test_communicate_timeout (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 433, in test_communicate_timeout timeout=0.3) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 574, in assertRaises callableObj(*args, **kwargs) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate raise TimeoutExpired(self.args) TypeError: __init__() takes at least 3 arguments (2 given) ====================================================================== ERROR: test_communicate_timeout_large_ouput (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 452, in test_communicate_timeout_large_ouput self.assertRaises(subprocess.TimeoutExpired, p.communicate, timeout=0.4) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 574, in assertRaises callableObj(*args, **kwargs) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate raise TimeoutExpired(self.args) TypeError: __init__() takes at least 3 arguments (2 given) ====================================================================== ERROR: test_check_output_timeout (test.test_subprocess.ContextManagerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 135, in test_check_output_timeout timeout=3) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 533, in check_output output, unused_err = process.communicate(timeout=timeout) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate raise TimeoutExpired(self.args) TypeError: __init__() takes at least 3 arguments (2 given) ====================================================================== ERROR: test_communicate_timeout (test.test_subprocess.ContextManagerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 433, in test_communicate_timeout timeout=0.3) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 574, in assertRaises callableObj(*args, **kwargs) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate raise TimeoutExpired(self.args) TypeError: __init__() takes at least 3 arguments (2 given) ====================================================================== ERROR: test_communicate_timeout_large_ouput (test.test_subprocess.ContextManagerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 452, in test_communicate_timeout_large_ouput self.assertRaises(subprocess.TimeoutExpired, p.communicate, timeout=0.4) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", line 574, in assertRaises callableObj(*args, **kwargs) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 846, in communicate stdout, stderr = self._communicate(input, endtime, timeout) File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\subprocess.py", line 1116, in _communicate raise TimeoutExpired(self.args) TypeError: __init__() takes at least 3 arguments (2 given) ====================================================================== FAIL: test_wait_timeout (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 657, in test_wait_timeout self.assertIn("0.01", str(c.exception)) # For coverage of __str__. AssertionError: '0.01' not found in "Command '['D:\\\\cygwin\\\\home\\\\db3l\\\\buildarea\\\\3.x.bolen-windows7\\\\build\\\\PCbuild\\\\python_d.exe', '-c', 'import time; time.sleep(0.1)']' timed out after 10 seconds" ====================================================================== FAIL: test_wait_timeout (test.test_subprocess.ContextManagerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_subprocess.py", line 657, in test_wait_timeout self.assertIn("0.01", str(c.exception)) # For coverage of __str__. AssertionError: '0.01' not found in "Command '['D:\\\\cygwin\\\\home\\\\db3l\\\\buildarea\\\\3.x.bolen-windows7\\\\build\\\\PCbuild\\\\python_d.exe', '-c', 'import time; time.sleep(0.1)']' timed out after 10 seconds" ---------------------------------------------------------------------- Ran 307 tests in 370.283s ---------- assignee: rnk components: Library (Lib) messages: 131486 nosy: pitrou, rnk priority: normal severity: normal stage: needs patch status: open title: test_subprocess fails under Windows type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 20 16:15:12 2011 From: report at bugs.python.org (STINNER Victor) Date: Sun, 20 Mar 2011 15:15:12 +0000 Subject: [New-bugs-announce] [issue11614] import __hello__ is broken in Python 3 In-Reply-To: <1300634112.35.0.363135641538.issue11614@psf.upfronthosting.co.za> Message-ID: <1300634112.35.0.363135641538.issue11614@psf.upfronthosting.co.za> New submission from STINNER Victor : import __hello__ doesn't print any message!!! ---------- messages: 131499 nosy: benjamin.peterson, georg.brandl, haypo priority: release blocker severity: normal status: open title: import __hello__ is broken in Python 3 versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 20 17:02:31 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Sun, 20 Mar 2011 16:02:31 +0000 Subject: [New-bugs-announce] [issue11615] sporadic failure in test_posix In-Reply-To: <1300636951.08.0.111508328563.issue11615@psf.upfronthosting.co.za> Message-ID: <1300636951.08.0.111508328563.issue11615@psf.upfronthosting.co.za> New submission from Antoine Pitrou : >From http://www.python.org/dev/buildbot/all/builders/PPC%20Ubuntu%203.x/builds/779/steps/test/logs/stdio ====================================================================== FAIL: test_fexecve (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/var/lib/buildbot/buildarea/3.x.warsaw-ubuntu-ppc/build/Lib/test/test_posix.py", line 153, in test_fexecve self.assertEqual(os.wait(), (pid, 0)) AssertionError: Tuples differ: (19299, 0) != (19303, 0) First differing element 0: 19299 19303 - (19299, 0) + (19303, 0) Perhaps there was another process from another test still executing? support.reap_children() should help avoid that. ---------- components: Tests messages: 131503 nosy: pitrou, rosslagerwall priority: normal severity: normal status: open title: sporadic failure in test_posix type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 20 17:48:01 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Sun, 20 Mar 2011 16:48:01 +0000 Subject: [New-bugs-announce] [issue11616] reap_children should not use WNOHANG In-Reply-To: <1300639681.51.0.654119922856.issue11616@psf.upfronthosting.co.za> Message-ID: <1300639681.51.0.654119922856.issue11616@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Using WNOHANG means that still-running children won't get collected. This seems to defeat the point of reap_children(). This patch seems to work: diff -r adbdb3e74461 Lib/test/support.py --- a/Lib/test/support.py Sun Mar 20 17:36:26 2011 +0100 +++ b/Lib/test/support.py Sun Mar 20 17:45:35 2011 +0100 @@ -1294,10 +1294,9 @@ def reap_children(): while True: try: # This will raise an exception on Windows. That's ok. - pid, status = os.waitpid(any_process, os.WNOHANG) - if pid == 0: - break - except: + pid, status = os.waitpid(any_process, 0) + except OSError: + # Either we're on Windows, or no running child remains. break @contextlib.contextmanager ---------- components: Tests messages: 131510 nosy: nnorwitz, pitrou, rosslagerwall priority: normal severity: normal stage: patch review status: open title: reap_children should not use WNOHANG type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 20 18:06:21 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Sun, 20 Mar 2011 17:06:21 +0000 Subject: [New-bugs-announce] [issue11617] Sporadic failure in test_httpservers In-Reply-To: <1300640781.99.0.619640847889.issue11617@psf.upfronthosting.co.za> Message-ID: <1300640781.99.0.619640847889.issue11617@psf.upfronthosting.co.za> New submission from Antoine Pitrou : http://www.python.org/dev/buildbot/all/builders/x86%20OpenIndiana%203.2/builds/101/steps/test/logs/stdio test test_httpservers failed -- Traceback (most recent call last): File "/export/home/buildbot/32bits/3.2.cea-indiana-x86/build/Lib/test/test_httpservers.py", line 136, in test_version_digits res = self.con.getresponse() File "/export/home/buildbot/32bits/3.2.cea-indiana-x86/build/Lib/http/client.py", line 1046, in getresponse response.begin() File "/export/home/buildbot/32bits/3.2.cea-indiana-x86/build/Lib/http/client.py", line 346, in begin version, status, reason = self._read_status() File "/export/home/buildbot/32bits/3.2.cea-indiana-x86/build/Lib/http/client.py", line 328, in _read_status raise BadStatusLine(line) http.client.BadStatusLine: _______________________________________ From report at bugs.python.org Sun Mar 20 18:06:57 2011 From: report at bugs.python.org (sbt) Date: Sun, 20 Mar 2011 17:06:57 +0000 Subject: [New-bugs-announce] [issue11618] Locks broken wrt timeouts on Windows In-Reply-To: <1300640817.81.0.852617582602.issue11618@psf.upfronthosting.co.za> Message-ID: <1300640817.81.0.852617582602.issue11618@psf.upfronthosting.co.za> New submission from sbt : In thread_nt.h, when the WaitForSingleObject() call in EnterNonRecursiveMutex() fails with WAIT_TIMEOUT (or WAIT_FAILED) the mutex is left in an inconsistent state. Note that the first line of EnterNonRecursiveMutex() is the comment /* Assume that the thread waits successfully */ Allowing EnterNonRecursiveMutex() to fail with a timeout obviously violates this promise ;-) I think the problem was introduced to Python 3.2 with: Issue7316: Add a timeout functionality to common locking operations. The following Windows session demonstrates unexpected behaviour: Python 3.3a0 (default, Mar 19 2011, 18:16:48) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import threading >>> l = threading.Lock() >>> l.acquire() True >>> l.acquire(timeout=1) False >>> l.release() >>> l.locked() # should return False True >>> l.acquire(blocking=False) # should return True False Also, after a timeout, uncontended acquires/releases always take the slow path: D:\Repos\cpython\PCbuild>python -m timeit ^ More? -s "from threading import Lock; l = Lock()" ^ More? "l.acquire();l.release()" 1000000 loops, best of 3: 0.974 usec per loop D:\Repos\cpython\PCbuild>python -m timeit ^ More? -s "from threading import Lock; l = Lock()" ^ More? -s "l.acquire();l.acquire(timeout=0.1);l.release()" ^ More? "l.acquire();l.release()" 100000 loops, best of 3: 2.18 usec per loop A unit test is attached which passes on Linux but has three failures on Windows. The "owned" field of NRMUTEX is a count of the number of threads waiting for the mutex (not including the owner). "owned" will over-estimate the number of waiters if a timeout occurs, because the timed out thread will still be counted as a waiter. The obvious fix is to decrement mutex->owned when a timeout occurs. Unfortunately that would introduce a race which might allow two threads to think they own the lock at the same time. I also notice that EnterNonRecursiveMutex() wrongly sets mutex->thread_id to the current thread even when it fails with a timeout. It appears that the thread_id field is never actually used -- is it there to help with debugging? Perhaps it should just be removed. BTW only thread_pthread.h and thread_nt.h have implementations of PyThread_acquire_lock_timed(). Since this function appears to be required by _threadmodule.c, does this mean that in Python 3.2 threads are only supported with pthreads and win32? If so you can get rid of all those other thread_*.h files. ---------- files: test-timeout.py messages: 131515 nosy: sbt priority: normal severity: normal status: open title: Locks broken wrt timeouts on Windows type: behavior versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21304/test-timeout.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 00:58:51 2011 From: report at bugs.python.org (STINNER Victor) Date: Sun, 20 Mar 2011 23:58:51 +0000 Subject: [New-bugs-announce] [issue11619] On Windows, don't encode filenames in the import machinery In-Reply-To: <1300665531.85.0.426527059221.issue11619@psf.upfronthosting.co.za> Message-ID: <1300665531.85.0.426527059221.issue11619@psf.upfronthosting.co.za> New submission from STINNER Victor : With #3080, Python 3.3 does now manipulate module paths and names as Unicode in the import machinery. But in 3 remaining places, it does encode filenames (to the ANSI code page): a) _PyImport_LoadDynamicModule() It should pass directly the PyObject* (instead of a char*) to _PyImport_GetDynLoadFunc(), but only on Windows (we may change the function name for Windows). _PyImport_GetDynLoadFunc() of dynload_win.c has to be patched to use the Unicode API (eg. LoadLibraryEx => LoadLibraryExW). b) write_compiled_module() The problem is to implement open_exclusive() for Windows using Unicode. open_exclusive() uses open() on Windows, but open() expects the filename as a byte string. We may use _Py_fopen() (_wfopen), but this function doesn't have an option to open the file in exclusive mode (O_EXCL flag). GNU has an extension: "x" flag in the file mode, but Windows doesn't support it. The file is passed to marshal functions like PyMarshal_WriteLongToFile(), and so the file have to be a FILE*. c) parse_source_module() => covered by the issue #10785. ---------- components: Interpreter Core, Unicode, Windows messages: 131574 nosy: amaury.forgeotdarc, haypo, pitrou priority: normal severity: normal status: open title: On Windows, don't encode filenames in the import machinery versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 01:34:41 2011 From: report at bugs.python.org (Tom Felker) Date: Mon, 21 Mar 2011 00:34:41 +0000 Subject: [New-bugs-announce] [issue11620] winsound.PlaySound() with SND_MEMORY should accept bytes instead of strings In-Reply-To: <1300667681.04.0.269037633009.issue11620@psf.upfronthosting.co.za> Message-ID: <1300667681.04.0.269037633009.issue11620@psf.upfronthosting.co.za> New submission from Tom Felker : PlaySound supposedly lets you play a .WAV file whose contents are stored in a string, by passing the string and flags including winsound.SND_MEMORY. I'm trying to use BytesIO object and the wave module to make a file in-memory, and pass this to winsound. It's a TypeError if I pass the resultant bytes object directly, and if I pass a string object, I get TypeError: must be str without null character or None, not str Since wav files can contain zeros, for the feature to work at all, the C code would need to detect the SND_MEMORY flag and interpret the first argument as a bytes object, instead of a null-terminated string, in that case. ---------- components: Library (Lib) messages: 131583 nosy: Tom.Felker priority: normal severity: normal status: open title: winsound.PlaySound() with SND_MEMORY should accept bytes instead of strings versions: Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 15:12:17 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 21 Mar 2011 14:12:17 +0000 Subject: [New-bugs-announce] [issue11621] DMG build error In-Reply-To: <1300716737.32.0.330768871896.issue11621@psf.upfronthosting.co.za> Message-ID: <1300716737.32.0.330768871896.issue11621@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Looks like a bootstrap issue, could be related to the latest getopt changes: Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] Traceback (most recent call last): File "/Users/db3l/buildarea.dmg/3.x.dmg/build/setup.py", line 13, in from distutils.core import Extension, setup File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/distutils/core.py", line 18, in from distutils.dist import Distribution File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/distutils/dist.py", line 17, in from distutils.fancy_getopt import FancyGetopt, translate_longopt File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/distutils/fancy_getopt.py", line 14, in import getopt File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/getopt.py", line 37, in from gettext import gettext as _ File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/gettext.py", line 49, in import locale, copy, io, os, re, struct, sys File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/struct.py", line 12, in from _struct import * ImportError: No module named '_struct' make: *** [sharedmods] Error 1 ---------- components: Build messages: 131655 nosy: db3l, eric.araujo, pitrou priority: normal severity: normal stage: needs patch status: open title: DMG build error type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 15:26:33 2011 From: report at bugs.python.org (Roberto De Renzi) Date: Mon, 21 Mar 2011 14:26:33 +0000 Subject: [New-bugs-announce] [issue11622] Documentation In-Reply-To: <1300717593.92.0.639893924649.issue11622@psf.upfronthosting.co.za> Message-ID: <1300717593.92.0.639893924649.issue11622@psf.upfronthosting.co.za> New submission from Roberto De Renzi : I don't know if a suggestion is allowed here. I am an absolute beginner trying to substitute my matlab+fortran with python. I just passed the stage of tutorials and I have to struggle looking for the right syntax to implement my simple-minded programs. The learning curve is much steeper than for matlab, certainly due to the greater power of the language. The thing I need is a good reference manual. I find the Language Reference extremely poor in examples. The Library Reference is marginally better. Would you please consider sponsoring (as a developer-user community) a style that forces to include very short examples? Thanks Roberto ---------- assignee: docs at python components: Documentation messages: 131658 nosy: docs at python, roberto.derenzi priority: normal severity: normal status: open title: Documentation type: feature request versions: Python 2.7, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 17:43:39 2011 From: report at bugs.python.org (Johannes Lindenbaum) Date: Mon, 21 Mar 2011 16:43:39 +0000 Subject: [New-bugs-announce] [issue11623] Distutils is reporting OSX 10.6 w/ XCode 4 as "universal" In-Reply-To: <1300725819.97.0.991086015608.issue11623@psf.upfronthosting.co.za> Message-ID: <1300725819.97.0.991086015608.issue11623@psf.upfronthosting.co.za> New submission from Johannes Lindenbaum : This bug is a crosspost from /setuptools. (http://bugs.python.org/setuptools/issue122) Summary: OSX 10.6.x with Xcode 4 installed. Xcode 4 removes the PPC assembler from GCC. I attempted to install Fabric-1.0.0 which depended on pycrypto, during the pycrypto build there was a failure regarding "Broken Pipe". I downloaded the package separately and attempted to do the install there. Same error. I was pointed in the right direction that the broken pipe error was coming from the '-arch ppc' flag during build. Expected Result 10.6.x should not report itself as "universal" when it's no longer possible to compile for PPC. Actual Result Attempted PPC compilation fails. More detail: http://superuser.com/questions/259278/python-2-6-1-pycrypto-2-3-pypi-package-broken-pipe-during-build/260106#260106 Let me know if you require more information. Kind Regards, Johannes ---------- assignee: tarek components: Distutils messages: 131673 nosy: eric.araujo, jlindenbaum, tarek priority: normal severity: normal status: open title: Distutils is reporting OSX 10.6 w/ XCode 4 as "universal" type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 18:31:46 2011 From: report at bugs.python.org (dholth) Date: Mon, 21 Mar 2011 17:31:46 +0000 Subject: [New-bugs-announce] [issue11624] distutils should support a custom list of exported symbols for Windows dlls. In-Reply-To: <1300728706.6.0.163969255982.issue11624@psf.upfronthosting.co.za> Message-ID: <1300728706.6.0.163969255982.issue11624@psf.upfronthosting.co.za> New submission from dholth : I would like to be able to use distutils to compile a shared library with a different set of exported symbols than the default. In Windows, distutils only exports certain symbols needed for the Python module initialization API when it compiles a shared module. It does this by passing a file to the C compiler that lists those symbols. In Linux all symbols are exported/visible by default because that's just how the linker has traditionally worked. I would like to be able to override or augment this list of symbols. Probably by just providing my own 'symbols to export' file. distutils is definitely the poor man's compiler frontend but this feature would make it easier for me to support Windows (Python's secret shame.) ---------- assignee: tarek components: Distutils2 messages: 131677 nosy: alexis, dholth, eric.araujo, tarek priority: normal severity: normal status: open title: distutils should support a custom list of exported symbols for Windows dlls. type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 18:33:44 2011 From: report at bugs.python.org (Doug Latornell) Date: Mon, 21 Mar 2011 17:33:44 +0000 Subject: [New-bugs-announce] [issue11625] Typo in collections.abc docs Message-ID: <1300728824.71.0.424725828576.issue11625@psf.upfronthosting.co.za> Changes by Doug Latornell : ---------- assignee: docs at python components: Documentation nosy: dlatornell, docs at python priority: normal severity: normal status: open title: Typo in collections.abc docs _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 19:54:35 2011 From: report at bugs.python.org (Rainer Schaaf) Date: Mon, 21 Mar 2011 18:54:35 +0000 Subject: [New-bugs-announce] [issue11626] Py_LIMITED_API on windows: unresolved symbol __imp___PyArg_ParseTuple_SizeT In-Reply-To: <1300733675.89.0.959184580863.issue11626@psf.upfronthosting.co.za> Message-ID: <1300733675.89.0.959184580863.issue11626@psf.upfronthosting.co.za> New submission from Rainer Schaaf : When building a c extension on windows the linker fails like this: link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:../../../libs/plop/Release_MD_PLOPDS_VS6 /LIBPATH:C:\Programme\python32\libs /LIBPATH:C:\Programme\python32\PCbuild kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libplop.lib /EXPORT:PyInit_plop_py build\temp.win32-3.2\Release\plop_py.obj /OUT:build\lib.win32-3.2\plop_py.pyd /IMPLIB:build\temp.win32-3.2\Release\plop_py.lib /MANIFESTFILE:build\temp.win32-3.2\Release\plop_py.pyd.manifest Creating library build\temp.win32-3.2\Release\plop_py.lib and object build\temp.win32-3.2\Release\plop_py.exp plop_py.obj : error LNK2019: unresolved external symbol __imp___PyArg_ParseTuple_SizeT referenced in function __wrap_PLOP_new build\lib.win32-3.2\plop_py.pyd : fatal error LNK1120: 1 unresolved externals I use distutils to build the extension. The same code works fine on Linux/Unix/MacOSX. When I unset the Py_LIMITED_API it works fine on Windows too. ---------- components: Extension Modules messages: 131683 nosy: rjs priority: normal severity: normal status: open title: Py_LIMITED_API on windows: unresolved symbol __imp___PyArg_ParseTuple_SizeT versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 22:59:25 2011 From: report at bugs.python.org (Michael Foord) Date: Mon, 21 Mar 2011 21:59:25 +0000 Subject: [New-bugs-announce] [issue11627] segfault raising an arbitrary object as an exception In-Reply-To: <1300744765.64.0.0214361659325.issue11627@psf.upfronthosting.co.za> Message-ID: <1300744765.64.0.0214361659325.issue11627@psf.upfronthosting.co.za> New submission from Michael Foord : Python 3.2 (r32:88452, Feb 20 2011, 10:19:59) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> class Foo(Exception): ... def __new__(*args): ... return object() ... >>> try: ... raise Foo ... except Exception as e: ... print ('got it', e) ... Bus error ---------- messages: 131687 nosy: michael.foord priority: normal severity: normal status: open title: segfault raising an arbitrary object as an exception type: crash versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 21 23:13:31 2011 From: report at bugs.python.org (Chris Colbert) Date: Mon, 21 Mar 2011 22:13:31 +0000 Subject: [New-bugs-announce] [issue11628] cmp_to_key generated class should use __slots__ In-Reply-To: <1300745611.16.0.624548709174.issue11628@psf.upfronthosting.co.za> Message-ID: <1300745611.16.0.624548709174.issue11628@psf.upfronthosting.co.za> New submission from Chris Colbert : The cmp_to_key func acts as a class factory for generating key objects that behave according to a user defined cmp function. Many patterns/libs that make use of key functions (for example blist and the SortedCollection recipe) store the the results of the key function internally to provide faster subsequent operations. For large datasets, the number of key objects can become large, and it makes sense to keep their memory footprint as small as possible. >From this stance, I propose to add "__slots__ = ('obj',)" to the class definition of "K" in cmp_to_key to prevent the creation of the un-needed instance dict and save the memory. I find it hard to conjure up a case where a user would need to weakref or add attributes to the return value of a key func. But should that need arise, that functionality could be provided as optional kwargs to cmp_to_key, or just have the user subclass the return value of cmp_to_key. Alternatively, the addition of __slots__ could be specified as a kwarg to cmp_to_key. I'd be happy to make a patch for any of these (or alternative) options. ---------- components: Library (Lib) messages: 131691 nosy: Chris.Colbert, ncoghlan, rhettinger priority: normal severity: normal status: open title: cmp_to_key generated class should use __slots__ type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 08:11:53 2011 From: report at bugs.python.org (Mark Hammond) Date: Tue, 22 Mar 2011 07:11:53 +0000 Subject: [New-bugs-announce] [issue11629] Reference implementation for PEP 397 In-Reply-To: <1300777913.25.0.357945805094.issue11629@psf.upfronthosting.co.za> Message-ID: <1300777913.25.0.357945805094.issue11629@psf.upfronthosting.co.za> New submission from Mark Hammond : A tracking bug for the reference implementation of PEP397 - A Python launcher for Windows. ---------- assignee: mhammond components: Documentation files: pep-0397-reference.py messages: 131723 nosy: mhammond priority: normal severity: normal status: open title: Reference implementation for PEP 397 type: feature request Added file: http://bugs.python.org/file21330/pep-0397-reference.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 10:10:49 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Tue, 22 Mar 2011 09:10:49 +0000 Subject: [New-bugs-announce] [issue11630] refleak in test_import In-Reply-To: <1300785049.73.0.789464741943.issue11630@psf.upfronthosting.co.za> Message-ID: <1300785049.73.0.789464741943.issue11630@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Introduced by ef2b6305d395. ---------- assignee: haypo messages: 131727 nosy: haypo, pitrou priority: normal severity: normal status: open title: refleak in test_import type: resource usage versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 10:30:39 2011 From: report at bugs.python.org (Kristoffer Nilsson) Date: Tue, 22 Mar 2011 09:30:39 +0000 Subject: [New-bugs-announce] [issue11631] Python 2.7.1 64bit, Win7 64bit problem to read and write with UDP. In-Reply-To: <1300786239.46.0.274643383137.issue11631@psf.upfronthosting.co.za> Message-ID: <1300786239.46.0.274643383137.issue11631@psf.upfronthosting.co.za> New submission from Kristoffer Nilsson : Running Windows 7 Enterprise 64 bit, and Python 7.2.1 64 bit Python failed to read and send UDP packages when ran in cmd.exe. This is not the case when ran with IDLE. Example; two simple programs. First one listening to a UDP port sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('', 10015)) reading data from socket and printing the received data, using; data, addr = sock.recvfrom(1024) this will lock, if not ran from IDLE. Same for sending data, using; sock.sendto(DATA_MESSAGE, (HOST, 10015)) this will work with both, but only send when running from IDLE. ---------- components: IDLE, Windows messages: 131731 nosy: Kristoffer.Nilsson priority: normal severity: normal status: open title: Python 2.7.1 64bit, Win7 64bit problem to read and write with UDP. versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 11:09:30 2011 From: report at bugs.python.org (Brice Videau) Date: Tue, 22 Mar 2011 10:09:30 +0000 Subject: [New-bugs-announce] [issue11632] difflib.unified_diff loses context In-Reply-To: <1300788570.13.0.524020554804.issue11632@psf.upfronthosting.co.za> Message-ID: <1300788570.13.0.524020554804.issue11632@psf.upfronthosting.co.za> New submission from Brice Videau : unified_diff seems to lose the context when comparing the 2 files contained in the attached archive using this script : import difflib b1 = open("out1.short","r").read().splitlines(True) b2 = open("out2.short","r").read().splitlines(True) compare = difflib.unified_diff(b1,b2) for line in compare: print line, a big chunk of lines is considered as removed, just to be added next (around line 16). Comparing out2.short against out1.short does not produce this behavior : compare = difflib.unified_diff(b2,b1) is "correct". Other diff tools such as diff or vimdiff do not exhibit this problem. ---------- components: Library (Lib) files: diff.tgz messages: 131735 nosy: Brice.Videau priority: normal severity: normal status: open title: difflib.unified_diff loses context type: behavior versions: Python 2.6, Python 3.1 Added file: http://bugs.python.org/file21332/diff.tgz _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 11:37:22 2011 From: report at bugs.python.org (anatoly techtonik) Date: Tue, 22 Mar 2011 10:37:22 +0000 Subject: [New-bugs-announce] [issue11633] regression: print buffers output when end='' In-Reply-To: <1300790242.96.0.630463287349.issue11633@psf.upfronthosting.co.za> Message-ID: <1300790242.96.0.630463287349.issue11633@psf.upfronthosting.co.za> New submission from anatoly techtonik : print() function for some reason buffers output on Windows if end!='\n'. In attached examples "Processing.. " string is shown in Python 3.2 only after the actual processing is finished, while in Python 2.6 it is shown before. ---------- files: printtest3.py messages: 131736 nosy: techtonik priority: normal severity: normal status: open title: regression: print buffers output when end='' versions: Python 3.2 Added file: http://bugs.python.org/file21333/printtest3.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 15:41:22 2011 From: report at bugs.python.org (Eli Bendersky) Date: Tue, 22 Mar 2011 14:41:22 +0000 Subject: [New-bugs-announce] [issue11634] misleading comment on PyBytes_FromStringAndSize In-Reply-To: <1300804882.95.0.132860096.issue11634@psf.upfronthosting.co.za> Message-ID: <1300804882.95.0.132860096.issue11634@psf.upfronthosting.co.za> New submission from Eli Bendersky : The comment string above the implementation of _PyBytes_FromStringAndSize in Objects/bytesobject.c starts with: /* For both PyBytes_FromString() and PyBytes_FromStringAndSize(), the parameter `size' denotes number of characters to allocate, not counting any null terminating character. This is misleading since PyBytes_FromString() has no 'size' parameter. The problem also exists for PyString in Python 2.x ---------- assignee: docs at python components: Documentation keywords: easy messages: 131750 nosy: docs at python, eli.bendersky priority: low severity: normal status: open title: misleading comment on PyBytes_FromStringAndSize versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 18:36:39 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Tue, 22 Mar 2011 17:36:39 +0000 Subject: [New-bugs-announce] [issue11635] concurrent.futures uses polling In-Reply-To: <1300815399.91.0.382429836243.issue11635@psf.upfronthosting.co.za> Message-ID: <1300815399.91.0.382429836243.issue11635@psf.upfronthosting.co.za> New submission from Antoine Pitrou : concurrent.futures uses polling in its worker threads and processes (with a timeout of 0.1). It means that: 1) this prevents CPUs to enter low power states durably 2) it incurs latency when calling shutdown() on an executor (this seems to be the main source of slowness in test_concurrent_futures under Linux) ---------- components: Library (Lib) messages: 131756 nosy: bquinlan, gregory.p.smith, jyasskin, pitrou priority: normal severity: normal stage: needs patch status: open title: concurrent.futures uses polling type: resource usage versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 19:14:17 2011 From: report at bugs.python.org (William Dawson) Date: Tue, 22 Mar 2011 18:14:17 +0000 Subject: [New-bugs-announce] [issue11636] fh is not defined in npyio.py fromregex In-Reply-To: <1300817657.44.0.659187032014.issue11636@psf.upfronthosting.co.za> Message-ID: <1300817657.44.0.659187032014.issue11636@psf.upfronthosting.co.za> New submission from William Dawson : NameError: global name 'fh' is not defined File "/Users/williamdawson/Programs/fat_wip.py", line 263, in header_gal = readheader(gal_cat) File "/Users/williamdawson/Programs/tools.py", line 96, in readheader [('column',numpy.int16),('name','S10')]) File "/Library/Frameworks/EPD64.framework/Versions/7.0/lib/python2.7/site-packages/numpy/lib/npyio.py", line 972, in fromregex Note that this code works perfectly fine with the python 2.6 EPD release. ---------- components: None files: npyio.py messages: 131758 nosy: William.Dawson priority: normal severity: normal status: open title: fh is not defined in npyio.py fromregex type: crash versions: Python 2.7 Added file: http://bugs.python.org/file21338/npyio.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 22:10:30 2011 From: report at bugs.python.org (=?utf-8?q?=C3=89ric_Araujo?=) Date: Tue, 22 Mar 2011 21:10:30 +0000 Subject: [New-bugs-announce] [issue11637] Add cwd to sys.path for hooks In-Reply-To: <1300828230.79.0.355779213126.issue11637@psf.upfronthosting.co.za> Message-ID: <1300828230.79.0.355779213126.issue11637@psf.upfronthosting.co.za> New submission from ?ric Araujo : When pysetup is run in a project directory, this dir is not on sys.path, so hooks modules in the dir can?t be found. ---------- assignee: tarek components: Distutils2 keywords: easy messages: 131778 nosy: alexis, eric.araujo, tarek priority: normal severity: normal stage: needs patch status: open title: Add cwd to sys.path for hooks versions: 3rd party _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 22:18:53 2011 From: report at bugs.python.org (RonnyPfannschmidt) Date: Tue, 22 Mar 2011 21:18:53 +0000 Subject: [New-bugs-announce] [issue11638] pysetup un sdist crashes with weird trace if version is unicode by accident In-Reply-To: <1300828733.05.0.475519990909.issue11638@psf.upfronthosting.co.za> Message-ID: <1300828733.05.0.475519990909.issue11638@psf.upfronthosting.co.za> New submission from RonnyPfannschmidt : i passed in a unicode value as version by accident, resulted in: Traceback (most recent call last): File "/home/ronny/.local/venvs/clean/bin/pysetup", line 7, in execfile(__file__) File "/home/ronny/Projects/distutils2/distutils2/pysetup", line 5, in main() File "/home/ronny/Projects/distutils2/distutils2/run.py", line 486, in main return dispatcher() File "/home/ronny/Projects/distutils2/distutils2/run.py", line 477, in __call__ return func(self, self.args) File "/home/ronny/Projects/distutils2/distutils2/run.py", line 166, in _run dist.run_command(cmd, dispatcher.command_options[cmd]) File "/home/ronny/Projects/distutils2/distutils2/dist.py", line 781, in run_command cmd_obj.run() File "/home/ronny/Projects/distutils2/distutils2/command/sdist.py", line 183, in run self.make_distribution() File "/home/ronny/Projects/distutils2/distutils2/command/sdist.py", line 327, in make_distribution owner=self.owner, group=self.group) File "/home/ronny/Projects/distutils2/distutils2/command/cmd.py", line 426, in make_archive owner=owner, group=group) File "/home/ronny/Projects/distutils2/distutils2/_backport/shutil.py", line 588, in make_archive filename = func(base_name, base_dir, **kwargs) File "/home/ronny/Projects/distutils2/distutils2/_backport/shutil.py", line 426, in _make_tarball tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) File "/home/ronny/Projects/distutils2/distutils2/_backport/tarfile.py", line 1693, in open _Stream(name, filemode, comptype, fileobj, bufsize), File "/home/ronny/Projects/distutils2/distutils2/_backport/tarfile.py", line 434, in __init__ self._init_write_gz() File "/home/ronny/Projects/distutils2/distutils2/_backport/tarfile.py", line 462, in _init_write_gz self.__write(self.name + NUL) File "/home/ronny/Projects/distutils2/distutils2/_backport/tarfile.py", line 478, in __write self.buf += s UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 1: ordinal not in range(128) note that i have no idea where the 0x8b is from, if i just pass the version trough str it works (which means something is wrong somewhere else, unicode just triggers it) ---------- assignee: tarek components: Distutils2 messages: 131781 nosy: RonnyPfannschmidt, alexis, eric.araujo, tarek priority: normal severity: normal status: open title: pysetup un sdist crashes with weird trace if version is unicode by accident versions: 3rd party _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 22:45:41 2011 From: report at bugs.python.org (Santoso Wijaya) Date: Tue, 22 Mar 2011 21:45:41 +0000 Subject: [New-bugs-announce] [issue11639] Documentation for *Config functions in logging module should be in logging.config In-Reply-To: <1300830341.3.0.391550111742.issue11639@psf.upfronthosting.co.za> Message-ID: <1300830341.3.0.391550111742.issue11639@psf.upfronthosting.co.za> New submission from Santoso Wijaya : For example, the function `fileConfig` is listed in the documentation [1] as `logging.fileConfig`. This was a surprise for me when trying it gave me an AttributeError. Only after reading the source code that I found out this function is defined in the `logging.config` module, and must be referenced as such. [1] http://docs.python.org/library/logging.html#logging.fileConfig ---------- assignee: docs at python components: Documentation messages: 131791 nosy: docs at python, santa4nt priority: normal severity: normal status: open title: Documentation for *Config functions in logging module should be in logging.config versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 22 23:15:44 2011 From: report at bugs.python.org (Peter Davies) Date: Tue, 22 Mar 2011 22:15:44 +0000 Subject: [New-bugs-announce] [issue11640] Shelve references globals in its __del__ method In-Reply-To: <1300832144.38.0.133902930927.issue11640@psf.upfronthosting.co.za> Message-ID: <1300832144.38.0.133902930927.issue11640@psf.upfronthosting.co.za> New submission from Peter Davies : Shelf.__setitem__ (which is called from __del__ when writeback is enabled) references globals. This was causing exceptions on interpreter shutdown (due to another exception) for me. I have attached a patch which stores the relevant globals in the Shelf object. ---------- components: Library (Lib) files: shelve_del_fix.diff keywords: patch messages: 131793 nosy: Peter.Davies priority: normal severity: normal status: open title: Shelve references globals in its __del__ method type: behavior versions: Python 2.7, Python 3.2 Added file: http://bugs.python.org/file21345/shelve_del_fix.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 00:09:36 2011 From: report at bugs.python.org (anatoly techtonik) Date: Tue, 22 Mar 2011 23:09:36 +0000 Subject: [New-bugs-announce] [issue11641] raw_input() -> input() security issue In-Reply-To: <1300835376.2.0.376957339181.issue11641@psf.upfronthosting.co.za> Message-ID: <1300835376.2.0.376957339181.issue11641@psf.upfronthosting.co.za> New submission from anatoly techtonik : 2to3 converts raw_input() calls into input(), and input() runs all user data through eval(). This opens a hole in previously secure Python2.x applications. Is the author of this change aware of the issue? ---------- components: 2to3 (2.x to 3.0 conversion tool) messages: 131805 nosy: techtonik priority: normal severity: normal status: open title: raw_input() -> input() security issue type: security versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 00:35:27 2011 From: report at bugs.python.org (anatoly techtonik) Date: Tue, 22 Mar 2011 23:35:27 +0000 Subject: [New-bugs-announce] [issue11642] regression: input() doesn't strip a trailing newline on Windows In-Reply-To: <1300836927.06.0.0134767205709.issue11642@psf.upfronthosting.co.za> Message-ID: <1300836927.06.0.0134767205709.issue11642@psf.upfronthosting.co.za> New submission from anatoly techtonik : Docs say that input() should strip trailing newline, but on Windows it doesn't happen. http://docs.python.org/py3k/library/functions.html#input Python 2.x Windows >>> raw_input() xyz 'xyz' >>> Python 3.2 Windows >>> input() zyx 'zyx\r' >>> ---------- components: 2to3 (2.x to 3.0 conversion tool) messages: 131812 nosy: techtonik priority: normal severity: normal status: open title: regression: input() doesn't strip a trailing newline on Windows versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 00:55:11 2011 From: report at bugs.python.org (=?utf-8?q?=C3=89ric_Araujo?=) Date: Tue, 22 Mar 2011 23:55:11 +0000 Subject: [New-bugs-announce] [issue11643] Use |version| instead of X.Y in the doc In-Reply-To: <1300838111.66.0.617899175478.issue11643@psf.upfronthosting.co.za> Message-ID: <1300838111.66.0.617899175478.issue11643@psf.upfronthosting.co.za> New submission from ?ric Araujo : Some files like site.rst use ?X.Y? to refer to the Python version, but Sphinx helpfully provides a |version| construct that can be replaced by the current version at build time. ---------- assignee: docs at python components: Documentation keywords: easy messages: 131816 nosy: docs at python, eric.araujo priority: normal severity: normal stage: needs patch status: open title: Use |version| instead of X.Y in the doc versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 00:59:56 2011 From: report at bugs.python.org (anatoly techtonik) Date: Tue, 22 Mar 2011 23:59:56 +0000 Subject: [New-bugs-announce] [issue11644] 2to3 example.py is not a Python 2.x file In-Reply-To: <1300838396.67.0.863213339568.issue11644@psf.upfronthosting.co.za> Message-ID: <1300838396.67.0.863213339568.issue11644@psf.upfronthosting.co.za> New submission from anatoly techtonik : http://docs.python.org/library/2to3.html#using-2to3 contains an example.py sample which is claimed to be Python 2.x source, but that's not true: def greet(name): print "Hello, {0}!".format(name) print "What's your name?" name = raw_input() greet(name) The code is valid only for Python 2.6+. For previous versions it gives the following traceback: Traceback (most recent call last): File "ewe.py", line 5, in greet(name) File "ewe.py", line 2, in greet print "Hello, {0}!".format(name) AttributeError: 'str' object has no attribute 'format' ---------- components: 2to3 (2.x to 3.0 conversion tool) messages: 131817 nosy: techtonik priority: normal severity: normal status: open title: 2to3 example.py is not a Python 2.x file _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 01:19:01 2011 From: report at bugs.python.org (Yuval Greenfield) Date: Wed, 23 Mar 2011 00:19:01 +0000 Subject: [New-bugs-announce] [issue11645] Pypi reviews "Expand 10 after" shows a duplicate line In-Reply-To: <1300839541.37.0.373352205502.issue11645@psf.upfronthosting.co.za> Message-ID: <1300839541.37.0.373352205502.issue11645@psf.upfronthosting.co.za> New submission from Yuval Greenfield : Just try and review any patch diff, eg http://bugs.python.org/review/6818/diff/2113/4194 and click "Expand 10 after" on either side (top or bottom) of the diff chunk. Notice that a duplicate line is introduced. ---------- messages: 131819 nosy: ubershmekel priority: normal severity: normal status: open title: Pypi reviews "Expand 10 after" shows a duplicate line type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 01:20:45 2011 From: report at bugs.python.org (anatoly techtonik) Date: Wed, 23 Mar 2011 00:20:45 +0000 Subject: [New-bugs-announce] [issue11646] 2to3: msvcrt.(get|put)ch -> (get|put)wch In-Reply-To: <1300839645.82.0.653929076098.issue11646@psf.upfronthosting.co.za> Message-ID: <1300839645.82.0.653929076098.issue11646@psf.upfronthosting.co.za> New submission from anatoly techtonik : msvcrt function calls need to be renamed to unicode equivalents, because now they return bytes, which doesn't support string methods used to process the output (e.g. lower()). http://docs.python.org/py3k/library/msvcrt.html msvcrt.getch() -> msvcrt.getwch() msvcrt.getche() -> msvcrt.getwche() msvcrt.putch() -> msvcrt.putwch() msvcrt.ungetch() -> msvcrt.ungetwch() ---------- components: 2to3 (2.x to 3.0 conversion tool) messages: 131820 nosy: techtonik priority: normal severity: normal status: open title: 2to3: msvcrt.(get|put)ch -> (get|put)wch versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 03:04:38 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 23 Mar 2011 02:04:38 +0000 Subject: [New-bugs-announce] [issue11647] function decorated with a context manager can only be invoked once In-Reply-To: <1300845878.3.0.475491224846.issue11647@psf.upfronthosting.co.za> Message-ID: <1300845878.3.0.475491224846.issue11647@psf.upfronthosting.co.za> New submission from Antoine Pitrou : If you add the following test to text_contextlib: diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -363,6 +363,8 @@ class TestContextDecorator(unittest.Test state.append(x) test('something') self.assertEqual(state, [1, 'something', 999]) + test('something else') + self.assertEqual(state, [1, 'something', 999, 1, 'something else', 999]) # This is needed to make the test actually run under regrtest.py! You get the following error: ====================================================================== ERROR: test_contextmanager_as_decorator (test.test_contextlib.TestContextDecorator) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/cpython/32/Lib/contextlib.py", line 28, in __enter__ return next(self.gen) StopIteration During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/antoine/cpython/32/Lib/test/test_contextlib.py", line 366, in test_contextmanager_as_decorator test('something else') File "/home/antoine/cpython/32/Lib/contextlib.py", line 15, in inner with self: File "/home/antoine/cpython/32/Lib/contextlib.py", line 30, in __enter__ raise RuntimeError("generator didn't yield") RuntimeError: generator didn't yield Clearly there is a problem in the API or its implementation, as in a function decorated with a context manager can only be invoked once! This isn't good... ---------- components: Library (Lib) messages: 131838 nosy: michael.foord, ncoghlan, pitrou priority: normal severity: normal status: open title: function decorated with a context manager can only be invoked once type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 03:42:36 2011 From: report at bugs.python.org (Tim Bielawa) Date: Wed, 23 Mar 2011 02:42:36 +0000 Subject: [New-bugs-announce] [issue11648] openlog()s 'logopt' keyword broken in syslog module In-Reply-To: <1300848156.85.0.89651150439.issue11648@psf.upfronthosting.co.za> Message-ID: <1300848156.85.0.89651150439.issue11648@psf.upfronthosting.co.za> New submission from Tim Bielawa : Issue 8451 unintentionally introduced a bug into the openlog() function in the syslog module. syslog.openlog() as documented [1] is defined as: syslog.openlog([ident[, logopt[, facility]]]). I believe this is caused by the patch for issue 8451 redefining the kwargs to expect a 'logoption' keyword instead. This patch: - Fixes syslog.openlog() so that it properly accepts the 'logopt' keyword argument again. [1] http://docs.python.org/library/syslog.html#syslog.openlog ---------- components: Library (Lib) files: syslog-fixlogopt-keyword.patch keywords: patch messages: 131844 nosy: tbielawa priority: normal severity: normal status: open title: openlog()s 'logopt' keyword broken in syslog module versions: Python 2.7 Added file: http://bugs.python.org/file21352/syslog-fixlogopt-keyword.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 14:30:23 2011 From: report at bugs.python.org (Gunnar Aastrand Grimnes) Date: Wed, 23 Mar 2011 13:30:23 +0000 Subject: [New-bugs-announce] [issue11649] startElementNS in xml.sax.saxutils.XMLGenerator ignored encoding In-Reply-To: <1300887023.39.0.212589786895.issue11649@psf.upfronthosting.co.za> Message-ID: <1300887023.39.0.212589786895.issue11649@psf.upfronthosting.co.za> New submission from Gunnar Aastrand Grimnes : The startElementNS method in the XMLGenerator ignores the encoding set. it does: self._out.write(' xmlns:%s="%s"' % (prefix, uri)) whereas it should have done: self._write(' xmlns:%s="%s"' % (prefix, uri)) Issue 938076 was similar to this, but for a different method. ---------- components: XML messages: 131863 nosy: gromgull priority: normal severity: normal status: open title: startElementNS in xml.sax.saxutils.XMLGenerator ignored encoding type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 14:35:52 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Wed, 23 Mar 2011 13:35:52 +0000 Subject: [New-bugs-announce] [issue11650] CTRL-Z causes interpreter exit In-Reply-To: <1300887352.61.0.261947274229.issue11650@psf.upfronthosting.co.za> Message-ID: <1300887352.61.0.261947274229.issue11650@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : 14:23 ~ $ python3 Python 3.3a0 (default:4a5782a2b074, Mar 21 2011, 15:20:28) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> ^Z [1]+ Stopped python3 14:25 ~ $ 14:25 ~ $ fg python3 [56455 refs] [36537 refs] And 14:29 ~/src/cpython $ ./python.exe Python 3.3a0 (default:267578b2422d, Mar 23 2011, 13:27:15) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> ^Z [3]+ Stopped ./python.exe 14:29 ~/src/cpython $ fg ./python.exe [56559 refs] [36610 refs] ---------- components: IO, Interpreter Core messages: 131864 nosy: sdaoden priority: normal severity: normal status: open title: CTRL-Z causes interpreter exit versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 15:57:46 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 23 Mar 2011 14:57:46 +0000 Subject: [New-bugs-announce] [issue11651] Improve test targets in Makefile In-Reply-To: <1300892266.04.0.602974057054.issue11651@psf.upfronthosting.co.za> Message-ID: <1300892266.04.0.602974057054.issue11651@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Summary: - remove "make quicktest" and "make memtest" - when "-j0" is passed to regrtest, use the cpu count detected by multiprocessing - remove the duplicate test in "make test" - add "-j0" to the test options in make test The patch is against default but perhaps we should apply to 3.2 as well. ---------- components: Tests files: maketest.patch keywords: patch messages: 131882 nosy: barry, ncoghlan, pitrou priority: normal severity: normal stage: patch review status: open title: Improve test targets in Makefile type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21356/maketest.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 17:43:47 2011 From: report at bugs.python.org (Billy Saelim) Date: Wed, 23 Mar 2011 16:43:47 +0000 Subject: [New-bugs-announce] [issue11652] urlib2 returns a pair of integers as the content-length value In-Reply-To: <1300898627.63.0.121848868508.issue11652@psf.upfronthosting.co.za> Message-ID: <1300898627.63.0.121848868508.issue11652@psf.upfronthosting.co.za> New submission from Billy Saelim : urlopen does not always return a single value for 'content-length'. For example: >>> import urllib2 >>> request = 'http://wwwsearch.sourceforge.net/mechanize/src/mechanize-0.1.11.zip' >>> fp = urllib2.urlopen(request) >>> fp.info().dict {'content-length': '289519, 289519', 'x-varnish': '929586024', 'via': '1.1 varnish', 'age': '0', 'expires': 'Fri, 25 Mar 2011 14:36:43 GMT', 'server': 'Apache/2.2.3 (CentOS)', 'last-modified': 'Sat, 07 Feb 2009 19:15:15 GMT', 'connection': 'close', 'etag': '"46aef-46258f510b6c0"', 'date': 'Wed, 23 Mar 2011 14:36:43 GMT', 'content-type': 'application/zip'} ---------- components: Library (Lib) messages: 131894 nosy: Billy.Saelim priority: normal severity: normal status: open title: urlib2 returns a pair of integers as the content-length value type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 18:20:34 2011 From: report at bugs.python.org (Skip Montanaro) Date: Wed, 23 Mar 2011 17:20:34 +0000 Subject: [New-bugs-announce] [issue11653] Problems with some tests using -j2 In-Reply-To: <1300900834.38.0.866909082776.issue11653@psf.upfronthosting.co.za> Message-ID: <1300900834.38.0.866909082776.issue11653@psf.upfronthosting.co.za> New submission from Skip Montanaro : At Antoine's behest, I tried running ./python.exe -m test -j2 in my cpython sandbox and saw several test case failures which didn't appear when I executed a simple make test He suggested I add the -W flag and try again. I did, but I don't see any difference in the output, so either I'm still doing something wrong or the -W flag is somehow mishandled. As far as I can tell the failing tests were not re-run in verbose mode. script command output attached. I ran these tests on Mac OS X Leopard (10.5.8). S ---------- components: Tests files: typescript messages: 131896 nosy: skip.montanaro priority: normal severity: normal status: open title: Problems with some tests using -j2 versions: Python 3.3 Added file: http://bugs.python.org/file21357/typescript _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 21:26:57 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 23 Mar 2011 20:26:57 +0000 Subject: [New-bugs-announce] [issue11654] errors in atexit hooks don't change process exit code In-Reply-To: <1300912017.1.0.699282992507.issue11654@psf.upfronthosting.co.za> Message-ID: <1300912017.1.0.699282992507.issue11654@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Not sure if it's the desired behaviour, so I'm reporting it: $ ./python -c "import atexit; atexit.register(lambda: 1/0)" && echo success Error in atexit._run_exitfuncs: ZeroDivisionError: division by zero [36956 refs] success ---------- components: Interpreter Core messages: 131916 nosy: pitrou priority: normal severity: normal status: open title: errors in atexit hooks don't change process exit code type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 23:28:23 2011 From: report at bugs.python.org (Lukas Lueg) Date: Wed, 23 Mar 2011 22:28:23 +0000 Subject: [New-bugs-announce] [issue11655] map() must not swallow exceptions from PyObject_GetIter In-Reply-To: <1300919303.37.0.228968832685.issue11655@psf.upfronthosting.co.za> Message-ID: <1300919303.37.0.228968832685.issue11655@psf.upfronthosting.co.za> New submission from Lukas Lueg : The built-in function map() currently swallows any exception that might have occured while trying to get an iterator from any parameter. This produces unexpected behaviour for applications that require a certain type of exception to be raised when __iter__() is called on their objects. >From 24179f82b7de, inside map_new(): 973 /* Get iterator. */ 974 curseq = PyTuple_GetItem(args, i+1); 975 sqp->it = PyObject_GetIter(curseq); 976 if (sqp->it == NULL) { 977 static char errmsg[] = 978 "argument %d to map() must support iteration"; 979 char errbuf[sizeof(errmsg) + 25]; 980 PyOS_snprintf(errbuf, sizeof(errbuf), errmsg, i+2); 981 PyErr_SetString(PyExc_TypeError, errbuf); 982 goto Fail_2; 983 } We *must* check if there has been any other kind of exception already being set when returning from PyObject_GetIter before setting PyExc_TypeError in line 981. If there is none, it is ok to raise a TypeError; any other exception must be passed on. For example: raising TooManyCacheMissesException in __iter__() causes map(foobar, myobject) to raise TypeError instead of TooManyCacheMissesException. Workaround: use map(foobar, iter(myobject)). The explicit call to iter will either produce an iterator object (which returns self to map()) or raises the correct exception. Python 3 is not affected as map_new() does not throw it's own TypeError in case PyObject_GetIter() fails. ---------- components: None messages: 131932 nosy: ebfe priority: normal severity: normal status: open title: map() must not swallow exceptions from PyObject_GetIter versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 23 23:52:11 2011 From: report at bugs.python.org (Jack Jansen) Date: Wed, 23 Mar 2011 22:52:11 +0000 Subject: [New-bugs-announce] [issue11656] Debug builds for Windows would be very helpful In-Reply-To: <1300920731.77.0.496004167034.issue11656@psf.upfronthosting.co.za> Message-ID: <1300920731.77.0.496004167034.issue11656@psf.upfronthosting.co.za> New submission from Jack Jansen : Because VC++ cannot cross-link modules that have been built with debugging to those built without debugging (because of runtime system differences) it would be a boon for people embedding Python if there was a binary distribution of the DLL (and .lib) available that was built with debugging turned on. Right now, to build a debugging version of an application that has Python embedded you must also build Python from source... ---------- components: Build, Windows messages: 131934 nosy: jackjansen priority: normal severity: normal status: open title: Debug builds for Windows would be very helpful type: feature request versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 24 01:57:26 2011 From: report at bugs.python.org (Ben Darnell) Date: Thu, 24 Mar 2011 00:57:26 +0000 Subject: [New-bugs-announce] [issue11657] multiprocessing_{send, recv}fd fail with fds > 256 In-Reply-To: <1300928246.81.0.834552598366.issue11657@psf.upfronthosting.co.za> Message-ID: <1300928246.81.0.834552598366.issue11657@psf.upfronthosting.co.za> New submission from Ben Darnell : Line 125 of multiprocessing.c is "*CMSG_DATA(cmsg) = fd;". CMSG_DATA returns an unsigned char*, while fd is an int, so this code does not support file descriptors > 256 (additionally, I'm not sure if the buffer is guaranteed to be initialized with zeros). ? recvfd has an analogous problem at line 168. Both of these need to be changed to copy the entire integer, e.g. by casting the result of CMSG_DATA to an int*. http://hg.python.org/cpython/file/5deb2094f033/Modules/_multiprocessing/multiprocessing.c ---------- messages: 131947 nosy: Ben.Darnell priority: normal severity: normal status: open title: multiprocessing_{send,recv}fd fail with fds > 256 type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 24 03:30:52 2011 From: report at bugs.python.org (=?utf-8?q?Jo=C3=A3o_Bernardo?=) Date: Thu, 24 Mar 2011 02:30:52 +0000 Subject: [New-bugs-announce] [issue11658] complex sqrt error In-Reply-To: <1300933852.92.0.68969844622.issue11658@psf.upfronthosting.co.za> Message-ID: <1300933852.92.0.68969844622.issue11658@psf.upfronthosting.co.za> New submission from Jo?o Bernardo : With Python 3, the ** operator is supposed to do math with complex numbers, but look what is happening: Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> (-1)**.5 (6.123233995736766e-17+1j) >>> import cmath >>> cmath.sqrt(-1) 1j >>> pow(-1, .5) (6.123233995736766e-17+1j) >>> (-4)**.5 (1.2246467991473532e-16+2j) >>> I also tried with Python 3.1.2 in my 32-bit Ubuntu 10.10 installation and got the same results. The error seems to be in the floating point (double) representation limit of 16 decimal places. ---------- components: None messages: 131951 nosy: JBernardo priority: normal severity: normal status: open title: complex sqrt error type: behavior versions: Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 24 06:24:25 2011 From: report at bugs.python.org (Ben Hayden) Date: Thu, 24 Mar 2011 05:24:25 +0000 Subject: [New-bugs-announce] [issue11659] Fix ResourceWarning in test_subprocess In-Reply-To: <1300944265.17.0.69540585366.issue11659@psf.upfronthosting.co.za> Message-ID: <1300944265.17.0.69540585366.issue11659@psf.upfronthosting.co.za> New submission from Ben Hayden : Adding in a cleanup to close Popen stdout in the function test_select_unbuffered in test_subprocess file in Lib/test dir. There are several tickets about different resource warnings mentioning test_subprocess - but I couldn't find any patches that fix this specific issue. ---------- components: Tests files: test_subprocess_resource_warning.patch keywords: patch messages: 131960 nosy: beardedp priority: normal severity: normal status: open title: Fix ResourceWarning in test_subprocess type: resource usage versions: Python 3.3 Added file: http://bugs.python.org/file21366/test_subprocess_resource_warning.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 24 08:00:30 2011 From: report at bugs.python.org (Eric Snow) Date: Thu, 24 Mar 2011 07:00:30 +0000 Subject: [New-bugs-announce] [issue11660] closure with too few cells segfaults In-Reply-To: <1300950030.4.0.490739395188.issue11660@psf.upfronthosting.co.za> Message-ID: <1300950030.4.0.490739395188.issue11660@psf.upfronthosting.co.za> New submission from Eric Snow : While perhaps esoteric, it looks like exec'ing a code object that has freevars, using a closure that has too few cells causes a segfault. I believe the problem is around line 3276 of ceval.c at the PyTuple_GET_ITEM call: if (PyTuple_GET_SIZE(co->co_freevars)) { int i; for (i = 0; i < PyTuple_GET_SIZE(co->co_freevars); ++i) { >>> PyObject *o = PyTuple_GET_ITEM(closure, i); Py_INCREF(o); freevars[PyTuple_GET_SIZE(co->co_cellvars) + i] = o; } } I only bring this up because I am toying around with exposing a wrapper around PyEval_EvalCodeEx that is a more fully featured version of exec. Here is an example of code where I ran into the problem: def outer(): x = 5 y = 6 def f(): return x,y z = 7 def g(): return z exec_closure(f.__code__, closure=g.__closure__) Incidently, it looks there isn't any check to see if len(closure) > len(freevars), which I would expect to be disallowed. However, I understand that there hasn't really been any point to worry about it due to the current usage of PyEval_EvalCodeEx. If the above two constraints are appropriate I would love to see them added in with something like the following: if (closure == NULL) &closure = PyTuple_New(0); if (!PyTuple_Check(closure)) { PyErr_Format(PyExc_TypeError, "closure must be a tuple"); goto fail; } Py_ssize_t nfreevars = PyTuple_GET_SIZE(co->co_freevars); Py_ssize_t ncells = PyTuple_GET_SIZE(closure); if (nfreevars != ncells) { PyErr_Format(PyExc_SystemError, "Expected %s cells, received %s", nfreevars, ncells); goto fail; } if (nfreevars) { int i; for (i = 0; i < PyTuple_GET_SIZE(co->co_freevars); ++i) { PyObject *o = PyTuple_GET_ITEM(closure, i); Py_INCREF(o); freevars[PyTuple_GET_SIZE(co->co_cellvars) + i] = o; } } Alternately, I could just add some validation into exec_closure, if it's not worth bothering in ceval.c. ---------- components: Interpreter Core messages: 131961 nosy: ericsnow priority: normal severity: normal status: open title: closure with too few cells segfaults type: crash versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 24 13:04:44 2011 From: report at bugs.python.org (R. David Murray) Date: Thu, 24 Mar 2011 12:04:44 +0000 Subject: [New-bugs-announce] [issue11661] test_collections.TestNamedTuple.test_source failing on many buildbots after f09f7ab40ce6 In-Reply-To: <1300968284.13.0.782582358366.issue11661@psf.upfronthosting.co.za> Message-ID: <1300968284.13.0.782582358366.issue11661@psf.upfronthosting.co.za> New submission from R. David Murray : Example: http://www.python.org/dev/buildbot/all/builders/x86%20FreeBSD%207.2%203.x/builds/1609/steps/test/logs/stdio ====================================================================== FAIL: test_source (test.test_collections.TestNamedTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/test/test_collections.py", line 334, in test_source self.assertNotIn('Color', globals()) AssertionError: 'Color' unexpectedly found in {'OrderedDict': , 'forget': , 'unittest': , 'MyOrderedDict': , 'WithSet': , 'KeysView': , 'operator': , 'shuffle': >, 'TestNT': , 'MutableMapping': , 'randrange': >, 'unlink': , 'support': , 'Mapping': , '__package__': None, 'Callable': , 're': , 'TestCounter': , 'collections': , 'test_main': , 'SubclassMappingTests': , 'ChainMap': , '__doc__': 'Unit tests for collections.py.', 'Hashable': , 'namedtuple': , 'inspect': , 'MutableSet': , '__builtins__': {'bytearray': , 'IndexError': , 'all': , 'help': Type help() for interactive help, or help(object) for help about object., 'vars': , 'SyntaxError': , 'UnicodeDecodeError': , 'memoryview': , 'isinstance': , '__build_class__': , 'copyright': Copyright (c) 2001-2011 Python Software Foundation. ---------- assignee: rhettinger components: Tests keywords: buildbot messages: 131970 nosy: pitrou, r.david.murray, rhettinger priority: high severity: normal stage: needs patch status: open title: test_collections.TestNamedTuple.test_source failing on many buildbots after f09f7ab40ce6 versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 24 16:06:57 2011 From: report at bugs.python.org (Guido van Rossum) Date: Thu, 24 Mar 2011 15:06:57 +0000 Subject: [New-bugs-announce] [issue11662] Redirect vulnerability in urllib/urllib2 In-Reply-To: <1300979217.98.0.998462672739.issue11662@psf.upfronthosting.co.za> Message-ID: <1300979217.98.0.998462672739.issue11662@psf.upfronthosting.co.za> New submission from Guido van Rossum : We received the following on the security list. With the OP's permission I am now filing a public bug with a patch, with the intent to submit the patch ASAP (in time for MvL's planned April security release of Python 2.5). The OP's description is below; I will attach a patch to this issue as soon as I have figured out how. description: -------------------- The Python urllib and urllib2 modules are typically used to fetch web pages but by default also contains handlers for ftp:// and file:// URL schemes. Now unfortunately it appears that it is possible for a web server to redirect (HTTP 302) a urllib request to any of the supported schemes. Examples on how this could turn bad: 1) File disclosure: A web application, that normally fetches and displays a web page, is redirected to file:///etc/passwd and discloses it. 2) Denial of Service: An application is redirected to a system device (e.g. file:///dev/zero) which will result in excessive CPU/memory/disk usage. Affected versions: ------------------ The urllib and urllib2 modules of python 2.4.6 and 2.6.5 where tested but this likely affects all versions. Possible solution: ------------------ The default handlers could be reduced but this will probably break existing python scripts. Alternatively the default HTTPRedirectHandler behaviour can be changed to only allow redirects to HTTP, HTTPS and FTP by checking the scheme of the location URL (this seems to be a common practise in browsers) ---------- assignee: gvanrossum components: Library (Lib) hgrepos: 6 messages: 131981 nosy: barry, benjamin.peterson, georg.brandl, gvanrossum priority: release blocker severity: normal stage: patch review status: open title: Redirect vulnerability in urllib/urllib2 type: security versions: Python 2.5, 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 Thu Mar 24 17:09:13 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 24 Mar 2011 16:09:13 +0000 Subject: [New-bugs-announce] [issue11663] concurrent.futures (or multiprocessing?) doesn't detect killed processes In-Reply-To: <1300982953.31.0.459888649279.issue11663@psf.upfronthosting.co.za> Message-ID: <1300982953.31.0.459888649279.issue11663@psf.upfronthosting.co.za> New submission from Antoine Pitrou : If you do: ./python -c "from concurrent.futures import *; from time import *; t = ProcessPoolExecutor(1); t.submit(sleep, 60)" and then kill the child process, the parent process doesn't notice and waits endlessly for the child to return the results. I'm using concurrent.futures here but I assume the bug (or limitation) is on the multiprocessing side? ---------- components: Library (Lib) messages: 131995 nosy: asksol, bquinlan, jnoller, pitrou priority: normal severity: normal status: open title: concurrent.futures (or multiprocessing?) doesn't detect killed processes versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 24 21:43:59 2011 From: report at bugs.python.org (=?utf-8?q?=C3=89ric_Araujo?=) Date: Thu, 24 Mar 2011 20:43:59 +0000 Subject: [New-bugs-announce] [issue11664] Add patch method to unittest.TestCase In-Reply-To: <1300999439.71.0.376555102459.issue11664@psf.upfronthosting.co.za> Message-ID: <1300999439.71.0.376555102459.issue11664@psf.upfronthosting.co.za> New submission from ?ric Araujo : A common thing to do in setUp or test* methods is to replace some module attribute with something else, either to mock an object calling an external resource or to test platform-specific behavior (for example, changing os.name before calling some function). Care has to be taken to restore the initial object with addCleanup, tearDown or in a finally block. I propose that a new method TestCase.patch (inspired by mock.patch, but more limited in scope) be added, to allow such usages (each example is standalone): def setUp(self): self.patch(socket, 'socket', MockSocket) def test_default_format(self): self.patch(os, 'name', 'posix') self.assertEqual(get_default_format(), '.tar.gz') self.path(os, 'name', 'nt') self.assertEqual(get_default_format(), '.zip') def setUp(self): self.patch(sys, 'path', sys.path.copy()) In each example, patch(object, attribute, value) does this: save object.attribute, set object.attribute to value, register a cleanup function to restore object.attribute. I assigned to Michael so that he can kill this idea early if he has reason to do so. If not, please move stage to ?patch needed? (no pun). I am willing to work on a patch for 3.3 and unittest2 (not sure which is first :) ---------- assignee: michael.foord components: Library (Lib) keywords: easy messages: 132026 nosy: eric.araujo, ezio.melotti, michael.foord priority: normal severity: normal status: open title: Add patch method to unittest.TestCase type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 24 23:29:03 2011 From: report at bugs.python.org (Viktor Ferenczi) Date: Thu, 24 Mar 2011 22:29:03 +0000 Subject: [New-bugs-announce] [issue11665] Regexp findall freezes In-Reply-To: <1301005743.88.0.293616308721.issue11665@psf.upfronthosting.co.za> Message-ID: <1301005743.88.0.293616308721.issue11665@psf.upfronthosting.co.za> New submission from Viktor Ferenczi : Finding all matches of a expression freezes: {{{ fviktor at sirius:~$ python3.2 Python 3.2 (r32:88445, Mar 8 2011, 01:24:57) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> text = '\\ = 0) & (lag < 1000) & (registered = 1) & !computer & (autocolor = 0) &' >>> rx = re.compile(r'(<(?:(?:[^<>]*)|(?:"[^"]*"))*>)') >>> rx.findall(text) It freezes at this point with 100% CPU load. So I pressed Ctrl-C to break it, which works: ^CTraceback (most recent call last): File "", line 1, in KeyboardInterrupt >>> }}} It is freezing on Python 2.6.6 as well, so it seems to be an old issue just (re)discovered. The regexp is ugly, I know. It can be written much simpler (r'(<.*?>|".*?")'), which is working fine. But this issue points out a possible vulnerability: DOS attack due to freezing a Python application utilizing an affected regexp to parse user input. I wasn't able to narrow down it further, but this issue is also depending on the text parsed, not only on the regexp pattern itself. ---------- components: Library (Lib) files: regexp_freeze.py messages: 132048 nosy: complex priority: normal severity: normal status: open title: Regexp findall freezes type: crash versions: Python 2.6, Python 3.2 Added file: http://bugs.python.org/file21382/regexp_freeze.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 00:35:44 2011 From: report at bugs.python.org (Raymond Hettinger) Date: Thu, 24 Mar 2011 23:35:44 +0000 Subject: [New-bugs-announce] [issue11666] Test pydoc to display full help for named tuples In-Reply-To: <1301009744.36.0.497333261481.issue11666@psf.upfronthosting.co.za> Message-ID: <1301009744.36.0.497333261481.issue11666@psf.upfronthosting.co.za> New submission from Raymond Hettinger : Teach pydoc to find methods and attributes with leadings underscores in a named tuple. ---------- components: Library (Lib) files: pydoc.patch keywords: patch messages: 132055 nosy: rhettinger priority: normal severity: normal status: open title: Test pydoc to display full help for named tuples type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file21385/pydoc.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 00:49:28 2011 From: report at bugs.python.org (David Kirkby) Date: Thu, 24 Mar 2011 23:49:28 +0000 Subject: [New-bugs-announce] [issue11667] 'configure' script overrides users setting of CFLAGS In-Reply-To: <1301010568.13.0.852668909245.issue11667@psf.upfronthosting.co.za> Message-ID: <1301010568.13.0.852668909245.issue11667@psf.upfronthosting.co.za> New submission from David Kirkby : I'm trying to build a version of Python *without* debugging information. The reason for me wanting to do this is because there is a bug which is either in gcc or AIX , that prevents recently patched versions of AIX building code where there are static variables that are unitilized. So I have tried $ export CFLAGS="-g0" $export CXXFLAGS="-g0" The "-g0" should disable debugging information. But instead the option occurs before the automatically inserted options, so I see: gcc -c -fno-strict-aliasing -g0 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Parser/pgen.o Parser/pgen.c Because of this, the "-g" overrides the "-g0" and I get debugging information. Is there any way to not add -g when building Python? ---------- components: Installation messages: 132056 nosy: drkirkby priority: normal severity: normal status: open title: 'configure' script overrides users setting of CFLAGS type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 01:27:36 2011 From: report at bugs.python.org (Antoine Pitrou) Date: Fri, 25 Mar 2011 00:27:36 +0000 Subject: [New-bugs-announce] [issue11668] _multiprocessing.Connection.poll with timeout uses polling under Windows In-Reply-To: <1301012856.06.0.501822966935.issue11668@psf.upfronthosting.co.za> Message-ID: <1301012856.06.0.501822966935.issue11668@psf.upfronthosting.co.za> New submission from Antoine Pitrou : This impacts higher-level APIs such as Queue.get() with a positive timeout. I'm not sure whether it's easily possible to fix this. A Google search seems to suggest that the pipe could be opened with "SYNCHRONIZE" access rights (?) and then WaitForSingleObject() be used on the handle. ---------- messages: 132058 nosy: asksol, brian.curtin, jnoller, krisvale, pitrou, tim.golden priority: normal severity: normal status: open title: _multiprocessing.Connection.poll with timeout uses polling under Windows type: resource usage versions: Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 09:42:54 2011 From: report at bugs.python.org (Graham Wideman) Date: Fri, 25 Mar 2011 08:42:54 +0000 Subject: [New-bugs-announce] [issue11669] Clarify Lang Ref "Compound statements" footnote In-Reply-To: <1301042574.67.0.975748752077.issue11669@psf.upfronthosting.co.za> Message-ID: <1301042574.67.0.975748752077.issue11669@psf.upfronthosting.co.za> New submission from Graham Wideman : In Language Ref section 7 "Compound Statements": http://docs.python.org/release/3.1.3/reference/compound_stmts.html there's a footnote regarding what happens to unhandled exceptions in a try-except statement: [1] The exception is propagated to the invocation stack only if there is no *finally* clause that negates the exception. This is very unclearly worded, especially since the reader in need of this footnote is probably familiar with the *except* clause being the one to "negate" an exception, and may well think this footnote is in error. This footnote could provide a more convincing explanation: [1] The exception is propagated to the invocation stack unless there is a finally clause which happens to raise another exception. That new exception causes the old exception to be lost. ---------- assignee: docs at python components: Documentation messages: 132072 nosy: docs at python, gwideman priority: normal severity: normal status: open title: Clarify Lang Ref "Compound statements" footnote type: behavior versions: Python 2.5, 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 Fri Mar 25 11:08:19 2011 From: report at bugs.python.org (Larry Hastings) Date: Fri, 25 Mar 2011 10:08:19 +0000 Subject: [New-bugs-announce] [issue11670] configparser read_file now iterates over f, docs still say it calls readline In-Reply-To: <1301047699.5.0.476245530251.issue11670@psf.upfronthosting.co.za> Message-ID: <1301047699.5.0.476245530251.issue11670@psf.upfronthosting.co.za> New submission from Larry Hastings : The documentation for configparser.RawConfigParser.read_file() states: "Read and parse configuration data from the file or file-like object in f (only the readline() method is used)." This was true in Python 3.1 and before. However in 3.2 the implementation of read_file changed. It no longer calls readline(). Instead, it iterates over the file object. Whoever made this change neglected to * fix the docs, or apparently * tell anybody. I've got the commit bit, so I'd be happy to fix this. I'd like to add it to the What's New In Python 3.2 as well; there's a section about configparser changes that would be perfect. Is it permissible to change the What's New document ex post facto like this? (Adding rhettinger so he can answer this.) ---------- assignee: docs at python components: Documentation messages: 132075 nosy: docs at python, larry, rhettinger priority: low severity: normal stage: needs patch status: open title: configparser read_file now iterates over f, docs still say it calls readline type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 13:14:58 2011 From: report at bugs.python.org (=?utf-8?q?Felix_Gr=C3=B6bert?=) Date: Fri, 25 Mar 2011 12:14:58 +0000 Subject: [New-bugs-announce] [issue11671] Potential misuse of wsgiref.headers.Headers In-Reply-To: <1301055298.41.0.957962483368.issue11671@psf.upfronthosting.co.za> Message-ID: <1301055298.41.0.957962483368.issue11671@psf.upfronthosting.co.za> New submission from Felix Gr?bert : As noted by security at python.org's response I'm filing this bug here. In wsgiref.headers.Headers it is possible to include headers which contain a newline (i.e. \n or \r) either through add_header or __init__. It is not uncommon that developers provide web applications to the public in which the HTTP response headers are not filtered for newlines but are controlled by the user. In such scenarios a malicious user can use a newline to inject another header or even initiate a HTTP response body. The impact would be at least equivalent to XSS. Therefore, I suggest to filter/warn/except header tuples which contain the above characters upon assignment in wsgiref.headers. ---------- components: Library (Lib) messages: 132080 nosy: Felix.Gr?bert priority: normal severity: normal status: open title: Potential misuse of wsgiref.headers.Headers type: security versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 20:47:09 2011 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 25 Mar 2011 19:47:09 +0000 Subject: [New-bugs-announce] [issue11672] multiprocessing.Array fails if size parameter is a long In-Reply-To: <1301082429.65.0.587496352735.issue11672@psf.upfronthosting.co.za> Message-ID: <1301082429.65.0.587496352735.issue11672@psf.upfronthosting.co.za> New submission from Mark Dickinson : [From a problem encountered by an EPD user, analyzed by Robert Kern] There appears to be an if isinstance(size_or_initializer, (int, long)): check in the Python 2.x source for multiprocessing.RawArray. As a result, the following works (as expected): Python 2.7.1+ (2.7:24179f82b7de, Mar 25 2011, 19:11:09) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import multiprocessing [49842 refs] >>> multiprocessing.Array('i', 2) > [65598 refs] But replacing the '2' with a '2L' makes it fail: >>> multiprocessing.Array('i', 2L) Traceback (most recent call last): File "", line 1, in File "/Users/mdickinson/Python/cpython/Lib/multiprocessing/__init__.py", line 260, in Array return Array(typecode_or_type, size_or_initializer, **kwds) File "/Users/mdickinson/Python/cpython/Lib/multiprocessing/sharedctypes.py", line 113, in Array obj = RawArray(typecode_or_type, size_or_initializer) File "/Users/mdickinson/Python/cpython/Lib/multiprocessing/sharedctypes.py", line 85, in RawArray type_ = type_ * len(size_or_initializer) TypeError: object of type 'long' has no len() [65655 refs] ---------- components: Library (Lib) messages: 132143 nosy: mark.dickinson priority: normal severity: normal stage: needs patch status: open title: multiprocessing.Array fails if size parameter is a long type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 20:47:14 2011 From: report at bugs.python.org (Robert Kern) Date: Fri, 25 Mar 2011 19:47:14 +0000 Subject: [New-bugs-announce] [issue11673] RawArray does not accept long In-Reply-To: <1301082434.18.0.556294062053.issue11673@psf.upfronthosting.co.za> Message-ID: <1301082434.18.0.556294062053.issue11673@psf.upfronthosting.co.za> New submission from Robert Kern : The constructor for multiprocessing.RawArray() takes an argument that is either an integer size or a sequence to initialize the contents. To determine if the argument is a size, it uses isinstance(x, int). This means that integers that happen to be Python longs cause an error. On Win64 systems, Python ints are still 32-bits, so valid sizes for arrays sometimes must be represented by Python longs. Attached is a patch that uses operator.index() to determine if the object can be used as an integer size. ---------- components: Library (Lib) files: raw-array-long.diff keywords: patch messages: 132144 nosy: Robert.Kern priority: normal severity: normal status: open title: RawArray does not accept long type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file21396/raw-array-long.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 21:38:10 2011 From: report at bugs.python.org (Elvis Pranskevichus) Date: Fri, 25 Mar 2011 20:38:10 +0000 Subject: [New-bugs-announce] [issue11674] list(obj), tuple(obj) swallow TypeError (in _PyObject_LengthHint) In-Reply-To: <1301085490.36.0.28946733028.issue11674@psf.upfronthosting.co.za> Message-ID: <1301085490.36.0.28946733028.issue11674@psf.upfronthosting.co.za> New submission from Elvis Pranskevichus : Consider the following: >>> class Test: ... def __init__(self): ... self.items = [] ... def __len__(self): ... if not self.items: ... self.items = list(self.calc_items()) ... return len(self.items) ... def __iter__(self): ... return iter(self.items) ... def calc_items(self, number): ... return range(1, number) ... >>> l = list(Test()) >>> print(l) [] >>> t = tuple(Test()) >>> print(t) () In the above example calc_items() method is called with a missing argument, which raises TypeError. That TypeError is being wrongly interpreted as "object of type 'Test' has no len()" and is swallowed by _PyObject_LengthHint(). The result is entirely unpredictable as the bug is masked, which is especially annoying for objects that can have a complex call graph under __len__(). Possible solution would be to adjust _PyObject_LengthHint() to rely on some other exception rather than straight TypeError. Swallowing a generic exception like that is bad. ---------- components: Interpreter Core messages: 132150 nosy: Elvis.Pranskevichus priority: normal severity: normal status: open title: list(obj), tuple(obj) swallow TypeError (in _PyObject_LengthHint) type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 22:02:05 2011 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 25 Mar 2011 21:02:05 +0000 Subject: [New-bugs-announce] [issue11675] multiprocessing Arrays not automatically zeroed. In-Reply-To: <1301086925.85.0.207162654752.issue11675@psf.upfronthosting.co.za> Message-ID: <1301086925.85.0.207162654752.issue11675@psf.upfronthosting.co.za> New submission from Mark Dickinson : The documentation for the multiprocessing module says: "If size_or_initializer is an integer, then it determines the length of the array, and the array will be initially zeroed. " But the part about the array being zeroed doesn't seem to be true: Python 3.3a0 (default:03c7a83bbdd3, Mar 25 2011, 21:00:37) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from multiprocessing import Array [67297 refs] >>> arr1 = Array('i', [56, 27, 1729]) [79877 refs] >>> del arr1 [79805 refs] >>> arr2 = Array('i', 3) [79876 refs] >>> list(arr2) # expect [0, 0, 0] [56, 27, 1729] [79882 refs] ---------- components: Library (Lib) messages: 132153 nosy: jnoller, mark.dickinson priority: normal severity: normal status: open title: multiprocessing Arrays not automatically zeroed. type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 22:40:27 2011 From: report at bugs.python.org (Dave Peck) Date: Fri, 25 Mar 2011 21:40:27 +0000 Subject: [New-bugs-announce] [issue11676] imp.load_module and submodules - doc issue, or bug? In-Reply-To: <1301089227.12.0.157951103986.issue11676@psf.upfronthosting.co.za> Message-ID: <1301089227.12.0.157951103986.issue11676@psf.upfronthosting.co.za> New submission from Dave Peck : If you use `import` to load a package and subpackage: import package import package.subpackage Then the `package` module instance will contain a `subpackage` attribute: assert "subpackage" in dir(sys.modules['package']), "This works." But if you use Python's `imp` module to import these packages instead, the same assertion will fail. Is this a python documentation oversight, or a bug with the `imp` module? To reproduce, clone the associated hg repro and follow the instructions in the README file. Thanks! ---------- components: Interpreter Core, Library (Lib) hgrepos: 10 messages: 132162 nosy: Dave Peck priority: normal severity: normal status: open title: imp.load_module and submodules - doc issue, or bug? type: behavior versions: Python 2.5, Python 2.6, Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Mar 25 23:30:48 2011 From: report at bugs.python.org (Barry A. Warsaw) Date: Fri, 25 Mar 2011 22:30:48 +0000 Subject: [New-bugs-announce] [issue11677] make test has horrendous performance on an ecryptfs In-Reply-To: <1301092248.42.0.811586375377.issue11677@psf.upfronthosting.co.za> Message-ID: <1301092248.42.0.811586375377.issue11677@psf.upfronthosting.co.za> New submission from Barry A. Warsaw : When your home directory is on a Linux (e.g. Ubuntu 10.10) ecryptfs, 'make test' and company can be horrendously slow. Of course, some performance hit should be expected, but depending on which combinations of tests I've run, I can see up to 25000x (!) slower on an ecryptfs than on a normal ext4 file system. regrtest.py changes its cwd to a TEMPDIR, but actually when you're running the tests from inside the Python build directory, this just becomes $srcdir/build so you don't get any advantage of running the tests out of e.g. a much faster tmpfs. (Aside: I'm not sure under what cases you would *not* be normally running out of the build dir, but I guess if you 'cd /tmp; /path/to/python/configure' and such, it would put you in a normal temp directory. OTOH, you're already in a tmpdir by then so what's the point of _make_temp_dir_for_build()?) I'd like to at least provide the option to create regrtest temporary files elsewhere so that they can live on a fast file system. There are several ways I can think of doing this and I'm not sure what the best way is: * Remove the special case from _make_temp_dir_for_build() so that it always sets TESTCWD into a tmpdir. * Add a boolean option --usetmp/-p which enables this override or the moral equivalent. * Make TESTFN relative to mkdtemp(). A quick and dirty test of this showed that it did significantly improve test times, but there were test failures too. I'm open to other ideas, but I really do want to be able to ./configure && ake && make testall in an ecryptfs build dir and get reasonable test times. You'll need an atexit handler or similar to clean up the tempdir. This does affect older Pythons, but probably any solution would be classified as a new feature so could only go in Python 3.3. ---------- assignee: barry messages: 132171 nosy: barry priority: normal severity: normal stage: needs patch status: open title: make test has horrendous performance on an ecryptfs type: performance versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 01:09:55 2011 From: report at bugs.python.org (=?utf-8?q?Westley_Mart=C3=ADnez?=) Date: Sat, 26 Mar 2011 00:09:55 +0000 Subject: [New-bugs-announce] [issue11678] Add support for Arch Linux to platform.linux_distributions() In-Reply-To: <1301098195.86.0.891765525403.issue11678@psf.upfronthosting.co.za> Message-ID: <1301098195.86.0.891765525403.issue11678@psf.upfronthosting.co.za> New submission from Westley Mart?nez : This comes from Issue 11340 . Adding support for Arch Linux to platform.linux_distributions() will allow a distutils test to be skipped for Arch. The Arch Linux website: http://www.archlinux.org/ ---------- components: Library (Lib) messages: 132187 nosy: anikom15 priority: normal severity: normal status: open title: Add support for Arch Linux to platform.linux_distributions() type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 01:28:39 2011 From: report at bugs.python.org (Thomas Kluyver) Date: Sat, 26 Mar 2011 00:28:39 +0000 Subject: [New-bugs-announce] [issue11679] readline interferes with characters beginning with byte \xe9 In-Reply-To: <1301099319.36.0.392064400408.issue11679@psf.upfronthosting.co.za> Message-ID: <1301099319.36.0.392064400408.issue11679@psf.upfronthosting.co.za> New submission from Thomas Kluyver : To replicate, in Python 3.1 on Linux (utf-8 console): >>> print(chr(0x9000)) ? Copy and paste this character into the prompt. It appears correctly (as a Chinese character). Then: >>> import readline >>> readline.parse_and_bind('"\M-i":" "') Now try to paste the character again: it appears as " ??" (four spaces, two unknown character symbols), and if you press return, you get a SyntaxError. This happens with all characters beginning with \xe9: In UTF-8, that's 0x9000-0x9fff. If the terminal encoding is changed to cp1252, I'm told that the same thing can be achieved with ?, which is \xe9 there. ---------- components: Unicode messages: 132192 nosy: takluyver priority: normal severity: normal status: open title: readline interferes with characters beginning with byte \xe9 type: behavior versions: Python 2.6, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 01:45:38 2011 From: report at bugs.python.org (David Bailey) Date: Sat, 26 Mar 2011 00:45:38 +0000 Subject: [New-bugs-announce] [issue11680] decimal module generates AttributeError: on call to as_integer_ratio In-Reply-To: <1301100338.15.0.911220600298.issue11680@psf.upfronthosting.co.za> Message-ID: <1301100338.15.0.911220600298.issue11680@psf.upfronthosting.co.za> New submission from David Bailey : File "C:\test3.py", line 166, in m self.from_float(value * decimal.Decimal(1.0))/decimal.Decimal(1.0) File "c:\Python27\lib\decimal.py", line 691, in from_float n, d = abs(f).as_integer_ratio() AttributeError: 'Decimal' object has no attribute 'as_integer_ratio' line 691 in decimal.py n, d = abs(f).as_integer_ratio() should be n, d = _math.fabs(f).as_integer_ratio() ---------- components: Library (Lib) messages: 132194 nosy: daveabailey priority: normal severity: normal status: open title: decimal module generates AttributeError: on call to as_integer_ratio type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 01:53:45 2011 From: report at bugs.python.org (=?utf-8?q?=C3=89ric_Araujo?=) Date: Sat, 26 Mar 2011 00:53:45 +0000 Subject: [New-bugs-announce] [issue11681] -b option undocumented In-Reply-To: <1301100825.87.0.69977993755.issue11681@psf.upfronthosting.co.za> Message-ID: <1301100825.87.0.69977993755.issue11681@psf.upfronthosting.co.za> New submission from ?ric Araujo : Python 2 has a -b command-line option which is undocumented. It is used by the warnings machinery to decide to warn about (-b) or raise an error (-bb) if someone uses str(bytes) or str(buffer) (explanation courtesy of grep and Python/pythonrun.c). ---------- assignee: docs at python components: Documentation keywords: easy messages: 132195 nosy: docs at python, eric.araujo priority: normal severity: normal stage: needs patch status: open title: -b option undocumented versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 04:36:45 2011 From: report at bugs.python.org (Nick Coghlan) Date: Sat, 26 Mar 2011 03:36:45 +0000 Subject: [New-bugs-announce] [issue11682] PEP 380 reference implementation for 3.3 In-Reply-To: <1301110605.68.0.392943983038.issue11682@psf.upfronthosting.co.za> Message-ID: <1301110605.68.0.392943983038.issue11682@psf.upfronthosting.co.za> New submission from Nick Coghlan : Creating an issue to track efforts to forward port the PEP 380 reference implementation to Python 3.3. ---------- hgrepos: 11 messages: 132213 nosy: ncoghlan priority: normal severity: normal status: open title: PEP 380 reference implementation for 3.3 versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 15:36:42 2011 From: report at bugs.python.org (Calvin Spealman) Date: Sat, 26 Mar 2011 14:36:42 +0000 Subject: [New-bugs-announce] [issue11683] unittest discover should recurse into packages which are already in sys.path In-Reply-To: <1301150202.25.0.136502435987.issue11683@psf.upfronthosting.co.za> Message-ID: <1301150202.25.0.136502435987.issue11683@psf.upfronthosting.co.za> New submission from Calvin Spealman : For example, if I had a project with a "src/" directory and inside that directory is a package named "foo", then I can run "python3 -m unittest discover -s ." and the tests will be not be found, but I can run "python3 -m unittest discover -s src/" and the tests in the foo package are run. This is because it can only find things which are in the python path, but if I have src/ on the path (I ran "add2virtualenv src/" at some point) then discover should know it can traverse inside this directory. ---------- messages: 132242 nosy: Calvin.Spealman priority: normal severity: normal status: open title: unittest discover should recurse into packages which are already in sys.path type: feature request versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 16:05:32 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Sat, 26 Mar 2011 15:05:32 +0000 Subject: [New-bugs-announce] [issue11684] (Maybe) Add email.parser.BytesHeaderParser In-Reply-To: <1301151932.52.0.667036895822.issue11684@psf.upfronthosting.co.za> Message-ID: <1301151932.52.0.667036895822.issue11684@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : David, you haven't added this one once you've added BytesParser(), so i assume that happened intentionally. On the other hand all the package heads in direction bytes, and HeaderParser as such is currently somewhat unusable. (The applied diff also corrects a documentation mispelling.) ---------- components: Library (Lib) files: bytes-header-parser.1.diff keywords: patch messages: 132243 nosy: r.david.murray, sdaoden priority: normal severity: normal status: open title: (Maybe) Add email.parser.BytesHeaderParser type: feature request versions: Python 3.3 Added file: http://bugs.python.org/file21409/bytes-header-parser.1.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 17:18:38 2011 From: report at bugs.python.org (Rene Dudfield) Date: Sat, 26 Mar 2011 16:18:38 +0000 Subject: [New-bugs-announce] [issue11685] possible SQL injection into db APIs via table names... sqlite3 In-Reply-To: <1301156318.95.0.463005530171.issue11685@psf.upfronthosting.co.za> Message-ID: <1301156318.95.0.463005530171.issue11685@psf.upfronthosting.co.za> New submission from Rene Dudfield : Hi, you can possibly do an SQL injection via table names (and maybe some other parts of queries). Tested with sqlite3, but maybe it affects others too. You can not do parameter substitution for table names, so people use normal python string formatting instead. If the table name comes from an untrusted source, then possibly an SQL injection could happen. cheers, ---------- messages: 132247 nosy: illume priority: normal severity: normal status: open title: possible SQL injection into db APIs via table names... sqlite3 type: security _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 18:15:41 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Sat, 26 Mar 2011 17:15:41 +0000 Subject: [New-bugs-announce] [issue11686] Update of some email/ __all__ lists In-Reply-To: <1301159741.4.0.853509960092.issue11686@psf.upfronthosting.co.za> Message-ID: <1301159741.4.0.853509960092.issue11686@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : This patch adds some BytesXy classes to some __all__[] exporters. (Still don't know why i can import email x = email.feedparser.Xy() but not import email x = email.parser.Xy() Is there any reason for that?) ---------- components: Library (Lib) files: __all__.diff keywords: patch messages: 132254 nosy: r.david.murray, sdaoden priority: normal severity: normal status: open title: Update of some email/ __all__ lists type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21411/__all__.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 18:51:14 2011 From: report at bugs.python.org (yac00b) Date: Sat, 26 Mar 2011 17:51:14 +0000 Subject: [New-bugs-announce] [issue11687] Cannot register using command-line In-Reply-To: <1301161874.42.0.537788072216.issue11687@psf.upfronthosting.co.za> Message-ID: <1301161874.42.0.537788072216.issue11687@psf.upfronthosting.co.za> New submission from yac00b : I am not exactly sure if it is a proper place for my problem. I am quite new to Python in general. I am working on Windows 7 with Python 3.2. I wanted to upload a module to PyPI. To do that I have to register with the command-line. I use the command "python3 setup.py register" and then I have to choose whether to use existing login, to create new etc. I am already registered on the website. When I choose 1 and press Enter, it still wants me to put a proper number. I searched the web and I found out that the solution is to specify my username and password in the .pypirc file. The problem is that I have no idea where to find this file. Should I maybe create it? The ".pypirc" is the extension? What is the exact name of the file? Or maybe is there any other way to solve this problem? ---------- components: Windows messages: 132258 nosy: yac00b priority: normal severity: normal status: open title: Cannot register using command-line type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 23:09:21 2011 From: report at bugs.python.org (Torsten Landschoff) Date: Sat, 26 Mar 2011 22:09:21 +0000 Subject: [New-bugs-announce] [issue11688] SQLite trace callback In-Reply-To: <1301177361.02.0.994780961602.issue11688@psf.upfronthosting.co.za> Message-ID: <1301177361.02.0.994780961602.issue11688@psf.upfronthosting.co.za> New submission from Torsten Landschoff : I'd like to access the SQLite trace callback from Python to actually see the same queries that SQLite actually gets to see. The C API of SQLite supports this via the sqlite3_trace function. I added support to this to the sqlite3 module plus unit tests testing that it is called, can be removed again and that unicode arguments arrive correctly at the callback. Please consider applying the patch. I am not sure if this should go to the pysqlite project on Google Code directly, I am just submitting it here because I worked in the python source tree as I am more used to its build system. I am sorry, Gerhard, if this is the wrong way. ---------- components: Library (Lib) files: sqlite_trace_py3.diff keywords: patch messages: 132275 nosy: torsten priority: normal severity: normal status: open title: SQLite trace callback type: feature request versions: Python 2.7, Python 3.3 Added file: http://bugs.python.org/file21413/sqlite_trace_py3.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Mar 26 23:28:40 2011 From: report at bugs.python.org (Torsten Landschoff) Date: Sat, 26 Mar 2011 22:28:40 +0000 Subject: [New-bugs-announce] [issue11689] sqlite: Incorrect unit test fails to detect failure In-Reply-To: <1301178520.82.0.473046584416.issue11689@psf.upfronthosting.co.za> Message-ID: <1301178520.82.0.473046584416.issue11689@psf.upfronthosting.co.za> New submission from Torsten Landschoff : The CheckClearHandler test in Lib/sqlite3/test/hooks.py is invalid. It sets a local variable in a callback where it wants to change the variable in the closure. Patch attached. ---------- components: Tests files: test_clear_handler_py3.diff keywords: patch messages: 132278 nosy: torsten priority: normal severity: normal status: open title: sqlite: Incorrect unit test fails to detect failure versions: Python 2.7, Python 3.3 Added file: http://bugs.python.org/file21415/test_clear_handler_py3.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 27 03:09:52 2011 From: report at bugs.python.org (Nick Coghlan) Date: Sun, 27 Mar 2011 01:09:52 +0000 Subject: [New-bugs-announce] [issue11690] Add "communication" FAQ to devguide In-Reply-To: <1301188192.33.0.9529618781.issue11690@psf.upfronthosting.co.za> Message-ID: <1301188192.33.0.9529618781.issue11690@psf.upfronthosting.co.za> New submission from Nick Coghlan : It would be good to supplement the "here's the list of mailing lists" (etc) section in the devguide [1] with a more task oriented communications FAQ of the form "If you are asking about topic A, then ask in forums X, Y or Z". (where the "forums" may be any online communications channel, be it a mailing list, IRC channel, Stack Overflow, or whatever) This would also mean that communications questions could be easily answered by following the "Dev FAQ" link in the quick links on the front page of the devguide. [1] http://docs.python.org/devguide/communication.html#communication Also, that page should be updated to mention the new "Python Insiders" blog. ---------- components: None messages: 132283 nosy: ncoghlan priority: normal severity: normal status: open title: Add "communication" FAQ to devguide _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 27 06:16:15 2011 From: report at bugs.python.org (William Edward Stuart Clemens) Date: Sun, 27 Mar 2011 04:16:15 +0000 Subject: [New-bugs-announce] [issue11691] sqlite3 Cursor.description doesn't set type_code In-Reply-To: <1301199375.2.0.455501522423.issue11691@psf.upfronthosting.co.za> Message-ID: <1301199375.2.0.455501522423.issue11691@psf.upfronthosting.co.za> New submission from William Edward Stuart Clemens : The DB API Spec 2.0 (PEP 249) clearly requires that column name and type_code be set as the first two values in Cursor.description the other 5 attributes are optional. The sqlite3 module doesn't set type_code. ---------- components: None files: sqlite.patch keywords: patch messages: 132289 nosy: wesclemens priority: normal severity: normal status: open title: sqlite3 Cursor.description doesn't set type_code type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file21421/sqlite.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 27 09:27:50 2011 From: report at bugs.python.org (Ross Lagerwall) Date: Sun, 27 Mar 2011 07:27:50 +0000 Subject: [New-bugs-announce] [issue11692] subprocess demo functions In-Reply-To: <1301210870.39.0.482032903365.issue11692@psf.upfronthosting.co.za> Message-ID: <1301210870.39.0.482032903365.issue11692@psf.upfronthosting.co.za> New submission from Ross Lagerwall : Running subprocess as a module invokes some demo functions. On posix, one of these doesn't work: $ ./python -m subprocess Process list: b' PID TTY TIME CMD\n 9003 pts/6 00:00:00 python\n 9004 pts/6 00:00:00 ps\n23760 pts/6 00:00:00 bash\n' Looking for 'hda'... b'' Trying a weird file... The file didn't exist. I thought so... Child traceback: Traceback (most recent call last): File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 1757, in _demo_posix print(Popen(["/this/path/does/not/exist"]).communicate()) File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 766, in __init__ restore_signals, start_new_session) File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 1439, in _execute_child raise child_exception_type(errno_num, err_msg) OSError: [Errno 2] No such file or directory: '/this/path/does/not/exist' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ross/code/py3kdev/silly/Lib/runpy.py", line 160, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/home/ross/code/py3kdev/silly/Lib/runpy.py", line 73, in _run_code exec(code, run_globals) File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 1790, in _demo_posix() File "/home/ross/code/py3kdev/silly/Lib/subprocess.py", line 1762, in _demo_posix print(e.child_traceback) AttributeError: 'OSError' object has no attribute 'child_traceback' I think these demo functions should be either be removed or incorporated into the docs. ---------- messages: 132291 nosy: gregory.p.smith, rosslagerwall priority: normal severity: normal status: open title: subprocess demo functions type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 27 10:25:27 2011 From: report at bugs.python.org (Kaushik Kannan) Date: Sun, 27 Mar 2011 08:25:27 +0000 Subject: [New-bugs-announce] [issue11693] memory leak in email.generator.Generator().flatten() method Message-ID: <1301214327.54.0.376971917501.issue11693@psf.upfronthosting.co.za> Changes by Kaushik Kannan : ---------- components: IO, Library (Lib) files: debug_as_string.py nosy: Kaushik.Kannan, barry, r.david.murray priority: normal severity: normal status: open title: memory leak in email.generator.Generator().flatten() method type: resource usage versions: Python 2.6 Added file: http://bugs.python.org/file21424/debug_as_string.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 27 13:12:16 2011 From: report at bugs.python.org (=?utf-8?q?Filip_Gruszczy=C5=84ski?=) Date: Sun, 27 Mar 2011 11:12:16 +0000 Subject: [New-bugs-announce] [issue11694] xdrlib raises ConversionError in inconsistent way In-Reply-To: <1301224336.99.0.411299821684.issue11694@psf.upfronthosting.co.za> Message-ID: <1301224336.99.0.411299821684.issue11694@psf.upfronthosting.co.za> New submission from Filip Gruszczy?ski : xdrlib defines ConversionError, but very seldom uses it. For example: def pack_float(self, x): try: self.__buf.write(struct.pack('>f', x)) except struct.error as msg: raise ConversionError(msg) But it doesn't do so here: def pack_uint(self, x): self.__buf.write(struct.pack('>L', x)) Shouldn't that be more consistent? I am happy to write a patch, that will make xdrlib raise ConversionError, as well as write proper test (I believe xdrlib tests should get some love altogether, so I would add a separate test case for this). ---------- components: Library (Lib) messages: 132309 nosy: gruszczy priority: normal severity: normal status: open title: xdrlib raises ConversionError in inconsistent way type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 27 16:05:45 2011 From: report at bugs.python.org (Steven Bethard) Date: Sun, 27 Mar 2011 14:05:45 +0000 Subject: [New-bugs-announce] [issue11695] Improve argparse usage/help customization In-Reply-To: <1301234745.11.0.232414036754.issue11695@psf.upfronthosting.co.za> Message-ID: <1301234745.11.0.232414036754.issue11695@psf.upfronthosting.co.za> New submission from Steven Bethard : I'm going to try to merge several closely related issues here. Basically, people would like better control over the usage message formatting so that you could: * Put program name and version information at the top of the message * Customize the "usage:" string (e.g. capitalize it) One proposal from anatoly techtonik would be to allow a format string so that you could write something like """My Program, version 3.5 Usage: %(usage)s Some description of my program %(argument_groups)% My epliog text """ This should be implemented as a HelpFormatter class, but we might have to expose a little more of the HelpFormatter API (which is currently documented as a no-public API) to make this possible. Patches welcome. ;-) ---------- components: Library (Lib) messages: 132322 nosy: bethard priority: normal severity: normal stage: needs patch status: open title: Improve argparse usage/help customization type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 27 17:19:09 2011 From: report at bugs.python.org (Mark Mc Mahon) Date: Sun, 27 Mar 2011 15:19:09 +0000 Subject: [New-bugs-announce] [issue11696] msilib.make_id() is not safe for non ASCII characters. In-Reply-To: <1301239149.02.0.122606838754.issue11696@psf.upfronthosting.co.za> Message-ID: <1301239149.02.0.122606838754.issue11696@psf.upfronthosting.co.za> New submission from Mark Mc Mahon : msilib.make_id() currently ensure that any of the following characters are not in the resulting ID: " -+~;" Per the Microsoft documentation the following list of characters are allowed. http://msdn.microsoft.com/en-us/library/aa369212(v=vs.85).aspx """The Identifier data type is a text string. Identifiers may contain the ASCII characters A-Z (a-z), digits, underscores (_), or periods (.). However, every identifier must begin with either a letter or an underscore.""" If an file name contains any characters outside of the characters " -+~;" + string.ascii_letters + string.digits + "._" then it will be an invalid ID. This includes many punctuation characters which are valid in file names but not ID's, and every unicode character which does not overlap with ASCII. The attached patch tries to fix this - and it includes tests. ---------- components: Windows files: msilib.make_id_fix_and_tests2.patch keywords: patch messages: 132336 nosy: markm priority: normal severity: normal status: open title: msilib.make_id() is not safe for non ASCII characters. versions: Python 3.2 Added file: http://bugs.python.org/file21430/msilib.make_id_fix_and_tests2.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Mar 27 23:13:21 2011 From: report at bugs.python.org (rmib) Date: Sun, 27 Mar 2011 21:13:21 +0000 Subject: [New-bugs-announce] [issue11697] Unsigned type in mmap_move_method In-Reply-To: <1301260401.14.0.178270138539.issue11697@psf.upfronthosting.co.za> Message-ID: <1301260401.14.0.178270138539.issue11697@psf.upfronthosting.co.za> New submission from rmib : In mmapmodule.c a function mmap_move_method, use unsigned variables dest, src, cnt, as signed: unsigned long dest, src, cnt; ... if (cnt <0 | | (cnt + dest) self-> size | | (src + cnt)> self-> size | | dest <0 | | dest> self-> size | | (dest + cnt)> self-> size) ---------- components: Library (Lib) messages: 132364 nosy: rmib priority: normal severity: normal status: open title: Unsigned type in mmap_move_method type: behavior versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 28 00:14:57 2011 From: report at bugs.python.org (Raymond Hettinger) Date: Sun, 27 Mar 2011 22:14:57 +0000 Subject: [New-bugs-announce] [issue11698] Improve repr for structseq objects to show named, but unindexed fields In-Reply-To: <1301264097.04.0.982421975108.issue11698@psf.upfronthosting.co.za> Message-ID: <1301264097.04.0.982421975108.issue11698@psf.upfronthosting.co.za> New submission from Raymond Hettinger : The current __repr__ for structseq only shows the name/value pairs for the positional part and it ignores the other named fields. For example, os.stat(somefile) returns: posix.stat_result(st_mode=33277, st_ino=8468407, st_dev=234881026, st_nlink=1, st_uid=0, st_gid=80, st_size=25424, st_atime=1301263901, st_mtime=1298229258, st_ctime=1298283922) but it doesn't show the other named fields and their values: {'st_ctime': 1298283922.0, 'st_rdev': 0, 'st_mtime': 1298229258.0, 'st_blocks': 56, 'st_flags': 0, 'st_gen': 0, 'st_atime': 1301263901.0, 'st_blksize': 4096, 'st_birthtime': 1298229258.0} The __reduce__ method for structseq returns both the tuple portion and the dictionary portion. The latter needs to be added to the repr so that information doesn't get hidden from the user. ---------- components: Interpreter Core keywords: easy messages: 132372 nosy: rhettinger priority: low severity: normal status: open title: Improve repr for structseq objects to show named, but unindexed fields type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 28 10:43:49 2011 From: report at bugs.python.org (Weeble) Date: Mon, 28 Mar 2011 08:43:49 +0000 Subject: [New-bugs-announce] [issue11699] Documentation for get_option_group is wrong In-Reply-To: <1301301829.71.0.0713641718569.issue11699@psf.upfronthosting.co.za> Message-ID: <1301301829.71.0.0713641718569.issue11699@psf.upfronthosting.co.za> New submission from Weeble : The docs for optparse say this: OptionParser.get_option_group(opt_str) Return, if defined, the OptionGroup that has the title or the long description equals to opt_str After failing to get this to work at all, I looked at the implementation, and the documentation is completely wrong. The method takes an option string, like '-o' or '--option' and returns the option group that it belongs to. Personally, I would much prefer the function to do what the documentation describes, i.e. find the option group with the given name, but I guess it's far too late for that. The scenario I'm in is that I'm writing a plugin for an existing tool which provides access to its OptionParser to add new options, but doesn't provide references to any of the groups that are already created. It looks like this documentation was added recently: http://bugs.python.org/issue1665333 ---------- messages: 132385 nosy: weeble priority: normal severity: normal status: open title: Documentation for get_option_group is wrong _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 28 14:26:30 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Mon, 28 Mar 2011 12:26:30 +0000 Subject: [New-bugs-announce] [issue11700] mailbox.py proxy updates In-Reply-To: <1301315190.34.0.276151285444.issue11700@psf.upfronthosting.co.za> Message-ID: <1301315190.34.0.276151285444.issue11700@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : I'll send a patch that updates/fixes handling of file closes in the internal proxy-file classes. It could cause errors yet because self._file is del-eted but that field may still be used afterwards. >>> mb = mailbox.Maildir('sdaoden', create=False) >>> mbf = mb.get_file(mb.keys()[0]) >>> msg = email.parser.BytesParser().parse(mbf, headersonly=True) >>> mbf.close() Traceback (most recent call last): File "", line 1, in File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 1922, in close if hasattr(self._file, 'close'): AttributeError: '_ProxyFile' object has no attribute '_file' The patched version will always act correctly. And yes, i'll open yet another issue due to the email.parser (or even TextIOWrapper) based problem. ---------- components: Library (Lib) messages: 132395 nosy: georg.brandl, r.david.murray, sdaoden, twouters priority: normal severity: normal status: open title: mailbox.py proxy updates versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 28 14:30:20 2011 From: report at bugs.python.org (Steffen Daode Nurpmeso) Date: Mon, 28 Mar 2011 12:30:20 +0000 Subject: [New-bugs-announce] [issue11701] email.parser.BytesParser() uses TextIOWrapper In-Reply-To: <1301315420.28.0.123524956156.issue11701@psf.upfronthosting.co.za> Message-ID: <1301315420.28.0.123524956156.issue11701@psf.upfronthosting.co.za> New submission from Steffen Daode Nurpmeso : ... and that closes the original file, too! (I've also opened #11700 due to the mailbox.py side of this.) static PyObject * textiowrapper_close(textio *self, PyObject *args) return PyObject_CallMethod(self->buffer, "close", NULL); >>> mb = mailbox.Maildir('sdaoden', create=False) >>> mbf = mb.get_file(mb.keys()[0]) >>> msg = email.parser.BytesParser().parse(mbf, headersonly=True) >>> mbf.close() Traceback (most recent call last): File "", line 1, in File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 1922, in close if hasattr(self._file, 'close'): AttributeError: '_ProxyFile' object has no attribute '_file' ---------- components: Library (Lib) messages: 132397 nosy: r.david.murray, sdaoden priority: normal severity: normal status: open title: email.parser.BytesParser() uses TextIOWrapper versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 28 17:13:42 2011 From: report at bugs.python.org (Mark Mc Mahon) Date: Mon, 28 Mar 2011 15:13:42 +0000 Subject: [New-bugs-announce] [issue11702] dir on return value of msilib.OpenDatabase() crashes python In-Reply-To: <1301325222.81.0.910767875041.issue11702@psf.upfronthosting.co.za> Message-ID: <1301325222.81.0.910767875041.issue11702@psf.upfronthosting.co.za> New submission from Mark Mc Mahon : Running the following code: >>> import msilib >>> db = msilib.OpenDatabase('c:/windows/installer/1c7a1.msi', 1) >>> db <_msi.Database object at 0x01E230A0> >>> dir(db) (Python crashes - tested on current Trunk and Python 2.7.1). I tried tracking it through the C code - and it seems to be a problem when dir is checking for __dir__ (the pointer in PyObject_GetAttrString seems to be incorrect). ---------- components: Windows messages: 132402 nosy: markm priority: normal severity: normal status: open title: dir on return value of msilib.OpenDatabase() crashes python type: crash versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 28 23:23:32 2011 From: report at bugs.python.org (Ivan Ivanenko) Date: Mon, 28 Mar 2011 21:23:32 +0000 Subject: [New-bugs-announce] [issue11703] Bug in python >= 2.7 with urllib2 fragment In-Reply-To: <1301347412.09.0.984655654688.issue11703@psf.upfronthosting.co.za> Message-ID: <1301347412.09.0.984655654688.issue11703@psf.upfronthosting.co.za> New submission from Ivan Ivanenko : result = urllib.urlopen("http://docs.python.org/library/urllib.html#OK") print result.geturl() result = urllib2.urlopen("http://docs.python.org/library/urllib.html#OK") print result.geturl() Python 2.6 returns: "http://docs.python.org/library/urllib.html#OK" "http://docs.python.org/library/urllib.html#OK" Python 2.7 returns: "http://docs.python.org/library/urllib.html#OK" "http://docs.python.org/library/urllib.html" 2to3 -w test.py Python 3 returns: "http://docs.python.org/library/urllib.html" "http://docs.python.org/library/urllib.html" I expect geturl() result with "#OK" in all cases ---------- components: Library (Lib) messages: 132423 nosy: Ivan.Ivanenko priority: normal severity: normal status: open title: Bug in python >= 2.7 with urllib2 fragment type: behavior versions: Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Mar 28 23:34:11 2011 From: report at bugs.python.org (Alex Gaynor) Date: Mon, 28 Mar 2011 21:34:11 +0000 Subject: [New-bugs-announce] [issue11704] functools.partial doesn't create bound methods In-Reply-To: <1301348051.58.0.203467592285.issue11704@psf.upfronthosting.co.za> Message-ID: <1301348051.58.0.203467592285.issue11704@psf.upfronthosting.co.za> New submission from Alex Gaynor : This is related to the discussion we had at the PyCon language summit about C vs Python function binding. If you create a partial instance and put it on a class it doesn't create bound instances. This behavior is a tad surprising in my view. At a minimum it'd be nice if the docs mentioned this. ---------- messages: 132425 nosy: alex priority: normal severity: normal status: open title: functools.partial doesn't create bound methods versions: Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 00:29:16 2011 From: report at bugs.python.org (Elias Zamaria) Date: Mon, 28 Mar 2011 22:29:16 +0000 Subject: [New-bugs-announce] [issue11705] sys.excepthook doesn't work in imported modules In-Reply-To: <1301351356.06.0.0947935400826.issue11705@psf.upfronthosting.co.za> Message-ID: <1301351356.06.0.0947935400826.issue11705@psf.upfronthosting.co.za> New submission from Elias Zamaria : I am trying to design a Python program that logs all uncaught exceptions using the logging module. I am doing this by using the sys.excepthook function to override the default exception handling. I noticed that if I run the program directly from the command line, it works fine, but if I try to import the file, it doesn't work. It seems like the sys.excepthook function is unaware of the logging module. Here is an example: #! /usr/bin/env python2.7 import logging, sys logger = logging.getLogger() logger.setLevel(logging.DEBUG) logger.addHandler(logging.FileHandler("test.log")) print "outside of exception handler: logger = %s" % logger def handleException(excType, excValue, traceback): #global logger # this function doesn't work whether or not I include this line print "inside exception handler: logger = %s" % logger logger.error("Uncaught exception", exc_info=(excType, excValue, traceback)) sys.excepthook = handleException logger.debug("starting") asdf # create an exception If I run this from the command line (`./loggingTest.py`), it works fine. The exception gets logged, and I see this output: outside of exception handler: logger = inside exception handler: logger = However, if I run the Python interpreter and try to import the file (`import loggingTest`), it acts strangely. The exception doesn't get logged and I see this: outside of exception handler: logger = inside exception handler: logger = None Error in sys.excepthook: Traceback (most recent call last): File "loggingTest.py", line 13, in handleException logger.error("Uncaught exception", exc_info=(excType, excValue, traceback)) AttributeError: 'NoneType' object has no attribute 'error' Original exception was: Traceback (most recent call last): File "", line 1, in File "loggingTest.py", line 18, in asdf # create an exception NameError: name 'asdf' is not defined I can maybe work around this problem by importing the logging module again within sys.excepthook, but I am still curious: why is this happening? The above text was copied from my question on Stack Overflow (http://stackoverflow.com/questions/5451746/sys-excepthook-doesnt-work-in-imported-modules). Someone on there (Jochen Ritzel) has mentioned that he noticed this bug in Python 2.7.1 but not 2.7. To me, it seems like the sys.excepthook function is unaware of any imported modules, unless those modules are imported from inside the function. ---------- components: Library (Lib) files: loggingTest.py messages: 132437 nosy: mikez302 priority: normal severity: normal status: open title: sys.excepthook doesn't work in imported modules type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file21446/loggingTest.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 00:41:36 2011 From: report at bugs.python.org (Dave Malcolm) Date: Mon, 28 Mar 2011 22:41:36 +0000 Subject: [New-bugs-announce] [issue11706] Build from hg fails with ancient hg version (0.9.3) In-Reply-To: <1301352096.18.0.757647939561.issue11706@psf.upfronthosting.co.za> Message-ID: <1301352096.18.0.757647939561.issue11706@psf.upfronthosting.co.za> New submission from Dave Malcolm : With hg/mercurial 0.9.3, the build of CPython fails with this error: gcc -pthread -c -fno-strict-aliasing -g -O0 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE \ -DHGVERSION="\"`LC_ALL=C hg id -i .`\"" \ -DHGTAG="\"`LC_ALL=C hg id -t .`\"" \ -DHGBRANCH="\"`LC_ALL=C hg id -b .`\"" \ -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c hg identify: option -i not recognized hg identify: option -t not recognized hg identify: option -b not recognized ./Modules/getbuildinfo.c: In function ?Py_GetBuildInfo?: ./Modules/getbuildinfo.c:37: error: missing terminating " character ./Modules/getbuildinfo.c:37: error: expected expression before ?)? token ./Modules/getbuildinfo.c:38: error: missing terminating " character ./Modules/getbuildinfo.c:38: error: missing terminating " character ./Modules/getbuildinfo.c:39: error: missing terminating " character ./Modules/getbuildinfo.c:39: error: missing terminating " character ./Modules/getbuildinfo.c:45: error: ?buildinfo? undeclared (first use in this function) ./Modules/getbuildinfo.c:45: error: (Each undeclared identifier is reported only once ./Modules/getbuildinfo.c:45: error: for each function it appears in.) ./Modules/getbuildinfo.c:49: warning: control reaches end of non-void function ./Modules/getbuildinfo.c: In function ?_Py_hgversion?: ./Modules/getbuildinfo.c:54: error: missing terminating " character ./Modules/getbuildinfo.c:54: warning: ?return? with no value, in function returning non-void ./Modules/getbuildinfo.c: In function ?_Py_hgidentifier?: ./Modules/getbuildinfo.c:61: error: missing terminating " character ./Modules/getbuildinfo.c:61: error: expected expression before ?;? token ./Modules/getbuildinfo.c:65: error: missing terminating " character ./Modules/getbuildinfo.c:65: error: expected expression before ?;? token make: *** [Modules/getbuildinfo.o] Error 1 What's happening is that "hg id" doesn't recognize the given options, and thus the various HG macros get set to insane multi-line strings containing usage information, but without quote characters, rather than to empty string literals [1]. This means that the post-processed code isn't valid C. The workaround presumably is to upgrade to a more recent version of mercurial. I'm reporting this here in the bug tracker in case anyone else runs into this problem. [1] Adding "-v" to the gcc invocation demonstrates that the values being passed are: -DHGVERSION="hg identify print information about the working copy Print a short summary of the current state of the repo. This summary identifies the repository state using one or two parent hash identifiers, followed by a "+" if there are uncommitted changes in the working directory, followed by a list of tags for this revision. aliases: id" -DHGTAG="hg identify print information about the working copy Print a short summary of the current state of the repo. This summary identifies the repository state using one or two parent hash identifiers, followed by a "+" if there are uncommitted changes in the working directory, followed by a list of tags for this revision. aliases: id" -DHGBRANCH="hg identify print information about the working copy Print a short summary of the current state of the repo. This summary identifies the repository state using one or two parent hash identifiers, followed by a "+" if there are uncommitted changes in the working directory, followed by a list of tags for this revision. aliases: id" ---------- components: Build messages: 132440 nosy: dmalcolm priority: low severity: normal status: open title: Build from hg fails with ancient hg version (0.9.3) type: compile error versions: Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 02:22:27 2011 From: report at bugs.python.org (Raymond Hettinger) Date: Tue, 29 Mar 2011 00:22:27 +0000 Subject: [New-bugs-announce] [issue11707] Create C version of functools.cmp_to_key() In-Reply-To: <1301358147.85.0.729395241348.issue11707@psf.upfronthosting.co.za> Message-ID: <1301358147.85.0.729395241348.issue11707@psf.upfronthosting.co.za> New submission from Raymond Hettinger : For cases where the underlying comparison function is in C (strcoll for example), the pure Python dispatch in cmp_to_key dominates running time. This can be reduced considerably by writing cmp_to_key in C, making its overhead as low or lower than the cost of bound method dispatch. ---------- assignee: rhettinger components: Interpreter Core keywords: easy messages: 132448 nosy: rhettinger priority: low severity: normal stage: needs patch status: open title: Create C version of functools.cmp_to_key() type: performance versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 06:21:10 2011 From: report at bugs.python.org (Peter Williams) Date: Tue, 29 Mar 2011 04:21:10 +0000 Subject: [New-bugs-announce] [issue11708] argparse: suggestion for formatting optional positional args In-Reply-To: <1301372470.63.0.394832292121.issue11708@psf.upfronthosting.co.za> Message-ID: <1301372470.63.0.394832292121.issue11708@psf.upfronthosting.co.za> New submission from Peter Williams : At present, if a number (e.g. 2) of optional positional arguments are defined (e.g. arg1 and arg2) argparse formats them as follows: usage: program [arg1] [arg2] in the usage message. I would like to suggest that a better format would be: usage: program [arg1 [arg2]] as this more accurately reflects the way argparse treats them during parsing of the command line. This formatting would be consistent with the way argparse currently formats a single optional positional argument with nargs='*', namely: usage: program [arg [arg ...]] ---------- components: Library (Lib) messages: 132462 nosy: pwil3058 priority: normal severity: normal status: open title: argparse: suggestion for formatting optional positional args type: feature request versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 11:26:04 2011 From: report at bugs.python.org (Palm Kevin) Date: Tue, 29 Mar 2011 09:26:04 +0000 Subject: [New-bugs-announce] [issue11709] help-method crashes if sys.stdin is None In-Reply-To: <1301390764.04.0.564019544953.issue11709@psf.upfronthosting.co.za> Message-ID: <1301390764.04.0.564019544953.issue11709@psf.upfronthosting.co.za> New submission from Palm Kevin : The interactive help-method provided by python crashes when no stdin-stream is available (sys.stdin == None). Exception: Traceback (most recent call last): File "MyScript", line 4, in File "C:\Python32\lib\site.py", line 457, in __call__ return pydoc.help(*args, **kwds) File "C:\Python32\lib\pydoc.py", line 1748, in __call__ self.help(request) File "C:\Python32\lib\pydoc.py", line 1795, in help else: doc(request, 'Help on %s:', output=self._output) File "C:\Python32\lib\pydoc.py", line 1537, in doc pager(render_doc(thing, title, forceload)) File "C:\Python32\lib\pydoc.py", line 1345, in pager pager = getpager() File "C:\Python32\lib\pydoc.py", line 1352, in getpager if not sys.stdin.isatty() or not sys.stdout.isatty(): AttributeError: 'NoneType' object has no attribute 'isatty' I think that this situation should be handled: - either by raising a clear error message indicating that help cannot be displayed because Python is executing in a non-interactive mode - either by simply printing documentation to stdout (like this: "print(sys.__doc__)") ---------- messages: 132474 nosy: palm.kevin priority: normal severity: normal status: open title: help-method crashes if sys.stdin is None _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 14:31:47 2011 From: report at bugs.python.org (Nick Coghlan) Date: Tue, 29 Mar 2011 12:31:47 +0000 Subject: [New-bugs-announce] [issue11710] Landing pages in docs for standard library packages In-Reply-To: <1301401907.02.0.216152132906.issue11710@psf.upfronthosting.co.za> Message-ID: <1301401907.02.0.216152132906.issue11710@psf.upfronthosting.co.za> New submission from Nick Coghlan : http://docs.python.org/py3k/urllib errors out rather than returning an index page for the modules that are part of the urllib package. This index page could also link to the HOWTO at http://docs.python.org/py3k/howto/urllib2.html The following packages have the same problem: xml, http, xmlrpc, concurrent These ones look OK: logging, curses, html, tkinter These index pages don't necessarily need to be linked from the contents page, but they should exist so that manually typed URLs for these packages do something useful rather than erroring out with a 404. ---------- assignee: docs at python components: Documentation messages: 132481 nosy: docs at python, ncoghlan priority: normal severity: normal status: open title: Landing pages in docs for standard library packages versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 21:19:09 2011 From: report at bugs.python.org (Cloudberry) Date: Tue, 29 Mar 2011 19:19:09 +0000 Subject: [New-bugs-announce] [issue11711] socketpair does not accept AF_INET family argument [Linux] In-Reply-To: <1301426349.91.0.210960527255.issue11711@psf.upfronthosting.co.za> Message-ID: <1301426349.91.0.210960527255.issue11711@psf.upfronthosting.co.za> New submission from Cloudberry : System where issue was reproduced is Ubuntu 10.04 32-bit with python 2.6.5 Expected behavior for socket.socketpair as per the docstring: "The arguments are the same as for socket() except the default family is AF_UNIX if defined on the platform; otherwise, the default is AF_INET." Executing socket.socketpair() or socket.socketpair(socket.AF_UNIX) runs fine. However, executing socket.socketpair(socket.AF_INET) throws socket.error with Errno 95 "Operation not supported". It seems either the docstring is off suggesting non-default family can be selected, or the AF_INET option is broken. ---------- components: Library (Lib) files: socketpair_runme.py.bz2 messages: 132504 nosy: Cloudberry priority: normal severity: normal status: open title: socketpair does not accept AF_INET family argument [Linux] type: behavior versions: Python 2.6 Added file: http://bugs.python.org/file21455/socketpair_runme.py.bz2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 21:28:42 2011 From: report at bugs.python.org (Terry J. Reedy) Date: Tue, 29 Mar 2011 19:28:42 +0000 Subject: [New-bugs-announce] [issue11712] Doc list.sort(cmp=,key=) result. In-Reply-To: <1301426922.02.0.157603577623.issue11712@psf.upfronthosting.co.za> Message-ID: <1301426922.02.0.157603577623.issue11712@psf.upfronthosting.co.za> New submission from Terry J. Reedy : l=[1,3,2] l.sort(cmp=lambda x,y:y-x, key=lambda x: x) print(l) With CPython 2.7 this 1) could raise an exception like TypeError: conflicting arguments passed; 2) could ignore cmp= and print [1,2,3] on the basis that the new should override the old; 3) does ignore key= and prints [3,2,1] (why does not matter now), but as near as I can tell, this is not documented. Suggestion: in 5.6.4. Mutable Sequence Types, in footnote 8, after "key specifies a function of one argument that is used to extract a comparison key from each list element: key=str.lower. The default value is None." add "Ignored if *cmp* is also given." ---------- assignee: docs at python components: Documentation keywords: easy, patch messages: 132507 nosy: docs at python, terry.reedy priority: normal severity: normal stage: needs patch status: open title: Doc list.sort(cmp=,key=) result. versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 21:56:50 2011 From: report at bugs.python.org (Davide Rizzo) Date: Tue, 29 Mar 2011 19:56:50 +0000 Subject: [New-bugs-announce] [issue11713] collections.deque docstring wrong/misleading In-Reply-To: <1301428610.35.0.643786956857.issue11713@psf.upfronthosting.co.za> Message-ID: <1301428610.35.0.643786956857.issue11713@psf.upfronthosting.co.za> New submission from Davide Rizzo : collections.deque docstring is: 'deque(iterable[, maxlen]) --> deque object\n\nBuild an ordered collection accessible from endpoints only.' As it reads now, it seems to imply that only endpoints can be read/modified. The rst correctly states that random access is possible (though slow). __ap__ suggestion is "Build an ordered collection with optimized access from its endpoints". ---------- components: Library (Lib) messages: 132513 nosy: davide.rizzo, rhettinger priority: normal severity: normal status: open title: collections.deque docstring wrong/misleading versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 22:08:05 2011 From: report at bugs.python.org (Thomas Rachel) Date: Tue, 29 Mar 2011 20:08:05 +0000 Subject: [New-bugs-announce] [issue11714] threading.Semaphore does not use try...finally In-Reply-To: <1301429285.55.0.524593153571.issue11714@psf.upfronthosting.co.za> Message-ID: <1301429285.55.0.524593153571.issue11714@psf.upfronthosting.co.za> New submission from Thomas Rachel : The acquire() and release() functions of threading.Semaphore do not make use of the try...finally suite as it would be reasonable. They just do def acquire(self, blocking=1): rc = False self.__cond.acquire() [...] self.__cond.release() return rc [...] def release(self): self.__cond.acquire() [...] self.__cond.release() while IMO it would be appropriate to put a try: after the acquire() calls and a finally: before the release() calls so the lock is not held forever if an exception occurs. (Feel free to use with self.__cond: instead...) Especially when Ctrl-C is pressed while acquire() waits, the respective KeyboardInterrupt gets thrown after acquire(), breaking the respective function and the __cond is locked forever because it is never release()d. ---------- components: Extension Modules messages: 132515 nosy: glglgl priority: normal severity: normal status: open title: threading.Semaphore does not use try...finally versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Mar 29 23:48:20 2011 From: report at bugs.python.org (Barry A. Warsaw) Date: Tue, 29 Mar 2011 21:48:20 +0000 Subject: [New-bugs-announce] [issue11715] Building Python on multiarch Debian and Ubuntu In-Reply-To: <1301435300.88.0.0418449859461.issue11715@psf.upfronthosting.co.za> Message-ID: <1301435300.88.0.0418449859461.issue11715@psf.upfronthosting.co.za> New submission from Barry A. Warsaw : Ubuntu 11.04 introduces new directories for libraries and headers to support multiple architectures on a single machine. E.g. 64bit and 32bit on a 64bit Ubuntu. Here are the specs: https://wiki.ubuntu.com/MultiarchSpec http://wiki.debian.org/ReleaseGoals/MultiArch Unlike issue 1294959 this bug simply covers building Python and its stdlib extension modules on such systems. For example, libsqlite3.so is no longer in /usr/lib but instead in /usr/lib/x86_64-linux-gnu on Ubuntu 11.04. This means that a number of extension modules which depend on these 3rd party shared libraries simply won't build, because setup.py is too naive about the paths it searches. The fix is fairly simple; you have to call out to dpkg-architecture to get the value of the platform's architecture and append that to /usr/lib and /usr/include for setup.py's search paths. See the attached branch and patch for a candidate fix. Because this does not introduce a new feature, it simply fixes the build process for changes to already supported platforms, I would like to apply this to Python 2.5 through 3.3. ---------- components: Build hgrepos: 13 messages: 132536 nosy: barry priority: high severity: normal status: open title: Building Python on multiarch Debian and Ubuntu type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 30 01:03:17 2011 From: report at bugs.python.org (Sean Sherrard) Date: Tue, 29 Mar 2011 23:03:17 +0000 Subject: [New-bugs-announce] [issue11716] mixing calls to io.TextIOWrapper.write and io.BufferedWriter.write produces undefined results In-Reply-To: <1301439797.75.0.361604208739.issue11716@psf.upfronthosting.co.za> Message-ID: <1301439797.75.0.361604208739.issue11716@psf.upfronthosting.co.za> New submission from Sean Sherrard : Maybe this is by design, but it certainly took me by surprise. Steps to reproduce: Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import io >>> raw = io.BytesIO() >>> buf = io.BufferedWriter(raw) >>> txt = io.TextIOWrapper(buf) >>> txt.write('one.') 4 >>> txt.buffer.write(b'two.') 4 >>> txt.flush() >>> raw.getvalue() b'two.one.' Same results in 2.7 ---------- components: Library (Lib) messages: 132553 nosy: Sean.Sherrard priority: normal severity: normal status: open title: mixing calls to io.TextIOWrapper.write and io.BufferedWriter.write produces undefined results type: behavior versions: Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 30 02:11:04 2011 From: report at bugs.python.org (Wolfgang Rohdewald) Date: Wed, 30 Mar 2011 00:11:04 +0000 Subject: [New-bugs-announce] [issue11717] conflicting definition of ssize_t in pyconfig.h In-Reply-To: <1301443864.94.0.799403342642.issue11717@psf.upfronthosting.co.za> Message-ID: <1301443864.94.0.799403342642.issue11717@psf.upfronthosting.co.za> New submission from Wolfgang Rohdewald : compiling pykde on windows with msvc2010 on a 32bit Windows 7: sipdnssdpart0.cpp R:\include\msvc\sys/types.h(52) : error C2371: 'ssize_t' : redefinition; different basic types c:\python27\include\pyconfig.h(201) : see declaration of 'ssize_t' I can fix this by defining ssize_t as long in pyconfig.h or as int in kdewin/include/msvc/sys/types.h the original files from windows define SSIZE_T as long so to me this seems like a bug in pyconfig.h, it should say typedef _W64 long ssize_t Python27\include\pyconfig.h says (same in Python32): #ifdef MS_WIN64 typedef __int64 ssize_t; #else typedef _W64 int ssize_t; #endif while kdewin/include/msvc/sys/types.h says: typedef SSIZE_T ssize_t; SSIZE_T is defined in Microsoft SDKs/Windows/v7.0A/Include/BaseTsd.h: typedef LONG_PTR SSIZE_T, *PSSIZE_T; and LONG_PTR from same directory, intsafe.h: #if (__midl > 501) typedef [public] __int3264 LONG_PTR; #else #ifdef _WIN64 typedef __int64 LONG_PTR; #else typedef _W64 long LONG_PTR; #endif // WIN64 #endif // (__midl > 501) for __midl see http://msdn.microsoft.com/en-us/library/aa367301(v=vs.85).aspx ---------- components: Windows messages: 132558 nosy: wrohdewald priority: normal severity: normal status: open title: conflicting definition of ssize_t in pyconfig.h type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 30 02:23:06 2011 From: report at bugs.python.org (Raymond Hettinger) Date: Wed, 30 Mar 2011 00:23:06 +0000 Subject: [New-bugs-announce] [issue11718] Teach IDLE's open-modue command to find packages In-Reply-To: <1301444586.78.0.773077705239.issue11718@psf.upfronthosting.co.za> Message-ID: <1301444586.78.0.773077705239.issue11718@psf.upfronthosting.co.za> New submission from Raymond Hettinger : The open-module command is a fast effective way to examine source code regardless of where it sits on sys.path; however, it gets lost when seeking a package name. Instead of aborting, it could bring-up the __init__.py file. For example, "open-module unittest" or "open-module collections" which both used to work before they became packages could open Lib/unittest/__init__.py and Lib/collections/__init__.py. ---------- components: IDLE keywords: easy messages: 132560 nosy: rhettinger priority: normal severity: normal status: open title: Teach IDLE's open-modue command to find packages type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 30 07:56:50 2011 From: report at bugs.python.org (Nadeem Vawda) Date: Wed, 30 Mar 2011 05:56:50 +0000 Subject: [New-bugs-announce] [issue11719] test_msilib skip unexpected on non-Windows platforms In-Reply-To: <1301464610.3.0.910071471193.issue11719@psf.upfronthosting.co.za> Message-ID: <1301464610.3.0.910071471193.issue11719@psf.upfronthosting.co.za> New submission from Nadeem Vawda : When running regrtest on a non-Windows platform, I get a warning that test_msilib was skipped unexpectedly. The attached patch modifies regrtest to indicate that this is expected. ---------- components: Tests files: test_msilib-expected.diff keywords: patch messages: 132570 nosy: loewis, nvawda priority: normal severity: normal status: open title: test_msilib skip unexpected on non-Windows platforms type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21469/test_msilib-expected.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 30 12:08:12 2011 From: report at bugs.python.org (Tennessee Leeuwenburg) Date: Wed, 30 Mar 2011 10:08:12 +0000 Subject: [New-bugs-announce] [issue11720] PyErr_WriteUnraisable while running cProfile In-Reply-To: <1301479692.05.0.122365414957.issue11720@psf.upfronthosting.co.za> Message-ID: <1301479692.05.0.122365414957.issue11720@psf.upfronthosting.co.za> New submission from Tennessee Leeuwenburg : I am happy to come up with a minimal test for this if that would help, but repeating the problem is not hard. Take a Python2.7 interpreter, install the decorator module from PyPi, and also the code at https://bitbucket.org/tleeuwenburg/benchmarker.py/. Running test_benchmarker.py will cause the problem. Exception TypeError: "'str' object is not callable" in '/tmp/benchlog/2011/30/2011_03_30_09_41.pstats' ignored I've tracked this message down and it's likely being writted to stdout by errors.c, where unraisable exceptions are handled. Using hotshot, and otherwise the same code, the error does not occur. Diagnosing the true cause of this issue is probably beyond me, but I'm more than happy to try to come up with a more minimal example or help any way I can. ---------- components: Interpreter Core messages: 132577 nosy: tleeuwenburg at gmail.com priority: normal severity: normal stage: test needed status: open title: PyErr_WriteUnraisable while running cProfile type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 30 14:17:22 2011 From: report at bugs.python.org (=?utf-8?q?Kristj=C3=A1n_Valur_J=C3=B3nsson?=) Date: Wed, 30 Mar 2011 12:17:22 +0000 Subject: [New-bugs-announce] [issue11721] socket.accept() with a timout socket creates bogus socket In-Reply-To: <1301487442.2.0.0773643422684.issue11721@psf.upfronthosting.co.za> Message-ID: <1301487442.2.0.0773643422684.issue11721@psf.upfronthosting.co.za> New submission from Kristj?n Valur J?nsson : I found this defect at PyCon 2011 after spending a lot of type fidgeting with ssl. The test_ssl.py unittest was using timeout on accept sockets and it was working fine there, but not with the code I was working out. Turns out that _ssl.py resets the timeout state of sockets, but not regular sockets. In short: If you have a socket with settimeout(1), then accept a connection on it, the new socket will have gettimeout()==None, but its state will still (internally) be non-blocking. The attached script demonstrates the issue. This is an issue with all versions of python from 2.5 upwards. There are basically two things we can do to fis this: 1) retain gettimeout()=None but internally make sure we set the resulting socket to blocking mode 2) have the accepted socket inherit the timeout properties of the parent socket properly, and so inherit its timeout value too. Number 2 is more in line with expected BSD socket behaviour that sockets at least inherit the non-blocking attribute of their parent socket. ---------- components: IO files: bug.py messages: 132581 nosy: krisvale priority: normal severity: normal status: open title: socket.accept() with a timout socket creates bogus socket versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file21473/bug.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 30 18:21:45 2011 From: report at bugs.python.org (Jason Morgan) Date: Wed, 30 Mar 2011 16:21:45 +0000 Subject: [New-bugs-announce] [issue11722] mingw64 does not link when building extensions In-Reply-To: <1301502105.52.0.181374026279.issue11722@psf.upfronthosting.co.za> Message-ID: <1301502105.52.0.181374026279.issue11722@psf.upfronthosting.co.za> New submission from Jason Morgan : Bulding a simple extension (the spam example) fails with mingw64. in modsupport.h, the following is used to detect 64bit, it does not work with mingw64. #if SIZEOF_SIZE_T != SIZEOF_INT /* On a 64-bit system, rename the Py_InitModule4 so that 2.4 modules cannot get loaded into a 2.5 interpreter */ #define Py_InitModule4 Py_InitModule4_64 #endif This code never compiles, you can test this by placing similar code and filling it with rubbish. This means it thinks the extension is being built on a 32bit compiler and creates the wrong call for Py_InitModule. Workaround: Explicitly calling Py_InitModule4_64() in extension and declaring Py_InitModule4_64(...) in code. Note this does not complain about re-declaration and builds OK because declaration is wrong. e.g. //m=Py_InitModule("spam", SpamMethods); m = Py_InitModule4_64("spam", SpamMethods,(char *)NULL, (PyObject *)NULL, PYTHON_API_VERSION); Or, a better more portable permanent fix, define WIN64 in code and modify modsupport.h: #if SIZEOF_SIZE_T != SIZEOF_INT || defined(WIN64) /* On a 64-bit system, rename the Py_InitModule4 so that 2.4 modules cannot get loaded into a 2.5 interpreter */ #define Py_InitModule4 Py_InitModule4_64 #endif I am sure there are other, more standard ways. ---------- components: Extension Modules messages: 132595 nosy: moog priority: normal severity: normal status: open title: mingw64 does not link when building extensions type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 30 18:41:47 2011 From: report at bugs.python.org (Jason Morgan) Date: Wed, 30 Mar 2011 16:41:47 +0000 Subject: [New-bugs-announce] [issue11723] No proper support for mingw64 - patch to add In-Reply-To: <1301503307.11.0.347710648609.issue11723@psf.upfronthosting.co.za> Message-ID: <1301503307.11.0.347710648609.issue11723@psf.upfronthosting.co.za> New submission from Jason Morgan : Python2.7 has no proper support for mings64. You can use environment path to trick compiler into using mings64, but this will cause conflict with other builds. Adding a mings64 compiler options is much more sensible as both mingw32 and mings64 can co-exist. (mingw64 has a prefix for all it's exe's) Suggest following patch, tested with mingw-w64-1.0-bin_i686-mingw_20110328 and Python-2.7.1(x64) on Windows7. Diff attached. See related issue 11722 ---------- components: Extension Modules files: mingw64.diff keywords: patch messages: 132597 nosy: moog priority: normal severity: normal status: open title: No proper support for mingw64 - patch to add type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file21477/mingw64.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Mar 30 23:00:09 2011 From: report at bugs.python.org (jenisys) Date: Wed, 30 Mar 2011 21:00:09 +0000 Subject: [New-bugs-announce] [issue11724] concurrent.futures: executor.submit() runs until completion even when future times out or is canceled In-Reply-To: <1301518809.28.0.175951319539.issue11724@psf.upfronthosting.co.za> Message-ID: <1301518809.28.0.175951319539.issue11724@psf.upfronthosting.co.za> New submission from jenisys : A long running task that is submitted to an ThreadPoolExecutor runs to completion even when the future times out or is canceled. Even executor.shutdown(wait=False) will not help. HOW TO REPEAT: Provide a function which sleeps for 10 seconds. Submit it to a ThreadPoolExecutor. Wait on the future for the result for 2 seconds. OBSERVED BEHAVIOUR: 1. future times out after approx. 2 seconds 2. Process shutdown is delayed by an additional 8 seconds, meaning it waits until submitted task/function has completed. ---------- components: Library (Lib) messages: 132614 nosy: jenisys priority: normal severity: normal status: open title: concurrent.futures: executor.submit() runs until completion even when future times out or is canceled type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 31 07:43:54 2011 From: report at bugs.python.org (Isaac Salsberg) Date: Thu, 31 Mar 2011 05:43:54 +0000 Subject: [New-bugs-announce] [issue11725] httplib and urllib2 failed ssl connection httplib.BadStatusLine In-Reply-To: <1301550234.98.0.946954388837.issue11725@psf.upfronthosting.co.za> Message-ID: <1301550234.98.0.946954388837.issue11725@psf.upfronthosting.co.za> New submission from Isaac Salsberg : https connections fails under intel MAC OS X 10.6.6 and 10.6.7 using httplib and/or urllib2 connecting to an IIS web server requesting basic authentication and a client certificate. This is an issue with MAC OS X 10.6.x, because I tried these very same scripts under RHES 5 x64 with python 2.6.5 and python 2.7.1 and they both run just fine. ---------------------------- Sample code with urllib2: import urllib2 response = urllib2.urlopen('https://www.finratrace.org/') ------------------ Sample code with httplib import httplib,base64 key,cert=('/tmp/cert_nopwd.pem',)*2 HOSTNAME = 'www.finratrace.org' username,password='myuser','mypass' base64string = base64.encodestring('%s:%s' % (username, password))[:-1] conn = httplib.HTTPSConnection(HOSTNAME,key_file = key,cert_file = cert) conn.putrequest('GET', '/') conn.putheader("Authorization", "Basic %s" % base64string) conn.endheaders() response = conn.getresponse() ----------------------- Both samples send the following error: ====>With python 2.6.1 Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import urllib2 >>> response = urllib2.urlopen('https://www.finratrace.org/') Traceback (most recent call last): File "", line 1, in File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 383, in open response = self._open(req, data) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 401, in _open '_open', req) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 361, in _call_chain result = func(*args) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 1138, in https_open return self.do_open(httplib.HTTPSConnection, req) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 1103, in do_open r = h.getresponse() File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 950, in getresponse response.begin() File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 390, in begin version, status, reason = self._read_status() File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/httplib.py", line 354, in _read_status raise BadStatusLine(line) httplib.BadStatusLine ================================== ====>Same thing happens Using python 2.7.1 Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import httplib,base64 >>> >>> key,cert=('/tmp/cert_nopwd.pem',)*2 >>> HOSTNAME = 'www.finratrace.org' >>> >>> username,password='myuser','mypass' >>> >>> base64string = base64.encodestring('%s:%s' % (username, password))[:-1] >>> >>> >>> conn = httplib.HTTPSConnection(HOSTNAME,key_file = key,cert_file = cert) >>> conn.putrequest('GET', '/') >>> conn.putheader("Authorization", "Basic %s" % base64string) >>> >>> conn.endheaders() >>> response = conn.getresponse() Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1021, in getresponse return response File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 401, in begin while True: File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 365, in _read_status # sending a valid response. httplib.BadStatusLine: '' ===================================== I also compiled py 2.7 getting the same error message. I tried patches from Issue7291, but did not work. ---------- assignee: ronaldoussoren components: Library (Lib), Macintosh messages: 132636 nosy: isalsberg, ronaldoussoren priority: normal severity: normal status: open title: httplib and urllib2 failed ssl connection httplib.BadStatusLine type: resource usage versions: Python 2.6, Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 31 12:08:02 2011 From: report at bugs.python.org (STINNER Victor) Date: Thu, 31 Mar 2011 10:08:02 +0000 Subject: [New-bugs-announce] [issue11726] linecache becomes specific to Python scripts in Python 3 In-Reply-To: <1301566082.59.0.198488725536.issue11726@psf.upfronthosting.co.za> Message-ID: <1301566082.59.0.198488725536.issue11726@psf.upfronthosting.co.za> New submission from STINNER Victor : linecache document doesn't tell that the module reads the #coding:xxx cookie to get the encoding of the Python file. linecache reads this cookie since 41665 (May 09 2007). "The linecache module allows one to get any line from any file, ..." => "any file"! And the example uses /etc/passwd which is not a Python file. Not only it reads the #coding:xxx cookie, but updatecache() tries also a PEP 302 loader to read the file. linecache should be marked as very specific to Python scripts, or it should be patched to become more generic (don't read the cookie / use loader by default). Note: the locale encoding may change between to calls to the linecache module. ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 132641 nosy: docs at python, haypo priority: normal severity: normal status: open title: linecache becomes specific to Python scripts in Python 3 versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 31 12:19:45 2011 From: report at bugs.python.org (STINNER Victor) Date: Thu, 31 Mar 2011 10:19:45 +0000 Subject: [New-bugs-announce] [issue11727] Add a --timeout option to regrtest.py using the faulthandler module In-Reply-To: <1301566785.42.0.872105634784.issue11727@psf.upfronthosting.co.za> Message-ID: <1301566785.42.0.872105634784.issue11727@psf.upfronthosting.co.za> New submission from STINNER Victor : I would be nice to add a timeout option to regrtest.py to be able to dump the traceback after TIMEOUT seconds and also exit the process. It would help debugging timeout issues (e.g. test_multiprocessing ), but also protect buildbots against evil (long) tests. Attached patch implements this feature. ---------- components: Tests files: regrtest_timeout.patch keywords: buildbot, patch messages: 132643 nosy: haypo priority: normal severity: normal status: open title: Add a --timeout option to regrtest.py using the faulthandler module versions: Python 3.3 Added file: http://bugs.python.org/file21488/regrtest_timeout.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 31 14:04:26 2011 From: report at bugs.python.org (valera) Date: Thu, 31 Mar 2011 12:04:26 +0000 Subject: [New-bugs-announce] [issue11728] mbox parser incorrect behaviour In-Reply-To: <1301573066.6.0.277247050127.issue11728@psf.upfronthosting.co.za> Message-ID: <1301573066.6.0.277247050127.issue11728@psf.upfronthosting.co.za> New submission from valera : mailbox.mbox parser is splitting mbox files by "^From " pattern, which is wrong , in fairy it should split mbox by "\nFrom ". Illustration: ------ >From bla-blah at localhost Header1 Header2 body1 body2 >From blah-blah2 at localhost Header1 body1 >From your dear friend body3 ------ This mbox would be splitted in 3 messages instead of 2 ---------- components: Library (Lib) messages: 132657 nosy: wally1980 priority: normal severity: normal status: open title: mbox parser incorrect behaviour versions: Python 2.5, 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 Thu Mar 31 14:38:40 2011 From: report at bugs.python.org (Ismail Donmez) Date: Thu, 31 Mar 2011 12:38:40 +0000 Subject: [New-bugs-announce] [issue11729] libffi assembler relocation check is not robust, fails with clang In-Reply-To: <1301575120.29.0.707250693117.issue11729@psf.upfronthosting.co.za> Message-ID: <1301575120.29.0.707250693117.issue11729@psf.upfronthosting.co.za> New submission from Ismail Donmez : The check under Modules/_ctypes/libffi/configure.ac does; echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then libffi_cv_as_x86_pcrel=no fi With clang; we get: clang: warning: argument unused during compilation: '-g' So it fails to detect pc relocation support due to an unrelated warning. ---------- components: Build messages: 132663 nosy: cartman priority: normal severity: normal status: open title: libffi assembler relocation check is not robust, fails with clang versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 31 17:17:24 2011 From: report at bugs.python.org (ysj.ray) Date: Thu, 31 Mar 2011 15:17:24 +0000 Subject: [New-bugs-announce] [issue11730] Setting sys.stdin to an invalid input stream causes interpreter run loop forever. In-Reply-To: <1301584644.8.0.189290691333.issue11730@psf.upfronthosting.co.za> Message-ID: <1301584644.8.0.189290691333.issue11730@psf.upfronthosting.co.za> New submission from ysj.ray : Setting sys.stdin to an invalid input stream under interactive mode causes interpreter run loop forever: Python 3.3a0 (default:22ae2b002865+, Mar 30 2011, 21:17:03) [GCC 4.4.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys [57804 refs] >>> sys.stdin = None [57809 refs] [57809 refs] [57809 refs] [57809 refs] [57809 refs] ...... Not only setting to None but also to any other invalid input stream could cause this. It's because in the beginning of PyRun_InteractiveOneFlags(), in order to get stdin encoding, the code tries to get sys.stdin and check if it's valid(not NULL, not None, has "encoding" attribute), if not, return -1 directly, then the loop in PyRun_InteractLoopFlags() continues and does the same thing. I think this should be fixed by using the Py_FileSystemDefaultEncoding instead when sys.stdin is invalid. ---------- components: Interpreter Core messages: 132678 nosy: ysj.ray priority: normal severity: normal status: open title: Setting sys.stdin to an invalid input stream causes interpreter run loop forever. type: crash versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 31 20:49:00 2011 From: report at bugs.python.org (R. David Murray) Date: Thu, 31 Mar 2011 18:49:00 +0000 Subject: [New-bugs-announce] [issue11731] Simplify email API via 'policy' objects In-Reply-To: <1301597340.87.0.239759427177.issue11731@psf.upfronthosting.co.za> Message-ID: <1301597340.87.0.239759427177.issue11731@psf.upfronthosting.co.za> New submission from R. David Murray : As part of the email6 design, the email-sig came up with the idea of simplifying the current email API by introducing the concept of "policy objects". A policy object is an object that hold various parameters and methods that can be used to control the behavior of the email package. Thus, instead of having 'maxheaderlen', '_mangle_from', 'unixfrom', linesep, etc, etc options, you have a policy object that holds settings for these options that are applicable to a particular domain. Thus an 'SMTP' policy would have a maxheaderlen of 76, a linesep of \r\n, and _mangle_from and unixfrom false, while mbox would have linesep \n and _mangle_from and unixfrom True. HTTP would be like SMTP, but with maxheaderlen 0 (unlimited). The policy is passed to the parser and/or the generator construtor to control how input is interpreted and how output is generated. By encapsulating the details into objects related to clearly defined problem domains, we make it much simpler to use the email package both within a domain and for translating messages between domains. Originally we saw the policy object as fundamental to the whole email6 design, but it has become clear that it is actually a relatively independent piece, and by itself much smaller than the parser and generator changes required for the full email6 implementation. Therefore I'm starting the email6 development with the policy object piece as a standalone proposal. I'd like to see this piece get reviewed and committed early in the process so I can use it as an underpinning for the further work. I've set up a feature repo for email6 at features/email6. I've pushed the framework (the policy object and its docs, with a selection of the options I intend to implement documented) and several integration updates (raise_on_defect, linesep, must_be_7bit). I thought I'd post this issue now, with the link to the repo, so people can give me early feedback if they wish. Ultimately I would like to deprecate the constructor arguments that are subsumed by the policy object settings. ---------- assignee: r.david.murray hgrepos: 15 messages: 132694 nosy: barry, r.david.murray priority: normal severity: normal stage: patch review status: open title: Simplify email API via 'policy' objects type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 31 22:53:31 2011 From: report at bugs.python.org (Brian Curtin) Date: Thu, 31 Mar 2011 20:53:31 +0000 Subject: [New-bugs-announce] [issue11732] Skip decorator for tests requiring manual intervention on Windows In-Reply-To: <1301604811.48.0.519862680053.issue11732@psf.upfronthosting.co.za> Message-ID: <1301604811.48.0.519862680053.issue11732@psf.upfronthosting.co.za> New submission from Brian Curtin : Attached is a patch which adds skip_unless_unattended, which ideally would be used with at least test_faulthandler when running on Windows. Running the tests on a Windows desktop results in the user having to click through Windows Error Reporting dialogs in order to continue. Build slaves disable or handle WER dialogs in order to continue running without manual intervention. The patch looks in the common registry keys [0,1] to see the status of WER and skips tests when it finds that WER is enabled and would require user intervention. We may want to additionally hook this up to a regrtest command line parameter to override the registry setting. Maybe there's a better name for the decorator - I'm not stuck with what I suggested. I consider build slaves as running in "unattended" mode as opposed to a human kicking off the tests. [0] http://www.spyany.com/program/registry-disable-error-reporting.htm [1] http://msdn.microsoft.com/en-us/library/bb513638(v=vs.85).aspx ---------- assignee: brian.curtin components: Tests, Windows files: unattended_decorator.diff keywords: patch messages: 132699 nosy: brian.curtin priority: normal severity: normal stage: patch review status: open title: Skip decorator for tests requiring manual intervention on Windows type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file21493/unattended_decorator.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Mar 31 23:40:38 2011 From: report at bugs.python.org (Ram Rachum) Date: Thu, 31 Mar 2011 21:40:38 +0000 Subject: [New-bugs-announce] [issue11733] Implement a `Counter.elements_count` method In-Reply-To: <1301607638.51.0.474843371118.issue11733@psf.upfronthosting.co.za> Message-ID: <1301607638.51.0.474843371118.issue11733@psf.upfronthosting.co.za> New submission from Ram Rachum : I suggest a `Counter.elements_count()` method should be added, that would give the same answer as `sum(counter.itervalues())`. ---------- components: Library (Lib) messages: 132708 nosy: cool-RR, rhettinger priority: normal severity: normal status: open type: feature request versions: Python 3.3 _______________________________________ Python tracker _______________________________________