From report at bugs.python.org Sat Feb 1 01:08:42 2014 From: report at bugs.python.org (A Hettinger) Date: Sat, 01 Feb 2014 00:08:42 +0000 Subject: [New-bugs-announce] [issue20469] ssl.getpeercert() should include extensions Message-ID: <1391213322.18.0.0407523257896.issue20469@psf.upfronthosting.co.za> New submission from A Hettinger: I have crafted an ssl cert which contains a custom extension, when I check the cert using OpenSSL on the commandline, I clearly see the extension, but when I have the server try to pprint.pprint(s.getpeercert()), I do not see these fields. Overall, I think it would be helpful to include extensions in ssl.getpeercert()'s returned list, but if there is a workaround for this (probably rare) issue, I would appreciate it. (I have only tested 3.4, not head) ---------- components: Extension Modules messages: 209850 nosy: oninoshiko priority: normal severity: normal status: open title: ssl.getpeercert() should include extensions versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 1 03:30:10 2014 From: report at bugs.python.org (STINNER Victor) Date: Sat, 01 Feb 2014 02:30:10 +0000 Subject: [New-bugs-announce] [issue20470] "Fatal Python error: Bus error" on the SPARC Solaris 10 buildbot Message-ID: <1391221810.73.0.133738651444.issue20470@psf.upfronthosting.co.za> New submission from STINNER Victor: On the buildbot "SPARC Solaris 10 (cc, 64b) [SB] 3.x", Python crash randomly with bus error. It looks like a regression introduced since the build 1422. Since it's a crash, it probably comes from a change in C module and so I expected this changeset: http://hg.python.org/cpython/rev/2fbb3c77f1577acc60f57401e07d7feceea66841 "Issue #17919: Fixed integer overflow in the eventmask parameter." => see issue #17919 http://buildbot.python.org/all/builders/SPARC%20Solaris%2010%20%28cc%2C%2064b%29%20%5BSB%5D%203.x/builds/1422/ Change #34778 Category None Changed by R David Murray Changed at Sat 14 Dec 2013 16:26:20 Branch default Revision 561822250761b47d643656a0be9c71f9d770252b Comments #19970: fix additional typo in 3.4 asyncio docs. Changed files Doc/library/asyncio-protocol.rst Change #34781 Category None Changed by Serhiy Storchaka Changed at Sat 14 Dec 2013 17:19:15 Branch default Revision 2fbb3c77f1577acc60f57401e07d7feceea66841 Comments Issue #17919: Fixed integer overflow in the eventmask parameter. Changed files Lib/test/test_devpoll.py Lib/test/test_poll.py Misc/NEWS Modules/selectmodule.c Change #34784 Category None Changed by Serhiy Storchaka Changed at Sat 14 Dec 2013 18:43:21 Branch default Revision 804406d79b45d02b1ea0ae2da45cfd5769141830 Comments Issue #19623: Fixed writing to unseekable files in the aifc module. Changed files Lib/aifc.py Lib/test/audiotests.py Lib/test/test_aifc.py Lib/test/test_sunau.py Lib/test/test_wave.py Misc/NEWS Change #34786 Category None Changed by Serhiy Storchaka Changed at Sat 14 Dec 2013 19:08:18 Branch default Revision 953d8ec1aeb3bff787204343a1c1837a17dbf68c Comments Null merge Changed files Lib/test/test_getargs2.py Lib/test/test_index.py Lib/test/test_int.py Misc/NEWS Objects/abstract.c Objects/longobject.c ---------- messages: 209861 nosy: haypo priority: normal severity: normal status: open title: "Fatal Python error: Bus error" on the SPARC Solaris 10 buildbot versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 1 04:14:10 2014 From: report at bugs.python.org (STINNER Victor) Date: Sat, 01 Feb 2014 03:14:10 +0000 Subject: [New-bugs-announce] [issue20471] test_signature_on_class() of test_inspect fails on "AMD64 FreeBSD 9.0 3.x" buildbot Message-ID: <1391224450.54.0.294439950021.issue20471@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/6302/steps/test/logs/stdio ====================================================================== ERROR: test_signature_on_class (test.test_inspect.TestSignatureObject) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_inspect.py", line 2198, in test_signature_on_class self.assertEqual(str(inspect.signature(C)), '()') File "/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/inspect.py", line 1734, in signature return signature(object) File "/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/inspect.py", line 1695, in signature return Signature.from_builtin(obj) File "/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/inspect.py", line 2196, in from_builtin raise ValueError("no signature found for builtin {!r}".format(func)) ValueError: no signature found for builtin ---------- messages: 209869 nosy: haypo, larry priority: normal severity: normal status: open title: test_signature_on_class() of test_inspect fails on "AMD64 FreeBSD 9.0 3.x" buildbot versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 1 04:20:19 2014 From: report at bugs.python.org (STINNER Victor) Date: Sat, 01 Feb 2014 03:20:19 +0000 Subject: [New-bugs-announce] [issue20472] test_write_pty() of test_asyncio fails on "x86 Tiger 3.x" buildbot Message-ID: <1391224819.03.0.550911452449.issue20472@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/x86%20Tiger%203.x/builds/7801/steps/test/logs/stdio ====================================================================== FAIL: test_write_pty (test.test_asyncio.test_events.PollEventLoopTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_asyncio/test_events.py", line 1105, in test_write_pty self.assertEqual(b'1', data) AssertionError: b'1' != b'' ---------- messages: 209870 nosy: gvanrossum, haypo, pitrou priority: normal severity: normal status: open title: test_write_pty() of test_asyncio fails on "x86 Tiger 3.x" buildbot _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 1 04:42:17 2014 From: report at bugs.python.org (Larry Hastings) Date: Sat, 01 Feb 2014 03:42:17 +0000 Subject: [New-bugs-announce] [issue20473] inspect.Signature no longer handles builtin classes correctly Message-ID: <1391226137.37.0.568949403046.issue20473@psf.upfronthosting.co.za> New submission from Larry Hastings: Yury: In revision 9433b380ad33 you changed inspect.Signature so that it cannot handle builtin classes. Please fix it. >>> import _pickle >>> import inspect >>> str(inspect.signature(_pickle.Pickler)) '()' >>> _pickle.Pickler.__text_signature__ '(file, protocol=None, fix_imports=True)' Those two strings should be the same. I don't know any guaranteed way to tell a builtin class from a user class. So if you pass in a class, the best approach is to do what it used to do: try from_builtin, and if it fails fail over to the isinstance(obj, type) code. You changed it to if _signature_is_builtin(obj): return Signature.from_builtin(obj) This unambiguously returns the result from from_builtin. Either find a way that you can determine a class is a builtin 100% reliably, or change this to *try* from_builtin but only return its result if it's successful. Your changes might have also caused #20471; that wasn't failing before. I'm still investigating. ---------- assignee: yselivanov messages: 209871 nosy: larry, yselivanov priority: normal severity: normal stage: needs patch status: open title: inspect.Signature no longer handles builtin classes correctly type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 1 11:11:49 2014 From: report at bugs.python.org (Ned Deily) Date: Sat, 01 Feb 2014 10:11:49 +0000 Subject: [New-bugs-announce] [issue20474] test_socket failures on OS X due to fixed "expected failures" Message-ID: <1391249509.61.0.504777849278.issue20474@psf.upfronthosting.co.za> New submission from Ned Deily: Three "send timeout" test cases in test_socket were changed by a4e4facad164 for Issue12958 to be "expected failures" on OS X because of observed failures on the OS X buildbots running OS X 10.6 (Snow Leopard) and earlier. testInterruptedSendTimeout (test.test_socket.InterruptedSendTimeoutTest) ... unexpected success testInterruptedSendmsgTimeout (test.test_socket.InterruptedSendTimeoutTest) ... unexpected success testInterruptedSendtoTimeout (test.test_socket.InterruptedSendTimeoutTest) ... unexpected success It seems that the platform bugs causing the failures were fixed in OS X 10.7 so that the "expected failures" no longer fail. However, the change in behavior had not been noticed because, until the recent change to unittest in Issue20165, unittest did not fail when there were unexpected successes. Now it does fail, causing test_socket to fail on OS X 10.7+ for 3.4. On 3.3 the "unexpected success" failures are silently skipped. The attached patch changes the test cases to be skipped for OS X versions prior to 10.7 rather than to always expect failure on OS X. ---------- components: Tests messages: 209882 nosy: larry, ncoghlan, ned.deily priority: high severity: normal stage: patch review status: open title: test_socket failures on OS X due to fixed "expected failures" versions: Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 1 22:10:18 2014 From: report at bugs.python.org (Paul Sokolovsky) Date: Sat, 01 Feb 2014 21:10:18 +0000 Subject: [New-bugs-announce] [issue20475] pystone.py in 3.4 still uses time.clock(), even though it's marked as deprecated since 3.3 Message-ID: <1391289018.79.0.847652804265.issue20475@psf.upfronthosting.co.za> New submission from Paul Sokolovsky: http://docs.python.org/3.3/library/time.html#time.clock says that it's deprecated, but pystone.py in Python-3.4.0b3 tarball still uses it. Please kindly consider switching it to plain time.time() and not to some other novelties. My usecase is: I'm working on alternative Python implementation, I of course want to benchmark it, and of course want to claim that I ran unmodified pystone.py. Now to achieve that, I need to implement deprecated function. ---------- messages: 209916 nosy: pfalcon priority: normal severity: normal status: open title: pystone.py in 3.4 still uses time.clock(), even though it's marked as deprecated since 3.3 type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 1 23:08:05 2014 From: report at bugs.python.org (R. David Murray) Date: Sat, 01 Feb 2014 22:08:05 +0000 Subject: [New-bugs-announce] [issue20476] If new email policies are used, default message factory should be EmailMessage Message-ID: <1391292485.67.0.381493162498.issue20476@psf.upfronthosting.co.za> New submission from R. David Murray: This was part of the design of the new stuff added in 3.4, so it is a bug that it doesn't work...somehow I missed implementing this detail. The full implementation should make this a policy setting, so that a custom policy could specify its own factory. However, since 3.4 is in beta it would be a bad time to add that to the policy. The patch proposed here implements the required behavior by hardcoding any non-compat32 policy to use EmailMessage instead of Message in feedparser. ---------- components: email files: use_emailmessage.patch keywords: patch messages: 209921 nosy: barry, r.david.murray priority: high severity: normal stage: commit review status: open title: If new email policies are used, default message factory should be EmailMessage type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file33848/use_emailmessage.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 1 23:45:58 2014 From: report at bugs.python.org (R. David Murray) Date: Sat, 01 Feb 2014 22:45:58 +0000 Subject: [New-bugs-announce] [issue20477] Add examples of using the new contentmanager api to the email docs Message-ID: <1391294758.28.0.146811184979.issue20477@psf.upfronthosting.co.za> New submission from R. David Murray: Here are the examples I promised to write in issue 18891. ---------- assignee: docs at python components: Documentation, email files: contentmanager-examples.patch keywords: patch messages: 209922 nosy: barry, docs at python, r.david.murray priority: normal severity: normal stage: commit review status: open title: Add examples of using the new contentmanager api to the email docs type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file33850/contentmanager-examples.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 02:16:29 2014 From: report at bugs.python.org (Nick Coghlan) Date: Sun, 02 Feb 2014 01:16:29 +0000 Subject: [New-bugs-announce] [issue20478] Avoid inadvertently special casing Counter in statistics module Message-ID: <1391303789.61.0.448801013488.issue20478@psf.upfronthosting.co.za> New submission from Nick Coghlan: As per the python-ideas thread at https://mail.python.org/pipermail/python-ideas/2014-February/025226.html the statistics.mode() function currently passes its argument directly to the collections.Counter() constructor. This results in Counter() objects being special-cased rather than treated as ordinary iterables. For the main API, it seems more appropriate to force treatment as an iterable by calling iter() on the argument before passing it to the Counter() constructor. I'll file a separate RFE about making it easier and more efficient to use the statistics module with weight/frequency mappings. ---------- components: Library (Lib) messages: 209930 nosy: gregory.p.smith, larry, ncoghlan, oscarbenjamin, stevenjd, wolma priority: release blocker severity: normal stage: test needed status: open title: Avoid inadvertently special casing Counter in statistics module type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 02:21:11 2014 From: report at bugs.python.org (Nick Coghlan) Date: Sun, 02 Feb 2014 01:21:11 +0000 Subject: [New-bugs-announce] [issue20479] Efficiently support weight/frequency mappings in the statistics module Message-ID: <1391304071.38.0.177384686096.issue20479@psf.upfronthosting.co.za> New submission from Nick Coghlan: Issue 20478 suggests ensuring that even weight/frequency mappings like collections.Counter are consistently handled as iterables in the current statistics module API. However, it likely makes sense to provide public APIs that support efficiently working with such weight/frequency mappings directly, rather than requiring that they be expanded to a full iterable all the time. One possibility would be to provide parallel APIs with the _map suffix, similar to the format() vs format_map() distinction in the string formatting APIs. ---------- components: Library (Lib) messages: 209931 nosy: gregory.p.smith, ncoghlan, oscarbenjamin, stevenjd, wolma priority: normal severity: normal stage: needs patch status: open title: Efficiently support weight/frequency mappings in the statistics module type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 02:22:28 2014 From: report at bugs.python.org (Leon Weber) Date: Sun, 02 Feb 2014 01:22:28 +0000 Subject: [New-bugs-announce] [issue20480] Add ipaddress property to get reverse DNS name Message-ID: <1391304148.19.0.350065852039.issue20480@psf.upfronthosting.co.za> New submission from Leon Weber: I was missing a method to compute the reverse DNS name for an IP address, and I felt this is something that would belong in the ipaddress module; so here?s a patch for the ipaddress module adding a reverse_name property to IPv?Address. This is an example: >>> ipaddress.ip_address("127.0.0.1").reverse_name '1.0.0.127.in-addr.arpa.' >>> ipaddress.ip_address("2001:db8::1").reverse_name '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.' Would this be an acceptable feature for inclusion in the ipaddress module? ---------- components: Library (Lib) files: ipaddress_reverse_names.patch keywords: patch messages: 209933 nosy: leonn, ncoghlan, pmoody priority: normal severity: normal status: open title: Add ipaddress property to get reverse DNS name type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file33851/ipaddress_reverse_names.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 02:31:51 2014 From: report at bugs.python.org (Nick Coghlan) Date: Sun, 02 Feb 2014 01:31:51 +0000 Subject: [New-bugs-announce] [issue20481] Clarify type coercion rules in statistics module Message-ID: <1391304711.74.0.578704343666.issue20481@psf.upfronthosting.co.za> New submission from Nick Coghlan: I haven't completely following the type coercion discussion on python-ideas. but the statistics module at least needs a docs clarification (to explain that the current behaviour when mixing input types is not fully defined, especially when Decimal is involved), and potentially a behavioural change to disallow certain type combinations where the behaviour may change in the future (see https://mail.python.org/pipermail/python-ideas/2014-February/025214.html for example) Either option seems reasonable to me (with a slight preference for the latter), but it's at least clear that we need to avoid locking ourselves into the exact coercion behaviour of the current implementation indefinitely. ---------- components: Library (Lib) messages: 209934 nosy: gregory.p.smith, larry, ncoghlan, oscarbenjamin, stevenjd, wolma priority: release blocker severity: normal stage: needs patch status: open title: Clarify type coercion rules in statistics module type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 03:41:28 2014 From: report at bugs.python.org (yegle) Date: Sun, 02 Feb 2014 02:41:28 +0000 Subject: [New-bugs-announce] [issue20482] smtplib.SMTP.sendmail: improve exception message Message-ID: <1391308888.03.0.522502415802.issue20482@psf.upfronthosting.co.za> New submission from yegle: Currently the `msg` argument of `smtplib.SMTP.sendmail` accept a `str` in Py3k if every characters in this `str` is in ASCII range, or a `bytes`. This is confusing for new comer because: 1. When you send your mail using only ASCII characters, everything is fine (no matter you use bytes or str). 2. When sometimes you included non-ASCII characters in your email, the traceback is hard to understand. Here's an example of such traceback: Traceback (most recent call last): File "./manage.py", line 113, in manager.run() File "/data/web/cgi-bin/venv/lib/python3.3/site-packages/flask_script/__init__.py", line 405, in run result = self.handle(sys.argv[0], sys.argv[1:]) File "/data/web/cgi-bin/venv/lib/python3.3/site-packages/flask_script/__init__.py", line 384, in handle return handle(app, *positional_args, **kwargs) File "/data/web/cgi-bin/venv/lib/python3.3/site-packages/flask_script/commands.py", line 145, in handle return self.run(*args, **kwargs) File "./manage.py", line 108, in run conn.send(msg) File "/data/web/cgi-bin/venv/lib/python3.3/site-packages/flask_mail.py", line 168, in send message.as_string()) File "/data/web/cgi-bin/python-3.3.3/lib/python3.3/smtplib.py", line 747, in sendmail msg = _fix_eols(msg).encode('ascii') UnicodeEncodeError: 'ascii' codec can't encode character '\u9f99' in position 646: ordinal not in range(128) Here's my proposal: --- smtplib.py.orig 2014-02-01 21:26:47.000000000 -0500 +++ smtplib.py 2014-02-01 21:37:51.000000000 -0500 @@ -744,7 +744,12 @@ esmtp_opts = [] print(msg) if isinstance(msg, str): - msg = _fix_eols(msg).encode('ascii') + try: + msg = _fix_eols(msg).encode('ascii') + except UnicodeEncodeError: + raise SMTPException( + "msg may be a string containing characters in the " + "ASCII range, or a byte string.") if self.does_esmtp: # Hmmm? what's this? -ddm # self.esmtp_features['7bit']="" ---------- components: email messages: 209943 nosy: barry, r.david.murray, yegle priority: normal severity: normal status: open title: smtplib.SMTP.sendmail: improve exception message type: enhancement versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 05:59:35 2014 From: report at bugs.python.org (Nick Coghlan) Date: Sun, 02 Feb 2014 04:59:35 +0000 Subject: [New-bugs-announce] [issue20483] Missing network resource checks in test_urllib2 & test_smtplib Message-ID: <1391317175.95.0.400221944155.issue20483@psf.upfronthosting.co.za> New submission from Nick Coghlan: These two tests appear to rely on DNS lookups or other network access that isn't guarded by the network resource (my internet dropped out and these two tests failed, but they work correctly now the internet connection is back up). ---------- components: Tests messages: 209947 nosy: ncoghlan priority: normal severity: normal stage: needs patch status: open title: Missing network resource checks in test_urllib2 & test_smtplib type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 06:57:56 2014 From: report at bugs.python.org (Ned Deily) Date: Sun, 02 Feb 2014 05:57:56 +0000 Subject: [New-bugs-announce] [issue20484] test_pydoc can alter execution environment causing subsequent test failures Message-ID: <1391320676.2.0.0607136124043.issue20484@psf.upfronthosting.co.za> New submission from Ned Deily: With the "pydoc.synopsis() for 'binary' modules" changes (d6c3fb8d5f84) to pydoc and test_pydoc for Issue20123, running test_pydoc can leave the regrtest environment altered and cause subsequent tests to fail in strange ways. I ran into this issue running regression tests for 3.4.0 and was able to isolate the failure to this change set. A somewhat simplified (if not necessarily minimal) set of steps to reproduce follow. I've not had time to further investigate the cause. I've also only seen the problem when running the tests with an installed Python or from a build directory when there is also a Python installed in the configured prefix but not from the build directory with no Python installed at the configured prefix. I've reproduced the failure on both Debian Linux and on OS X. The following output is from the former. $ rm -rf /tmp/root/* $ hg purge --all $ hg update 6d72617cae64 # the parent change set of d6c3fb8d5f84 $ hg log -r . changeset: 88306:6d72617cae64 user: R David Murray date: Sat Jan 04 21:17:52 2014 -0500 summary: whatsnew: removal of TYPE_INT64 from marshal. $ ./configure --prefix=/tmp/root $ make && make install $ ( cd /tmp && /tmp/root/bin/python3.4 -m test -w test_pydoc test_distutils ) [1/2] test_pydoc [2/2] test_distutils All 2 tests OK. $ hg update d6c3fb8d5f84 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -r . changeset: 88307:d6c3fb8d5f84 user: Eric Snow date: Sat Jan 04 20:38:11 2014 -0700 summary: Issue 20123: Fix pydoc.synopsis() for "binary" modules. $ make && make install $ ( cd /tmp && /tmp/root/bin/python3.4 -m test -w test_pydoc test_distutils ) [1/2] test_pydoc Warning -- warnings.filters was modified by test_pydoc Warning -- logging._handlerList was modified by test_pydoc [2/2] test_distutils test test_distutils failed -- multiple errors occurred; run in verbose mode for details 1 test failed: test_distutils 1 test altered the execution environment: test_pydoc Re-running failed tests in verbose mode Re-running test 'test_distutils' in verbose mode test_simple_built (distutils.tests.test_bdist_dumb.BuildDumbTestCase) ... FAIL test_check_all (distutils.tests.test_check.CheckTestCase) ... ok [...] ====================================================================== ERROR: test_metadata_check_option (distutils.tests.test_sdist.SDistTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_sdist.py", line 247, in test_metadata_check_option cmd.run() File "/tmp/root/lib/python3.4/distutils/command/sdist.py", line 158, in run self.get_file_list() File "/tmp/root/lib/python3.4/distutils/command/sdist.py", line 204, in get_file_list self.add_defaults() File "/tmp/root/lib/python3.4/distutils/command/sdist.py", line 262, in add_defaults self.filelist.extend(build_py.get_source_files()) File "/tmp/root/lib/python3.4/distutils/command/build_py.py", line 301, in get_source_files return [module[-1] for module in self.find_all_modules()] File "/tmp/root/lib/python3.4/distutils/command/build_py.py", line 295, in find_all_modules package_dir = self.get_package_dir(package) File "/tmp/root/lib/python3.4/site-packages/setuptools/command/build_py.py", line 187, in get_package_dir return os.path.join(self.distribution.src_root, res) File "/tmp/root/lib/python3.4/posixpath.py", line 83, in join path += b TypeError: unsupported operand type(s) for +=: 'dict' and 'str' ====================================================================== ERROR: test_debug_mode (distutils.tests.test_install.InstallTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_install.py", line 236, in test_debug_mode self.test_record() File "/tmp/root/lib/python3.4/distutils/tests/test_install.py", line 186, in test_record cmd.run() File "/tmp/root/lib/python3.4/distutils/command/install.py", line 566, in run self.run_command(cmd_name) File "/tmp/root/lib/python3.4/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/tmp/root/lib/python3.4/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/install_scripts.py", line 18, in run self.run_command("egg_info") File "/tmp/root/lib/python3.4/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/tmp/root/lib/python3.4/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 163, in run self.find_sources() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 186, in find_sources mm.run() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 246, in run self.add_defaults() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 282, in add_defaults sdist.add_defaults(self) File "/tmp/root/lib/python3.4/site-packages/setuptools/command/sdist.py", line 148, in add_defaults if os.path.exists(fn): File "/tmp/root/lib/python3.4/genericpath.py", line 19, in exists os.stat(path) TypeError: stat: can't specify None for path argument ====================================================================== ERROR: test_record (distutils.tests.test_install.InstallTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_install.py", line 186, in test_record cmd.run() File "/tmp/root/lib/python3.4/distutils/command/install.py", line 566, in run self.run_command(cmd_name) File "/tmp/root/lib/python3.4/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/tmp/root/lib/python3.4/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/install_scripts.py", line 18, in run self.run_command("egg_info") File "/tmp/root/lib/python3.4/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/tmp/root/lib/python3.4/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 163, in run self.find_sources() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 186, in find_sources mm.run() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 246, in run self.add_defaults() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 282, in add_defaults sdist.add_defaults(self) File "/tmp/root/lib/python3.4/site-packages/setuptools/command/sdist.py", line 148, in add_defaults if os.path.exists(fn): File "/tmp/root/lib/python3.4/genericpath.py", line 19, in exists os.stat(path) TypeError: stat: can't specify None for path argument ====================================================================== ERROR: test_record_extensions (distutils.tests.test_install.InstallTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_install.py", line 217, in test_record_extensions cmd.run() File "/tmp/root/lib/python3.4/distutils/command/install.py", line 566, in run self.run_command(cmd_name) File "/tmp/root/lib/python3.4/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/tmp/root/lib/python3.4/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/install_egg_info.py", line 29, in run self.run_command('egg_info') File "/tmp/root/lib/python3.4/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/tmp/root/lib/python3.4/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 163, in run self.find_sources() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 186, in find_sources mm.run() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 246, in run self.add_defaults() File "/tmp/root/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 282, in add_defaults sdist.add_defaults(self) File "/tmp/root/lib/python3.4/site-packages/setuptools/command/sdist.py", line 148, in add_defaults if os.path.exists(fn): File "/tmp/root/lib/python3.4/genericpath.py", line 19, in exists os.stat(path) TypeError: stat: can't specify None for path argument ====================================================================== ERROR: test_get_inputs (distutils.tests.test_install_lib.InstallLibTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_install_lib.py", line 91, in test_get_inputs inputs = cmd.get_inputs() File "/tmp/root/lib/python3.4/distutils/command/install_lib.py", line 211, in get_inputs inputs.extend(build_py.get_outputs()) File "/tmp/root/lib/python3.4/distutils/command/build_py.py", line 308, in get_outputs modules = self.find_all_modules() File "/tmp/root/lib/python3.4/distutils/command/build_py.py", line 295, in find_all_modules package_dir = self.get_package_dir(package) File "/tmp/root/lib/python3.4/site-packages/setuptools/command/build_py.py", line 187, in get_package_dir return os.path.join(self.distribution.src_root, res) File "/tmp/root/lib/python3.4/posixpath.py", line 83, in join path += b TypeError: unsupported operand type(s) for +=: 'dict' and 'str' ====================================================================== ERROR: test_get_outputs (distutils.tests.test_install_lib.InstallLibTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_install_lib.py", line 71, in test_get_outputs outputs = cmd.get_outputs() File "/tmp/root/lib/python3.4/distutils/command/install_lib.py", line 188, in get_outputs self.install_dir) File "/tmp/root/lib/python3.4/distutils/command/install_lib.py", line 148, in _mutate_outputs build_files = build_cmd.get_outputs() File "/tmp/root/lib/python3.4/distutils/command/build_py.py", line 308, in get_outputs modules = self.find_all_modules() File "/tmp/root/lib/python3.4/distutils/command/build_py.py", line 295, in find_all_modules package_dir = self.get_package_dir(package) File "/tmp/root/lib/python3.4/site-packages/setuptools/command/build_py.py", line 187, in get_package_dir return os.path.join(self.distribution.src_root, res) File "/tmp/root/lib/python3.4/posixpath.py", line 83, in join path += b TypeError: unsupported operand type(s) for +=: 'dict' and 'str' ====================================================================== FAIL: test_simple_built (distutils.tests.test_bdist_dumb.BuildDumbTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_bdist_dumb.py", line 91, in test_simple_built self.assertEqual(contents, sorted(wanted)) AssertionError: Lists differ: ['PKG-INFO', 'SOURCES.txt', 'dependency_lin[52 chars]txt'] != ['foo-0.1-py3.4.egg-info', 'foo.cpython-34.pyc', 'foo.py'] First differing element 0: PKG-INFO foo-0.1-py3.4.egg-info First list contains 3 additional elements. First extra element 3: foo.cpython-34.pyc + ['foo-0.1-py3.4.egg-info', 'foo.cpython-34.pyc', 'foo.py'] - ['PKG-INFO', - 'SOURCES.txt', - 'dependency_links.txt', - 'foo.cpython-34.pyc', - 'foo.py', - 'top_level.txt'] ====================================================================== FAIL: test_formats (distutils.tests.test_bdist.BuildTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_bdist.py", line 26, in test_formats self.assertEqual(found, formats) AssertionError: Lists differ: ['bztar', 'egg', 'gztar', 'msi', 'rpm', 'tar', 'wininst', 'zip', 'ztar'] != ['bztar', 'gztar', 'msi', 'rpm', 'tar', 'wininst', 'zip', 'ztar'] First differing element 1: egg gztar First list contains 1 additional elements. First extra element 8: ztar - ['bztar', 'egg', 'gztar', 'msi', 'rpm', 'tar', 'wininst', 'zip', 'ztar'] ? ------- + ['bztar', 'gztar', 'msi', 'rpm', 'tar', 'wininst', 'zip', 'ztar'] ====================================================================== FAIL: test_dir_in_package_data (distutils.tests.test_build_py.BuildPyTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_build_py.py", line 153, in test_dir_in_package_data dist.run_commands() distutils.errors.DistutilsFileError: can't copy 'pkg/doc/otherdir': doesn't exist or not a regular file During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_build_py.py", line 155, in test_dir_in_package_data self.fail("failed package_data when data dir includes a dir") AssertionError: failed package_data when data dir includes a dir ====================================================================== FAIL: test_empty_package_dir (distutils.tests.test_build_py.BuildPyTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_build_py.py", line 87, in test_empty_package_dir dist.run_commands() distutils.errors.DistutilsFileError: can't copy 'oc/testfile': doesn't exist or not a regular file During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/root/lib/python3.4/distutils/tests/test_build_py.py", line 89, in test_empty_package_dir self.fail("failed package_data test when package_dir is ''") AssertionError: failed package_data test when package_dir is '' ---------------------------------------------------------------------- Ran 201 tests in 0.915s FAILED (failures=4, errors=6, skipped=19) test test_distutils failed $ rm -rf /tmp/root/* $ hg purge --all $ hg update default # current tip 339 files updated, 0 files merged, 2 files removed, 0 files unresolved $ hg log -r . changeset: 88889:d7ac90c0463a tag: tip user: Victor Stinner date: Sat Feb 01 22:49:59 2014 +0100 summary: Issue #20400: Merge Tulip into Python: add the new asyncio.subprocess module $ ./configure --prefix=/tmp/root $ make && make install $ ( cd /tmp && /tmp/root/bin/python3.4 -m test -w test_pydoc test_distutils ) [1/2] test_pydoc Warning -- warnings.filters was modified by test_pydoc Warning -- logging._handlerList was modified by test_pydoc [2/2] test_distutils test test_distutils failed -- multiple errors occurred; run in verbose mode for details 1 test failed: test_distutils 1 test altered the execution environment: test_pydoc Re-running failed tests in verbose mode Re-running test 'test_distutils' in verbose mode test_simple_built (distutils.tests.test_bdist_dumb.BuildDumbTestCase) ... FAIL [...] ---------------------------------------------------------------------- Ran 201 tests in 0.959s FAILED (failures=4, errors=6, skipped=19) test test_distutils failed $ # problem still exists ---------- assignee: eric.snow components: Library (Lib), Tests messages: 209950 nosy: eric.snow, ned.deily priority: high severity: normal stage: needs patch status: open title: test_pydoc can alter execution environment causing subsequent test failures versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 15:20:28 2014 From: report at bugs.python.org (Suzumizaki) Date: Sun, 02 Feb 2014 14:20:28 +0000 Subject: [New-bugs-announce] [issue20485] Enable 'import .pyd' Message-ID: <1391350828.19.0.622173065149.issue20485@psf.upfronthosting.co.za> New submission from Suzumizaki: Currently, the name of .pyd modules is limited within 7 bit US-ASCII. I want to do "import X" to import X.pyd, where X contains Unicode characters. I tried to make the patch and my work seems to be done successfully. I will post the patch with this issue, and next what should I do? About the solution: To make the export entry 'PyInit_xxx' kept inside 7 bit, I use the simple encoding 'szm62' for unicode, called in the patch. 1) 'szm62' is used once per module(.pyd), only for 'PyInit_xxx'. 2) 'szm62' is used only when non-ASCII characters are in the name of the module. 3) 'szm62' generates short string as UTF-8, except 0-9A-Za-z are encoded to 2 bytes. 4) 'szm62' is very simple, much easier than UTF-8. 5) I tested it only with MS VC++, but I believe highly compatible with other environments. 6) 'szm62' also can decode 7 bits to unicode, but only the encoding is used for this issue. Notes: The simplicity is important for the project like Cython -- it generates .pyd files. The codepoints over 16bits are also simply supported. They will be encoded to 4 alnum(0-9A-Za-z) characters. 0-9A-Za-z are (always) encoded to 2 alnums. They will be simply prefixed with '0'(U+000030). When the generating 'Non-ASCII.pyd' with MSVC toolkit, the report 'LINK : warning LNK4232' will be raised on linking. But no problem. The warning says "When someone try to link with LoadLibraryEx'A' function, it may or may not fail, depends on the user locale." Our Python.exe uses always LoadLibraryEx'W', it never fail with locale issue. Or if you have any question, please tell me that. Regards, Suzumizaki-Kimitaka ---------- components: Interpreter Core files: 20140202_patch_for_python_default_branch_88885.patch keywords: patch messages: 209988 nosy: Suzumizaki priority: normal severity: normal status: open title: Enable 'import .pyd' type: behavior versions: Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file33866/20140202_patch_for_python_default_branch_88885.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 16:37:29 2014 From: report at bugs.python.org (=?utf-8?b?0JjQs9C+0YDRjCDQqNCw0YPQu9Cw?=) Date: Sun, 02 Feb 2014 15:37:29 +0000 Subject: [New-bugs-announce] [issue20486] msilib: can't close opened database Message-ID: <1391355449.68.0.999858284587.issue20486@psf.upfronthosting.co.za> New submission from ????? ?????: In Python 2.7.6 can't find any way to close MSI database after finish working with it. As a result database is locked and can't be opened by any other application until Python process is finished. import msilib db = msilib.OpenDatabase('test.msi', msilib.MSIDBOPEN_TRANSACT) view = db.OpenView("SELECT File, Component_, FileName FROM File") view.Execute(None) r1 = view.Fetch() r1.SetString(3,"test.txt") view.Modify(msilib.MSIMODIFY_UPDATE, r1) view.Close() db.Commit() del db db2 = msilib.OpenDatabase('test.msi', msilib.MSIDBOPEN_TRANSACT) MSIError: 1: 2203 2: test.msi 3: -2147287008 ---------- components: Library (Lib), Windows messages: 209992 nosy: gentoo90 priority: normal severity: normal status: open title: msilib: can't close opened database type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 16:38:27 2014 From: report at bugs.python.org (INADA Naoki) Date: Sun, 02 Feb 2014 15:38:27 +0000 Subject: [New-bugs-announce] [issue20487] Odd words in unittest.mock document. Message-ID: <1391355507.86.0.158179018907.issue20487@psf.upfronthosting.co.za> New submission from INADA Naoki: http://docs.python.org/3.3/library/unittest.mock.html#magic-mock > The two equality method, __eq__ and __ne__, are special. They do the default equality comparison on identity, using a side effect, unless you change their return value to return something else: What "using a side effect" means? ---------- assignee: docs at python components: Documentation messages: 209993 nosy: docs at python, michael.foord, naoki priority: normal severity: normal status: open title: Odd words in unittest.mock document. versions: Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 16:41:58 2014 From: report at bugs.python.org (R. David Murray) Date: Sun, 02 Feb 2014 15:41:58 +0000 Subject: [New-bugs-announce] [issue20488] importlib title and introduction are out of date Message-ID: <1391355718.64.0.231740167188.issue20488@psf.upfronthosting.co.za> New submission from R. David Murray: Now that importlib *is* the import system in CPython, the title ("An Implementation of import") and the intro ("a reference implementation that is easier to comprehend than..." seem to me like they are out of date and should be reworded. ---------- assignee: docs at python components: Documentation messages: 209994 nosy: brett.cannon, docs at python, eric.snow, r.david.murray priority: normal severity: normal status: open title: importlib title and introduction are out of date type: behavior versions: Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 18:12:02 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 02 Feb 2014 17:12:02 +0000 Subject: [New-bugs-announce] [issue20489] help() fails for zlib Compress and Decompress objects Message-ID: <1391361122.5.0.357428984902.issue20489@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: >>> import zlib >>> d = zlib.decompressobj() >>> d >>> c = zlib.compressobj() >>> c >>> zlib.DEF_BUF_SIZE 16384 >>> zlib.Z_FINISH 4 >>> help(c) Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/inspect.py", line 2243, in wrap_value value = eval(s, module_dict) File "", line 1, in NameError: name 'Z_FINISH' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/inspect.py", line 2246, in wrap_value value = eval(s, sys_module_dict) File "", line 1, in NameError: name 'Z_FINISH' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/home/serhiy/py/cpython/Lib/_sitebuiltins.py", line 99, in __call__ return pydoc.help(*args, **kwds) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1799, in __call__ self.help(request) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1849, in help else: doc(request, 'Help on %s:', output=self._output) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1585, in doc pager(render_doc(thing, title, forceload)) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1578, in render_doc return title % desc + '\n\n' + renderer.document(object, name) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 357, in document if inspect.isclass(object): return self.docclass(*args) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1276, in docclass lambda t: t[1] == 'method') File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1225, in spill name, mod, object)) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 358, in document if inspect.isroutine(object): return self.docroutine(*args) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1328, in docroutine signature = inspect.signature(object) File "/home/serhiy/py/cpython/Lib/inspect.py", line 1695, in signature return Signature.from_builtin(obj) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2298, in from_builtin p(name, default) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2284, in p default_node = RewriteSymbolics().visit(default_node) File "/home/serhiy/py/cpython/Lib/ast.py", line 245, in visit return visitor(node) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2276, in visit_Name return wrap_value(node.id) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2248, in wrap_value raise RuntimeError() RuntimeError >>> help(d) Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/inspect.py", line 2243, in wrap_value value = eval(s, module_dict) File "", line 1, in NameError: name 'DEF_BUF_SIZE' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/inspect.py", line 2246, in wrap_value value = eval(s, sys_module_dict) File "", line 1, in NameError: name 'DEF_BUF_SIZE' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/home/serhiy/py/cpython/Lib/_sitebuiltins.py", line 99, in __call__ return pydoc.help(*args, **kwds) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1799, in __call__ self.help(request) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1849, in help else: doc(request, 'Help on %s:', output=self._output) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1585, in doc pager(render_doc(thing, title, forceload)) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1578, in render_doc return title % desc + '\n\n' + renderer.document(object, name) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 357, in document if inspect.isclass(object): return self.docclass(*args) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1276, in docclass lambda t: t[1] == 'method') File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1225, in spill name, mod, object)) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 358, in document if inspect.isroutine(object): return self.docroutine(*args) File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1328, in docroutine signature = inspect.signature(object) File "/home/serhiy/py/cpython/Lib/inspect.py", line 1695, in signature return Signature.from_builtin(obj) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2298, in from_builtin p(name, default) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2284, in p default_node = RewriteSymbolics().visit(default_node) File "/home/serhiy/py/cpython/Lib/ast.py", line 245, in visit return visitor(node) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2276, in visit_Name return wrap_value(node.id) File "/home/serhiy/py/cpython/Lib/inspect.py", line 2248, in wrap_value raise RuntimeError() RuntimeError ---------- components: Library (Lib) messages: 210001 nosy: larry, serhiy.storchaka, yselivanov priority: normal severity: normal status: open title: help() fails for zlib Compress and Decompress objects type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 20:04:48 2014 From: report at bugs.python.org (Ram Rachum) Date: Sun, 02 Feb 2014 19:04:48 +0000 Subject: [New-bugs-announce] [issue20490] Show clear error message on circular import Message-ID: <1391367888.31.0.501253544651.issue20490@psf.upfronthosting.co.za> New submission from Ram Rachum: If there's a circular import in my program, I don't want to see an error message, "Cannot import name 'foo'" and then say in my mind, "ah, I'm an experienced Python developer, I know that when Python says that it often means that there's a circular import problem." I want the error message to **say there's a circular import problem**, so (a) I won't have to remember this piece of trivia and (b) less experienced developers won't have to bang their heads on their desks trying to figure out why the import isn't working. Bonus points if the error message actually shows which module is trying to import a module that imports itself, so we'll know where to fix. ---------- components: Interpreter Core messages: 210006 nosy: cool-RR priority: normal severity: normal status: open title: Show clear error message on circular import type: enhancement versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 21:46:37 2014 From: report at bugs.python.org (Kaarle Ritvanen) Date: Sun, 02 Feb 2014 20:46:37 +0000 Subject: [New-bugs-announce] [issue20491] textwrap: Non-breaking space not honored Message-ID: <1391373997.78.0.616228125857.issue20491@psf.upfronthosting.co.za> New submission from Kaarle Ritvanen: The textwrap module does not distinguish non-breaking space (\xa0) from other whitespace when determining word boundaries. In the beginning of the module, the _whitespace variable is defined to address this issue but is not used in the regular expressions determining the splitting rules. ---------- components: Library (Lib) files: textwrap-honor-non-breaking-spaces.patch keywords: patch messages: 210013 nosy: kunkku priority: normal severity: normal status: open title: textwrap: Non-breaking space not honored type: behavior versions: Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file33872/textwrap-honor-non-breaking-spaces.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 2 21:47:19 2014 From: report at bugs.python.org (Benjamin Peterson) Date: Sun, 02 Feb 2014 20:47:19 +0000 Subject: [New-bugs-announce] [issue20492] test_tcl is failing on windows 2.7 Message-ID: <1391374039.08.0.285544417854.issue20492@psf.upfronthosting.co.za> New submission from Benjamin Peterson: http://buildbot.python.org/all/builders/x86%20Windows%20Server%202003%20%5BSB%5D%202.7/builds/833/steps/test/logs/stdio ---------- assignee: serhiy.storchaka messages: 210014 nosy: benjamin.peterson, serhiy.storchaka priority: normal severity: normal status: open title: test_tcl is failing on windows 2.7 versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 01:37:51 2014 From: report at bugs.python.org (STINNER Victor) Date: Mon, 03 Feb 2014 00:37:51 +0000 Subject: [New-bugs-announce] [issue20493] asyncio: OverflowError('timeout is too large') Message-ID: <1391387871.01.0.754074352669.issue20493@psf.upfronthosting.co.za> New submission from STINNER Victor: In asyncio, if the next event is in 2^40 seconds, epoll.poll() raises an OverflowError because epoll_wait() maximum value for the timeout is INT_MAX seconds. Test timeout_overflow.py to reproduce the issue. ---------- files: timeout_overflow.py messages: 210061 nosy: haypo priority: normal severity: normal status: open title: asyncio: OverflowError('timeout is too large') versions: Python 3.4 Added file: http://bugs.python.org/file33879/timeout_overflow.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 01:52:49 2014 From: report at bugs.python.org (Benjamin Yolken) Date: Mon, 03 Feb 2014 00:52:49 +0000 Subject: [New-bugs-announce] [issue20494] Backport of http://bugs.python.org/issue11849 to Python 2.7 (Make it more likely for the system allocator to release free()d memory arenas on glibc-based systems). Message-ID: <1391388769.61.0.620925038774.issue20494@psf.upfronthosting.co.za> New submission from Benjamin Yolken: We have found that http://bugs.python.org/issue11849 affects a number of our Python 2.7 systems in production. I took the changes in http://hg.python.org/cpython/rev/f8a697bc3ca8 and backported them to the head of the python 2.7 cpython hg branch. I have verified that these changes fix the problem and that all tests pass. Please see the attached patch. ---------- files: memory_fix.patch keywords: patch messages: 210063 nosy: bhyolken priority: normal severity: normal status: open title: Backport of http://bugs.python.org/issue11849 to Python 2.7 (Make it more likely for the system allocator to release free()d memory arenas on glibc-based systems). type: enhancement versions: Python 2.7 Added file: http://bugs.python.org/file33881/memory_fix.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 02:29:28 2014 From: report at bugs.python.org (STINNER Victor) Date: Mon, 03 Feb 2014 01:29:28 +0000 Subject: [New-bugs-announce] [issue20495] test_read_pty_output() hangs on FreeBSD 7.2 buildbot Message-ID: <1391390968.29.0.23257855186.issue20495@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/x86%20FreeBSD%207.2%203.x/builds/4969/steps/test/logs/stdio --- [298/389/1] test_asyncio Timeout (1:00:00)! Current thread 0x28401040 (most recent call first): File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/asyncio/base_events.py", line 208 in time File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/asyncio/base_events.py", line 641 in _run_once File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/asyncio/base_events.py", line 154 in run_forever File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/asyncio/base_events.py", line 173 in run_until_complete File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/asyncio/test_utils.py", line 44 in run_briefly File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/asyncio/test_utils.py", line 59 in run_until File "/usr/home/db3l/buildarea/3.x.bolen-freebsd7/build/Lib/test/test_asyncio/test_events.py", line 979 in test_read_pty_output ... --- FYI The test is now skipped on Mac OS X older than 10.6, the test on the kqueue selector is skipped on Mac OS X older than 10.9: issue #20472. ---------- messages: 210072 nosy: gvanrossum, haypo, skrah priority: normal severity: normal status: open title: test_read_pty_output() hangs on FreeBSD 7.2 buildbot versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 06:09:47 2014 From: report at bugs.python.org (Alan Isaac) Date: Mon, 03 Feb 2014 05:09:47 +0000 Subject: [New-bugs-announce] [issue20496] function definition tutorial encourages bad practice Message-ID: <1391404187.28.0.545168168954.issue20496@psf.upfronthosting.co.za> New submission from Alan Isaac: Section 4.6 of the tutorial introduces function definition: http://docs.python.org/3/tutorial/controlflow.html#defining-functions The first example defines a function that *prints* a Fibonacci series. A basic mistake made by students new to programming is to use a function to print values rather than to return them. In this sense, the example encourages bad practice and misses an opportunity to instruct. Since they have already met lists in Section 3, I suggest that returning a list of the values and then printing the list would enhance the tutorial. ---------- assignee: docs at python components: Documentation messages: 210077 nosy: aisaac, docs at python priority: normal severity: normal status: open title: function definition tutorial encourages bad practice type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 07:19:42 2014 From: report at bugs.python.org (INADA Naoki) Date: Mon, 03 Feb 2014 06:19:42 +0000 Subject: [New-bugs-announce] [issue20497] Unclear word in socket document. Message-ID: <1391408382.37.0.746852071929.issue20497@psf.upfronthosting.co.za> New submission from INADA Naoki: http://docs.python.org/3.3/library/socket.html#socket.getaddrinfo > Changed in version 3.2: parameters can now be passed as single keyword arguments. What *single* means? I can use multiple keyword arguments: In [3]: socket.getaddrinfo('www.python.org', 80, proto=socket.SOL_TCP, family=socket.AF_INET) Out[3]: [(, , 6, '', ('82.94.164.162', 80))] ---------- assignee: docs at python components: Documentation messages: 210078 nosy: docs at python, naoki priority: normal severity: normal status: open title: Unclear word in socket document. versions: Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 07:57:35 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Mon, 03 Feb 2014 06:57:35 +0000 Subject: [New-bugs-announce] [issue20498] Update StringIO newline tests Message-ID: <1391410655.69.0.384794659533.issue20498@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Proposed patches adds several new checks and test cases to StringIO newline tests. It also fixes test_newline_lf which didn't use the newline argument. ---------- components: IO, Tests messages: 210080 nosy: benjamin.peterson, hynek, pitrou, serhiy.storchaka, stutzbach priority: normal severity: normal stage: patch review status: open title: Update StringIO newline tests versions: Python 2.7, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 13:46:19 2014 From: report at bugs.python.org (Oscar Benjamin) Date: Mon, 03 Feb 2014 12:46:19 +0000 Subject: [New-bugs-announce] [issue20499] Rounding errors with statistics.variance Message-ID: <1391431579.33.0.244887922603.issue20499@psf.upfronthosting.co.za> New submission from Oscar Benjamin: The mean/variance functions in the statistics module don't quite round correctly. The reasons for this are that although exact rational arithmetic is used internally in the _sum function it is not used throughout the module. In particular the _sum function should be changed to return an exact result and exact arithmetic should be used right up to the point before returning to the user at which point a rounding/coercion should be used to give the user their answer in the appropriate type correctly rounded once. Using exact arithmetic everywhere makes it possible to replace all of the variance* functions with single-pass algorithms based on the computational formula for variance which should be more efficient as well. For example the following implements pvariance so that it returns a perfectly rounded result for float input and output in a single pass: def pvariance(data): sx = 0 sx2 = 0 for n, x in enumerate(map(Fraction, data), 1): sx += x sx2 += x ** 2 Ex = sx / n Ex2 = sx2 / n var = Ex2 - Ex ** 2 return float(var) Comparing the above with the statistics module: >>> pvariance([0, 0, 1]) 0.2222222222222222 >>> statistics.pvariance([0, 0, 1]) 0.22222222222222224 The true answer is: >>> from fractions import Fraction as F >>> float(statistics.pvariance([F(0), F(0), F(1)])) 0.2222222222222222 The logic in the _sum function for computing exact integer ratios and coercing back to the output type could be moved into utility functions so that it does not need to be duplicated. Some examples of rounding issues: >>> from statistics import variance, mean >>> from decimal import Decimal as D, getcontext >>> from fractions import Fraction as F Variance with ints or floats returns a float but the float is not quite the nearest possible float: >>> variance([0, 0, 2]) 1.3333333333333335 >>> float(variance([F(0), F(0), F(2)])) # true result rounded once 1.3333333333333333 Another example with Decimal: >>> getcontext().prec = 5 >>> getcontext() Context(prec=5, rounding=ROUND_HALF_EVEN, Emin=-999999999, Emax=999999999, capitals=1, clamp=0, flags=[Rounded, Inexact], traps=[DivisionByZero, Overflow, InvalidOperation]) >>> variance([D(0), D(0), D(2)] * 2) # Rounded down instead of up Decimal('1.0666') >>> r = (variance([F(0), F(0), F(2)] * 2)) >>> D(r.numerator) / r.denominator # Correctly rounded Decimal('1.0667') The mean function may also not be correctly rounded: >>> getcontext().prec = 2 >>> r = mean((F('1.2'), F('1.3'), F('1.55'))) >>> r Fraction(27, 20) >>> D(r.numerator) / r.denominator # Correctly rounded Decimal('1.4') >>> mean([D('1.2'), D('1.3'), D('1.55')]) Decimal('1.3') ---------- components: Library (Lib) messages: 210121 nosy: oscarbenjamin, stevenjd priority: normal severity: normal status: open title: Rounding errors with statistics.variance versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 14:07:09 2014 From: report at bugs.python.org (Xavier de Gaye) Date: Mon, 03 Feb 2014 13:07:09 +0000 Subject: [New-bugs-announce] [issue20500] assertion failed when passing an exception object to sys.exit Message-ID: <1391432829.26.0.791023513998.issue20500@psf.upfronthosting.co.za> New submission from Xavier de Gaye: The following code crashes python with: python: Objects/object.c:512: PyObject_Str: Assertion `!PyErr_Occurred()' failed. on the tip of the default branch, but not on python 3.3.3. import sys error = None try: raise ValueError('some text') except ValueError as err: error = err if error: sys.exit(error) ---------- components: Interpreter Core messages: 210123 nosy: xdegaye priority: normal severity: normal status: open title: assertion failed when passing an exception object to sys.exit type: crash versions: Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 15:27:33 2014 From: report at bugs.python.org (Gunnar Aastrand Grimnes) Date: Mon, 03 Feb 2014 14:27:33 +0000 Subject: [New-bugs-announce] [issue20501] fileinput module will read whole file into memory when using fileinput.hook_encoded Message-ID: <1391437653.41.0.935040025319.issue20501@psf.upfronthosting.co.za> New submission from Gunnar Aastrand Grimnes: When reading large files with fileinput, it will work as expected and only process a line at a time when used normally, but if you add an hook_encoded openhook it will read the whole file into memory before returning the first line. Verify by running this program on a large text file: import fileinput for l in fileinput.input(openhook=fileinput.hook_encoded('iso-8859-1')): raw_input() and check how much memory it uses. Remove the openhook and memory usage goes down to nothing. ---------- components: IO messages: 210130 nosy: gromgull priority: normal severity: normal status: open title: fileinput module will read whole file into memory when using fileinput.hook_encoded type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 15:28:52 2014 From: report at bugs.python.org (Mauricio de Alencar) Date: Mon, 03 Feb 2014 14:28:52 +0000 Subject: [New-bugs-announce] [issue20502] Context.create_decimal_from_float() inconsistent precision for zeros after decimal mark Message-ID: <1391437732.8.0.604418392969.issue20502@psf.upfronthosting.co.za> New submission from Mauricio de Alencar: The following code demonstrates an inconsistency of this method in dealing with zeros after the decimal mark. from decimal import Context context = Context(prec=2) for x in [100., 10., 1., 0.1]: print(context.create_decimal_from_float(x), context.create_decimal_from_float(4.56*x)) Produces the output: 1.0E+2 4.6E+2 10 46 1 4.6 0.10 0.46 Line 3 is inconsistent. It should be "1.0 4.6". ---------- messages: 210131 nosy: mdealencar priority: normal severity: normal status: open title: Context.create_decimal_from_float() inconsistent precision for zeros after decimal mark type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 16:36:42 2014 From: report at bugs.python.org (Gerrit Holl) Date: Mon, 03 Feb 2014 15:36:42 +0000 Subject: [New-bugs-announce] [issue20503] super behavioru and abstract base classes (either implementation or documentation/error message is wrong) Message-ID: <1391441802.61.0.557224247712.issue20503@psf.upfronthosting.co.za> New submission from Gerrit Holl: When using an abstract base class, super(type, obj) throws a TypeError stating "obj must be an instance (...) of type", even though isinstance(obj, type) returns True. I'm not sure what is supposed to happen here, but either the error message and the documentation for super would need to be reformulated, or there is an issue with the implementation, or I am misunderstanding something. Python 3.3.3 (default, Dec 12 2013, 11:13:02) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numbers >>> super(numbers.Number, 0) Traceback (most recent call last): File "", line 1, in TypeError: super(type, obj): obj must be an instance or subtype of type >>> isinstance(0, numbers.Number) True ---------- components: Interpreter Core messages: 210141 nosy: Gerrit.Holl priority: normal severity: normal status: open title: super behavioru and abstract base classes (either implementation or documentation/error message is wrong) versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 3 22:33:19 2014 From: report at bugs.python.org (Sebastian Rittau) Date: Mon, 03 Feb 2014 21:33:19 +0000 Subject: [New-bugs-announce] [issue20504] cgi.FieldStorage, multipart, missing Content-Length Message-ID: <1391463199.17.0.394387661768.issue20504@psf.upfronthosting.co.za> New submission from Sebastian Rittau: Consider the attached test case. This test will run fine with Python 2.7, but will fail with Python 3.3. If cgi.FieldStorage() tries to parse a multipart request without a Content-Length header in the main section, segments will have a length of 0. During the parse process, two instances of FieldStorage are involved. The outer one reads the whole request and creates and delegates reading of the fragment to inner instances. The main problem is that FieldStorage.read_lines_to_outerboundary() of the inner FieldStorage will read nothing, since self.limit is lower than zero. def read_lines_to_outerboundary(self): ... while 1: if _read >= self.limit: break ... This happens, since limit is passed when creating the inner instance in FieldStorage.read_multi(): def read_multi(self, environ, keep_blank_values, strict_parsing): ... part = klass(self.fp, headers, ib, environ, keep_blank_values, strict_parsing,self.limit-self.bytes_read, self.encoding, self.errors) ... Now, if the total request did not have a Content-Length header, self.limit will be -1. The naive fix works for the test case, at least, but I don't know if there are other repercussions: --- /usr/lib/python3.3/cgi.py 2014-02-03 22:31:16.649431125 +0100 +++ cgi.py 2014-02-03 22:32:14.849704379 +0100 @@ -788,7 +788,7 @@ last_line_lfend = True _read = 0 while 1: - if _read >= self.limit: + if self.limit >= 0 and _read >= self.limit: break line = self.fp.readline(1<<16) # bytes self.bytes_read += len(line) ---------- components: Library (Lib) files: cgi-bug.py messages: 210166 nosy: srittau priority: normal severity: normal status: open title: cgi.FieldStorage, multipart, missing Content-Length versions: Python 3.3 Added file: http://bugs.python.org/file33891/cgi-bug.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 00:34:16 2014 From: report at bugs.python.org (STINNER Victor) Date: Mon, 03 Feb 2014 23:34:16 +0000 Subject: [New-bugs-announce] [issue20505] Remove resolution from selectors and granularity from asyncio Message-ID: <1391470456.74.0.460953910028.issue20505@psf.upfronthosting.co.za> New submission from STINNER Victor: To solve a performance issue in asyncio, I added a new resolution attribute to selectors.BaseSelector and a new _granularity attribute to asyncio.BaseEventLoop. If I understood correctly, Charles-Fran?ois (author and so maintainer of the new selectors module) doesn't like the new resolution attribute because it is a lie (if I understood correctly Charles-Fran?ois complain). He's right: the kernel can use a clock with a worse resolution. For example, on Linux kernel older than 2.6.28, all selectors (select, poll, epoll) had a resolution of 1/HZ where HZ is usually 100, 250 or 1000. So the best resolution was 1 ms (10^-3), whereas the timeval structure used in select() has a resolution of 1 us (10^-6). On Windows, there is a different issue: the clock used by time.monotonic() has a resolution of 15.6 ms, whereas the type to describe the timeouf of the proactor selector (GetQueuedCompletionStatus function) has a resolution of 1 ms. So the resolution of the clock, time.get_clock_info('monotonic').resolution, should also be used. Attached patch removes the two new attributes to make the code simpler. I created this issue to reopen the discussion, but I would prefer to keep the attributes. I wrote the patch to be able to compare the different options. It's just to ensure that everyone agree on the solution. The patch is a comprise, it solves partially the asyncio performance issue. With the patch, BaseEventLoop._run_once() may not executed a task even if there was a scheduled task, just because of timing rounding issues. So I modified the existing patch to tolerate "useless calls" to _run_once(). It was hard for me to analyze and choose the best solution for these issues because on my Fedora 20 (Linux kernel 3.12), the timings look "perfect". I'm unable to reproduce the sporadic timing issues (selector sleeping 8 ms or 9 ms whereas we asked to sleep 10 ms), whereas the test failed on many different buildbots. I suppose that depending on the hardware and the Linux kernel version, the exact resolution selectors is very different. I didn't test the patch on Windows yet. See issues #20311 and #20452 for the background and raw numbers. Note: the test_timeout_rounding() test of test_asyncio now pass on all buildbots: various platforms, selectors and hardwares. Note 2: If we decide to keep the BaseSelector.resolution attribute, I hesitate to replace it with a method because we might improve the read resolution later, which may require to execute code. For example, on Linux older than 2.6.28, the resolution can be computed by retrieving the HZ constant. It requires to check the OS and kernel version. ---------- files: remove_granularity.patch keywords: patch messages: 210170 nosy: gvanrossum, haypo, neologix priority: normal severity: normal status: open title: Remove resolution from selectors and granularity from asyncio versions: Python 3.4 Added file: http://bugs.python.org/file33892/remove_granularity.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 02:23:14 2014 From: report at bugs.python.org (Arup Chakravarty) Date: Tue, 04 Feb 2014 01:23:14 +0000 Subject: [New-bugs-announce] [issue20506] Command to display all available Import Library Message-ID: <1391476994.58.0.915135187283.issue20506@psf.upfronthosting.co.za> New submission from Arup Chakravarty: Have a built-in mechanism to display all available import libraries within the interpreter. Like what is available through the built-in dir function. ---------- components: Library (Lib) messages: 210171 nosy: arupchakrav priority: normal severity: normal status: open title: Command to display all available Import Library type: enhancement versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 12:09:02 2014 From: report at bugs.python.org (Gareth Rees) Date: Tue, 04 Feb 2014 11:09:02 +0000 Subject: [New-bugs-announce] [issue20507] TypeError from str.join has no message Message-ID: <1391512142.14.0.683696819623.issue20507@psf.upfronthosting.co.za> New submission from Gareth Rees: If you pass an object of the wrong type to str.join, Python raises a TypeError with no error message: Python 3.4.0b3 (default, Jan 27 2014, 02:26:41) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> ''.join(1) Traceback (most recent call last): File "", line 1, in TypeError It is unnecessarily hard to understand from this error what the problem actually was. Which object had the wrong type? What type should it have been? Normally a TypeError is associated with a message explaining which type was wrong, and what it should have been. For example: >>> b''.join(1) Traceback (most recent call last): File "", line 1, in TypeError: can only join an iterable It would be nice if the TypeError from ''.join(1) included a message like this. The reason for the lack of message is that PyUnicode_Join starts out by calling PySequence_Fast(seq, "") which suppresses the error message from PyObject_GetIter. This commit by Tim Peters is responsible: . The commit message doesn't mention the suppression of the message so I can assume that it was an oversight. I suggest replacing the line: fseq = PySequence_Fast(seq, ""); in PyUnicode_Join in unicodeobject.c with: fseq = PySequence_Fast(seq, "can only join an iterable"); for consistency with bytes_join in stringlib/join.h. Patch attached. ---------- components: Interpreter Core files: join.patch keywords: patch messages: 210200 nosy: Gareth.Rees priority: normal severity: normal status: open title: TypeError from str.join has no message type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file33900/join.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 14:09:31 2014 From: report at bugs.python.org (Gareth Rees) Date: Tue, 04 Feb 2014 13:09:31 +0000 Subject: [New-bugs-announce] [issue20508] IndexError from ipaddress._BaseNetwork.__getitem__ has no message Message-ID: <1391519371.56.0.280883005316.issue20508@psf.upfronthosting.co.za> New submission from Gareth Rees: If you try to look up an out-of-range address from an object returned by ipaddress.ip_network, then ipaddress._BaseNetwork.__getitem__ raises an IndexError with no message: Python 3.4.0b3 (default, Jan 27 2014, 02:26:41) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import ipaddress >>> ipaddress.ip_network('2001:db8::8/125')[100] Traceback (most recent call last): File "", line 1, in File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ipaddress.py", line 601, in __getitem__ raise IndexError IndexError Normally an IndexError is associated with a message explaining the cause of the error. For example: >>> [].pop() Traceback (most recent call last): File "", line 1, in IndexError: pop from empty list It would be nice if the IndexError from ipaddress._BaseNetwork.__getitem__ included a message like this. With the attached patch, the error message looks like this in the positive case: >>> ipaddress.ip_network('2001:db8::8/125')[100] Traceback (most recent call last): File "", line 1, in File "/Users/gdr/hg.python.org/cpython/Lib/ipaddress.py", line 602, in __getitem__ % (self, self.num_addresses)) IndexError: 100 out of range 0..7 for 2001:db8::8/125 and like this in the negative case: >>> ipaddress.ip_network('2001:db8::8/125')[-100] Traceback (most recent call last): File "", line 1, in File "/Users/gdr/hg.python.org/cpython/Lib/ipaddress.py", line 608, in __getitem__ % (n - 1, self.num_addresses, self)) IndexError: -100 out of range -8..-1 for 2001:db8::8/125 (If you have a better suggestion for how the error message should read, I could submit a revised patch. I suppose it could just say "address index out of range" for consistency with list.__getitem__ and str.__getitem__. But I think the extra information is likely to be helpful for the programmer who is trying to track down the cause of an error.) ---------- components: Library (Lib) files: ipaddress.patch keywords: patch messages: 210224 nosy: Gareth.Rees priority: normal severity: normal status: open title: IndexError from ipaddress._BaseNetwork.__getitem__ has no message type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file33903/ipaddress.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 16:53:33 2014 From: report at bugs.python.org (Marius Gedminas) Date: Tue, 04 Feb 2014 15:53:33 +0000 Subject: [New-bugs-announce] [issue20509] logging.config.fileConfig() docs could link to the config file format Message-ID: <1391529213.62.0.538303765352.issue20509@psf.upfronthosting.co.za> New submission from Marius Gedminas: When one is reading the description of logging.config.fileConfig() at http://docs.python.org/3.3/library/logging.config.html#logging.config.fileConfig not immediately apparent what the "configparser-format file" should contain (i.e. the naming convention for sections, and what keys mean what.) This is all nicely described at http://docs.python.org/3.3/library/logging.config.html#configuration-file-format but personal experience shows that users like me hit Page Down a few times and give up before they reach that part (and also they do not think to read the outline in the sidebar). It would be nice if there was a direct link, like in the attached patch. ---------- assignee: docs at python components: Documentation files: improve-fileconfig-docs.patch keywords: patch messages: 210245 nosy: docs at python, mgedmin priority: normal severity: normal status: open title: logging.config.fileConfig() docs could link to the config file format type: enhancement versions: Python 2.7, Python 3.3 Added file: http://bugs.python.org/file33907/improve-fileconfig-docs.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 17:09:06 2014 From: report at bugs.python.org (Gareth Rees) Date: Tue, 04 Feb 2014 16:09:06 +0000 Subject: [New-bugs-announce] [issue20510] Test cases in test_sys don't match the comments Message-ID: <1391530146.21.0.549410928914.issue20510@psf.upfronthosting.co.za> New submission from Gareth Rees: Lib/test/test_sys.py contains test cases with incorrect comments -- or comments with incorrect test cases, if you prefer: # call without argument try: sys.exit(0) except SystemExit as exc: self.assertEqual(exc.code, 0) ... # call with tuple argument with one entry # entry will be unpacked try: sys.exit(42) except SystemExit as exc: self.assertEqual(exc.code, 42) ... # call with integer argument try: sys.exit((42,)) except SystemExit as exc: self.assertEqual(exc.code, 42) ... (In the quote above I've edited out some inessential detail; see the file if you really want to know.) You can see that in the first test case sys.exit is called with an argument (although the comment claims otherwise); in the second it is called with an integer (not a tuple), and in the third it is called with a tuple (not an integer). These comments have been unchanged since the original commit by Walter D?rwald . I've attached a patch that corrects the first test case and swaps the comments for the second and third test cases: # call without argument rc = subprocess.call([sys.executable, "-c", "import sys; sys.exit()"]) self.assertEqual(rc, 0) # call with integer argument try: sys.exit(42) except SystemExit as exc: self.assertEqual(exc.code, 42) ... # call with tuple argument with one entry # entry will be unpacked try: sys.exit((42,)) except SystemExit as exc: self.assertEqual(exc.code, 42) ... Note that in the first test case (without an argument) sys.exit() with no argument actually raises SystemExit(None), so it's not sufficient to catch the SystemExit and check exc.code; I need to check that it actually gets translated to 0 on exit. ---------- components: Tests files: exittest.patch keywords: patch messages: 210246 nosy: Gareth.Rees priority: normal severity: normal status: open title: Test cases in test_sys don't match the comments type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file33908/exittest.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 18:40:31 2014 From: report at bugs.python.org (Yury Selivanov) Date: Tue, 04 Feb 2014 17:40:31 +0000 Subject: [New-bugs-announce] [issue20511] asyncio: StreamReader should use bytearray for its internal buffer Message-ID: <1391535631.01.0.473053250343.issue20511@psf.upfronthosting.co.za> New submission from Yury Selivanov: This issue on google code: https://code.google.com/p/tulip/issues/detail?id=124 ---------- files: sr_ba_01.patch keywords: needs review, patch messages: 210253 nosy: gvanrossum, haypo, pitrou, yselivanov priority: normal severity: normal status: open title: asyncio: StreamReader should use bytearray for its internal buffer Added file: http://bugs.python.org/file33912/sr_ba_01.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 19:48:23 2014 From: report at bugs.python.org (Alexis Daboville) Date: Tue, 04 Feb 2014 18:48:23 +0000 Subject: [New-bugs-announce] [issue20512] Python3.3 segfaults when using big5hkscs encoding Message-ID: <1391539703.53.0.816371062299.issue20512@psf.upfronthosting.co.za> New submission from Alexis Daboville: When using the 'big5hkscs' encoding it's possible to make Python3.3 segfault, here is how to repro: ? 13:41 adaboville @ adoboville-mbp in ~ $ py3 Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 13:52:24) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 'nb'.encode('big5hkscs') b'nb' >>> 'nb'.encode('big5hkscs') Segmentation fault: 11 Note that it doesn't crash on the first first line, but on the second (even though both lines are the same). FWIW pypy3.3 doesn't crash: ? 13:43 adaboville @ adoboville-mbp in .../pypy3-2.1-beta1-osx64 $ bin/pypy Python 3.2.3 (d63636b30cc0, Jul 30 2013, 07:02:48) [PyPy 2.1.0-beta1 with GCC 4.2.1 Compatible Clang Compiler] on darwin Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: ``why did you guys have to make the builtin fortune more interesting than actual work? i just catched myself restarting pypy 20 times'' >>>> 'nb'.encode('big5hkscs') b'nb' >>>> 'nb'.encode('big5hkscs') b'nb' >>>> ---------- messages: 210258 nosy: alexis.d priority: normal severity: normal status: open title: Python3.3 segfaults when using big5hkscs encoding type: crash versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 20:03:28 2014 From: report at bugs.python.org (Victor Scherba) Date: Tue, 04 Feb 2014 19:03:28 +0000 Subject: [New-bugs-announce] [issue20513] Script interruption on logoff from 0 session under Win2003 and earlier Message-ID: <1391540608.89.0.389395011233.issue20513@psf.upfronthosting.co.za> New submission from Victor Scherba: To get the bug: 1. Windows Server 2003 (same bug should be under earlier versions: XP, 2000, ...). 2. Any Windows service should spawn process with Python script. 3. Py script should stay into time.sleep. 4. Any Windows user should login in console session 0. 5. Bug: when this user logoff, script interrupts. To repeat the bug simply you could use srvany which spawn: python.exe -c "import time; time.sleep(10000)". There is problem in cpython/Modules/timemodule.c in PyCtrlHandler. Before logoff Windows broadcasts to all services and its children CTRL_LOGOFF_EVENT signal. But PyCtrlHandler doesn't filter it out by dwCtrlType and always sets hInterruptEvent. This forces script interruption. CTRL_SHUTDOWN_EVENT also should be filtered out. CTRL_SHUTDOWN_EVENT broacasted to all services before Windows shutdown. But after it has been handled, other process can block or pause shutdowning. Default Windows console control handler does not call ExitProcess when processing the CTRL_LOGOFF_EVENT and CTRL_SHUTDOWN_EVENT signals. See more at http://msdn.microsoft.com/en-us/library/windows/desktop/ms683242(v=vs.85).aspx On Win Vista and higher bug not presents. Impossible to login to session 0 because of session 0 isolation. Patch attached. There is same fix in cpython/Modules/_multiprocessing/multiprocessing.c ---------- components: Extension Modules, Windows messages: 210259 nosy: vScherba priority: normal severity: normal status: open title: Script interruption on logoff from 0 session under Win2003 and earlier type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Feb 4 23:27:12 2014 From: report at bugs.python.org (Robert Copperwhite) Date: Tue, 04 Feb 2014 22:27:12 +0000 Subject: [New-bugs-announce] [issue20514] Errno 10013 - ipython notebook Message-ID: <1391552832.57.0.277394042566.issue20514@psf.upfronthosting.co.za> New submission from Robert Copperwhite: Hello, I've recently installed ipython (Anaconda) and haven't managed to get up and running. When I execute "ipython notebook" from the command prompt I get the attached error message, basically: "Errno 10013: An attempt was made to access a socket in a way forbidden by its access permissions". I have disabled all firewalls, and even uninstalled McAfee but no resolution. Would be grateful for some recommendations on what to try next. Thanks ---------- components: Installation messages: 210272 nosy: robertc priority: normal severity: normal status: open title: Errno 10013 - ipython notebook type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Feb 5 00:09:12 2014 From: report at bugs.python.org (Christian Heimes) Date: Tue, 04 Feb 2014 23:09:12 +0000 Subject: [New-bugs-announce] [issue20515] Null pointer dereference in tkinter module Message-ID: <1391555352.52.0.553421944384.issue20515@psf.upfronthosting.co.za> New submission from Christian Heimes: varname_converter() doesn't check the return value of PyUnicode_AsUTF8AndSize() for NULL. The bug was introduced by http://hg.python.org/cpython/rev/321b714653e3 / issue #20368 3. returned_null: Function "PyUnicode_AsUTF8AndSize(PyObject *, Py_ssize_t *)" returns null (checked 28 out of 30 times).[show details] 4. var_assigned: Assigning: "s" = null return value from "PyUnicode_AsUTF8AndSize(PyObject *, Py_ssize_t *)". 1399 s = PyUnicode_AsUTF8AndSize(in, &size); 5. Condition "size > 2147483647", taking false branch 1400 if (size > INT_MAX) { 1401 PyErr_SetString(PyExc_OverflowError, "string is too long"); 1402 return 0; 1403 } CID 1167595 (#1 of 1): Dereference null return value (NULL_RETURNS)6. dereference: Dereferencing a pointer that might be null "s" when calling "strlen(char const *)" 1404 if (strlen(s) != size) { ---------- components: Tkinter files: cid1167595.patch keywords: patch messages: 210276 nosy: christian.heimes, larry, serhiy.storchaka priority: release blocker severity: normal stage: patch review status: open title: Null pointer dereference in tkinter module type: crash versions: Python 3.4 Added file: http://bugs.python.org/file33918/cid1167595.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Feb 5 03:56:55 2014 From: report at bugs.python.org (Glenn Langford) Date: Wed, 05 Feb 2014 02:56:55 +0000 Subject: [New-bugs-announce] [issue20516] Concurrent.futures base concurrency improvement (with patch) Message-ID: <1391569015.82.0.789033083368.issue20516@psf.upfronthosting.co.za> New submission from Glenn Langford: The current approach taken in as_completed() and wait() is to immediately lock the entire set of given Futures simultaneously. This limits concurrency, particularly when the number of futures is large, and also requires the complete set of Futures to be known up front. A different approach is to lock Futures one at a time, as they are given. In the case of as_completed(), completed futures can be yielded immediately. For completed futures, a waiter also does not have to be installed (whereas the current implementation installs waiters for all given Futures, regardless of state). A demonstration patch is attached which - locks Futures one at a time for as_completed() and all variations of wait() - reduces the overhead in tracking the state of each Future - makes it easier to add other user APIs if desired later - consolidates the machinery into a new internal class, reducing the amount of code ---------- components: Library (Lib) files: futures-base.patch keywords: patch messages: 210286 nosy: bquinlan, glangford, haypo, pitrou priority: normal severity: normal status: open title: Concurrent.futures base concurrency improvement (with patch) type: enhancement versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file33920/futures-base.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Feb 5 04:43:10 2014 From: report at bugs.python.org (Larry Hastings) Date: Wed, 05 Feb 2014 03:43:10 +0000 Subject: [New-bugs-announce] [issue20517] Support errors with two filenames for errno exceptions Message-ID: <1391571790.8.0.840627368503.issue20517@psf.upfronthosting.co.za> New submission from Larry Hastings: There are a bunch of functions provided by Python, e.g. PyErr_SetFromErrnoWithFilenameObject(), that allow specifying a filename associated with the error. But there are some errors that really need two filenames, like copy(), symlink(), and rename(). The error could be on only one file, but some errors could apply to either or both, and errno's error doesn't always provide enough context to tell which it would be. I propose that we add new APIs that allow specifying a second filename. We take all the *WithFilename* APIs and add the *WithFilenames* equivalent (e.g. PyErr_SetFromErrnoWithFilenameObjects()). Internally, oserror_parse_args() would now parse an extra "filename2" entry in the tuple, just after the "filename" entry (but before the possible "winerror" entry). Currently when formatting an error with a filename, the format string looks like [Errno {errno}] {errstring}: {filename} I propose that for two filenames it look like [Errno {errno}] {errstring}: \"{filename}\" -> \"{filename2}\" ---------- messages: 210290 nosy: georg.brandl, larry, richard, serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: Support errors with two filenames for errno exceptions type: enhancement versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Feb 5 09:30:36 2014 From: report at bugs.python.org (Martin Teichmann) Date: Wed, 05 Feb 2014 08:30:36 +0000 Subject: [New-bugs-announce] [issue20518] Weird behavior with multiple inheritance when C classes involved Message-ID: <1391589036.91.0.744972661823.issue20518@psf.upfronthosting.co.za> New submission from Martin Teichmann: Python behaves odd with regards to multiple inheritance and classes written in C. I stumbled over this problem while working with PyQt4, but soon realized that part of the problem is not actually in that library, but is deep down in the CPython core. For better understanding of this post, I still use PyQt4 as an example. For those who don't know PyQt4, it's an excellent Python binding for some C++ library, for this post you only need to know that QTimer is a class that inherits from QObject. The PyQt4 documentation repeatedly insists that it is not possible to inherit more than one of its classes. This is not astonishing, since this is actually a limitation of CPython. What should still be possible is to inherit from two classes if one is the parent of the other. Let me give an example: ======================================== from PyQt4.QtCore import QObject, QTimer # QObject is the parent of QTimer class A(QObject): pass class B(A, QTimer): pass class C(QTimer, A): pass print(B.__base__, B.__mro__) print(C.__base__, C.__mro__) ======================================== Both classes B and C technically inherit from both QObject and QTimer, but given that QTimer inherits from QObject, there is no actual multiple inheritance here, from the perspective of a class written in C. But now the problems start. The metaclass of PyQt4 uses the __base__ class attribute to find out which of its classes the new class actually decends from (this is called the "best_base" in typeobject.c). This is the correct behavior, this is exactly what __base__ is for. Lets see what it contains. For the class B, the second-to-last line prints: (, , , , , , ) So, __base__ is set to class A. This is incorrect, as PyQt4 now thinks it should create a QObject. The reason is the weird algorithm that typeobject.c uses: it tries to find the most special class that does not change the size of the its instances (called the solid_base). This sounds reasonable at first, because only classes written in C can change the size of their instances. Unfortunately, this does not hold the other way around: in PyQt4, the instances only contain a pointer to the actual data structures, so all instances of all PyQt4 classes have the same size, and __base__ will simply default to __bases__[0]. Now I tried to outsmart this algorithm, why not put the PyQt4 class as the first parent class? This is what the class C is for in my example. And indeed, the last line of my example prints: (, , , , , , ) So hooray, __base__ is set to QTimer, the metaclass will inherit from the correct class! But well, there is a strong drawback: now the MRO, which I print in the same example, has a mixture of Python and PyQt4 classes in it. Unfortunately, the methods of the PyQt4 classes do not call super, so they are uncooperative when it comes to multiple inheritance. This is expected, as they are written in C++, a language that has a weird concept of cooperative multiple inheritance, if it has one at all. So, to conclude: it is sometimes not possible to use python cooperative multiple inheritance if C base classes are involved. This is a bummer. Can we change this behavior? Yes, certainly. The clean way would be to re-write typeobject.c to actually find the best_base in a sane way. This would be easiest if we could just find out somehow whether a class is written in Python or in C, e.g. by adding a tp_flag to PyTypeObject. best_base would then point to the most specialized parent written in C. A simpler solution would be to default to __bases__[-1] for __base__, then we can tell users to simply put their uncooperative base classes last in the list of bases. ---------- components: Interpreter Core messages: 210291 nosy: Martin.Teichmann priority: normal severity: normal status: open title: Weird behavior with multiple inheritance when C classes involved type: behavior versions: Python 2.7, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Feb 5 12:52:23 2014 From: report at bugs.python.org (Gustavo J. A. M. Carneiro) Date: Wed, 05 Feb 2014 11:52:23 +0000 Subject: [New-bugs-announce] [issue20519] uuid.uuid4().hex generates garbage when ctypes available Message-ID: <1391601143.27.0.910101155735.issue20519@psf.upfronthosting.co.za> New submission from Gustavo J. A. M. Carneiro: If you try the attached program, you will find that for every iteration the uuid.uuid4() call generates objects that contain reference cycles and need the help of the garbage collector. This is not nice. If I make the ctypes module not able to import, then no garbage is generated. This problem appears in 2.7, 3.3, and 3.4, at least. ---------- components: Library (Lib) files: gc.py messages: 210306 nosy: gustavo priority: normal severity: normal status: open title: uuid.uuid4().hex generates garbage when ctypes available type: resource usage versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33925/gc.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Feb 5 14:09:34 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Wed, 05 Feb 2014 13:09:34 +0000 Subject: [New-bugs-announce] [issue20520] Readline test in test_codecs is broken Message-ID: <1391605774.47.0.366195437882.issue20520@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The ReadTest.test_readline test in Lib/test/test_codecs.py has two loops on "\n \r\n \r \u2028".split(). But as far as "\n \r\n \r \u2028".split() is empty list (because newline characters are whitespace characters), the bodies of these loops are never executed. After fixing this bug, a number of other tests were exposed. I tried to fix them. The purpose of these tests is not entirely clear, so I'm not sure that it is properly grasped the idea of the author. Test was added in issue1076985 and modified in issue1175396. ---------- components: Tests files: test_codecs_readline.patch keywords: patch messages: 210309 nosy: doerwalter, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Readline test in test_codecs is broken type: behavior versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33928/test_codecs_readline.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Feb 5 14:56:12 2014 From: report at bugs.python.org (Sven Berkvens-Matthijsse) Date: Wed, 05 Feb 2014 13:56:12 +0000 Subject: [New-bugs-announce] [issue20521] [PATCH] Cleanup for "dis" module documentation Message-ID: <1391608572.54.0.381225308012.issue20521@psf.upfronthosting.co.za> New submission from Sven Berkvens-Matthijsse: The documentation for the "dis" module has a wrong opcode name in it (POP_STACK instead of POP_TOP). Furthermore, the patch fixes inconsistent use of markers for code and opcodes. ---------- assignee: docs at python components: Documentation files: dis-doc.patch keywords: patch messages: 210314 nosy: docs at python, svenberkvens priority: normal severity: normal status: open title: [PATCH] Cleanup for "dis" module documentation type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file33929/dis-doc.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Feb 5 15:59:12 2014 From: report at bugs.python.org (Simone Serrajotto) Date: Wed, 05 Feb 2014 14:59:12 +0000 Subject: [New-bugs-announce] [issue20522] pandas version 0.13.0 does not give warning when summing float with object Message-ID: New submission from Simone Serrajotto: Good afternoon, I have just installed pandas 0.13.0 and was observing some strange results produced by old codes. One major issue is that I found that when summing two columns of a dataframe, one of which is a float64 and the other an object, the result includes just the float64 columns. This would be not an issue per se, but no warning message is displayed. I think a warning in this case is of paramount importance. Regards, Simone -- Simone Serrajotto Quaestio Capital Management SGR SpA Unipersonale Corso Como 15 (8? piano) 20154 Milano C.F. e P.I. 06803880969 Iscritta all'Albo delle SGR al n. 299 Mobile: +39 393 919 0217 Tel: +39 02 3676 5241 E-Mail: s.serrajotto at quaestiocapital.com -- Le informazioni contenute nella comunicazione che precede sono riservate e destinate esclusivamente alla persona o all'ente sopraindicati. La diffusione, distribuzione e/o copiatura del presente email o di qualsiasi documento allegato da parte di qualsiasi soggetto diverso dal destinatario e' proibita. La sicurezza e la correttezza dei messaggi di posta elettronica non possono essere garantite. Se avete ricevuto questo messaggio per errore, Vi preghiamo di contattarci immediatamente. Grazie The content of this email is confidential and it is intended for the sole use of the addressees. The transmission, distribution and/or copy of this email or any document attached hereto by any person other than the addressees is prohibited. The transmission of this email cannot be guaranteed to be secure or error-free. If you have received this communication unintentionally, please inform us immediately. Thank you. ---------- messages: 210323 nosy: serrajo priority: normal severity: normal status: open title: pandas version 0.13.0 does not give warning when summing float with object _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Feb 5 22:57:33 2014 From: report at bugs.python.org (mbyt) Date: Wed, 05 Feb 2014 21:57:33 +0000 Subject: [New-bugs-announce] [issue20523] global .pdbrc on windows 7 not reachable out of the box Message-ID: <1391637453.5.0.977818995818.issue20523@psf.upfronthosting.co.za> New submission from mbyt: The global .pdbrc file is determined by the %HOME% environment variable. However, this is not available out of the box on e.g. windows 7 systems. Here only %HOMEDRIVE% and %HOMEPATH% are defined. Thus the usual approach to have a global .pdbrc file on windows is to define a %HOME% environment variable by hand. This could be avoided if the global .pdbrc would be determined by os.path.expanduser("~/.pdbrc"), which works on current windows and does the magic behind. There are two possible approaches to improve this situation: * explicitly mention in the docs that on windows a %HOME% varialbe need to be created manually * patch pdb.py to use os.path.expanduser instead (see attached diff) For reference, see also old discussion https://mail.python.org/pipermail/python-list/2005-October/349550.html. ---------- files: pdb.diff keywords: patch messages: 210349 nosy: mbyt priority: normal severity: normal status: open title: global .pdbrc on windows 7 not reachable out of the box type: enhancement Added file: http://bugs.python.org/file33935/pdb.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 00:23:15 2014 From: report at bugs.python.org (R. David Murray) Date: Wed, 05 Feb 2014 23:23:15 +0000 Subject: [New-bugs-announce] [issue20524] format error messages should provide context information Message-ID: <1391642595.93.0.722493013717.issue20524@psf.upfronthosting.co.za> New submission from R. David Murray: Consider the following: '{run_time:%H:%M:%S}, ,COM,DA{id},"{title:.43}",{id},{length:%M:%S}'.format(**mydict) The error message I got was: Invalid format specifier The problem turned out to be that the value of the 'length' key was an integer instead of a datetime.time(), but it sure wasn't easy to figure out which bit of the format string or which variable was the problem. It would be nice for the format error message to include the pattern that it is parsing when it hits the error. The type of the value being substituted would also be nice. Perhaps something like: The format specifier in {length:%HH:%MM} is not valid for type int() ---------- components: Library (Lib) messages: 210351 nosy: eric.smith, r.david.murray priority: normal severity: normal status: open title: format error messages should provide context information _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 08:58:12 2014 From: report at bugs.python.org (Vajrasky Kok) Date: Thu, 06 Feb 2014 07:58:12 +0000 Subject: [New-bugs-announce] [issue20525] Got compiler warning when compiling readline module Message-ID: <1391673492.51.0.068271536657.issue20525@psf.upfronthosting.co.za> New submission from Vajrasky Kok: On Fedora 20, I got this compiler warning: /home/sky/Code/python/cpython3.4/Modules/readline.c: In function ?flex_complete?: /home/sky/Code/python/cpython3.4/Modules/readline.c:962:5: warning: passing argument 1 of ?completion_matches? discards ?const? qualifier from pointer target type [enabled by default] result = completion_matches(text, *on_completion); ^ /home/sky/Code/python/cpython3.4/Modules/readline.c:40:15: note: expected ?char *? but argument is of type ?const char *? extern char **completion_matches(char *, rl_compentry_func_t *); ^ Here is the patch using Christian Heimes' strategy in silencing compiler warning in dbm module. http://hg.python.org/cpython/rev/3068ff3d9d1e ---------- components: Extension Modules files: fix_compile_warning_readline.patch keywords: patch messages: 210364 nosy: vajrasky priority: normal severity: normal status: open title: Got compiler warning when compiling readline module type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file33938/fix_compile_warning_readline.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 10:14:02 2014 From: report at bugs.python.org (STINNER Victor) Date: Thu, 06 Feb 2014 09:14:02 +0000 Subject: [New-bugs-announce] [issue20526] python: Modules/gcmodule.c:379: visit_decref: Assertion `((gc)->gc.gc_refs >> (1)) != 0' failed. Message-ID: <1391678042.33.0.420181737425.issue20526@psf.upfronthosting.co.za> New submission from STINNER Victor: While trying to reproduce a race condition in asyncio, I got an assertion error from the Python garbage collector at exit. It's not easy to reproduce the issue: run attached script on Python 3.4 compiled in debug mode (to get assertions) and press CTRL+c twice. It looks like the bug occurs more often after at least 400 runs. The Future class of the asyncio may store an exception in its private Future._exception attribute. An exception stores a traceback. I don't know if it's related. Output: --- ... run #347 ^CTraceback (most recent call last): File "x.py", line 73, in main() File "x.py", line 70, in main el.join() File "/home/haypo/prog/python/default/Lib/threading.py", line 1061, in join self._wait_for_tstate_lock() File "/home/haypo/prog/python/default/Lib/threading.py", line 1077, in _wait_for_tstate_lock elif lock.acquire(block, timeout): run #348 KeyboardInterrupt ... run #364 run #365 run #366 run #367 -cancelled- run #368 ^CException ignored in: Traceback (most recent call last): File "/home/haypo/prog/python/default/Lib/threading.py", line 1295, in _shutdown t.join() File "/home/haypo/prog/python/default/Lib/threading.py", line 1061, in join self._wait_for_tstate_lock() File "/home/haypo/prog/python/default/Lib/threading.py", line 1077, in _wait_for_tstate_lock elif lock.acquire(block, timeout): KeyboardInterrupt -cancelled- python: Modules/gcmodule.c:379: visit_decref: Assertion `((gc)->gc.gc_refs >> (1)) != 0' failed. Abandon (core dumped) $ ls *core python-6564.core $ gdb ./python -c python-6564.core Core was generated by `./python x.py'. Program terminated with signal SIGABRT, Aborted. (gdb) where #0 0x0000003f3a835c59 in raise () from /lib64/libc.so.6 #1 0x0000003f3a837368 in abort () from /lib64/libc.so.6 #2 0x0000003f3a82ebb6 in __assert_fail_base () from /lib64/libc.so.6 #3 0x0000003f3a82ec62 in __assert_fail () from /lib64/libc.so.6 #4 0x000000000043ac66 in visit_decref ( op=Frame 0x7f013c001398, for file x.py, line 43, in task (self=, _selector=) at remote 0x7f014c3bff60>, _epoll=, _fd_to_key={5: }) at remote 0x7f014c3bfae8>, _granularity=, _ssock=, _internal_fds=1, _csock=, _signal_handlers={}) at remote 0x7f014c437400>, _is_stopped=False, _target=None, _daemonic=False, executor=, acquire=, _lock=<_thread.lock at remote 0x7f014c3bb1a0>, _waiters=, arg=0x0) at Python/traceback.c:64 #6 0x000000000043acdc in subtract_refs (containers=0x8f1a20 ) at Modules/gcmodule.c:398 #7 0x000000000043bdee in collect (generation=2, n_collected=0x7fff499317c0, n_uncollectable=0x7fff499317b8, nofail=0) at Modules/gcmodule.c:957 #8 0x000000000043c455 in collect_with_callback (generation=2) at Modules/gcmodule.c:1128 #9 0x000000000043d1d5 in PyGC_Collect () at Modules/gcmodule.c:1604 #10 0x000000000041e959 in Py_Finalize () at Python/pythonrun.c:605 #11 0x000000000043a890 in Py_Main (argc=2, argv=0x22bb020) at Modules/main.c:771 #12 0x000000000041aba9 in main (argc=2, argv=0x7fff49931ab8) at ./Modules/python.c:69 (gdb) frame 4 #4 0x000000000043ac66 in visit_decref ( (gdb) print op $3 = Frame 0x7f013c001398, for file x.py, line 43, in task (self=, _selector=) at remote 0x7f014c3bff60>, _epoll=, _fd_to_key={5: }) at remote 0x7f014c3bfae8>, _granularity=, _ssock=, _internal_fds=1, _csock=, _signal_handlers={}) at remote 0x7f014c437400>, _is_stopped=False, _target=None, _daemonic=False, executor=, acquire=, _lock=<_thread.lock at remote 0x7f014c3bb1a0>, _waiters=gc.gc_refs >> (1)) != 0' failed. type: crash versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 10:19:32 2014 From: report at bugs.python.org (OscaTutenchamon) Date: Thu, 06 Feb 2014 09:19:32 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue20527=5D_multiprocessing=2E?= =?utf-8?q?Queue_deadlocks_after_=E2=80=9Creader=E2=80=9D_process_death?= Message-ID: <1391678372.4.0.26319787903.issue20527@psf.upfronthosting.co.za> New submission from OscaTutenchamon: I've experienced that queue can be deadlocked for reading when: 1. The "reader" process is using `get` with timeout > 0: self.queue.get(timeout=3) 2. "reader" dies while `get` is blocking due to timeout. After that queue's `_rlock` is never being released so reading becomes impossible. Application demonstrating the problem. I create two child processes "Worker" (putting into queue) and "Receiver" (getting from queue). Also parent process periodically checks if his children are alive and starts new child if needed. #!/usr/bin/env python # -*- coding: utf-8 -*- import multiprocessing import procname import time class Receiver(multiprocessing.Process): ''' Reads from queue with 3 secs timeout ''' def __init__(self, queue): multiprocessing.Process.__init__(self) self.queue = queue def run(self): procname.setprocname('Receiver') while True: try: msg = self.queue.get(timeout=3) print '<<< `{}`, queue rlock: {}'.format( msg, self.queue._rlock) except multiprocessing.queues.Empty: print '<<< EMPTY, Queue rlock: {}'.format( self.queue._rlock) pass class Worker(multiprocessing.Process): ''' Puts into queue with 1 sec sleep ''' def __init__(self, queue): multiprocessing.Process.__init__(self) self.queue = queue def run(self): procname.setprocname('Worker') while True: time.sleep(1) print 'Worker: putting msg, Queue size: ~{}'.format( self.queue.qsize()) self.queue.put('msg from Worker') if __name__ == '__main__': queue = multiprocessing.Queue() worker = Worker(queue) worker.start() receiver = Receiver(queue) receiver.start() while True: time.sleep(1) if not worker.is_alive(): print 'Restarting worker' worker = Worker(queue) worker.start() if not receiver.is_alive(): print 'Restarting receiver' receiver = Receiver(queue) receiver.start() Colored version here: http://pastebin.com/YifY63vE Console output. $ python queuetest.py Worker: putting msg, Queue size: ~0 <<< `msg from Worker`, queue rlock: Worker: putting msg, Queue size: ~0 <<< `msg from Worker`, queue rlock: Restarting receiver <-- killed Receiver with SIGTERM Worker: putting msg, Queue size: ~0 Worker: putting msg, Queue size: ~1 Worker: putting msg, Queue size: ~2 <<< EMPTY, Queue rlock: Worker: putting msg, Queue size: ~3 Worker: putting msg, Queue size: ~4 Worker: putting msg, Queue size: ~5 <<< EMPTY, Queue rlock: Worker: putting msg, Queue size: ~6 Worker: putting msg, Queue size: ~7 System information. $ uname -sr Linux 3.11.8-200.fc19.x86_64 $ python -V Python 2.7.5 In [3]: multiprocessing.__version__ Out[3]: '0.70a1' ---------- components: Library (Lib) messages: 210369 nosy: OscaTutenchamon priority: normal severity: normal status: open title: multiprocessing.Queue deadlocks after ?reader? process death type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 11:08:45 2014 From: report at bugs.python.org (Gunnar Aastrand Grimnes) Date: Thu, 06 Feb 2014 10:08:45 +0000 Subject: [New-bugs-announce] [issue20528] fileinput module will read whole file into memory when using fileinput.hook_encoded due to codecs.StreamReader.readlines Message-ID: <1391681325.2.0.183803213887.issue20528@psf.upfronthosting.co.za> New submission from Gunnar Aastrand Grimnes: When reading large files with fileinput, it will work as expected and only process a line at a time when used normally, but if you add an hook_encoded openhook it will read the whole file into memory before returning the first line. Verify by running this program on a large text file: import fileinput for l in fileinput.input(openhook=fileinput.hook_encoded('iso-8859-1')): raw_input() and check how much memory it uses. Remove the openhook and memory usage goes down to nothing. The problem is that fileinput calls readlines with a size-hint and in codecs.StreamReader, readlines explicitly ignores this hint and reads all lines into memory. http://bugs.python.org/issue20501 is open for fixing up the documentation for fileinput, but a fix would also be nice. I see two options: 1. As suggested by r.david.murray: Give us a way of signaling to fileinput that it should not use readlines, for instance by setting buffer=None 2. Fix the codecs module to allow StreamReader to respect the hint if given. Although the comment there says it's no efficient way to do this, at least an inefficient way would be better than reading a possibly infinite stream in. A simple solution would be to repeatedly call readline. A more complicated solution would be to read chunks from the stream, and then encode them, just like the readline method does. BTW - this issue is py2.7 only, I tested a file object from io.open with encoding in 3.3 and it supports readlines just fine. ---------- components: IO messages: 210371 nosy: gromgull priority: normal severity: normal status: open title: fileinput module will read whole file into memory when using fileinput.hook_encoded due to codecs.StreamReader.readlines versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 13:13:42 2014 From: report at bugs.python.org (=?utf-8?q?Bernt_R=C3=B8skar_Brenna?=) Date: Thu, 06 Feb 2014 12:13:42 +0000 Subject: [New-bugs-announce] [issue20529] Unittest displays ResourceWarning warnings when running tests, it probably should not Message-ID: <1391688822.97.0.233110009283.issue20529@psf.upfronthosting.co.za> New submission from Bernt R?skar Brenna: Given the following file test_reswarn.py: ==== import unittest class TestResourceWarning(unittest.TestCase): def test_it(self): self.assertIn("TestResourceWarning", open(__file__).read()) ==== Running the test: ==== $ python -m unittest test_reswarn.py ./test_reswarn.py:6: ResourceWarning: unclosed file <_io.TextIOWrapper name='./test_reswarn.py' mode='r' encoding='UTF-8'> self.assertIn("TestResourceWarning", open(__file__).read()) . ---------------------------------------------------------------------- Ran 1 test in 0.000s OK ==== When running the unit test using unittest, ResourceWarning warnings are displayed. In my experience using open("filename") without explicitly closing the file is pretty common and would usually not be an error, since the file will be closed when the reference goes out of scope (or am I wrong?). Therefore I believe that unittest should not emit ResourceWarning warnings. ---------- components: Library (Lib) messages: 210377 nosy: Bernt.R?skar.Brenna priority: normal severity: normal status: open title: Unittest displays ResourceWarning warnings when running tests, it probably should not type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 15:09:10 2014 From: report at bugs.python.org (Larry Hastings) Date: Thu, 06 Feb 2014 14:09:10 +0000 Subject: [New-bugs-announce] [issue20530] Change the text signature format (again) to be more robust Message-ID: <1391695750.05.0.146053236138.issue20530@psf.upfronthosting.co.za> New submission from Larry Hastings: Following a new discussion of the format of the text signature, I decided to go with this: (...)\n--\n\n See here for the discussion: https://mail.python.org/pipermail/python-dev/2014-February/132271.html Patch attached implementing this approach. Can I get a review? I want this in before tagging for rc1 on Saturday. Other changes: * clinic.py now generates the "/" marker in sigantures to denote positional-only parameters. * clinic.py --make is a lot faster; it prescans the file for any clinic block signatures, and if it doesn't see any it skips the file. * When generating the docstring for a function with optional groups, the signature generated is not intended to be machine-readable. So it omits the "$", the "/", and the "--" markers. (See Modules/_cursesmodule.c for the one and only example.) ---------- assignee: larry files: larry.even.newerer.signature.syntax.1.diff keywords: patch messages: 210380 nosy: georg.brandl, larry, ncoghlan, serhiy.storchaka, yselivanov, zach.ware priority: release blocker severity: normal stage: patch review status: open title: Change the text signature format (again) to be more robust type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file33941/larry.even.newerer.signature.syntax.1.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 15:44:54 2014 From: report at bugs.python.org (Jason R. Coombs) Date: Thu, 06 Feb 2014 14:44:54 +0000 Subject: [New-bugs-announce] [issue20531] TypeError in e-mail.parser when non-ASCII is present Message-ID: <1391697894.48.0.687210900333.issue20531@psf.upfronthosting.co.za> New submission from Jason R. Coombs: As reported in https://bitbucket.org/dholth/wheel/issue/104, the email.parser no longer accepts Unicode content as it did in 3.3. I searched the What's New and module documentation, but found no indication that this behavior is no longer supported, so it appears to be a regression. If it's an intentional change, the behavior should be documented in one of the aforementioned documents. Consider this simple test case: # -*- coding: utf-8 -*- import email.parser meta = """ Header: ? """ email.parser.Parser().parsestr(meta) Run that on Python 3.3.3 or Python 2 and it executes silently. Run it on Python 3.4.0b3 and it produces this traceback: Traceback (most recent call last): File "C:\Users\jaraco\projects\public\wheel\test.py", line 6, in email.parser.Parser().parsestr(meta) File "C:\Program Files\Python34\lib\email\parser.py", line 70, in parsestr return self.parse(StringIO(text), headersonly=headersonly) File "C:\Program Files\Python34\lib\email\parser.py", line 60, in parse return feedparser.close() File "C:\Program Files\Python34\lib\email\feedparser.py", line 170, in close self._call_parse() File "C:\Program Files\Python34\lib\email\feedparser.py", line 163, in _call_parse self._parse() File "C:\Program Files\Python34\lib\email\feedparser.py", line 449, in _parsegen self._cur.set_payload(EMPTYSTRING.join(lines)) File "C:\Program Files\Python34\lib\email\message.py", line 311, in set_payload " payload") from None TypeError: charset argument must be specified when non-ASCII characters are used in the payload ---------- components: email keywords: 3.4regression messages: 210390 nosy: barry, jason.coombs, r.david.murray priority: normal severity: normal status: open title: TypeError in e-mail.parser when non-ASCII is present versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 18:59:44 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 06 Feb 2014 17:59:44 +0000 Subject: [New-bugs-announce] [issue20532] Mark all tests which use _testcapi as CPython only Message-ID: <1391709584.86.0.554035328709.issue20532@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch marks all tests which use _testcapi as CPython only. Usually such tests don't make sense in alternative implementations. In particular tests which test integer overflow rely on implementation details. This should help to use common tests for different implementations. ---------- components: Tests files: testcapi_cpython_only.patch keywords: patch messages: 210409 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Mark all tests which use _testcapi as CPython only type: behavior versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33946/testcapi_cpython_only.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 21:07:50 2014 From: report at bugs.python.org (Rihards) Date: Thu, 06 Feb 2014 20:07:50 +0000 Subject: [New-bugs-announce] [issue20533] bug? Message-ID: <1391717270.59.0.361887326054.issue20533@psf.upfronthosting.co.za> New submission from Rihards: Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> 11.29-6.29 4.999999999999999 >>> 11.30-6.30 5.000000000000001 >>> ---------- messages: 210412 nosy: Rihards priority: normal severity: normal status: open title: bug? _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 22:25:50 2014 From: report at bugs.python.org (Ethan Furman) Date: Thu, 06 Feb 2014 21:25:50 +0000 Subject: [New-bugs-announce] [issue20534] Enum tests fail with pickle protocol 4 Message-ID: <1391721950.3.0.401090497621.issue20534@psf.upfronthosting.co.za> New submission from Ethan Furman: enum34, the Enum backport, specifically uses `protocol=HIGHEST_PROTOCOL`, while the current enum tests just use the default. Running the enum34 test expose an issue with pickle protocol 4: ====================================================================== ERROR: test_subclasses_with_getnewargs (__main__.TestEnum) ---------------------------------------------------------------------- Traceback (most recent call last): File "test_enum.py", line 1022, in test_subclasses_with_getnewargs self.assertEqual(loads(dumps(NI5, protocol=HIGHEST_PROTOCOL)), 5) _pickle.PicklingError: Can't pickle .NamedInt'>: attribute lookup TestEnum.test_subclasses_with_getnewargs..NamedInt on __main__ failed ====================================================================== ERROR: test_tuple_subclass (__main__.TestEnum) ---------------------------------------------------------------------- Traceback (most recent call last): File "test_enum.py", line 1100, in test_tuple_subclass self.assertTrue(loads(dumps(SomeTuple.first, protocol=HIGHEST_PROTOCOL)) is SomeTuple.first) _pickle.PicklingError: Can't pickle : attribute lookup TestEnum.test_tuple_subclass..SomeTuple on __main__ failed ---------- messages: 210419 nosy: alexandre.vassalotti, ethan.furman, pitrou priority: high severity: normal stage: test needed status: open title: Enum tests fail with pickle protocol 4 type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Feb 6 22:55:17 2014 From: report at bugs.python.org (Arfrever Frehtes Taifersar Arahesis) Date: Thu, 06 Feb 2014 21:55:17 +0000 Subject: [New-bugs-announce] [issue20535] run_tests.py: Work around issues 20355 and 20361 Message-ID: <1391723717.25.0.167441884978.issue20535@psf.upfronthosting.co.za> New submission from Arfrever Frehtes Taifersar Arahesis: Tools/scripts/run_tests.py contains: def main(regrtest_args): args = [sys.executable, '-W', 'default', # Warnings set to 'default' '-bb', # Warnings about bytes/bytearray '-E', # Ignore environment variables ] As described in issues #20355 and #20361, -bb fails to enable BytesWarning errors. I suggest to include a small workaround, which will be deleted in Python 3.5. I attach patch. ---------- components: Tests files: run_tests.py.patch keywords: patch messages: 210423 nosy: Arfrever, serhiy.storchaka priority: normal severity: normal status: open title: run_tests.py: Work around issues 20355 and 20361 versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33948/run_tests.py.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 00:42:19 2014 From: report at bugs.python.org (Stefan Krah) Date: Thu, 06 Feb 2014 23:42:19 +0000 Subject: [New-bugs-announce] [issue20536] statistics._decimal_to_ratio() produces non-integer ratio Message-ID: <1391730139.77.0.406178455931.issue20536@psf.upfronthosting.co.za> New submission from Stefan Krah: As I understand, _decimal_to_ratio() should always produce an integer ratio. But it does not for positive exponents: >>> import statistics >>> statistics.mean([Decimal("100"), Decimal("200")]) Decimal('150') >>> statistics.mean([Decimal("1e2"), Decimal("2e2")]) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.4/statistics.py", line 308, in mean return _sum(data)/n File "/usr/local/lib/python3.4/statistics.py", line 166, in _sum total += Fraction(n, d) File "/usr/local/lib/python3.4/fractions.py", line 163, in __new__ raise TypeError("both arguments should be " TypeError: both arguments should be Rational instances >>> >>> statistics._decimal_to_ratio(Decimal("1e2")) (1, 0.01) >>> 1e2.as_integer_ratio() (100, 1) ---------- components: Library (Lib) messages: 210427 nosy: skrah, stevenjd priority: high severity: normal stage: needs patch status: open title: statistics._decimal_to_ratio() produces non-integer ratio type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 00:53:08 2014 From: report at bugs.python.org (Yury Selivanov) Date: Thu, 06 Feb 2014 23:53:08 +0000 Subject: [New-bugs-announce] [issue20537] logging exc_info parameter should accept exception instances Message-ID: <1391730788.17.0.188838717397.issue20537@psf.upfronthosting.co.za> New submission from Yury Selivanov: A bunch of logging methods accept optional parameter exc_info, that is supposed to be either 'True' or a tuple of three elements (type, exc, tb). If, however, someone passes an actual exception instance, Logger._log function will interpret it as True and get the current exception from sys.exc_info, ignoring the passed exception completely. Attached is a patch that fixes this: if exc_info is an instance of BaseException, Logger._log creates the tuple out of it automatically. ---------- files: logging_01.patch keywords: patch messages: 210428 nosy: vinay.sajip, yselivanov priority: normal severity: normal status: open title: logging exc_info parameter should accept exception instances type: enhancement versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file33950/logging_01.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 10:32:08 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 09:32:08 +0000 Subject: [New-bugs-announce] [issue20538] Segfault in UTF-7 incremental decoder Message-ID: <1391765528.81.0.362071183373.issue20538@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: UTF-7 incremental decoder can crash in debug build when decodes unfinished base-64 section. In non-debug build it just produces inconsistent unicode string. Minimal examples: $ ./python -c "import codecs; codecs.utf_7_decode(b'a+AIA', 'strict')" python: Objects/unicodeobject.c:403: _PyUnicode_CheckConsistency: Assertion `maxchar >= 128' failed. Aborted (core dumped) $ ./python -c "import codecs; codecs.utf_7_decode(b'+AIA-+AQA', 'strict')" python: Objects/unicodeobject.c:410: _PyUnicode_CheckConsistency: Assertion `maxchar >= 0x100' failed. Aborted (core dumped) $ ./python -c "import codecs; codecs.utf_7_decode(b'+AQA-+2ADcAA', 'strict')" python: Objects/unicodeobject.c:414: _PyUnicode_CheckConsistency: Assertion `maxchar >= 0x10000' failed. Aborted (core dumped) This happens because _PyUnicodeWriter reverts position back before unfinished base-64 section, but its buffer was already widened for characters in unfinished base-64 section. if (inShift) { writer.pos = shiftOutStart; /* back off output */ *consumed = startinpos; } And now _PyUnicodeWriter generates a string with a kind larger then needed for decoded characters. This bug causes a lot of crashes on buildbots. E.g: http://buildbot.python.org/all/builders/AMD64%20Snow%20Leop%203.x/builds/1197 http://buildbot.python.org/all/builders/AMD64%20Ubuntu%20LTS%203.3/builds/1446 ---------- components: Interpreter Core, Unicode messages: 210444 nosy: ezio.melotti, haypo, serhiy.storchaka priority: high severity: normal stage: needs patch status: open title: Segfault in UTF-7 incremental decoder type: crash versions: Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 11:54:29 2014 From: report at bugs.python.org (Nick Coghlan) Date: Fri, 07 Feb 2014 10:54:29 +0000 Subject: [New-bugs-announce] [issue20539] math.factorial may throw OverflowError Message-ID: <1391770469.14.0.441115710554.issue20539@psf.upfronthosting.co.za> New submission from Nick Coghlan: I believe this is mostly a curiousity (since actually calculating a factorial this big would take an interminable amount of time), but math.factorial can be provoked into throwing OverflowError by a large enough input: >>> math.factorial(10**19) Traceback (most recent call last): File "", line 1, in OverflowError: Python int too large to convert to C long >>> math.factorial(1e19) Traceback (most recent call last): File "", line 1, in OverflowError: Python int too large to convert to C long ---------- messages: 210448 nosy: ncoghlan priority: normal severity: normal status: open title: math.factorial may throw OverflowError _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 13:06:28 2014 From: report at bugs.python.org (Irvin Probst) Date: Fri, 07 Feb 2014 12:06:28 +0000 Subject: [New-bugs-announce] [issue20540] Python 3.3/3.4 regression in multiprocessing manager ? Message-ID: <1391774788.17.0.649419287978.issue20540@psf.upfronthosting.co.za> New submission from Irvin Probst: After checking with the kind people of help at python.org I think I found a bug in the way connections are handled in the multiprocessing module. Using python 3.3 I've noticed a performance drop of about 70 times when running some code performing basic requests on a SyncManager. As this code was burried deep into a big project I made a test case attached to this report to reproduce this behavior. Here is what this code does: - define a class SharedData with several instance variables (a,b and c here) - this class has two methods exposed through a proxy (good() ans bad()) both see a huge performance drop using 3.3 and can be used to reproduce this behavior. The only difference is that good() uses a mutex whereas bad() does not, I wished to check that mutexes were not to blame for this problem. - create a Syncmanager giving access to a SharedData instance - launch a multiprocessing.Process() running the do_stuff() function, this function calls 10 times the good() (or bad()) method of SharedData through the Syncmanager, passes some values to it and gets back the result. - after each call to the proxy the time elapsed, roughly measured with time.time(), is printed System specs: Linux turing 3.12-1-686-pae #1 SMP Debian 3.12.6-2 (2013-12-29) i686 GNU/Linux Python version: latests 2.6,2.7,3.2 and 3.3 from standard debian repos 3.3.0 and 3.4.0 beta3 compiled from source time elapsed in each call to the proxy using Python 2.6, 2.7 and 3.2: first call to proxy ~ 0.04 seconds, next calls ~0.001 sec time elapsed in each call to the proxy using Python 3.3.0, 3.3.2, 3.3.3 , 3.4.0b3: first call to proxy ~0.27 seconds, next calls: 0.07 sec I reproduced this behavior using python 2.7 and 3.3.3 on an ubuntu computer running the latest amd64 release. Of course I tried without a print() after each call but it does not change anything, python 3.3 is *much* slower here. Using cProfile I tracked this down to the builtin read() method and indeed timing the read() syscall in posix_read() using gettimeofday() confirms it takes ages, posix_write() is fine though. I think the problem comes from the underlying socket the interpreter is reading from. connections.py from multiprocessing has been rewrittend between 3.2 and 3.3 but I can't see what's wrong in the way it has been done, basic socket options seem to be exactly the same. One interesting point is that it seems to only affect the last bytes sent through the socket, e.g if you send a numpy.array big enough to fill the socket's read() buffer the first calls to read() are done at a normal speed, only the last one takes time. If you confirm my test code is not to blame it makes IMHO the SyncManager in 3.3 and 3.4 completely unusable for frequent data exchanges between processes. Thanks for your time. ---------- components: Library (Lib) files: test_manager.py messages: 210457 nosy: Irvin.Probst priority: normal severity: normal status: open title: Python 3.3/3.4 regression in multiprocessing manager ? type: performance versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33956/test_manager.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 13:47:34 2014 From: report at bugs.python.org (Nick Coghlan) Date: Fri, 07 Feb 2014 12:47:34 +0000 Subject: [New-bugs-announce] [issue20541] os.path.exists() gives wrong answer for Windows special files Message-ID: <1391777254.4.0.885932258701.issue20541@psf.upfronthosting.co.za> New submission from Nick Coghlan: In trying to figure out why my fix for issue 20053 wasn't working on Windows, I eventually traced it back to the fact that "os.path.exists(os.devnull)" returns False on Windows, so pip isn't picking up my config file override in ensurepip, and reads the global default config file anyway. However, if you do "if exist NUL (echo exists) ELSE (echo missing)" in cmd, it will print "exists", so this looks like a bug in our os.path.exists implementation. That is currently implemented in genericpath and assumes that a file exists if-and-only-if os.stat(name) doesn't throw an exception. It turns out this assumption isn't really correct on Windows - 'NUL' and 'CON' (and presumably other special files) can be opened, but trying to do os.stat() on them throws an exception. ---------- components: Library (Lib), Windows messages: 210460 nosy: ncoghlan priority: normal severity: normal stage: test needed status: open title: os.path.exists() gives wrong answer for Windows special files type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 14:33:33 2014 From: report at bugs.python.org (Nick Coghlan) Date: Fri, 07 Feb 2014 13:33:33 +0000 Subject: [New-bugs-announce] [issue20542] Assertion failure in test_readline Message-ID: <1391780013.0.0.395448319598.issue20542@psf.upfronthosting.co.za> New submission from Nick Coghlan: test_readline is consistently failing with an assertion failure in debug builds. I'm going to add a skip for the time being, because I don't know the UnicodeWriter or UTF7 code well enough to guess where the inconsistency may be being introduced. Relevant extract from faulthandler stack dump: Current thread 0x00007f83a3e14740 (most recent call first): File "/home/ncoghlan/devel/py3k/Lib/codecs.py", line 494 in read File "/home/ncoghlan/devel/py3k/Lib/codecs.py", line 548 in readline File "/home/ncoghlan/devel/py3k/Lib/test/test_codecs.py", line 168 in test_readline Relevant extract from gdb trace: #4 0x00000000004f092f in _PyUnicode_CheckConsistency ( op='xxx\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', check_content=1) at Objects/unicodeobject.c:410 #5 0x0000000000544b75 in _PyUnicodeWriter_Finish (writer=0x7ffffffd7d40) at Objects/unicodeobject.c:13503 #6 0x0000000000510f5b in PyUnicode_DecodeUTF7Stateful (s=0x7fffed18b5b8 "", size=72, errors=0x7ffff19db0e8 "strict", consumed=0x7ffffffd7e48) at Objects/unicodeobject.c:4472 #7 0x0000000000607922 in utf_7_decode (self=, args=(b'xxx\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+ICg', 'strict')) at ./Modules/_codecsmodule.c:271 ---------- assignee: serhiy.storchaka keywords: 3.4regression, buildbot messages: 210467 nosy: larry, ncoghlan, serhiy.storchaka priority: release blocker severity: normal stage: needs patch status: open title: Assertion failure in test_readline type: crash versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 19:44:35 2014 From: report at bugs.python.org (Keith Randall) Date: Fri, 07 Feb 2014 18:44:35 +0000 Subject: [New-bugs-announce] [issue20543] ** operator does not overflow to inf Message-ID: <1391798675.64.0.456943405881.issue20543@psf.upfronthosting.co.za> New submission from Keith Randall: >>> 1e200*1e200 inf >>> 1e200**2 Traceback (most recent call last): File "", line 1, in OverflowError: (34, 'Numerical result out of range') Shouldn't floating-point operations overflow to inf, not generate exceptions? ---------- components: Interpreter Core messages: 210517 nosy: Keith.Randall priority: normal severity: normal status: open title: ** operator does not overflow to inf type: behavior versions: Python 3.2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:25:10 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:25:10 +0000 Subject: [New-bugs-announce] [issue20544] Use specific asserts in operator tests Message-ID: <1391804710.79.0.27308793582.issue20544@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes the operator module tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_operator_asserts.patch keywords: easy, patch messages: 210540 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in operator tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33969/test_operator_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:25:25 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:25:25 +0000 Subject: [New-bugs-announce] [issue20545] Use specific asserts in unicode tests Message-ID: <1391804725.49.0.807419128336.issue20545@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes unicode related tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests, Unicode files: test_unicode_asserts.patch keywords: easy, patch messages: 210541 nosy: benjamin.peterson, ezio.melotti, haypo, lemburg, loewis, pitrou, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in unicode tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33970/test_unicode_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:25:44 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:25:44 +0000 Subject: [New-bugs-announce] [issue20546] Use specific asserts in int tests Message-ID: <1391804744.01.0.671211669548.issue20546@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes the int class tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_long_asserts.patch keywords: easy, patch messages: 210543 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in int tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33971/test_long_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:25:56 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:25:56 +0000 Subject: [New-bugs-announce] [issue20547] Use specific asserts in bigmem tests Message-ID: <1391804756.75.0.781107542362.issue20547@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes bigmem tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_bigmem_asserts.patch keywords: easy, patch messages: 210544 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in bigmem tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33972/test_bigmem_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:26:12 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:26:12 +0000 Subject: [New-bugs-announce] [issue20548] Use specific asserts in warnings and exceptions tests Message-ID: <1391804772.02.0.729156315156.issue20548@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes warnings and exceptions related tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_warnexc_asserts.patch keywords: easy, patch messages: 210545 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in warnings and exceptions tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33973/test_warnexc_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:26:45 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:26:45 +0000 Subject: [New-bugs-announce] [issue20549] Use specific asserts in mailbox, smtplib and poplib tests Message-ID: <1391804805.68.0.562354478477.issue20549@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes the mailbox, smtplib and poplib modules tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_mailbox_asserts.patch keywords: easy, patch messages: 210546 nosy: giampaolo.rodola, petri.lehtinen, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in mailbox, smtplib and poplib tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33974/test_mailbox_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:26:56 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:26:56 +0000 Subject: [New-bugs-announce] [issue20550] Use specific asserts in collections tests Message-ID: <1391804816.95.0.0835407946311.issue20550@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes collections tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests keywords: easy messages: 210547 nosy: rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in collections tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:27:16 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:27:16 +0000 Subject: [New-bugs-announce] [issue20551] Use specific asserts in decimal tests Message-ID: <1391804836.31.0.134510679108.issue20551@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes the decimal module tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_decimal_asserts.patch keywords: easy, patch messages: 210548 nosy: facundobatista, mark.dickinson, rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in decimal tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33975/test_decimal_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:27:36 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:27:36 +0000 Subject: [New-bugs-announce] [issue20552] Use specific asserts in bytes tests Message-ID: <1391804856.25.0.0710909652112.issue20552@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes bytes tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_bytes_asserts.patch keywords: easy, patch messages: 210549 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in bytes tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33976/test_bytes_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 21:27:44 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 20:27:44 +0000 Subject: [New-bugs-announce] [issue20553] Use specific asserts in ipaddress tests Message-ID: <1391804864.8.0.447928748965.issue20553@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes the ipaddress module tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_ipaddress_asserts.patch keywords: easy, patch messages: 210550 nosy: ncoghlan, pmoody, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in ipaddress tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33977/test_ipaddress_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 22:34:19 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 21:34:19 +0000 Subject: [New-bugs-announce] [issue20554] Use specific asserts in argparse and optparse tests Message-ID: <1391808859.25.0.0531028969207.issue20554@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes argparse and optparse modules tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_optparse_asserts.patch keywords: patch messages: 210560 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Use specific asserts in argparse and optparse tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33979/test_optparse_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 22:34:25 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 21:34:25 +0000 Subject: [New-bugs-announce] [issue20555] Use specific asserts in urllib related tests Message-ID: <1391808865.17.0.101662916847.issue20555@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes the urllib, httplib, ftplib, cgi, and wsgiref modules tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_urllib_asserts.patch keywords: patch messages: 210561 nosy: giampaolo.rodola, orsenthil, pje, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in urllib related tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33980/test_urllib_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 22:34:38 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 21:34:38 +0000 Subject: [New-bugs-announce] [issue20556] Use specific asserts in threading tests Message-ID: <1391808878.85.0.661174932104.issue20556@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes the threading module tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_threading_asserts.patch keywords: patch messages: 210562 nosy: brett.cannon, pitrou, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use specific asserts in threading tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33981/test_threading_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Feb 7 22:34:57 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 07 Feb 2014 21:34:57 +0000 Subject: [New-bugs-announce] [issue20557] Use specific asserts in io tests Message-ID: <1391808897.1.0.851007465151.issue20557@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The proposed patch makes the io module tests use more specific asserts. This will provide more useful failure report. ---------- components: Tests files: test_io_asserts.patch keywords: patch messages: 210563 nosy: benjamin.peterson, hynek, pitrou, serhiy.storchaka, stutzbach priority: normal severity: normal stage: patch review status: open title: Use specific asserts in io tests type: enhancement versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file33982/test_io_asserts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 8 01:55:43 2014 From: report at bugs.python.org (Garrett Cooper) Date: Sat, 08 Feb 2014 00:55:43 +0000 Subject: [New-bugs-announce] [issue20558] ECONNRESET value in logging.config is valid with Linux [distros]; not valid with *BSD Message-ID: <1391820943.88.0.107305353589.issue20558@psf.upfronthosting.co.za> New submission from Garrett Cooper: The logging module checks for ECONNRESET if it's equal to 104. This is valid on Linux, but not [some] other OSes. On FreeBSD and OpenBSD [*] it's 54, not 104. The attached patch fixes the logging code to check for errno.ECONNRESET in !win32 environments. http://www.openbsd.org/cgi-bin/man.cgi?query=errno&apropos=0&sektion=0&manpath=OpenBSD+Current&arch=i386&format=htmlvim ---------- files: patch messages: 210580 nosy: yaneurabeya priority: normal severity: normal status: open title: ECONNRESET value in logging.config is valid with Linux [distros]; not valid with *BSD Added file: http://bugs.python.org/file33985/patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 8 05:34:24 2014 From: report at bugs.python.org (Bill Winslow) Date: Sat, 08 Feb 2014 04:34:24 +0000 Subject: [New-bugs-announce] [issue20559] urllib/http fail to sanitize a non-ascii url Message-ID: <1391834064.13.0.416589140445.issue20559@psf.upfronthosting.co.za> New submission from Bill Winslow: The following code will produce a UnicodeEncodeError about a character being non-ascii: from urllib import request, parse, error url = 'http://en.wikipedia.org/wiki/Antonio Vallejo-N?jera' req = request.Request(url) response = request.urlopen(req) This fails as follows: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.3/urllib/request.py", line 156, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.3/urllib/request.py", line 469, in open response = self._open(req, data) File "/usr/lib/python3.3/urllib/request.py", line 487, in _open '_open', req) File "/usr/lib/python3.3/urllib/request.py", line 447, in _call_chain result = func(*args) File "/usr/lib/python3.3/urllib/request.py", line 1268, in http_open return self.do_open(http.client.HTTPConnection, req) File "/usr/lib/python3.3/urllib/request.py", line 1248, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/usr/lib/python3.3/http/client.py", line 1067, in request self._send_request(method, url, body, headers) File "/usr/lib/python3.3/http/client.py", line 1095, in _send_request self.putrequest(method, url, **skips) File "/usr/lib/python3.3/http/client.py", line 959, in putrequest self._output(request.encode('ascii')) UnicodeEncodeError: 'ascii' codec can't encode character '\xe1' in position 27: ordinal not in range(128) I examined the library code in question: line 958 in http/client.py, the line before the one that barfs, contains the following comment: # Non-ASCII characters should have been eliminated earlier I added a print statement to the library code: print(request) self._output(request.encode('ascii')) This prints the following: >>> response = request.urlopen(req) GET /wiki/Antonio Vallejo-N?jera HTTP/1.1 Traceback (most recent call last): ... I confirmed that the 27th character as mentioned in the traceback is in fact the ? in the last name. Clearly either urllib or http is not properly sanitizing the url -- unfortunately, my knowledge is useless as to determining where the actual error is; hopefully this report contains enough detail to make it easy enough. ---------- components: Library (Lib), Unicode messages: 210587 nosy: Dubslow, ezio.melotti, haypo priority: normal severity: normal status: open title: urllib/http fail to sanitize a non-ascii url type: behavior versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 8 11:14:31 2014 From: report at bugs.python.org (Terry J. Reedy) Date: Sat, 08 Feb 2014 10:14:31 +0000 Subject: [New-bugs-announce] [issue20560] tkFileFilter.c: ostypeCount not initialized? Message-ID: <1391854471.94.0.0196154123534.issue20560@psf.upfronthosting.co.za> New submission from Terry J. Reedy: Fresh Win7 VC express debug build (F7), 2.7 only: fairly recent (last 3 months?) regression. In debug console, import idlelib.idle. Try to Open a file. Get message that ostypeCount is used before initialized. If open python_d with F5 in VC, [break] takes me to VS debugger, which points to line 341 in tkFileFilter.c (where is that in the directory tree?). if (ostypeCount > 0 && ostypeList != NULL) { I am slightly puzzled because it appears that line 234 for (i=0; i _______________________________________ From report at bugs.python.org Sat Feb 8 12:10:27 2014 From: report at bugs.python.org (Wolfgang Maier) Date: Sat, 08 Feb 2014 11:10:27 +0000 Subject: [New-bugs-announce] [issue20561] Decimal handling error in statistics module Message-ID: <1391857827.55.0.926154753892.issue20561@psf.upfronthosting.co.za> New submission from Wolfgang Maier: Can this still be fixed in 3.4 ?? I came across this bug in the statistics module today: >>> import statistics >>> data = [Decimal('1e4')] >>> statistics.mean(data) Traceback (most recent call last): File "", line 1, in statistics.mean(data) File "C:/Python33\statistics.py", line 316, in mean return _sum(data)/n File "C:/Python33\statistics.py", line 167, in _sum total += Fraction(n, d) File "C:\Python33\lib\fractions.py", line 163, in __new__ raise TypeError("both arguments should be " TypeError: both arguments should be Rational instances The reason for this is that the statistics module converts Decimals to exact ratios internally like this: def _decimal_to_ratio(d): """Convert Decimal d to exact integer ratio (numerator, denominator). >>> from decimal import Decimal >>> _decimal_to_ratio(Decimal("2.6")) (26, 10) """ sign, digits, exp = d.as_tuple() if exp in ('F', 'n', 'N'): # INF, NAN, sNAN assert not d.is_finite() raise ValueError num = 0 for digit in digits: num = num*10 + digit if sign: num = -num den = 10**-exp #if type(den) != int: # print (d, sign, digits, exp, num, den) return (num, den) The important part here is the line: den = 10**-exp which makes den an int if - and **only** if - exp is negative. However, the exponent in the namedtuple returned by Decimal.as_tuple() is not guaranteed to be negative and in fact: >>>Decimal('1e4').as_tuple() DecimalTuple(sign=0, digits=(1,), exponent=4) With this den in the above function becomes a float, which raises an error subsequently in _sum, when it essentially tries to do: Fraction(num, den) IMPORTANT: I have been running this example on my laptop with Python3.3.0 and the statistics module imported from sys.path. Thus, I cannot exclude that the decimal module has changed since 3.3.0 and is now always returning a negative exponent with .as_tuple(). I'm abroad and cannot verify this against the Python3.4dev build. Could somebody confirm this for 3.4 and reject this issue immediately if the error doesn't occur ? If this is not version dependent though, then there is a very simple bug-fix for it, which I suggest should still be incorporated into 3.4: if exp >= 0: return int(x), 1 inserted right after the raise ValueError line is doing the job. I cannot generate the diff for this myself, so could somebody do this. Thanks a lot for your efforts! ---------- messages: 210613 nosy: oscarbenjamin, python-dev, skrah, stevenjd, wolma priority: normal severity: normal status: open title: Decimal handling error in statistics module type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 8 13:43:08 2014 From: report at bugs.python.org (Johnny Wezel) Date: Sat, 08 Feb 2014 12:43:08 +0000 Subject: [New-bugs-announce] [issue20562] sqlite3 returns result set with doubled first entry Message-ID: <1391863388.33.0.362303830227.issue20562@psf.upfronthosting.co.za> New submission from Johnny Wezel: I could isolate a bug where sqlite3 returns a result set from a select where the first entry occurs twice. >>> sys.version_info sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0) >>> import sqlite3 >>> sqlite3.version_info (2, 6, 0) $ uname -a Linux 3.10.25-gentoo #1 SMP PREEMPT Wed Jan 29 18:05:47 CET 2014 x86_64 Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz GenuineIntel GNU/Linux ---------- components: Extension Modules files: t.py messages: 210622 nosy: jwezel priority: normal severity: normal status: open title: sqlite3 returns result set with doubled first entry type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file33992/t.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 8 14:49:53 2014 From: report at bugs.python.org (Nick Coghlan) Date: Sat, 08 Feb 2014 13:49:53 +0000 Subject: [New-bugs-announce] [issue20563] Mark ipaddress as stable? Message-ID: <1391867393.51.0.348238863582.issue20563@psf.upfronthosting.co.za> New submission from Nick Coghlan: Peter, with issue 18805 fixed, what do you think about removing the provisional status from the ipaddress API? Aside from issue 19157 (where I'm not sure the behaviour even needs changing), the other open ipaddress issues appear to be docs related or RFEs. At this point, making ipaddress subject to the usual backwards compatibility guarantees seems fairly low risk. ---------- assignee: pmoody messages: 210641 nosy: larry, ncoghlan, pmoody priority: normal severity: normal stage: commit review status: open title: Mark ipaddress as stable? type: enhancement versions: Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 8 19:19:44 2014 From: report at bugs.python.org (Remi Pointel) Date: Sat, 08 Feb 2014 18:19:44 +0000 Subject: [New-bugs-announce] [issue20564] test_threadsignals.py "failed" on OpenBSD because too slow (> 3sec) Message-ID: <1391883584.64.0.946216274397.issue20564@psf.upfronthosting.co.za> New submission from Remi Pointel: Hi, I have 2 tests which "failed" on OpenBSD (tested on i386, amd64 and sparc64) in: - test_threadsignals.py/test_lock_acquire_interruption - test_threadsignals.py/test_rlock_acquire_interruption ====================================================================== FAIL: test_lock_acquire_interruption (__main__.ThreadSignals) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_threadsignals.py", line 94, in test_lock_acquire_interruption self.assertLess(dt, 3.0) AssertionError: 5.020112991333008 not less than 3.0 ====================================================================== FAIL: test_rlock_acquire_interruption (__main__.ThreadSignals) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_threadsignals.py", line 122, in test_rlock_acquire_interruption self.assertLess(dt, 3.0) AssertionError: 5.0101478099823 not less than 3.0 On the 3 machines it took ~ 5sec. I'm asking why it's 3 seconds by default in the tests? Could we modify the value to 6 instead of 3, is it acceptable? Thanks for your response, Remi. ---------- components: Tests messages: 210672 nosy: rpointel priority: normal severity: normal status: open title: test_threadsignals.py "failed" on OpenBSD because too slow (> 3sec) versions: Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 8 19:26:34 2014 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 08 Feb 2014 18:26:34 +0000 Subject: [New-bugs-announce] [issue20565] Update Tcl/Tk version for buildbots Message-ID: <1391883994.31.0.277087136027.issue20565@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Currently Windows buildbots use old versions of Tcl/Tk. These versions contain bugs (for example see issue20560). Versions mentioned in Tools/buildbot/external-common.bat: On 2.7: 8.5.2.1/8.5.2.0 On 3.3: 8.5.11.0 On 3.4: 8.6.1.0 Some buildbots even use beta version of 8.6 (I needed write workaround in testsuite for behavior differences). Recent Tcl/Tk versions: Tcl/Tk 8.6.1 Sep 20, 2013 Tcl/Tk 8.5.15 Sep 18, 2013 Tcl/Tk 8.4.20 Jun 1, 2013 Perhaps it is time to update Tcl/Tk to recent versions? ---------- messages: 210674 nosy: pitrou, serhiy.storchaka priority: normal severity: normal status: open title: Update Tcl/Tk version for buildbots versions: Python 2.7, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Feb 8 21:18:14 2014 From: report at bugs.python.org (Glenn Langford) Date: Sat, 08 Feb 2014 20:18:14 +0000 Subject: [New-bugs-announce] [issue20566] asyncio as_completed() thrashes adding and removing callbacks Message-ID: <1391890694.33.0.714223329819.issue20566@psf.upfronthosting.co.za> New submission from Glenn Langford: In asyncio, tasks.py as_completed() appears to trigger adding and removing callbacks multiple times for the pending set of futures, each time a single future completes. For example, to wait for 5 futures which complete at different times: - as_completed() uses _wait() - _wait() will add 5 callbacks, one for each future - when one future completes, a callback is triggered and all 5 callbacks are removed; this is because _wait() was called with FIRST_COMPLETED - for the 4 remaining futures - 4 callbacks have to be added back again - when the next future completes, the 4 callbacks are removed etc? The worst case is if as_completed() is called to wait for all of a larger number of futures, which complete at different times. For example, with 100 futures worst case, ~10,000 callback adds and removes would be performed. (I am very new to the asyncio code, so I don't have a patch to offer at this point). ---------- components: Library (Lib) messages: 210679 nosy: glangford, gvanrossum, haypo, pitrou priority: normal severity: normal status: open title: asyncio as_completed() thrashes adding and removing callbacks type: performance versions: Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 00:36:18 2014 From: report at bugs.python.org (Ned Deily) Date: Sat, 08 Feb 2014 23:36:18 +0000 Subject: [New-bugs-announce] [issue20567] test_ttk_guionly gets 'can't invoke "event" command: application has been destroyed' messages from Tk Message-ID: <1391902578.02.0.588798272285.issue20567@psf.upfronthosting.co.za> New submission from Ned Deily: Seen with default (3.4.0) framework builds on OS X 10.9 with ActiveTcl 8.5.15.0: ./configure --enable-universalsdk=/ --with-universal-archs=intel --enable-framework=/tmp/t/Library/Frameworks make && make install cd /tmp/t /tmp/t/bin/python3.4 -m test -w -uall [...] [343/389/1] test_ttk_guionly can't invoke "event" command: application has been destroyed while executing "event generate $w <>" (procedure "ttk::ThemeChanged" line 6) invoked from within "ttk::ThemeChanged" can't invoke "event" command: application has been destroyed while executing "event generate $w <>" (procedure "ttk::ThemeChanged" line 6) invoked from within "ttk::ThemeChanged" can't invoke "event" command: application has been destroyed while executing "event generate $w <>" (procedure "ttk::ThemeChanged" line 6) invoked from within "ttk::ThemeChanged" can't invoke "event" command: application has been destroyed while executing "event generate $w <>" (procedure "ttk::ThemeChanged" line 6) invoked from within "ttk::ThemeChanged" [344/389/1] test_ttk_textonly [...] When running test_ttk_guionly by itself (or in combination with a few neighboring tests): /tmp/t/bin/python3.4 -m test -w -uall test_ttk_guionly the message is not seen. I had not seen this behavior prior to somewhere in the 3.4.0 development cycle. ---------- components: Tests, Tkinter messages: 210704 nosy: ned.deily priority: normal severity: normal stage: needs patch status: open title: test_ttk_guionly gets 'can't invoke "event" command: application has been destroyed' messages from Tk versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 01:08:05 2014 From: report at bugs.python.org (Nick Coghlan) Date: Sun, 09 Feb 2014 00:08:05 +0000 Subject: [New-bugs-announce] [issue20568] Pass --default-install to ensurepip in the Windows installers? Message-ID: <1391904485.94.0.961786946534.issue20568@psf.upfronthosting.co.za> New submission from Nick Coghlan: Installing 3.4b3 on Windows to test issue 20053, I was surprised to find that after installation, "pip install " didn't work. I had forgotten that due to the flat executable namespace on POSIX systems, we only install pip3 and pip3.4 by default - you have to pass "--default-install" to ensurepip to get it to install the unqualified "pip". For virtual environments, we handle that in the venv module - it passes "--default-pip" when invoking the ensurepip CLI. Given that Windows uses "python" for both Python 2 & 3 (in contrast to the POSIX python/python3 and python2/python3 conventions), perhaps we should be passing --default-install to ensurepip in the Windows installers as well? ---------- components: Installation messages: 210705 nosy: dstufft, larry, loewis, ncoghlan, pmoore priority: deferred blocker severity: normal stage: needs patch status: open title: Pass --default-install to ensurepip in the Windows installers? type: enhancement versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 03:46:31 2014 From: report at bugs.python.org (Saimadhav Heblikar) Date: Sun, 09 Feb 2014 02:46:31 +0000 Subject: [New-bugs-announce] [issue20569] IDLE : Add clipboard history feature Message-ID: <1391913991.05.0.696306257044.issue20569@psf.upfronthosting.co.za> New submission from Saimadhav Heblikar: Hi, this patch adds clipboard history feature to idle.with this,we can retrieve any cut/copied text after the start of idle. it uses a list to store the messages called _clipboard_history it creates a dialog window to present a listbox and a paste button to the user. further ideas for this patch could include making the clipboard history accessible across files(which is not possible in this patch) ---------- components: IDLE files: python-clipboard-history-enhancement.patch keywords: patch messages: 210714 nosy: sahutd priority: normal severity: normal status: open title: IDLE : Add clipboard history feature type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file34002/python-clipboard-history-enhancement.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 05:20:15 2014 From: report at bugs.python.org (Nick Coghlan) Date: Sun, 09 Feb 2014 04:20:15 +0000 Subject: [New-bugs-announce] [issue20570] Bundle pip 0.15.3 in Python 3.4rc2 Message-ID: <1391919615.88.0.398800251792.issue20570@psf.upfronthosting.co.za> New submission from Nick Coghlan: Larry, we currently have 0.15.2 bundled for 3.4rc1. This is the latest release of pip: http://www.pip-installer.org/en/latest/news.html#changelog However, there are a few additional fixes that have been merged to the pip 1.5.X maintenance branch that could be included in a 0.15.3 release: - the workaround to resolve issue 20053 on Windows - a number of fixes related to wheel downloads - ensuring hash fragments in URLs are checked properly It would be good to get those resolved prior to the final 3.4 release. ---------- assignee: larry messages: 210717 nosy: dstufft, larry, ncoghlan, pmoore priority: deferred blocker severity: normal status: open title: Bundle pip 0.15.3 in Python 3.4rc2 type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 10:16:49 2014 From: report at bugs.python.org (Larry Hastings) Date: Sun, 09 Feb 2014 09:16:49 +0000 Subject: [New-bugs-announce] [issue20571] test_codecs currently failing on several Windows buildbots Message-ID: <1391937409.03.0.728071863469.issue20571@psf.upfronthosting.co.za> New submission from Larry Hastings: The Windows buildbots are currently broken due to a codec issue. I populated the "nosy" list based on the "unicode" experts from the Experts Index. http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/4040 test_streamreaderwriter (test.test_codecs.WithStmtTest) ... test test_codecs failed ok ====================================================================== ERROR: test_readline (test.test_codecs.CP65001Test) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_codecs.py", line 157, in test_readline self.assertEqual(readalllines("".join(vw), True), "|".join(vw)) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_codecs.py", line 136, in readalllines line = reader.readline(size=size, keepends=keepends) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\codecs.py", line 548, in readline data = self.read(readsize, firstline=True) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\codecs.py", line 494, in read newchars, decodedbytes = self.decode(data, self.errors) UnicodeDecodeError: 'CP_UTF8' codec can't decode bytes in position 0--1: No mapping for the Unicode character exists in the target code page. ---------- components: Tests messages: 210732 nosy: benjamin.peterson, ezio.melotti, haypo, larry, loewis, pitrou priority: release blocker severity: normal stage: needs patch status: open title: test_codecs currently failing on several Windows buildbots type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 11:23:20 2014 From: report at bugs.python.org (Giampaolo Rodola') Date: Sun, 09 Feb 2014 10:23:20 +0000 Subject: [New-bugs-announce] [issue20572] subprocess.Popen.wait() undocumented "endtime" parameter Message-ID: <1391941400.18.0.703922206544.issue20572@psf.upfronthosting.co.za> New submission from Giampaolo Rodola': http://hg.python.org/cpython/file/29d9638bf449/Lib/subprocess.py#l1144 This was introduced in revision 6b627e121573 and is currently not documented. I'm not sure whether this is a documentation issue or "endtime" should have been "_endtime" instead. ---------- messages: 210740 nosy: giampaolo.rodola, rnk priority: normal severity: normal status: open title: subprocess.Popen.wait() undocumented "endtime" parameter versions: Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 11:59:22 2014 From: report at bugs.python.org (Vladimir Rutsky) Date: Sun, 09 Feb 2014 10:59:22 +0000 Subject: [New-bugs-announce] [issue20573] "built-in repr()" function link on the repr module documentation is incorrect Message-ID: <1391943562.07.0.0261710580563.issue20573@psf.upfronthosting.co.za> New submission from Vladimir Rutsky: http://docs.python.org/2/library/repr.html page contains several links on built-in function `repr()` (search for "built-in repr()" on page), but links goes to `Repr.repr()` functions of `Repr` module instead of http://docs.python.org/library/functions.html#repr This is reverse situation to bug described in http://bugs.python.org/issue14489 ---------- messages: 210748 nosy: rutsky priority: normal severity: normal status: open title: "built-in repr()" function link on the repr module documentation is incorrect versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 14:18:25 2014 From: report at bugs.python.org (STINNER Victor) Date: Sun, 09 Feb 2014 13:18:25 +0000 Subject: [New-bugs-announce] [issue20574] Implement incremental decoder for cp65001 Message-ID: <1391951905.18.0.272262636483.issue20574@psf.upfronthosting.co.za> New submission from STINNER Victor: (Follow up of issue #20538 and #20571.) Attached patch implements incremental decoders for multibyte code pages (on Windows), especially for CP_UTF8 aka "cp65001" in Python. Code pages 932, 936, 949, 950 and 1361 already have an incremental decoder since: --- changeset: 38817:549c547700af branch: legacy-trunk user: Martin v. L?wis date: Wed Jun 14 05:21:04 2006 +0000 files: Doc/api/concrete.tex Include/unicodeobject.h Lib/encodings/mbcs.py Misc/NEWS Modules/_codecsmodule.c Objects/unicodeobject.c description: Patch #1455898: Incremental mode for "mbcs" codec. --- Python currently uses IsDBCSLeadByteEx(): http://msdn.microsoft.com/en-us/library/windows/desktop/dd318667%28v=vs.85%29.aspx And CharPrevA(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms647471%28v=vs.85%29.aspx But IsDBCSLeadByteEx() only supports code pages 932, 936, 949, 950 and 1361. Python supports the code page 65001 (codec "cp65001") since Python 3.3. New tests on incremental decoders were added in Python 3.4: I addedd a skip for cp65001 since it was not supported (#20571). This issue implements the incremental decoder and so removes the skip. I prefer to wait for Python 3.5 (not rush for add this new feature after 3.4 beta 3). cp65001 is mostly used for output (sys.stdout/sys.stderr) on Windows, not for input. ---------- files: incremental_cp_utf8.patch keywords: patch messages: 210759 nosy: haypo, larry, loewis, serhiy.storchaka priority: normal severity: normal status: open title: Implement incremental decoder for cp65001 type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file34008/incremental_cp_utf8.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 14:29:43 2014 From: report at bugs.python.org (Oscar Benjamin) Date: Sun, 09 Feb 2014 13:29:43 +0000 Subject: [New-bugs-announce] [issue20575] Type handling policy for the statistics module Message-ID: <1391952583.31.0.349942146298.issue20575@psf.upfronthosting.co.za> New submission from Oscar Benjamin: As of issue20481, the statistics module for Python 3.4 will disallow any mixing of numeric types with the exception of int that can mix with any other type (but only one at a time). My understanding is that this change was not necessarily considered to be a permanent policy but rather a quick fix for Python 3.4 in order to explicitly prevent certain confusing situations arising from mixing Decimal with other stdlib numeric types. issue20499 has a lot of discussion about different ways to improve accuracy and speed for the mean, variance etc. functions in the statistics module. It's tricky though to come up with a concrete implementation without having a clear specification for how the module should handle different numeric types. There are several related issues to do with type handling. Should the statistics module 1) Use the same coercion rules as the numeric tower (pep-3141)? 2) Allow Decimal to mix with any types from the numeric tower? 3) Allow non-stdlib types that don't use the numeric tower? 4) Allow any mixing of types at all? 5) Strive to achieve the maximum possible accuracy for every type that it accepts? I don't personally see much of a use-case for mixing e.g. Decimal and Fraction. I don't think it's unreasonable to require users to choose a numeric type and stick to it. The common cases will almost certainly be either all int or all float so those should be the main targets of any speed optimisation. If a user is using Fraction/Decimal then they must have gone out of their way to do so and they may as well do so consistently for all of their data. When choosing to use Fraction you do so because you want perfect accuracy. Mixing those Fractions with floating point types such as float and Decimal doesn't make any sense. Although there is a sense in which Decimals are also exact since they are always exact in their constructor. However I don't think there's any case where the Decimal constructor can be used but the Fraction constructor cannot so this mixing of types is unnecessary. As with Fraction a user who chooses to use Decimal is going out of their way to do so because of the kind of accuracy guarantees that the type provides. It doesn't make any sense to mix these with floats that are inherently tainted with the wrong kind of rounding error. So mixing Decimal and float doesn't make any sense either. Note that ordinary arithmetic prohibits the mixing of Decimal with Fraction/float so that on this point the statistics module is essentially maintaining a consistent position with respect to the policy of the Decimal type. On the other hand ordinary arithmetic allows all of int, float, Fraction and complex and indeed any other type subscribing to the ABCs in the numeric tower to be mixed. As of issue20481 the statistics module does not allow any type mixing except for int: http://hg.python.org/cpython/rev/5db74cd953ab Note also that it uses type identity rather than subclass relationships or ABCs so that it is not even possible to mix e.g. float with a float subclass. The most common case of mixing will almost certainly be int and float which will work. However I doubt that the current policy would be considered to be in keeping with Python's general policy on numeric types and anticipate that there will be a desire to change it in the future. The obvious candidate for a policy is the numeric tower and ABCs of PEP-3141. In that case the statistics module has a partial precedent on which to base its policy. The only tricky part is that Decimal is not part of the numeric tower. So there needs to be a special rule for Decimal such as "it only mixes with int/Integral". Basing the policy on the numeric tower is attractive but it is worth noting that the std lib types int, float, Fraction and Decimal are the only types that actually implement and register with these ABCs. So it's not much different from saying that those particular types (and subclasses of) are accepted but I think that that is better than the current policy. Third party numeric types don't implement the interfaces described in PEP-3141. However one thing that is implemented by every third-party numeric type that I know of is __float__. So if there was to be a desire to support those in the statistics module then the simplest extension of the policy on types is to say that any non-numeric-tower types will simply be coerced with float. This still leaves the issue about how type mixing works there but, again, perhaps the safest option before the need arises is just to say that no type mixing is allowed if any input object is not from the numeric tower. What do you think? ---------- components: Library (Lib) messages: 210762 nosy: ncoghlan, oscarbenjamin, skrah, stevenjd, wolma priority: normal severity: normal status: open title: Type handling policy for the statistics module type: enhancement versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 14:47:33 2014 From: report at bugs.python.org (Larry Hastings) Date: Sun, 09 Feb 2014 13:47:33 +0000 Subject: [New-bugs-announce] [issue20576] Default signatures for slots should be positional-only Message-ID: <1391953653.09.0.426145547934.issue20576@psf.upfronthosting.co.za> New submission from Larry Hastings: I just realized that the signatures for builtin slot functions (__iadd__, __delitem__, etc) only accept positional-only arguments. But when I added the signatures by hand to all the slots I didn't mark them as positional-only. The attached patch remedies that oversight. ---------- assignee: larry components: Library (Lib) files: larry.slots.are.positional.only.1.diff keywords: patch messages: 210763 nosy: larry, ncoghlan, yselivanov priority: normal severity: normal stage: patch review status: open title: Default signatures for slots should be positional-only type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file34009/larry.slots.are.positional.only.1.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Feb 9 20:28:36 2014 From: report at bugs.python.org (Tal Einat) Date: Sun, 09 Feb 2014 19:28:36 +0000 Subject: [New-bugs-announce] [issue20577] IDLE: Remove FormatParagraph's width setting from config dialog Message-ID: <1391974116.91.0.4701294104.issue20577@psf.upfronthosting.co.za> New submission from Tal Einat: Following up issue3068, this is a separate patch which moves the "paragraph reformat width" setting from the "general" tab in IDLE's config dialog to the relevant place in the extensions configuration. ---------- components: IDLE files: taleinat.20140209.IDLE__Remove_format_paragraph_width_from_config_dialog.patch keywords: patch messages: 210779 nosy: taleinat priority: normal severity: normal status: open title: IDLE: Remove FormatParagraph's width setting from config dialog versions: Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file34013/taleinat.20140209.IDLE__Remove_format_paragraph_width_from_config_dialog.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 10 01:13:49 2014 From: report at bugs.python.org (Nikolaus Rath) Date: Mon, 10 Feb 2014 00:13:49 +0000 Subject: [New-bugs-announce] [issue20578] BufferedIOBase.readinto1 is missing Message-ID: <1391991229.05.0.363628736117.issue20578@psf.upfronthosting.co.za> New submission from Nikolaus Rath: It would be nice to have a readinto1 method to complement the existing read, readinto, and read1 methods of io.BufferedIOBase. ---------- components: Library (Lib) messages: 210794 nosy: nikratio priority: normal severity: normal status: open title: BufferedIOBase.readinto1 is missing type: enhancement versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Feb 10 11:10:42 2014 From: report at bugs.python.org (Ned Deily) Date: Mon, 10 Feb 2014 10:10:42 +0000 Subject: [New-bugs-announce] [issue20579] OS X IDLE keyboard accelerators fail or misbehave with Cocoa Tk Message-ID: <1392027042.62.0.0419013450349.issue20579@psf.upfronthosting.co.za> New submission from Ned Deily: On OS X, most of the IDLE command keyboard accelerators that use the OS X