From report at bugs.python.org Sat May 1 00:57:29 2010 From: report at bugs.python.org (Dmitry Chichkov) Date: Fri, 30 Apr 2010 22:57:29 +0000 Subject: [New-bugs-announce] [issue8583] Hardcoded namespace_separator in the cElementTree.XMLParser In-Reply-To: <1272668249.2.0.865128956478.issue8583@psf.upfronthosting.co.za> Message-ID: <1272668249.2.0.865128956478.issue8583@psf.upfronthosting.co.za> New submission from Dmitry Chichkov : The namespace_separator parameter is hard coded in the cElementTree.XMLParser class disallowing the option of ignoring XML Namespaces with cElementTree library. Here's the code example: from xml.etree.cElementTree import iterparse from StringIO import StringIO xml = """""" for event, elem in iterparse(StringIO(xml)): print event, elem It produces: end end In the current implementation local tags get forcibly concatenated with URIs often resulting in the ugly code on the user's side and performance degradation (at least due to extra concatenations and extra lengthy compare operations in the elements matching code). Internally cElementTree uses EXPAT parser, which is doing namespace processing only optionally, enabled by providing a value for namespace_separator argument. This argument is hard-coded in the cElementTree: self->parser = EXPAT(ParserCreate_MM)(encoding, &memory_handler, "}"); Well, attached is a patch exposing this parameter in the cElementTree.XMLParser() arguments. This parameter is optional and the default behavior should be unchanged. Here's the test code: import cElementTree x = """text""" parser = cElementTree.XMLParser() parser.feed(x) elem = parser.close() print elem parser = cElementTree.XMLParser(namespace_separator="}") parser.feed(x) elem = parser.close() print elem parser = cElementTree.XMLParser(namespace_separator=None) parser.feed(x) elem = parser.close() print elem The resulting output: ---------- components: Library (Lib) messages: 104671 nosy: dmtr priority: normal severity: normal status: open title: Hardcoded namespace_separator in the cElementTree.XMLParser type: performance versions: Python 2.5, Python 2.6, Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 01:16:26 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Fri, 30 Apr 2010 23:16:26 +0000 Subject: [New-bugs-announce] [issue8584] test_multiprocessing skips some tests In-Reply-To: <1272669386.78.0.641016378449.issue8584@psf.upfronthosting.co.za> Message-ID: <1272669386.78.0.641016378449.issue8584@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Some tests in test_multiprocessing (py3k) are skipped because they "require _ctypes", but I do have ctypes. Here are the skipped tests: test_array (test.test_multiprocessing.WithProcessesTestArray) ... skipped 'requires _ctypes' test_getobj_getlock_obj (test.test_multiprocessing.WithProcessesTestArray) ... skipped 'requires _ctypes' test_rawarray (test.test_multiprocessing.WithProcessesTestArray) ... skipped 'requires _ctypes' test_copy (test.test_multiprocessing.WithProcessesTestSharedCTypes) ... skipped 'requires _ctypes' test_sharedctypes (test.test_multiprocessing.WithProcessesTestSharedCTypes) ... skipped 'requires _ctypes' test_synchronize (test.test_multiprocessing.WithProcessesTestSharedCTypes) ... skipped 'requires _ctypes' test_getobj_getlock (test.test_multiprocessing.WithProcessesTestValue) ... skipped 'requires _ctypes' test_rawvalue (test.test_multiprocessing.WithProcessesTestValue) ... skipped 'requires _ctypes' test_value (test.test_multiprocessing.WithProcessesTestValue) ... skipped 'requires _ctypes' ---------- assignee: jnoller components: Tests messages: 104675 nosy: jnoller, pitrou priority: normal severity: normal stage: needs patch status: open title: test_multiprocessing skips some tests type: behavior versions: Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 03:15:36 2010 From: report at bugs.python.org (Alex) Date: Sat, 01 May 2010 01:15:36 +0000 Subject: [New-bugs-announce] [issue8585] zipimporter.find_module is untested In-Reply-To: <1272676536.77.0.29287206537.issue8585@psf.upfronthosting.co.za> Message-ID: <1272676536.77.0.29287206537.issue8585@psf.upfronthosting.co.za> New submission from Alex : There are no tests for zipimporter.find_module in the success case, only tests that it handles invalid inputs ok. I'll work up some tests for this tomorrow probably. ---------- components: Extension Modules messages: 104684 nosy: alex priority: normal severity: normal status: open title: zipimporter.find_module is untested _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 12:38:15 2010 From: report at bugs.python.org (Michael Foord) Date: Sat, 01 May 2010 10:38:15 +0000 Subject: [New-bugs-announce] [issue8586] test_imp.py test failures on Py3K Mac OS X In-Reply-To: <1272710295.84.0.106568163829.issue8586@psf.upfronthosting.co.za> Message-ID: <1272710295.84.0.106568163829.issue8586@psf.upfronthosting.co.za> New submission from Michael Foord : I get the following failure running test_imp on py3k, Mac OS X 10.6.3. ====================================================================== ERROR: test_package___file__ (__main__.PEP3147Tests) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_imp.py", line 303, in test_package___file__ support.forget('pep3147') File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/pep3147.pyc' ---------- messages: 104702 nosy: brett.cannon, michael.foord priority: normal severity: normal stage: unit test needed status: open title: test_imp.py test failures on Py3K Mac OS X type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 12:44:56 2010 From: report at bugs.python.org (Michael Foord) Date: Sat, 01 May 2010 10:44:56 +0000 Subject: [New-bugs-announce] [issue8587] test_import.py test failures on Py3K Mac OS X In-Reply-To: <1272710696.01.0.527513394318.issue8587@psf.upfronthosting.co.za> Message-ID: <1272710696.01.0.527513394318.issue8587@psf.upfronthosting.co.za> New submission from Michael Foord : I get the following failures with test_import on Mac OS X 10.6.3: ====================================================================== ERROR: test_import (test.test_import.ImportTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/compile/python-trunk3/Lib/test/test_import.py", line 93, in test_import test_with_extension(".py") File "/compile/python-trunk3/Lib/test/test_import.py", line 86, in test_with_extension forget(TESTFN) File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/@test_9343_tmp.pyc' ====================================================================== ERROR: test___cached__ (test.test_import.PycacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/compile/python-trunk3/Lib/test/test_import.py", line 504, in setUp self._clean() File "/compile/python-trunk3/Lib/test/test_import.py", line 498, in _clean forget(TESTFN) File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/@test_9343_tmp.pyc' ====================================================================== ERROR: test___cached___legacy_pyc (test.test_import.PycacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/compile/python-trunk3/Lib/test/test_import.py", line 504, in setUp self._clean() File "/compile/python-trunk3/Lib/test/test_import.py", line 498, in _clean forget(TESTFN) File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/@test_9343_tmp.pyc' ====================================================================== ERROR: test_import_pyc_path (test.test_import.PycacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/compile/python-trunk3/Lib/test/test_import.py", line 504, in setUp self._clean() File "/compile/python-trunk3/Lib/test/test_import.py", line 498, in _clean forget(TESTFN) File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/@test_9343_tmp.pyc' ====================================================================== ERROR: test_missing_source (test.test_import.PycacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/compile/python-trunk3/Lib/test/test_import.py", line 504, in setUp self._clean() File "/compile/python-trunk3/Lib/test/test_import.py", line 498, in _clean forget(TESTFN) File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/@test_9343_tmp.pyc' ====================================================================== ERROR: test_missing_source_legacy (test.test_import.PycacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/compile/python-trunk3/Lib/test/test_import.py", line 504, in setUp self._clean() File "/compile/python-trunk3/Lib/test/test_import.py", line 498, in _clean forget(TESTFN) File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/@test_9343_tmp.pyc' ====================================================================== ERROR: test_package___cached__ (test.test_import.PycacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/compile/python-trunk3/Lib/test/test_import.py", line 504, in setUp self._clean() File "/compile/python-trunk3/Lib/test/test_import.py", line 498, in _clean forget(TESTFN) File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/@test_9343_tmp.pyc' ====================================================================== ERROR: test_package___cached___from_pyc (test.test_import.PycacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/compile/python-trunk3/Lib/test/test_import.py", line 504, in setUp self._clean() File "/compile/python-trunk3/Lib/test/test_import.py", line 498, in _clean forget(TESTFN) File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/@test_9343_tmp.pyc' ====================================================================== ERROR: test_unwritable_directory (test.test_import.PycacheTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/compile/python-trunk3/Lib/test/test_import.py", line 504, in setUp self._clean() File "/compile/python-trunk3/Lib/test/test_import.py", line 498, in _clean forget(TESTFN) File "/compile/python-trunk3/Lib/test/support.py", line 227, in forget unlink(source + 'c') File "/compile/python-trunk3/Lib/test/support.py", line 186, in unlink os.unlink(filename) OSError: [Errno 20] Not a directory: '/dev/null/lib/python32.zip/@test_9343_tmp.pyc' ---------- messages: 104703 nosy: brett.cannon, michael.foord priority: normal severity: normal status: open title: test_import.py test failures on Py3K Mac OS X versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 12:56:49 2010 From: report at bugs.python.org (Michael Foord) Date: Sat, 01 May 2010 10:56:49 +0000 Subject: [New-bugs-announce] [issue8588] test_urllib2.py test failures on Py3K Mac OS X In-Reply-To: <1272711409.24.0.121208244389.issue8588@psf.upfronthosting.co.za> Message-ID: <1272711409.24.0.121208244389.issue8588@psf.upfronthosting.co.za> New submission from Michael Foord : Failures on py3k, Mac OS X 10.6.3. ====================================================================== ERROR: test_proxy_https (__main__.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_urllib2.py", line 1010, in test_proxy_https r = o.open(req) File "/compile/python-trunk3/Lib/urllib/request.py", line 349, in open response = self._open(req, data) File "/compile/python-trunk3/Lib/urllib/request.py", line 367, in _open '_open', req) File "/compile/python-trunk3/Lib/urllib/request.py", line 327, in _call_chain result = func(*args) File "/compile/python-trunk3/Lib/urllib/request.py", line 655, in meth(r, proxy, type)) File "/compile/python-trunk3/Lib/urllib/request.py", line 663, in proxy_open if req.host and proxy_bypass(req.host): File "/compile/python-trunk3/Lib/urllib/request.py", line 2214, in proxy_bypass return proxy_bypass_macosx_sysconf(host) File "/compile/python-trunk3/Lib/urllib/request.py", line 2183, in proxy_bypass_macosx_sysconf hostIP = ip2num(hostIP) File "/compile/python-trunk3/Lib/urllib/request.py", line 2161, in ip2num if len(parts) != 4: TypeError: object of type 'map' has no len() ====================================================================== ERROR: test_proxy_https_proxy_authorization (__main__.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_urllib2.py", line 1026, in test_proxy_https_proxy_authorization r = o.open(req) File "/compile/python-trunk3/Lib/urllib/request.py", line 349, in open response = self._open(req, data) File "/compile/python-trunk3/Lib/urllib/request.py", line 367, in _open '_open', req) File "/compile/python-trunk3/Lib/urllib/request.py", line 327, in _call_chain result = func(*args) File "/compile/python-trunk3/Lib/urllib/request.py", line 655, in meth(r, proxy, type)) File "/compile/python-trunk3/Lib/urllib/request.py", line 663, in proxy_open if req.host and proxy_bypass(req.host): File "/compile/python-trunk3/Lib/urllib/request.py", line 2214, in proxy_bypass return proxy_bypass_macosx_sysconf(host) File "/compile/python-trunk3/Lib/urllib/request.py", line 2183, in proxy_bypass_macosx_sysconf hostIP = ip2num(hostIP) File "/compile/python-trunk3/Lib/urllib/request.py", line 2161, in ip2num if len(parts) != 4: TypeError: object of type 'map' has no len() ---------- messages: 104708 nosy: michael.foord priority: normal severity: normal status: open title: test_urllib2.py test failures on Py3K Mac OS X versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 13:05:19 2010 From: report at bugs.python.org (Michael Foord) Date: Sat, 01 May 2010 11:05:19 +0000 Subject: [New-bugs-announce] [issue8589] test_warnings.CEnvironmentVariableTests.test_nonascii fails under an ascii terminal In-Reply-To: <1272711919.88.0.504421520723.issue8589@psf.upfronthosting.co.za> Message-ID: <1272711919.88.0.504421520723.issue8589@psf.upfronthosting.co.za> New submission from Michael Foord : If you run test_warnings.py under an ascii terminal (at least on Mac OS X) then test_warnings.CEnvironmentVariableTests.test_nonascii fails. Perhaps the test should be skipped? ====================================================================== FAIL: test_nonascii (__main__.CEnvironmentVariableTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_warnings.py", line 758, in test_main() File "Lib/test/test_warnings.py", line 753, in test_main PyEnvironmentVariableTests File "/compile/python-trunk3/Lib/test/support.py", line 1053, in run_unittest _run_suite(suite) File "/compile/python-trunk3/Lib/test/support.py", line 1027, in _run_suite result = runner.run(suite) File "/compile/python-trunk3/Lib/unittest/runner.py", line 158, in run result.printErrors() File "/compile/python-trunk3/Lib/unittest/runner.py", line 109, in printErrors self.printErrorList('FAIL', self.failures) File "/compile/python-trunk3/Lib/unittest/runner.py", line 116, in printErrorList self.stream.writeln("%s" % err) File "/compile/python-trunk3/Lib/unittest/runner.py", line 24, in writeln self.write(arg) UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 121: ordinal not in range(128) Looks like the traceback here actually comes from unittest trying to report the failure. ---------- messages: 104709 nosy: michael.foord priority: normal severity: normal status: open title: test_warnings.CEnvironmentVariableTests.test_nonascii fails under an ascii terminal versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 13:36:08 2010 From: report at bugs.python.org (Michael Foord) Date: Sat, 01 May 2010 11:36:08 +0000 Subject: [New-bugs-announce] [issue8590] test_httpservers.CGIHTTPServerTestCase failure on 3.1-maint Mac OS X In-Reply-To: <1272713768.56.0.588560261666.issue8590@psf.upfronthosting.co.za> Message-ID: <1272713768.56.0.588560261666.issue8590@psf.upfronthosting.co.za> New submission from Michael Foord : A failure in test_httpservers.py on 31-maint (not failing in py3k) on Mac OS X 10.6.3: test_post (__main__.CGIHTTPServerTestCase) ... Traceback (most recent call last): File "/private/var/folders/WD/WDk8J3uFE7OM9tRer5Oy4E+++TI/-Tmp-/tmpv_ZniR/cgi-bin/file2.py", line 2, in import cgi File "/compile/py-31-maint/Lib/cgi.py", line 34, in from operator import attrgetter ImportError: No module named operator [28226 refs] FAIL ====================================================================== FAIL: test_post (__main__.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_httpservers.py", line 379, in test_post AssertionError: b'' != b'1, python, 123456\n' Interesting to see the import error during the test. Running python and executing "import operator" works fine. ---------- messages: 104711 nosy: michael.foord priority: normal severity: normal stage: needs patch status: open title: test_httpservers.CGIHTTPServerTestCase failure on 3.1-maint Mac OS X versions: Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 17:22:11 2010 From: report at bugs.python.org (Dan Buch) Date: Sat, 01 May 2010 15:22:11 +0000 Subject: [New-bugs-announce] [issue8591] update mkpkg to latest coding standards In-Reply-To: <1272727331.63.0.427295643421.issue8591@psf.upfronthosting.co.za> Message-ID: <1272727331.63.0.427295643421.issue8591@psf.upfronthosting.co.za> New submission from Dan Buch : On first glance, `distutils2.mkpkg` does not reflect the latest and greatest in Python coding standards. I'd like to take a stab at PEP-(7|8)'ing the whole thing, although I know there are other issues open to add features to the module, so I don't want to cause unnecessary merge pains. Thoughts? ---------- assignee: tarek components: Distutils2 messages: 104726 nosy: meatballhat, tarek priority: normal severity: normal status: open title: update mkpkg to latest coding standards type: behavior 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 Sat May 1 20:04:35 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Sat, 01 May 2010 18:04:35 +0000 Subject: [New-bugs-announce] [issue8592] 'y' does not check for embedded NUL bytes In-Reply-To: <1272737075.21.0.258918022173.issue8592@psf.upfronthosting.co.za> Message-ID: <1272737075.21.0.258918022173.issue8592@psf.upfronthosting.co.za> New submission from Antoine Pitrou : The documentation for the 'y' format (PyArg_ParseTuple and friends) states that: ? The bytes object must not contain embedded NUL bytes; if it does, a TypeError exception is raised. ? But, reading Python/getargs.c, the strlen() check is actually missing in the code for 'y'. ---------- assignee: loewis components: Interpreter Core messages: 104734 nosy: loewis, pitrou priority: normal severity: normal stage: needs patch status: open title: 'y' does not check for embedded NUL bytes type: behavior versions: Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 20:25:02 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Sat, 01 May 2010 18:25:02 +0000 Subject: [New-bugs-announce] [issue8593] Improve c-api/arg.rst In-Reply-To: <1272738302.73.0.83180845409.issue8593@psf.upfronthosting.co.za> Message-ID: <1272738302.73.0.83180845409.issue8593@psf.upfronthosting.co.za> New submission from Antoine Pitrou : This patch fixes, reorders and improves c-api/arg.rst. I would even suggest to go further and single out a couple of "most useful" formats ('s', 'y*', 'i', 'l'...) so that people don't get lost in all the possibilities. ---------- assignee: docs at python components: Documentation files: argdoc.patch keywords: patch messages: 104736 nosy: docs at python, pitrou priority: normal severity: normal stage: patch review status: open title: Improve c-api/arg.rst versions: Python 3.1, Python 3.2 Added file: http://bugs.python.org/file17168/argdoc.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 1 22:33:02 2010 From: report at bugs.python.org (Giampaolo Rodola') Date: Sat, 01 May 2010 20:33:02 +0000 Subject: [New-bugs-announce] [issue8594] Add a "source_address" option to ftplib In-Reply-To: <1272745982.51.0.743868524528.issue8594@psf.upfronthosting.co.za> Message-ID: <1272745982.51.0.743868524528.issue8594@psf.upfronthosting.co.za> New submission from Giampaolo Rodola' : Similarly to issue 3972 the patch in attachment adds a new "source_address" option to FTP class to bind to a specific address when connecting to a remote FTP server. It must be noted that this gets done for both control and passive data connections (client connecting to server). The latter one solves issue 1661754. ---------- components: Library (Lib) files: ftplib_source_address.patch keywords: needs review, patch messages: 104749 nosy: giampaolo.rodola, pitrou, r.david.murray priority: normal severity: normal status: open title: Add a "source_address" option to ftplib type: feature request versions: Python 3.2 Added file: http://bugs.python.org/file17172/ftplib_source_address.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 2 04:54:44 2010 From: report at bugs.python.org (Julian) Date: Sun, 02 May 2010 02:54:44 +0000 Subject: [New-bugs-announce] [issue8595] Unexpected default timeout in http-client-related libraries In-Reply-To: <1272768884.43.0.28527344604.issue8595@psf.upfronthosting.co.za> Message-ID: <1272768884.43.0.28527344604.issue8595@psf.upfronthosting.co.za> New submission from Julian : Since Python 2.6, httplib has offered a timeout parameter for fetches. As the documentation explains, if this parameter is not provided, it uses the global default. What the document doesn't explain is httplib builds on top of the socket library. The socket library has a default timeout of None (i.e. forever). This may be an appropriate default for general sockets, but it is a poor default for httplib; typical http clients would use a timeout in the 2-10 second range. This problem is propagated up to urllib2, which sits on httplib, and further obscures that the default might be unsuitable. >From an inspection of the manuals, Python 3.0.1 suffers from the same problem except, the names have changed. urllib.response sits on http.client. I, for one, made a brutal mistake of assuming that the "global default" would be some reasonable default for fetching web pages; I didn't have any specific timeout in mind, and was happy for the library to take care of it. Several million successful http downloads later, my server application thread froze waiting forever when talking to a recalcitrant web-server. I imagine others have fallen for the same trap. While an ideal solution would be for httplib and http.client to use a more generally acceptable default, I can see it might be far too late to make such a change without breaking existing applications. Failing that, I would recommend that the documentation for httplib, urllib, urllib2, http.client and urllib.request (+ any other similar libraries sitting on socket? FTP, SMTP?) be changed to highlight that the default global timeout, sans deliberate override, is to wait a surprisingly long time. ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 104763 nosy: docs at python, oddthinking priority: normal severity: normal status: open title: Unexpected default timeout in http-client-related libraries type: behavior versions: Python 2.6, Python 2.7, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 2 06:04:10 2010 From: report at bugs.python.org (pvo) Date: Sun, 02 May 2010 04:04:10 +0000 Subject: [New-bugs-announce] [issue8596] crypt blowfish 'ignores' salt In-Reply-To: <1272773050.91.0.224780223694.issue8596@psf.upfronthosting.co.za> Message-ID: <1272773050.91.0.224780223694.issue8596@psf.upfronthosting.co.za> New submission from pvo : Blowfish crypt uses a 128 bit salt, not only the letters [./a-zA-Z0-9]. Despite the different salts, crypt ignores the salt and produces identical encrypted passwords. The problem occurs on FreeBSD 7.2 with Python 2.5.5 (r255:77872) and Python 2.6.4 (r264:7570) (both from the ports) python2.6 crypt_blf.py salt: '$2a$05$)O\x0e9\xb7\xb0\xc9\xd6)v.\xd3\x03\xea!\xc1$' $2a$05$t59ktwmm7.WpI...../5uuAazXv5nUvrWyN1EzMcL6/EQ0HrNyJwq salt: '$2a$05$\x1ak\x0c\xfbF\xf5\xdf\xb4\x99\xa6\x12\x81\x8d\xce\xea\x19$' $2a$05$COgstwmm........../5uuu63L/Vi1a/9FQpklC2BKZ74ai8JM2ey salt: '$2a$05$\x80:\x14\xbb\xc3R\x95\xb9\xcb\xf0#\x04\xbf"\xf7\xe9$' $2a$05$COgstwmm........../5uuu63L/Vi1a/9FQpklC2BKZ74ai8JM2ey salt: '$2a$05$i\x01 \x10\x13#\xe3\xdc\x80\x90[3\xd5@(\x96$' $2a$05$COgstwmm........../5uuu63L/Vi1a/9FQpklC2BKZ74ai8JM2ey salt: '$2a$05$<\xa8CY\xa6\x018\xe7\x0b}\x92\xd3\xa1L1\xfb$' $2a$05$COgstwmm........../5uuu63L/Vi1a/9FQpklC2BKZ74ai8JM2ey ---------- components: Library (Lib) files: crypt_blf.py messages: 104768 nosy: pvo priority: normal severity: normal status: open title: crypt blowfish 'ignores' salt type: behavior versions: Python 2.5, Python 2.6 Added file: http://bugs.python.org/file17181/crypt_blf.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 2 07:45:31 2010 From: report at bugs.python.org (Zooko O'Whielacronx) Date: Sun, 02 May 2010 05:45:31 +0000 Subject: [New-bugs-announce] [issue8597] build out-of-line asm on Windows In-Reply-To: <1272779131.33.0.179650713526.issue8597@psf.upfronthosting.co.za> Message-ID: <1272779131.33.0.179650713526.issue8597@psf.upfronthosting.co.za> New submission from Zooko O'Whielacronx : I maintain a Python package which comes with assembly optimizations -- http://tahoe-lafs.org/trac/pycryptopp . Someone was porting this package to Win64 today and discovered that distutils couldn't build it because the Microsoft compiler on Win64 doesn't allow in-line assembly and distutils doesn't know how to build out-of-line assembly (see also http://stackoverflow.com/questions/1664812/can-pythons-distutils-compile-s-assembly which says that there isn't a known way to do this). So the fellow who is porting pycryptopp to Win64 for me, Samuel Neves, found this hack in someone else's setup.py file: http://bitbucket.org/ambroff/greenlet/src/3ad4830aa109/setup.py We're probably going to adapt that hack to the pycryptopp setup.py file in order to work around this problem. But then another fellow named Josip Djolonga who is a GSoC student working on Distutils2 suggested that we could patch the compiler class to use assembly files and pass them to cl.exe. Samuel worked up a patch that does that and then he was able to build pycryptopp on Win64. Here is his patch attached as a file. Note that we will still need to do some work-around in the pycryptopp setup.py file in order to make pycryptopp buildable on Win64 with older versions of Python that do not have this fix. Any suggestions on the best way to do that would be welcome. Oops, I see that Samuel gave me the patch in traditional diff form instead of unified diff form. I hope you can accept it anyway since he has gone to bed. ---------- assignee: tarek components: Distutils files: patch.diff keywords: patch messages: 104770 nosy: tarek, zooko priority: normal severity: normal status: open title: build out-of-line asm on Windows type: behavior Added file: http://bugs.python.org/file17182/patch.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 2 11:58:08 2010 From: report at bugs.python.org (STINNER Victor) Date: Sun, 02 May 2010 09:58:08 +0000 Subject: [New-bugs-announce] [issue8598] test/support: don't use localhost as IPv6 host name In-Reply-To: <1272794288.96.0.106540212417.issue8598@psf.upfronthosting.co.za> Message-ID: <1272794288.96.0.106540212417.issue8598@psf.upfronthosting.co.za> New submission from STINNER Victor : TestIPv6Environment testcase of test_ftplib uses support.HOST as hostname, and HOST=localhost. Usually, localhost is the name of 127.0.0.1, but not always ::1. On Linux, the usual names for ::1 are ip6-localhost or ip6-loopback. My internet server provider DNS resolver does not always resolv "localhost" as ::1, sometimes it answer 3(NXDOMAIN). Anyway, the name should be resolved by the local DNS resolver, not depend on an external (ISP) DNS server. The simplest solution is to use "::1" instead of localhost ;-) ---------- components: Tests messages: 104778 nosy: haypo priority: normal severity: normal status: open title: test/support: don't use localhost as IPv6 host name versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 2 17:03:46 2010 From: report at bugs.python.org (Oren Held) Date: Sun, 02 May 2010 15:03:46 +0000 Subject: [New-bugs-announce] [issue8599] _execvpe should behaves inconsistently when PATH includes a filename In-Reply-To: <1272812626.29.0.414465850944.issue8599@psf.upfronthosting.co.za> Message-ID: <1272812626.29.0.414465850944.issue8599@psf.upfronthosting.co.za> New submission from Oren Held : A. Description When running os._execvpe with a relative pathname that does not exist, I'd expect to get ENOENT error. But there is an edge case in which Python throws ENOTDIR error - when the LAST element in PATH is a regular file (e.g. /bin/ls). This case is caused by a sysadmin mistake, but it may happen, as in the system on which I've encountered this bug. B. Explanation + How to reproduce: Consider the following case: PATH="/bin:/bin/ls" # Last part is a filename instead of a directory >>> import os; os.execvp("blabla", [""]) Throws: OSError: [Errno 20] Not a directory Now, consider a similar but differently-ordered PATH: PATH="/bin/ls:/bin" # *First* part is a filename instead of a directory >>> import os; os.execvp("blabla", [""]) Throws: OSError: [Errno 2] No such file or directory C. Why this behavior is not good: First, IMO there is a certain problem here - differently ordered PATH shouldn't throw different exception. In both cases the executable was not found in PATH, both cases are the same for this matter. Second, the unix shell (e.g. bash) faces the same issue, and behaves differently. It'll return "command not found" to stdout for both ENOENT and ENOTDIR cases, regardless of the element order in PATH. D. My recommendation I'd recommend throwing ENOENT even when ENODIR is thrown for some paths. I am not sure what's the least-evil way to do it, I've been thinking of the following patch, but it's not working because it depends on strerror. It also looks kinda ugly: --- os.py.old 2010-05-02 17:41:21.481909804 +0300 +++ os.py 2010-05-02 18:03:11.261872651 +0300 @@ -386,7 +386,7 @@ saved_tb = tb if saved_exc: raise error, saved_exc, saved_tb - raise error, e, tb + raise error, error(errno.ENOENT, os.strerror(errno.ENOENT)), tb # DOESNT WORK, no access to os.strerror from here # Change environ to automatically call putenv() if it exists try: ---------- components: Library (Lib) messages: 104788 nosy: Oren_Held priority: normal severity: normal status: open title: _execvpe should behaves inconsistently when PATH includes a filename type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 3 04:00:25 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 03 May 2010 02:00:25 +0000 Subject: [New-bugs-announce] [issue8600] test_gdb failures In-Reply-To: <1272852025.2.0.622667060005.issue8600@psf.upfronthosting.co.za> Message-ID: <1272852025.2.0.622667060005.issue8600@psf.upfronthosting.co.za> New submission from Antoine Pitrou : All test_gdb tests fail here with both trunk and py3k. The failure is always the same so I'm just quoting one of them below: ====================================================================== FAIL: test_basic_command (test.test_gdb.PyBtTests) Verify that the "py-bt" command works ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/py3k/__svn__/Lib/test/test_gdb.py", line 604, in test_basic_command cmds_after_breakpoint=['py-bt']) File "/home/antoine/py3k/__svn__/Lib/test/test_gdb.py", line 126, in get_stack_trace self.assertEquals(err, '') AssertionError: - warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. - warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. - warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. - warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. - warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. This is with: GNU gdb (GDB) 7.1-1mdv2010.1 (Mandriva Linux release 2010.1) Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-mandriva-linux-gnu". For bug reporting instructions, please see: . ---------- assignee: dmalcolm components: Tests messages: 104810 nosy: dmalcolm, pitrou priority: normal severity: normal stage: needs patch status: open title: test_gdb failures type: behavior versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 3 08:54:29 2010 From: report at bugs.python.org (Matt Wartell) Date: Mon, 03 May 2010 06:54:29 +0000 Subject: [New-bugs-announce] [issue8601] bz2.BZ2File should support "with" protocol per PEP 343 In-Reply-To: <1272869669.89.0.492897458524.issue8601@psf.upfronthosting.co.za> Message-ID: <1272869669.89.0.492897458524.issue8601@psf.upfronthosting.co.za> New submission from Matt Wartell : As the bz2.BZ2File object claims to be a file-like object it should conform to PEP 343 "The 'with' statement" by implementation of the __enter__ and __exit__ methods. boring, substantiating detail follows: $ uname -a Linux tallguy 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686 GNU/Linux $ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 >>> with bz2.BZ2File('test.bz2') as infile: ... pass ... AttributeError: 'bz2.BZ2File' object has no attribute '__exit__' >>> getattr(bz2.BZ2File, '__enter__') AttributeError: type object 'bz2.BZ2File' has no attribute '__enter__' >>> getattr(bz2.BZ2File, '__exit__') AttributeError: type object 'bz2.BZ2File' has no attribute '__exit__' $ dpkg -l python2.6 ii python2.6 2.6.5-1ubuntu6 An interactive hig... $ dpkg -L python2.6 | grep bz2.so /usr/lib/python2.6/lib-dynload/bz2.so ---------- components: Extension Modules messages: 104817 nosy: Matt.Wartell priority: normal severity: normal status: open title: bz2.BZ2File should support "with" protocol per PEP 343 type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 3 09:03:54 2010 From: report at bugs.python.org (Matt Wartell) Date: Mon, 03 May 2010 07:03:54 +0000 Subject: [New-bugs-announce] [issue8602] documentation of bz2 module mildly erroneous In-Reply-To: <1272870234.45.0.00658969889364.issue8602@psf.upfronthosting.co.za> Message-ID: <1272870234.45.0.00658969889364.issue8602@psf.upfronthosting.co.za> New submission from Matt Wartell : This is related to http://bugs.python.org/issue8601 "bz2.BZ2File should support "with" protocol per PEP 343" The documentation at http://docs.python.org/library/bz2.html states: "This module provides a comprehensive interface for the bz2 compression library. It implements a complete file interface,..." although bz2.BZ2File does not support the __enter__ and __exit__ methods so arguably doesn't implement the "complete file interface". If issue8601 is declined then the documentation should probably note this exception. ---------- assignee: docs at python components: Documentation messages: 104818 nosy: Matt.Wartell, docs at python priority: normal severity: normal status: open title: documentation of bz2 module mildly erroneous type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 3 10:56:26 2010 From: report at bugs.python.org (STINNER Victor) Date: Mon, 03 May 2010 08:56:26 +0000 Subject: [New-bugs-announce] [issue8603] Create a bytes version of os.environ and getenvb() In-Reply-To: <1272876986.0.0.50581565866.issue8603@psf.upfronthosting.co.za> Message-ID: <1272876986.0.0.50581565866.issue8603@psf.upfronthosting.co.za> New submission from STINNER Victor : As discussed in issue #8514, I propose a bytes version of os.envionb which would be synchronized with os.environ (which is possible thanks to surrogateescape error handler). I also propose a os.getenvb()->bytes function. I don't know yet if it's a good idea of not, but my patch accepts both bytes and str for os.environ(b).get() and os.getenv(b)(). antoine> In posixmodule.c, (...) if memory allocation of the bytes antoine> object fails, we should error out. I would require to change also the Windows version and the code specific to OS/2. Ok to do that, but after closing this issue ;-) I don't want to change to much things at the same time. ---------- components: Interpreter Core, Library (Lib), Unicode files: os_environb.patch keywords: patch messages: 104825 nosy: Arfrever, ezio.melotti, gregory.p.smith, haypo, lemburg, loewis, pitrou priority: normal severity: normal status: open title: Create a bytes version of os.environ and getenvb() versions: Python 3.2 Added file: http://bugs.python.org/file17191/os_environb.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 3 14:43:59 2010 From: report at bugs.python.org (Olemis Lang) Date: Mon, 03 May 2010 12:43:59 +0000 Subject: [New-bugs-announce] [issue8604] Alias for distutils.file_util.write_file in e.g. shutils In-Reply-To: <1272890639.26.0.821067455807.issue8604@psf.upfronthosting.co.za> Message-ID: <1272890639.26.0.821067455807.issue8604@psf.upfronthosting.co.za> New submission from Olemis Lang : Often I have the contents to be written in a file at a given path that I know as well. I recently tried to find a function in stdlib to do that and to my surprise this is what I found : - Such function exists - It's `distutils.file_util.write_file` IMO the last place where people'd look for such a function is inside `distutils` package. Besides I reviewed modules listed under `File and directory access` category in `Library Reference` and found nothing even similar. The idea is to provide a a similar function in `shutils` module ---------- assignee: tarek components: Distutils messages: 104833 nosy: olemis, tarek priority: normal severity: normal status: open title: Alias for distutils.file_util.write_file in e.g. shutils type: feature request versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 3 18:14:53 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 03 May 2010 16:14:53 +0000 Subject: [New-bugs-announce] [issue8605] gdb API issues In-Reply-To: <1272903293.59.0.249639149559.issue8605@psf.upfronthosting.co.za> Message-ID: <1272903293.59.0.249639149559.issue8605@psf.upfronthosting.co.za> New submission from Antoine Pitrou : I now get the following failures in test_gdb: ====================================================================== FAIL: test_pyup_command (test.test_gdb.StackNavigationTests) Verify that the "py-up" command works ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 599, in test_pyup_command $''') File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 163, in assertMultilineMatches msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 at 0x4508a0: file Objects/object.c, line 330.\n\nBreakpoint 1, PyObject_Print (op=42, fp=0x7ffff7535780, flags=1) at Objects/object.c:330\n330\t\treturn internal_print(op, fp, flags, 0);\n#7 (unable to read python frame information)\n' did not match '^.*\n#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \\(a=1, b=2, c=3\\)\n baz\\(a, b, c\\)\n$' ====================================================================== FAIL: test_up_at_top (test.test_gdb.StackNavigationTests) Verify handling of "py-up" at the top of the stack ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 613, in test_up_at_top cmds_after_breakpoint=['py-up'] * 4) File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 129, in get_stack_trace self.assertEquals(err, '') AssertionError: 'Error occurred in Python command.\nError occurred in Python command.\n' != '' ====================================================================== FAIL: test_up_then_down (test.test_gdb.StackNavigationTests) Verify "py-up" followed by "py-down" ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 628, in test_up_then_down $''') File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 163, in assertMultilineMatches msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 at 0x4508a0: file Objects/object.c, line 330.\n\nBreakpoint 1, PyObject_Print (op=42, fp=0x7ffff7535780, flags=1) at Objects/object.c:330\n330\t\treturn internal_print(op, fp, flags, 0);\n#7 (unable to read python frame information)\n#3 Frame 0x805700, for file /home/antoine/cpython/__svn__/Lib/test/gdb_sample.py, line 10, in baz (args=(1, 2, 3))\n print(42)\n' did not match '^.*\n#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \\(a=1, b=2, c=3\\)\n baz\\(a, b, c\\)\n#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 10, in baz \\(args=\\(1, 2, 3\\)\\)\n print\\(42\\)\n$' ====================================================================== FAIL: test_basic_command (test.test_gdb.PyBtTests) Verify that the "py-bt" command works ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 634, in test_basic_command cmds_after_breakpoint=['py-bt']) File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 129, in get_stack_trace self.assertEquals(err, '') AssertionError: 'Error occurred in Python command.\n' != '' ====================================================================== FAIL: test_print_after_up (test.test_gdb.PyPrintTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 658, in test_print_after_up r".*\nlocal 'c' = 3\nlocal 'b' = 2\nlocal 'a' = 1\n.*") File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 163, in assertMultilineMatches msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 at 0x4508a0: file Objects/object.c, line 330.\n\nBreakpoint 1, PyObject_Print (op=42, fp=0x7ffff7535780, flags=1) at Objects/object.c:330\n330\t\treturn internal_print(op, fp, flags, 0);\n#7 (unable to read python frame information)\nUnable to read information on python frame\nUnable to read information on python frame\nUnable to read information on python frame\n' did not match ".*\\nlocal 'c' = 3\\nlocal 'b' = 2\\nlocal 'a' = 1\\n.*" ====================================================================== FAIL: test_locals_after_up (test.test_gdb.PyLocalsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 684, in test_locals_after_up r".*\na = 1\nb = 2\nc = 3\n.*") File "/home/antoine/cpython/__svn__/Lib/test/test_gdb.py", line 163, in assertMultilineMatches msg='%r did not match %r' % (actual, pattern)) AssertionError: 'Breakpoint 1 at 0x4508a0: file Objects/object.c, line 330.\n\nBreakpoint 1, PyObject_Print (op=42, fp=0x7ffff7535780, flags=1) at Objects/object.c:330\n330\t\treturn internal_print(op, fp, flags, 0);\n#7 (unable to read python frame information)\nUnable to read information on python frame\n' did not match '.*\\na = 1\\nb = 2\\nc = 3\\n.*' ---------------------------------------------------------------------- Basically, it seems the Python API for gdb is a bit unstable or changing. Here is what manually trying the new commands produces: (gdb) py-bt #4 (unable to read python frame information) Traceback (most recent call last): File "/home/antoine/cpython/__svn__/python-gdb.py", line 1341, in invoke frame.print_summary() File "/home/antoine/cpython/__svn__/python-gdb.py", line 1195, in print_summary pyop = self.get_pyop() File "/home/antoine/cpython/__svn__/python-gdb.py", line 1168, in get_pyop return PyFrameObjectPtr.from_pyobject_ptr(f) File "/home/antoine/cpython/__svn__/python-gdb.py", line 349, in from_pyobject_ptr return cls(gdbval) TypeError: __init__() takes exactly 3 arguments (2 given) Error occurred in Python command. (gdb) py-up Traceback (most recent call last): File "/home/antoine/cpython/__svn__/python-gdb.py", line 1309, in invoke move_in_stack(move_up=True) File "/home/antoine/cpython/__svn__/python-gdb.py", line 1289, in move_in_stack iter_frame.print_summary() File "/home/antoine/cpython/__svn__/python-gdb.py", line 1195, in print_summary pyop = self.get_pyop() File "/home/antoine/cpython/__svn__/python-gdb.py", line 1168, in get_pyop return PyFrameObjectPtr.from_pyobject_ptr(f) File "/home/antoine/cpython/__svn__/python-gdb.py", line 349, in from_pyobject_ptr return cls(gdbval) TypeError: __init__() takes exactly 3 arguments (2 given) Error occurred in Python command. $ gdb --version GNU gdb (GDB) 7.1-1mdv2010.1 (Mandriva Linux release 2010.1) Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-mandriva-linux-gnu". For bug reporting instructions, please see: . ---------- assignee: dmalcolm components: Demos and Tools, Tests messages: 104852 nosy: dmalcolm, pitrou priority: normal severity: normal stage: needs patch status: open title: gdb API issues type: behavior versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 3 22:14:56 2010 From: report at bugs.python.org (=?utf-8?b?SmVzw7pzIENlYSBBdmnDs24=?=) Date: Mon, 03 May 2010 20:14:56 +0000 Subject: [New-bugs-announce] [issue8606] OSF is not supported anymore In-Reply-To: <1272917696.34.0.331615225862.issue8606@psf.upfronthosting.co.za> Message-ID: <1272917696.34.0.331615225862.issue8606@psf.upfronthosting.co.za> New submission from Jes?s Cea Avi?n : OSF* platform seems to be pretty dead. We are moving it to unsupported state, as documented in PEP11. The first phase is Python 3.2: Configure will fail win OSF* platforms. This configuration failure will be trvivially reversible. If nobody stands up to take care of OSF*, support will be removed in Python 3.3. Discussion: http://mail.python.org/pipermail/python-dev/2010-April/099718.html http://mail.python.org/pipermail/python-dev/2010-May/099899.html ---------- assignee: jcea messages: 104875 nosy: jcea priority: normal severity: normal stage: committed/rejected status: open title: OSF is not supported anymore versions: Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 02:25:09 2010 From: report at bugs.python.org (Robin Dunn) Date: Tue, 04 May 2010 00:25:09 +0000 Subject: [New-bugs-announce] [issue8607] OSX: duplicate -arch flags in CFLAGS breaks sysconfig In-Reply-To: <1272932709.85.0.263067973339.issue8607@psf.upfronthosting.co.za> Message-ID: <1272932709.85.0.263067973339.issue8607@psf.upfronthosting.co.za> New submission from Robin Dunn : In Python 2.7b1, building on OSX 10.6 with this configure command: export CC=gcc-4.0 export CXX=g++-4.0 export MACOSX_DEPLOYMENT_TARGET=10.4 ../configure \ --with-universal-archs=32-bit \ --enable-universalsdk=/Developer/SDKs/MacOSX10.4u.sdk \ --enable-framework Results in these lines in Makefile: BASECFLAGS= -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-common -dynamic CFLAGS= $(BASECFLAGS) -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk $(OPT) $(EXTRA_CFLAGS) Then later on in the build the sysconfig module uses the -arch flags in CFLAGS but is not able to find a match because of the extra set of values, and the build fails with this exception: Traceback (most recent call last): File "./../Lib/site.py", line 542, in main() File "./../Lib/site.py", line 521, in main addbuilddir() File "./../Lib/site.py", line 118, in addbuilddir s = "build/lib.%s-%.3s" % (get_platform(), sys.version) File "/projects/Python-2.7b1/Lib/sysconfig.py", line 646, in get_platform "Don't know machine value for archs=%r"%(archs,)) ValueError: Don't know machine value for archs=('i386', 'i386', 'ppc', 'ppc') make: *** [sharedmods] Error 1 ---------- components: Build messages: 104905 nosy: robind priority: normal severity: normal status: open title: OSX: duplicate -arch flags in CFLAGS breaks sysconfig type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 10:58:07 2010 From: report at bugs.python.org (Torsten Marek) Date: Tue, 04 May 2010 08:58:07 +0000 Subject: [New-bugs-announce] [issue8608] fix_import prefixes "." to already relative imports In-Reply-To: <1272963487.39.0.595362588306.issue8608@psf.upfronthosting.co.za> Message-ID: <1272963487.39.0.595362588306.issue8608@psf.upfronthosting.co.za> New submission from Torsten Marek : The fixer for absolute -> relative imports prefixes "." to already relative imports, i.e. from . import something will be converted into from .. import something if something.py exists. This of course will raise an exception on import or introduce subtle bugs if something exists in .. I've attached a patch against 2to3 head which addresses this problem. ---------- components: 2to3 (2.x to 3.0 conversion tool) files: fix-no-prefix-relative-import.diff keywords: patch messages: 104914 nosy: shlomme priority: normal severity: normal status: open title: fix_import prefixes "." to already relative imports type: behavior Added file: http://bugs.python.org/file17196/fix-no-prefix-relative-import.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 11:47:22 2010 From: report at bugs.python.org (Nico) Date: Tue, 04 May 2010 09:47:22 +0000 Subject: [New-bugs-announce] [issue8609] itertools: problem with nested groupby, list() In-Reply-To: <1272966442.26.0.576520629253.issue8609@psf.upfronthosting.co.za> Message-ID: <1272966442.26.0.576520629253.issue8609@psf.upfronthosting.co.za> New submission from Nico : Hi, I ran into a bit of an unexpected issue here with itertools. I need to say that I discovered itertools only recently, and that maybe my way of approaching the problem is "not what I want to do". If you think this may be the case, please let me know. Anyway, the problem is the following: I have a list of dictionaries, something like [ { "a": 1, "b": 1, "c": 3 }, { "a": 1, "b": 1, "c": 4 }, ... ] and I'd like to iterate through all items with, e.g., "a":1. What I do is sort and then groupby, my_list.sort( key=operator.itemgetter('a') ) my_list_grouped = itertools.groupby( my_list, operator.itemgetter('a') ) and then just very simply iterate over my_list_grouped, for my_item in my_list_grouped: # do something with my_item[0], my_item[1] Now, inside this loop I'd like to again iterate over all items with the same 'b'-value -- no problem, just do the above inside the loop: for my_item in my_list_grouped: # group by keyword "b" my_list2 = list( my_item[1] ) my_list2.sort( key=operator.itemgetter('b') ) my_list_grouped = itertools.groupby( my_list2, operator.itemgetter('b') ) for e in my_list_grouped: # do something with e[0], e[1] That seems to work all right. Now, the problem occurs when this all is wrapped into an outer loop, such as for k in [ 'first pass', 'second pass' ]: for my_item in my_list_grouped: # bla, the above To be able to iterate more than once through my_list_grouped, I have to convert it into a list first, so outside all loops, I go like my_list.sort( key=operator.itemgetter('a') ) my_list_grouped = itertools.groupby( my_list, operator.itemgetter('a') ) my_list_grouped = list( my_list_grouped ) This, however, makes it impossible to do the inner sort and groupby-operation; you just get the very first element, and that's it. An example file is attached. Is there anything that I can do to debug? Cheers, Nico ---------- components: None files: iterator-test.py messages: 104917 nosy: nicki priority: normal severity: normal status: open title: itertools: problem with nested groupby, list() versions: Python 2.6 Added file: http://bugs.python.org/file17198/iterator-test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 13:58:58 2010 From: report at bugs.python.org (STINNER Victor) Date: Tue, 04 May 2010 11:58:58 +0000 Subject: [New-bugs-announce] [issue8610] Python3/POSIX: errors if file system encoding is None In-Reply-To: <1272974338.7.0.0380929022736.issue8610@psf.upfronthosting.co.za> Message-ID: <1272974338.7.0.0380929022736.issue8610@psf.upfronthosting.co.za> New submission from STINNER Victor : On POSIX (but not on Mac OS X), Python3 calls get_codeset() to get the file system encoding. If this function fails, sys.getfilesystemencoding() returns None. PyUnicode_DecodeFSDefaultAndSize() fallbacks to utf-8 whereas subprocess fail: ... File "/home/SHARE/SVN/py3k/Lib/subprocess.py", line 670, in __init__ restore_signals, start_new_session) File "/home/SHARE/SVN/py3k/Lib/subprocess.py", line 1101, in _execute_child executable_list = (fs_encode(executable),) File "/home/SHARE/SVN/py3k/Lib/subprocess.py", line 1088, in fs_encode return s.encode(fs_encoding, 'surrogateescape') TypeError: encode() argument 1 must be string, not None We have two choices: raise a fatal error if get_codeset() failed, or fallback to utf-8. On Windows and Mac OS X, get_codeset() shouldn't be called because the result is just dropped. We should call _PyCodec_Lookup(Py_FileSystemDefaultEncoding) instead to ensure that the file system encoding can be loaded. ---------- components: Interpreter Core, Unicode messages: 104924 nosy: haypo priority: normal severity: normal status: open title: Python3/POSIX: errors if file system encoding is None versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 15:30:50 2010 From: report at bugs.python.org (STINNER Victor) Date: Tue, 04 May 2010 13:30:50 +0000 Subject: [New-bugs-announce] [issue8611] Python3 doesn't support locale different than utf8 and an non-ASCII path (POSIX) In-Reply-To: <1272979850.31.0.0455265952928.issue8611@psf.upfronthosting.co.za> Message-ID: <1272979850.31.0.0455265952928.issue8611@psf.upfronthosting.co.za> New submission from STINNER Victor : Python3 is unable to start (bootstrap failure) on a POSIX system if the locale encoding is different than utf8 and the Python path (standard library path where the encoding module is stored) contains a non-ASCII character. (Windows and Mac OS X are not affected by this issue because the file system encoding is hardcoded.) - Py_FileSystemDefaultEncoding == NULL - calculate_path(): sys.path is filled with directory names decoded with the locale encoding - find_module() encodes each path using PyUnicode_AsEncodedString(..., Py_FileSystemDefaultEncoding, NULL): use "utf-8" encoding because Py_FileSystemDefaultEncoding is NULL => error because the path is not encoded and decoded with the same encoding We cannot encodes a path with the locale encoding because we need find_module() to load the encoding codec, and loading the codec needs find_module()... (bootstrap error :-)) We should decodes the path using a fixed encoding (eg. ASCII or utf-8), use the same encoding to encodes paths in find_module(), and then reencode paths of all objects storing filenames: - sys.path list items - sys.modules dict keys - sys.modules values: each module have __file__ and/or __path__ attributes - all code objects (co_filename) - (maybe some other?) The error occurs in an early stage of Py_InitializeEx(), so the object list is limited and we control this list (eg. site is not loaded yet). Related issues: - #8610: "Python3/POSIX: errors if file system encoding is None" - #8242: "Improve support of PEP 383 (surrogates) in Python3: meta-issue" ---------- components: Interpreter Core, Unicode messages: 104932 nosy: haypo priority: normal severity: normal status: open title: Python3 doesn't support locale different than utf8 and an non-ASCII path (POSIX) versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 16:17:15 2010 From: report at bugs.python.org (Zaar Hai) Date: Tue, 04 May 2010 14:17:15 +0000 Subject: [New-bugs-announce] [issue8612] multiprocessing Queue module failes to send INIConfig objects In-Reply-To: <1272982635.61.0.958839100699.issue8612@psf.upfronthosting.co.za> Message-ID: <1272982635.61.0.958839100699.issue8612@psf.upfronthosting.co.za> New submission from Zaar Hai : I'm using INIConfig class from iniparse module(http://code.google.com/p/iniparse). I've tried to use multiprocessing.Queue to propagate configuration changes between the processes. However, INIConfig instances have troubles being pushed through Queue objects. I do not know whether this is a Queue or iniparse bug, so I've opened issued on both projects(http://code.google.com/p/iniparse/issues/detail?id=20). Even this is not a Queue bug, it would be great to have some advice on how this problem may be solved. Thanks. Problem description: Running this simple code: from multiprocessing import Process from multiprocessing import Queue from iniparse import INIConfig import time def worker(queue): config = queue.get() print config.sec1.var1 def main(): config = INIConfig(open("./my.conf")) queue = Queue() p = Process(target=worker, args=(queue,)) p.start() queue.put(config) time.sleep(1) if __name__ == "__main__": main() Raised this error: Traceback (most recent call last): File "/usr/lib/pymodules/python2.5/multiprocessing/queues.py", line 242, in _feed send(obj) TypeError: 'Undefined' object is not callable The contents of my.conf are like this: [sec1] var1 = test1 var2 = test2 I'm using python 2.5.2 on Debian Lenny amd64 with python-multiprocessing package (http://packages.debian.org/squeeze/python-multiprocessing). ---------- components: None messages: 104942 nosy: Zaar.Hai priority: normal severity: normal status: open title: multiprocessing Queue module failes to send INIConfig objects versions: Python 2.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 16:54:01 2010 From: report at bugs.python.org (Mark Dickinson) Date: Tue, 04 May 2010 14:54:01 +0000 Subject: [New-bugs-announce] [issue8613] Decimal module flags undetermined when a signal is trapped. In-Reply-To: <1272984841.0.0.906657038884.issue8613@psf.upfronthosting.co.za> Message-ID: <1272984841.0.0.906657038884.issue8613@psf.upfronthosting.co.za> New submission from Mark Dickinson : In an effort to keep to one issue per tracker item, I'm pulling this issue out of the comments on issue 8567. Issue: if a Decimal operation raises several signals, and one or more of those signals is trapped, how should that operation affect flags? Decimal currently ends up setting some or none of those flags, depending on exactly which signal is trapped first. Stefan points out that cdecimal and decnumber both treat all operations as atomic: *all* flags relevant to that operation are set, and only then are any traps acted on. The specification isn't clear on this. At http://speleotrove.com/decimal/daexcep.html it says: """The value of the trap-enabler for each signal in the context determines whether an operation is completed after the condition is detected or whether the condition is trapped and hence not necessarily completed (see IEEE 754 ?7 and ?8).""" There's also this (thanks, Stefan), in http://speleotrove.com/decimal/damodel.html """For each of the signals, the corresponding flag is set to 1 when the signal occurs. It is only reset to 0 by explicit user action.""" However, this doesn't really help: do we regard signals as being raised one-by-one during (or at the end of) an operation, or all at once? And should a trap take effect the moment a signal is handled, or should all traps be delayed until the end of an operation? ---------- assignee: mark.dickinson messages: 104945 nosy: facundobatista, mark.dickinson, rhettinger, skrah priority: normal severity: normal stage: unit test needed status: open title: Decimal module flags undetermined when a signal is trapped. type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 20:18:04 2010 From: report at bugs.python.org (Mark Dickinson) Date: Tue, 04 May 2010 18:18:04 +0000 Subject: [New-bugs-announce] [issue8614] test_gzip fails on OS X In-Reply-To: <1272997084.97.0.485599300068.issue8614@psf.upfronthosting.co.za> Message-ID: <1272997084.97.0.485599300068.issue8614@psf.upfronthosting.co.za> New submission from Mark Dickinson : test_buffered_reader test_gzip is failing for me since r80720, on trunk on OS X 10.6.3: ====================================================================== ERROR: test_buffered_reader (__main__.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_gzip.py", line 91, in test_buffered_reader lines = [line for line in r] File "/Users/dickinsm/python/svn/trunk/Lib/gzip.py", line 365, in flush self.fileobj.flush() IOError: [Errno 9] Bad file descriptor ---------------------------------------------------------------------- Ran 16 tests in 1.258s FAILED (errors=1) Traceback (most recent call last): File "Lib/test/test_gzip.py", line 271, in test_main(verbose=True) File "Lib/test/test_gzip.py", line 268, in test_main test_support.run_unittest(TestGzip) File "/Users/dickinsm/python/svn/trunk/Lib/test/test_support.py", line 1038, in run_unittest _run_suite(suite) File "/Users/dickinsm/python/svn/trunk/Lib/test/test_support.py", line 1021, in _run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File "Lib/test/test_gzip.py", line 91, in test_buffered_reader lines = [line for line in r] File "/Users/dickinsm/python/svn/trunk/Lib/gzip.py", line 365, in flush self.fileobj.flush() IOError: [Errno 9] Bad file descriptor Here's a minimal Python script that produces the failure: import gzip import io f = gzip.GzipFile('hamster', 'wb') f.write("some data") f.close() f = gzip.GzipFile('hamster', 'rb') r = io.BufferedReader(f) lines = [line for line in r] r.close() This gives the following output: Traceback (most recent call last): File "test_gzip.py", line 11, in r.close() File "/Users/dickinsm/python/svn/trunk/Lib/gzip.py", line 365, in flush self.fileobj.flush() IOError: [Errno 9] Bad file descriptor [20213 refs] ---------- components: Library (Lib) messages: 104965 nosy: mark.dickinson, pitrou priority: normal severity: normal status: open title: test_gzip fails on OS X versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 23:14:59 2010 From: report at bugs.python.org (Gregor Lingl) Date: Tue, 04 May 2010 21:14:59 +0000 Subject: [New-bugs-announce] [issue8615] turtle.py - backport of 3.1 features In-Reply-To: <1273007699.22.0.180641297375.issue8615@psf.upfronthosting.co.za> Message-ID: <1273007699.22.0.180641297375.issue8615@psf.upfronthosting.co.za> New submission from Gregor Lingl : The file submitted, turtle.py, essentially contains a backport of the new features, which were added to the turtle module with Python 3.1. Otherwise this versions is 100% compatible with the turtle module of Python 2.6. So scripts written with Python 3.1's turtle module will run unchanged with identical behaviour under Python 2.7. The same do - of course - scripts written with Python 2.6's version of the turtle module. Remark: There were also some enhancements and cleanup in the code for Python 3.1, which I also did backport to this version. Inclusion of this version of turtle.py into Python 2.7 will need an update of the docs (essentially to those of Python 3.1). I'll be able to submit an appropriate *.rst file within a week or so. ---------- components: Library (Lib) files: turtle.py messages: 104975 nosy: georg.brandl, gregorlingl, loewis priority: normal severity: normal status: open title: turtle.py - backport of 3.1 features type: feature request versions: Python 2.7 Added file: http://bugs.python.org/file17206/turtle.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 4 23:32:10 2010 From: report at bugs.python.org (Gregor Lingl) Date: Tue, 04 May 2010 21:32:10 +0000 Subject: [New-bugs-announce] [issue8616] Changes to content of Demo/turtle In-Reply-To: <1273008730.8.0.105084103886.issue8616@psf.upfronthosting.co.za> Message-ID: <1273008730.8.0.105084103886.issue8616@psf.upfronthosting.co.za> New submission from Gregor Lingl : turtleDemo.py contains a string referring to the outdated xturtle. Should be replaced according to the submitted diff. Moreover I'd like to propose to add to demo-scripts to the Demo-directory, namely tdemo_nim.py and tdemo_round_dance.py as well as to replace the old tdemo_paint.py by the enhanced version tdemo_scribble.py. I'll add those files subsequently. Regards, Gregor ---------- components: Demos and Tools files: turtleDemo_27b1_to_turtleDemo.diff keywords: patch messages: 104977 nosy: georg.brandl, gregorlingl, loewis priority: normal severity: normal status: open title: Changes to content of Demo/turtle versions: Python 2.7 Added file: http://bugs.python.org/file17208/turtleDemo_27b1_to_turtleDemo.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 01:51:20 2010 From: report at bugs.python.org (Dave Abrahams) Date: Tue, 04 May 2010 23:51:20 +0000 Subject: [New-bugs-announce] [issue8617] Non-existent variables documented In-Reply-To: <1273017080.78.0.24275979751.issue8617@psf.upfronthosting.co.za> Message-ID: <1273017080.78.0.24275979751.issue8617@psf.upfronthosting.co.za> New submission from Dave Abrahams : http://docs.python.org/library/site.html#module-site mentions two variables that don't appear in my Python 2.6.5 installation's site module: PYTHONNOUSERSITE New in version 2.6. PYTHONUSERBASE New in version 2.6. ---------- assignee: docs at python components: Documentation messages: 104985 nosy: dabrahams, docs at python priority: normal severity: normal status: open title: Non-existent variables documented versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 02:23:20 2010 From: report at bugs.python.org (Brian Curtin) Date: Wed, 05 May 2010 00:23:20 +0000 Subject: [New-bugs-announce] [issue8618] test_winsound failing on Windows Server 2008 In-Reply-To: <1273019000.91.0.843326391671.issue8618@psf.upfronthosting.co.za> Message-ID: <1273019000.91.0.843326391671.issue8618@psf.upfronthosting.co.za> New submission from Brian Curtin : Some of the test_alias_* functions in test_winsound are failing with a RuntimeError "Failed to play sound" when run on Server 2008 R2. The sound from each test exists in the registry so the test doesn't end up getting skipped. I'm guessing there is some missing privilege, so it's possible we should additionally skip based on that. ---------- assignee: brian.curtin components: Tests, Windows messages: 104988 nosy: brian.curtin priority: normal severity: normal stage: needs patch status: open title: test_winsound failing on Windows Server 2008 type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 05:43:03 2010 From: report at bugs.python.org (Sriram Thaiyar) Date: Wed, 05 May 2010 03:43:03 +0000 Subject: [New-bugs-announce] [issue8619] Doc bug for urllib.request._urlopener in Python 3.1+ In-Reply-To: <1273030983.81.0.163471104029.issue8619@psf.upfronthosting.co.za> Message-ID: <1273030983.81.0.163471104029.issue8619@psf.upfronthosting.co.za> New submission from Sriram Thaiyar : http://docs.python.org/dev/py3k/library/urllib.request.html#urllib.request._urlopener [in the body] urllib._urlopener should be urllib.request._urlopener ---------- assignee: docs at python components: Documentation messages: 104998 nosy: Sriram.Thaiyar, docs at python priority: normal severity: normal status: open title: Doc bug for urllib.request._urlopener in Python 3.1+ versions: Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 13:35:55 2010 From: report at bugs.python.org (Mattelaer) Date: Wed, 05 May 2010 11:35:55 +0000 Subject: [New-bugs-announce] [issue8620] wrong truncation of line in Cmd.cmd In-Reply-To: <1273059355.74.0.713627995995.issue8620@psf.upfronthosting.co.za> Message-ID: <1273059355.74.0.713627995995.issue8620@psf.upfronthosting.co.za> New submission from Mattelaer : When using the Cmd module on a file. it happens that the last line is truncated from the last caracther. The problem is simply that it can happen that the last line doesn't finish by '\n' charcacter. In consequence the line which is suppose to suppress the '\n' suppress another character. Cheers, Olivier ---------- components: None messages: 105012 nosy: omatt priority: normal severity: normal status: open title: wrong truncation of line in Cmd.cmd type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 14:00:58 2010 From: report at bugs.python.org (yig) Date: Wed, 05 May 2010 12:00:58 +0000 Subject: [New-bugs-announce] [issue8621] Mac OS X In-Reply-To: <1273060858.71.0.68463359774.issue8621@psf.upfronthosting.co.za> Message-ID: <1273060858.71.0.68463359774.issue8621@psf.upfronthosting.co.za> New submission from yig : Calling uuid.uuid4() while using the multiprocessing module leads to the same exact UUIDs being generating in each process. It is an artifact resulting from the built-in uuid_generate_random() of my underlying platform, Mac OS X 10.6.3. A Linux machine I have does not exhibit this problem. I have tested it with both Python 2.5 and 2.6. ---------- assignee: ronaldoussoren components: Macintosh files: multiprocessing_uuid.py messages: 105013 nosy: ronaldoussoren, yig priority: normal severity: normal status: open title: Mac OS X type: behavior versions: Python 2.5, Python 2.6 Added file: http://bugs.python.org/file17216/multiprocessing_uuid.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 15:55:25 2010 From: report at bugs.python.org (Marc-Andre Lemburg) Date: Wed, 05 May 2010 13:55:25 +0000 Subject: [New-bugs-announce] [issue8622] Add PYTHONFSENCODING environment variable In-Reply-To: <1273067725.01.0.392024082724.issue8622@psf.upfronthosting.co.za> Message-ID: <1273067725.01.0.392024082724.issue8622@psf.upfronthosting.co.za> New submission from Marc-Andre Lemburg : As discussed on issue8610, we need a way to override the automatic detection of the file system encoding - for much the same reasons we also do for the I/O encoding: the detection mechanism isn't fail-safe. We should add a new environment variable with the same functionality as PYTHONIOENCODING: PYTHONFSENCODING: Encoding[:errors] used for file system. ---------- components: Interpreter Core messages: 105030 nosy: haypo, lemburg priority: normal severity: normal status: open title: Add PYTHONFSENCODING environment variable versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 15:57:36 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 05 May 2010 13:57:36 +0000 Subject: [New-bugs-announce] [issue8623] Aliasing warnings in socketmodule.c In-Reply-To: <1273067856.13.0.617035378143.issue8623@psf.upfronthosting.co.za> Message-ID: <1273067856.13.0.617035378143.issue8623@psf.upfronthosting.co.za> New submission from Antoine Pitrou : This is on py3k, with gcc 4.4.3: /home/antoine/py3k/__svn__/Modules/socketmodule.c: In function 'socket_gethostbyaddr': /home/antoine/py3k/__svn__/Modules/socketmodule.c:3238: warning: dereferencing pointer 'sa' does break strict-aliasing rules /home/antoine/py3k/__svn__/Modules/socketmodule.c:3208: note: initialized from here /home/antoine/py3k/__svn__/Modules/socketmodule.c: In function 'socket_gethostbyname_ex': /home/antoine/py3k/__svn__/Modules/socketmodule.c:3183: warning: dereferencing pointer 'sa' does break strict-aliasing rules /home/antoine/py3k/__svn__/Modules/socketmodule.c:3181: note: initialized from here ---------- components: Extension Modules messages: 105033 nosy: brett.cannon, pitrou priority: normal severity: normal stage: needs patch status: open title: Aliasing warnings in socketmodule.c type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 15:58:54 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 05 May 2010 13:58:54 +0000 Subject: [New-bugs-announce] [issue8624] Aliasing warnings in multiprocessing.c In-Reply-To: <1273067934.7.0.859212268784.issue8624@psf.upfronthosting.co.za> Message-ID: <1273067934.7.0.859212268784.issue8624@psf.upfronthosting.co.za> New submission from Antoine Pitrou : This is on py3k, with gcc 4.4.3: /home/antoine/py3k/__svn__/Modules/_multiprocessing/multiprocessing.c: In function 'multiprocessing_sendfd': /home/antoine/py3k/__svn__/Modules/_multiprocessing/multiprocessing.c:125: warning: dereferencing type-punned pointer will break strict-aliasing rules /home/antoine/py3k/__svn__/Modules/_multiprocessing/multiprocessing.c: In function 'multiprocessing_recvfd': /home/antoine/py3k/__svn__/Modules/_multiprocessing/multiprocessing.c:168: warning: dereferencing type-punned pointer will break strict-aliasing rules ---------- assignee: jnoller components: Extension Modules messages: 105034 nosy: brett.cannon, jnoller, pitrou priority: normal severity: normal stage: needs patch status: open title: Aliasing warnings in multiprocessing.c type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 16:03:49 2010 From: report at bugs.python.org (Mark Dickinson) Date: Wed, 05 May 2010 14:03:49 +0000 Subject: [New-bugs-announce] [issue8625] --with-pydebug builds now include -O2 by default In-Reply-To: <1273068229.98.0.576087123255.issue8625@psf.upfronthosting.co.za> Message-ID: <1273068229.98.0.576087123255.issue8625@psf.upfronthosting.co.za> New submission from Mark Dickinson : When doing a debug build of Python with gcc, without any previous setting of CFLAGS, the '-O2' flag is now automatically included. This behaviour started in r79218. It would be nice to restore the original behaviour, if possible, since the optimization causes difficulties when debugging. One solution would be to add '-O0' to OPT for debug builds (on gcc), as in the attached patch. You then get compiler flags including: "-g -O2 -g -O0" which is somewhat ugly, but the -O0 overrides the -O2 (I think). Does this seem like a reasonable solution? ---------- components: Build files: no_debug_optimization.patch keywords: patch messages: 105035 nosy: haypo, lemburg, mark.dickinson, pitrou priority: normal severity: normal status: open title: --with-pydebug builds now include -O2 by default type: behavior versions: Python 2.7, Python 3.2 Added file: http://bugs.python.org/file17219/no_debug_optimization.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 16:28:11 2010 From: report at bugs.python.org (Dave Abrahams) Date: Wed, 05 May 2010 14:28:11 +0000 Subject: [New-bugs-announce] [issue8626] TypeError: rsplit() takes no keyword arguments In-Reply-To: <1273069691.09.0.629182954336.issue8626@psf.upfronthosting.co.za> Message-ID: <1273069691.09.0.629182954336.issue8626@psf.upfronthosting.co.za> New submission from Dave Abrahams : Based on the rsplit documentation, I'd expect 'foo bar'.rsplit(maxsplit=1) to work. This is probably a much bigger problem than just rsplit, i.e. I doubt there is a policy about whether documented parameter names need to be usable as keywords, and if not, how one finds out which keywords are supported. ---------- messages: 105040 nosy: dabrahams priority: normal severity: normal status: open title: TypeError: rsplit() takes no keyword arguments _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 16:30:56 2010 From: report at bugs.python.org (Mark Dickinson) Date: Wed, 05 May 2010 14:30:56 +0000 Subject: [New-bugs-announce] [issue8627] Unchecked PyErr_WarnPy3k return value in Objects/typeobject.c In-Reply-To: <1273069856.93.0.435136167669.issue8627@psf.upfronthosting.co.za> Message-ID: <1273069856.93.0.435136167669.issue8627@psf.upfronthosting.co.za> New submission from Mark Dickinson : Lines 3884 and 3890 of Objects/typeobject.c (trunk, r80782), which check for a subclass overriding __eq__ (or __cmp__) but not __hash__, call PyErr_WarnPy3k but don't check the return value. [This was reported when compiling Python with clang.] This can lead to an "XXX undetected error", if the warning actually raised an exception: newton:trunk dickinsm$ ./python.exe -3 Python 2.7b1+ (trunk:80783, May 5 2010, 15:25:42) [GCC 4.2.1 (Apple Inc. build 5659)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import warnings [35022 refs] >>> warnings.filterwarnings("error") [35046 refs] >>> class A(object): ... def __eq__(self, other): ... return False ... XXX undetected error Traceback (most recent call last): File "", line 1, in DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x [35139 refs] Nick, I think this came from a checkin of yours: r65642, related to issue 2235. Any suggestions about how to fix it? It's a bit tricky, since the function the check occurs in (inherit_slots) has return type 'void'. Is it okay if I change inherit_slots to return an int here? If so, I'll produce a patch. Also, can we remove the check related to __hash__ and __cmp__? With __cmp__ gone in 3.1, and 3.0 considered defunct, I don't think it's relevant any more. ---------- messages: 105041 nosy: mark.dickinson, ncoghlan priority: normal severity: normal status: open title: Unchecked PyErr_WarnPy3k return value in Objects/typeobject.c versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 17:11:51 2010 From: report at bugs.python.org (Daniel Urban) Date: Wed, 05 May 2010 15:11:51 +0000 Subject: [New-bugs-announce] [issue8628] Incorrect numbers.Complex.imag documentation In-Reply-To: <1273072311.36.0.918807999354.issue8628@psf.upfronthosting.co.za> Message-ID: <1273072311.36.0.918807999354.issue8628@psf.upfronthosting.co.za> New submission from Daniel Urban : The current documentation of the imag abstract property of numbers.Complex is this: "Abstract. Retrieves the Real component of this number." Of course the imag attribute is the imaginary component, not the real. ---------- assignee: docs at python components: Documentation messages: 105048 nosy: docs at python, durban priority: normal severity: normal status: open title: Incorrect numbers.Complex.imag documentation versions: Python 2.6, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 18:20:39 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Wed, 05 May 2010 16:20:39 +0000 Subject: [New-bugs-announce] [issue8629] Fix test_ssl failures under 2.6/3.1 with OpenSSL 1.0.0 In-Reply-To: <1273076439.97.0.920291482414.issue8629@psf.upfronthosting.co.za> Message-ID: <1273076439.97.0.920291482414.issue8629@psf.upfronthosting.co.za> New submission from Antoine Pitrou : OpenSSL 1.0.0 needs to change the cipher list for some test_ssl tests to succeed, but the cipher list can't be changed in 2.6/3.1 (maintenance branches). The solution is to skip these tests with the newer OpenSSLs. This patch uses the "openssl" executable to fetch the OpenSSL version, but we could instead backport OPENSSL_VERSION_* from trunk, at least as undocumented attributes. What do you think? ---------- components: Tests files: sslfix.patch keywords: patch messages: 105055 nosy: giampaolo.rodola, janssen, pitrou priority: normal severity: normal stage: patch review status: open title: Fix test_ssl failures under 2.6/3.1 with OpenSSL 1.0.0 type: behavior versions: Python 2.6, Python 3.1 Added file: http://bugs.python.org/file17224/sslfix.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 18:38:15 2010 From: report at bugs.python.org (=?utf-8?q?Andr=C3=A9_M=2E_C=2E_Campos?=) Date: Wed, 05 May 2010 16:38:15 +0000 Subject: [New-bugs-announce] [issue8630] Keepends param in codec readline(s) In-Reply-To: <1273077495.73.0.386813094956.issue8630@psf.upfronthosting.co.za> Message-ID: <1273077495.73.0.386813094956.issue8630@psf.upfronthosting.co.za> New submission from Andr? M. C. Campos : Some methods in StreamReaderWriter class (codecs library) has different signatures from StreamReader methods. More precisely it's missing the keepends parameter in readline and readlines methods. So, we cannot code: fp = codecs.open(fileName, "r", "utf-8") lines = fp.readlines(keepends=False) or line = fp.readline(keepends=False) ---------- components: Library (Lib) messages: 105056 nosy: amccampos priority: normal severity: normal status: open title: Keepends param in codec readline(s) type: behavior versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 5 23:45:06 2010 From: report at bugs.python.org (Alex Quinn) Date: Wed, 05 May 2010 21:45:06 +0000 Subject: [New-bugs-announce] [issue8631] subprocess.Popen.communicate(...) hangs on Windows In-Reply-To: <1273095906.37.0.582736332431.issue8631@psf.upfronthosting.co.za> Message-ID: <1273095906.37.0.582736332431.issue8631@psf.upfronthosting.co.za> New submission from Alex Quinn : After using subprocess.Popen(...).communicate(), the session hangs. c:\>python31 Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from subprocess import Popen, PIPE >>> Popen(["echo","Hello!"], stdout=PIPE).communicate()[0] b'Hello!\n' >>> At this point, the session stops responding to keyboard input. ========================================= MORE DETAILS: Neither Ctrl-C, Ctrl-Z, nor Ctrl-D will break out of it, but Ctrl-Break does break out of it. The task manager shows no CPU activity for the process. I've seen problem with Python v3.1.2 and v2.6.1 on Windows 7. It works fine under Linux: $ python3.1 Python 3.1 (r31:73572, Mar 22 2010, 14:57:00) [GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from subprocess import Popen, PIPE >>> Popen(["echo","Hello!"], stdout=PIPE).communicate()[0] b'Hello!\n' >>> print("No problems under Linux") No problems under Linux >>> Is this bug type "crash" or "behavior"? I went with the former, since it ends the usable Python session. ---------- components: IO, Library (Lib), Windows messages: 105088 nosy: Alex Quinn priority: normal severity: normal status: open title: subprocess.Popen.communicate(...) hangs on Windows type: crash versions: Python 2.6, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 6 00:04:25 2010 From: report at bugs.python.org (Alex Quinn) Date: Wed, 05 May 2010 22:04:25 +0000 Subject: [New-bugs-announce] [issue8632] subprocess doesn't handle Windows built-in commands as os.system() does In-Reply-To: <1273097065.69.0.229964904727.issue8632@psf.upfronthosting.co.za> Message-ID: <1273097065.69.0.229964904727.issue8632@psf.upfronthosting.co.za> New submission from Alex Quinn : The documentation says subprocess replaces os.system(). However, subprocess does not handle built-in Windows shell commands as os.system() does. Works: - os.system("dir /w") - subprocess.Popen("cmd /c dir /w", stdout=subprocess.PIPE).communicate()[0] Does NOT work: - Popen("dir /w", stdout=PIPE).communicate()[0] - Popen(["dir", "/w"], stdout=PIPE).communicate()[0] Examples: s:\d>python31 Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from subprocess import Popen, PIPE >>> Popen(["cmd", "/c", "dir", "/w"], stdout=PIPE).communicate()[0] ..... (WORKED) >>> Popen(["dir", "/w"], stdout=PIPE).communicate()[0] dir: cannot access /w: No such file or directory b'' (DIDN'T WORK) >>> ---------- components: IO, Library (Lib), Windows messages: 105091 nosy: Alex Quinn priority: normal severity: normal status: open title: subprocess doesn't handle Windows built-in commands as os.system() does type: behavior versions: Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 6 00:14:51 2010 From: report at bugs.python.org (STINNER Victor) Date: Wed, 05 May 2010 22:14:51 +0000 Subject: [New-bugs-announce] [issue8633] tarfile doesn't support undecodable filename in PAX format In-Reply-To: <1273097691.15.0.651636064492.issue8633@psf.upfronthosting.co.za> Message-ID: <1273097691.15.0.651636064492.issue8633@psf.upfronthosting.co.za> New submission from STINNER Victor : tarfile is unable to open a TAR archive in PAX format embedding invalid filenames (filename not encoded in utf8, an undecodable filename). Attached file is an example (contain the file b'z/\xff', not decodable from utf8). PAX specification has a "invalid" option with 4 values: bypass (default), rename, UTF-8, write. http://www.opengroup.org/onlinepubs/009695399/utilities/pax.html As it was done for other formats in issue #8390, PAX can use Python surrogateescape error handler to store undecodable bytes as unicode surrogates. I think that PAX should be strict by default, but have an option to enable surrogateescape mode. ---------- components: Library (Lib) files: z-pax.tar messages: 105094 nosy: haypo, lars.gustaebel, loewis priority: normal severity: normal status: open title: tarfile doesn't support undecodable filename in PAX format versions: Python 3.2 Added file: http://bugs.python.org/file17230/z-pax.tar _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 6 10:09:27 2010 From: report at bugs.python.org (Benjamin VENELLE) Date: Thu, 06 May 2010 08:09:27 +0000 Subject: [New-bugs-announce] [issue8634] [PATCH] get method for dbm interface In-Reply-To: <1273133367.38.0.142877532423.issue8634@psf.upfronthosting.co.za> Message-ID: <1273133367.38.0.142877532423.issue8634@psf.upfronthosting.co.za> New submission from Benjamin VENELLE : I'm suggesting to add the dict's 'get' method to dbm interface. So that, it would be easier to manage 'key not found' issues. B. Venelle. ---------- components: Library (Lib) messages: 105130 nosy: Kain94 priority: normal severity: normal status: open title: [PATCH] get method for dbm interface type: feature request versions: Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 6 15:16:04 2010 From: report at bugs.python.org (Nick Coghlan) Date: Thu, 06 May 2010 13:16:04 +0000 Subject: [New-bugs-announce] [issue8635] enumerate() docstring doesn't cover optional start argument In-Reply-To: <1273151764.64.0.669433681589.issue8635@psf.upfronthosting.co.za> Message-ID: <1273151764.64.0.669433681589.issue8635@psf.upfronthosting.co.za> New submission from Nick Coghlan : As noted in the comments for issue 2831, the enumerate docstring doesn't cover the feature added by that patch. ---------- components: Interpreter Core keywords: easy messages: 105144 nosy: ncoghlan priority: normal severity: normal stage: needs patch status: open title: enumerate() docstring doesn't cover optional start argument type: behavior versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 6 15:48:19 2010 From: report at bugs.python.org (Scott Dial) Date: Thu, 06 May 2010 13:48:19 +0000 Subject: [New-bugs-announce] [issue8636] enumerate() test cases do not cover optional start argument In-Reply-To: <1273153699.94.0.112049339171.issue8636@psf.upfronthosting.co.za> Message-ID: <1273153699.94.0.112049339171.issue8636@psf.upfronthosting.co.za> New submission from Scott Dial : The issue2831 patch test cases are not actually being run by test_enumerate and they were broken tests anyways. This patch fixes the brokenness. ---------- components: Interpreter Core, Tests files: test_enumerate.patch keywords: patch messages: 105147 nosy: scott.dial priority: normal severity: normal status: open title: enumerate() test cases do not cover optional start argument type: behavior versions: Python 2.7, Python 3.2 Added file: http://bugs.python.org/file17237/test_enumerate.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 6 17:33:46 2010 From: report at bugs.python.org (Justin Bronder) Date: Thu, 06 May 2010 15:33:46 +0000 Subject: [New-bugs-announce] [issue8637] [PATCH] pydoc should respect MANPAGER over PAGER. In-Reply-To: <1273160026.83.0.741000260603.issue8637@psf.upfronthosting.co.za> Message-ID: <1273160026.83.0.741000260603.issue8637@psf.upfronthosting.co.za> New submission from Justin Bronder : Similar to man(1), pydoc should respect the environment variable MANPAGER over PAGER. The current behavior causes issues when using a PAGER that does not support man pages. Patch based off of trunk, r80871 ---------- components: Library (Lib) files: python-2.7-pydoc-manpager.patch keywords: patch messages: 105151 nosy: jsbronder priority: normal severity: normal status: open title: [PATCH] pydoc should respect MANPAGER over PAGER. type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file17238/python-2.7-pydoc-manpager.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 6 22:00:32 2010 From: report at bugs.python.org (Lucian Ursu) Date: Thu, 06 May 2010 20:00:32 +0000 Subject: [New-bugs-announce] [issue8638] Remove suggestion for name mangling from the tutorial In-Reply-To: <1273176032.85.0.0243971489868.issue8638@psf.upfronthosting.co.za> Message-ID: <1273176032.85.0.0243971489868.issue8638@psf.upfronthosting.co.za> New submission from Lucian Ursu : I suggest that name mangling should not be recommended as a way of having private attributes. Instead, one underscore should be suggested as a signal that the attribute is private. This suggestion comes after discussing with some of the helpers from #python. Basically, they said that name mangling should never be used, so it would be appropriate to remove this recommendation from the tutorial. ---------- assignee: docs at python components: Documentation messages: 105161 nosy: LucianU, docs at python priority: normal severity: normal status: open title: Remove suggestion for name mangling from the tutorial type: feature request versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 6 23:58:30 2010 From: report at bugs.python.org (George Sakkis) Date: Thu, 06 May 2010 21:58:30 +0000 Subject: [New-bugs-announce] [issue8639] Allow callable objects in inspect.getargspec In-Reply-To: <1273183110.15.0.600505035287.issue8639@psf.upfronthosting.co.za> Message-ID: <1273183110.15.0.600505035287.issue8639@psf.upfronthosting.co.za> New submission from George Sakkis : Not sure if this has been brought before but how about extending getargspec to work with callable instances, i.e. make it equivalent to getargspec(obj.__call__) ? ---------- components: Library (Lib) messages: 105166 nosy: gsakkis priority: normal severity: normal status: open title: Allow callable objects in inspect.getargspec type: feature request versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 00:45:17 2010 From: report at bugs.python.org (STINNER Victor) Date: Thu, 06 May 2010 22:45:17 +0000 Subject: [New-bugs-announce] [issue8640] subprocess: add envb argument to Popen constructor (Python3, POSIX only) In-Reply-To: <1273185917.08.0.761086865943.issue8640@psf.upfronthosting.co.za> Message-ID: <1273185917.08.0.761086865943.issue8640@psf.upfronthosting.co.za> New submission from STINNER Victor : Python 3.2 has now its os.environb, the bytes version of os.environ. subprocess should get a new envb argument to be able to use pure bytes environmental variables. Examples: subprocess.call([b'env], envb={b'PATH': b'/usr/bin'}) and envb = os.environb.copy() envb[b'PATH'] = b'/usr/bin' subprocess.call([b'env], envb=envb) Specify both env and envb would raise an exception. envb should only be available on POSIX (as os.environb). Related issues: #8513 (subprocess: support bytes program name) and #8603 (os.environb). ---------- components: Library (Lib), Unicode messages: 105168 nosy: haypo priority: normal severity: normal status: open title: subprocess: add envb argument to Popen constructor (Python3, POSIX only) versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 08:16:34 2010 From: report at bugs.python.org (Puzzlet Chung) Date: Fri, 07 May 2010 06:16:34 +0000 Subject: [New-bugs-announce] [issue8641] IDLE 3 doesn't highlights b"", but u"" In-Reply-To: <1273212994.94.0.428777321336.issue8641@psf.upfronthosting.co.za> Message-ID: <1273212994.94.0.428777321336.issue8641@psf.upfronthosting.co.za> New submission from Puzzlet Chung : IDLE 3.1.2 doesn't highlight b"" syntax, instead highlights u"". Tested with IDLE (x86) 3.1.2 and Windows XP SP2. ---------- components: IDLE messages: 105184 nosy: puzzlet priority: normal severity: normal status: open title: IDLE 3 doesn't highlights b"", but u"" versions: Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 11:05:33 2010 From: report at bugs.python.org (MATSUI Tetsushi) Date: Fri, 07 May 2010 09:05:33 +0000 Subject: [New-bugs-announce] [issue8642] json.loads description In-Reply-To: <1273223133.88.0.532176627145.issue8642@psf.upfronthosting.co.za> Message-ID: <1273223133.88.0.532176627145.issue8642@psf.upfronthosting.co.za> New submission from MATSUI Tetsushi : At the end of description of json.loads, dump() should be load(). ---------- assignee: docs at python components: Documentation messages: 105187 nosy: docs at python, mft priority: normal severity: normal status: open title: json.loads description versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 13:11:18 2010 From: report at bugs.python.org (=?utf-8?b?TWljaGFsIEJvxb5vxYg=?=) Date: Fri, 07 May 2010 11:11:18 +0000 Subject: [New-bugs-announce] [issue8643] incorrect timedelta yielded by two on-the-fly nows In-Reply-To: <1273230678.16.0.688887441579.issue8643@psf.upfronthosting.co.za> Message-ID: <1273230678.16.0.688887441579.issue8643@psf.upfronthosting.co.za> New submission from Michal Bo?o? : now() - now() from datetime.datetime produces not-nearly-zero timedelta: >>> import datetime >>> (datetime.datetime.now() - datetime.datetime.now()).seconds 86399 (i can't in the moment figure out why this is happening, sice the datetime library is written in C) ---------- components: Library (Lib) messages: 105190 nosy: mykhal priority: normal severity: normal status: open title: incorrect timedelta yielded by two on-the-fly nows type: behavior versions: Python 2.5, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 14:24:55 2010 From: report at bugs.python.org (Mark Dickinson) Date: Fri, 07 May 2010 12:24:55 +0000 Subject: [New-bugs-announce] [issue8644] timedelta.total_seconds needlessly inaccurate, especially for negative timedeltas In-Reply-To: <1273235095.12.0.903457246009.issue8644@psf.upfronthosting.co.za> Message-ID: <1273235095.12.0.903457246009.issue8644@psf.upfronthosting.co.za> New submission from Mark Dickinson : I just noticed (while responding to issue 8643) that timedelta.total_seconds() has some accuracy problems, especially for negative timedeltas: Python 3.2a0 (py3k:80840:80842, May 7 2010, 12:29:35) [GCC 4.2.1 (Apple Inc. build 5659)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from datetime import timedelta >>> td = timedelta(microseconds = -123) >>> td.total_seconds() # expect -0.000123 -0.0001230000052601099 This could be easily fixed by using integer arithmetic internally instead of float arithmetic: >>> 1e-6 * td.microseconds + td.seconds + 86400 * td.days -0.0001230000052601099 >>> (td.microseconds + 1000000 * (td.seconds + 86400 * td.days)) / 1000000 -0.000123 This works especially nicely in combination with the new float repr and the improved accuracy of true division in 2.7 / 3.2, to give a total_seconds() whose repr is free of noise digits. (Well, for small timedeltas, anyway.) Since total_seconds is new in 2.7 and 3.2, I think it would be good to fix this before the 2.7 release. ---------- components: Extension Modules messages: 105197 nosy: belopolsky, mark.dickinson priority: normal severity: normal stage: needs patch status: open title: timedelta.total_seconds needlessly inaccurate, especially for negative timedeltas type: behavior versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 17:55:35 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Fri, 07 May 2010 15:55:35 +0000 Subject: [New-bugs-announce] [issue8645] PyUnicode_AsEncodedObject is undocumented In-Reply-To: <1273247735.73.0.712345896243.issue8645@psf.upfronthosting.co.za> Message-ID: <1273247735.73.0.712345896243.issue8645@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : PyUnicode_AsEncodedObject is undocumented. It has the same signature as PyUnicode_AsEncodedString, although they do slightly different things based on a brief source code inspection (I'm not clear on what that difference is though). ---------- assignee: docs at python components: Documentation messages: 105203 nosy: docs at python, stutzbach priority: normal severity: normal stage: needs patch status: open title: PyUnicode_AsEncodedObject is undocumented versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 17:59:05 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Fri, 07 May 2010 15:59:05 +0000 Subject: [New-bugs-announce] [issue8646] PyUnicode_EncodeDecimal is undocumented In-Reply-To: <1273247945.7.0.702043835904.issue8646@psf.upfronthosting.co.za> Message-ID: <1273247945.7.0.702043835904.issue8646@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : PyUnicode_EncodeDecimal is undocumented (although it's referenced in passing in the documentation for PyLong_FromUnicode). There's a lengthy comment in unicodeobject.h describing PyUnicode_EncodeDecimal, which could be converted more or less directly into documentation. ---------- assignee: docs at python components: Documentation messages: 105205 nosy: docs at python, stutzbach priority: normal severity: normal stage: needs patch status: open title: PyUnicode_EncodeDecimal is undocumented versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 18:07:19 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Fri, 07 May 2010 16:07:19 +0000 Subject: [New-bugs-announce] [issue8647] PyUnicode_GetMax is undocumented In-Reply-To: <1273248439.66.0.594970239714.issue8647@psf.upfronthosting.co.za> Message-ID: <1273248439.66.0.594970239714.issue8647@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : Here's the relevant signature: /* Get the maximum ordinal for a Unicode character. */ PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); ---------- assignee: docs at python components: Documentation messages: 105206 nosy: docs at python, stutzbach priority: normal severity: normal stage: needs patch status: open title: PyUnicode_GetMax is undocumented versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 18:10:36 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Fri, 07 May 2010 16:10:36 +0000 Subject: [New-bugs-announce] [issue8648] The UTF-7 codec functions are undocumented In-Reply-To: <1273248636.7.0.217932609429.issue8648@psf.upfronthosting.co.za> Message-ID: <1273248636.7.0.217932609429.issue8648@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : The UTF-7 codec functions are undocumented: PyUnicode_DecodeUTF7Stateful PyUnicode_DecodeUTF7 PyUnicode_EncodeUTF7 ---------- assignee: docs at python components: Documentation messages: 105207 nosy: docs at python, stutzbach priority: normal severity: normal stage: needs patch status: open title: The UTF-7 codec functions are undocumented versions: Python 2.6, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 18:48:41 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Fri, 07 May 2010 16:48:41 +0000 Subject: [New-bugs-announce] [issue8649] Py_UNICODE_* functions are undocumented In-Reply-To: <1273250921.26.0.330435554177.issue8649@psf.upfronthosting.co.za> Message-ID: <1273250921.26.0.330435554177.issue8649@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : Python provides several functions for manipulating raw Py_UNICODE strings, but they aren't documented. Below are their signatures. PyAPI_FUNC(size_t) Py_UNICODE_strlen(const Py_UNICODE *u); PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strcpy( Py_UNICODE *s1, const Py_UNICODE *s2); PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strncpy( Py_UNICODE *s1, const Py_UNICODE *s2, size_t n); PyAPI_FUNC(int) Py_UNICODE_strcmp( const Py_UNICODE *s1, const Py_UNICODE *s2); PyAPI_FUNC(Py_UNICODE*) Py_UNICODE_strchr( const Py_UNICODE *s, Py_UNICODE c ); ---------- assignee: docs at python components: Documentation messages: 105214 nosy: docs at python, stutzbach priority: normal severity: normal stage: needs patch status: open title: Py_UNICODE_* functions are undocumented versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 19:21:01 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Fri, 07 May 2010 17:21:01 +0000 Subject: [New-bugs-announce] [issue8650] zlibmodule.c isn't 64-bit clean In-Reply-To: <1273252861.66.0.962857738541.issue8650@psf.upfronthosting.co.za> Message-ID: <1273252861.66.0.962857738541.issue8650@psf.upfronthosting.co.za> New submission from Antoine Pitrou : zlibmodule.c doesn't define PY_SSIZE_T_CLEAN, and uses lots of "int" variables for length values internally. Besides, the zlib itself uses "uInt" and "uLong" variables in its z_stream structure (rather than something guaranteed to be at least the width of a pointer). On large input data, this will conspire to produce bogus results or crashes. For example: >>> s = 'x' * (4 * 1024**3 + 100) >>> t = zlib.compress(s, 1) >>> len(t) 12 >>> len(zlib.decompress(t)) 100 ---------- components: Extension Modules messages: 105216 nosy: gregory.p.smith, pitrou priority: normal severity: normal stage: needs patch status: open title: zlibmodule.c isn't 64-bit clean type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 19:24:56 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Fri, 07 May 2010 17:24:56 +0000 Subject: [New-bugs-announce] [issue8651] "s#" and friends can silently truncate buffer length In-Reply-To: <1273253096.48.0.301498355728.issue8651@psf.upfronthosting.co.za> Message-ID: <1273253096.48.0.301498355728.issue8651@psf.upfronthosting.co.za> New submission from Antoine Pitrou : When PY_SSIZE_T isn't defined and a format such as "s#" receives an object whose length fits in a Py_ssize_t but not in an int, the buffer length is silently truncated: >>> s = 'x' * (4 * 1024**3 + 100) >>> t = zlib.compress(s, 1) >>> len(t) 12 >>> len(zlib.decompress(t)) 100 (from issue8650) ---------- components: Interpreter Core messages: 105217 nosy: haypo, loewis, pitrou priority: normal severity: normal stage: needs patch status: open title: "s#" and friends can silently truncate buffer length type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 19:25:34 2010 From: report at bugs.python.org (Marien Zwart) Date: Fri, 07 May 2010 17:25:34 +0000 Subject: [New-bugs-announce] [issue8652] Minor improvements to the "Handling Exceptions" part of the tutorial In-Reply-To: <1273253134.08.0.147248211976.issue8652@psf.upfronthosting.co.za> Message-ID: <1273253134.08.0.147248211976.issue8652@psf.upfronthosting.co.za> New submission from Marien Zwart : Based on questions asked on freenode's #python by people reading the tutorial I would like to suggest two improvements to http://docs.python.org/tutorial/errors.html#handling-exceptions : - Mention the older "except SomeException, e:" syntax too, not just "except SomeException as e:". I have had people ask me to help them upgrade to a newer python because they thought their version of python did not support catching exception instances (their distro python being 2.5). A big fat warning that they're reading the Python 2.6 tutorial (with links to older tutorials) may also work. - Mention "except IOError as e" before mentioning "except IOError as (errno, strerror):". The latter is an advanced and relatively unusual trick, combining regular exception catching and unpacking. Those two concepts need to be explained before the combination is. I have had people ask me how to do "except KeyError as (key, insert_something_here):" because they thought they *always* needed those parens there. (perhaps just not mentioning unpacking here at all, using "except IOError as e:" and then using e.errno would make more sense, especially since "except IOError as (errno, strerror):" is a SyntaxError in python 3 and up (because of the unpacking) and python 2.5.x and down (because of the "as")...) I can try to write a patch to the documentation if you like. ---------- assignee: docs at python components: Documentation messages: 105218 nosy: docs at python, marienz priority: normal severity: normal status: open title: Minor improvements to the "Handling Exceptions" part of the tutorial _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 20:39:02 2010 From: report at bugs.python.org (Dave Abrahams) Date: Fri, 07 May 2010 18:39:02 +0000 Subject: [New-bugs-announce] [issue8653] urlparse.urlparse/urlsplit doc missing In-Reply-To: <1273257542.33.0.475796266696.issue8653@psf.upfronthosting.co.za> Message-ID: <1273257542.33.0.475796266696.issue8653@psf.upfronthosting.co.za> New submission from Dave Abrahams : The docstrings for these functions don't explain the 'scheme' parameter. Even renaming it to default_scheme would help. ---------- assignee: docs at python components: Documentation messages: 105221 nosy: dabrahams, docs at python priority: normal severity: normal status: open title: urlparse.urlparse/urlsplit doc missing _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 21:02:45 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Fri, 07 May 2010 19:02:45 +0000 Subject: [New-bugs-announce] [issue8654] Improve ABI compatibility between UCS2 and UCS4 builds In-Reply-To: <1273258965.02.0.175407225836.issue8654@psf.upfronthosting.co.za> Message-ID: <1273258965.02.0.175407225836.issue8654@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : Currently, Python can be built with an internal Unicode representation of UCS2 or UCS4. To prevent extension modules compiled with the wrong Unicode representation from linking, unicodeobject.h #defines many of the Unicode functions. For example, PyUnicode_FromString becomes either PyUnicodeUCS2_FromString or PyUnicodeUCS4_FromString. Consequently, if one installs a binary egg (e.g., with easy_install), there's a good chance one will get an error such as the following when trying to use it: undefined symbol: PyUnicodeUCS2_FromString In Python 2, only some extension modules were stung by this problem. For Python 3, virtually every extension type will need to call a PyUnicode_* function, since __repr__ must return a Unicode object. It's basically fruitless to upload a binary egg for Python 3 to PyPi, since it will generate link errors for a large fraction of downloaders (I discovered this the hard way). Right now, nearly all the functions in unicodeobject.h are wrapped. Several functions are not. Many of the unwrapped functions also have no documentation, so I'm guessing they are newer functions that were not wrapped when they were added. Most extensions treat PyUnicodeObjects as opaque and do not care if the internal representation is UCS2 or UCS4. We can improve ABI compatibility by only wrapping functions where the representation matters from the caller's point of view. For example, PyUnicode_FromUnicode creates a Unicode object from an array of Py_UNICODE objects. It will interpret the data differently on UCS2 vs UCS4, so the function should be wrapped. On the other hand, PyUnicode_FromString creates a Unicode object from a char *. The caller can treat the returned object as opaque, so the function should not be wrapped. The attached patch implements that rule. It unwraps 64 opaque functions that were previously wrapped, and wraps 11 non-opaque functions that were previously unwrapped. "make test" works with both UCS2 and UCS4 builds. I previously brought this issue up on python-ideas, see: http://mail.python.org/pipermail/python-ideas/2009-November/006543.html Here's a summary of that discussion: Zooko Wilcox-O'Hearn pointed out that my proposal is complimentary to his proposal to standardize on UCS4, to reduce the risk of extension modules built with a mismatched encoding. Stefan Behnel pointed out that easy_install should allow eggs to specify the encoding they require. PJE's proposed implementation of that feature (http://bit.ly/1bO62) would allow eggs to specify UCS2, UCS4, or "Don't Care". My proposal greatly increases the number of eggs that could label themselves "Don't Care", reducing maintenance work for package maintainers. In other words, they are complimentary fixes. Guido liked the idea but expressed concern about the possibility of extension modules that link successfully, but later crash because they actually do depend on the UCS2/UCS4 distinction. With my current patch, there are still two ways for that to happen: 1) The extension uses only opaque functions, but casts the returned PyObject * to PyUnicodeObject * and accesses the str member, or 2) The extension uses only opaque functions, but uses the PyUnicode_AS_UNICODE or PyUnicode_AS_DATA macros. Most packages that poke into the internals of PyUnicodeObject also call non-opaque functions. Consequently, they will still generate a linker error if the encoding is mismatched, as desired. I'm trying to come up with a way to 100% guarantee that any extension poking into the internals will generate a linker error if the encoding is mismatched, even if they don't call any non-opaque functions. I'll post about that in a separate comment to this bug. ---------- assignee: stutzbach components: Interpreter Core, Unicode messages: 105222 nosy: stutzbach priority: normal severity: normal stage: needs patch status: open title: Improve ABI compatibility between UCS2 and UCS4 builds type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri May 7 22:49:54 2010 From: report at bugs.python.org (Westly Ward) Date: Fri, 07 May 2010 20:49:54 +0000 Subject: [New-bugs-announce] [issue8655] Problem with getpeercert in the ssl module when retrieving client side certs In-Reply-To: <1273265394.09.0.646660549737.issue8655@psf.upfronthosting.co.za> Message-ID: <1273265394.09.0.646660549737.issue8655@psf.upfronthosting.co.za> New submission from Westly Ward : I originally had this problem when writing my IRCd, but then tested it in a basic script. The problem is that getpeercert() is always returning None when executed on the server side, even when the client is using an ssl cert. I have included an example in the attachment. Just run sslserver.py in one terminal window, and then run sslclient.py in the other. I also included the two fresh ssl certs and keys I used. In client.txt and server.txt I put the commands I used to generate the ssl certs and keys. ---------- components: Library (Lib) files: ssltest.tar.gz messages: 105227 nosy: Westly.Ward priority: normal severity: normal status: open title: Problem with getpeercert in the ssl module when retrieving client side certs versions: Python 2.6 Added file: http://bugs.python.org/file17249/ssltest.tar.gz _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 03:45:28 2010 From: report at bugs.python.org (Dave Abrahams) Date: Sat, 08 May 2010 01:45:28 +0000 Subject: [New-bugs-announce] [issue8656] urllib2 mangles file://-scheme URLs In-Reply-To: <1273283128.63.0.607654661421.issue8656@psf.upfronthosting.co.za> Message-ID: <1273283128.63.0.607654661421.issue8656@psf.upfronthosting.co.za> New submission from Dave Abrahams : $ touch /tmp/x.html $ python -c 'import urllib2;resp=urllib2.urlopen("file:///tmp/x.html");print resp.geturl()' file:/tmp/x.html note the missing // after the colon ---------- messages: 105250 nosy: dabrahams priority: normal severity: normal status: open title: urllib2 mangles file://-scheme URLs versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 04:49:08 2010 From: report at bugs.python.org (Dave Abrahams) Date: Sat, 08 May 2010 02:49:08 +0000 Subject: [New-bugs-announce] [issue8657] urlparse.urlunsplit should be smarter about + In-Reply-To: <1273286948.85.0.868221921839.issue8657@psf.upfronthosting.co.za> Message-ID: <1273286948.85.0.868221921839.issue8657@psf.upfronthosting.co.za> New submission from Dave Abrahams : from urlparse import * urlunsplit(urlsplit('git+file:///foo/bar/baz')) => git+file:/foo/bar/baz ---------- messages: 105253 nosy: dabrahams priority: normal severity: normal status: open title: urlparse.urlunsplit should be smarter about + versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 06:00:34 2010 From: report at bugs.python.org (Senthil Kumaran) Date: Sat, 08 May 2010 04:00:34 +0000 Subject: [New-bugs-announce] [issue8658] urlparse.urlunsplit should be smarter about + and file urls In-Reply-To: <1273291234.63.0.786087724907.issue8658@psf.upfronthosting.co.za> Message-ID: <1273291234.63.0.786087724907.issue8658@psf.upfronthosting.co.za> New submission from Senthil Kumaran : >>> from urlparse import * >>> urlsplit('git+file:///foo/bar/baz') SplitResult(scheme='git+file', netloc='', path='/foo/bar/baz', query='', fragment='') >>> urlunsplit(urlsplit('git+file:///foo/bar/baz')) 'git+file:/foo/bar/baz' >>> ---------- assignee: orsenthil files: urlparse_giturl.patch keywords: patch messages: 105256 nosy: orsenthil priority: normal severity: normal status: open title: urlparse.urlunsplit should be smarter about + and file urls type: behavior Added file: http://bugs.python.org/file17257/urlparse_giturl.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 08:15:22 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Sat, 08 May 2010 06:15:22 +0000 Subject: [New-bugs-announce] [issue8659] ABS(x) == 0 can be simplified to x == 0 In-Reply-To: <1273299322.78.0.204722147586.issue8659@psf.upfronthosting.co.za> Message-ID: <1273299322.78.0.204722147586.issue8659@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : I noticed that in longobject.c, there are a few spots that take the absolute value of an int before comparing the int to 0. There's no -0 for C integers, so the absolute value isn't necessary. I traced back through the commit history, and it looks like they're an artifact of the original one's-complement longobject.c (which COULD have -0). longobject was switched to two's-complement in 1992. ;-) ---------- assignee: stutzbach components: Interpreter Core files: abs-zero.patch keywords: patch messages: 105265 nosy: stutzbach priority: normal severity: normal stage: patch review status: open title: ABS(x) == 0 can be simplified to x == 0 type: performance versions: Python 3.2 Added file: http://bugs.python.org/file17259/abs-zero.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 15:10:10 2010 From: report at bugs.python.org (Daniel Urban) Date: Sat, 08 May 2010 13:10:10 +0000 Subject: [New-bugs-announce] [issue8660] py3k weakref documentation mentions the long built-in type In-Reply-To: <1273324210.04.0.0772545090364.issue8660@psf.upfronthosting.co.za> Message-ID: <1273324210.04.0.0772545090364.issue8660@psf.upfronthosting.co.za> New submission from Daniel Urban : There is a sentence in the weakref module's documentation: "Other built-in types such as tuple and long do not support weak references even when subclassed" But there is no "long" type in py3k. ---------- assignee: docs at python components: Documentation messages: 105285 nosy: docs at python, durban priority: normal severity: normal status: open title: py3k weakref documentation mentions the long built-in type versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 17:33:42 2010 From: report at bugs.python.org (Jean-Paul Calderone) Date: Sat, 08 May 2010 15:33:42 +0000 Subject: [New-bugs-announce] [issue8661] FAQ item 2.25 is unclear In-Reply-To: <1273332822.19.0.471138698588.issue8661@psf.upfronthosting.co.za> Message-ID: <1273332822.19.0.471138698588.issue8661@psf.upfronthosting.co.za> New submission from Jean-Paul Calderone : The item "How do I prepare a new branch for merging?" is unclear about which branch needs to be prepared. It could be the source branch or the destination branch. In #python-dev, I learned that it's probably the destination branch being discussed here. This should be clarified (and it could also be pointed out that it is almost always the case that this step has been done by someone else already). ---------- messages: 105300 nosy: exarkun priority: normal severity: normal status: open title: FAQ item 2.25 is unclear _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 18:50:50 2010 From: report at bugs.python.org (Timothy Pederick) Date: Sat, 08 May 2010 16:50:50 +0000 Subject: [New-bugs-announce] [issue8662] bytes join cannot join bytes In-Reply-To: <1273337450.92.0.207021309047.issue8662@psf.upfronthosting.co.za> Message-ID: <1273337450.92.0.207021309047.issue8662@psf.upfronthosting.co.za> New submission from Timothy Pederick : This code behaves as expected: >>> ' '.join('cat') 'c a t' This code does not: >>> b'\x00'.join(b'cat') Traceback (most recent call last): ... b'\x00'.join(b'cat') TypeError: sequence item 0: expected bytes, int found Instead, you have to do something like this: >>> b'\x00'.join(bytes((i,)) for i in b'cat') b'c\x00a\x00t' The cause is that indexing a bytes object gives an int, not a bytes. I know, it's as designed, PEP 3137, etc. But in this specific instance, it causes Python to behave inconsistently (bytes vs. str) and unintuitively (to me, anyway). (Same problem with bytes or bytearray in either position.) ---------- files: joinerror.py messages: 105317 nosy: perey priority: normal severity: normal status: open title: bytes join cannot join bytes type: behavior versions: Python 3.1 Added file: http://bugs.python.org/file17262/joinerror.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 19:38:41 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Sat, 08 May 2010 17:38:41 +0000 Subject: [New-bugs-announce] [issue8663] Failed compile in a non-ASCII path In-Reply-To: <1273340321.62.0.764550030132.issue8663@psf.upfronthosting.co.za> Message-ID: <1273340321.62.0.764550030132.issue8663@psf.upfronthosting.co.za> New submission from Antoine Pitrou : Distutils fails logging characters which are not part of the "default encoding": http://www.python.org/dev/buildbot/builders/AMD64%20Ubuntu%20wide%203.x/builds/1062/steps/compile/logs/stdio [...] File "/home/buildbot/cpython-ucs4-nonascii-\u20ac/3.x.pitrou-ubuntu-wide/build/Lib/distutils/dir_util.py", line 67, in mkpath log.info("creating %s", head) File "/home/buildbot/cpython-ucs4-nonascii-\u20ac/3.x.pitrou-ubuntu-wide/build/Lib/distutils/log.py", line 40, in info self._log(INFO, msg, args) File "/home/buildbot/cpython-ucs4-nonascii-\u20ac/3.x.pitrou-ubuntu-wide/build/Lib/distutils/log.py", line 30, in _log stream.write('%s\n' % msg) UnicodeEncodeError: 'ascii' codec can't encode character '\u20ac' in position 81: ordinal not in range(128) [54439 refs] ---------- assignee: tarek components: Distutils messages: 105320 nosy: haypo, pitrou, tarek priority: normal severity: normal stage: needs patch status: open title: Failed compile in a non-ASCII path type: compile error versions: Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 21:36:33 2010 From: report at bugs.python.org (Arfrever Frehtes Taifersar Arahesis) Date: Sat, 08 May 2010 19:36:33 +0000 Subject: [New-bugs-announce] [issue8664] py_compile.compile() should consistently create parent directory of target file In-Reply-To: <1273347393.41.0.872470014027.issue8664@psf.upfronthosting.co.za> Message-ID: <1273347393.41.0.872470014027.issue8664@psf.upfronthosting.co.za> New submission from Arfrever Frehtes Taifersar Arahesis : Currently when cfile argument of py_compile.compile() is None, then path to target file is automatically calculated and parent directory of target file is created. If the same path of target file is explicitly passed as cfile argument of py_compile.compile(), then parent directory of target file is not created automatically. This inconsistency in behavior can be easily fixed. Fixing it also allows to simplify compileall.compile_file() function, which calls py_compile.compile() and currently needs to earlier try to create parent directory of target file. The following example shows inconsistent behavior: $ mkdir test $ touch test/test.py $ tree test test ??? test.py 0 directories, 1 file $ python3.2 -c 'import py_compile; py_compile.compile("test/test.py")' $ tree test test ??? __pycache__ ? ??? test.cpython-32.pyc ??? test.py 1 directory, 2 files $ rm -fr test/__pycache__ $ python3.2 -c 'import py_compile; py_compile.compile("test/test.py", "test/__pycache__/test.cpython-32.pyc")' Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.2/py_compile.py", line 131, in compile with open(cfile, 'wb') as fc: IOError: [Errno 2] No such file or directory: 'test/__pycache__/test.cpython-32.pyc' $ mkdir test/__pycache__ $ python3.2 -c 'import py_compile; py_compile.compile("test/test.py", "test/__pycache__/test.cpython-32.pyc")' $ tree test test ??? __pycache__ ? ??? test.cpython-32.pyc ??? test.py 1 directory, 2 files ---------- components: Library (Lib) messages: 105328 nosy: Arfrever priority: normal severity: normal status: open title: py_compile.compile() should consistently create parent directory of target file type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 21:51:00 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Sat, 08 May 2010 19:51:00 +0000 Subject: [New-bugs-announce] [issue8665] "make pycremoval" fails In-Reply-To: <1273348260.64.0.925523005722.issue8665@psf.upfronthosting.co.za> Message-ID: <1273348260.64.0.925523005722.issue8665@psf.upfronthosting.co.za> New submission from Antoine Pitrou : This is probably because you remove the directory while find is walking it: $ make pycremoval find . -name '*.py[co]' -exec rm -f {} ';' find . -name '__pycache__' -exec rmdir {} ';' find: `./Lib/http/__pycache__': No such file or directory find: `./Lib/unittest/test/__pycache__': No such file or directory find: `./Lib/unittest/__pycache__': No such file or directory find: `./Lib/email/__pycache__': No such file or directory find: `./Lib/test/__pycache__': No such file or directory find: `./Lib/importlib/__pycache__': No such file or directory find: `./Lib/urllib/__pycache__': No such file or directory find: `./Lib/__pycache__': No such file or directory find: `./Lib/encodings/__pycache__': No such file or directory find: `./Lib/json/__pycache__': No such file or directory make: [pycremoval] Error 1 (ignored) ---------- assignee: barry components: Build messages: 105331 nosy: barry, pitrou priority: normal severity: normal stage: needs patch status: open title: "make pycremoval" fails type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat May 8 21:56:34 2010 From: report at bugs.python.org (Tim Chase) Date: Sat, 08 May 2010 19:56:34 +0000 Subject: [New-bugs-announce] [issue8666] Allow ConfigParser.get*() to take a default value In-Reply-To: <1273348594.74.0.554904911988.issue8666@psf.upfronthosting.co.za> Message-ID: <1273348594.74.0.554904911988.issue8666@psf.upfronthosting.co.za> New submission from Tim Chase : Patch to update ConfigParser.py so that the .get* methods can take an optional parameter rather than raising exceptions. Usage: cp = ConfigParser(...) # ... value = cp.get('MySection', 'MyOption', default='some default') i = cp.getint('MySecton', 'MyInt', default=42) f = cp.getfloat('MySection', 'MyF', default=3.14) ---------- components: Library (Lib) messages: 105333 nosy: Gumnos priority: normal severity: normal status: open title: Allow ConfigParser.get*() to take a default value type: feature request versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 9 01:51:33 2010 From: report at bugs.python.org (Brett Cannon) Date: Sat, 08 May 2010 23:51:33 +0000 Subject: [New-bugs-announce] [issue8667] Link to PEP 3147 from importlib docs In-Reply-To: <1273362693.55.0.571697250376.issue8667@psf.upfronthosting.co.za> Message-ID: <1273362693.55.0.571697250376.issue8667@psf.upfronthosting.co.za> New submission from Brett Cannon : In trying to keep importlib's docs THE place to go for links to all relevant import details, a link to PEP 3147 is needed. ---------- assignee: brett.cannon components: Documentation keywords: easy messages: 105351 nosy: brett.cannon priority: low severity: normal stage: needs patch status: open title: Link to PEP 3147 from importlib docs versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 9 03:19:06 2010 From: report at bugs.python.org (Dan Buch) Date: Sun, 09 May 2010 01:19:06 +0000 Subject: [New-bugs-announce] [issue8668] add a 'develop' command In-Reply-To: <1273367946.24.0.0664676682922.issue8668@psf.upfronthosting.co.za> Message-ID: <1273367946.24.0.0664676682922.issue8668@psf.upfronthosting.co.za> New submission from Dan Buch : make a 'develop' command in distutils2 a la setuptools (unless, of course, this has already been unilaterally refused via distutils-sig or other communication) ---------- assignee: tarek components: Distutils2 messages: 105359 nosy: meatballhat, tarek priority: normal severity: normal status: open title: add a 'develop' command type: feature request _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 9 03:47:13 2010 From: report at bugs.python.org (Dan Buch) Date: Sun, 09 May 2010 01:47:13 +0000 Subject: [New-bugs-announce] [issue8669] lack of bdist_rpm module raises error on 'setup.py --help-commands' In-Reply-To: <1273369633.98.0.458470159807.issue8669@psf.upfronthosting.co.za> Message-ID: <1273369633.98.0.458470159807.issue8669@psf.upfronthosting.co.za> New submission from Dan Buch : Running 'python setup.py --help-commands' in the distutils2 package raises an error because there is no 'bdist_rpm' module. Should references to 'bdist_rpm' be removed, or should the 'bdist_rpm' module be (re?)introduced? ---------- assignee: tarek components: Distutils2 messages: 105361 nosy: meatballhat, tarek priority: normal severity: normal status: open title: lack of bdist_rpm module raises error on 'setup.py --help-commands' _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 9 08:38:34 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Sun, 09 May 2010 06:38:34 +0000 Subject: [New-bugs-announce] [issue8670] c_types.c_wchar should not assume that sizeof(wchar_t) == sizeof(Py_UNICODE) In-Reply-To: <1273387114.89.0.416578803449.issue8670@psf.upfronthosting.co.za> Message-ID: <1273387114.89.0.416578803449.issue8670@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : Using a UCS2 Python on a platform with a 32-bit wchar_t, the following code throws an exception (but should not): >>> ctypes.c_wchar('\u10000') Traceback (most recent call last): File "", line 1, in TypeError: one character unicode string expected The trouble is in the u_set() function in Modules/_ctypes/cfield.c. The corresponding u_get() function looks correct. On a UCS4 Python running on a system with a 16-bit wchar_t, u_set() will corrupt the data by silently truncating the character to 16-bits. For reference, Linux and Mac OS use a 32-bit wchar_t while Windows uses a 16-bit wchar_t. ---------- assignee: theller components: ctypes messages: 105374 nosy: stutzbach, theller priority: normal severity: normal stage: unit test needed status: open title: c_types.c_wchar should not assume that sizeof(wchar_t) == sizeof(Py_UNICODE) type: behavior versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun May 9 14:43:35 2010 From: report at bugs.python.org (bones7456) Date: Sun, 09 May 2010 12:43:35 +0000 Subject: [New-bugs-announce] [issue8671] A small erorr on http://docs.python.org/library/re.html In-Reply-To: <1273409015.67.0.984272084937.issue8671@psf.upfronthosting.co.za> Message-ID: <1273409015.67.0.984272084937.issue8671@psf.upfronthosting.co.za> New submission from bones7456 : In section \b , original text is: Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of alphanumeric or underscore characters, so the end of a word is indicated by whitespace or a non-alphanumeric, non-underscore character. Note that \b is defined as the boundary between \w and \ W, so the precise set of characters deemed to be alphanumeric depends on the values of the UNICODE and LOCALE flags. Inside a character range, \b represents the backspace character, for compatibility with Python?s string literals. NOTE: there is space between "\" and "W", I think it is not needed. ---------- assignee: docs at python components: Documentation messages: 105391 nosy: bones7456, docs at python priority: normal severity: normal status: open title: A small erorr on http://docs.python.org/library/re.html versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 10 00:44:06 2010 From: report at bugs.python.org (Matthew Brett) Date: Sun, 09 May 2010 22:44:06 +0000 Subject: [New-bugs-announce] [issue8672] Error decompressing valid zlib data In-Reply-To: <1273445046.81.0.821535662262.issue8672@psf.upfronthosting.co.za> Message-ID: <1273445046.81.0.821535662262.issue8672@psf.upfronthosting.co.za> New submission from Matthew Brett : I have a valid zlib compressed string, attached here as 'mat.bin' (1.7M), that cause and error on zlib.decompress decompression: >>> import zlib >>> data = open('mat.bin', 'rb').read() >>> out = zlib.decompress(data) Traceback (most recent call last): File "", line 1, in error: Error -5 while decompressing data I know these data are valid, because I get the string I was expecting with: >>> dc_obj = zlib.decompressobj() >>> out = dc_obj.decompress(data) As expected, there is no remaining data after this read: >>> assert dc_obj.flush() == '' >>> I believe that the behavior of zlib.decompress(data) and zlib.decompressobj().decompress(data) should be equivalent, and that the error for zlib.decompress(data) is therefore the symptom of a bug. ---------- components: IO files: mat.bin messages: 105420 nosy: matthew.brett priority: normal severity: normal status: open title: Error decompressing valid zlib data type: behavior versions: Python 2.6, Python 3.1 Added file: http://bugs.python.org/file17279/mat.bin _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 10 12:12:09 2010 From: report at bugs.python.org (Ronald Oussoren) Date: Mon, 10 May 2010 10:12:09 +0000 Subject: [New-bugs-announce] [issue8673] configure script doesn't recognize 10.5 SDK correctly In-Reply-To: <1273486329.72.0.388751753442.issue8673@psf.upfronthosting.co.za> Message-ID: <1273486329.72.0.388751753442.issue8673@psf.upfronthosting.co.za> New submission from Ronald Oussoren : I got a build error when building the 2.7b2 installers because the MacOS module couldn't be build. That turns out to be caused by an issue in the configure script: for some reason the check for the 10.5 SDK gives the wrong answer (both with and without building using the 10.4u SDK). I haven't had time to research the issue and worked around it by hardcoding the right answer in the configure script during my build, but that's obviously not the correct solution. ---------- assignee: ronaldoussoren components: Build, Macintosh messages: 105426 nosy: ronaldoussoren priority: high severity: normal stage: needs patch status: open title: configure script doesn't recognize 10.5 SDK correctly type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 10 15:43:29 2010 From: report at bugs.python.org (Tomas Hoger) Date: Mon, 10 May 2010 13:43:29 +0000 Subject: [New-bugs-announce] [issue8674] audioop: incorrect integer overflow checks In-Reply-To: <1273499009.24.0.283270137147.issue8674@psf.upfronthosting.co.za> Message-ID: <1273499009.24.0.283270137147.issue8674@psf.upfronthosting.co.za> New submission from Tomas Hoger : SVN commit r64114 added integer overflow checks to multiple modules. Checks added to audioop module are incorrect and can still be bypassed: http://svn.python.org/view/python/trunk/Modules/audioop.c?r1=64114&r2=64113 - audioop_tostereo - should be fine, but relies on undefined behaviour - audioop_lin2lin - undetected overflow: size=1, size2=4, len=0x40000001 - audioop_ratecv - undetected overflow: nchannels=0x5fffffff (32bit) - audioop_ulaw2lin - undetected overflow: size=4, len=0x40000001 - audioop_alaw2lin - same as audioop_ulaw2lin - audioop_adpcm2lin - undetected overflow: size=4, len=0x20000001 Most of these are triggered by large fragment as an input. Attached patch replaces checks added in r64114 by checks using INT_MAX. ---------- components: Extension Modules files: python2.6-audioop-int-overflows.diff keywords: patch messages: 105434 nosy: thoger priority: normal severity: normal status: open title: audioop: incorrect integer overflow checks type: security versions: Python 2.6 Added file: http://bugs.python.org/file17281/python2.6-audioop-int-overflows.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 10 20:38:05 2010 From: report at bugs.python.org (Mark Dickinson) Date: Mon, 10 May 2010 18:38:05 +0000 Subject: [New-bugs-announce] [issue8675] audioop module needs an int -> Py_ssize_t upgrade In-Reply-To: <1273516685.47.0.439722259241.issue8675@psf.upfronthosting.co.za> Message-ID: <1273516685.47.0.439722259241.issue8675@psf.upfronthosting.co.za> New submission from Mark Dickinson : The audioop module still uses 'int' for most of its sizes; it would be better if it used 'Py_ssize_t' instead, so that data aren't artificially limited to 2Gb on 64-bit systems. Converting ought to be a fairly straightforward task for someone wanting to get their feet wet with CPython hacking; marking as easy. ---------- keywords: easy messages: 105454 nosy: mark.dickinson priority: normal severity: normal status: open title: audioop module needs an int -> Py_ssize_t upgrade type: performance versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 10 21:29:08 2010 From: report at bugs.python.org (Daniel Urban) Date: Mon, 10 May 2010 19:29:08 +0000 Subject: [New-bugs-announce] [issue8676] Py3k Built-in Exceptions documentation mentions the raise statement of 2.x In-Reply-To: <1273519748.49.0.797934742899.issue8676@psf.upfronthosting.co.za> Message-ID: <1273519748.49.0.797934742899.issue8676@psf.upfronthosting.co.za> New submission from Daniel Urban : In the documentation of the exceptions (http://docs.python.org/dev/py3k/library/exceptions) there is a sentence: "The associated value is the second argument to the raise statement." But in py3k there is a different raise statement than in 2.x. ---------- assignee: docs at python components: Documentation messages: 105457 nosy: docs at python, durban priority: normal severity: normal status: open title: Py3k Built-in Exceptions documentation mentions the raise statement of 2.x versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 10 21:59:40 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 10 May 2010 19:59:40 +0000 Subject: [New-bugs-announce] [issue8677] Modules needing PY_SSIZE_T_CLEAN In-Reply-To: <1273521580.77.0.503810144474.issue8677@psf.upfronthosting.co.za> Message-ID: <1273521580.77.0.503810144474.issue8677@psf.upfronthosting.co.za> New submission from Antoine Pitrou : This is a list of extension modules making use of one of the "#" format codes ("s#", "y#", etc.) without defining PY_SSIZE_T_CLEAN, and therefore being 64-bit unclean: Modules/audioop.c Modules/_cursesmodule.c Modules/_elementtree.c Modules/_gdbmmodule.c Modules/nismodule.c Modules/ossaudiodev.c Modules/pyexpat.c Modules/socketmodule.c Modules/_ssl.c Modules/unicodedata.c ---------- components: Extension Modules messages: 105461 nosy: pitrou priority: normal severity: normal stage: needs patch status: open title: Modules needing PY_SSIZE_T_CLEAN type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 10 23:24:02 2010 From: report at bugs.python.org (Brett Cannon) Date: Mon, 10 May 2010 21:24:02 +0000 Subject: [New-bugs-announce] [issue8678] crashers in rgbimg In-Reply-To: <1273526642.93.0.89259252042.issue8678@psf.upfronthosting.co.za> Message-ID: <1273526642.93.0.89259252042.issue8678@psf.upfronthosting.co.za> New submission from Brett Cannon : Red Hat found some crashers in the rgbimg module along with a proposed patch: https://bugzilla.redhat.com/show_bug.cgi?id=541698 . Since the patch was sent to the PSRT privately before the bugs were announced, it should be fine to take the patch from the page and apply it. ---------- messages: 105467 nosy: brett.cannon priority: normal severity: normal status: open title: crashers in rgbimg type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon May 10 23:39:33 2010 From: report at bugs.python.org (=?utf-8?q?Tarek_Ziad=C3=A9?=) Date: Mon, 10 May 2010 21:39:33 +0000 Subject: [New-bugs-announce] [issue8679] write a distutils to distutils2 converter In-Reply-To: <1273527573.05.0.844239277503.issue8679@psf.upfronthosting.co.za> Message-ID: <1273527573.05.0.844239277503.issue8679@psf.upfronthosting.co.za> New submission from Tarek Ziad? : write a script that converts a distutils or setuptools based setup.py script into a distutils2 one. This script will need to parse the AST and generate a new setup.py, using a few transformation rules. ---------- assignee: tarek components: Distutils2 messages: 105468 nosy: tarek priority: normal severity: normal status: open title: write a distutils to distutils2 converter type: feature request _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 00:15:48 2010 From: report at bugs.python.org (=?utf-8?q?Tarek_Ziad=C3=A9?=) Date: Mon, 10 May 2010 22:15:48 +0000 Subject: [New-bugs-announce] [issue8680] Add a sandbox in Distutils2 In-Reply-To: <1273529748.63.0.145688721875.issue8680@psf.upfronthosting.co.za> Message-ID: <1273529748.63.0.145688721875.issue8680@psf.upfronthosting.co.za> New submission from Tarek Ziad? : Add a sandbox in distutils2, so all installation steps can be recorded or controlled. Usage example: a dry-run mode that prevents anything to be written on the disk but just reports. See setuptools.sandbox for example ---------- assignee: tarek components: Distutils2 messages: 105471 nosy: tarek priority: normal severity: normal status: open title: Add a sandbox in Distutils2 type: feature request _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 00:37:39 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 10 May 2010 22:37:39 +0000 Subject: [New-bugs-announce] [issue8681] Make the zlib module emit more detailed error messages In-Reply-To: <1273531059.62.0.905439523154.issue8681@psf.upfronthosting.co.za> Message-ID: <1273531059.62.0.905439523154.issue8681@psf.upfronthosting.co.za> New submission from Antoine Pitrou : This is a patch to use our own error descriptions when the zlib doesn't provide anything in particular. It would have made issue8672 easier to diagnose for the reporter (and for us). ---------- components: Extension Modules files: zliberrors.patch keywords: patch messages: 105476 nosy: gregory.p.smith, pitrou priority: normal severity: normal stage: patch review status: open title: Make the zlib module emit more detailed error messages type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 Added file: http://bugs.python.org/file17287/zliberrors.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 01:32:11 2010 From: report at bugs.python.org (Antoine Pitrou) Date: Mon, 10 May 2010 23:32:11 +0000 Subject: [New-bugs-announce] [issue8682] _ssl.c uses PyWeakref_GetObject but doesn't incref result In-Reply-To: <1273534331.53.0.523751841318.issue8682@psf.upfronthosting.co.za> Message-ID: <1273534331.53.0.523751841318.issue8682@psf.upfronthosting.co.za> New submission from Antoine Pitrou : PyWeakref_GetObject() returns a borrowed reference, which can therefore become invalid at any time (especially when the GIL gets released). This provides a way to crash the interpreter deliberately. The returned reference should be incref'ed immediately before any other action is taken. ---------- assignee: pitrou components: Extension Modules messages: 105481 nosy: pitrou priority: normal severity: normal stage: needs patch status: open title: _ssl.c uses PyWeakref_GetObject but doesn't incref result type: crash versions: Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 02:51:42 2010 From: report at bugs.python.org (srid) Date: Tue, 11 May 2010 00:51:42 +0000 Subject: [New-bugs-announce] [issue8683] HPUX Segmentation Fault in Modules/gcmodule.c -- if (!gc_list_is_empty(from)) { In-Reply-To: <1273539102.07.0.573681131536.issue8683@psf.upfronthosting.co.za> Message-ID: <1273539102.07.0.573681131536.issue8683@psf.upfronthosting.co.za> New submission from srid : Platform: HP-UX B.11.22 U ia64 Python: 2.7 trunk GDB output when running built `python` binary: Program received signal SIGSEGV, Segmentation fault (si_code: 1). 0x40000000002a2510:1 in gc_list_merge (from=0x148, to=0x148) at Modules/gcmodule.c:240 240 if (!gc_list_is_empty(from)) { and the stack trace: (gdb) bt #0 0x40000000002a2510:1 in gc_list_merge (from=0x148, to=0x148) at Modules/gcmodule.c:240 #1 0x40000000002a4720:0 in collect (generation=0) at Modules/gcmodule.c:975 #2 0x40000000002a6620:0 in _PyObject_GC_Malloc (basicsize=65598) at Modules/gcmodule.c:996 #3 0x400000000018e540:0 in PyType_GenericAlloc (type=0x1003e, nitems=65598) at Objects/typeobject.c:743 #4 0x40000000003107d0:0 in PyDescr_NewWrapper (type=0x0, base=0x1003e, wrapped=0x1003e) at Objects/descrobject.c:641 #5 0x40000000001a4570:0 in add_operators (type=0x0) at Objects/typeobject.c:6388 #6 0x4000000000193670:0 in PyType_Ready (type=0x1003e) at Objects/typeobject.c:4003 #7 0x40000000001485b0:0 in _Py_ReadyTypes () at Objects/object.c:2092 #8 0x4000000000270980:0 in Py_InitializeEx (install_sigs=0) at Python/pythonrun.c:176 #9 0x40000000002720e0:0 in Py_Initialize () at Python/pythonrun.c:370 #10 0x400000000009da70:0 in Py_Main (argc=0, argv=0x0) at Modules/main.c:507 #11 0x400000000009c770:0 in main (argc=0, argv=0x0) at ./Modules/python.c:23 ---------- components: Interpreter Core messages: 105482 nosy: srid priority: normal severity: normal status: open title: HPUX Segmentation Fault in Modules/gcmodule.c -- if (!gc_list_is_empty(from)) { type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 06:27:50 2010 From: report at bugs.python.org (Josiah Carlson) Date: Tue, 11 May 2010 04:27:50 +0000 Subject: [New-bugs-announce] [issue8684] improvements to sched.py In-Reply-To: <1273552070.58.0.496415961493.issue8684@psf.upfronthosting.co.za> Message-ID: <1273552070.58.0.496415961493.issue8684@psf.upfronthosting.co.za> New submission from Josiah Carlson : This patch is against Python trunk, but it could be easily targeted for Python 3.2 . It is meant to extract the scheduler updates from issue1641 without mucking with asyncore. It's reach is reduced and simplified, which should make maintenance a bit easier. ---------- assignee: giampaolo.rodola components: Library (Lib) files: sched.patch keywords: needs review, patch, patch messages: 105483 nosy: giampaolo.rodola, josiahcarlson priority: low severity: normal status: open title: improvements to sched.py type: feature request Added file: http://bugs.python.org/file17289/sched.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 11:04:19 2010 From: report at bugs.python.org (Andrew Bennetts) Date: Tue, 11 May 2010 09:04:19 +0000 Subject: [New-bugs-announce] [issue8685] set(range(100000)).difference(set()) is slow In-Reply-To: <1273568659.49.0.865922101958.issue8685@psf.upfronthosting.co.za> Message-ID: <1273568659.49.0.865922101958.issue8685@psf.upfronthosting.co.za> New submission from Andrew Bennetts : set.difference(s), when s is also a set, basically does:: res = set() for elem in self: if elem not in other: res.add(elem) This is wasteful when len(self) is much greater than len(other): $ python -m timeit -s "s = set(range(100000)); sd = s.difference; empty = set()" "sd(empty)" 100 loops, best of 3: 12.8 msec per loop $ python -m timeit -s "s = set(range(10)); sd = s.difference; empty = set()" "sd(empty)" 1000000 loops, best of 3: 1.18 usec per loop Here's a patch that compares the lengths of self and other before that loop, and if len(self) is greater, swaps them. The new timeit results are: $ python -m timeit -s "s = set(range(100000)); sd = s.difference; empty = set()" "sd(empty)" 1000000 loops, best of 3: 0.289 usec per loop $ python -m timeit -s "s = set(range(10)); sd = s.difference; empty = set()" "sd(empty)" 1000000 loops, best of 3: 0.294 usec per loop ---------- components: Interpreter Core files: set-difference-speedup.diff keywords: patch messages: 105489 nosy: spiv priority: normal severity: normal status: open title: set(range(100000)).difference(set()) is slow type: performance versions: Python 2.7 Added file: http://bugs.python.org/file17292/set-difference-speedup.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 13:13:56 2010 From: report at bugs.python.org (INADA Naoki) Date: Tue, 11 May 2010 11:13:56 +0000 Subject: [New-bugs-announce] [issue8686] "This isn't defined beyond that" phrase is not friendly to non-native English speakers. In-Reply-To: <1273576436.16.0.861526907899.issue8686@psf.upfronthosting.co.za> Message-ID: <1273576436.16.0.861526907899.issue8686@psf.upfronthosting.co.za> New submission from INADA Naoki : http://docs.python.org/library/difflib.html#difflib.SequenceMatcher.quick_ratio > This isn?t defined beyond that it is an upper bound on ratio(), and is faster to compute. "beyond" is a bit confusing because it also means "over" and this sentence refers upper bound. I think "This isn't defined in detail more than..." is easier. ---------- assignee: docs at python components: Documentation messages: 105498 nosy: docs at python, naoki priority: normal severity: normal status: open title: "This isn't defined beyond that" phrase is not friendly to non-native English speakers. versions: Python 2.6, Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 14:28:06 2010 From: report at bugs.python.org (Giampaolo Rodola') Date: Tue, 11 May 2010 12:28:06 +0000 Subject: [New-bugs-announce] [issue8687] sched.py module doesn't have a test suite In-Reply-To: <1273580886.01.0.152818867035.issue8687@psf.upfronthosting.co.za> Message-ID: <1273580886.01.0.152818867035.issue8687@psf.upfronthosting.co.za> New submission from Giampaolo Rodola' : sched.py module is currently lacking a test suite. Possibly this should be resolved before fixing issue 8684. ---------- components: Tests messages: 105503 nosy: giampaolo.rodola, josiah.carlson, josiahcarlson, pitrou priority: normal severity: normal status: open title: sched.py module doesn't have a test suite versions: Python 2.7, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 14:32:48 2010 From: report at bugs.python.org (Ronald Oussoren) Date: Tue, 11 May 2010 12:32:48 +0000 Subject: [New-bugs-announce] [issue8688] distutils sdist is too laze w.r.t. recalculating MANIFEST In-Reply-To: <1273581168.94.0.337026684583.issue8688@psf.upfronthosting.co.za> Message-ID: <1273581168.94.0.337026684583.issue8688@psf.upfronthosting.co.za> New submission from Ronald Oussoren : The sdist command in distutils calculates the MANIFEST file from a template (by default MANIFEST.in). The code in sdist assumes that the contents of MANIFEST only depends on MANIFEST.in and setup.py, which can cause files to be missed when building an sdist. In particular: given a MANIFEST.in file that includes all documentation in a 'Doc' subdirectory, using"recursive-include Doc *.txt" in the template, the MANIFEST won't get regenerated when a new file is added to the documentation subdirectory and hence that new file is not included in sdist distributions. ---------- assignee: tarek components: Distutils messages: 105505 nosy: ronaldoussoren, tarek priority: normal severity: normal stage: needs patch status: open title: distutils sdist is too laze w.r.t. recalculating MANIFEST type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 18:27:02 2010 From: report at bugs.python.org (Simon Jagoe) Date: Tue, 11 May 2010 16:27:02 +0000 Subject: [New-bugs-announce] [issue8689] sqlite3 parameter substitution breaks with multiple parameters In-Reply-To: <1273595222.03.0.475415636905.issue8689@psf.upfronthosting.co.za> Message-ID: <1273595222.03.0.475415636905.issue8689@psf.upfronthosting.co.za> New submission from Simon Jagoe : I have been using sqlalchemy and sqlamp in a project for a while with Python 2.5.x and Python 2.6.4. With a recent upgrade to Python 2.6.5 (on Ubuntu Lucid Lynx), a particular operation began to fail when using sqlite. I have tracked this to using the sqlite3 module and multiple parameter substitution. See below for a simple test case. Set up the database: >>> import sqlite3 >>> conn = sqlite3.connect('test.sqlite3') >>> c = conn.cursor() >>> c.execute('create table test (col integer)') >>> c.execute('insert into test values (1)') >>> conn.commit() Actual result: >>> c.execute('SELECT coalesce(max(test.col), ?) + ? AS col FROM test', (0, 1)) >>> c.fetchone() (None,) Expected result: >>> c.execute('SELECT coalesce(max(test.col), ?) + ? AS col FROM test', (0, 1)) >>> c.fetchone() (2,) The expected result can be simulated like this: >>> c.execute('SELECT coalesce(max(test.col), 0) + 1 AS col FROM test') >>> c.fetchone() (2,) ---------- messages: 105525 nosy: azriphale priority: normal severity: normal status: open title: sqlite3 parameter substitution breaks with multiple parameters versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 20:39:44 2010 From: report at bugs.python.org (Jason Baker) Date: Tue, 11 May 2010 18:39:44 +0000 Subject: [New-bugs-announce] [issue8690] multiprocessing.dummy.Queue does not expose same interface as multiprocessing.Queue In-Reply-To: <1273603184.02.0.789462329458.issue8690@psf.upfronthosting.co.za> Message-ID: <1273603184.02.0.789462329458.issue8690@psf.upfronthosting.co.za> New submission from Jason Baker : The multiprocessing.dummy.Queue class is merely an import of Queue.Queue. There are a few methods that this does not provide however: close, join_thread, and cancel_join_thread. I don't know what the best way to handle this is, but it should be pretty trivial to add methods that do nothing or at least throw a NotImplementedError. ---------- components: Library (Lib) messages: 105533 nosy: Jason.Baker priority: normal severity: normal status: open title: multiprocessing.dummy.Queue does not expose same interface as multiprocessing.Queue versions: Python 2.6, Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 22:21:18 2010 From: report at bugs.python.org (Terry J. Reedy) Date: Tue, 11 May 2010 20:21:18 +0000 Subject: [New-bugs-announce] [issue8691] Doc: left alignment is not the default for numbers In-Reply-To: <1273609278.89.0.493567914757.issue8691@psf.upfronthosting.co.za> Message-ID: <1273609278.89.0.493567914757.issue8691@psf.upfronthosting.co.za> New submission from Terry J. Reedy : As reported on python-list by Alan G Isaac, Lib Ref 6.1.3.1. Format Specification Mini-Language, for instance http://docs.python.org/dev/py3k/library/string.html#formatstrings wrongly says in the alignment section "'<' Forces the field to be left-aligned within the available space (This is the default.)" This latter, of course, is not true for number fields. "(This is the default.)" could be replaced by "(the string default)." (in any case, the '.' should be outside the () unless one is added after 'space' before '(') and "(the number default)" added to the next line. Or instead the issue of defaults could be addressed in the text below the table. I am assuming that this issue affects 2.6/7. ---------- assignee: docs at python components: Documentation messages: 105536 nosy: docs at python, tjreedy priority: normal severity: normal status: open title: Doc: left alignment is not the default for numbers versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue May 11 22:23:01 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Tue, 11 May 2010 20:23:01 +0000 Subject: [New-bugs-announce] [issue8692] Use divide-and-conquer for faster factorials In-Reply-To: <1273609381.14.0.711112369478.issue8692@psf.upfronthosting.co.za> Message-ID: <1273609381.14.0.711112369478.issue8692@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : (Making an educated guess about who to add to the Nosy list) Attached is a patch to improve math.factorial by using a divide-and-conquer algorithm. The old algorithm performs n-1 multiplications, mostly on numbers with a very large number of digits. The algorithm in this patch: - implicitly factors out all powers of two and applies a left-shift at the end. - performs roughly half as many multiplications (around n/2 + 2*lg n) - groups the multiplications so most multiplications are on small numbers - uses a lookup table for n <= 12 There are faster factorial algorithms available, but they're significantly more complicated and rely on a fast prime factorization function. This one is around 125 lines of code in C (with comments). I have a pure-Python version that's around 25 lines of code, if anyone is interested. Here are some timing results for different values of n: n : old algorithm : new algorithm 1 0.14 us 0.10 us 10 0.63 us 0.12 us 13 0.81 us 0.76 us 100 12.6 us 4.92 us 1k 576 us 118 us 10k 53.6 ms 8.16 ms 100k 12.1 s 443 ms 1M 27 min 23 s 10M forget it 20 min I tested that both algorithms return the same answer for all values of n up to 10,000. ---------- assignee: stutzbach components: Extension Modules files: factorial.patch keywords: needs review, patch, patch messages: 105537 nosy: mark.dickinson, rhettinger, stutzbach priority: normal severity: normal stage: patch review status: open title: Use divide-and-conquer for faster factorials type: performance versions: Python 3.2 Added file: http://bugs.python.org/file17300/factorial.patch _______________________________________ Python tracker _______________________________________ From mbnoimi at gmx.com Wed May 12 05:56:32 2010 From: mbnoimi at gmx.com (M. Bashir Al-Noimi) Date: Wed, 12 May 2010 05:56:32 +0200 Subject: [New-bugs-announce] Py_Initialize: can't initialize sys standard streams Message-ID: <4BEA26F0.4000400@gmx.com> Hi All, After installing python-3.1.2.msi I'm not able to run to python.exe at all because it gives me the following error message: > Fatal Python error: Py_Initialize: can't initialize sys standard streams > LookupError: unknown encoding: cp720 > > This application has requested the Runtime to terminate it in an > unusual way. > Please contact the application's support team for more information. *How I can fix this issue?* *PS* * I'm using WinXp SP3 32Bit * I uninstalled python-2.6.3 before installing python-3.1.2.msi -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From report at bugs.python.org Wed May 12 05:25:19 2010 From: report at bugs.python.org (Muhammad Bashir Al-Noimi) Date: Wed, 12 May 2010 03:25:19 +0000 Subject: [New-bugs-announce] [issue8693] Py_Initialize: can't initialize sys standard streams In-Reply-To: <1273634719.18.0.842243568226.issue8693@psf.upfronthosting.co.za> Message-ID: <1273634719.18.0.842243568226.issue8693@psf.upfronthosting.co.za> New submission from Muhammad Bashir Al-Noimi : After installing python-3.1.2.msi I'm not able to run to python.exe at all because it gives me the following error message: Fatal Python error: Py_Initialize: can't initialize sys standard streams LookupError: unknown encoding: cp720 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. PS * I'm using WinXp SP3 32Bit ---------- components: Windows files: error.log messages: 105566 nosy: mbnoimi priority: normal severity: normal status: open title: Py_Initialize: can't initialize sys standard streams type: crash versions: Python 3.1 Added file: http://bugs.python.org/file17302/error.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 12 08:14:31 2010 From: report at bugs.python.org (Nathan Phillip Brink) Date: Wed, 12 May 2010 06:14:31 +0000 Subject: [New-bugs-announce] [issue8694] python3 FAQ mentions unicode() In-Reply-To: <1273644871.8.0.754393677422.issue8694@psf.upfronthosting.co.za> Message-ID: <1273644871.8.0.754393677422.issue8694@psf.upfronthosting.co.za> New submission from Nathan Phillip Brink : http://docs.python.org/py3k/faq/programming.html#what-does-unicodeerror-ascii-decoding-encoding-error-ordinal-not-in-range-128-mean When I try to use unicode() from within python3, the call fails. I would actually expect that the FAQ should contain more information concerning the merging of the unicode and str classes. It would be nice if, when this FAQ entry is updated, there is a short discussion on making the code compatible with both python2 and python3, as it appears that's the only way python3 adaption will ever happen. ---------- assignee: docs at python components: Documentation messages: 105574 nosy: docs at python, ohnobinki priority: normal severity: normal status: open title: python3 FAQ mentions unicode() versions: Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 12 12:51:26 2010 From: report at bugs.python.org (Senthil) Date: Wed, 12 May 2010 10:51:26 +0000 Subject: [New-bugs-announce] [issue8695] Issue while installing Python 2.6.5 in IBM AIX 6.1 In-Reply-To: <1273661486.25.0.2216975723.issue8695@psf.upfronthosting.co.za> Message-ID: <1273661486.25.0.2216975723.issue8695@psf.upfronthosting.co.za> New submission from Senthil : Hi, I am trying to install Python 2.6.5 in IBM AIX(6.1) machine. The make seems to failing with the following error. Fatal Python error: Interpreter not initialized (version mismatch?) make: *** [sharedmods] IOT/Abort trap (core dumped) ---------- components: Build files: logs.zip messages: 105580 nosy: senthil_l priority: normal severity: normal status: open title: Issue while installing Python 2.6.5 in IBM AIX 6.1 type: crash versions: Python 2.6 Added file: http://bugs.python.org/file17305/logs.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 12 16:27:13 2010 From: report at bugs.python.org (A.M. Kuchling) Date: Wed, 12 May 2010 14:27:13 +0000 Subject: [New-bugs-announce] [issue8696] PEP 391: Adding documentation of logging.config.dictConfig In-Reply-To: <1273674433.57.0.0627786943755.issue8696@psf.upfronthosting.co.za> Message-ID: <1273674433.57.0.0627786943755.issue8696@psf.upfronthosting.co.za> New submission from A.M. Kuchling : The attached patch adds a first cut at documenting the PEP 391 dictConfig() feature. I've taken the PEP 391 text and rearranged it to fit into the existing logging module docs. I haven't gone through every paragraph and adjusted the markup to use Sphinx roles. Vinay: I don't think you need to proofread every single bit of text in this patch. I suggest you look at the following things: * The start of the 'Configuring Logging' section, which I rewrote. * The description of dictConfig(), which is assembled from several bits of the PEP. * The details of the dictionary schema are moved to be first instead of last. I therefore rewrote the paragraph in the PEP beginning "Before describing the schema in detail..." to one that begins "Describing a logging configuration requires listing..." Is the new paragraph OK? If you like the resulting ordering and the rewritten text, then I'll go through the rest of the text adding Sphinx markup, and commit the result. Thanks! ---------- assignee: vinay.sajip components: Documentation files: pep391-docs.txt keywords: needs review, patch messages: 105587 nosy: akuchling, vinay.sajip priority: low severity: normal stage: patch review status: open title: PEP 391: Adding documentation of logging.config.dictConfig versions: Python 2.7 Added file: http://bugs.python.org/file17308/pep391-docs.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 12 16:27:13 2010 From: report at bugs.python.org (A.M. Kuchling) Date: Wed, 12 May 2010 14:27:13 +0000 Subject: [New-bugs-announce] [issue8697] PEP 391: Adding documentation of logging.config.dictConfig In-Reply-To: <1273674433.55.0.29048689936.issue8697@psf.upfronthosting.co.za> Message-ID: <1273674433.55.0.29048689936.issue8697@psf.upfronthosting.co.za> New submission from A.M. Kuchling : The attached patch adds a first cut at documenting the PEP 391 dictConfig() feature. I've taken the PEP 391 text and rearranged it to fit into the existing logging module docs. I haven't gone through every paragraph and adjusted the markup to use Sphinx roles. Vinay: I don't think you need to proofread every single bit of text in this patch. I suggest you look at the following things: * The start of the 'Configuring Logging' section, which I rewrote. * The description of dictConfig(), which is assembled from several bits of the PEP. * The details of the dictionary schema are moved to be first instead of last. I therefore rewrote the paragraph in the PEP beginning "Before describing the schema in detail..." to one that begins "Describing a logging configuration requires listing..." Is the new paragraph OK? If you like the resulting ordering and the rewritten text, then I'll go through the rest of the text adding Sphinx markup, and commit the result. Thanks! ---------- assignee: vinay.sajip components: Documentation files: pep391-docs.txt keywords: needs review, patch messages: 105588 nosy: akuchling, vinay.sajip priority: low severity: normal stage: patch review status: open title: PEP 391: Adding documentation of logging.config.dictConfig versions: Python 2.7 Added file: http://bugs.python.org/file17307/pep391-docs.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 12 16:27:17 2010 From: report at bugs.python.org (A.M. Kuchling) Date: Wed, 12 May 2010 14:27:17 +0000 Subject: [New-bugs-announce] [issue8698] PEP 391: Adding documentation of logging.config.dictConfig In-Reply-To: <1273674437.89.0.924445396649.issue8698@psf.upfronthosting.co.za> Message-ID: <1273674437.89.0.924445396649.issue8698@psf.upfronthosting.co.za> New submission from A.M. Kuchling : The attached patch adds a first cut at documenting the PEP 391 dictConfig() feature. I've taken the PEP 391 text and rearranged it to fit into the existing logging module docs. I haven't gone through every paragraph and adjusted the markup to use Sphinx roles. Vinay: I don't think you need to proofread every single bit of text in this patch. I suggest you look at the following things: * The start of the 'Configuring Logging' section, which I rewrote. * The description of dictConfig(), which is assembled from several bits of the PEP. * The details of the dictionary schema are moved to be first instead of last. I therefore rewrote the paragraph in the PEP beginning "Before describing the schema in detail..." to one that begins "Describing a logging configuration requires listing..." Is the new paragraph OK? If you like the resulting ordering and the rewritten text, then I'll go through the rest of the text adding Sphinx markup, and commit the result. Thanks! ---------- assignee: vinay.sajip components: Documentation files: pep391-docs.txt keywords: needs review, patch messages: 105589 nosy: akuchling, vinay.sajip priority: low severity: normal stage: patch review status: open title: PEP 391: Adding documentation of logging.config.dictConfig versions: Python 2.7 Added file: http://bugs.python.org/file17309/pep391-docs.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 12 17:00:48 2010 From: report at bugs.python.org (Daniel Urban) Date: Wed, 12 May 2010 15:00:48 +0000 Subject: [New-bugs-announce] [issue8699] Equality and hashing for functools.partial In-Reply-To: <1273676448.87.0.841686829268.issue8699@psf.upfronthosting.co.za> Message-ID: <1273676448.87.0.841686829268.issue8699@psf.upfronthosting.co.za> New submission from Daniel Urban : On python-dev came up an idea [1] to support equality (== and !=) and hashing by functools.partial instances. Van Lindberg provided an implementation written in Python [2]. I've made a very similar implementation in C (in Modules/_functoolsmodule.c). The Python equivalent of my code is in Lib/test/test_functools.py as the PythonPartialCls class. The hashing differs a little from Van Lindberg's implementation: I'm computing the "normal form" of the dict as the sorted list of its items (not as the sorted list of the keys followed by the items). (It was easier to implement this way.) I haven't made a lot of Python programming in C, so I'm not sure I made everything in the right way (especially the reference counting). Anyway, I'm attaching my patch. I'd appreciate every suggestion, and will try to correct my mistakes. Thanks! [1] http://mail.python.org/pipermail/python-dev/2010-May/099981.html [2] http://mail.python.org/pipermail/python-dev/2010-May/099996.html ---------- components: Extension Modules files: partial_eq_hash.diff keywords: patch messages: 105591 nosy: durban priority: normal severity: normal status: open title: Equality and hashing for functools.partial type: feature request versions: Python 3.2 Added file: http://bugs.python.org/file17311/partial_eq_hash.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 12 20:29:39 2010 From: report at bugs.python.org (Balachander Ganesan) Date: Wed, 12 May 2010 18:29:39 +0000 Subject: [New-bugs-announce] [issue8700] strip() is removing an extra character if the strip pattern contains "-" In-Reply-To: <1273688979.04.0.976435378464.issue8700@psf.upfronthosting.co.za> Message-ID: <1273688979.04.0.976435378464.issue8700@psf.upfronthosting.co.za> New submission from Balachander Ganesan : Version: ======== Python 2.4.3 (#1, Jan 14 2008, 18:31:21) [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2 Description: ============ When the pattern used for strip contains "-" character then it removes one more characters next to it. >>> a = 'image-abc-1.2.0-12_1234_123' >>> b = a.strip('image-') >>> print b bc-1.2.0-12_1234_123 >From the above print statement we can see that instead of 'bc-1.2.0-12_1234_123', it prints only 'bc-1.2.0-12_1234_123'. The first character "a" next to "-" is missing. ---------- components: Library (Lib) messages: 105598 nosy: Balachander.Ganesan priority: normal severity: normal status: open title: strip() is removing an extra character if the strip pattern contains "-" type: behavior versions: 3rd party _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed May 12 23:19:39 2010 From: report at bugs.python.org (Poor Yorick) Date: Wed, 12 May 2010 21:19:39 +0000 Subject: [New-bugs-announce] [issue8701] tarfile: first character of member names doubled In-Reply-To: <1273699179.4.0.239975221626.issue8701@psf.upfronthosting.co.za> Message-ID: <1273699179.4.0.239975221626.issue8701@psf.upfronthosting.co.za> New submission from Poor Yorick : In the following file, for python 2.6.4, tarfile.list doubles the first character of each member name: http://watson.nci.nih.gov/cran_mirror/src/contrib/Archive/time/time_1.0.tar.gz gnu tar handles the file correctly ---------- components: Library (Lib) messages: 105609 nosy: pooryorick priority: normal severity: normal status: open title: tarfile: first character of member names doubled versions: Python 2.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 13 10:05:26 2010 From: report at bugs.python.org (anatoly techtonik) Date: Thu, 13 May 2010 08:05:26 +0000 Subject: [New-bugs-announce] [issue8702] difflib: unified_diff produces wrong patches (again) In-Reply-To: <1273737926.93.0.83825384013.issue8702@psf.upfronthosting.co.za> Message-ID: <1273737926.93.0.83825384013.issue8702@psf.upfronthosting.co.za> New submission from anatoly techtonik : If source/target file for unified format diff context doesn't end with new line, the diff should contain this marker: \ No newline at end of file Or else there is information loss when such patch is applied. http://en.wikipedia.org/wiki/Diff#Unified_format ---------- components: Library (Lib) messages: 105630 nosy: techtonik priority: normal severity: normal status: open title: difflib: unified_diff produces wrong patches (again) versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 13 12:16:16 2010 From: report at bugs.python.org (Daniel Urban) Date: Thu, 13 May 2010 10:16:16 +0000 Subject: [New-bugs-announce] [issue8703] Py3k PyList_Type documentation mentions types.ListType In-Reply-To: <1273745776.41.0.112445145635.issue8703@psf.upfronthosting.co.za> Message-ID: <1273745776.41.0.112445145635.issue8703@psf.upfronthosting.co.za> New submission from Daniel Urban : The Py3k documentation of PyList_Type [1] contains the sentence: "This is the same object as list and types.ListType in the Python layer." But there is no types.ListType object in py3k. [1] http://docs.python.org/dev/py3k/c-api/list.html#PyList_Type ---------- assignee: docs at python components: Documentation messages: 105631 nosy: docs at python, durban priority: normal severity: normal status: open title: Py3k PyList_Type documentation mentions types.ListType versions: Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu May 13 16:12:52 2010 From: report at bugs.python.org (Daniel Stutzbach) Date: Thu, 13 May 2010 14:12:52 +0000 Subject: [New-bugs-announce] [issue8704] cgitb sends a bogus HTTP header if the app crashes before finishing headers In-Reply-To: <1273759972.28.0.178671810955.issue8704@psf.upfronthosting.co.za> Message-ID: <1273759972.28.0.178671810955.issue8704@psf.upfronthosting.co.za> New submission from Daniel Stutzbach : If the CGI script crashes before finishing the headers, cgitb will emit invalid HTTP headers before showing the error message. Below are HTTP headers I received, captured with a packet sniffer. Note the "<--: spam". HTTP/1.1 200 OK Date: Thu, 13 May 2010 14:00:42 GMT Server: Apache/2.2.9