From report at bugs.python.org Sun Jan 1 14:05:45 2017 From: report at bugs.python.org (Zoe Mbikayi) Date: Sun, 01 Jan 2017 19:05:45 +0000 Subject: [New-bugs-announce] [issue29128] No way to instsall win32com Message-ID: <1483297545.45.0.26168848935.issue29128@psf.upfronthosting.co.za> Changes by Zoe Mbikayi : ---------- components: Library (Lib) nosy: Zoe Mbikayi priority: normal severity: normal status: open title: No way to instsall win32com type: resource usage versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 1 18:03:59 2017 From: report at bugs.python.org (Michael Mrozek) Date: Sun, 01 Jan 2017 23:03:59 +0000 Subject: [New-bugs-announce] [issue29129] Copy/paste error in "8.13.14.1.1. Using auto" Message-ID: <1483311839.39.0.725935533948.issue29129@psf.upfronthosting.co.za> New submission from Michael Mrozek: The "8.13.14.1.1 Using auto" section ( https://docs.python.org/3/library/enum.html#using-auto ) looks like it was copied from the subsequent "8.13.14.1.2 Using object" section, and a reference to "object" wasn't changed to "auto" in the first line. ---------- assignee: docs at python components: Documentation messages: 284434 nosy: docs at python, mrozekma priority: normal severity: normal status: open title: Copy/paste error in "8.13.14.1.1. Using auto" versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 1 19:28:18 2017 From: report at bugs.python.org (John Hagen) Date: Mon, 02 Jan 2017 00:28:18 +0000 Subject: [New-bugs-announce] [issue29130] Exit code 120 returned from Python unit test testing SystemExit Message-ID: <1483316898.11.0.0292789374137.issue29130@psf.upfronthosting.co.za> New submission from John Hagen: I recently tried to port one of my packages to Python 3.6 and unit tests that worked in Python 2.7, 3.3-3.5 began failing in 3.6. I originally thought it was a problem with coverage, but it turns out it was not. The full thread is: https://bitbucket.org/ned/coveragepy/issues/545/coverage-fails-on-python-36-travis-build The highlight is this unit test causes Python to exit with status code 120 (which fails a Travis build): class ParseArgumentsTestCase(unittest.TestCase): def test_no_arguments(self): # type: () -> None with self.assertRaises(SystemExit): # Suppress argparse stderr. class NullWriter: def write(self, s): # type: (str) -> None pass sys.stderr = NullWriter() parse_arguments() Ned found this corresponding note in the Python 3.6 release notes: Changed in version 3.6: If an error occurs in the cleanup after the Python interpreter has caught SystemExit (such as an error flushing buffered data in the standard streams), the exit status is changed to 120. If this is indeed, correct behavior and Python 3.6 is catching something incorrect (I agree this is not necessarily the most elegant unit test) then I am happy to close this issue. Just wanted to be sure I at least reported it in case this was a real issue. ---------- components: IO messages: 284437 nosy: John Hagen priority: normal severity: normal status: open title: Exit code 120 returned from Python unit test testing SystemExit type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 2 00:45:41 2017 From: report at bugs.python.org (mike peremsky) Date: Mon, 02 Jan 2017 05:45:41 +0000 Subject: [New-bugs-announce] [issue29131] Calling printf from the cdll does not print the full string Message-ID: <1483335941.28.0.90423143294.issue29131@psf.upfronthosting.co.za> New submission from mike peremsky: I am going throught he Gray Hat Python book and installed Python 3.7 (32-bit) on a windows x64 machine. The following code will only print the first character of the passed string argument. The same code run on Python 2.7 will print the correct string value. from ctypes import * msvcrt = cdll.msvcrt message_string = "Hello World!\n" msvcrt.printf("Testing: %s", message_string) Output: T ---------- components: ctypes messages: 284464 nosy: mperemsky priority: normal severity: normal status: open title: Calling printf from the cdll does not print the full string type: behavior versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 2 07:56:23 2017 From: report at bugs.python.org (Evan) Date: Mon, 02 Jan 2017 12:56:23 +0000 Subject: [New-bugs-announce] [issue29132] shlex.shlex with punctuation_chars and posix doesn't handle punctuation next to quotes Message-ID: <1483361783.89.0.00336686739256.issue29132@psf.upfronthosting.co.za> New submission from Evan: When both punctuation_chars and posix are used, any punctuation directly next to quoted characters is interpreted as a single token. >>> from shlex import shlex >>> list(shlex('>"a"', posix=True)) ['>', 'a'] >>> list(shlex('>"a"', punctuation_chars=True)) ['>', '"a"'] >>> list(shlex('>"a"', posix=True, punctuation_chars=True)) ['>a'] # should be ['>', 'a'] ---------- components: Library (Lib) messages: 284480 nosy: evan_, r.david.murray, vinay.sajip priority: normal severity: normal status: open title: shlex.shlex with punctuation_chars and posix doesn't handle punctuation next to quotes versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 2 08:00:12 2017 From: report at bugs.python.org (Evan) Date: Mon, 02 Jan 2017 13:00:12 +0000 Subject: [New-bugs-announce] [issue29133] Minor inaccuracy in shlex.shlex punctuation_chars example Message-ID: <1483362012.78.0.704413629859.issue29133@psf.upfronthosting.co.za> New submission from Evan: https://docs.python.org/3/library/shlex.html#improved-compatibility-with-shells The code sample here does not match the output - the first line is labelled 'New' and the second line 'Old'. ---------- assignee: docs at python components: Documentation messages: 284481 nosy: docs at python, evan_ priority: normal severity: normal status: open title: Minor inaccuracy in shlex.shlex punctuation_chars example versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 2 11:54:11 2017 From: report at bugs.python.org (YoSTEALTH) Date: Mon, 02 Jan 2017 16:54:11 +0000 Subject: [New-bugs-announce] [issue29134] contextlib doc bug Message-ID: <1483376051.72.0.678487921628.issue29134@psf.upfronthosting.co.za> New submission from YoSTEALTH: Link: https://docs.python.org/3/library/contextlib.html#contextlib.ContextDecorator "from contextlib import ContextDecorator class mycontext(ContextBaseClass, ContextDecorator):" "ContextBaseClass" is referenced but its no where to be found in source. ---------- messages: 284489 nosy: YoSTEALTH priority: normal severity: normal status: open title: contextlib doc bug _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 2 15:37:59 2017 From: report at bugs.python.org (William Gianopoulos) Date: Mon, 02 Jan 2017 20:37:59 +0000 Subject: [New-bugs-announce] [issue29135] run_proces logs the command without escaping parmaeters such that the coammns logged are not valid Message-ID: <1483389479.69.0.4543924586.issue29135@psf.upfronthosting.co.za> New submission from William Gianopoulos: So, the arguments to run_process are not escaped when logged such that the logged command is un-parsable. The following call: self.run_process(['notify-send', '--app-name', 'Mozilla Build System', 'Mozilla Build System', msg]) where msg='Build complete' ends up logging the following: /usr/bin/notify-send --app-name Mozilla Build System Mozilla Build System Build complete Where to be a valid command it needs to be: /usr/bin/notify-send --app-name 'Mozilla Build System' 'Mozilla Build System' 'Build complete' So, I think this needs to either not log the command at all or for each parameter replace any occurrence of the character "'" with "\'" and then enclose the entire parameter with "'" to make sure the logged command can actually be properly parsed. ---------- components: Library (Lib) messages: 284498 nosy: wgianopoulos priority: normal severity: normal status: open title: run_proces logs the command without escaping parmaeters such that the coammns logged are not valid versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 2 16:07:24 2017 From: report at bugs.python.org (Christian Heimes) Date: Mon, 02 Jan 2017 21:07:24 +0000 Subject: [New-bugs-announce] [issue29136] Add OP_NO_TLSv1_3 Message-ID: <1483391244.76.0.29431388133.issue29136@psf.upfronthosting.co.za> New submission from Christian Heimes: OpenSSL 1.1.1 is going to provide TLS 1.3. The preferred protocols PROTOCOL_TLS (old name PROTOCOL_SSLv23), PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER are going to have TLS 1.3 enabled by default. In order to disable TLS 1.3, let's add OP_NO_TLSv1_3 to _ssl.c and guard it with #ifdef SSL_OP_NO_TLSv1_3 https://github.com/openssl/openssl/blob/d2e491f225d465b11f18a466bf399d4a899cb50e/include/openssl/ssl.h#L346 Benjamin, Larry, Ned, are you ok with a new flag? OpenSSL 1.1.1 won't be available any time soon. I like to add the flag *after* the upcoming round of releases. ---------- assignee: christian.heimes components: SSL messages: 284504 nosy: benjamin.peterson, christian.heimes, larry, ned.deily priority: normal severity: normal stage: needs patch status: open title: Add OP_NO_TLSv1_3 type: enhancement versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 2 19:15:10 2017 From: report at bugs.python.org (Nathaniel Smith) Date: Tue, 03 Jan 2017 00:15:10 +0000 Subject: [New-bugs-announce] [issue29137] Fix fpectl-induced ABI breakage Message-ID: <1483402510.43.0.646850547969.issue29137@psf.upfronthosting.co.za> New submission from Nathaniel Smith: It turns out that CPython built with --with-fpectl has a different ABI than CPython built without --with-fpectl (which is the default). Specifically, if you have an extension module built against a --with-fpectl CPython, and it uses the PyFPE_{START,END}_PROTECT macros (as e.g. Cython modules do), then it ends up referring to some symbols that aren't provided by no-fpectl CPython builds. These macros are part of the stable ABI, so it's possible (though unlikely?) that there are existing modules using the stable ABI that refer to these symbols. Mailing list discussion: December: https://mail.python.org/pipermail/python-dev/2016-December/147065.html January: https://mail.python.org/pipermail/python-dev/2017-January/147092.html Guido's "let's get rid of it": https://mail.python.org/pipermail/python-dev/2017-January/147094.html There are 3 parts to the fpectl machinery: - macros PyFPE_{START,END}_PROTECT in Include/pyfpe.h, which are part of the public C API. Depending on --with-fpectl, these are either no-ops, or else refer to: - global symbols PyFPE_{jbuf,counter,dummy}, defined in Python/pyfpe.c iff --with-fpectl is enabled. - the stdlib module 'fpectl' (Modules/fpectlmodule.c) which provides some Python APIs that make use of the information that the macros put into the global symbols. (If the user doesn't use fpectl, then the macros do nothing except update the global variables.) >From the python-dev discussion, I think the resolution is: - for all supported CPython releases, we should modify Python/pyfpe.c so that the PyFPE_jbuf and PyFPE_counter are defined unconditionally. (I.e., remove the #ifdef WANT_SIGFPE_HANDLER that currently protects their definitions). After this change, all CPython builds will be able to import all CPython extension modules (though the actual fpectl functionality may or may not be available). - in the next 3.5 and maybe 3.4 releases, we should add a deprecation warning to the fpectl module. - in the next 2.7 release, we should add a Py3k warning to the fpectl module. - in trunk / 3.7, we should remove --with-fpectl and the fpectl stdlib module entirely. For stable API compatibility we might want to leave the PyFPE_* macros (defined as no-ops) and/or the PyFPE_{jbuf,counter,dummy} symbols, but nothing will actually use them. ---------- components: Extension Modules messages: 284511 nosy: njs priority: normal severity: normal status: open title: Fix fpectl-induced ABI breakage versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 01:27:46 2017 From: report at bugs.python.org (Martin Panter) Date: Tue, 03 Jan 2017 06:27:46 +0000 Subject: [New-bugs-announce] [issue29138] No __hash__() inheritance warning with -Werror Message-ID: <1483424866.48.0.00115230231317.issue29138@psf.upfronthosting.co.za> New submission from Martin Panter: Normally there is a Python 3 compatibility warning emitted when a class is based on object, implements __eq__(), but does not define __hash__(): $ python -3 -c 'class C(object): __eq__ = lambda self, other: True' -c:1: DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x But when warnings are raised as exceptions, this warning seems to be suppressed: $ python -3 -Werror -c 'class C(object): __eq__ = lambda self, other: True' Perhaps there is bad exception handling at the warn() call site. ---------- messages: 284539 nosy: martin.panter priority: normal severity: normal stage: needs patch status: open title: No __hash__() inheritance warning with -Werror type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 04:58:30 2017 From: report at bugs.python.org (Xiang Zhang) Date: Tue, 03 Jan 2017 09:58:30 +0000 Subject: [New-bugs-announce] [issue29139] operator.concat/iconcat could only work if left operand is a sequence Message-ID: <1483437510.5.0.880271510583.issue29139@psf.upfronthosting.co.za> New submission from Xiang Zhang: As the title, but I think it should also continue if only the right operand is a sequence since the right operand could get a __radd__ to do the concatenation: >>> class S: ... def __init__(self): ... self.v = list(range(10)) ... def __radd__(self, other): ... print('in __radd__') ... self.v.extend(other) ... return self.v ... def __getitem__(self, idx): ... return self.v[idx] >>> def i(): ... yield from range(10, 20) >>> i() + S() in __radd__ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] >>> operator.concat(i(), S()) Traceback (most recent call last): File "", line 1, in TypeError: 'generator' object can't be concatenated >>> a = i() >>> a += S() in __radd__ >>> a [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] >>> a = i() >>> operator.iconcat(a, S()) Traceback (most recent call last): File "", line 1, in TypeError: 'generator' object can't be concatenated ---------- components: Library (Lib) messages: 284546 nosy: xiang.zhang priority: normal severity: normal status: open title: operator.concat/iconcat could only work if left operand is a sequence type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 08:57:09 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 03 Jan 2017 13:57:09 +0000 Subject: [New-bugs-announce] [issue29140] time_hash() reads the wrong bytes to get microseconds Message-ID: <1483451829.62.0.434619516952.issue29140@psf.upfronthosting.co.za> New submission from STINNER Victor: When the time is folded, time_hash() uses DATE_xxx() macros, instead of TIME_xxx() macros, and so reads microseconds from the wrong bytes. Bug introduced by the implementation of the PEP 495 (Local Time Disambiguation). #define PyDateTime_DATE_GET_MICROSECOND(o) \ ((((PyDateTime_DateTime*)o)->data[7] << 16) | \ (((PyDateTime_DateTime*)o)->data[8] << 8) | \ ((PyDateTime_DateTime*)o)->data[9]) #define PyDateTime_TIME_GET_MICROSECOND(o) \ ((((PyDateTime_Time*)o)->data[3] << 16) | \ (((PyDateTime_Time*)o)->data[4] << 8) | \ ((PyDateTime_Time*)o)->data[5]) Attached patch fixes time_hash(). I guess that it's a dummy copy-paste issue. ---------- components: Library (Lib) files: time_hash.patch keywords: patch messages: 284561 nosy: belopolsky, haypo priority: normal severity: normal status: open title: time_hash() reads the wrong bytes to get microseconds versions: Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46123/time_hash.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 09:04:28 2017 From: report at bugs.python.org (Sandeep Srinivasa) Date: Tue, 03 Jan 2017 14:04:28 +0000 Subject: [New-bugs-announce] [issue29141] error in 2to3 Message-ID: <1483452268.26.0.428258207401.issue29141@psf.upfronthosting.co.za> New submission from Sandeep Srinivasa: docs_uploaded_at = dict(filter(lambda (x,y):True if len(y) == 3 else False,docs_uploaded_at.iteritems())) produces docs_uploaded_at = dict([x_y for x_y in iter(docs_uploaded_at.items()) if True if len(x_y[1]) == 3 else False]) without_transaction_users = filter(lambda x:False if x.phone in with_transaction_mobile else True,registered) produces without_transaction_users = [x for x in registered if False if x.phone in with_transaction_mobile else True] ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 284562 nosy: Sandeep Srinivasa priority: normal severity: normal status: open title: error in 2to3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 09:09:49 2017 From: report at bugs.python.org (Thomas Loetzer) Date: Tue, 03 Jan 2017 14:09:49 +0000 Subject: [New-bugs-announce] [issue29142] urllib: no_proxy variable values with leading dot not properly handled Message-ID: <1483452589.12.0.177615671636.issue29142@psf.upfronthosting.co.za> New submission from Thomas Loetzer: Hi, the fix for issue 26864 changed the behavior of urllib for no_proxy values with a leading dot to no longer match anything. This seems to be caused by always adding an additional dot between the hostname being checked and the entry. Example: no_proxy = '.company.internal' I would expect 'somehost.company.internal' to be accessed without proxy, but this is not actually the case. Changing no_proxy to company.internal changes this and the host is accessed without proxy. Python 2.7.11 and curl both handle this case fine and the proxy is not used. Regards, Thomas ---------- components: Library (Lib) messages: 284565 nosy: tloetzer priority: normal severity: normal status: open title: urllib: no_proxy variable values with leading dot not properly handled versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 12:49:34 2017 From: report at bugs.python.org (Oleg Serov) Date: Tue, 03 Jan 2017 17:49:34 +0000 Subject: [New-bugs-announce] [issue29143] Logger should ignore propagate property for disabled handlers. Message-ID: <1483465774.47.0.809201158116.issue29143@psf.upfronthosting.co.za> New submission from Oleg Serov: Looks like if I have a logger handler with propagate = False and it is disabled, the "propagate" is still in affect. I am considering this is a bug, because: 1. I have some random logging configuration with some logging handlers that have "propagate = True" 2. I am setting a new logging configuration by using logging.config.dictConfig with "disable_existing_loggers = True" 3. After that I still "feel" the effect of old config, because some log messages do not reach my new loggers. What I am doing wrong? Or this is a bug? A bug in documentation? ---------- components: Library (Lib) messages: 284583 nosy: Oleg Serov priority: normal severity: normal status: open title: Logger should ignore propagate property for disabled handlers. versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 13:27:01 2017 From: report at bugs.python.org (=?utf-8?q?Lum=C3=ADr_Balhar?=) Date: Tue, 03 Jan 2017 18:27:01 +0000 Subject: [New-bugs-announce] [issue29144] Implicit namespace packages in Python 3.6 Message-ID: <1483468021.78.0.379899829208.issue29144@psf.upfronthosting.co.za> New submission from Lum?r Balhar: Hello. I've found a really strange difference between Python 3.5 and 3.6 related to namespace packages and I cannot find any note in changelogs. I've created a simple bash script which can reproduce my issue using virtual environments: http://pastebin.com/j3fXMtR4 This script creates a virtual environment, installs marrow.util from PyPI which is one part of namespace package and creates the other part (marrow.mailer) in the local folder. Then script tries to import marrow.util and marrow.mailer - and there is the difference. In Python 3.5 - I can import marrow.util (installed via pip) but I cannot import local marrow.mailer module. I think that this is right behavior. In Python 3.6 - I cannot import marrow.util (installed via pip) but I can import local marrow.mailer module. Python versions are 3.5.2 (installed from Fedora repositories) and 3.6.0 (compiled manually). Why there is such a big difference? Am I missing something? I tried to ask on IRC, stackoverflow etc. but without success. Could you please explain the reason for this behavior to me? Thank you and have a nice day. Lum?r Bash script attached ---------- files: test_namespace_package.sh messages: 284587 nosy: frenzy priority: normal severity: normal status: open title: Implicit namespace packages in Python 3.6 type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file46129/test_namespace_package.sh _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 13:36:42 2017 From: report at bugs.python.org (jan matejek) Date: Tue, 03 Jan 2017 18:36:42 +0000 Subject: [New-bugs-announce] [issue29145] failing overflow checks in replace_* Message-ID: <1483468602.77.0.231507148809.issue29145@psf.upfronthosting.co.za> New submission from jan matejek: Related to http://bugs.python.org/issue1621 and http://bugs.python.org/issue27473 GCC 6 optimizes away broken overflow checks. This leads to segfaults on test_replace_overflow, at least for strings and bytearrays. ---------- components: Interpreter Core messages: 284588 nosy: matejcik priority: normal severity: normal status: open title: failing overflow checks in replace_* type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 16:12:51 2017 From: report at bugs.python.org (John Parejko) Date: Tue, 03 Jan 2017 21:12:51 +0000 Subject: [New-bugs-announce] [issue29146] Confusing "invalid token" exception when integers have leading zero Message-ID: <1483477971.7.0.132370199799.issue29146@psf.upfronthosting.co.za> New submission from John Parejko: As described in PEP-3127, the "leading-zeros" formatting for octal was removed from python 3. This is a good thing(tm), but the recommendation of that PEP to improve the error message of the raised exception[1] was apparently never implemented. I just ran into this while with some recently-ported python2 code, and it took a while to figure out the problem. Although this is going to be less of a problem with time as people convert to pure python3, it will be very helpful during the transition period. >>> 0o007 7 >>> 007 File "", line 1 007 ^ SyntaxError: invalid token 1: https://www.python.org/dev/peps/pep-3127/#id17 ---------- assignee: docs at python components: 2to3 (2.x to 3.x conversion tool), Documentation, Interpreter Core messages: 284591 nosy: John Parejko, docs at python priority: normal severity: normal status: open title: Confusing "invalid token" exception when integers have leading zero type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 3 23:48:12 2017 From: report at bugs.python.org (jha.amit6666) Date: Wed, 04 Jan 2017 04:48:12 +0000 Subject: [New-bugs-announce] [issue29147] registry value to be cleared when python is uninstalled Message-ID: <1483505292.36.0.945723017008.issue29147@psf.upfronthosting.co.za> New submission from jha.amit6666: I have installed python 3.5 on Windows and then uninstalled it. THe registry value HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.5 is still present. This is solved in python 3.6. So the work to be done here is: if there was any previous version of python installed and not present now, then the registry values should be cleared. The behaviour of uninstallation of Python 3.6 is that the registry value is cleared. ---------- components: Windows messages: 284608 nosy: jha.amit6666, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: registry value to be cleared when python is uninstalled type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 00:14:47 2017 From: report at bugs.python.org (Yugansh Marwah) Date: Wed, 04 Jan 2017 05:14:47 +0000 Subject: [New-bugs-announce] [issue29148] Inheritance behaviour ambiguos Message-ID: <1483506887.2.0.751213470204.issue29148@psf.upfronthosting.co.za> New submission from Yugansh Marwah: Inheritance property behaves ambiguously on inheriting multiple inheritance over a class It even calls the function of un-inherited class code is attached below kindly run it and tell me the exact behavior of the same. ---------- components: Tests files: oops.py messages: 284610 nosy: yugansh94 priority: normal severity: normal status: open title: Inheritance behaviour ambiguos type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file46133/oops.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 01:05:07 2017 From: report at bugs.python.org (Sumner Hearth) Date: Wed, 04 Jan 2017 06:05:07 +0000 Subject: [New-bugs-announce] [issue29149] SSL.py recursion limit crash Message-ID: <1483509907.61.0.802720332804.issue29149@psf.upfronthosting.co.za> New submission from Sumner Hearth: Error in python 3.6 ssl.py: [...] File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 737, in __init__ self._context.verify_mode = cert_reqs File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 479, in verify_mode super(SSLContext, SSLContext).verify_mode.__set__(self, value) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 479, in verify_mode super(SSLContext, SSLContext).verify_mode.__set__(self, value) [Repeated] Crash is infinite recursion on super calls having to do with the verify_mode property Crash found when creating an SSL context for eventlet with flask-socketio, unfortunately easiest way to reproduce involves installing eventlet, flask, flask-socketio, and pyopenssl. I've included the smallest working example of the crash in python 3.6, attached code works in python 3.5. Note: I'm attempting to create a dependency-free version of the file which exhibits the same behavior, it's tricky to unwrap all the libraries leading to the issue. See https://github.com/miguelgrinberg/Flask-SocketIO/issues/193 for original post discovering bug. ---------- assignee: christian.heimes components: SSL files: crash.py messages: 284614 nosy: Sumner Hearth, christian.heimes priority: normal severity: normal status: open title: SSL.py recursion limit crash type: crash versions: Python 3.6 Added file: http://bugs.python.org/file46135/crash.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 06:26:34 2017 From: report at bugs.python.org (zeroinside) Date: Wed, 04 Jan 2017 11:26:34 +0000 Subject: [New-bugs-announce] [issue29150] Bad cast@ _mysql_ResultObject_Initialize() result in code execution Message-ID: <1483529194.23.0.906683794217.issue29150@psf.upfronthosting.co.za> New submission from zeroinside: Hello. I found a vulnerability in _mysql module. PoC below: #!/usr/bin/python2.7 import _mysql RDX=0x66666666 payload="A"*2048 _mysql.result(payload,RDX) It's exploitable bug, I'm working on exploit. (gdb) run mysql.py Starting program: /usr/bin/python2.7 mysql.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x00007ffff38e7f3c in mysql_use_result () from /usr/lib/libmysqlclient.so.18 (gdb) info reg rax 0x4141414141414141 4702111234474983745 rbx 0x7ffff7e91b90 140737352637328 rcx 0x0 0 rdx 0x66666666 1717986918 rsi 0x7ffff7eb1ec0 140737352769216 rdi 0x5555557f9890 93824995006608 rbp 0x7fffffffe120 0x7fffffffe120 rsp 0x7fffffffe0a8 0x7fffffffe0a8 r8 0x7fffffffdd00 140737488346368 r9 0x7fffffffdd80 140737488346496 r10 0x5555557824f0 93824994518256 r11 0x2 2 r12 0x5555557560a0 93824994336928 r13 0x0 0 r14 0x7ffff7e939c7 140737352645063 r15 0x7ffff7e91b90 140737352637328 rip 0x7ffff38e7f3c 0x7ffff38e7f3c eflags 0x10206 [ PF IF RF ] cs 0x33 51 ss 0x2b 43 ds 0x0 0 es 0x0 0 fs 0x0 0 gs 0x0 0 (gdb) disas $rip Dump of assembler code for function mysql_use_result: 0x00007ffff38e7f30 <+0>: push %rbp 0x00007ffff38e7f31 <+1>: mov 0x4d0(%rdi),%rax 0x00007ffff38e7f38 <+8>: mov %rsp,%rbp 0x00007ffff38e7f3b <+11>: pop %rbp => 0x00007ffff38e7f3c <+12>: mov 0x18(%rax),%rax 0x00007ffff38e7f40 <+16>: jmpq *%rax End of assembler dump. (gdb) ---------- components: Library (Lib) messages: 284629 nosy: zeroinside priority: normal severity: normal status: open title: Bad cast@ _mysql_ResultObject_Initialize() result in code execution type: security versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 07:22:05 2017 From: report at bugs.python.org (patrila) Date: Wed, 04 Jan 2017 12:22:05 +0000 Subject: [New-bugs-announce] [issue29151] test_asyncore.TestAPI_UseIPv4Select / test_asyncore.TestAPI_UseIPv6Select fails test_handle_close_after_conn_broken Message-ID: <1483532525.73.0.454850752566.issue29151@psf.upfronthosting.co.za> New submission from patrila: Dear Python developers python-2.7.12, python-3.4.5 and the current "default" branch fail the tests * test.test_asyncore.TestAPI_UseIPv4Select.test_handle_close_after_conn_broken * test.test_asyncore.TestAPI_UseIPv6Select.test_handle_close_after_conn_broken (difference is only if IPv4 or IPv6 is used). The output of the test-suite is $ ./python -m unittest test.test_asyncore.TestAPI_UseIPv4Select.test_handle_close_after_conn_broken test.test_asyncore.TestAPI_UseIPv6Select.test_handle_close_after_conn_broken FF ====================================================================== FAIL: test_handle_close_after_conn_broken (test.test_asyncore.TestAPI_UseIPv4Select) ---------------------------------------------------------------------- Traceback (most recent call last): File ".../Lib/test/test_asyncore.py", line 648, in test_handle_close_after_conn_broken self.loop_waiting_for_flag(client) File ".../Lib/test/test_asyncore.py", line 511, in loop_waiting_for_flag self.fail("flag not set") AssertionError: flag not set ====================================================================== FAIL: test_handle_close_after_conn_broken (test.test_asyncore.TestAPI_UseIPv6Select) ---------------------------------------------------------------------- Traceback (most recent call last): File ".../Lib/test/test_asyncore.py", line 648, in test_handle_close_after_conn_broken self.loop_waiting_for_flag(client) File ".../Lib/test/test_asyncore.py", line 511, in loop_waiting_for_flag self.fail("flag not set") AssertionError: flag not set ---------------------------------------------------------------------- Ran 2 tests in 10.000s FAILED (failures=2) However, I also encounter sometimes a success (for both IPv6 and also IPv4). Therefore, I re-run the tests 100 times, this was the result: success rate of IPv4 test: 2/100 success rate of IPv6 test: 4/100 I conjecture that there is some kind of race condition behind the scenes which sometimes is "won" but more often lost. I'm running this test on Linux 4.8. I also did find nothing in the system logs related to the issue. ---------- messages: 284633 nosy: patrila priority: normal severity: normal status: open title: test_asyncore.TestAPI_UseIPv4Select / test_asyncore.TestAPI_UseIPv6Select fails test_handle_close_after_conn_broken versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 07:57:35 2017 From: report at bugs.python.org (kristall) Date: Wed, 04 Jan 2017 12:57:35 +0000 Subject: [New-bugs-announce] [issue29152] unittest subTest does not call addFailure Message-ID: <1483534655.28.0.0626841658388.issue29152@psf.upfronthosting.co.za> New submission from kristall: unittests subTests do not call addFailure in the case of a failure. Please see http://stackoverflow.com/questions/41432353/python3-4-unittest-addfailure-not-called-when-subtests-are-used for detailed problemdescription. ---------- components: Tests messages: 284635 nosy: kristall priority: normal severity: normal status: open title: unittest subTest does not call addFailure versions: Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 08:50:54 2017 From: report at bugs.python.org (patrila) Date: Wed, 04 Jan 2017 13:50:54 +0000 Subject: [New-bugs-announce] [issue29153] Test test.test_asynchat.TestAsynchat / test.test_asynchat.TestAsynchat_WithPoll fail test_close_when_done Message-ID: <1483537854.64.0.339355431872.issue29153@psf.upfronthosting.co.za> New submission from patrila: Dear Python developers The tests test.test_asynchat.TestAsynchat.test_close_when_done test.test_asynchat.TestAsynchat_WitrhPoll.test_close_when_done fail with ====================================================================== FAIL: test_close_when_done (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File ".../Lib/test/test_asynchat.py", line 256, in test_close_when_done self.assertGreater(len(s.buffer), 0) AssertionError: 0 not greater than 0 ====================================================================== FAIL: test_close_when_done (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File ".../Lib/test/test_asynchat.py", line 256, in test_close_when_done self.assertGreater(len(s.buffer), 0) AssertionError: 0 not greater than 0 Looking in the source code we see self.assertEqual(c.contents, []) # the server might have been able to send a byte or two back, but this # at least checks that it received something and didn't just fail # (which could still result in the client not having received anything) self.assertGreater(len(s.buffer), 0) We therefore conjecture that the server was able to send all data back. The relevant part is around line 61, the run() method of echo_server. # this may fail on some tests, such as test_close_when_done, # since the client closes the channel when it's done sending while self.buffer: n = conn.send(self.buffer[:self.chunk_size]) time.sleep(0.001) self.buffer = self.buffer[n:] Indeed, if we change the sleeping time to something larger, e.g. 1sec. The tests pass fine. In general it is a bad habit to relay on "hardware to be slow enough" to work/pass. I therefore propose to introduce a separate field in echo_server which is set to True if the server has received some data. Patch is attached and also included below. It is tested against Python-3.6.0 (sorry no "default" branch). Python 3.5.3rc1 also works, but the patch below has an offset of -1 (the import warnings line was added/removed depending on the point of view). For Python 2.7.13 the "same patch" also works but needs different line numbers and also different context. Patch is attached. Patch for 3.6.0: --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@ -42,12 +42,15 @@ self.event.set() conn, client = self.sock.accept() self.buffer = b"" + self.received_something = False # collect data until quit message is seen while SERVER_QUIT not in self.buffer: data = conn.recv(1) if not data: break self.buffer = self.buffer + data + if self.buffer: + self.received_something = True # remove the SERVER_QUIT message self.buffer = self.buffer.replace(SERVER_QUIT, b'') @@ -252,7 +255,7 @@ # the server might have been able to send a byte or two back, but this # at least checks that it received something and didn't just fail # (which could still result in the client not having received anything) - self.assertGreater(len(s.buffer), 0) + self.assertTrue(s.received_something) def test_push(self): # Issue #12523: push() should raise a TypeError if it doesn't get ---------- files: test_asynchat_add_receive_something_flag_3.6.patch keywords: patch messages: 284636 nosy: patrila priority: normal severity: normal status: open title: Test test.test_asynchat.TestAsynchat / test.test_asynchat.TestAsynchat_WithPoll fail test_close_when_done versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46138/test_asynchat_add_receive_something_flag_3.6.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 10:48:47 2017 From: report at bugs.python.org (Gerrit Holl) Date: Wed, 04 Jan 2017 15:48:47 +0000 Subject: [New-bugs-announce] [issue29154] 5 failures in test_doctest: ModuleNotFoundError: No module named 'IPython' Message-ID: <1483544927.48.0.740005145144.issue29154@psf.upfronthosting.co.za> New submission from Gerrit Holl: I am building and testing Python 3.6 on the JASMIN Analysis Platform , which runs Red Hat Enterprise Linux Server release 6.8 on a machine with 48 ? Intel(R) Xeon(R) CPU E7-4860 v2 @ 2.60GHz, 2 TiB RAM, and a PanFS? distributed file system. I am experiencing failures in test_doctest, specifically with `ModuleNotFoundError: No module named 'IPython'`. I don't know why it comes up with IPython at all. Below is the non-verbose test output. Attached is the verbose test output. $ ./python -m test test_doctest Run tests sequentially 0:00:00 [1/1] test_doctest ********************************************************************** File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 1841, in test.test_doctest.test_debug Failed example: try: doctest.debug_src(s) finally: sys.stdin = real_stdin Expected: > (1)() (Pdb) next 12 --Return-- > (1)()->None (Pdb) print(x) 12 (Pdb) continue Got: *** ModuleNotFoundError: No module named 'IPython' > (1)() (Pdb) next 12 --Return-- > (1)()->None (Pdb) print(x) 12 (Pdb) continue ********************************************************************** File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 1885, in test.test_doctest.test_pdb_set_trace Failed example: try: runner.run(test) finally: sys.stdin = real_stdin Expected: --Return-- > (1)()->None -> import pdb; pdb.set_trace() (Pdb) print(x) 42 (Pdb) continue TestResults(failed=0, attempted=3) Got: --Return-- *** ModuleNotFoundError: No module named 'IPython' > (1)()->None -> import pdb; pdb.set_trace() (Pdb) print(x) 42 (Pdb) continue TestResults(failed=0, attempted=3) ********************************************************************** File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 1914, in test.test_doctest.test_pdb_set_trace Failed example: try: runner.run(test) finally: sys.stdin = real_stdin Expected: --Return-- > (3)calls_set_trace()->None -> import pdb; pdb.set_trace() (Pdb) print(y) 2 (Pdb) up > (1)() -> calls_set_trace() (Pdb) print(x) 1 (Pdb) continue TestResults(failed=0, attempted=2) Got: --Return-- *** ModuleNotFoundError: No module named 'IPython' > (3)calls_set_trace()->None -> import pdb; pdb.set_trace() (Pdb) print(y) 2 (Pdb) up > (1)() -> calls_set_trace() (Pdb) print(x) 1 (Pdb) continue TestResults(failed=0, attempted=2) ********************************************************************** File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 1952, in test.test_doctest.test_pdb_set_trace Failed example: try: runner.run(test) finally: sys.stdin = real_stdin # doctest: +NORMALIZE_WHITESPACE Expected: --Return-- > (3)g()->None -> import pdb; pdb.set_trace() (Pdb) list 1 def g(x): 2 print(x+3) 3 -> import pdb; pdb.set_trace() [EOF] (Pdb) next --Return-- > (2)f()->None -> g(x*2) (Pdb) list 1 def f(x): 2 -> g(x*2) [EOF] (Pdb) next --Return-- > (1)()->None -> f(3) (Pdb) list 1 -> f(3) [EOF] (Pdb) continue ********************************************************************** File "foo-bar at baz.py", line 7, in foo-bar at baz Failed example: f(3) Expected nothing Got: 9 TestResults(failed=1, attempted=3) Got: --Return-- *** ModuleNotFoundError: No module named 'IPython' > (3)g()->None -> import pdb; pdb.set_trace() (Pdb) list 1 def g(x): 2 print(x+3) 3 -> import pdb; pdb.set_trace() [EOF] (Pdb) next --Return-- > (2)f()->None -> g(x*2) (Pdb) list 1 def f(x): 2 -> g(x*2) [EOF] (Pdb) next --Return-- > (1)()->None -> f(3) (Pdb) list 1 -> f(3) [EOF] (Pdb) continue ********************************************************************** File "foo-bar at baz.py", line 7, in foo-bar at baz Failed example: f(3) Expected nothing Got: 9 TestResults(failed=1, attempted=3) File "/dev/shm/gerrit/Python-3.6.0/Lib/test/test_doctest.py", line 2025, in test.test_doctest.test_pdb_set_trace_nested Failed example: try: runner.run(test) finally: sys.stdin = real_stdin # doctest: +REPORT_NDIFF Differences (ndiff with -expected +actual): + *** ModuleNotFoundError: No module named 'IPython' > (5)calls_set_trace() -> self.f1() (Pdb) print(y) 1 (Pdb) step --Call-- > (7)f1() -> def f1(self): (Pdb) step > (8)f1() -> x = 1 (Pdb) step > (9)f1() -> self.f2() (Pdb) step --Call-- > (11)f2() -> def f2(self): (Pdb) step > (12)f2() -> z = 1 (Pdb) step > (13)f2() -> z = 2 (Pdb) print(z) 1 (Pdb) up > (9)f1() -> self.f2() (Pdb) print(x) 1 (Pdb) up > (5)calls_set_trace() -> self.f1() (Pdb) print(y) 1 (Pdb) up > (1)() -> calls_set_trace() (Pdb) print(foo) *** NameError: name 'foo' is not defined (Pdb) continue TestResults(failed=0, attempted=2) ********************************************************************** 3 items had failures: 1 of 4 in test.test_doctest.test_debug 3 of 18 in test.test_doctest.test_pdb_set_trace 1 of 9 in test.test_doctest.test_pdb_set_trace_nested ***Test Failed*** 5 failures. test test_doctest failed -- 5 of 515 doctests failed test_doctest failed 1 test failed: test_doctest Total duration: 3 sec Tests result: FAILURE ---------- files: test_doctest_failure messages: 284643 nosy: Gerrit.Holl priority: normal severity: normal status: open title: 5 failures in test_doctest: ModuleNotFoundError: No module named 'IPython' versions: Python 3.6 Added file: http://bugs.python.org/file46140/test_doctest_failure _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 11:42:46 2017 From: report at bugs.python.org (Gerrit Holl) Date: Wed, 04 Jan 2017 16:42:46 +0000 Subject: [New-bugs-announce] [issue29155] test.test_spwd.TestSpwdNonRoot failure with FileNotFoundError: Message-ID: <1483548166.48.0.314208460749.issue29155@psf.upfronthosting.co.za> New submission from Gerrit Holl: I am building and testing Python 3.6 on the JASMIN Analysis Platform , which runs Red Hat Enterprise Linux Server release 6.8 on a machine with 48 ? Intel(R) Xeon(R) CPU E7-4860 v2 @ 2.60GHz, 2 TiB RAM, and a PanFS? distributed file system. test.test_spwd.TestSpwdNonRoot is failing with FileNotFoundError. Below is the full verbose output of `./python -m test -v test_spwd`: == CPython 3.6.0 (default, Jan 4 2017, 14:11:04) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] == Linux-2.6.32-642.6.2.el6.x86_64-x86_64-with-redhat-6.8-Santiago little-endian == hash algorithm: siphash24 64bit == cwd: /home/users/gholl/src/Python-3.6.0/build/test_python_40357 == encodings: locale=UTF-8, FS=utf-8 Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0) Run tests sequentially 0:00:00 [1/1] test_spwd test_getspnam_exception (test.test_spwd.TestSpwdNonRoot) ... ERROR test_getspall (test.test_spwd.TestSpwdRoot) ... skipped 'root privileges required' test_getspnam (test.test_spwd.TestSpwdRoot) ... skipped 'root privileges required' ====================================================================== ERROR: test_getspnam_exception (test.test_spwd.TestSpwdNonRoot) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/users/gholl/src/Python-3.6.0/Lib/test/test_spwd.py", line 67, in test_getspnam_exception spwd.getspnam(name) FileNotFoundError: [Errno 2] No such file or directory ---------------------------------------------------------------------- Ran 3 tests in 0.002s FAILED (errors=1, skipped=2) test_spwd failed 1 test failed: test_spwd Total duration: 66 ms Tests result: FAILURE ---------- messages: 284651 nosy: Gerrit.Holl priority: normal severity: normal status: open title: test.test_spwd.TestSpwdNonRoot failure with FileNotFoundError: _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 11:45:56 2017 From: report at bugs.python.org (Lukas Schwaighofer) Date: Wed, 04 Jan 2017 16:45:56 +0000 Subject: [New-bugs-announce] [issue29156] remove superfluous pow test for (nonexistent) long Message-ID: <1483548356.52.0.249977190995.issue29156@psf.upfronthosting.co.za> New submission from Lukas Schwaighofer: Since python 3 there is no longer a type long. There is still a legacy test formerly used for longs present in test_pow.py. As the same test is already present (as also visible at the beginning of the patch) the test can safely be removed. ---------- components: Tests files: test_pow.patch keywords: patch messages: 284652 nosy: lukas.schwaighofer priority: normal severity: normal status: open title: remove superfluous pow test for (nonexistent) long type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46143/test_pow.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 12:33:01 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 04 Jan 2017 17:33:01 +0000 Subject: [New-bugs-announce] [issue29157] random.c: Prefer getrandom() over getentropy(), handle ENOSYS in py_getentropy() Message-ID: <1483551181.22.0.980001779001.issue29157@psf.upfronthosting.co.za> New submission from STINNER Victor: A new getentropy() function was recently added to the glibc: https://sourceware.org/bugzilla/show_bug.cgi?id=17252 When the Python/random.c file was written (by me), the getentropy() function was only supported on OpenBSD. Later, random.c was modified to *not* use getentropy() on Solaris (Issue #25003). The problem is that py_getentropy() doesn't handle ENOSYS, and so Python fails at startup with a fatal error (Python 3.6): Fatal Python error: failed to get random numbers to initialize Python or (Python 3.5): Fatal Python error: getentropy() failed The bug was first reported in Fedora 26 (rawhide): https://bugzilla.redhat.com/show_bug.cgi?id=1410175 Attached patch (written for the default branch) should fix these issues: * Prefer getrandom() syscall over getentropy() function: getrandom() supports blocking and non-blocking mode on Linux, whereas getentropy() doesn't * Enhance py_getentropy() to handle ENOSYS: fallback on reading from /dev/urandom and remember that the function doesn't work I'm not sure that handling ENOSYS is required, since it's no more used on Linux, but it shouldn't hurt. I don't know if py_getentropy() should also handle EPERM? py_getrandom() catchs errors: EAGAIN, EINTR, EPERM and ENOSYS. With the patch, py_getentropy() catchs ENOSYS error. ---------- files: getentropy.patch keywords: patch messages: 284659 nosy: christian.heimes, haypo priority: normal severity: normal status: open title: random.c: Prefer getrandom() over getentropy(), handle ENOSYS in py_getentropy() type: security versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46144/getentropy.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 14:19:03 2017 From: report at bugs.python.org (Luciano Dionisio) Date: Wed, 04 Jan 2017 19:19:03 +0000 Subject: [New-bugs-announce] [issue29158] Possible glitch in the interaction of a thread and a multiprocessing manager Message-ID: <1483557543.41.0.26156873729.issue29158@psf.upfronthosting.co.za> New submission from Luciano Dionisio: After spending a lot of time trying to understand why my code will not execute as expected and after not getting any help from StackOverflow: http://stackoverflow.com/questions/41444081/python-multiprocessing-manager-delegate-client-connection-and-dont-wait I assumed that it may be a possible glitch in the interaction of a thread and a multiprocessing manager. I have tried this in Python 2.7.13 and Python 3.6.0 and assume the problem still exists in between and beyond. The problem appears when I try to delegate the connect() method of a multiprocessing manager client to a thread. The first time the procedure takes place, everything works fine and there is no problem of shared memory or anything. The problem arises on the second and forth trials of connect, when there seems to be a memory sharing problem. To reproduce the problem you have to run the server.py and client.py modules. You can see that the client is capable of populating the server's queue. If you terminate the server.py process and start it again, the client can no longer reassign the remote queue. Actually, reconnecting to the server always take place, as well as the correct linkage to the remote queue on line 53 of bridge.py: self.items_buffer = self.remote_manager.items_buffer() but the problem is that this procedure no longer works after the first time. Even though the connection is re-established, and at the moment of reconnection it is possible to send info to the server, whenever the thread dies, the pipe gets somehow broken. ---------- components: Interpreter Core files: case.zip messages: 284661 nosy: Luciano Dionisio priority: normal severity: normal status: open title: Possible glitch in the interaction of a thread and a multiprocessing manager type: crash versions: Python 2.7, Python 3.6 Added file: http://bugs.python.org/file46145/case.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 14:49:54 2017 From: report at bugs.python.org (Alexander Belopolsky) Date: Wed, 04 Jan 2017 19:49:54 +0000 Subject: [New-bugs-announce] [issue29159] Regression in bytes constructor Message-ID: <1483559394.32.0.335371111214.issue29159@psf.upfronthosting.co.za> New submission from Alexander Belopolsky: Consider the following code: $ cat bug.py from array import array class C(array): def __new__(cls): return array.__new__(cls, 'B', b'abc') def __index__(self): raise TypeError x = C() print(bytes(x)) It works under python 3.5: $ python3.5 bug.py b'abc' but raises a TypeError under python 3.6: $ python3.6 bug.py Traceback (most recent call last): File "bug.py", line 8, in print(bytes(x)) File "bug.py", line 6, in __index__ raise TypeError TypeError It looks like this was introduced in issue #27704. (Ref: e/pyq#827) ---------- keywords: 3.6regression messages: 284663 nosy: belopolsky, serhiy.storchaka priority: normal severity: normal status: open title: Regression in bytes constructor type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 17:34:57 2017 From: report at bugs.python.org (Pavel Chuvakhov) Date: Wed, 04 Jan 2017 22:34:57 +0000 Subject: [New-bugs-announce] [issue29160] `pow` with three int arguments works like it had two arguments Message-ID: <1483569297.56.0.246813655497.issue29160@psf.upfronthosting.co.za> New submission from Pavel Chuvakhov: Standard `pow` function of three integer arguments should result in a reminder `(x**y) % z`. It seems that `pow(x,y,z)` ignores `%z` operation if type(z) is not `int`. This happens also in the cases when `z` has type numpy.int32, numpy.int64, etc. I consider such a behavior of `pow` as a bug to be fixed. Thank you for your attantion, guys! Best wishes, Pavel. ---------- components: Distutils files: pow-bug_report.py messages: 284675 nosy: dstufft, eric.araujo, pch priority: normal severity: normal status: open title: `pow` with three int arguments works like it had two arguments type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file46146/pow-bug_report.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 18:44:44 2017 From: report at bugs.python.org (Gary E. Miller) Date: Wed, 04 Jan 2017 23:44:44 +0000 Subject: [New-bugs-announce] [issue29161] random.SystemRandom(seed) documentation issue Message-ID: <1483573484.55.0.222683171285.issue29161@psf.upfronthosting.co.za> New submission from Gary E. Miller: The man page for random.SystemRandom([seed]]) fails to mention that the parameter 'seed' is never used. This should be prominent in the documentation. I have found several cases where a seed was provided to SystemRandom(). https://docs.python.org/2.7/library/random.html?highlight=systemrandom Present in all versions of Python docs that I could find. ---------- components: Library (Lib) messages: 284678 nosy: gem priority: normal severity: normal status: open title: random.SystemRandom(seed) documentation issue type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 20:20:08 2017 From: report at bugs.python.org (OO O) Date: Thu, 05 Jan 2017 01:20:08 +0000 Subject: [New-bugs-announce] [issue29162] pyshell.py: name 'sys' is not defined Message-ID: <1483579208.82.0.533923327462.issue29162@psf.upfronthosting.co.za> New submission from OO O: Sorry for my bad English. line 7, 13 at pyshell.py. Call sys befor import sys. Cause name 'sys' is not defined ---------- assignee: terry.reedy components: IDLE messages: 284684 nosy: OO O, terry.reedy priority: normal severity: normal status: open title: pyshell.py: name 'sys' is not defined type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 20:27:11 2017 From: report at bugs.python.org (Michal Ostrowski) Date: Thu, 05 Jan 2017 01:27:11 +0000 Subject: [New-bugs-announce] [issue29163] shlex error in posix mode and empty quotes Message-ID: <1483579631.92.0.342698548142.issue29163@psf.upfronthosting.co.za> New submission from Michal Ostrowski: Three examples below. I believe the second is wrong, because it reorders the "echo" and "," tokens. >>> list(shlex.shlex('echo b="a",echo bar', posix=True)) ['echo', 'b', '=', 'a', ',', 'echo', 'bar'] >>> list(shlex.shlex('echo b="",echo bar', posix=True)) ['echo', 'b', '=', 'echo', ',', 'bar'] >>> list(shlex.shlex('echo b="",echo bar')) ['echo', 'b', '=', '""', ',', 'echo', 'bar'] ---------- messages: 284685 nosy: Michal Ostrowski priority: normal severity: normal status: open title: shlex error in posix mode and empty quotes _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 4 21:21:05 2017 From: report at bugs.python.org (OO O) Date: Thu, 05 Jan 2017 02:21:05 +0000 Subject: [New-bugs-announce] [issue29164] make test always fail at 218/405 ( AssertionError: ', ' not found in '1234.5' ) Message-ID: <1483582865.63.0.483903091008.issue29164@psf.upfronthosting.co.za> New submission from OO O: make test always fail at 218/405 at test_format.py line 426 message: [218/405/1] test test_format failed -- Traceback (most recent call last): File "/home/vm00/Downloads/Python-3.6.0/Lib/test/test_format.py", line 426, in test_locale self.assertIn(sep, text) AssertionError: ',' not found in '1234.5' ---------- components: Installation messages: 284692 nosy: OO O priority: normal severity: normal status: open title: make test always fail at 218/405 ( AssertionError: ',' not found in '1234.5' ) versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 5 01:47:59 2017 From: report at bugs.python.org (INADA Naoki) Date: Thu, 05 Jan 2017 06:47:59 +0000 Subject: [New-bugs-announce] [issue29165] Use forward compatible macro in example code for creating new type Message-ID: <1483598879.57.0.52341008423.issue29165@psf.upfronthosting.co.za> New submission from INADA Naoki: https://docs.python.org/2.7/extending/newtypes.html#the-basics uses PyObject_HEAD_INIT for type object header. static PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ This code isn't compatible with Python 3. In Python 3, PyVarObject_HEAD_INIT is used instead. https://docs.python.org/3.6/extending/newtypes.html#the-basics static PyTypeObject noddy_NoddyType = { PyVarObject_HEAD_INIT(NULL, 0) This code is compatible with Python 2. This example code can be copy and pasted when creating new extension. If people start writing Python 2 extension, and forward port it to Python 3, this small incompatibility cause compile error. Let's use more forward compatible and short code for example. ---------- assignee: docs at python components: Documentation messages: 284709 nosy: docs at python, inada.naoki priority: normal severity: normal status: open title: Use forward compatible macro in example code for creating new type type: enhancement versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 5 02:06:51 2017 From: report at bugs.python.org (Mama Mama) Date: Thu, 05 Jan 2017 07:06:51 +0000 Subject: [New-bugs-announce] [issue29166] AT&T tech email support number <1 855 338 0710 New submission from Mama Mama: AT&T tech email support number <1 855 338 0710$$$>>>1 855 338 0710 <<$$$$$<$_)_)AT&T tech email support phone number AT&T email support number &$$$>>>1 855 338 0710 <<$$$$$<$_)_)AT&T tech email support phone number AT&T email support number$$$$$$$$ 1 855 338 0710 moto khama wla AT&T tech email support number AT&T email support number AT&T tech email support phone number at&t email technical support number ---------- components: asyncio files: 1 855 338 0710 AT&T tech email support phone number AT&T email support number.jpg messages: 284711 nosy: Mama Mama, gvanrossum, yselivanov priority: normal severity: normal status: open title: AT&T tech email support number <1 855 338 0710 _______________________________________ From report at bugs.python.org Thu Jan 5 05:54:26 2017 From: report at bugs.python.org (Simon Percivall) Date: Thu, 05 Jan 2017 10:54:26 +0000 Subject: [New-bugs-announce] [issue29167] Race condition in enum.py:_decompose() Message-ID: <1483613666.47.0.301459916652.issue29167@psf.upfronthosting.co.za> New submission from Simon Percivall: When called by `_create_pseudo_member_()`, the dictionary iteration of `_value2member_map` in `_decompose()` in enum.py may lead to a "RuntimeError: dictionary changed size during iteration". For me, it happened in `re.compile`. ``` Traceback (most recent call last): ... File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py", line 233, in compile return _compile(pattern, flags) File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/re.py", line 301, in _compile p = sre_compile.compile(pattern, flags) File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sre_compile.py", line 562, in compile p = sre_parse.parse(p, flags) File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sre_parse.py", line 866, in parse p.pattern.flags = fix_flags(str, p.pattern.flags) File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/sre_parse.py", line 835, in fix_flags flags |= SRE_FLAG_UNICODE File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 794, in __or__ result = self.__class__(self._value_ | self.__class__(other)._value_) File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 291, in __call__ return cls.__new__(cls, value) File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 533, in __new__ return cls._missing_(value) File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 760, in _missing_ new_member = cls._create_pseudo_member_(value) File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 769, in _create_pseudo_member_ _, extra_flags = _decompose(cls, value) File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 849, in _decompose for v, m in flag._value2member_map_.items() File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 848, in (m, v) RuntimeError: dictionary changed size during iteration ``` ---------- messages: 284724 nosy: simon.percivall priority: normal severity: normal status: open title: Race condition in enum.py:_decompose() type: crash versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 5 07:12:48 2017 From: report at bugs.python.org (Simon Schuler) Date: Thu, 05 Jan 2017 12:12:48 +0000 Subject: [New-bugs-announce] [issue29168] multiprocessing pickle error Message-ID: <1483618368.97.0.107401413332.issue29168@psf.upfronthosting.co.za> New submission from Simon Schuler: Hello, the following code doesn't work any longer in the new Python version 3.6. import sys import os import subprocess from multiprocessing import Pool, Value, Queue import multiprocessing import logging import logging.handlers import pickle queue = multiprocessing.Manager().Queue(-1) qh = logging.handlers.QueueHandler(queue) pickle.dumps(qh) It raises the following exception. >>> TypeError: can't pickle _thread.RLock objects Furthermore, also for customized logging handler classes it doesn't work anymore. class CustomHandler(logging.Handler): def __init__(self, queue): logging.Handler.__init__(self) self.queue = queue def emit(self, record): try: ei = record.exc_info if ei: dummy = self.format(record) record.exc_info = None except (KeyboardInterrupt, SystemExit): raise except: self.handleError(record) For a centralized logging facility in a multiprocess environment this is a big problem. How can I handle this in the 3.6 version? ---------- messages: 284738 nosy: cxss priority: normal severity: normal status: open title: multiprocessing pickle error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 5 10:11:47 2017 From: report at bugs.python.org (Matthias Klose) Date: Thu, 05 Jan 2017 15:11:47 +0000 Subject: [New-bugs-announce] [issue29169] update zlib to 1.2.10 Message-ID: <1483629107.49.0.982374684244.issue29169@psf.upfronthosting.co.za> New submission from Matthias Klose: These are the changes updating zlib from 1.2.8 to 1.2.10. It is only used when building without a system zlib. The new release includes fixes for security issues CVE-2016-9840, CVE-2016-9841, CVE-2016-9842, CVE-2016-9843. Intending to update all active branches. Larry, is it ok to add this before the upcoming 3.4 and 3.5 releases, or should it wait? Changes in 1.2.10 (2 Jan 2017) - Avoid warnings on snprintf() return value - Fix bug in deflate_stored() for zero-length input - Fix bug in gzwrite.c that produced corrupt gzip files - Remove files to be installed before copying them in Makefile.in - Add warnings when compiling with assembler code Changes in 1.2.9 (31 Dec 2016) - Fix contrib/minizip to permit unzipping with desktop API [Zouzou] - Improve contrib/blast to return unused bytes - Assure that gzoffset() is correct when appending - Improve compress() and uncompress() to support large lengths - Fix bug in test/example.c where error code not saved - Remedy Coverity warning [Randers-Pehrson] - Improve speed of gzprintf() in transparent mode - Fix inflateInit2() bug when windowBits is 16 or 32 - Change DEBUG macro to ZLIB_DEBUG - Avoid uninitialized access by gzclose_w() - Allow building zlib outside of the source directory - Fix bug that accepted invalid zlib header when windowBits is zero - Fix gzseek() problem on MinGW due to buggy _lseeki64 there - Loop on write() calls in gzwrite.c in case of non-blocking I/O - Add --warn (-w) option to ./configure for more compiler warnings - Reject a window size of 256 bytes if not using the zlib wrapper - Fix bug when level 0 used with Z_HUFFMAN or Z_RLE - Add --debug (-d) option to ./configure to define ZLIB_DEBUG - Fix bugs in creating a very large gzip header - Add uncompress2() function, which returns the input size used - Assure that deflateParams() will not switch functions mid-block - Dramatically speed up deflation for level 0 (storing) - Add gzfread(), duplicating the interface of fread() - Add gzfwrite(), duplicating the interface of fwrite() - Add deflateGetDictionary() function - Use snprintf() for later versions of Microsoft C - Fix *Init macros to use z_ prefix when requested - Replace as400 with os400 for OS/400 support [Monnerat] - Add crc32_z() and adler32_z() functions with size_t lengths - Update Visual Studio project files [AraHaan] ---------- assignee: doko components: Extension Modules files: zlib-1.2.10.diff keywords: patch messages: 284749 nosy: doko, larry priority: normal severity: normal status: open title: update zlib to 1.2.10 versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46161/zlib-1.2.10.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 5 16:57:30 2017 From: report at bugs.python.org (Roy Marples) Date: Thu, 05 Jan 2017 21:57:30 +0000 Subject: [New-bugs-announce] [issue29170] Curses Module should check for is_keypad and not window flags Message-ID: <1483653450.75.0.3170058096.issue29170@psf.upfronthosting.co.za> New submission from Roy Marples: checking whether WINDOW has _flags... no The ncurses library can be built with an opaque window structure. As such, it's not always possible to query it's flags. Luckily there is the is_keypad function which works regardless of how ncurses was built. If this test is changed, then it will help support NetBSD curses as well. ---------- components: Extension Modules messages: 284771 nosy: Roy Marples priority: normal severity: normal status: open title: Curses Module should check for is_keypad and not window flags type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 5 17:38:51 2017 From: report at bugs.python.org (Eric N. Vander Weele) Date: Thu, 05 Jan 2017 22:38:51 +0000 Subject: [New-bugs-announce] [issue29171] Remove unused blake2 function to avoid undefined references Message-ID: <1483655931.95.0.807787917048.issue29171@psf.upfronthosting.co.za> New submission from Eric N. Vander Weele: Compilers are not required to elide static functions which are unused. Some compilers, such as Solaris Studio, always emits the function, even if the function does not get called within the translation unit. This becomes problematic when a static inline function calls a non-existent function; thus, resulting in (dynamic or static) link time errors. Given that 'blake2' is never referenced nor called, remove the definition of this function to increase portability for non-Linux toolchains. https://blogs.oracle.com/d/entry/inline_functions_in_c also indicates that this is case for Solaris Studio as well. ---------- components: Build files: blake2-remove-unused-function-1.patch keywords: patch messages: 284781 nosy: christian.heimes, ericvw priority: normal severity: normal status: open title: Remove unused blake2 function to avoid undefined references type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file46165/blake2-remove-unused-function-1.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 5 17:55:18 2017 From: report at bugs.python.org (Eric N. Vander Weele) Date: Thu, 05 Jan 2017 22:55:18 +0000 Subject: [New-bugs-announce] [issue29172] blake2: Use lowest-common denominator signature of #pragma pack Message-ID: <1483656918.9.0.359858354352.issue29172@psf.upfronthosting.co.za> New submission from Eric N. Vander Weele: Solaris Studio emits the following during compilation: "/tmp/Python-3.6.0/Modules/_blake2/impl/blake2.h", line 89: warning: ignoring malformed #pragma pack(n) "/tmp/Python-3.6.0/Modules/_blake2/impl/blake2.h", line 119: warning: ignoring malformed #pragma pack(n) To make the usage of '#pragma pack' more portable, change to the optional, single argument form. ---------- components: Build files: blake2-pragma-pack-1.patch keywords: patch messages: 284784 nosy: christian.heimes, ericvw priority: normal severity: normal status: open title: blake2: Use lowest-common denominator signature of #pragma pack type: compile error versions: Python 3.6 Added file: http://bugs.python.org/file46167/blake2-pragma-pack-1.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 5 18:28:45 2017 From: report at bugs.python.org (Prahlad Yeri) Date: Thu, 05 Jan 2017 23:28:45 +0000 Subject: [New-bugs-announce] [issue29173] Python 3.6 on Windows wastes a lot of CPU cycles in a while loop Message-ID: <1483658925.81.0.717567578019.issue29173@psf.upfronthosting.co.za> New submission from Prahlad Yeri: I'm running Python 3.6 on Windows 7. It wastes a lot of cpu cycles when inside a loop. In attached screenshot, you'll find that ~25% cpu is used by Python, while all I'm doing is running a pomodoro script that waits for a specific timeslot to complete. Here is the code for pomodoro.py that runs the while loop inside start_tracking() function: https://github.com/prahladyeri/PyPomodoro/blob/master/pomodoro.py def start_tracking(task): global last_beep print("Working on %s:%s (%d minutes)." % (task['category'], task['name'], task['duration'])) print("Started tracking at %s." % (datetime.datetime.now().strftime("%H:%M"))) print("Beep interval is set to %d minutes." % config.slot_interval) session_start_time = datetime.datetime.now() task_end_time = session_start_time + datetime.timedelta(minutes=task['duration']) last_beep = datetime.datetime.now() notified = False while(True): now = datetime.datetime.now() diff = (now - last_beep).total_seconds() / 60.0 #in minutes minutes_worked = round(diff) reminder_text = "%s:%s" % (task['category'], task['name']) #diff = diff.total_seconds() / (60.0) if (diff >= config.slot_interval): #30 #notify ---------- components: Windows files: Python_high_CPU_Windows.png messages: 284787 nosy: paul.moore, prahladyeri, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Python 3.6 on Windows wastes a lot of CPU cycles in a while loop type: resource usage versions: Python 3.6 Added file: http://bugs.python.org/file46169/Python_high_CPU_Windows.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 02:48:58 2017 From: report at bugs.python.org (ita1024) Date: Fri, 06 Jan 2017 07:48:58 +0000 Subject: [New-bugs-announce] [issue29174] 'NoneType' object is not callable in subprocess.py Message-ID: <1483688938.47.0.507597836624.issue29174@psf.upfronthosting.co.za> New submission from ita1024: Please try the attached testcase with `python3.6 test.py`; Python 3.6 displays unnecessary warnings of the following form: $ ../test.py Exception ignored in: > Traceback (most recent call last): File "/usr/local/lib/python3.6/subprocess.py", line 761, in __del__ TypeError: 'NoneType' object is not callable Exception ignored in: > Traceback (most recent call last): File "/usr/local/lib/python3.6/subprocess.py", line 761, in __del__ These warnings appear because of the line "warnings.warn" recently added in subprocess.Popen.__del__: 1. The call to warnings.warn is not usable during interpreter shutdown (and running `python -W ignore test.py` has no effect) 2. Calling "process.terminate()" or "process.kill()" at in the testcase or in an atexit handler would not get rid of the warning, one must set the return code on the Popen object 3. The warning can show up in existing code that has absolutely no zombie problems. I suggest to revert the recently added warning from subprocess.py: """ @@ -754,11 +995,6 @@ if not self._child_created: # We didn't get to successfully create a child process. return - if self.returncode is None: - # Not reading subprocess exit status creates a zombi process which - # is only destroyed at the parent python process exit - warnings.warn("subprocess %s is still running" % self.pid, - ResourceWarning, source=self) # In case the child hasn't been waited on, check if it's done. self._internal_poll(_deadstate=_maxsize) if self.returncode is None and _active is not None: """ ---------- components: Library (Lib) files: test.py messages: 284798 nosy: ita1024 priority: normal severity: normal status: open title: 'NoneType' object is not callable in subprocess.py type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file46171/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 04:58:43 2017 From: report at bugs.python.org (Jonathan Roach) Date: Fri, 06 Jan 2017 09:58:43 +0000 Subject: [New-bugs-announce] [issue29175] Documentation for File objects missing Message-ID: <1483696723.95.0.735667565924.issue29175@psf.upfronthosting.co.za> New submission from Jonathan Roach: The file documentation (as seen in python.org) went missing in 3.3. In 2.7.13 it can be found in 'The Python Standard Library' as section '5.9 File Objects', between '5.8 Mapping Types' and '5.10 memory view type'. In 3.3 and onwards this section is no longer present, and, as far as I can tell, is not present elsewhere in the documentation. [related: in 'The Python Tutorial' section '7.2.1 Methods of File Objects' the inline references to the file object methods are shown as references, but without a target] ---------- assignee: docs at python components: Documentation messages: 284806 nosy: docs at python, eric.araujo, ezio.melotti, georg.brandl, jonroach at icloud.com priority: normal severity: normal status: open title: Documentation for File objects missing type: behavior versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 05:47:00 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Fri, 06 Jan 2017 10:47:00 +0000 Subject: [New-bugs-announce] [issue29176] /tmp does not exist on Android and is used by curses.window.putwin() Message-ID: <1483699620.77.0.827616599041.issue29176@psf.upfronthosting.co.za> New submission from Xavier de Gaye: ====================================================================== ERROR: test_module_funcs (test.test_curses.TestCurses) Test module-level functions ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_curses.py", line 219, in test_module_fun cs self.stdscr.putwin(f) FileNotFoundError: [Errno 2] No such file or directory: '/tmp/py.curses.putwin.nsIZYY' ---------------------------------------------------------------------- ---------- assignee: xdegaye components: Extension Modules keywords: patch messages: 284810 nosy: twouters, xdegaye priority: normal severity: normal stage: needs patch status: open title: /tmp does not exist on Android and is used by curses.window.putwin() type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 06:14:22 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Fri, 06 Jan 2017 11:14:22 +0000 Subject: [New-bugs-announce] [issue29177] skip tests using socketserver.UnixStreamServer when bind() raises PermissionError Message-ID: <1483701262.25.0.0295401910206.issue29177@psf.upfronthosting.co.za> New submission from Xavier de Gaye: This happens on Android for a non-root user. One test in test_logging fails. Multiple tests fail in test_socketserver with identical backtraces, only the first one is listed here. ====================================================================== [1955/2616] ERROR: test_noserver (test.test_logging.UnixSocketHandlerTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_logging.py", line 1527, in setUp SocketHandlerTest.setUp(self) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_logging.py", line 1444, in setUp self.handle_socket, 0.01) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_logging.py", line 885, in __init__ bind_and_activate) File "/sdcard/org.bitbucket.pyona/lib/python3.7/socketserver.py", line 452, in __init__ self.server_bind() File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_logging.py", line 889, in server_bind super(TestTCPServer, self).server_bind() File "/sdcard/org.bitbucket.pyona/lib/python3.7/socketserver.py", line 466, in server_bind self.socket.bind(self.server_address) PermissionError: [Errno 13] Permission denied ====================================================================== [905/2616] ERROR: test_ForkingUnixDatagramServer (test.test_socketserver.SocketServerTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_socketserver.py", line 243, in test_Fork ingUnixDatagramServer self.dgram_examine) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/support/__init__.py", line 2040, in decorator return func(*args) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_socketserver.py", line 121, in run_serve r svrcls, hdlrbase) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_socketserver.py", line 114, in make_serv er server = MyServer(addr, MyHandler) File "/sdcard/org.bitbucket.pyona/lib/python3.7/socketserver.py", line 452, in __init__ self.server_bind() File "/sdcard/org.bitbucket.pyona/lib/python3.7/socketserver.py", line 466, in server_bind self.socket.bind(self.server_address) PermissionError: [Errno 13] Permission denied ---------- assignee: xdegaye components: Tests messages: 284812 nosy: xdegaye priority: normal severity: normal stage: needs patch status: open title: skip tests using socketserver.UnixStreamServer when bind() raises PermissionError type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 06:16:17 2017 From: report at bugs.python.org (INADA Naoki) Date: Fri, 06 Jan 2017 11:16:17 +0000 Subject: [New-bugs-announce] [issue29178] Adding bytes.frombuffer(byteslike) constructor Message-ID: <1483701377.3.0.893514886442.issue29178@psf.upfronthosting.co.za> New submission from INADA Naoki: # Summary ## 1. Making bytes from slice of bytearray easy and efficient. bs = bytes(memoryview(bytelike)[start:end]) works fine on CPython, but it will cause issue on PyPy. Since memoryview is not closed explicitly, exception like "BufferError: Existing exports of data: object cannot be re-sized" will be raised after it. Where exception raised can be far from where unclosed memoryview is leaked. ## 2. bytes(x) constructor is too overloaded. It has undocumented corner cases. See PEP 467 and #29159 # ML threads https://mail.python.org/pipermail/python-dev/2016-October/146668.html https://mail.python.org/pipermail/python-dev/2017-January/147109.html +1 from: Nathaniel Smith, Alexander Belopolsky, Yury Selivanov -1 from: Nick Coghlan Nick proposed put it on separated module, instead of adding it as builtin method. # First draft patch bytes-frombuffer.patch is first draft patch. It implements frombuffer to only bytes, with signature proposed first. Only C-contiguous buffer is supported for now. frombuffer(byteslike, length=-1, offset=0) method of builtins.type instance Create a bytes object from bytes-like object. Examples: bytes.frombuffer(b'abcd') -> b'abcd' bytes.frombuffer(b'abcd', 2) -> b'ab' bytes.frombuffer(b'abcd', 8) -> b'abcd' bytes.frombuffer(b'abcd', offset=2) -> b'cd' bytes.frombuffer(b'abcd', 1, 2) -> b'c' ---------- components: Interpreter Core files: bytes-frombuffer.patch keywords: patch messages: 284813 nosy: Yury.Selivanov, belopolsky, haypo, inada.naoki, ncoghlan priority: normal severity: normal status: open title: Adding bytes.frombuffer(byteslike) constructor type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46173/bytes-frombuffer.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 09:28:56 2017 From: report at bugs.python.org (Petr Viktorin) Date: Fri, 06 Jan 2017 14:28:56 +0000 Subject: [New-bugs-announce] [issue29179] Py_UNUSED is not documented Message-ID: <1483712936.43.0.521596791461.issue29179@psf.upfronthosting.co.za> New submission from Petr Viktorin: The Py_UNUSED macro, which was added in Python 3.4, is not documented. Is this an omission, or is it undocumented on purpose? I can prepare a patch if it's the former. The macro was added in: http://bugs.python.org/issue19976 and referenced in: http://bugs.python.org/issue26179 Usage on Github: https://github.com/search?q=py_unused&type=Code ---------- assignee: docs at python components: Documentation messages: 284821 nosy: docs at python, encukou priority: normal severity: normal status: open title: Py_UNUSED is not documented versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 10:14:52 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Fri, 06 Jan 2017 15:14:52 +0000 Subject: [New-bugs-announce] [issue29180] skip tests that raise PermissionError in test_os (non-root user on Android) Message-ID: <1483715692.75.0.979129057464.issue29180@psf.upfronthosting.co.za> New submission from Xavier de Gaye: ====================================================================== [1633/2616] ERROR: test_link (test.test_os.LinkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1703, in test_link self._test_link(self.file1, self.file2) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1698, in _test_link os.link(file1, file2) PermissionError: [Errno 13] Permission denied: '@test_2295_tmp' -> '@test_2295_tmp2' ====================================================================== ERROR: test_link_bytes (test.test_os.LinkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1707, in test_link_bytes bytes(self.file2, sys.getfilesystemencoding())) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1698, in _test_link os.link(file1, file2) PermissionError: [Errno 13] Permission denied: b'@test_2295_tmp' -> b'@test_2295_tmp2' ====================================================================== ERROR: test_unicode_name (test.test_os.LinkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1717, in test_unicode_name self._test_link(self.file1, self.file2) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 1698, in _test_link os.link(file1, file2) PermissionError: [Errno 13] Permission denied: '@test_2295_tmp?' -> '@test_2295_tmp?2' ====================================================================== ERROR: test_stty_match (test.test_os.TermsizeTests) Check if stty returns the same results ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 2795, in test_stty_match size = subprocess.check_output(['stty', 'size']).decode().split() File "/sdcard/org.bitbucket.pyona/lib/python3.7/subprocess.py", line 336, in check_output **kwargs).stdout File "/sdcard/org.bitbucket.pyona/lib/python3.7/subprocess.py", line 403, in run with Popen(*popenargs, **kwargs) as process: File "/sdcard/org.bitbucket.pyona/lib/python3.7/subprocess.py", line 707, in __init__ restore_signals, start_new_session) File "/sdcard/org.bitbucket.pyona/lib/python3.7/subprocess.py", line 1323, in _execute_child raise child_exception_type(errno_num, err_msg) PermissionError: [Errno 13] Permission denied ====================================================================== ERROR: test_attributes (test.test_os.TestScandir) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_os.py", line 3150, in test_attributes os.link(filename, os.path.join(self.path, "link_file.txt")) PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp/file .txt' -> '/data/local/tmp/test_python_2295/@test_2295_tmp/link_file.txt' ---------------------------------------------------------------------- Ran 238 tests in 4.675s FAILED (errors=5, skipped=40) test test_os failed ---------- assignee: xdegaye components: Tests messages: 284824 nosy: xdegaye priority: normal severity: normal stage: needs patch status: open title: skip tests that raise PermissionError in test_os (non-root user on Android) type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 11:31:35 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Fri, 06 Jan 2017 16:31:35 +0000 Subject: [New-bugs-announce] [issue29181] skip tests that raise PermissionError in test_tarfile (non-root user on Android) Message-ID: <1483720295.96.0.810571843517.issue29181@psf.upfronthosting.co.za> New submission from Xavier de Gaye: ====================================================================== [339/2616] ERROR: test_link_size (test.test_tarfile.Bz2WriteTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1102, in test_link_siz e os.link(target, link) PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard ir/link_target' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/link' ====================================================================== ERROR: test_link_size (test.test_tarfile.GzipWriteTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1102, in test_link_siz e os.link(target, link) PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard ir/link_target' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/link' ====================================================================== ERROR: test_add_hardlink (test.test_tarfile.HardlinkTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1563, in setUp os.link(self.foo, self.bar) PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard ir/foo' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/bar' ====================================================================== ERROR: test_add_twice (test.test_tarfile.HardlinkTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1563, in setUp os.link(self.foo, self.bar) PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard ir/foo' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/bar' ====================================================================== ERROR: test_dereference_hardlink (test.test_tarfile.HardlinkTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1563, in setUp os.link(self.foo, self.bar) PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard ir/foo' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/bar' ====================================================================== ERROR: test_link_size (test.test_tarfile.WriteTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_tarfile.py", line 1102, in test_link_siz e os.link(target, link) PermissionError: [Errno 13] Permission denied: '/data/local/tmp/test_python_2295/@test_2295_tmp-tard ir/link_target' -> '/data/local/tmp/test_python_2295/@test_2295_tmp-tardir/link' ---------------------------------------------------------------------- Ran 426 tests in 17.296s FAILED (errors=6, skipped=80) test test_tarfile failed ---------- assignee: xdegaye components: Tests messages: 284832 nosy: xdegaye priority: normal severity: normal stage: needs patch status: open title: skip tests that raise PermissionError in test_tarfile (non-root user on Android) type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 12:01:57 2017 From: report at bugs.python.org (Senthil Kumaran) Date: Fri, 06 Jan 2017 17:01:57 +0000 Subject: [New-bugs-announce] [issue29182] Remove the warning in urllib docs that it doesn't do certificate validate by default. Message-ID: <1483722117.81.0.319313681571.issue29182@psf.upfronthosting.co.za> New submission from Senthil Kumaran: It started as a discussion in this issue: http://bugs.python.org/issue22417#msg284604 I think, that warning can be removed. If no one has any objections, I will commit this attached patch. ---------- assignee: orsenthil components: Documentation files: remove_warning.patch keywords: patch messages: 284836 nosy: benjamin.peterson, christian.heimes, clopez, orsenthil priority: normal severity: normal stage: patch review status: open title: Remove the warning in urllib docs that it doesn't do certificate validate by default. type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file46176/remove_warning.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 14:41:41 2017 From: report at bugs.python.org (Jerome Leclanche) Date: Fri, 06 Jan 2017 19:41:41 +0000 Subject: [New-bugs-announce] [issue29183] Unintuitive error handling in wsgiref when a crash happens in write() or close() Message-ID: <1483731701.21.0.630358100063.issue29183@psf.upfronthosting.co.za> New submission from Jerome Leclanche: TLDR: When an error happens in the wsgiref's write() or close(), stack traces get inundated with irrelevant yet legitimate errors which make it hard to track down the real issue. Couple of examples of this happening in practice: https://stackoverflow.com/questions/28124461/how-do-i-solve-nonetype-object-is-not-callable-with-beautifulsoup-and-bottle https://stackoverflow.com/questions/27518844/error-when-serving-html-with-wsgi ---- How to reproduce: The file I've attached reproduces the error on python 3.4, 3.5 and 3.6. The handler returns a string instead of bytes, which fails an early assert in handlers.py: write(data). BaseHandler.run() triggers, gets as far as finish_response(), which triggers the above AssertionError. It falls into the except: block which attempts to handle_error(). But before doing that, it triggers self.close(), which sets result/headers/status/environ to None, bytes_sent to 0 and headers_sent to False. Now when handle_error() triggers, `self.headers_sent` is False because of that, which attempts to trigger finish_response() *again*. This triggers a write() which attempts sending the headers, which checks client_is_modern(), subscripting `self.environ` which at that point has already been set to None. New error, which is caught in run()'s except block and re-raised after closing the connection (again). I probably skipped some steps because the traceback is truly a mess. I think this could be improved, if only so that it doesn't get so confusing anymore. ---------- files: test_server.py messages: 284844 nosy: jleclanche priority: normal severity: normal status: open title: Unintuitive error handling in wsgiref when a crash happens in write() or close() versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file46179/test_server.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 14:48:57 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Fri, 06 Jan 2017 19:48:57 +0000 Subject: [New-bugs-announce] [issue29184] skip tests of test_socketserver when bind() raises PermissionError (non-root user on Android) Message-ID: <1483732137.12.0.493215743488.issue29184@psf.upfronthosting.co.za> New submission from Xavier de Gaye: This happens on Android for a non-root user. Multiple tests fail in test_socketserver with identical backtraces, only the first one is listed here. ====================================================================== [905/2616] ERROR: test_ForkingUnixDatagramServer (test.test_socketserver.SocketServerTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_socketserver.py", line 243, in test_Fork ingUnixDatagramServer self.dgram_examine) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/support/__init__.py", line 2040, in decorator return func(*args) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_socketserver.py", line 121, in run_serve r svrcls, hdlrbase) File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_socketserver.py", line 114, in make_serv er server = MyServer(addr, MyHandler) File "/sdcard/org.bitbucket.pyona/lib/python3.7/socketserver.py", line 452, in __init__ self.server_bind() File "/sdcard/org.bitbucket.pyona/lib/python3.7/socketserver.py", line 466, in server_bind self.socket.bind(self.server_address) PermissionError: [Errno 13] Permission denied ---------- assignee: xdegaye components: Tests messages: 284845 nosy: xdegaye priority: normal severity: normal stage: needs patch status: open title: skip tests of test_socketserver when bind() raises PermissionError (non-root user on Android) type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 16:18:27 2017 From: report at bugs.python.org (Xavier de Gaye) Date: Fri, 06 Jan 2017 21:18:27 +0000 Subject: [New-bugs-announce] [issue29185] test_distutils fails on Android API level 24 Message-ID: <1483737507.74.0.0285105710282.issue29185@psf.upfronthosting.co.za> New submission from Xavier de Gaye: ====================================================================== ERROR: test_tarfile_vs_tar (distutils.tests.test_archive_util.ArchiveUtilTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/distutils/tests/test_archive_util.py", line 170, i n test_tarfile_vs_tar spawn(gzip_cmd) File "/sdcard/org.bitbucket.pyona/lib/python3.7/distutils/spawn.py", line 36, in spawn _spawn_posix(cmd, search_path, dry_run=dry_run) File "/sdcard/org.bitbucket.pyona/lib/python3.7/distutils/spawn.py", line 159, in _spawn_posix % (cmd, exit_status)) distutils.errors.DistutilsExecError: command 'gzip' failed with exit status 1 ====================================================================== FAIL: test_copy_file_hard_link (distutils.tests.test_file_util.FileUtilTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/sdcard/org.bitbucket.pyona/lib/python3.7/distutils/tests/test_file_util.py", line 88, in te st_copy_file_hard_link self.assertTrue(os.path.samestat(st2, st3), (st2, st3)) AssertionError: False is not true : (os.stat_result(st_mode=33206, st_ino=15948, st_dev=64800, st_nl ink=1, st_uid=2000, st_gid=2000, st_size=12, st_atime=1483691935, st_mtime=1483691935, st_ctime=1483 691935), os.stat_result(st_mode=33206, st_ino=15949, st_dev=64800, st_nlink=1, st_uid=2000, st_gid=2 000, st_size=12, st_atime=1483691935, st_mtime=1483691935, st_ctime=1483691935)) ---------------------------------------------------------------------- Ran 236 tests in 1.885s FAILED (failures=1, errors=1, skipped=38) test test_distutils failed ---------- assignee: xdegaye components: Tests messages: 284850 nosy: dstufft, eric.araujo, xdegaye priority: normal severity: normal stage: needs patch status: open title: test_distutils fails on Android API level 24 type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 17:55:58 2017 From: report at bugs.python.org (YoSTEALTH) Date: Fri, 06 Jan 2017 22:55:58 +0000 Subject: [New-bugs-announce] [issue29186] TimeoutError isn't being raised? Message-ID: <1483743358.76.0.0752156268987.issue29186@psf.upfronthosting.co.za> New submission from YoSTEALTH: TimeoutError isn't being raised? My Python Version: 3.5.1 (64bit, linux) # Document: https://docs.python.org/3/library/exceptions.html#TimeoutError """ exception TimeoutError Raised when a system function timed out at the system level. Corresponds to errno ETIMEDOUT. New in version 3.3: All the above OSError subclasses were added. See also PEP 3151 - Reworking the OS and IO exception hierarchy """ # PEP: According to pep-3151 link: https://www.python.org/dev/peps/pep-3151/ """ TimeoutError : connection timed out (ETIMEDOUT); this can be re-cast as a generic timeout exception, replacing socket.timeout and also useful for other types of timeout (for example in Lock.acquire()) """ # This Does NOT Work: def Send(conn, data): # Set Timeout. conn.settimeout(3.0) try: while data: sent = conn.send(data) data = data[sent:] except TimeoutError as e: print("TimeoutError:", e) # close_connection() else: pass # Do Stuff... # This Works def Send(conn, data): # Set Timeout. conn.settimeout(3.0) try: while data: sent = conn.send(data) data = data[sent:] except socket.timeout as e: print("socket.timeout:", e) # socket.timeout: timed out close_connection() else: pass # Do Stuff... # This Works def Send(conn, data): # Set Timeout. conn.settimeout(3.0) try: while data: sent = conn.send(data) data = data[sent:] except OSError as e: print('ERROR Send:', e) # ERROR Send: timed out close_connection() else: pass # Do Stuff... According to PEP "TimeoutError" is suppose to replace "socket.timeout" but it doesn't seem to work! Any ideas why? ---------- messages: 284868 nosy: YoSTEALTH priority: normal severity: normal status: open title: TimeoutError isn't being raised? type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 18:06:54 2017 From: report at bugs.python.org (Matt Dodge) Date: Fri, 06 Jan 2017 23:06:54 +0000 Subject: [New-bugs-announce] [issue29187] Pickle failure is raising AttributeError and not PicklingError Message-ID: <1483744014.75.0.396569327718.issue29187@psf.upfronthosting.co.za> New submission from Matt Dodge: When failing to pickle something (like a locally scoped class) the documentation indicates that a PicklingError should be raised. Doc links: - https://docs.python.org/3/library/pickle.html?highlight=pickle#pickle-picklable - https://docs.python.org/3.5/library/pickle.html#what-can-be-pickled-and-unpickled However, instead I'm seeing AttributeError get raised instead, starting in Python 3.5. In Python 3.4 PicklingErrror was raised, as expected. To reproduce, use the following file def func(): class C: pass return C import pickle pickle.dumps(func()()) In Python 3.4 you see: Traceback (most recent call last): File "pickletest.py", line 5, in pickle.dumps(func()()) _pickle.PicklingError: Can't pickle .C'>: attribute lookup C on __main__ failed But in 3.5/3.6 you see: Traceback (most recent call last): File "pickletest.py", line 5, in pickle.dumps(func()()) AttributeError: Can't pickle local object 'func..C' I don't necessarily mind that a different exception is being raised, but how should we be handling exceptions while pickling? Catch all exceptions? That doesn't feel right to me, but if we're trying to pickle data out of our control I'm not sure what else to do. FYI, the UnpicklingError documentation (https://docs.python.org/3/library/pickle.html?highlight=pickle#pickle.UnpicklingError) indicates that other exceptions can possibly be raised during unpickling. I assume that is more related to the fact that the pickled data may not fit into the current class/module structure though, so I think it's unrelated. ---------- components: Library (Lib) messages: 284869 nosy: Matt.Dodge priority: normal severity: normal status: open title: Pickle failure is raising AttributeError and not PicklingError versions: Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 6 18:53:54 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 06 Jan 2017 23:53:54 +0000 Subject: [New-bugs-announce] [issue29188] Backport random.c from Python 3.5 to Python 2.7 Message-ID: <1483746834.46.0.642378238515.issue29188@psf.upfronthosting.co.za> New submission from STINNER Victor: Python 3.6 uses the new getrandom() function/syscall on Linux and Solaris to get random bytes with no file descriptor: it prevents EMFILE and ENFILE errors or surprises when opening a first file (and looking at its file descriptor). I propose to copy and adapt Python/random.c from Python 3.5 when Python 3.5 will be updated for the issue #29157. Python 2.7 requires extra changes: * configure.ac: need to check linux/random.h in AC_CHECK_HEADERS() * random.c: need to keep vms_urandom() function (Python 2.7 still supports VMS!) * Python 2.7 doesn't implement the PEP 475 (EINTR) and so don't have functions like _Py_read() which handles EINTR for us. See also the issue #29157 for the latest change in random.c: prefer getrandom() over getentropy() to support the glibc 2.24. ---------- messages: 284876 nosy: haypo priority: normal severity: normal status: open title: Backport random.c from Python 3.5 to Python 2.7 type: security versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 00:49:55 2017 From: report at bugs.python.org (Berker Peksag) Date: Sat, 07 Jan 2017 05:49:55 +0000 Subject: [New-bugs-announce] [issue29189] Broken indentation in FancyURLopener documentation Message-ID: <1483768195.47.0.481112354487.issue29189@psf.upfronthosting.co.za> New submission from Berker Peksag: I noticed this while taking a look at urllib docs for issue 29182. Indentation of prompt_user_passwd() is broken and it looks like it's part of the note directive: https://docs.python.org/2/library/urllib.html#urllib.FancyURLopener.prompt_user_passwd Python 3 version renders fine: https://docs.python.org/3/library/urllib.request.html#urllib.request.FancyURLopener.prompt_user_passwd Here is a patch. ---------- assignee: docs at python components: Documentation files: docfix.diff keywords: patch messages: 284888 nosy: berker.peksag, docs at python, orsenthil priority: normal severity: normal stage: patch review status: open title: Broken indentation in FancyURLopener documentation type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file46183/docfix.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 02:10:06 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 07 Jan 2017 07:10:06 +0000 Subject: [New-bugs-announce] [issue29190] Avoid possible errors in comparing strings Message-ID: <1483773006.32.0.276673146687.issue29190@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: PyUnicode_Compare() and PyUnicode_RichCompare() can raise an exception if one of arguments is not ready unicode object. The result is not always checked for error. Proposed patch gets rid of possible bugs. PyUnicode_Compare() and PyUnicode_RichCompare() in Modules/_pickle.c are replaced with _PyUnicode_EqualToASCIIString() and _PyUnicode_EqualToASCIIId() which never fail. Additional check is added in Modules/_decimal/_decimal.c to ensure that the string which is came from a user code is ready. All other occurrences of PyUnicode_Compare() seems are called only with ready unicode objects. ---------- components: Extension Modules files: unicode_compare.patch keywords: patch messages: 284895 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Avoid possible errors in comparing strings type: behavior versions: Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46184/unicode_compare.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 03:48:55 2017 From: report at bugs.python.org (Segev Finer) Date: Sat, 07 Jan 2017 08:48:55 +0000 Subject: [New-bugs-announce] [issue29191] liblzma is missing from pcbuild.sln Message-ID: <1483778935.32.0.9795840646.issue29191@psf.upfronthosting.co.za> New submission from Segev Finer: liblzma is missing from pcbuild.sln. This causes the build of _lzma to fail when building the solution and not using build.bat. Attached is a patch that fixes this for the default branch. Note that it also includes some missing project configurations for the _asyncio module which Visual Studio will add every single time you open the solution. A similar patch is simple enough to create for older versions/branches. Just Add->Existing Project liblzma.vcxproj and make sure to revert any lines in the sln which Visual Studio added that you don't want to commit. (Like VisualStudioVersion = ...) ---------- components: Windows files: add-liblzma-to-pcbuild-sln.patch keywords: patch messages: 284902 nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: liblzma is missing from pcbuild.sln type: compile error versions: Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46187/add-liblzma-to-pcbuild-sln.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 06:12:07 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 07 Jan 2017 11:12:07 +0000 Subject: [New-bugs-announce] [issue29192] Remove deprecated features from http.cookies Message-ID: <1483787527.13.0.320164851178.issue29192@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Some behavior of http.cookies was deprecated in 3.5. Following patch finishes the deprecation period and removes the code for handling deprecated features. Former warnings become errors. ---------- components: Library (Lib) files: cookies_finish_deprecation.patch keywords: patch messages: 284905 nosy: demian.brecht, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Remove deprecated features from http.cookies type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46188/cookies_finish_deprecation.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 06:35:11 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 07 Jan 2017 11:35:11 +0000 Subject: [New-bugs-announce] [issue29193] Remove support of format_string as keyword argument in string.Formatter().format() Message-ID: <1483788911.55.0.222681922661.issue29193@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Passing a format string as a keyword argument to string.Formatter.format() was deprecated in 3.5 (issue23671). Proposed patch finishes the deprecation period and converts a warning to an error. Python 3.5-3.6: >>> string.Formatter().format(format_string='foo: {foo}', foo=123) __main__:1: DeprecationWarning: Passing 'format_string' as keyword argument is deprecated 'foo: 123' Python 3.7: >>> string.Formatter().format(format_string='foo: {foo}', foo=123) Traceback (most recent call last): File "", line 1, in File "/home/serhiy/py/cpython/Lib/string.py", line 179, in format "argument: 'format_string'") from None TypeError: format() missing 1 required positional argument: 'format_string' ---------- components: Library (Lib) files: string_formatter_positional_only.patch keywords: patch messages: 284907 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Remove support of format_string as keyword argument in string.Formatter().format() type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46189/string_formatter_positional_only.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 07:02:13 2017 From: report at bugs.python.org (John Lehmann) Date: Sat, 07 Jan 2017 12:02:13 +0000 Subject: [New-bugs-announce] [issue29194] importlib reload fails for module supplied as argument to command line Message-ID: <1483790533.68.0.771948929262.issue29194@psf.upfronthosting.co.za> New submission from John Lehmann: Modules that have been loaded as an argument to the command line cannot be reloaded using importlib.reload. For example with the attached file: $ python reloader.py Traceback (most recent call last): File "reloader.py", line 31, in reload_module("__main__") File "reloader.py", line 28, in reload_module importlib.reload(module) File "/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/importlib/__init__.py", line 166, in reload _bootstrap._exec(spec, module) File "", line 607, in _exec AttributeError: 'NoneType' object has no attribute 'name' ---------- components: Library (Lib) files: reloader.py messages: 284910 nosy: j1o1h1n priority: normal severity: normal status: open title: importlib reload fails for module supplied as argument to command line versions: Python 3.5 Added file: http://bugs.python.org/file46191/reloader.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 07:04:53 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 07 Jan 2017 12:04:53 +0000 Subject: [New-bugs-announce] [issue29195] Get rid of supporting outdated wrong keyword arguments in re methods Message-ID: <1483790693.93.0.397432841389.issue29195@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Many re methods accepted the string parameter as a keyword argument by wrong name. This was fixed in issue20283. Wrong keyword names were still accepted, but a deprecation warning was emitted if use them. Proposed patch finishes the deprecation period (started since 3.4) and removes the support of wrong names. Python 2.7.7, 3.3.6, 3.4-3.6: >>> import re >>> re.compile('.').match(pattern='a') __main__:1: DeprecationWarning: The 'pattern' keyword parameter name is deprecated. Use 'string' instead. <_sre.SRE_Match object; span=(0, 1), match='a'> >>> re.compile('.').match(string='a') <_sre.SRE_Match object; span=(0, 1), match='a'> Python 3.7: >>> re.compile('.').match(pattern='a') Traceback (most recent call last): File "", line 1, in TypeError: Required argument 'string' (pos 1) not found ---------- components: Extension Modules files: re_wrong_string_argument_name.patch keywords: patch messages: 284911 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Get rid of supporting outdated wrong keyword arguments in re methods type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46192/re_wrong_string_argument_name.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 11:52:20 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 07 Jan 2017 16:52:20 +0000 Subject: [New-bugs-announce] [issue29196] Remove old-deprecated plistlib features Message-ID: <1483807940.54.0.471253591392.issue29196@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Seems many features of plistlib was deprecated from the start. The plistlib module was added in 2.6 and its code already contained deprecated features: * The _InternalDict class is a dict subclass with implemented __getattr__/__setattr__/__delattr__ methods, but all these methods have been deprecated. Since deprecated methods shouldn't be used and they are not implemented in builting dict, _InternalDict can be replaced by builting dict. * The Dict class has been deprecated. It doesn't used in the module. A user should use builting dict instead. * The Plist class has been deprecated. It doesn't used in the module. A user should use module level functions instead of Plist methods. It seems to me that all these classes can be removed. This doesn't break compatibility, since they were deprecated in 2.6. They are even not documented in 2.7. ---------- components: Library (Lib) files: plistlib_remove_deprecated_classes.patch keywords: patch messages: 284925 nosy: ronaldoussoren, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Remove old-deprecated plistlib features type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46196/plistlib_remove_deprecated_classes.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 12:17:38 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 07 Jan 2017 17:17:38 +0000 Subject: [New-bugs-announce] [issue29197] Remove os.path.splitunc() Message-ID: <1483809458.59.0.701425626614.issue29197@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Proposed patch removes os.path.splitunc(). It is Windows specific and has been deprecated in 3.1. It is superseded by splitdrive() in 3.x and in 2.7 since 2.7.8 (see issue21672). ---------- components: Library (Lib) files: remove_os_path_splitunc.patch keywords: patch messages: 284926 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Remove os.path.splitunc() type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46197/remove_os_path_splitunc.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 16:37:41 2017 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 07 Jan 2017 21:37:41 +0000 Subject: [New-bugs-announce] [issue29198] AsyncGenerator is missing from typing Message-ID: <1483825061.03.0.644790904886.issue29198@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: PEP 525 async generators weren't added to typing.py, probably by oversight. I sent pull requests to typing and typeshed on GitHub to add an AsyncGenerator class and stub: - https://github.com/python/typing/pull/346 - https://github.com/python/typeshed/pull/815 However, typing docs are not in GitHub, so I'm attaching a doc patch here. ---------- components: Library (Lib) files: asyncgenerator.patch keywords: patch messages: 284937 nosy: Jelle Zijlstra, gvanrossum, yselivanov priority: normal severity: normal status: open title: AsyncGenerator is missing from typing versions: Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46202/asyncgenerator.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 20:14:55 2017 From: report at bugs.python.org (ppperry) Date: Sun, 08 Jan 2017 01:14:55 +0000 Subject: [New-bugs-announce] [issue29199] test_regrtest fails if PCBuild directory doesn't exist Message-ID: <1483838095.77.0.195289202994.issue29199@psf.upfronthosting.co.za> New submission from ppperry: ====================================================================== ERROR: test_pcbuild_rt (test.test_regrtest.ProgramsTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Program Files (x86)\Python36-32\lib\test\test_regrtest.py", line 564, in test_pcbuild_rt self.run_batch(script, *rt_args, *self.regrtest_args, *self.tests) File "C:\Program Files (x86)\Python36-32\lib\test\test_regrtest.py", line 539, in run_batch proc = self.run_command(args) File "C:\Program Files (x86)\Python36-32\lib\test\test_regrtest.py", line 436, in run_command **kw) File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 403, in run with Popen(*popenargs, **kwargs) as process: File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 707, in __init__ restore_signals, start_new_session) File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 990, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified ---------- messages: 284947 nosy: ppperry priority: normal severity: normal status: open title: test_regrtest fails if PCBuild directory doesn't exist versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 21:02:12 2017 From: report at bugs.python.org (Jiajun Huang) Date: Sun, 08 Jan 2017 02:02:12 +0000 Subject: [New-bugs-announce] [issue29200] is it a bug in `functools._HashedSeq` Message-ID: <1483840932.91.0.717045884042.issue29200@psf.upfronthosting.co.za> New submission from Jiajun Huang: the class definition: class _HashedSeq(list): """ This class guarantees that hash() will be called no more than once per element. This is important because the lru_cache() will hash the key multiple times on a cache miss. """ __slots__ = 'hashvalue' def __init__(self, tup, hash=hash): self[:] = tup self.hashvalue = hash(tup) def __hash__(self): return self.hashvalue and I've test for it: In [1]: from functools import _HashedSeq In [2]: from unittest.mock import Mock In [3]: test_tup = 1, 2, 3, "hello", "world" In [4]: hash_func = Mock() In [5]: _HashedSeq(test_tup, hash=hash_func) Out[5]: [1, 2, 3, 'hello', 'world'] In [6]: _HashedSeq(test_tup, hash=hash_func) Out[6]: [1, 2, 3, 'hello', 'world'] In [7]: _HashedSeq(test_tup, hash=hash_func) Out[7]: [1, 2, 3, 'hello', 'world'] In [8]: hash_func.call_count Out[8]: 3 the hash function had been called 3 times rather than 1. ---------- components: Library (Lib) messages: 284949 nosy: Jiajun Huang priority: normal severity: normal status: open title: is it a bug in `functools._HashedSeq` versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 7 23:24:20 2017 From: report at bugs.python.org (Edward Laier) Date: Sun, 08 Jan 2017 04:24:20 +0000 Subject: [New-bugs-announce] [issue29201] Python 3.6 not working within VS 2015 Message-ID: <1483849460.53.0.951526575508.issue29201@psf.upfronthosting.co.za> New submission from Edward Laier: I installed Python 3.6 on my Microsoft server 2016 , running VS 2015 Community. I tried the path to Python Environment, then auto-detect, VS crashes and then when it restarts it will have the "+ Custom" grayed out. Where I then have to remove the key to ungray it as mentioned here [link](https://stackoverflow.com/questions/40430831/vs-2015-python-environments-greyed-out) Trying to put in all the variables for the environment doesn't work as 3.6 isn't even an option in the version drop-box for VS. The only option I see for now until this is fixed is removing 3.6 and installing 3.5 ---------- components: Windows messages: 284957 nosy: Edward Laier, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Python 3.6 not working within VS 2015 type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 04:50:36 2017 From: report at bugs.python.org (Raymond Hettinger) Date: Sun, 08 Jan 2017 09:50:36 +0000 Subject: [New-bugs-announce] [issue29202] Improve dict iteration Message-ID: <1483869036.69.0.874318106576.issue29202@psf.upfronthosting.co.za> New submission from Raymond Hettinger: I haven't had much of a chance to comb through all the code it detail, but there are least a few places that loop over the whole entry table (size is dk_nentries) when fewer iterations would suffice (stop once mp->ma_used entries have been seen). Since the table is usually dense packed to the left, this will give fewer loops and fewer memory accesses. ---------- assignee: serhiy.storchaka components: Interpreter Core files: dict_shorter_iteration.diff keywords: patch messages: 284970 nosy: inada.naoki, rhettinger, serhiy.storchaka priority: normal severity: normal status: open title: Improve dict iteration type: performance versions: Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46209/dict_shorter_iteration.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 05:01:29 2017 From: report at bugs.python.org (Raymond Hettinger) Date: Sun, 08 Jan 2017 10:01:29 +0000 Subject: [New-bugs-announce] [issue29203] With PEP 468, the lru cache not longer needs to sort keyword args Message-ID: <1483869689.96.0.118801671139.issue29203@psf.upfronthosting.co.za> New submission from Raymond Hettinger: Since the ordering of keyword arguments is now guaranteed, the LRU cache doesn't need to sort any longer. The will give a small change in behavior that I don't care about. A call f(a=1, b=2) would now be cached separately from f(b=2, a=1). That won't arise often and isn't really different than the status quo where f(1, b=2) or f(1, 2) are already cached separately. Overall it is a net win by saving the sorting step on every call. ---------- assignee: serhiy.storchaka components: Library (Lib) files: lru_468.diff keywords: patch messages: 284971 nosy: rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: With PEP 468, the lru cache not longer needs to sort keyword args type: performance versions: Python 3.7 Added file: http://bugs.python.org/file46210/lru_468.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 06:13:23 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 08 Jan 2017 11:13:23 +0000 Subject: [New-bugs-announce] [issue29204] Add code deprecations in ElementTree Message-ID: <1483874003.49.0.675614316595.issue29204@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Some deprecated ElementTree features are deprecated only in the documentation or in Python implementation (that is virtually the same since C implementation is default). Proposed patch adds missed deprecations is code. It also makes warnings be ignored only in tests where they are expected. This is possible since converting doctests to unittests some time ago. Added deprecations: * Element.getchildren() and Element.getiterator() methods. They were deprecated in the documentation and in Python implementation in 2.7 and 3.2. * The xml.etree.cElementTree module. Deprecated in the documentation in 3.3. * The html argument of XMLParser. Deprecated in the documentation in 3.4. Ned, is it appropriate to commit the patch (or its part) in 3.6? The discrepancy between Python and C implementation can be considered as a bug. What are your thoughts? ---------- components: Extension Modules, Library (Lib) files: etree_deprecations.patch keywords: patch messages: 284975 nosy: ned.deily, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Add code deprecations in ElementTree type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46211/etree_deprecations.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 06:29:20 2017 From: report at bugs.python.org (Jelle Zijlstra) Date: Sun, 08 Jan 2017 11:29:20 +0000 Subject: [New-bugs-announce] [issue29205] col_offset for AsyncFunctionDef AST nodes is wrong Message-ID: <1483874960.49.0.58571949289.issue29205@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: The col_offset attribute for ast.AsyncFunctionDef objects points to the "def" keyword, not to the "async" keyword that actually starts the node. Test case: In [18]: code = 'async def f(): pass' In [19]: tree = ast.parse(code) In [20]: tree.body[0] Out[20]: <_ast.AsyncFunctionDef at 0x7f5cb6a58f60> In [21]: tree.body[0].col_offset Out[21]: 6 ---------- components: Library (Lib) messages: 284978 nosy: Jelle Zijlstra priority: normal severity: normal status: open title: col_offset for AsyncFunctionDef AST nodes is wrong versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 06:43:51 2017 From: report at bugs.python.org (John Lehmann) Date: Sun, 08 Jan 2017 11:43:51 +0000 Subject: [New-bugs-announce] [issue29206] importlib reload fails for module supplied as argument to command line Message-ID: <1483875831.65.0.670865149709.issue29206@psf.upfronthosting.co.za> New submission from John Lehmann: In testing the py3 port for the web framework web.py, I found a limitation of importlib.reload. A module that was loaded via the command line cannot be reloaded with importlib.reload. The basic mode of operation for web.py is to create a web application as a single module, say, "app.py" and run this with "python app.py". When in development mode, on each page view, the modification time for each file backing each module is checked for changes. If the file has changed, the file is reloaded. This allows for an iterative development mode familiar to web developers since the glory days of writing VB pages in ASP. The problem occurs when the file is loaded directly, or with "-m". For example with the attached file: $ python reloader.py Traceback (most recent call last): File "reloader.py", line 31, in reload_module("__main__") File "reloader.py", line 28, in reload_module importlib.reload(module) File "/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/importlib/__init__.py", line 166, in reload _bootstrap._exec(spec, module) File "", line 607, in _exec AttributeError: 'NoneType' object has no attribute 'name' And with -m: $ python -m reloader Traceback (most recent call last): File "/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/runpy.py", line 184, in _run_module_as_main "__main__", mod_spec) File "/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "reloader.py", line 31, in reload_module("__main__") File "reloader.py", line 28, in reload_module importlib.reload(module) File "/usr/local/var/pyenv/versions/3.5.2/lib/python3.5/importlib/__init__.py", line 147, in reload raise ImportError(msg.format(name), name=name) ImportError: module reloader not in sys.modules Note that there are two different error messages, neither of which is great. There are workarounds, but given that this works in previous version of python, it might be better to fix it. Or to have an explicit error message that describes the problem more precisely: "Cannot reload __main__" ---------- files: reloader.py messages: 284982 nosy: brett.cannon, j1o1h1n, r.david.murray priority: normal severity: normal status: open title: importlib reload fails for module supplied as argument to command line type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file46212/reloader.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 10:52:16 2017 From: report at bugs.python.org (petevine) Date: Sun, 08 Jan 2017 15:52:16 +0000 Subject: [New-bugs-announce] [issue29207] make install fails on ARM Message-ID: <1483890736.55.0.166449192505.issue29207@psf.upfronthosting.co.za> New submission from petevine: I've just tried installing 2.7.13 on my ARM machine but after a successful build, `make install` fails without any hint what's wrong: Compiling /usr/lib/python2.7/xmllib.py ... Compiling /usr/lib/python2.7/xmlrpclib.py ... Compiling /usr/lib/python2.7/zipfile.py ... make: *** [libinstall] Error 1 Python 3.5.2 installation was successful on the same machine a little earlier. At the very least, a hint should be provided on how to get more verbose info. ---------- components: Build messages: 284994 nosy: petevine priority: normal severity: normal status: open title: make install fails on ARM type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 11:50:12 2017 From: report at bugs.python.org (Dustin Spicuzza) Date: Sun, 08 Jan 2017 16:50:12 +0000 Subject: [New-bugs-announce] [issue29208] BlockingIOError during system startup Message-ID: <1483894212.45.0.948118557952.issue29208@psf.upfronthosting.co.za> New submission from Dustin Spicuzza: I haven't dug into this very deeply yet, so I'm seeking some clarity on this issue before doing so. According to my reading of PEP 522 (https://www.python.org/dev/peps/pep-0522/), BlockingIOError will be raised in security sensitive APIs, but not when just importing the random module. However, it seems that this is not actually the case: BlockingIOError: [Errno 11] Resource temporarily unavailable The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/lvuser/py/robot.py", line 15, in import wpilib File "/usr/local/lib/python3.6/site-packages/wpilib/__init__.py", line 72, in from ._impl.main import run File "/usr/local/lib/python3.6/site-packages/wpilib/_impl/main.py", line 7, in from pkg_resources import iter_entry_points File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 36, in import email.parser File "/usr/local/lib/python3.6/email/parser.py", line 12, in from email.feedparser import FeedParser, BytesFeedParser File "/usr/local/lib/python3.6/email/feedparser.py", line 27, in from email._policybase import compat32 File "/usr/local/lib/python3.6/email/_policybase.py", line 9, in from email.utils import _has_surrogates File "/usr/local/lib/python3.6/email/utils.py", line 28, in import random File "/usr/local/lib/python3.6/random.py", line 742, in _inst = Random() SystemError: returned a result with an error set Background: I'm the maintainer of the RobotPy project, which allows students to use Python to control their robots in the FIRST Robotics competition. The robot controller we use is an NI roboRIO, which is powered by an ARM cortex-a9. This error was encountered when the robot is booting up with a python program. Presumably the program is started early enough in the boot process where the urandom blocking issue mentioned in the PEP occurs. I'd love some help figuring out what's going on here, and the best way to fix it. Thanks! I'm also tracking this issue at https://github.com/robotpy/robotpy-wpilib/issues/243 ---------- components: Library (Lib) messages: 284996 nosy: virtuald priority: normal severity: normal status: open title: BlockingIOError during system startup versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 12:56:25 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 08 Jan 2017 17:56:25 +0000 Subject: [New-bugs-announce] [issue29209] Remove old-deprecated ElementTree features Message-ID: <1483898185.03.0.0187159979308.issue29209@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Proposed patch removes old-deprecated ElementTree features. * Methods Element.getchildren(), Element.getiterator() and ElementTree.getiterator() deprecated in 2.7 and 3.2. Use list(elem) or iteration instead of getchildren(), methods iter() instead of getiterator(). * The html argument of XMLParser deprecated in 3.4. The rest of arguments are keyword-only now (passing them as keywords was recommended in the documentatin). * The support of the doctype() method of XMLParser subclasses and its default implementation. Deprecated in 3.2. Define the doctype() method on a custom TreeBuilder target instead. * The xml.etree.cElementTree module deprecated in 3.3. Unfortunately some of these deprecations are in the documentation only or in Python implementatation, but not in C implementatation. Perhaps missed warnings should be added first (see issue29204). But if commit the patch from issue29204 in 3.6, perhaps deprecated features could be removed in 3.7. ---------- components: Extension Modules, Library (Lib), XML files: etree_remove_deprecated.patch keywords: patch messages: 285000 nosy: eli.bendersky, ned.deily, scoder, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Remove old-deprecated ElementTree features type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46216/etree_remove_deprecated.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 13:22:27 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 08 Jan 2017 18:22:27 +0000 Subject: [New-bugs-announce] [issue29210] Remove the support of the exclude argument in tarfile.TarFile.add() Message-ID: <1483899747.86.0.0120992057455.issue29210@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Proposed patch removes the support of the exclude argument in tarfile.TarFile.add(). It was deprecated in 2.7 and 3.2. The filter argument that supersedes it is available in all maintained releases. ---------- components: Library (Lib) files: remove_tarfile_add_exclude.patch keywords: patch messages: 285002 nosy: lars.gustaebel, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Remove the support of the exclude argument in tarfile.TarFile.add() type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46217/remove_tarfile_add_exclude.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 8 16:14:25 2017 From: report at bugs.python.org (Andrew Dalke) Date: Sun, 08 Jan 2017 21:14:25 +0000 Subject: [New-bugs-announce] [issue29211] assertRaises with exceptions re-raised from a generator kills generator Message-ID: <1483910065.0.0.586195151306.issue29211@psf.upfronthosting.co.za> New submission from Andrew Dalke: The unittest assertRaises/assertRaisesRegex implementation calls traceback.clear_frames() because of issue9815 ("assertRaises as a context manager keeps tracebacks and frames alive"). However, if the traceback is from an exception created in a generator, caught, and re-raised outside of the generator, then the clear_frames() will cause the generator to raise a StopIteration exception the next time it is used. Here is a reproducible where I create a generator and wrap it inside of an object API: def simple_gen(): yield 1, None try: 1/0 except ZeroDivisionError as err: yield None, err yield 3, None class Spam: def __init__(self): self.gen = simple_gen() def get_next(self): value, err = next(self.gen) if err is not None: raise err return value I can test this without unittest using the following: def simple_test(): spam = Spam() assert spam.get_next() == 1 try: spam.get_next() except ZeroDivisionError: pass else: raise AssertionError assert spam.get_next() == 3 print("simple test passed") simple_test() This prints "simple test passed", as expected. The unittest implementation is simpler: import unittest class TestGen(unittest.TestCase): def test_gen(self): spam = Spam() self.assertEqual(spam.get_next(), 1) with self.assertRaises(ZeroDivisionError): spam.get_next() self.assertEqual(spam.get_next(), 3) unittest.main() but it reports an unexpected error: ====================================================================== ERROR: test_gen (__main__.TestGen) ---------------------------------------------------------------------- Traceback (most recent call last): File "clear.py", line 40, in test_gen self.assertEqual(spam.get_next(), 3) File "clear.py", line 13, in get_next value, err = next(self.gen) StopIteration ---------------------------------------------------------------------- Ran 1 test in 0.000s FAILED (errors=1) I have tracked it down to the call to traceback.clear_frames(tb) in unittest/case.py. The following ClearFrames context manager will call traceback.clear_frames() if requested. The test code uses ClearFrames to demonstrate that the call to clear_frames() is what causes the unexpected StopIteration exception: import traceback class ClearFrames: def __init__(self, clear_frames): self.clear_frames = clear_frames def __enter__(self): return self def __exit__(self, exc_type, exc_value, tb): assert exc_type is ZeroDivisionError, exc_type if self.clear_frames: traceback.clear_frames(tb) # This is the only difference between the tests. return True # This is essentially the same test case as before, but structured using # a context manager that either does or does not clear the traceback frames. def clear_test(clear_frames): spam = Spam() assert spam.get_next() == 1 with ClearFrames(clear_frames): spam.get_next() try: assert spam.get_next() == 3 except StopIteration: print(" ... got StopIteration") return print(" ... clear_test passed") print("\nDo not clear frames") clear_test(False) print("\nClear frames") clear_test(True) The output from this test is: Do not clear frames ... clear_test passed Clear frames ... got StopIteration There are only a dozen or so tests in my code which are affected by this. (These are from a test suite which I am porting from 2.7 to 3.5.) I can easily re-write them to avoid using assertRaisesRegex. I have no suggestion for a longer-term solution. ---------- components: Library (Lib) messages: 285006 nosy: dalke priority: normal severity: normal status: open title: assertRaises with exceptions re-raised from a generator kills generator type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 00:16:03 2017 From: report at bugs.python.org (desbma) Date: Mon, 09 Jan 2017 05:16:03 +0000 Subject: [New-bugs-announce] [issue29212] Python 3.6 logging thread name regression with concurrent.future threads Message-ID: <1483938963.09.0.315595404976.issue29212@psf.upfronthosting.co.za> New submission from desbma: Logging statement using 'threadName' from concurrent.futures threads produce the wrong output with Python 3.6. The attached program with Python 3.5.X outputs: MainThread From main thread Thread-1 From worker thread But with 3.6, it outputs: MainThread From main thread _0 From worker thread ---------- files: test.py messages: 285021 nosy: desbma priority: normal severity: normal status: open title: Python 3.6 logging thread name regression with concurrent.future threads type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file46222/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 09:12:18 2017 From: report at bugs.python.org (Josh Wilson) Date: Mon, 09 Jan 2017 14:12:18 +0000 Subject: [New-bugs-announce] [issue29213] python -m venv activate.bat has weird mix of line endings Message-ID: <1483971138.02.0.292455070123.issue29213@psf.upfronthosting.co.za> New submission from Josh Wilson: The activate.bat file generated by python -m venv somevirtualenv seems to have a mix of line ending styles. Sometimes using Carriage Return (CR) and Line Feed (LF) and other times using only CR. This seems to cause unexpected behavior when trying to modify the file to set additional environment variables. Since this is a Windows-specific file it seems like it should use Windows-style line endings of CRLF Deactivate.bat has the same issue. ---------- components: Windows messages: 285043 nosy: Josh Wilson, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: python -m venv activate.bat has weird mix of line endings type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 09:17:01 2017 From: report at bugs.python.org (=?utf-8?b?0JzQsNGA0Log0JrQvtGA0LXQvdCx0LXRgNCz?=) Date: Mon, 09 Jan 2017 14:17:01 +0000 Subject: [New-bugs-announce] [issue29214] Standard open() does not allow to specify file permissions. Message-ID: <1483971421.1.0.906896747438.issue29214@psf.upfronthosting.co.za> New submission from ???? ?????????: 1. Syscall open() allows that. 2. This is important to prevent race-conditions between creating a file with default permissions and calling fchmod(). ---------- components: Library (Lib) messages: 285044 nosy: mmarkk priority: normal severity: normal status: open title: Standard open() does not allow to specify file permissions. versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 09:28:49 2017 From: report at bugs.python.org (Sander Vrijders) Date: Mon, 09 Jan 2017 14:28:49 +0000 Subject: [New-bugs-announce] [issue29215] pyport.h uses non C90-style comment Message-ID: <1483972129.08.0.0486776479108.issue29215@psf.upfronthosting.co.za> New submission from Sander Vrijders: I am writing C90 compliant code and am wrapping my C headers with SWIG, which includes python3.6m/pyport.h. I've told my compiler to report all warnings as errors. Compilation fails with the following error: ``` /usr/include/python3.6m/pyport.h:40:1: error: C++ style comments are not allowed in ISO C90 // long long is required. Ensure HAVE_LONG_LONG is defined for compatibility. ``` I believe the comment was added by the patch of a previous bug (see https://hg.python.org/cpython/rev/4745d801cae2). The solution would be to change this comment to a C90 comment. ---------- messages: 285045 nosy: Sander Vrijders priority: normal severity: normal status: open title: pyport.h uses non C90-style comment type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 11:38:22 2017 From: report at bugs.python.org (Raymond Hettinger) Date: Mon, 09 Jan 2017 16:38:22 +0000 Subject: [New-bugs-announce] [issue29216] Space saving step for the LRU cache Message-ID: <1483979902.02.0.507353430639.issue29216@psf.upfronthosting.co.za> New submission from Raymond Hettinger: Sync with the space savings optimization in the pure Python code. I'm unsure whether the best way is to check for an exact tuple or whether to just check an exact int/str. ---------- assignee: serhiy.storchaka components: Library (Lib) files: functools_sync.diff keywords: patch messages: 285051 nosy: rhettinger, serhiy.storchaka priority: low severity: normal stage: patch review status: open title: Space saving step for the LRU cache type: resource usage versions: Python 3.7 Added file: http://bugs.python.org/file46228/functools_sync.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 17:43:26 2017 From: report at bugs.python.org (David Muller) Date: Mon, 09 Jan 2017 22:43:26 +0000 Subject: [New-bugs-announce] [issue29217] Documentation for uuid has wrong description for variant Message-ID: <1484001806.43.0.207679570942.issue29217@psf.upfronthosting.co.za> New submission from David Muller: The documentation's description for uuid.variant says that its value is one of several integer constants, but those constants are actually strings. ---------- assignee: docs at python components: Documentation messages: 285079 nosy: TigerhawkT3, docs at python priority: normal severity: normal status: open title: Documentation for uuid has wrong description for variant type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 18:01:13 2017 From: report at bugs.python.org (Eric N. Vander Weele) Date: Mon, 09 Jan 2017 23:01:13 +0000 Subject: [New-bugs-announce] [issue29218] distutils: Remove unused install_misc class Message-ID: <1484002873.56.0.81761190557.issue29218@psf.upfronthosting.co.za> New submission from Eric N. Vander Weele: This class hasn't been used for quite some time. Seems safe to remove. ---------- components: Build, Distutils files: distutils-remove-install_misc-1.patch keywords: patch messages: 285080 nosy: dstufft, eric.araujo, ericvw, gward priority: normal severity: normal status: open title: distutils: Remove unused install_misc class type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46235/distutils-remove-install_misc-1.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 20:43:30 2017 From: report at bugs.python.org (Ilya Kulakov) Date: Tue, 10 Jan 2017 01:43:30 +0000 Subject: [New-bugs-announce] [issue29219] TracebackException(capture_locals=True) may fail with RecursionError Message-ID: <1484012610.3.0.9642464783.issue29219@psf.upfronthosting.co.za> New submission from Ilya Kulakov: I'm using Python 3.5.2 to be precise. I have code that is roughly equivalent to: import sys import traceback def handle_exception(exc_type, exc_value, exc_traceback): traceback.TracebackException(exc_type, exc_value, exc_traceback, capture_locals=True) sys.excepthook = handle_exception For one of the clients the following error happened: Traceback (most recent call last): File "...", line 222, in ... File "...", line 160, in ... File "...", line 878, in ... File ":/traceback.py", line 463, in __init__ File ":/traceback.py", line 474, in __init__ File ":/traceback.py", line 352, in extract File ":/traceback.py", line 257, in __init__ File ":/traceback.py", line 257, in File ":/ctypes/__init__.py", line 354, in __repr__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ File ":/ctypes/__init__.py", line 360, in __getattr__ File ":/ctypes/__init__.py", line 365, in __getitem__ RecursionError: maximum recursion depth exceeded ---------- components: Library (Lib) messages: 285084 nosy: Ilya.Kulakov priority: normal severity: normal status: open title: TracebackException(capture_locals=True) may fail with RecursionError type: crash versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 21:47:19 2017 From: report at bugs.python.org (Mark Blakeney) Date: Tue, 10 Jan 2017 02:47:19 +0000 Subject: [New-bugs-announce] [issue29220] Python 3.6 regression/change using logging.addLevelName() to clear a name Message-ID: <1484016439.6.0.79629021761.issue29220@psf.upfronthosting.co.za> New submission from Mark Blakeney: I have code which does a logging.addLevelName(logging.INFO, '') so that the logging level name is not displayed in INFO messages, but is in all other levels. I have been running this code fine since many versions of Python 2 through to 3.5. Now running with python 3.6.0-1 (on Arch Linux), the name is output in messages as "Level 20". Changing the empty string '' in the call above to a space ' ' is my current work-around. ---------- components: Library (Lib) messages: 285085 nosy: markb priority: normal severity: normal status: open title: Python 3.6 regression/change using logging.addLevelName() to clear a name type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 9 23:18:47 2017 From: report at bugs.python.org (Anthony Scopatz) Date: Tue, 10 Jan 2017 04:18:47 +0000 Subject: [New-bugs-announce] [issue29221] ABC Recursion Error on isinstance() with less than recursion limit class hierarchy depth Message-ID: <1484021927.49.0.387886726852.issue29221@psf.upfronthosting.co.za> New submission from Anthony Scopatz: Classes that have an abstract base class somewhere in their hierarchy have a significantly reduced depth with respect to the recursion limit. In the attached minimal example, the class hierarchy is only able to be 245 deep past the ABC before a recursion error, rather than the expected 1000. Also disconcerting is that this recursion error is triggered by unrelated objects, namely an isinstance() check. This means that the error can happen at any point in the interpreter simply because the offending class exists. You don't need to call isinstance() with the offending class. This is likely due to the way the way that ABCMeta.__subclasscheck__(). This issue can be avoided by either: 1. Not having a deep-ish hierarchy, or 2. Calling the trigger, isinstance(), each time a new class is created (inside of the loop). Option (2) works because it tricks ABCMeta into putting each subclass class into its internal cache of subclasses. This fix is undesirable in general because what triggers the error, in general may not be known and can cross package boundaries. Note: I only tested this on Python v3.4 and v3.5, but it presumably affects all currently supported versions of Python. ---------- components: Library (Lib) files: abc_rec_fail.py messages: 285090 nosy: Anthony Scopatz priority: normal severity: normal status: open title: ABC Recursion Error on isinstance() with less than recursion limit class hierarchy depth type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46236/abc_rec_fail.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 01:32:23 2017 From: report at bugs.python.org (Vex Woo) Date: Tue, 10 Jan 2017 06:32:23 +0000 Subject: [New-bugs-announce] [issue29222] Python3 interactive shell hangs on Message-ID: <1484029943.51.0.404854509621.issue29222@psf.upfronthosting.co.za> New submission from Vex Woo: I'v tested the following steps against python3.5 and python3.6. Python shell hangs on. $ python3.6 Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import itertools >>> counter = itertools.count() >>> next(counter) 0 >>> next(counter) 1 >>> 'count' in counter ^C^C^C^C^C^C^C^C ^C^C^C ^D ^Z [1] + 47254 suspended python3.6 ~ ->> fg [1] + 47254 continued python3.6 ^C^C^Z [1] + 47254 suspended python3.6 ---------- components: Build messages: 285093 nosy: Nixawk priority: normal severity: normal status: open title: Python3 interactive shell hangs on type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 09:28:10 2017 From: report at bugs.python.org (George Fischhof) Date: Tue, 10 Jan 2017 14:28:10 +0000 Subject: [New-bugs-announce] [issue29223] Settable defaulting to decimal instead of float Message-ID: <1484058490.62.0.883575101853.issue29223@psf.upfronthosting.co.za> New submission from George Fischhof: Hi There, Settable defaulting to decimal instead of float It would be good to be able to use decimal automatically instead of float if there is a setting. For example an environment variable or a flag file. Where and when accuracy is more important than speed, the user could set this flag, and calculate with decimal numbers as learned in the school. I think several people would use this function Best regards, George ---------- components: Interpreter Core messages: 285114 nosy: georgefischhof priority: normal severity: normal status: open title: Settable defaulting to decimal instead of float type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 09:36:47 2017 From: report at bugs.python.org (George Fischhof) Date: Tue, 10 Jan 2017 14:36:47 +0000 Subject: [New-bugs-announce] [issue29224] OS related file operations (copy, move, delete, rename...) should be placed into one module Message-ID: <1484059007.13.0.312635543812.issue29224@psf.upfronthosting.co.za> New submission from George Fischhof: Hi There, OS related file operations (copy, move, delete, rename...) should be placed into one module... As it quite confusing that they are in two moduls (os and shutil). I have read that one is higher level than other, but actually to use them I have to think which function can be found in which module. It is confuse for beginners, and makes the usage more complex instead of make it more simple (as Zen of Python says ;-) ) An alias could good, not to cause incompatibility. Best regards, George ---------- components: Library (Lib) messages: 285115 nosy: georgefischhof priority: normal severity: normal status: open title: OS related file operations (copy, move, delete, rename...) should be placed into one module type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 10:37:15 2017 From: report at bugs.python.org (Elvis Stansvik) Date: Tue, 10 Jan 2017 15:37:15 +0000 Subject: [New-bugs-announce] [issue29225] distutils.command.install_lib.get_outputs() wrong with extensions built inplace Message-ID: <1484062635.84.0.0152072002193.issue29225@psf.upfronthosting.co.za> New submission from Elvis Stansvik: I noticed the following strange behavior: estan at newton:~/testdist$ find . ./testext.c ./setup.cfg ./setup.py estan at newton:~/testdist$ cat setup.py from distutils.core import setup, Extension setup( name='testdist', version='1.0.0', ext_modules = [Extension('testext', ['testext.c'])] ) estan at newton:~/testdist$ cat setup.cfg [build_ext] inplace=1 estan at newton:~/testdist$ ~/cpython/python setup.py install --prefix=~/prefix --record record.txt running install running build running build_ext building 'testext' extension creating build creating build/temp.linux-x86_64-3.7-pydebug gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall -Wstrict-prototypes -fPIC -I/home/estan/cpython/Include -I/home/estan/cpython -c testext.c -o build/temp.linux-x86_64-3.7-pydebug/testext.o gcc -pthread -shared build/temp.linux-x86_64-3.7-pydebug/testext.o -o /home/estan/testdist/testext.cpython-37dm-x86_64-linux-gnu.so running install_lib warning: install_lib: 'build/lib.linux-x86_64-3.7-pydebug' does not exist -- no Python modules to install running install_egg_info Creating /home/estan/prefix/lib/python3.7/site-packages/ Writing /home/estan/prefix/lib/python3.7/site-packages/testdist-1.0.0-py3.7.egg-info writing list of installed files to 'record.txt' estan at newton:~/testdist$ cat record.txt /home/estan/prefix/lib/python3.7/site-packages/n-37dm-x86_64-linux-gnu.so /home/estan/prefix/lib/python3.7/site-packages/testdist-1.0.0-py3.7.egg-info estan at newton:~/testdist$ find ~/prefix /home/estan/prefix /home/estan/prefix/lib /home/estan/prefix/lib/python3.7 /home/estan/prefix/lib/python3.7/site-packages /home/estan/prefix/lib/python3.7/site-packages/testdist-1.0.0-py3.7.egg-info estan at newton:~/testdist$ Notice how in the written record.txt, the path to the extension is wrong ("testext.cpytho" is missing), and the extension is not installed. I did a little digging and found that the reason is install_lib.get_outputs() returns the wrong result for extensions that are built inplace: It assumes they are built in the build directory. The attached patch fixes the problem. The failure of the included test case without the change to install_lib is: ====================================================================== FAIL: test_get_outputs_inplace_ext (distutils.tests.test_install_lib.InstallLibTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/estan/cpython/Lib/distutils/tests/test_install_lib.py", line 91, in test_get_outputs_inplace_ext self.assertEqual(expected, actual) AssertionError: Lists differ: ['/tmp/tmptt4nhzgi/foo.cpython-37dm-x86_64-linux-gnu.so'] != ['/tmp/tmptt4nhzgi/dm-x86_64-linux-gnu.so'] First differing element 0: '/tmp/tmptt4nhzgi/foo.cpython-37dm-x86_64-linux-gnu.so' '/tmp/tmptt4nhzgi/dm-x86_64-linux-gnu.so' - ['/tmp/tmptt4nhzgi/foo.cpython-37dm-x86_64-linux-gnu.so'] ? -------------- + ['/tmp/tmptt4nhzgi/dm-x86_64-linux-gnu.so'] ---------------------------------------------------------------------- Notice the missing "foo.cpython-37". With the change to install_lib, the test passes. ---------- components: Distutils messages: 285127 nosy: Elvis Stansvik, dstufft, eric.araujo priority: normal severity: normal status: open title: distutils.command.install_lib.get_outputs() wrong with extensions built inplace type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 11:40:05 2017 From: report at bugs.python.org (Simon Grantham) Date: Tue, 10 Jan 2017 16:40:05 +0000 Subject: [New-bugs-announce] [issue29226] Comment generates syntax error Message-ID: <1484066405.87.0.420039297563.issue29226@psf.upfronthosting.co.za> New submission from Simon Grantham: Placing the word "coding:" in a hash tag comment in a file causes a syntax error. Eg: ~ $ cat tst.py # coding: Wow! How odd! ~ $ python tst.py File "tst.py", line 2 SyntaxError: encoding problem: Wow ~ $ ---------- components: Interpreter Core messages: 285129 nosy: sgrantham priority: normal severity: normal status: open title: Comment generates syntax error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 12:50:46 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 10 Jan 2017 17:50:46 +0000 Subject: [New-bugs-announce] [issue29227] Reduce C stack consumption in function calls Message-ID: <1484070646.73.0.530578838486.issue29227@psf.upfronthosting.co.za> New submission from STINNER Victor: Attached patch reduce C stack consumption in function calls. It's the follow-up of the issue #28870. Reference (rev a30cdf366c02): test_python_call: 7175 calls before crash, stack: 1168 bytes/call test_python_getitem: 6235 calls before crash, stack: 1344 bytes/call test_python_iterator: 5344 calls before crash, stack: 1568 bytes/call => total: 18754 calls, 4080 bytes With "Inline call_function() in ceval.c": test_python_call: 7936 calls before crash, stack: 1056 bytes/call test_python_getitem: 6387 calls before crash, stack: 1312 bytes/call test_python_iterator: 5755 calls before crash, stack: 1456 bytes/call => total: 20078 calls, 3824 bytes With inline and "_PY_FASTCALL_SMALL_STACK: 5 arg (40 B) => 3 arg (24 B)": test_python_call: 8058 calls before crash, stack: 1040 bytes/call test_python_getitem: 6630 calls before crash, stack: 1264 bytes/call test_python_iterator: 5952 calls before crash, stack: 1408 bytes/call => total: 20640 calls, 3712 bytes I applied testcapi_stack_pointer.patch and run stack_overflow_28870-sp.py of the issue #28870 to produce these statistics. With the patch, Python 3.7 is still not as good as Python 3.5 (msg285109), but it's a first enhancement. ---------- components: Interpreter Core files: less_stack.patch keywords: patch messages: 285135 nosy: haypo, serhiy.storchaka priority: normal severity: normal status: open title: Reduce C stack consumption in function calls type: performance versions: Python 3.7 Added file: http://bugs.python.org/file46242/less_stack.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 13:19:26 2017 From: report at bugs.python.org (yadayada) Date: Tue, 10 Jan 2017 18:19:26 +0000 Subject: [New-bugs-announce] [issue29228] sqlite3 OperationalError on changing into WAL transaction mode Message-ID: <1484072366.39.0.529572648914.issue29228@psf.upfronthosting.co.za> New submission from yadayada: Running sqlite3.connect('foo.db').execute("PRAGMA journal_mode = WAL") will throw sqlite3.OperationalError: cannot change into wal mode from within a transaction on Python 3.6.0, but not with older versions. ---------- messages: 285141 nosy: yadayada priority: normal severity: normal status: open title: sqlite3 OperationalError on changing into WAL transaction mode versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 14:22:09 2017 From: report at bugs.python.org (Jason Curtis) Date: Tue, 10 Jan 2017 19:22:09 +0000 Subject: [New-bugs-announce] [issue29229] incompatible: unittest.mock.sentinel and multiprocessing.Pool.map() Message-ID: <1484076129.07.0.522749594718.issue29229@psf.upfronthosting.co.za> New submission from Jason Curtis: When a sentinel object from unittest.mock.sentinel is passed through a multiprocessing.Pool.map, I expect it to still be comparable. As a user, I'd like to be able to write a unit test using sentinels on my unparallelized code, and then see that the test still passes after I parallelize the code using multiprocessing, so that I can make use of sentinels in regression testing. Example: ``` from unittest import mock import multiprocessing def identity(x): return x with multiprocessing.Pool() as pool: multiprocessed = list(pool.map(identity, [mock.sentinel.foo])) assert identity(mock.sentinel.foo) == mock.sentinel.foo # Passes assert multiprocessed[0] == mock.sentinel.foo # Fails ``` ---------- components: Library (Lib) messages: 285146 nosy: Jason Curtis priority: normal severity: normal status: open title: incompatible: unittest.mock.sentinel and multiprocessing.Pool.map() type: behavior versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 14:45:11 2017 From: report at bugs.python.org (Daniel Fackrell) Date: Tue, 10 Jan 2017 19:45:11 +0000 Subject: [New-bugs-announce] [issue29230] Segfault in sqlite3 Message-ID: <1484077511.04.0.514172163049.issue29230@psf.upfronthosting.co.za> New submission from Daniel Fackrell: This crash occurs while running some unittests in one of our Django apps. It duplicates on all three versions I've tried (2.7.10, 2.7.12, and 2.7.13). I don't have a Python3-capable code to test against at present. It fails on my Mac OS system, and we can't duplicate the issue on an Ubuntu system. There's one particular test that consistently triggers it, but only if most of the other tests for the same file run first. I've attached the .crash file (with Python 2.7.13), and included pip freeze and uname -a output below. Please let me know if I can provide more info to help with debugging this. $ uname -a Darwin c02pwm27g8wn.corp.verisys.com 15.6.0 Darwin Kernel Version 15.6.0: Wed Nov 2 20:30:56 PDT 2016; root:xnu-3248.60.11.1.2~2/RELEASE_X86_64 x86_64 $ pip freeze coverage==4.3.1 Django==1.8.17 django-nose==1.4.4 funcsigs==1.0.2 lxml==3.4.4 mock==2.0.0 model-mommy==1.3.1 MySQL-python==1.2.5 nose==1.3.7 pbr==1.10.0 pycrypto==2.6.1 pytz==2016.10 requests==2.12.4 six==1.10.0 suds==0.4 ---------- files: python_2017-01-09-152821_C02PWM27G8WN.crash messages: 285150 nosy: intchanter priority: normal severity: normal status: open title: Segfault in sqlite3 type: crash versions: Python 2.7 Added file: http://bugs.python.org/file46244/python_2017-01-09-152821_C02PWM27G8WN.crash _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 16:14:07 2017 From: report at bugs.python.org (KeyWeeUsr) Date: Tue, 10 Jan 2017 21:14:07 +0000 Subject: [New-bugs-announce] [issue29231] Broken MSIs in Python 3.5+ Message-ID: <1484082847.93.0.115252889304.issue29231@psf.upfronthosting.co.za> New submission from KeyWeeUsr: In versions _lower_ than 3.5.0 there was a `.MSI` installer for Windows, which had a really nice hidden option. That option looked like this: msiexec.exe /a "file.msi" /qb /L*V "file.log" ALLUSERS=0 TARGETDIR="target" CURRENTDIRECTORY="%cd%" which basically allows me to ignore admin rights, because the MSI turns to some kind of installer for whole network, thus the permission workaround for older Python versions. With Python 3.5.0 was introduced a new `.EXE` installer, which has `.MSI` files packed in itself, you can get them out with: python-3.5.0.exe /layout [optional target directory] yet there's a really annoying thing going around with this solution. When I do this, the `.MSI` files have a `-d.msi` suffix and when I manually unpack it with the `msiexec` command above, **every file** has that suffix too, which makes it a _completely damaged_ installation. Renaming the files isn't really an option as each file has `-d.`, not `-d.msi.` suffix, so it's too hard to rename it in a simple way with tools such as Batch, unless I want to check for multiple cases (e.g. folders). Is there any way how to extract the content of the installer to a separate folder, like it was possible before **without** any additional stuff put into `Programs and features`, such as `Python 3.5.0 (64bit)` or similar? Or other question - is there any way how to forbid the installer to access `Programs and features`, shut it from asking admin privileges and registry at all? It's quite useful if I want to have multiple python fresh installations not bound to anything at all with testing as its main purpose. Note, that I have no intention to use python launcher (that `py.exe` thing), virtualenv or any other alternative "solution" as every of them allows me to install only a one **global** Python installation of the same version and/or is too big for quick usage and at the same time I need to have an option for testing on a fresh interpreter not modified by anything and completely cut off from the OS stuff. Any ideas how can I achieve the same behavior even on newer Python versions with the EXE installer? ---------- components: Installation, Windows messages: 285157 nosy: KeyWeeUsr, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Broken MSIs in Python 3.5+ type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 16:29:12 2017 From: report at bugs.python.org (Earl Maier) Date: Tue, 10 Jan 2017 21:29:12 +0000 Subject: [New-bugs-announce] [issue29232] Quiet Install Message-ID: <1484083752.73.0.652797539276.issue29232@psf.upfronthosting.co.za> New submission from Earl Maier: On quiet and passive Installs of Python 3.6 and 3.5 in windows 7 and 10 (x64), Python successfully installs but does not appear in programs and features. It would also appear that the append path and python launcher switches do not work for quiet install. If installed manual everything functions as it should. Quiet installs work just fine with version 2.7 (msi vs exe). The installers used are the Windows x86-64 executable installer for both python 3.6.0 and 3.5.2. ---------- components: Windows files: Capture.PNG messages: 285159 nosy: earl.maier, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Quiet Install type: behavior versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file46247/Capture.PNG _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 18:05:00 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 10 Jan 2017 23:05:00 +0000 Subject: [New-bugs-announce] [issue29233] call_method(): call _PyObject_FastCall() rather than _PyObject_VaCallFunctionObjArgs() Message-ID: <1484089500.65.0.838677833824.issue29233@psf.upfronthosting.co.za> New submission from STINNER Victor: Recently, I modified call_method() and call_maybe() of Objects/typeobject.c to avoid the creation of a temporary tuple: replace Py_VaBuildValue()+PyObject_Call() with the new _PyObject_VaCallFunctionObjArgs(). But while working on the issue #28870, I noticed that _PyObject_VaCallFunctionObjArgs() is not efficient and can be avoided. In typeobject.c, the number of arguments is hardcoded, so we don't need complex functions to compute the number of arguments and decide to allocate an array on the stack or on the heap. ---------- messages: 285165 nosy: haypo priority: normal severity: normal status: open title: call_method(): call _PyObject_FastCall() rather than _PyObject_VaCallFunctionObjArgs() _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 19:05:11 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 11 Jan 2017 00:05:11 +0000 Subject: [New-bugs-announce] [issue29234] Disable inlining of _PyStack_AsTuple() to reduce the stack consumption Message-ID: <1484093111.93.0.908854837348.issue29234@psf.upfronthosting.co.za> New submission from STINNER Victor: While working on the issue #28870, I noticed that _PyStack_AsTuple() is inlined. Compared to Python 3.5 which didn't have this function, it seems like _PyStack_AsTuple() is responsible for an increase of the stack consumption. ---------- components: Interpreter Core messages: 285168 nosy: haypo, serhiy.storchaka priority: normal severity: normal status: open title: Disable inlining of _PyStack_AsTuple() to reduce the stack consumption type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 20:13:40 2017 From: report at bugs.python.org (Thane Brimhall) Date: Wed, 11 Jan 2017 01:13:40 +0000 Subject: [New-bugs-announce] [issue29235] Allow profile/cProfile to be used as context managers Message-ID: <1484097220.43.0.363931456874.issue29235@psf.upfronthosting.co.za> New submission from Thane Brimhall: The `enable` and `disable` methods on the profilers fit the description of a context manager very well. The following code: pr = cProfile.Profile() pr.enable() # ... do something ... pr.disable() pr.print_stats() Would turn into something like this: with cProfile.Profile() as pr: # ... do something ... pr.print_stats() The patch for this code would be trivial and backwards-compatible: simply add something like the following lines to the _lsprof.Profiler base class: def __enter__(self): self.enable() return self def __exit__(self, exc_type, exc_val, exc_tb): self.disable() ---------- components: Library (Lib) messages: 285175 nosy: Thane Brimhall priority: normal severity: normal status: open title: Allow profile/cProfile to be used as context managers type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 20:17:40 2017 From: report at bugs.python.org (Maciej Piechorka) Date: Wed, 11 Jan 2017 01:17:40 +0000 Subject: [New-bugs-announce] [issue29236] 'an ASCII string of one or more PEM-encoded certificates' needs to be unicode Message-ID: <1484097460.25.0.906949156541.issue29236@psf.upfronthosting.co.za> New submission from Maciej Piechorka: In documentation it is specified that cadata parameter in load_verify_locations is 'an ASCII string of one or more PEM-encoded certificates'. However the code is actually determining it based on PyUnicode_Check function so the 'ASCII string' actually needs to be unicode object. In Python 3 it seems to be fixed by checking by PyObject_GetBuffer. ---------- assignee: docs at python components: Documentation, SSL messages: 285176 nosy: docs at python, uzytkownik priority: normal severity: normal status: open title: 'an ASCII string of one or more PEM-encoded certificates' needs to be unicode versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 20:31:34 2017 From: report at bugs.python.org (Thane Brimhall) Date: Wed, 11 Jan 2017 01:31:34 +0000 Subject: [New-bugs-announce] [issue29237] Create enum for pstats sorting options Message-ID: <1484098294.24.0.117553666266.issue29237@psf.upfronthosting.co.za> New submission from Thane Brimhall: When using the cProfile and pstats modules, I often forget which string keys are available for sorting. It would be nice to add an enum for these so a user could have their linter and IDE check that value pre-runtime. By subclassing both `str` and `Enum` this proposal would be backwards-compatible with all existing code. The patch for such a change would be trivial: 1. Add a new Sort class to the pstats module: class Sort(str, enum.Enum): calls = 'calls' # call count cumulative = 'cumulative' # cumulative time cumtime = 'cumtime' # cumulative time file = 'file' # file name filename = 'filename' # file name module = 'module' # file name ncalls = 'ncalls' # call count pcalls = 'pcalls' # primitive call count line = 'line' # line number name = 'name' # function name nfl = 'nfl' # name/file/line stdname = 'stdname' # standard name time = 'time' # internal time tottime = 'tottime' # internal time 2. Change the print_stats method signature on the profiler base and subclasses to look like this: def print_stats(self, sort: Sort=Sort.stdname): Optionally, you could build the Sort enum like below to remove redundant options and increase explicitness: class Sort(str, enum.Enum): call_count = 'calls' cumulative_time = 'cumulative' filename = 'filename' primitive_call_count = 'pcalls' line_number = 'line' function_name = 'name' name_file_line = 'nfl' standard_name = 'stdname' internal_time = 'time' ---------- components: Library (Lib) messages: 285178 nosy: Thane Brimhall priority: normal severity: normal status: open title: Create enum for pstats sorting options type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 10 22:00:31 2017 From: report at bugs.python.org (Thane Brimhall) Date: Wed, 11 Jan 2017 03:00:31 +0000 Subject: [New-bugs-announce] [issue29238] Add more kwargs to cProfile's print_stats Message-ID: <1484103631.29.0.405631580429.issue29238@psf.upfronthosting.co.za> New submission from Thane Brimhall: Using the pstats class to print off profiler results is helpful when you want to filter, order, and limit the number of returned lines. I'd rather see the most commonly-used subset of pstats functionality included in the profiler's print_stats implementation directly. # The current way pstats.Stats(profiler).strip_dirs().sort_stats('cumulative').reverse_order().print_stats(10) # Proposed way profiler.print_stats(strip_dirs=False, sort='cumulative', reverse=True, limit=10) Currently only the `sort` kwarg is available. To me this implies that some level of control was originally intended to be available in the print_stats method anyway. I also feel like the proposed API is more readable and explicit. Note that for complex situations you'd still need to use the pstats class directly, eg. substituting a different stream implementation or filtering/sorting by multiple values. This would be a backwards-compatible patch and would be implemented something like this: def print_stats(self, sort=-1, limit=None, strip_dirs=True, reverse=True): import pstats stats = pstats.Stats(self) if strip_dirs: stats = stats.strip_dirs() stats = stats.sort_stats(sort) if reverse: stats = stats.reverse_order() stats.print_stats(limit) ---------- components: Library (Lib) messages: 285183 nosy: Thane Brimhall priority: normal severity: normal status: open title: Add more kwargs to cProfile's print_stats type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 11 05:28:19 2017 From: report at bugs.python.org (Jim Fasarakis-Hilliard) Date: Wed, 11 Jan 2017 10:28:19 +0000 Subject: [New-bugs-announce] [issue29239] Fix wrong issue number in what's new entry Message-ID: <1484130499.71.0.0502378123939.issue29239@psf.upfronthosting.co.za> Changes by Jim Fasarakis-Hilliard : ---------- assignee: docs at python components: Documentation files: fix_issue.patch keywords: patch nosy: Jim Fasarakis-Hilliard, docs at python priority: normal severity: normal status: open title: Fix wrong issue number in what's new entry versions: Python 3.6 Added file: http://bugs.python.org/file46256/fix_issue.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 11 06:19:52 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 11 Jan 2017 11:19:52 +0000 Subject: [New-bugs-announce] [issue29240] Implementation of the PEP 540: Add a new UTF-8 mode Message-ID: <1484133592.17.0.263024020483.issue29240@psf.upfronthosting.co.za> New submission from STINNER Victor: This issue tracks the implementation of the PEP 540. Attached pep540_cli.py script can be used to play with it. ---------- components: Interpreter Core, Library (Lib), Unicode files: pep540_cli.py messages: 285214 nosy: ezio.melotti, haypo priority: normal pull_requests: 15 severity: normal status: open title: Implementation of the PEP 540: Add a new UTF-8 mode type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46257/pep540_cli.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 11 07:28:01 2017 From: report at bugs.python.org (JGoutin) Date: Wed, 11 Jan 2017 12:28:01 +0000 Subject: [New-bugs-announce] [issue29241] sys._enablelegacywindowsfsencoding() don't apply to os.fsencode and os.fsdecode Message-ID: <1484137681.59.0.0301192140292.issue29241@psf.upfronthosting.co.za> New submission from JGoutin: The doc say that calling "sys._enablelegacywindowsfsencoding()" is equivalent to use "PYTHONLEGACYWINDOWSFSENCODING" environment variable. In fact, this no apply to "os.fsencode" and "os.fsdecode". Example with Python 3.6 64Bits on Windows 7 64 bits : EXAMPLE CODE 1 (sys._enablelegacywindowsfsencoding()): import sys import os # Force the use of legacy encoding like versions of Python prior to 3.6. sys._enablelegacywindowsfsencoding() # Show actual file system encoding encoding = sys.getfilesystemencoding() print('File system encoding:', encoding) # os.fsencode(filename) VS filename.encode(File system encoding) print(os.fsencode('?'), '?'.encode(encoding)) >>> File system encoding: mbcs >>> b'\xc3\xa9' b'\xe9' First is encoded with "utf-8" and not "mbcs" (The actual File system encoding) EXAMPLE CODE 2 (PYTHONLEGACYWINDOWSFSENCODING): import sys import os # Force the use of legacy encoding like versions of Python prior to 3.6. # "PYTHONLEGACYWINDOWSFSENCODING" environment variable set before running Python. # Show actual file system encoding encoding = sys.getfilesystemencoding() print('File system encoding:', encoding) # os.fsencode(filename) VS filename.encode(File system encoding) print(os.fsencode('?'), '?'.encode(encoding)) >>> File system encoding: mbcs >>> b'\xe9' b'\xe9' Everything encoded with "mbcs" (The actual File system encoding) In "os.fsencode" and "os.fsdecode" encoding and errors are cached on start and never updated by "sys._enablelegacywindowsfsencoding()" after. ---------- components: Windows messages: 285220 nosy: JGoutin, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: sys._enablelegacywindowsfsencoding() don't apply to os.fsencode and os.fsdecode type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 11 10:03:16 2017 From: report at bugs.python.org (Dingyuan Wang) Date: Wed, 11 Jan 2017 15:03:16 +0000 Subject: [New-bugs-announce] [issue29242] Crash on GC when compiling PyPy Message-ID: <1484146996.34.0.185188210895.issue29242@psf.upfronthosting.co.za> New submission from Dingyuan Wang: When compiling the PyPy default branch [1] on a Debian testing machine with Python 2.7.13, cpython randomly crashes. (gdb) bt #0 update_refs () at ../Modules/gcmodule.c:332 #1 collect.lto_priv () at ../Modules/gcmodule.c:924 #2 0x000055555562a804 in collect_generations () at ../Modules/gcmodule.c:1050 #3 _PyObject_GC_Malloc () at ../Modules/gcmodule.c:1511 #4 0x0000555555640ef5 in PyType_GenericAlloc (nitems=0, type=0x555555a9dd20 <_PyExc_AttributeError>) at ../Objects/typeobject.c:781 #5 BaseException_new.lto_priv.68 () at ../Objects/exceptions.c:34 #6 0x0000555555642093 in type_call.lto_priv () at ../Objects/typeobject.c:749 #7 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #8 0x000055555565a490 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4221 #9 0x00005555556695d0 in PyErr_NormalizeException () at ../Python/errors.c:192 #10 0x0000555555656cad in PyEval_EvalFrameEx () at ../Python/ceval.c:3251 #11 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #12 0x000055555566ac2e in function_call.lto_priv () at ../Objects/funcobject.c:523 #13 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #14 0x000055555568102e in instancemethod_call.lto_priv () at ../Objects/classobject.c:2602 #15 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #16 0x00005555556f333a in call_method.lto_priv () at ../Objects/typeobject.c:1283 #17 0x000055555573eb8f in slot_tp_setattro.lto_priv () at ../Objects/typeobject.c:5654 #18 0x00005555556667e9 in PyObject_SetAttr () at ../Objects/object.c:1247 #19 0x0000555555650ec3 in PyEval_EvalFrameEx () at ../Python/ceval.c:2253 #20 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #21 0x000055555566ac2e in function_call.lto_priv () at ../Objects/funcobject.c:523 #22 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #23 0x000055555568102e in instancemethod_call.lto_priv () at ../Objects/classobject.c:2602 #24 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #25 0x000055555565a4dd in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4221 #26 0x00005555556f3e31 in slot_tp_hash.lto_priv () at ../Objects/typeobject.c:5506 #27 0x000055555568c908 in dict_subscript.lto_priv () at ../Objects/dictobject.c:1202 #28 0x000055555565618e in PyEval_EvalFrameEx () at ../Python/ceval.c:1539 #29 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #30 0x000055555566ac2e in function_call.lto_priv () at ../Objects/funcobject.c:523 #31 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #32 0x000055555568102e in instancemethod_call.lto_priv () at ../Objects/classobject.c:2602 #33 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #34 0x000055555565a490 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4221 #35 0x000055555569ff3a in instance_subscript.lto_priv () at ../Objects/classobject.c:1105 #36 0x000055555565618e in PyEval_EvalFrameEx () at ../Python/ceval.c:1539 #37 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #38 0x000055555566ac2e in function_call.lto_priv () at ../Objects/funcobject.c:523 #39 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #40 0x0000555555672dd9 in slot_tp_new.lto_priv () at ../Objects/typeobject.c:5849 #41 0x0000555555642093 in type_call.lto_priv () at ../Objects/typeobject.c:749 #42 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #43 0x0000555555655e8f in do_call (nk=, na=1, pp_stack=0x7fffffffb950, func=) at ../Python/ceval.c:4569 #44 call_function (oparg=, pp_stack=0x7fffffffb950) at ../Python/ceval.c:4374 #45 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #46 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffbaa0, func=) at ../Python/ceval.c:4437 #47 call_function (oparg=, pp_stack=0x7fffffffbaa0) at ../Python/ceval.c:4372 #48 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #49 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffbbf0, func=) at ../Python/ceval.c:4437 #50 call_function (oparg=, pp_stack=0x7fffffffbbf0) at ../Python/ceval.c:4372 #51 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #52 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffbd40, func=) at ../Python/ceval.c:4437 ---Type to continue, or q to quit--- #53 call_function (oparg=, pp_stack=0x7fffffffbd40) at ../Python/ceval.c:4372 #54 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #55 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffbe90, func=) at ../Python/ceval.c:4437 #56 call_function (oparg=, pp_stack=0x7fffffffbe90) at ../Python/ceval.c:4372 #57 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #58 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffbfe0, func=) at ../Python/ceval.c:4437 #59 call_function (oparg=, pp_stack=0x7fffffffbfe0) at ../Python/ceval.c:4372 #60 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #61 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffc130, func=) at ../Python/ceval.c:4437 #62 call_function (oparg=, pp_stack=0x7fffffffc130) at ../Python/ceval.c:4372 #63 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #64 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffc280, func=) at ../Python/ceval.c:4437 #65 call_function (oparg=, pp_stack=0x7fffffffc280) at ../Python/ceval.c:4372 #66 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #67 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #68 0x000055555565676e in fast_function (nk=0, na=, n=, pp_stack=0x7fffffffc490, func=) at ../Python/ceval.c:4447 #69 call_function (oparg=, pp_stack=0x7fffffffc490) at ../Python/ceval.c:4372 #70 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #71 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffc5e0, func=) at ../Python/ceval.c:4437 #72 call_function (oparg=, pp_stack=0x7fffffffc5e0) at ../Python/ceval.c:4372 #73 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #74 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffc730, func=) at ../Python/ceval.c:4437 #75 call_function (oparg=, pp_stack=0x7fffffffc730) at ../Python/ceval.c:4372 #76 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #77 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffc880, func=) at ../Python/ceval.c:4437 #78 call_function (oparg=, pp_stack=0x7fffffffc880) at ../Python/ceval.c:4372 #79 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #80 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffc9d0, func=) at ../Python/ceval.c:4437 #81 call_function (oparg=, pp_stack=0x7fffffffc9d0) at ../Python/ceval.c:4372 #82 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #83 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffcb20, func=) at ../Python/ceval.c:4437 #84 call_function (oparg=, pp_stack=0x7fffffffcb20) at ../Python/ceval.c:4372 #85 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #86 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffcc70, func=) at ../Python/ceval.c:4437 #87 call_function (oparg=, pp_stack=0x7fffffffcc70) at ../Python/ceval.c:4372 #88 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #89 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffcdc0, func=) at ../Python/ceval.c:4437 #90 call_function (oparg=, pp_stack=0x7fffffffcdc0) at ../Python/ceval.c:4372 #91 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #92 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #93 0x0000555555655f78 in fast_function (nk=1, na=, n=, pp_stack=0x7fffffffcfd0, func=) at ../Python/ceval.c:4447 #94 call_function (oparg=, pp_stack=0x7fffffffcfd0) at ../Python/ceval.c:4372 #95 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #96 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffd120, func=) at ../Python/ceval.c:4437 #97 call_function (oparg=, pp_stack=0x7fffffffd120) at ../Python/ceval.c:4372 #98 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #99 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #100 0x000055555566ade8 in function_call.lto_priv () at ../Objects/funcobject.c:523 #101 0x000055555563c5f3 in PyObject_Call () at ../Objects/abstract.c:2547 #102 0x00005555556531a5 in ext_do_call (nk=0, na=3, flags=, pp_stack=0x7fffffffd3d8, func=) at ../Python/ceval.c:4666 #103 PyEval_EvalFrameEx () at ../Python/ceval.c:3028 #104 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #105 0x000055555565676e in fast_function (nk=1, na=, n=, pp_stack=0x7fffffffd5e0, func=) at ../Python/ceval.c:4447 ---Type to continue, or q to quit--- #106 call_function (oparg=, pp_stack=0x7fffffffd5e0) at ../Python/ceval.c:4372 #107 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #108 0x0000555555655c7f in fast_function (nk=, na=, n=, pp_stack=0x7fffffffd730, func=) at ../Python/ceval.c:4437 #109 call_function (oparg=, pp_stack=0x7fffffffd730) at ../Python/ceval.c:4372 #110 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #111 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #112 0x000055555565676e in fast_function (nk=0, na=, n=, pp_stack=0x7fffffffd940, func=) at ../Python/ceval.c:4447 #113 call_function (oparg=, pp_stack=0x7fffffffd940) at ../Python/ceval.c:4372 #114 PyEval_EvalFrameEx () at ../Python/ceval.c:2989 #115 0x000055555564e525 in PyEval_EvalCodeEx () at ../Python/ceval.c:3584 #116 0x000055555564e2c9 in PyEval_EvalCode (co=, globals=, locals=) at ../Python/ceval.c:669 #117 0x000055555567de7f in run_mod.lto_priv () at ../Python/pythonrun.c:1376 #118 0x0000555555678e52 in PyRun_FileExFlags () at ../Python/pythonrun.c:1362 #119 0x000055555567899e in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:948 #120 0x0000555555629b81 in Py_Main () at ../Modules/main.c:640 #121 0x00007ffff6f1a2b1 in __libc_start_main (main=0x5555556294b0
, argc=4, argv=0x7fffffffdd88, init=, fini=, rtld_fini=, stack_end=0x7fffffffdd78) at ../csu/libc-start.c:291 #122 0x00005555556293aa in _start () [1] https://bitbucket.org/pypy/pypy/commits/c501282f4438fe2675e6bfd9cc38374fa55d3da0 ---------- components: Interpreter Core messages: 285228 nosy: gumblex priority: normal severity: normal status: open title: Crash on GC when compiling PyPy type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 11 11:15:14 2017 From: report at bugs.python.org (Xiang Zhang) Date: Wed, 11 Jan 2017 16:15:14 +0000 Subject: [New-bugs-announce] [issue29243] --enable-optimizations makes common build commands always need to compile from scratch Message-ID: <1484151314.82.0.308427338149.issue29243@psf.upfronthosting.co.za> New submission from Xiang Zhang: In 3.6 we get --enable-optimizations. One thing I find annoyed with this flag is that it makes some build commands compile from scratch since it always clears the environment first. For example, with the commands listed at the top of Makefile: ./configure make make test make install It compiles 3 times and considering the optimized build needs more time every time, it lasts long. I am not sure this is a problem and feel free to close it. ---------- components: Build messages: 285233 nosy: xiang.zhang priority: normal severity: normal status: open title: --enable-optimizations makes common build commands always need to compile from scratch versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 11 13:11:47 2017 From: report at bugs.python.org (rdb) Date: Wed, 11 Jan 2017 18:11:47 +0000 Subject: [New-bugs-announce] [issue29244] Python 3.6 unnecessarily requires inttypes.h Message-ID: <1484158307.25.0.0951457804811.issue29244@psf.upfronthosting.co.za> New submission from rdb: Python 3.6 now requires inttypes.h on all platforms. However, this is not provided by MSVC 2010 and 2012, which is still used by some people who build extension modules for Python. MSVC 2010 does provide stdint.h, and replacing the inttypes.h include with an include to stdint.h seems to work fine. I would suggest a fix along the lines of this: #if defined(_MSC_VER) && _MSC_VER < 1800 #include #else #include #endif Alternatively, the HAVE_INTTYPES_H definition could be used to fall back to stdint.h, and it could be undefined for the MSVC build. ---------- components: Extension Modules messages: 285250 nosy: rdb priority: normal severity: normal status: open title: Python 3.6 unnecessarily requires inttypes.h versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 11 14:44:31 2017 From: report at bugs.python.org (Kevin Bonham) Date: Wed, 11 Jan 2017 19:44:31 +0000 Subject: [New-bugs-announce] [issue29245] Can't write to NamedTemporaryFile Message-ID: <1484163871.38.0.591576246688.issue29245@psf.upfronthosting.co.za> New submission from Kevin Bonham: Python 3.6.0 (default, Dec 24 2016, 08:01:42) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from tempfile import NamedTemporaryFile >>> tmp = NamedTemporaryFile() >>> tmp.write("hello world!") Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tempfile.py", line 483, in func_wrapper return func(*args, **kwargs) TypeError: a bytes-like object is required, not 'str' >>> type(tmp) The more verbose error points to issue #18879 (http://bugs.python.org/issue18879), which seems very similar to my problem, but is marked as resolved. --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 tmp_file.write("blah") /usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tempfile.py in func_wrapper(*args, **kwargs) 481 @_functools.wraps(func) 482 def func_wrapper(*args, **kwargs): --> 483 return func(*args, **kwargs) 484 # Avoid closing the file as long as the wrapper is alive, 485 # see issue #18879. TypeError: a bytes-like object is required, not 'str' This also seems like it might be related to http://bugs.python.org/issue28867, though I'm getting the same behavior with TemporaryFile: >>> from tempfile import TemporaryFile >>> tmp2 = TemporaryFile() >>> tmp2.write("Hello World") Traceback (most recent call last): File "", line 1, in TypeError: a bytes-like object is required, not 'str' I can do: >>> with open(tmp.name, "w") as t: ... t.write("Hello world!") Is this intended behavior? The docs still say that these functions should return file-like objects. ---------- components: Library (Lib) messages: 285266 nosy: Kevin Bonham priority: normal severity: normal status: open title: Can't write to NamedTemporaryFile type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 11 18:03:00 2017 From: report at bugs.python.org (Spiro Sideris) Date: Wed, 11 Jan 2017 23:03:00 +0000 Subject: [New-bugs-announce] [issue29246] typing.Union raises RecursionError when comparing Union to other type Message-ID: <1484175780.67.0.919413735976.issue29246@psf.upfronthosting.co.za> New submission from Spiro Sideris: The typing.Union module raises a RecursionError when comparing a Union with no additional tree_args to a type that is not a Union. An example of the stack trace with the added test looks like the following: 0:00:00 [1/1] test_typing test test_typing failed -- Traceback (most recent call last): File "/Users/spiro/Development/open_source/cpython/Lib/test/test_typing.py", line 221, in test_union_compare_other self.assertNotEqual(Union, object) File "/Users/spiro/Development/open_source/cpython/Lib/unittest/case.py", line 827, in assertNotEqual if not first != second: File "/Users/spiro/Development/open_source/cpython/Lib/typing.py", line 760, in __eq__ return self._subs_tree() == other#return self._subs_tree() is not self and self._subs_tree() == other File "/Users/spiro/Development/open_source/cpython/Lib/typing.py", line 760, in __eq__ return self._subs_tree() == other#return self._subs_tree() is not self and self._subs_tree() == other File "/Users/spiro/Development/open_source/cpython/Lib/typing.py", line 760, in __eq__ return self._subs_tree() == other#return self._subs_tree() is not self and self._subs_tree() == other [Previous line repeated 233 more times] File "/Users/spiro/Development/open_source/cpython/Lib/typing.py", line 759, in __eq__ if not isinstance(other, _Union): RecursionError: maximum recursion depth exceeded in __instancecheck__ test_typing failed 1 test failed: test_typing Total duration: 316 ms Tests result: FAILURE The test compares a Union with no tree_args to another type. ---------- components: Library (Lib) files: spirowork.patch keywords: patch messages: 285279 nosy: spiside priority: normal severity: normal status: open title: typing.Union raises RecursionError when comparing Union to other type type: crash versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46264/spirowork.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 11 23:23:54 2017 From: report at bugs.python.org (Nathaniel Smith) Date: Thu, 12 Jan 2017 04:23:54 +0000 Subject: [New-bugs-announce] [issue29247] Document return value of epoll.poll Message-ID: <1484195034.62.0.718564451527.issue29247@psf.upfronthosting.co.za> New submission from Nathaniel Smith: The documentation for select.epoll.poll doesn't document the return value at all, which is somewhat important information :-) I think it's a list of (fd, eventmask) tuples? https://docs.python.org/3.7/library/select.html#select.epoll.poll ---------- assignee: docs at python components: Documentation messages: 285285 nosy: docs at python, njs priority: normal severity: normal status: open title: Document return value of epoll.poll versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 03:09:20 2017 From: report at bugs.python.org (Eryk Sun) Date: Thu, 12 Jan 2017 08:09:20 +0000 Subject: [New-bugs-announce] [issue29248] os.readlink fails on Windows Message-ID: <1484208560.98.0.375529555783.issue29248@psf.upfronthosting.co.za> New submission from Eryk Sun: win_readlink in Modules/posixmodule.c mistakenly treats the PrintNameOffset field of the reparse data buffer as a number of characters instead of bytes. Thus, if the offset is non-zero, the value returned is incorrect stack garbage. For example, the following should return "C:\\ProgramData": >>> os.readlink(r'C:\Users\All Users') '\u6c20\u3012\u041f\x01\u2768\u60b2\u031b\x02\x05\x00\u031e\x06\u8c01\u4012' Craig Holmquist found this bug, as detailed in message 277385. He included a fix in the patch for issue 23407, but this should be addressed in the next maintenance release of 3.5 and 3.6. ---------- components: Library (Lib), Windows messages: 285294 nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: os.readlink fails on Windows type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 05:19:54 2017 From: report at bugs.python.org (Jon Walsh) Date: Thu, 12 Jan 2017 10:19:54 +0000 Subject: [New-bugs-announce] [issue29249] Pathlib glob ** bug Message-ID: <1484216394.04.0.57434547579.issue29249@psf.upfronthosting.co.za> New submission from Jon Walsh: >>> from pathlib import Path >>> Path("a/b/c/d/e.txt").match('a/*/**/*') False ---------- components: Library (Lib) messages: 285297 nosy: Jon Walsh priority: normal severity: normal status: open title: Pathlib glob ** bug type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 05:42:45 2017 From: report at bugs.python.org (Eryk Sun) Date: Thu, 12 Jan 2017 10:42:45 +0000 Subject: [New-bugs-announce] [issue29250] islink and stat follow_symlinks are inconsistent on Windows Message-ID: <1484217765.9.0.444376233166.issue29250@psf.upfronthosting.co.za> New submission from Eryk Sun: win32_xstat_impl in Modules/posixmodule.c doesn't check the value of reparse_tag to limit traversal to only tags that are considered links. So we have cases in which os.path.islink returns False (e.g. junctions, pending the resolution of issue 23407), but os.stat and os.lstat disagree. For example: >>> os.path.islink(r'C:\Documents and Settings') False >>> s = os.stat(r'C:\Documents and Settings') >>> ls = os.lstat(r'C:\Documents and Settings') >>> s.st_ino == ls.st_ino False At its strictest, traversal would be limited to just symbolic links. It could be relaxed to also include junctions, and even further to include all tags with the name surrogate bit set [1]. This includes the following Microsoft tags IO_REPARSE_TAG_MOUNT_POINT (junctions) IO_REPARSE_TAG_SYMLINK IO_REPARSE_TAG_IIS_CACHE and non-Microsoft tags: IO_REPARSE_TAG_SOLUTIONSOFT IO_REPARSE_TAG_OSR_SAMPLE IO_REPARSE_TAG_QI_TECH_HSM IO_REPARSE_TAG_MAXISCALE_HSM I'm creating this issue as an enhancement for 3.7. The problem has existed for a long time, but it hasn't been a thorn in anyone's side as far as I know. [1]: https://msdn.microsoft.com/en-us/library/aa365511 ---------- components: Library (Lib), Windows messages: 285299 nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: islink and stat follow_symlinks are inconsistent on Windows type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 07:04:20 2017 From: report at bugs.python.org (Martin Panter) Date: Thu, 12 Jan 2017 12:04:20 +0000 Subject: [New-bugs-announce] [issue29251] Class __dict__ is only a mapping proxy Message-ID: <1484222660.7.0.65822313324.issue29251@psf.upfronthosting.co.za> New submission from Martin Panter: The __dict__ attribute of class objects is documented as being a (standard) dictionary, but implemented with a proxy object. I propose to clarify the documentation in ?Custom classes? under , and in . I believe my changes are also applicable to Python 2, as long as I point out the proxy is specific to ?new-style? classes. ---------- assignee: docs at python components: Documentation files: class-dict.patch keywords: patch messages: 285313 nosy: docs at python, martin.panter priority: normal severity: normal stage: patch review status: open title: Class __dict__ is only a mapping proxy type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46268/class-dict.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 07:27:27 2017 From: report at bugs.python.org (Decorater) Date: Thu, 12 Jan 2017 12:27:27 +0000 Subject: [New-bugs-announce] [issue29252] self in classes missinterpreted as a string. Message-ID: <1484224047.15.0.809127294576.issue29252@psf.upfronthosting.co.za> New submission from Decorater: So, I have a class (it subclasses the zipimporter for my import hook) that allows me to not worry about issues when the hook is appended to the beginning of the path hooks. The code to the class as follows: class OriginalZipImport(zipimport.zipimporter): """ Original zipimporter class. Modified for requirements of this import hook. """ # Sadly I have to manually specify the file extensions the original # zipimporter supports to bypass an AttributeError. # according to https://docs.python.org/3.6/library/zipimport.html # zipimport only allows importing ``.py`` and ``.pyc`` files from zips. extensions = ['.py', '.pyc'] def __init__(self, archivepath): super(OriginalZipImport, self.inst).__init__(self, archivepath) def find_loader(self, fullname, path=None): """ Original find_loader. """ self.inst.find_loader(fullname, path=path) def find_module(self, fullname, path=None): """ Original find_module. """ self.inst.find_module(self, fullname, path=path) def load_module(self, fullname): """ Original load_module. """ self.inst.load_module(self, fullname) However instead of working like the way I would expect it gives this traceback: Traceback (most recent call last): File "E:\Users\Elsword\Desktop\DecoraterBot\Async\\zipmaker\make_zip.py", line 11, in from pathlib import Path File "", line 961, in _find_and_load File "", line 946, in _find_and_load_unlocked File "", line 885, in _find_spec File "", line 1157, in find_spec File "", line 1129, in _get_spec File "", line 1273, in find_spec File "", line 1229, in _get_spec File "E:\Users\Elsword\Desktop\DecoraterBot\Async\zipmaker\py2pycx\_pycx_backend.py", line 180, in find_loader self.inst.find_loader(fullname, path=path) AttributeError: 'str' object has no attribute 'inst' Note: it does use a slightly modified make_zip.py that is different than the one that is on the python source trees. It is specifically for testing the hook to see if it works or not. The hook is supposed to work however it is confusing why it is doing this as I did not set self to be an string so it should allow me to do all of this just fine. ---------- components: Interpreter Core messages: 285316 nosy: Decorater priority: normal severity: normal status: open title: self in classes missinterpreted as a string. versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 08:51:51 2017 From: report at bugs.python.org (Erik Bray) Date: Thu, 12 Jan 2017 13:51:51 +0000 Subject: [New-bugs-announce] [issue29253] Fix test_asyncore tests on Cygwin Message-ID: <1484229111.27.0.864294562114.issue29253@psf.upfronthosting.co.za> New submission from Erik Bray: This patch works around a couple different problems with running the test_asyncore tests in Cygwin, both of which are due to bugs in Cygwin itself and not in Python. As such, I don't think Python should try to work around these issues in general, but I do think they're worth at least working around in the tests so that they can pass and/or skip. The first issue is more severe, as it actually causes the test run to hang indefinitely due to a bug in Cygwin that can cause connect() on a socket to block indefinitely. This occurs only in a situation where a "client" connects to a "server" that is not accept()-ing connections--a situation that occurs specifically in some of the asyncore tests where both the "client" and the "server" are in the same test process. This applies a known workaround to the tests only, allowing them to pass. The other bug simply causes a test failure--the bug is that getsockopt(SO_REUSEADDR) returns the wrong result after a setsockopt(SO_REUSEADDR) (the latter has the correct behavior; the value of the option just isn't reported back correctly after being set). In this case the relevant test is simply skipped on Cygwin. The patch is currently light on in-line documentation of the situation, but I can add that if it's otherwise approved. ---------- components: Tests files: 0001-Fix-test_asyncore-tests-on-Cygwin-by-working-around-.patch keywords: patch messages: 285326 nosy: erik.bray, zach.ware priority: normal severity: normal stage: patch review status: open title: Fix test_asyncore tests on Cygwin Added file: http://bugs.python.org/file46272/0001-Fix-test_asyncore-tests-on-Cygwin-by-working-around-.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 11:42:13 2017 From: report at bugs.python.org (Suraj Kumar) Date: Thu, 12 Jan 2017 16:42:13 +0000 Subject: [New-bugs-announce] [issue29254] Documentation Error Message-ID: <1484239333.41.0.299474192201.issue29254@psf.upfronthosting.co.za> New submission from Suraj Kumar: Hi, I have found one documentation mistake in section 3.1.2. Strings saying """Note how the start is always included, and the end always excluded. This makes sure that s[:i] + s[i:] is always equal to s: >>>word = 'Python' >>> word[:2] + word[2:] 'Python' """ I think instead of 'the end always excluded' it should be 'the end always included'. If my observation is correct, please do the needful change. Thanks & Regards, Suraj ---------- assignee: docs at python components: Documentation messages: 285331 nosy: Suraj Kumar, docs at python priority: normal severity: normal status: open title: Documentation Error type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 18:35:07 2017 From: report at bugs.python.org (Nathaniel Smith) Date: Thu, 12 Jan 2017 23:35:07 +0000 Subject: [New-bugs-announce] [issue29255] selects.KqueueSelector behaves incorrectly when no fds are registered Message-ID: <1484264107.13.0.0489042381572.issue29255@psf.upfronthosting.co.za> New submission from Nathaniel Smith: When calling kevent(), selectors.KqueueSelector.select sets the "maxevents" argument to len(self._fd_to_key). So if there are no fds registered, it passes maxevents=0. It turns out that the kevent() API has a special case behavior for maxevents=0: it returns immediately, ignoring timeout. I have no idea why kevent() works this way, but it's specifically called out in the man page: The nevents argument determines the size of eventlist. When nevents is zero, kevent() will return immediately even if there is a timeout specified unlike select(2). https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2 It happens that asyncio doesn't run into this because asyncio always has at least one fd registered with its selector, but this causes problems for other users of the selectors module, e.g.: https://github.com/dabeaz/curio/issues/156 I believe fix would just be to add some code like: "if max_ev == 0: max_ev = 1" to selectors.KqueueSelector.select. ---------- components: Library (Lib) messages: 285352 nosy: njs priority: normal severity: normal status: open title: selects.KqueueSelector behaves incorrectly when no fds are registered versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 18:42:18 2017 From: report at bugs.python.org (Nathaniel Smith) Date: Thu, 12 Jan 2017 23:42:18 +0000 Subject: [New-bugs-announce] [issue29256] Windows select() errors out when given no fds to select on, which breaks SelectSelector Message-ID: <1484264538.85.0.902649207203.issue29256@psf.upfronthosting.co.za> New submission from Nathaniel Smith: If SelectSelector.select() is called when there are no fds registered, then it ends up calling select.select([], [], [], timeout). On sensible operating systems, this is equivalent to time.sleep(timeout). On Windows, it raises an error. Asyncio manages to avoid hitting this due to the fact that it always has at least one fd registered, but it causes problems for other users of the selectors module, e.g.: https://github.com/dabeaz/curio/issues/75 I see two possible approaches to fixing this: 1) Modify SelectSelector to check for this case and call time.sleep() instead of select.select() when encountered. 2) Modify the select.select() wrapper so that it behaves consistently on all operating systems, by special-casing this situation on Windows. Option (2) seems nicer to me. ---------- components: Library (Lib) messages: 285353 nosy: njs priority: normal severity: normal status: open title: Windows select() errors out when given no fds to select on, which breaks SelectSelector versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 19:48:36 2017 From: report at bugs.python.org (Gerald Britton) Date: Fri, 13 Jan 2017 00:48:36 +0000 Subject: [New-bugs-announce] [issue29257] Possible error in discussion of Abstract Base Classes and abstract properties Message-ID: <1484268516.3.0.750896526181.issue29257@psf.upfronthosting.co.za> New submission from Gerald Britton: I was rereading the 2.7 docs about abstract base classes the other day. I found this: "This defines a read-only property; you can also define a read-write abstract property using the ?long? form of property declaration:" along with an example. so I copied the example and put in a little surrounding code: from abc import ABCMeta, abstractproperty class C: __metaclass__ = ABCMeta def getx(self): pass def setx(self, value): pass x = abstractproperty(getx, setx) class D(C): @property def x(self):self._x d = D() print(d) When I ran this, I expected an exception, since I defined a read/write abstract property but only implemented the read operation. However, the example runs fine. That is the class D can be instantiated without error. Of course I cannot set the property since I didn't implement that part. Now, If I don't implement the property at all, I can' instantiate the class. I get: "TypeError: Can't instantiate abstract class D with abstract methods x" which is what I would expect. What I don't understand is why I don't get a similar error when I implement the read operation for the property but not the write operation. If this actually doesn't work (catching the non-implementation at instantiation time), then why is it documented this way? To me at least the doc implies that it *will* raise on the missing write property implementation. If ABCs are working as intended, can the documentation be changed to reflect that as per my experience above? If the documentation is correct, can the ABC implementation be modified to function that way? ---------- assignee: docs at python components: Documentation messages: 285356 nosy: docs at python, gbritton priority: normal severity: normal status: open title: Possible error in discussion of Abstract Base Classes and abstract properties versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 12 23:47:54 2017 From: report at bugs.python.org (Anthony Sottile) Date: Fri, 13 Jan 2017 04:47:54 +0000 Subject: [New-bugs-announce] [issue29258] __init__.py required for pkgutil.walk_packages in python3 Message-ID: <1484282874.75.0.69511180509.issue29258@psf.upfronthosting.co.za> New submission from Anthony Sottile: PEP420 makes __init__.py files optional: https://docs.python.org/3/whatsnew/3.3.html#pep-420-implicit-namespace-packages Though it seems without them, pkgutil.walk_packages does not function as desired: https://docs.python.org/3/library/pkgutil.html#pkgutil.walk_packages Consider the following example: ``` $ tree foo foo ??? bar ? ??? baz.py ? ??? __init__.py ??? __init__.py ??? womp.py ``` And a test script # test.py ``` import pkgutil import foo for _, mod, _ in pkgutil.walk_packages(foo.__path__, foo.__name__ + '.'): print(mod) ``` In both python2 and python3 I get the following output: ``` $ python2.7 test.py foo.bar foo.bar.baz foo.womp $ python3.5 test.py foo.bar foo.bar.baz foo.womp ``` Removing the __init__.py files and only using python3, I get this: ``` $ find -name '__init__.*' -delete $ python3.5 test.py foo.bar ``` The modules are definitely importable: ``` $ python3.5 -c 'import foo.bar.baz' $ ``` Originally asked as a question on stackoverflow: http://stackoverflow.com/questions/41203765/init-py-required-for-pkgutil-walk-packages-in-python3 ---------- components: Library (Lib) messages: 285361 nosy: Anthony Sottile priority: normal severity: normal status: open title: __init__.py required for pkgutil.walk_packages in python3 type: behavior versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 07:24:34 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 13 Jan 2017 12:24:34 +0000 Subject: [New-bugs-announce] [issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects Message-ID: <1484310274.99.0.832491900546.issue29259@psf.upfronthosting.co.za> New submission from STINNER Victor: A new FASTCALL calling convention was added to Python 3.6. It allows to avoid the creation of a temporary tuple to pass positional arguments and a temporary dictionary to pass keyword arguments. A new METH_FASTCALL calling convention was added for C functions. Most functions now support fastcall, except objects with a __call__() method which have to go through slot_tp_call() which still requires a tuple and dictionary. I tried multiple implementations to support fast calls to call the __call__() method, but I had practical and technical issues. First, I tried to reuse the tp_call field to PyTypeObject: it can be a regular call (tuple/dict for arguments) or a fast call. I added a flag to the tp_flags field. It was tricky to support class inheritance, decide to set or clear the flag. But the real blocker issue is fAthat it is obviously breaks the backward compatibility: existing code calling directly tp_call with the regular calling convention will crash immediatly, and the error is not catched during compilation, even if the code is recompiled. I propose a different design: add a new tp_fastcall field to PyTypeObject and use a wrapper for tp_call when tp_fastcall is defined. If a type defines tp_fastcall but not, the tp_call wrapper "simply" calls tp_fastcall. Advantages: * The wrapper is trivial * Minor changes to PyType_Ready() to support inheritance (simple logic) * Fully backward compatible * If tp_call is called directly without keyword arguments, there is no overhead but a speedup! Inheritance: * If a type only defines tp_call, tp_fastcall is not inherited from the parent: tp_fastcall is set to NULL. * If a type only defines tp_fastcall: tp_fastcall is always use (tp_call uses the wrapper) * If a type defines tp_call and tp_fastcall, PyObject_Call() uses tp_call whereas _PyObject_FastCallDict() uses tp_fastcall. Functions of the C API will be modified to use tp_fastcall if available. The plan is then to patch most Python types to replace their tp_call with tp_fastcall. First, most important (common) types like Python and C functions, descriptors, and the various kinds of wrappers should be patched. Later, we should maybe discuss on a case by case basis to decide if it's worth it. I will try to run benchmark before any kind. ---------- messages: 285388 nosy: haypo, inada.naoki, serhiy.storchaka priority: normal pull_requests: 17 severity: normal status: open title: Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 09:31:05 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 13 Jan 2017 14:31:05 +0000 Subject: [New-bugs-announce] [issue29260] Use designated initializers to define PyTypeObject types Message-ID: <1484317865.58.0.725398845848.issue29260@psf.upfronthosting.co.za> New submission from STINNER Victor: Currently, PyTypeObject fields are set in order in the C code. Typical example: PyTypeObject PyMethod_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "method", sizeof(PyMethodObject), 0, (destructor)method_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ (reprfunc)method_repr, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)method_hash, /* tp_hash */ method_call, /* tp_call */ 0, /* tp_str */ method_getattro, /* tp_getattro */ PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ method_doc, /* tp_doc */ (traverseproc)method_traverse, /* tp_traverse */ 0, /* tp_clear */ method_richcompare, /* tp_richcompare */ offsetof(PyMethodObject, im_weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ method_methods, /* tp_methods */ method_memberlist, /* tp_members */ method_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ method_descr_get, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ method_new, /* tp_new */ }; The aligned comment is an old practice required to be able to see to which field correspond a line. This syntax usually produces a lot of zeros. The C standard (C99?) allows to use a more readable syntax: PyTypeObject PyMethod_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) .tp_name = "method", .tp_basicsize = sizeof(PyMethodObject), .tp_dealloc = (destructor)method_dealloc, .tp_repr = (reprfunc)method_repr, .tp_hash = (hashfunc)method_hash, .tp_call = method_call, .tp_getattro = method_getattro, ... }; It seems like it's possible to start with positional fields and then switch to named fields, so PyVarObject_HEAD_INIT() still works. Maybe maybe PyVarObject_HEAD_INIT() should also evolve? Or maybe we need a new macro using the ".tp_xxx=...," syntax? INADA Naoki proposed to use this syntax in my pull request which adds a new tp_fastcall field which requires to add many zeros: https://github.com/python/cpython/pull/65#pullrequestreview-16566423 Example of change: @@ -370,6 +370,17 @@ PyTypeObject PyMethod_Type = { 0, /* tp_init */ 0, /* tp_alloc */ method_new, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + 0, /* tp_del */ + 0, /* tp_version_tag */ + 0, /* tp_finalize */ + (fastternaryfunc)method_fastcall, /* tp_fastcall */ }; ---------- messages: 285399 nosy: haypo, inada.naoki priority: normal severity: normal status: open title: Use designated initializers to define PyTypeObject types versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 10:06:25 2017 From: report at bugs.python.org (Dave Jones) Date: Fri, 13 Jan 2017 15:06:25 +0000 Subject: [New-bugs-announce] [issue29261] Missing venv/scripts/common after "make install" Message-ID: <1484319985.48.0.948212892156.issue29261@psf.upfronthosting.co.za> New submission from Dave Jones: While attempting to diagnose something (unrelated to this issue) under python 3.6, I used the following steps to clone and build a non-root python installation: $ mkdir py36 $ hg clone https://hg.python.org/cpython $ cd cpython $ hg update 3.6 $ ./configure --prefix=/home/pi/py36 $ make $ make install Afterwards I attempted to set up a venv for further testing: $ /home/pi/py36/bin/python3 -m venv py36env This succeeded but, unfortunately, activating the venv proved impossible as the "activate" script was missing from its "bin" sub-dir. After a bit of investigation it appears that "make install" had copied "Lib/venv/scripts/posix" but not "Lib/venv/scripts/common" into the installation, hence the templates for "activate.csh" and "activate.fish" are present, but not the "activate" template. I had a search around for related issues but only found #22343 which explains why "activate" is no longer present (because it's moved from scripts/posix/ to scripts/common/) but I don't think is responsible for common not getting copied by "make install". It appears adding "venv/scripts/common" to LIBSUBDIRS in Makefile.pre.in fixes the issue (as in the attached patch) but I've no idea if this covers all necessary platforms (I'd guess Windows doesn't use the Makefile if #22343 fixed things for it?). ---------- components: Installation files: missing_venv_common.diff keywords: patch messages: 285403 nosy: Dave Jones priority: normal severity: normal status: open title: Missing venv/scripts/common after "make install" type: behavior versions: Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46280/missing_venv_common.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 10:45:47 2017 From: report at bugs.python.org (flying sheep) Date: Fri, 13 Jan 2017 15:45:47 +0000 Subject: [New-bugs-announce] [issue29262] Provide a way to check for *real* typing.Union instances Message-ID: <1484322347.31.0.5780880295.issue29262@psf.upfronthosting.co.za> New submission from flying sheep: typing.Union prevents the use of `isinstance` and `issubclass` via a hook. This is presumably to prevent errors that would arise if someone tried to do issubclass(A, Union[A, B]) or isinstance(A(), Union[A, B]), because Union isn?t specified in the PEP to allow a check like this, and doesn?t implement it. (Instead it throws said error) However, as far as I can see there is no blessed way to check if an object was returned by Union.__getitem__(). A simple way that works is: sig = inspect.signature(f) ann = sig.parameters['arg1'].annotation is_an_union = isinstance(ann, typing._Union) but _Union is a private class, and an implementation detail. is there a blessed way to do this? If not, one should be added. ---------- components: Library (Lib) messages: 285410 nosy: flying sheep priority: normal severity: normal status: open title: Provide a way to check for *real* typing.Union instances versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 11:09:52 2017 From: report at bugs.python.org (STINNER Victor) Date: Fri, 13 Jan 2017 16:09:52 +0000 Subject: [New-bugs-announce] [issue29263] Implement LOAD_METHOD/CALL_METHOD for C functions Message-ID: <1484323792.44.0.217164349535.issue29263@psf.upfronthosting.co.za> New submission from STINNER Victor: The issue #29259 implements tp_fastcall on method_descriptor (PyMethodDescr_Type). According to http://bugs.python.org/issue26110#msg283093 it would allow to implement LOAD_METHOD and CALL_METHOD for C functions. ---------- messages: 285414 nosy: haypo, inada.naoki, yselivanov priority: normal severity: normal status: open title: Implement LOAD_METHOD/CALL_METHOD for C functions type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 12:27:39 2017 From: report at bugs.python.org (Brian Vandenberg) Date: Fri, 13 Jan 2017 17:27:39 +0000 Subject: [New-bugs-announce] [issue29264] sparc/ffi.c:440 error: 'asm' undeclared Message-ID: <1484328459.12.0.655564355741.issue29264@psf.upfronthosting.co.za> New submission from Brian Vandenberg: When building pythong 3.6.0 on solaris 10/sparc I'm seeing the following error: Modules/_ctypes/libffi/src/sparc/ffi.c:440:8: error: 'asm' undeclared (first use in this function) (...) If I force it to use -std=gnu99 then it seems to compile fine. ---------- components: ctypes messages: 285428 nosy: phantal priority: normal severity: normal status: open title: sparc/ffi.c:440 error: 'asm' undeclared type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 12:48:34 2017 From: report at bugs.python.org (Brian Vandenberg) Date: Fri, 13 Jan 2017 17:48:34 +0000 Subject: [New-bugs-announce] [issue29265] test suite is attempting to spawn 258 child processes to run tests Message-ID: <1484329714.36.0.262857115906.issue29265@psf.upfronthosting.co.za> New submission from Brian Vandenberg: I'm attempting to build python 3.6.0 on sparc/solaris 10. After the initial configure/compile complete I ran "make test" and I see: $ make test running build running build_ext (...) running build_scripts copying and adjusting (...) changing mode of (...) renaming (...) (...) Run tests in parallel using 258 child processes I'm fairly sure the issue stems from the fact that each core on the machine has 8 "threads" and there's 32 cores (for a total of 256 virtual cores). Each core can execute 8 parallel tasks only in very specific circumstances. It's intended for use by things like lapack/atlas where you might be doing many computations on the same set of data. Outside of these more restricted circumstances each core can only handle 2 parallel tasks (or so I gathered from the documentation), so at best this machine could handle 64 backgrounded jobs though I normally restrict my builds to the actual core count or less. The most common way to get a "realistic" core count on these machines from shell scripts is: $ core_count=`kstat -m cpu_info | grep core_id | sort -u | wc -l` ... though I'm not sure how the test suite is determining the core count. I didn't see any mention of "kstat" anywhere. ---------- components: Tests messages: 285430 nosy: phantal priority: normal severity: normal status: open title: test suite is attempting to spawn 258 child processes to run tests type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 13:43:15 2017 From: report at bugs.python.org (Brian Vandenberg) Date: Fri, 13 Jan 2017 18:43:15 +0000 Subject: [New-bugs-announce] [issue29266] test_create_connection_service_name fails if "http" isn't listed in /etc/services Message-ID: <1484332995.5.0.803330803747.issue29266@psf.upfronthosting.co.za> New submission from Brian Vandenberg: One of our solaris machines doesn't have an entry in /etc/services for "http". This is causing test_create_connection_service_name to fail. In my case I can just ignore that particular failure, but as a fix you might consider overtly getting valid service names from the host to test. Additionally, if you don't already have it you might consider adding a test that validates behavior when using a non-existent service. ---------- components: Tests messages: 285434 nosy: phantal priority: normal severity: normal status: open title: test_create_connection_service_name fails if "http" isn't listed in /etc/services type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 13:53:57 2017 From: report at bugs.python.org (Brian Vandenberg) Date: Fri, 13 Jan 2017 18:53:57 +0000 Subject: [New-bugs-announce] [issue29267] Cannot override some flags in CFLAGS from the command-line Message-ID: <1484333637.07.0.801577004436.issue29267@psf.upfronthosting.co.za> New submission from Brian Vandenberg: Due to issue 29264 I was attempting to override the build default "-std=c99" with: /path/to/configure (...) CFLAGS=-std=gnu99 ... however, the configure script is written like this: CFLAGS_NODIST="$CFLAGS_NODIST -std=c99" This causes it to always override my attempt to override the build default. ---------- components: Build messages: 285435 nosy: phantal priority: normal severity: normal status: open title: Cannot override some flags in CFLAGS from the command-line type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 14:43:48 2017 From: report at bugs.python.org (Brian Vandenberg) Date: Fri, 13 Jan 2017 19:43:48 +0000 Subject: [New-bugs-announce] [issue29268] test_spwd fails on solaris using NIS users Message-ID: <1484336628.67.0.439917676346.issue29268@psf.upfronthosting.co.za> New submission from Brian Vandenberg: On all our solaris 10 machines when I run a simple test program it never reports a failure when calling getspnam: #include #include int main( int, char** ) { spwd *asdf = getspnam( "some_user" ); if( NULL == sdf ) { perror( "getspnam" ); } return 0; } If I run the above program on our linux boxes it fails as expected, but on our solaris machines it produces the same information you'd see running "ypcat passwd | grep some_user". I suspect either there's a bug in the solaris implementation of getpwnam() or perhaps there's a configuration issue on our solaris machines, though it's also possible this is just how it behaves in Solaris (at least with NIS). As to whether anything should change for test_spwd -- I suspect this will get closed as "won't fix" but at least this report may help anyone else running into this failure. ---------- components: Tests messages: 285439 nosy: phantal priority: normal severity: normal status: open title: test_spwd fails on solaris using NIS users type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 15:55:24 2017 From: report at bugs.python.org (Brian Vandenberg) Date: Fri, 13 Jan 2017 20:55:24 +0000 Subject: [New-bugs-announce] [issue29269] test_socket failing in solaris Message-ID: <1484340924.46.0.120687210952.issue29269@psf.upfronthosting.co.za> New submission from Brian Vandenberg: I started looking into this failure to see if I could figure out why but it looks like I'd have to spend more time than I have available to figure out the cause. Environment/setup: * air-gapped network (no internet access) * sparc / Solaris 10 * Built with gcc 6.3.0 * Altered configure script to change -std=c99 to -std=gnu99 (see issue 29264) * The only configure flags used were --prefix and --with-universal-archs=all When I run test_socket I see the following 4 failures; please note, I'm hand typing the results so I may typo something: ERROR: testCount (test.test_socket.SendfileUsingSendfileTest) Traceback: File "(...)/test_socket.py", line 5248, in testCount File "(...)/test_socket.py", line 5151, in recv_data MemoryError Error: testCount (test.test_socket.SendfileUsingSendfileTest) Traceback: File "(...)/test_socket.py", line 277, in _tearDown File "(...)/test_socket.py", line 289, in clientRun File "(...)/test_socket.py", line 5241, in _testCount File "(...)/Lib/socket.py", line 296, in _sendfile_use_sendfile socket.timeout: timed out Error: testWithTimeout (test.test_socket.SendfileUsingSendfileTest) Traceback: File "(...)/test_socket.py", line 5318, in testWithTimeout data = self.recv_data(conn) File "(...)/test_socket.py", line 5151, in recv_data chunk = conn.recv(self.BUFSIZE) MemoryError Error: testWithTimeout (test.test_socket.SendfileUsingSendfileTest) Traceback: File "(...)/test_socket.py", line 277, in _tearDown raise exc File "(...)/test_socket.py", line 289, in clientRun test_func() File "(...)/test_socket.py", line 5313, in _testWithTimeout sent = meth(file) File "(...)/Lib/socket.py", line 296, in _sendfile_use_sendfile socket.timeout: timed out Error: testCountWithOffset (test.test_socket.SendfileUsingSendfileTest) Traceback: File "(...)/test_socket.py", line 5287, in testCountWithOffset self.assertEqual(len(data), count) AssertionError: 4376231 != 100007 Ran 539 tests in 69.166s FAILED (failures=1, errors=4, skipped=324) test test_socket failed ---------- components: Tests messages: 285440 nosy: phantal priority: normal severity: normal status: open title: test_socket failing in solaris type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 17:10:22 2017 From: report at bugs.python.org (Dave Jones) Date: Fri, 13 Jan 2017 22:10:22 +0000 Subject: [New-bugs-announce] [issue29270] super call in ctypes sub-class fails in 3.6 Message-ID: <1484345422.14.0.967631121608.issue29270@psf.upfronthosting.co.za> New submission from Dave Jones: While investigating a bug report in one of my libraries (https://github.com/waveform80/picamera/issues/355) I've come across a behaviour that appears in Python 3.6 but not prior versions. Specifically, calling super() in a sub-class of a ctypes scalar type appears to fail at the class definition stage. A minimal test case is as follows: import ctypes as ct class SuperTest(ct.c_uint32): def __repr__(self): return super().__repr__() This works happily under python 3.2, 3.4, and 3.5 (that I've tested), and also under 2.7 (with the appropriate modification to super's arguments). However, under 3.6 it elicits the following exception: Traceback (most recent call last): File "py36_ctypes.py", line 3, in class SuperTest(ct.c_uint32): TypeError: __class__ set to defining 'SuperTest' as Reading through the "What's New" list in 3.6, I thought this might be something to do with the PEP-487 implementation (given it modified class construction), but having read through the PEP and associated patches I'm not so sure as I can't see anything that affects the setting of the "__class__" attribute (but don't rule it out on that basis; I'm no expert!). I'll admit that sub-classing one of ctypes' scalar types is a little odd, but given this works in prior versions and there doesn't appear to be anything in the documentation banning the practice (that I've found?) this might constitute a bug? ---------- components: ctypes messages: 285444 nosy: Dave Jones priority: normal severity: normal status: open title: super call in ctypes sub-class fails in 3.6 type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 17:11:24 2017 From: report at bugs.python.org (Yury Selivanov) Date: Fri, 13 Jan 2017 22:11:24 +0000 Subject: [New-bugs-announce] [issue29271] Task.current_task(None) returns unexpected result Message-ID: <1484345484.86.0.127501941011.issue29271@psf.upfronthosting.co.za> New submission from Yury Selivanov: Quoting Alberto Berdi from python-tulip mailing list: working with the Python 3.6 asyncio implemented in C, i've got what is for me a strange behavior of the asyncio.Task.current task function. Executing the following test: import asyncio async def coro(): print(asyncio.Task.current_task()) print(asyncio.Task.current_task(None)) print(asyncio.Task.current_task(loop=asyncio.get_event_loop())) loop = asyncio.get_event_loop() loop.run_until_complete(coro()) in Py3.5, I obtain the result: cb=[_run_until_complete_cb() at /usr/lib/python3.5/asyncio/base_events.py:176]> cb=[_run_until_complete_cb() at /usr/lib/python3.5/asyncio/base_events.py:176]> cb=[_run_until_complete_cb() at /usr/lib/python3.5/asyncio/base_events.py:176]> In Py3.6, i get: cb=[_run_until_complete_cb() at /usr/lib/python3.6/asyncio/base_events.py:176]> None cb=[_run_until_complete_cb() at /usr/lib/python3.6/asyncio/base_events.py:176]> What's going on here? It's still right to expect the same result from the three calls or something has changed? The documentation for the Task.current_task() function seems unchanged between the two version. My python3.6 has version: $ python3.6 -VV Python 3.6.0 (default, Dec 29 2016, 04:29:02) [GCC 6.2.1 20161215] ---------- assignee: yselivanov components: asyncio messages: 285445 nosy: gvanrossum, yselivanov priority: normal severity: normal stage: patch review status: open title: Task.current_task(None) returns unexpected result type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 13 20:37:00 2017 From: report at bugs.python.org (Brian Vandenberg) Date: Sat, 14 Jan 2017 01:37:00 +0000 Subject: [New-bugs-announce] [issue29272] test_logging hangs if /etc/hosts only aliases "localhost" to ::1 Message-ID: <1484357820.6.0.682177445577.issue29272@psf.upfronthosting.co.za> New submission from Brian Vandenberg: On some of the linux boxes on our (air-gapped, if that matters) network it looks like some of them were mis-configured and their /etc/hosts file looks something like this: $ cat /etc/hosts 127.0.0.1 snoopy.the.internal.domain snoopy localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 ... whereas for other linux machines not exhibiting this problem: $ cat /etc/hosts 127.0.0.1 woodstock.the.internal.domain woodstock localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 It appears this is causing test_logging to hang while running SocketHandlerTest. Unfortunately I don't have administrative privileges so I'm not able to prove I'm right. I only have circumstantial evidence, but no machine I tested (about 20 machines) contradicts what I stated above. ---------- components: Tests messages: 285452 nosy: phantal priority: normal severity: normal status: open title: test_logging hangs if /etc/hosts only aliases "localhost" to ::1 type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 14 02:25:54 2017 From: report at bugs.python.org (Martin Panter) Date: Sat, 14 Jan 2017 07:25:54 +0000 Subject: [New-bugs-announce] [issue29273] test___all__ alters utf8 locale setting Message-ID: <1484378754.56.0.202012710496.issue29273@psf.upfronthosting.co.za> New submission from Martin Panter: On a Linux computer I have LANG=en_US.utf8 set. Python 3 initializes the locale with this setting (see revision 43e32b2b4004): >>> locale.setlocale(locale.LC_CTYPE) # Get setting initialized by Python 'en_US.utf8' In Lib/test/test___all__.py, there is a special case to restore the locale after loading the ?readline? module (last changed in revision 37ed6eed0595). It does this by calling getlocale() and later setlocale(). However the getlocale() call translates the setting to UTF-8 in uppercase with a dash, and setlocale() keeps it that way: >>> locale.getlocale(locale.LC_CTYPE) ('en_US', 'UTF-8') >>> locale.setlocale(locale.LC_CTYPE, _) 'en_US.UTF-8' This means that the test framework may complain: Warning -- locale was modified by test___all__ One subtlety is that I only see the warning when the ?tkinter? module is unavailable. Otherwise, the test imports Lib/idlelib/iomenu.py, which calls setlocale(locale.LC_CTYPE, "") and restores the original ?utf8? spelling. The easiest fix would be to use setlocale(locale.LC_CTYPE) instead of getlocale() in test___all__. However I think it may be safe to remove this code entirely. The original version of the it was added by Guido in revision ba522c74a931 (year 2002). Three hours later is revision c7d5801bbae8, where Guido changed the ?readline? module to restore the locale after Readline library initialization. Since the module is fixed, I don?t think we need the test workaround, and I propose to remove it in Python 3, where it causes the above conflict. ---------- components: Tests files: readline-getlocale.patch keywords: patch messages: 285467 nosy: martin.panter priority: normal severity: normal stage: patch review status: open title: test___all__ alters utf8 locale setting type: behavior versions: Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46287/readline-getlocale.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 14 02:30:59 2017 From: report at bugs.python.org (Martin Panter) Date: Sat, 14 Jan 2017 07:30:59 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue29274=5D_Change_=E2=80=9Cte?= =?utf-8?b?c3RzIGNhc2Vz4oCdIOKGkiDigJx0ZXN0IGNhc2Vz4oCd?= Message-ID: <1484379059.0.0.00296348115264.issue29274@psf.upfronthosting.co.za> New submission from Martin Panter: The ?unittest? documentation has ?tests cases? written a few times. This doesn?t seem right to me, but I thought I should get a second opinion in case I missed something. ---------- assignee: docs at python components: Documentation files: tests-cases.patch keywords: patch messages: 285468 nosy: docs at python, martin.panter priority: normal severity: normal stage: patch review status: open title: Change ?tests cases? ? ?test cases? versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46288/tests-cases.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 14 10:46:18 2017 From: report at bugs.python.org (Elizabeth Myers) Date: Sat, 14 Jan 2017 15:46:18 +0000 Subject: [New-bugs-announce] [issue29275] time module still has Y2K issues note Message-ID: <1484408778.39.0.526783015881.issue29275@psf.upfronthosting.co.za> New submission from Elizabeth Myers: It's 2017. I think it's time to remove the Y2K warning from this: https://docs.python.org/3/library/time.html :P. It's 17 years past the sell-by date for that notice. ---------- assignee: docs at python components: Documentation messages: 285489 nosy: Elizacat, docs at python priority: normal severity: normal status: open title: time module still has Y2K issues note versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 14 10:52:38 2017 From: report at bugs.python.org (Ari) Date: Sat, 14 Jan 2017 15:52:38 +0000 Subject: [New-bugs-announce] [issue29276] HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags Message-ID: <1484409158.63.0.451865597774.issue29276@psf.upfronthosting.co.za> New submission from Ari: The following code produces incorrect results under Python 2.7.13. One would expect it to print 2 lines, "Encountered a start tag: a" and "Encountered a start tag: img". Yet it prints only "Encountered a start tag: a". from HTMLParser import HTMLParser class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): print 'Encountered a start tag: %s' % tag parser = MyHTMLParser() parser.feed('') Python 3.5.2 produces correct results on the same input and prints the expected "Encountered a start tag: a" and "Encountered a start tag: img". from html.parser import HTMLParser class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): print("Encountered a start tag:", tag) parser = MyHTMLParser() parser.feed('') ---------- components: Library (Lib) messages: 285490 nosy: Ari priority: normal severity: normal status: open title: HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 14 12:07:50 2017 From: report at bugs.python.org (miniflow) Date: Sat, 14 Jan 2017 17:07:50 +0000 Subject: [New-bugs-announce] [issue29277] os.getcwd failing on LOFS share Message-ID: <1484413670.89.0.750982203265.issue29277@psf.upfronthosting.co.za> New submission from miniflow: I am calling os.getcwd and am occasionally seeing failures inside my program. This is not due to files missing as the files on the share are static. Eror is: [Errno 2] No such file or directory Which is definitely not the case. Can any sort of trace be done at the time of failure to detect if the issue is with python or the OS? System is running Debian inside of an Illumos LX zone. ---------- components: IO, Library (Lib) messages: 285492 nosy: David Terk priority: normal severity: normal status: open title: os.getcwd failing on LOFS share type: crash versions: Python 2.7, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 15 02:44:06 2017 From: report at bugs.python.org (Utku Gultopu) Date: Sun, 15 Jan 2017 07:44:06 +0000 Subject: [New-bugs-announce] [issue29278] Python 3.6 build fails with parallel make Message-ID: <1484466246.11.0.873853911133.issue29278@psf.upfronthosting.co.za> New submission from Utku Gultopu: Version Info ============ Linux 4.4.0-59-generic #80-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux Issue ===== When the multiple jobs option (`make -j`) is specified, build fails after compiling the `structmember.c` file. Subsequent compilation attempts show the following message: gcc: internal compiler error: Killed (program cc1) Please submit a full bug report, with preprocessed source if appropriate. See for instructions. ---------- components: Build messages: 285503 nosy: ugultopu priority: normal severity: normal status: open title: Python 3.6 build fails with parallel make type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 15 03:17:47 2017 From: report at bugs.python.org (Arcadiy Ivanov) Date: Sun, 15 Jan 2017 08:17:47 +0000 Subject: [New-bugs-announce] [issue29279] --with-pydebug optimizes too much Message-ID: <1484468267.58.0.136858573865.issue29279@psf.upfronthosting.co.za> New submission from Arcadiy Ivanov: Around line 1480 of configure.ac: if test "$Py_DEBUG" = 'true' ; then # Optimization messes up debuggers, so turn it off for # debug builds. if "$CC" -v --help 2>/dev/null |grep -- -Og > /dev/null; then OPT="-g -Og -Wall $STRICT_PROTO" else OPT="-g -O0 -Wall $STRICT_PROTO" fi else OPT="-g $WRAP -O3 -Wall $STRICT_PROTO" fi The "-Og", unfortunately, optimizes too much resulting in local variables and arguments being optimized out: (gdb) info locals kwlist = {0x7ffff02c3318 "database", 0x7ffff02c3321 "timeout", 0x7ffff02c3329 "detect_types", 0x7ffff02c3336 "isolation_level", 0x7ffff02c3346 "check_same_thread", 0x7ffff02c3392 "factory", 0x7ffff02c3358 "cached_statements", 0x7ffff02c336a "uri", 0x0} database = 0x7ffff04f7da0 ":memory:" detect_types = 0 isolation_level = 0x1 factory = 0x7ffff04c7dc0 check_same_thread = 1 cached_statements = 4888694 uri = 0 timeout = 5 (gdb) info args self = args = 0x7fffeff6be28 kwargs = 0x0 When "self" is optimized out it's too much optimization for debug mode. ---------- components: Build messages: 285505 nosy: arcivanov priority: normal severity: normal status: open title: --with-pydebug optimizes too much versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 15 14:03:25 2017 From: report at bugs.python.org (Arthur Vanwalleghen) Date: Sun, 15 Jan 2017 19:03:25 +0000 Subject: [New-bugs-announce] [issue29280] gdbm & ndbm support missing in Windows Message-ID: <1484507005.86.0.826464747916.issue29280@psf.upfronthosting.co.za> New submission from Arthur Vanwalleghen: When I tried to work with GDBM and Ndbm files I saw that their supporting modules were not found. This can be verified with Pydoc: Pydoc\Python36-32\lib \dbm(package)\Package Contents\gnu|ndbm ErrorDuringImport: problem in dbm.gnu - ModuleNotFoundError: No module named '_gdbm' ErrorDuringImport: problem in dbm.ndbm - ModuleNotFoundError: No module named '_dbm' I first noticed this in 3.5 and waited to see if it was fixed in 3.6. I am running Win8.1. I want to work with files created on Linux/Perl using GDBM or NDBM. I cannot find any perl support for Python's dbm.dumb. I am looking for an out-of-the-box support for simple key/data files. ---------- components: Windows messages: 285517 nosy: ArtVan, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: gdbm & ndbm support missing in Windows type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 04:19:59 2017 From: report at bugs.python.org (Alexey Popravka) Date: Mon, 16 Jan 2017 09:19:59 +0000 Subject: [New-bugs-announce] [issue29281] json.loads documentation missing "versionchanged" statement Message-ID: <1484558399.93.0.792457597374.issue29281@psf.upfronthosting.co.za> New submission from Alexey Popravka: json.loads function was changed in Python 3.6 to accept bytes and bytearrays, however documentation is missing `versionchanged` block describing this changes. ---------- assignee: docs at python components: Documentation messages: 285545 nosy: Alexey Popravka, docs at python priority: normal severity: normal status: open title: json.loads documentation missing "versionchanged" statement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 05:01:37 2017 From: report at bugs.python.org (Juraj Sukop) Date: Mon, 16 Jan 2017 10:01:37 +0000 Subject: [New-bugs-announce] [issue29282] Fused multiply-add: proposal to add math.fma() Message-ID: <1484560897.19.0.0955404368118.issue29282@psf.upfronthosting.co.za> New submission from Juraj Sukop: Fused multiply-add (henceforth FMA) is an operation which calculates the product of two numbers and then the sum of the product and a third number with just one floating-point rounding. More concretely: r = x*y + z The value of `r` is the same as if the RHS was calculated with infinite precision and the rounded to a 32-bit single-precision or 64-bit double-precision floating-point number [1]. Even though one FMA CPU instruction might be calculated faster than the two separate instructions for multiply and add, its main advantage comes from the increased precision of numerical computations that involve the accumulation of products. Examples which benefit from using FMA are: dot product [2], compensated arithmetic [3], polynomial evaluation [4], matrix multiplication, Newton's method and many more [5]. C99 includes [6] `fma` function to `math.h` and emulates the calculation if the FMA instruction is not present on the host CPU [7]. PEP 7 states that "Python versions greater than or equal to 3.6 use C89 with several select C99 features" and that "Future C99 features may be added to this list in the future depending on compiler support" [8]. This proposal is then about adding new `fma` function with the following signature to `math` module: math.fma(x, y, z) '''Return a float representing the result of the operation `x*y + z` with single rounding error, as defined by the platform C library. The result is the same as if the operation was carried with infinite precision and rounded to a floating-point number.''' Attached is a simple module for Python 3 demonstrating the fused multiply-add operation. On my machine, `example.py` prints: 40037.524591982365 horner_double 40037.48821639768 horner_fma 40037.49486325783 horner_compensated 40037.49486325783 horner_decimal [1] https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation [2] S. Graillat, P. Langlois, N. Louvet. Accurate dot products with FMA. 2006 [3] S. Graillat, Accurate Floating Point Product and Exponentiation. 2007. [4] S. Graillat, P. Langlois, N. Louvet. Improving the compensated Horner scheme with a Fused Multiply and Add. 2006 [5] J.-M. Muller, N. Brisebarre, F. de Dinechin, C.-P. Jeannerod, V. Lef?vre, G. Melquiond, N. Revol, D. Stehl?, S. Torres. Handbook of Floating-Point Arithmetic. 2010. Chapter 5 [6] ISO/IEC 9899:TC3, "7.12.13.1 The fma functions", Committee Draft - Septermber 7, 2007 [7] https://git.musl-libc.org/cgit/musl/tree/src/math/fma.c [8] https://www.python.org/dev/peps/pep-0007/ ---------- components: Library (Lib) messages: 285547 nosy: juraj.sukop priority: normal severity: normal status: open title: Fused multiply-add: proposal to add math.fma() type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 06:14:45 2017 From: report at bugs.python.org (jan matejek) Date: Mon, 16 Jan 2017 11:14:45 +0000 Subject: [New-bugs-announce] [issue29283] duplicate README in site-packages Message-ID: <1484565285.81.0.453565653975.issue29283@psf.upfronthosting.co.za> New submission from jan matejek: Lib/site-packages directory now contains README.txt in addition to README. Both files are identical. One of them should probably go away? ---------- components: Installation messages: 285555 nosy: matejcik priority: normal severity: normal status: open title: duplicate README in site-packages type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 11:42:44 2017 From: report at bugs.python.org (John Taylor) Date: Mon, 16 Jan 2017 16:42:44 +0000 Subject: [New-bugs-announce] [issue29284] Include thread_name_prefix in the concurrent.futures.ThreadPoolExecutor example 17.4.2.1 Message-ID: <1484584964.59.0.239435362381.issue29284@psf.upfronthosting.co.za> New submission from John Taylor: Please include how to use the thread_name_prefix method argument (new to Python 3.6) in the example: 17.4.2.1. ThreadPoolExecutor Example ---------- assignee: docs at python components: Documentation messages: 285572 nosy: docs at python, jftuga priority: normal severity: normal status: open title: Include thread_name_prefix in the concurrent.futures.ThreadPoolExecutor example 17.4.2.1 type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 12:06:40 2017 From: report at bugs.python.org (John Taylor) Date: Mon, 16 Jan 2017 17:06:40 +0000 Subject: [New-bugs-announce] [issue29285] Unicode errors occur inside of multi-line comments Message-ID: <1484586400.61.0.654989234385.issue29285@psf.upfronthosting.co.za> New submission from John Taylor: I am using Python 3.5.2 on OS X 10.11.6. The same error occurs with 3.5.2 on Windows 10. When I run the attached code, I get this error: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 23-24: truncated \uXXXX escape I think unicode processing should be ignored inside of multiline comments. Inside of my comments, I really want to use this text verbatim. ---------- components: Interpreter Core files: example.py messages: 285573 nosy: jftuga priority: normal severity: normal status: open title: Unicode errors occur inside of multi-line comments type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file46303/example.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 12:30:51 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 16 Jan 2017 17:30:51 +0000 Subject: [New-bugs-announce] [issue29286] Use METH_FASTCALL in str methods Message-ID: <1484587851.78.0.529922329593.issue29286@psf.upfronthosting.co.za> New submission from STINNER Victor: Changes 27dc9a1c061e and 01b06ca45f64 converted the str (Unicode) methods to Argument Clinic, cool! But str methods taking more than one argument use positional-only arguments. Currently, Argument Clinic doesn't use METH_FASTCALL for these methods, but METH_VARARGS. There are two options: * Allow passing arguments as keywoards: str.replace(old='a', new='b') * Enhance Argument Clinic to use also METH_FASTCALL for functions using positional-only functions The goal is to speedup method calls. Example with str.replace(): $ ./python-patch -m perf timeit '"a".replace("x", "y")' --duplicate=100 --compare-to ./python-ref python-ref: ..................... 132 ns +- 1 ns python-patch: ..................... 102 ns +- 2 ns Median +- std dev: [python-ref] 132 ns +- 1 ns -> [python-patch] 102 ns +- 2 ns: 1.30x faster (-23%) ---------- messages: 285574 nosy: haypo, inada.naoki, larry, serhiy.storchaka priority: normal severity: normal status: open title: Use METH_FASTCALL in str methods type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 17:20:08 2017 From: report at bugs.python.org (Raymond Hettinger) Date: Mon, 16 Jan 2017 22:20:08 +0000 Subject: [New-bugs-announce] [issue29287] IDLE needs syntax highlighting for f-strings Message-ID: <1484605208.08.0.296182628472.issue29287@psf.upfronthosting.co.za> New submission from Raymond Hettinger: Follow the lead from Vim, MagicPython, and PyCharm. Needs separate colorization to make the expression distinct from the rest of the string. Needs close-brace matching. Would be desirable to have autocompletion as well. https://twitter.com/raymondh/status/819085176764366848 ---------- assignee: terry.reedy components: IDLE messages: 285585 nosy: rhettinger, terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE needs syntax highlighting for f-strings type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 17:30:45 2017 From: report at bugs.python.org (Ilya Kulakov) Date: Mon, 16 Jan 2017 22:30:45 +0000 Subject: [New-bugs-announce] [issue29288] Lookup Error while importing idna from a worker thread Message-ID: <1484605845.11.0.283710954459.issue29288@psf.upfronthosting.co.za> New submission from Ilya Kulakov: See this post: https://github.com/kennethreitz/requests/issues/3578 The current workaround for requests is to have a no-op import somewhere in the code. However, that doesn't really work for us: our python and stdlib are bundled by pyqtdeploy as in Qt resources system and we frequently see this error. On certain machines. Workaround that seems to work more reliably is a no-op look up via ''.encode('ascii').decode('idna'). ---------- components: Library (Lib) messages: 285586 nosy: Ilya.Kulakov priority: normal severity: normal status: open title: Lookup Error while importing idna from a worker thread versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 18:24:44 2017 From: report at bugs.python.org (STINNER Victor) Date: Mon, 16 Jan 2017 23:24:44 +0000 Subject: [New-bugs-announce] [issue29289] Convert OrderedDict methods to Argument Clinic Message-ID: <1484609084.15.0.406928886689.issue29289@psf.upfronthosting.co.za> New submission from STINNER Victor: Attached patch converts methods using METH_VARARGS|METH_KEYWORDS calling convention to METH_FASTCALL using Argument Clinic. This calling convention is faster, and Argument Clinic provides better docstring. See also issue #29263 "Implement LOAD_METHOD/CALL_METHOD for C functions" and issue #29286 "Use METH_FASTCALL in str methods". ---------- components: Interpreter Core files: odict_clinic.patch keywords: patch messages: 285588 nosy: eric.snow, haypo, inada.naoki priority: normal severity: normal status: open title: Convert OrderedDict methods to Argument Clinic type: performance versions: Python 3.7 Added file: http://bugs.python.org/file46306/odict_clinic.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 16 22:08:41 2017 From: report at bugs.python.org (Steven D'Aprano) Date: Tue, 17 Jan 2017 03:08:41 +0000 Subject: [New-bugs-announce] [issue29290] argparse breaks long lines on NO-BREAK SPACE Message-ID: <1484622521.42.0.0580919403747.issue29290@psf.upfronthosting.co.za> New submission from Steven D'Aprano: argparse help incorrectly breaks long lines on U+u00A0 NO-BREAK SPACE. The attached script has been run on Python 3.5.3rc1 in a terminal window 80 columns wide, and it produces output:: usage: argparse_nobreak.py [-h] [--no-condensedxxxx] optional arguments: -h, --help show this help message and exit --no-condensedxxxx Disable default font-style: condensed. Also disables "M+ 1M" condensed monospace. I expected the last line should have broken just before the "M+ 1M", rather than in the middle. See also #20491. ---------- components: Library (Lib) files: argparse_nobreak.py messages: 285607 nosy: steven.daprano priority: normal severity: normal status: open title: argparse breaks long lines on NO-BREAK SPACE type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file46310/argparse_nobreak.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 03:04:31 2017 From: report at bugs.python.org (ipolcak) Date: Tue, 17 Jan 2017 08:04:31 +0000 Subject: [New-bugs-announce] [issue29291] Misleading text in the documentation of re library for non-greedy match Message-ID: <1484640271.49.0.239743289753.issue29291@psf.upfronthosting.co.za> New submission from ipolcak: The text about non-greedy match in the documentation for re library is misleading. The docs for py2.7 (https://docs.python.org/2.7/library/re.html) and 3.6 (https://docs.python.org/3.6/library/re.html) says: "The '*', '+', and '?' qualifiers are all greedy; they match as much text as possible. Sometimes this behaviour isn?t desired; if the RE <.*> is matched against b , it will match the entire string, and not just . Adding ? after the qualifier makes it perform the match in non-greedy or minimal fashion; as few characters as possible will be matched. Using the RE <.*?> will match only ." The docs for py3.4 (https://docs.python.org/3.4/library/re.html) offers a little bit different example: "The '*', '+', and '?' qualifiers are all greedy; they match as much text as possible. Sometimes this behaviour isn?t desired; if the RE <.*> is matched against '

title

', it will match the entire string, and not just '

'. Adding '?' after the qualifier makes it perform the match in non-greedy or minimal fashion; as few characters as possible will be matched. Using .*? in the previous expression will match only '

'." However, in reality if the non-greedy match is not successful, it might fallback to the greedy match, see: >>> import re >>> a = re.compile(r"<.*?>") >>> a.match(" b ") <_sre.SRE_Match object; span=(0, 15), match=' b '> >>> a.search(" b ") <_sre.SRE_Match object; span=(0, 15), match=' b '> So the '<.*?>' part of the regex matches ' b ' in this example. I propose to add to the documentation the following text: "However, note that even the non-greedy version can match additional text, for example consider the RE '(<.*>)' to be matched against ' b '. The match is successful and the unnamed group contains ' b '." ---------- assignee: docs at python components: Documentation messages: 285619 nosy: docs at python, ipolcak priority: normal severity: normal status: open title: Misleading text in the documentation of re library for non-greedy match type: behavior versions: Python 2.7, Python 3.4, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 03:06:20 2017 From: report at bugs.python.org (Xiang Zhang) Date: Tue, 17 Jan 2017 08:06:20 +0000 Subject: [New-bugs-announce] [issue29292] Missing a parameter in PyEval_EvalCodeEx doc Message-ID: <1484640380.78.0.065326592654.issue29292@psf.upfronthosting.co.za> New submission from Xiang Zhang: The signature of PyEval_EvalCodeEx now gets a "PyObject *kwdefs" parameter but the doc doesn't mention it. ---------- assignee: docs at python components: Documentation messages: 285620 nosy: docs at python, xiang.zhang priority: normal severity: normal status: open title: Missing a parameter in PyEval_EvalCodeEx doc versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 03:43:56 2017 From: report at bugs.python.org (Victor de la Fuente) Date: Tue, 17 Jan 2017 08:43:56 +0000 Subject: [New-bugs-announce] [issue29293] Missing parameter "n" on multiprocessing.Condition.notify() Message-ID: <1484642636.98.0.126375980974.issue29293@psf.upfronthosting.co.za> New submission from Victor de la Fuente: Versions: Darwin MacBook-Pro-de-Victor.local 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64 Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin import multiprocessing as mp condition = mp.Condition() with condition: condition.notify(2) #Docs show notify(n=1) #TypeError: notify() takes 1 positional argument but 2 were given #Replacing the call with condition.notify(2): #TypeError: notify() got an unexpected keyword argument 'n' # Docs show signature: def notify(self, n=1) # But found this debugging: # multiprocessing/synchronize.py # line 211: class Condition(object): # ..... # line 271: def notify(self): #<-- ?There is no n paramater? # ..... ---------- components: Library (Lib) messages: 285623 nosy: Victor de la Fuente priority: normal severity: normal status: open title: Missing parameter "n" on multiprocessing.Condition.notify() type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 04:12:38 2017 From: report at bugs.python.org (Thomas Heller) Date: Tue, 17 Jan 2017 09:12:38 +0000 Subject: [New-bugs-announce] [issue29294] ctypes.windll.LoadLibrary refuses unicode argument Message-ID: <1484644358.67.0.715247179434.issue29294@psf.upfronthosting.co.za> New submission from Thomas Heller: ctypes.windll.LoadLibrary refuses unicode argument; this is a regression in Python 2.7.13: Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from ctypes import windll >>> windll.LoadLibrary(u"kernel32.dll") Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\ctypes\__init__.py", line 440, in LoadLibrary return self._dlltype(name) File "C:\Python27\lib\ctypes\__init__.py", line 362, in __init__ self._handle = _dlopen(self._name, mode) TypeError: LoadLibrary() argument 1 must be string, not unicode >>> It did work in Python 2.7.12 and before: Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from ctypes import windll >>> windll.LoadLibrary(u"kernel32") >>> ---------- components: ctypes messages: 285628 nosy: theller priority: normal severity: normal status: open title: ctypes.windll.LoadLibrary refuses unicode argument versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 05:47:42 2017 From: report at bugs.python.org (INADA Naoki) Date: Tue, 17 Jan 2017 10:47:42 +0000 Subject: [New-bugs-announce] [issue29295] dict: Optimize PyDict_GetItemString() Message-ID: <1484650062.84.0.813029301463.issue29295@psf.upfronthosting.co.za> New submission from INADA Naoki: PyDict_GetItemString() is heavily used, especially from keyword argument parsing. Current implementation creates temporary string for key object. This patch avoid the temporary key string when passed C string is ASCII. This benchmark is based on a8563ef0eb8a, so PyDict_GetItemString() calls for parsing positional arguments is reduced already. $ ../python -m perf compare_to -G --min-speed 2 default.json patched.json Slower (1): - scimark_lu: 430 ms +- 21 ms -> 446 ms +- 23 ms: 1.04x slower (+4%) Faster (11): - telco: 24.2 ms +- 0.4 ms -> 21.8 ms +- 0.7 ms: 1.11x faster (-10%) - xml_etree_parse: 315 ms +- 17 ms -> 302 ms +- 14 ms: 1.04x faster (-4%) - logging_simple: 31.6 us +- 0.3 us -> 30.4 us +- 0.3 us: 1.04x faster (-4%) - mako: 41.6 ms +- 0.7 ms -> 40.3 ms +- 0.4 ms: 1.03x faster (-3%) - logging_format: 36.5 us +- 0.3 us -> 35.5 us +- 0.4 us: 1.03x faster (-3%) - float: 297 ms +- 4 ms -> 289 ms +- 4 ms: 1.03x faster (-3%) - scimark_monte_carlo: 276 ms +- 10 ms -> 269 ms +- 7 ms: 1.02x faster (-2%) - regex_effbot: 5.31 ms +- 0.37 ms -> 5.19 ms +- 0.06 ms: 1.02x faster (-2%) - pickle_pure_python: 1.32 ms +- 0.02 ms -> 1.29 ms +- 0.02 ms: 1.02x faster (-2%) - scimark_sor: 525 ms +- 9 ms -> 514 ms +- 8 ms: 1.02x faster (-2%) - richards: 180 ms +- 3 ms -> 176 ms +- 2 ms: 1.02x faster (-2%) Benchmark hidden because not significant (52): ... Performance difference of telco is bit surprising. Profiler shows the difference is from `print(t, file=outfil)` (here: https://github.com/python/performance/blob/master/performance/benchmarks/bm_telco.py#L79 ) Until most common builtin functions are converted to FASTCALL, this patch has significant performance gain. ---------- components: Interpreter Core files: dict_getitemascii.patch keywords: patch messages: 285631 nosy: inada.naoki priority: normal severity: normal status: open title: dict: Optimize PyDict_GetItemString() type: performance versions: Python 3.7 Added file: http://bugs.python.org/file46313/dict_getitemascii.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 06:34:31 2017 From: report at bugs.python.org (INADA Naoki) Date: Tue, 17 Jan 2017 11:34:31 +0000 Subject: [New-bugs-announce] [issue29296] convert print() to METH_FASTCALL Message-ID: <1484652871.69.0.785445814249.issue29296@psf.upfronthosting.co.za> New submission from INADA Naoki: Median +- std dev: [default] 24.2 ms +- 0.4 ms -> [patched] 19.2 ms +- 0.4 ms: 1.26x faster (-21%) ---------- files: print-fastcall.patch keywords: patch messages: 285632 nosy: haypo, inada.naoki priority: normal severity: normal status: open title: convert print() to METH_FASTCALL type: performance versions: Python 3.7 Added file: http://bugs.python.org/file46314/print-fastcall.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 09:43:36 2017 From: report at bugs.python.org (Mo Ali) Date: Tue, 17 Jan 2017 14:43:36 +0000 Subject: [New-bugs-announce] [issue29297] python3 open() does not check argument type before attempting to read() or write() Message-ID: <1484664216.19.0.300485907535.issue29297@psf.upfronthosting.co.za> New submission from Mo Ali: Python3 open(), read(), or write()doesn't check argument type before action causing a hang. Would like to catch exceptions but not without an exception to return. See below. Python3.6: Python 3.6.0 (default, Dec 24 2016, 08:01:42) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> test = False >>> with open(str(test)) as f: ... fail = f.read() ... python2.7: ??? python2 0 < 09:35:31 Python 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> test = False >>> with open(test) as f: ... fail = f.read() ... Traceback (most recent call last): File "", line 1, in TypeError: coercing to Unicode: need string or buffer, bool found ---------- messages: 285644 nosy: Mo Ali priority: normal severity: normal status: open title: python3 open() does not check argument type before attempting to read() or write() type: crash versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 09:52:49 2017 From: report at bugs.python.org (zachrahan) Date: Tue, 17 Jan 2017 14:52:49 +0000 Subject: [New-bugs-announce] [issue29298] argparse fails with required subparsers, un-named dest, and empty argv Message-ID: <1484664769.91.0.625725054847.issue29298@psf.upfronthosting.co.za> New submission from zachrahan: In python 3.6 (and several versions back), using argparse with required subparsers will cause an unhelpful TypeError if the 'dest' parameter is not explicitly specified, and no arguments are provided. Test case: import argparse parser = argparse.ArgumentParser() subparsers = parser.add_subparsers() subparsers.required = True args = parser.parse_args([]) Observed result: TypeError: sequence item 0: expected str instance, NoneType found If the line above is changed to: subparsers = parser.add_subparsers(dest='function') Then the following is printed to stderr: usage: python [-h] {} ... python: error: the following arguments are required: function This issue goes back at least several years: http://stackoverflow.com/questions/23349349/argparse-with-required-subparser/23354355 Though it seems odd to not specify a dest in the add_subparsers line, the pattern is not completely useless. The below works fine without setting a 'dest' in add_subparsers, except when argv is empty: sub1 = subparsers.add_parser('print') sub1.set_defaults(function=print) However, an empty argv produces the unexpected TypeError above. I'm not sure if argparse should provide a more useful exception in this case, or if there is a clean way to do the right thing without a dest specified. ---------- components: Library (Lib) messages: 285646 nosy: zachrahan priority: normal severity: normal status: open title: argparse fails with required subparsers, un-named dest, and empty argv type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 10:17:14 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 17 Jan 2017 15:17:14 +0000 Subject: [New-bugs-announce] [issue29299] Argument Clinic: Fix signature of optional positional-only arguments Message-ID: <1484666234.33.0.914406658402.issue29299@psf.upfronthosting.co.za> New submission from STINNER Victor: When a function has only positional arguments and at least one argument is optional, the expected signature is: func(mandatory_arg1, mandatory_arg2[, optional_arg3[, optinal_arg4]]) For example, the signature of format() is inconsistent with its documentation. Signature: --- $ python3 -c 'help(format)'|cat Help on built-in function format in module builtins: format(value, format_spec='', /) Return value.__format__(format_spec) format_spec defaults to the empty string --- Documentation: --- .. function:: format(value[, format_spec]) --- Attached patch is a first attempt to fix the issue. The problem is that my heuristic to check if an argument is "optional" doesn't seem to work as expected in all cases. I chose to check if the C default is NULL. The problem is that some functions defines a C default to NULL whereas the Python default is set to a different value and is correct. Example with _io.FileIO.truncate: /*[clinic input] _io.FileIO.truncate size as posobj: object = NULL / whereas the documentation says that the default is None: .. method:: truncate(size=None) It's easy to fix the default, but in this case my change doesn't fix the signature anymore since the C default is still NULL: /*[clinic input] _io.FileIO.truncate size as posobj: object(c_default="NULL") = None / We need a different heuristic than C default is NULL, or we should fix functions where the heuristic fails. ---------- components: Argument Clinic files: ac_optional_positional.patch keywords: patch messages: 285650 nosy: haypo, larry, rhettinger, serhiy.storchaka priority: normal severity: normal status: open title: Argument Clinic: Fix signature of optional positional-only arguments versions: Python 3.7 Added file: http://bugs.python.org/file46316/ac_optional_positional.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 11:31:45 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 17 Jan 2017 16:31:45 +0000 Subject: [New-bugs-announce] [issue29300] Modify the _struct module to use FASTCALL and Argument Clinic Message-ID: <1484670705.59.0.0193443230555.issue29300@psf.upfronthosting.co.za> New submission from STINNER Victor: Attached patch modify the _struct module to use FASTCALL and Argument Clinic. AC requires a summary line, so I duplicated the first sentence of iter_unpack() docstring: iter_unpack(fmt, buffer, /) Return an iterator yielding tuples unpacked from the given bytes. Return an iterator yielding tuples unpacked from the given bytes source according to the format string, like a repeated invocation of unpack_from(). Requires that the bytes length be a multiple of the format struct size. ---------- components: Argument Clinic files: struct_fastcall.patch keywords: patch messages: 285663 nosy: haypo, inada.naoki, larry, serhiy.storchaka priority: normal severity: normal status: open title: Modify the _struct module to use FASTCALL and Argument Clinic type: performance versions: Python 3.7 Added file: http://bugs.python.org/file46319/struct_fastcall.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 11:38:44 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 17 Jan 2017 16:38:44 +0000 Subject: [New-bugs-announce] [issue29301] decimal: Use FASTCALL and/or Argument Clinic Message-ID: <1484671124.21.0.493200110844.issue29301@psf.upfronthosting.co.za> New submission from STINNER Victor: I'm currently working on the isuse #29259: "Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects". I used bm_telco of the performance benchmark suite to check which functions still require to create a temporary tuple for positional arguments and a temporary dict for keyword arguments. I found 3 remaining functions which have an impact on the result of the benchmark: * print(): optimized by the issue #29296 * _struct.unpack(): I just created the issue #29300 "Modify the _struct module to use FASTCALL and Argument Clinic" * _decimal.Decimal.quantize() I would like to know if Stephan would be ok to modify the _decimal module to use FASTCALL. I know that recently he reverted changes to keep the same code base on Python 3.5, 3.6 and 3.7. With 4 changes (tp_fastcall #29259, print #29296, unpack #29300 and this issue), bm_telco becomes 22% faster which is not negligible! 20.9 ms +- 0.5 ms => 16.4 ms +- 0.5 ms Attached decimal.patch patch is the strict minimum change to optimize bm_telco, but I would prefer to change all _decimal functions and methods using METH_VARARGS and METH_VARARGS|METH_KEYWORDS to convert them to METH_FASTCALL. The best would be to use Argument Clinic. AC exists since Python 3.5, so it should be possible to keep the same code base on Python 3.5-3.7, only generated code would be different. ---------- files: decimal.patch keywords: patch messages: 285665 nosy: haypo, skrah priority: normal severity: normal status: open title: decimal: Use FASTCALL and/or Argument Clinic type: performance versions: Python 3.7 Added file: http://bugs.python.org/file46320/decimal.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 17:49:42 2017 From: report at bugs.python.org (Alexander Mohr) Date: Tue, 17 Jan 2017 22:49:42 +0000 Subject: [New-bugs-announce] [issue29302] add contextlib.AsyncExitStack Message-ID: <1484693382.32.0.211448130443.issue29302@psf.upfronthosting.co.za> New submission from Alexander Mohr: ExitStack is a really useful class and would be a great to have an async version. I've gone ahead and created an implementation based on the existing Python 3.5.2 implementation. Let me know what you guys think. I think it would be possible to combine most of the two classes together if you guys think it would be useful. Let me know if I can/should create a github PR and where to do that. ---------- components: Library (Lib) files: exit_stack.py messages: 285687 nosy: thehesiod priority: normal severity: normal status: open title: add contextlib.AsyncExitStack type: enhancement versions: Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46322/exit_stack.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 18:26:15 2017 From: report at bugs.python.org (anonymous2017) Date: Tue, 17 Jan 2017 23:26:15 +0000 Subject: [New-bugs-announce] [issue29303] asyncio.Lock.acquire() does not always yield Message-ID: <1484695575.39.0.807179616569.issue29303@psf.upfronthosting.co.za> New submission from anonymous2017: Details here: http://stackoverflow.com/questions/41708609/unfair-scheduling-bad-lock-optimization-in-asyncio-event-loop Essentially there should be a `yield` before this line otherwise a coroutine that only acquires and releases a lock will never yield to other coroutines. ---------- components: asyncio messages: 285688 nosy: anonymous2017, gvanrossum, yselivanov priority: normal severity: normal status: open title: asyncio.Lock.acquire() does not always yield type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 17 21:36:13 2017 From: report at bugs.python.org (INADA Naoki) Date: Wed, 18 Jan 2017 02:36:13 +0000 Subject: [New-bugs-announce] [issue29304] dict: simplify lookup function Message-ID: <1484706973.14.0.775713839146.issue29304@psf.upfronthosting.co.za> New submission from INADA Naoki: All lookdict* functions are implemented like pseudo language: ``` lookup() if not collision: return result while True: perturb_shift() lookup() if not collision: return result ``` This patch changes it as: ``` while True: lookup() if not collision: return result perturb_shift() ``` It removes 100 lines of code. Good. But how about performance? When this patch is applied to 4a534c45bbf6: ``` $ ../python.patched -m perf compare_to default.json patched2.json -G --min-speed=2 Slower (4): - xml_etree_generate: 271 ms +- 6 ms -> 283 ms +- 9 ms: 1.04x slower (+4%) - nqueens: 263 ms +- 4 ms -> 272 ms +- 3 ms: 1.04x slower (+4%) - scimark_monte_carlo: 272 ms +- 10 ms -> 280 ms +- 14 ms: 1.03x slower (+3%) - scimark_lu: 435 ms +- 23 ms -> 446 ms +- 32 ms: 1.03x slower (+3%) Faster (7): - call_method: 15.2 ms +- 0.2 ms -> 14.7 ms +- 0.4 ms: 1.04x faster (-4%) - call_simple: 14.4 ms +- 0.2 ms -> 13.9 ms +- 0.3 ms: 1.04x faster (-4%) - xml_etree_iterparse: 227 ms +- 9 ms -> 219 ms +- 7 ms: 1.04x faster (-3%) - scimark_sor: 527 ms +- 10 ms -> 510 ms +- 11 ms: 1.03x faster (-3%) - call_method_slots: 14.7 ms +- 0.5 ms -> 14.3 ms +- 0.2 ms: 1.03x faster (-3%) - genshi_text: 90.2 ms +- 1.1 ms -> 87.8 ms +- 1.1 ms: 1.03x faster (-3%) - django_template: 403 ms +- 5 ms -> 394 ms +- 4 ms: 1.02x faster (-2%) Benchmark hidden because not significant (53): 2to3, ... ``` And when this patch applied to 1a97b10cb420 : ``` $ ../python.patched -m perf compare_to default.json patched.json -G --min-speed=2 Slower (6): - call_simple: 13.5 ms +- 0.5 ms -> 14.4 ms +- 0.4 ms: 1.07x slower (+7%) - xml_etree_generate: 270 ms +- 6 ms -> 287 ms +- 5 ms: 1.06x slower (+6%) - xml_etree_process: 240 ms +- 6 ms -> 247 ms +- 4 ms: 1.03x slower (+3%) - regex_compile: 429 ms +- 3 ms -> 440 ms +- 5 ms: 1.03x slower (+3%) - call_method_unknown: 16.1 ms +- 0.2 ms -> 16.5 ms +- 0.3 ms: 1.02x slower (+2%) - logging_simple: 31.2 us +- 0.4 us -> 32.0 us +- 0.3 us: 1.02x slower (+2%) Faster (8): - genshi_text: 90.6 ms +- 1.4 ms -> 87.6 ms +- 1.2 ms: 1.03x faster (-3%) - scimark_sor: 513 ms +- 11 ms -> 497 ms +- 12 ms: 1.03x faster (-3%) - genshi_xml: 200 ms +- 2 ms -> 194 ms +- 2 ms: 1.03x faster (-3%) - unpickle_pure_python: 857 us +- 21 us -> 835 us +- 13 us: 1.03x faster (-3%) - python_startup_no_site: 9.95 ms +- 0.02 ms -> 9.74 ms +- 0.02 ms: 1.02x faster (-2%) - json_dumps: 29.7 ms +- 0.4 ms -> 29.1 ms +- 0.4 ms: 1.02x faster (-2%) - xml_etree_iterparse: 225 ms +- 9 ms -> 220 ms +- 5 ms: 1.02x faster (-2%) - chameleon: 31.1 ms +- 0.3 ms -> 30.5 ms +- 0.5 ms: 1.02x faster (-2%) Benchmark hidden because not significant (50): 2to3, ... ``` I can't see any stable and significant performance regression. I'll try to create some micro benchmarks. ---------- files: dictlook-refactoring.patch keywords: patch messages: 285695 nosy: inada.naoki priority: normal severity: normal status: open title: dict: simplify lookup function Added file: http://bugs.python.org/file46324/dictlook-refactoring.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 03:41:01 2017 From: report at bugs.python.org (Babe Hardy) Date: Wed, 18 Jan 2017 08:41:01 +0000 Subject: [New-bugs-announce] [issue29305] encoding to ascii in client.py Message-ID: <1484728861.39.0.489354661051.issue29305@psf.upfronthosting.co.za> New submission from Babe Hardy: used urlopen('...{}'.format(v)).read() with v being a string when v is of a non-ascii format: >>UnicodeEncodeError: 'ascii' codec can't encode characters<< in line 984 of putrequest after changing >>self._output(request.encode('ascii'))<< into >>self._output(request.encode('utf-8'))<< my script worked again ---------- components: Library (Lib) messages: 285707 nosy: Babe Hardy priority: normal severity: normal status: open title: encoding to ascii in client.py type: compile error versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 04:04:45 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 18 Jan 2017 09:04:45 +0000 Subject: [New-bugs-announce] [issue29306] Check usage of Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() in new FASTCALL functions Message-ID: <1484730285.0.0.960009012423.issue29306@psf.upfronthosting.co.za> New submission from STINNER Victor: I added the following new functions to Python 3.6: * _PyObject_FastCallDict() * _PyObject_FastCallKeywords() * _PyFunction_FastCallDict() * _PyFunction_FastCallKeywords() * _PyCFunction_FastCallDict() * _PyCFunction_FastCallKeywords() I'm not sure that these functions update correctly the "recursion_depth" counter using Py_EnterRecursiveCall() and Py_LeaveRecursiveCall(). ---------- components: Interpreter Core messages: 285709 nosy: haypo, inada.naoki priority: normal severity: normal status: open title: Check usage of Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() in new FASTCALL functions type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 05:56:23 2017 From: report at bugs.python.org (Jeroen Van Goey) Date: Wed, 18 Jan 2017 10:56:23 +0000 Subject: [New-bugs-announce] [issue29307] ModuleNotFoundError when using literal string interpolation with invalid format specifier Message-ID: <1484736983.43.0.107395329278.issue29307@psf.upfronthosting.co.za> New submission from Jeroen Van Goey: I installed Python 3.6 from J Fernyhough's PPA by doing sudo add-apt-repository ppa:jonathonf/python-3.6 sudo apt-get update sudo apt-get install python3.6 I made a string, using the new literal string interpolation, but I supplied an invalid format specifier. I not only got the expected "ValueError: Invalid format specifier", but also the unexpected "ModuleNotFoundError: No module named 'apt_pkg'". $ python3.6 Python 3.6.0 (default, Dec 29 2016, 21:40:36) [GCC 5.4.1 20161202] on linux Type "help", "copyright", "credits" or "license" for more information. >>> value = 4 * 20 >>> f'the value is {value:%A}' Traceback (most recent call last): File "", line 1, in ValueError: Invalid format specifier Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in from apport.packaging_impl import impl as packaging File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' Original exception was: Traceback (most recent call last): File "", line 1, in ValueError: Invalid format specifier ---------- messages: 285716 nosy: jeroen-vangoey priority: normal severity: normal status: open title: ModuleNotFoundError when using literal string interpolation with invalid format specifier type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 09:39:37 2017 From: report at bugs.python.org (Jack Bennett) Date: Wed, 18 Jan 2017 14:39:37 +0000 Subject: [New-bugs-announce] [issue29308] venv should match virtualenv VIRTUAL_ENV_DISABLE_PROMPT config Message-ID: <1484750377.25.0.809506276992.issue29308@psf.upfronthosting.co.za> New submission from Jack Bennett: virtualenv has https://virtualenv.pypa.io/en/latest/reference/#envvar-VIRTUAL_ENV_DISABLE_PROMPT to block activate from trying to overwrite the prompt function. Users of venv can't do that, 3.6 added prompt but even None defaults to the current folder name. If I may suggest either respecting the virtualenv variable or perhaps prompt=False Specifically we've ran into this in powershell while making cmder stricter on the prompt over here: https://github.com/cmderdev/cmder/issues/1207 Thanks, Jack ---------- components: Library (Lib) messages: 285729 nosy: Jack Bennett priority: normal severity: normal status: open title: venv should match virtualenv VIRTUAL_ENV_DISABLE_PROMPT config type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 09:58:33 2017 From: report at bugs.python.org (=?utf-8?q?Romain_S=C3=A9bille?=) Date: Wed, 18 Jan 2017 14:58:33 +0000 Subject: [New-bugs-announce] [issue29309] Interpreter hang when interrupting a loop.run_in_executor() future Message-ID: <1484751513.93.0.173979168861.issue29309@psf.upfronthosting.co.za> New submission from Romain S?bille: Hi, I stumble on this today and can't find any reasons or previous issue as to why this happen so I thought of submitting the issue here. I attached a script (run_in_executor.py) to reproduce the problem, the original problem arise when waiting to read on a socket but I have the same result with time.sleep(). The output: $ python3.6 run_in_executor.py Start Going to sleep ^CClosing loop Traceback (most recent call last): File "run_in_executor.py", line 15, in loop.run_until_complete(sleep_in_executor(loop)) File "/usr/local/lib/python3.6/asyncio/base_events.py", line 454, in run_until_complete self.run_forever() File "/usr/local/lib/python3.6/asyncio/base_events.py", line 421, in run_forever self._run_once() File "/usr/local/lib/python3.6/asyncio/base_events.py", line 1389, in _run_once event_list = self._selector.select(timeout) File "/usr/local/lib/python3.6/selectors.py", line 445, in select fd_event_list = self._epoll.poll(timeout, max_ev) KeyboardInterrupt ^CError in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 39, in _python_exit t.join() File "/usr/local/lib/python3.6/threading.py", line 1056, in join self._wait_for_tstate_lock() File "/usr/local/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock elif lock.acquire(block, timeout): KeyboardInterrupt Current behavior: We have to send two ^C before we go back to the shell. Expected behavior: Only one ^C to go back to the shell. Python versions tested: - Python 3.4.2 - Python 3.4.6 - Python 3.5.3 - Python 3.6.0 >From what I have gathered the error is within the ThreadPoolExecutor cleaning function but I don't see why there are still living workers, the Executor.shutdown() take care of that. Unfortunately I don't really know what to look, is a AsyncIO bug ? A ThreadPoolExecutor bug ? Or something else. ---------- components: asyncio files: run_in_executor.py messages: 285732 nosy: gvanrossum, rsebille, yselivanov priority: normal severity: normal status: open title: Interpreter hang when interrupting a loop.run_in_executor() future type: behavior versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file46328/run_in_executor.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 11:09:17 2017 From: report at bugs.python.org (Jelle Zijlstra) Date: Wed, 18 Jan 2017 16:09:17 +0000 Subject: [New-bugs-announce] [issue29310] Document typing.NamedTuple default argument syntax Message-ID: <1484755757.54.0.970081096642.issue29310@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Document https://github.com/python/typing/pull/338 I should have a patch in the next few days; creating this issue to remind myself. ---------- assignee: Jelle Zijlstra components: Documentation messages: 285740 nosy: Jelle Zijlstra priority: normal severity: normal status: open title: Document typing.NamedTuple default argument syntax versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 11:54:10 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 18 Jan 2017 16:54:10 +0000 Subject: [New-bugs-announce] [issue29311] Argument Clinic: convert dict methods Message-ID: <1484758450.31.0.717694851278.issue29311@psf.upfronthosting.co.za> New submission from STINNER Victor: The dict type has multiple methods which use METH_VARARGS or METH_VARARGS|METH_KEYWORDS calling convention, whereras there is no a new faster METH_FASTCALL calling convention which avoids temporary tuple/dict to pass arguments. ---------- components: Argument Clinic messages: 285742 nosy: haypo, inada.naoki, larry priority: normal severity: normal status: open title: Argument Clinic: convert dict methods type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 12:07:42 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 18 Jan 2017 17:07:42 +0000 Subject: [New-bugs-announce] [issue29312] Use FASTCALL in dict.update() Message-ID: <1484759262.53.0.625567482548.issue29312@psf.upfronthosting.co.za> New submission from STINNER Victor: Follow-up of the issue #29311 "Argument Clinic: convert dict methods". The dict.update() method hs a special prototype: def update(arg=None **kw): ... I don't think that Argument Clinic supports it right now, so I propose to first optimize dict_update() to use METH_FASTCALL. Attached patch is a first step: convert kwnames tuple to a dict. A second step would be to avoid the temporary dict and update the dict using args + kwnames directly. ---------- files: dict_update_fastcall.patch keywords: patch messages: 285744 nosy: haypo, inada.naoki priority: normal severity: normal status: open title: Use FASTCALL in dict.update() type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46330/dict_update_fastcall.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 14:38:39 2017 From: report at bugs.python.org (eszense) Date: Wed, 18 Jan 2017 19:38:39 +0000 Subject: [New-bugs-announce] [issue29313] msi by bdist_msi will fail execute install-scripts if space in present in python path Message-ID: <1484768319.35.0.107822358832.issue29313@psf.upfronthosting.co.za> New submission from eszense: If python.exe path contains space, msi generated with bdist_msi command with --install-script=abc.py will fail with msg: C:\\Program Files\\Python35\\python.exe: can't open file 'C:\\Program': [Error 2] No such file or directory Patch attached for your consideration ---------- components: Distutils files: patch.diff keywords: patch messages: 285749 nosy: dstufft, eric.araujo, eszense priority: normal severity: normal status: open title: msi by bdist_msi will fail execute install-scripts if space in present in python path type: crash Added file: http://bugs.python.org/file46333/patch.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 15:07:47 2017 From: report at bugs.python.org (R. David Murray) Date: Wed, 18 Jan 2017 20:07:47 +0000 Subject: [New-bugs-announce] [issue29314] asyncio.async deprecation warning is missing stacklevel=2 Message-ID: <1484770067.77.0.974182324744.issue29314@psf.upfronthosting.co.za> New submission from R. David Murray: Title pretty much says it all. The warning isn't very helpful currently, since it just reports the line in tasks.py where the deprecation warning is generated. ---------- messages: 285750 nosy: r.david.murray priority: normal severity: normal status: open title: asyncio.async deprecation warning is missing stacklevel=2 versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 15:21:15 2017 From: report at bugs.python.org (Mike Lissner) Date: Wed, 18 Jan 2017 20:21:15 +0000 Subject: [New-bugs-announce] [issue29315] \b requires raw strings or to be escaped. Update docs with that hint? Message-ID: <1484770875.58.0.864108991771.issue29315@psf.upfronthosting.co.za> New submission from Mike Lissner: I just ran into a funny corner case I imagine others are aware of. When you write "\b" in Python, it is a single character: "\x08". So if you try to write a regex like: words = '\b(.*)\b' That won't work. But using a raw string will: words = r'\b(.*)\b' As will escaping it in this horrible fashion: words = '\\b(.*)\\b' I believe this doesn't affect any of the other regex flags, so I wonder if it's worth adding something to the docs to warn about this. I just spent a bunch of time trying to figure out why it seemed like \b wasn't working. A little tip in the docs would have gone a LONG way. ---------- assignee: docs at python components: Documentation messages: 285751 nosy: Mike.Lissner, docs at python priority: normal severity: normal status: open title: \b requires raw strings or to be escaped. Update docs with that hint? type: enhancement versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 16:20:07 2017 From: report at bugs.python.org (Guido van Rossum) Date: Wed, 18 Jan 2017 21:20:07 +0000 Subject: [New-bugs-announce] [issue29316] Can we keep typing.py provisional for the duration of the Python 3.6 release cycle? Message-ID: <1484774407.47.0.689245055951.issue29316@psf.upfronthosting.co.za> New submission from Guido van Rossum: The 3.6 what's new (https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-typing) claims typing.py is no longer provisional, but I don't think it's quite ready yet. There are a number of things that I'd like to merge into typing.py over the duration of 3.6's lifetime. Nothing backwards incompatible, but definitely new features. See also https://github.com/python/typing/issues/247 ---------- messages: 285758 nosy: gvanrossum priority: normal severity: normal status: open title: Can we keep typing.py provisional for the duration of the Python 3.6 release cycle? _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 18 18:33:31 2017 From: report at bugs.python.org (mark) Date: Wed, 18 Jan 2017 23:33:31 +0000 Subject: [New-bugs-announce] [issue29317] test_copyxattr_symlinks fails Message-ID: <1484782411.92.0.520036190929.issue29317@psf.upfronthosting.co.za> New submission from mark: ====================================================================== ERROR: test_copyxattr_symlinks (test.test_shutil.TestShutil) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/Python-3.6.0/Lib/test/test_shutil.py", line 505, in test_copyxattr_symlinks os.setxattr(src, 'trusted.foo', b'42') PermissionError: [Errno 1] Operation not permitted: '/tmp/tmpvlu10qdm/foo' ---------------------------------------------------------------------- The problem is that "trusted" attributes (in this case trusted.foo) are visible and accessible only to processes that have the CAP_SYS_ADMIN capability. The current "skipUnless" guard is wrong: being root (UID 0) doesn't necessarely imply you have CAP_SYS_ADMIN. For instance this test (and thus "make test") will always fail in a Docker container unless it's started with "--cap-add SYS_ADMIN" (which, in general, is not the best thing to do). ---------- components: Tests messages: 285764 nosy: marktay priority: normal severity: normal status: open title: test_copyxattr_symlinks fails versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 06:33:01 2017 From: report at bugs.python.org (STINNER Victor) Date: Thu, 19 Jan 2017 11:33:01 +0000 Subject: [New-bugs-announce] [issue29318] Optimize _PyFunction_FastCallDict() for **kwargs Message-ID: <1484825581.48.0.790581995103.issue29318@psf.upfronthosting.co.za> New submission from STINNER Victor: Example: --- def func(x, y): print(x, y) def proxy2(func, **kw): func(**kw) def proxy1(func, **kw): proxy2(func, **kw) --- The "proxy2(func, **kw)" call in proxy1() is currently inefficient: _PyFunction_FastCallDict() converts the dictionary into a C array [key1, value1, key2, value2, ...] and then _PyEval_EvalCodeWithName() rebuilds the dictionary from the C array. Since "func(*args, **kw)" proxies are common in Python, especially to call the parent constructor when overriding __init__, I think that it would be interesting to optimize this code path. I first expected that it was a regression of FASTCALL, but Python < 3.6 doesn't optimize this code neither. ---------- components: Interpreter Core messages: 285773 nosy: haypo, inada.naoki priority: normal severity: normal status: open title: Optimize _PyFunction_FastCallDict() for **kwargs type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 07:11:31 2017 From: report at bugs.python.org (Paul Moore) Date: Thu, 19 Jan 2017 12:11:31 +0000 Subject: [New-bugs-announce] [issue29319] Embedded 3.6.0 distribution cannot run pyz files Message-ID: <1484827891.73.0.559570067048.issue29319@psf.upfronthosting.co.za> New submission from Paul Moore: Trying to run a pyz file using the embedded distribution for 3.6.0, I get an error "Could not import runpy module". To reproduce, see below: >type .\__main__.py print('Hello, world') >zip test.pyz __main__.py adding: __main__.py (172 bytes security) (stored 0%) >unzip .\python-3.6.0-embed-amd64.zip ... >.\python.exe .\test.pyz Could not import runpy module ModuleNotFoundError: No module named 'runpy' Running with the standard interpreter works fine: >py -V Python 3.6.0 >py .\test.pyz Hello, world ---------- assignee: steve.dower components: Windows messages: 285783 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Embedded 3.6.0 distribution cannot run pyz files type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 07:53:40 2017 From: report at bugs.python.org (eszense) Date: Thu, 19 Jan 2017 12:53:40 +0000 Subject: [New-bugs-announce] [issue29320] bdist_msi install_script fail to execute if alt python location specified Message-ID: <1484830420.95.0.711337585743.issue29320@psf.upfronthosting.co.za> New submission from eszense: if install-script specified and alternative python location selected during installation, msiexec will fail with: "There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. This is due to the lack of PythonExeX Custom Action setting the path to python.exe Patch attacked for your consideration ---------- files: patch.txt messages: 285786 nosy: eszense priority: normal pull_requests: 18 severity: normal status: open title: bdist_msi install_script fail to execute if alt python location specified type: crash Added file: http://bugs.python.org/file46336/patch.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 09:26:43 2017 From: report at bugs.python.org (RK-5wWm9h) Date: Thu, 19 Jan 2017 14:26:43 +0000 Subject: [New-bugs-announce] [issue29321] Wrong documentation for unicode and str comparison Message-ID: <1484836003.73.0.224345826816.issue29321@psf.upfronthosting.co.za> New submission from RK-5wWm9h: PROBLEM (IN BRIEF): In the currently published 2.7.13 The Python Language Reference manual, section 5.9 "Comparisons" (https://docs.python.org/2/reference/expressions.html#comparisons): "If both are numbers, they are converted to a common type. Otherwise, objects of different types always compare unequal..." This an *incorrect (and misleading) statement*. PROPOSED FIX: Insert a new sentence, to give this resulting text: "If both are numbers, they are converted to a common type. If one is str and the other unicode, they are compared as below. Otherwise, objects of different types always compare unequal..." DETAILS, JUSTIFICATION, CORRECTNESS, ETC: The behaviour that a str and a unicode object -- despite being objects of different types -- may compare equal, is explicitly stated several paragraphs later: "* Strings are compared lexicographically using the numeric equivalents (the result of the built-in function ord()) of their characters. Unicode and 8-bit strings are fully interoperable in this behavior. [4]" Text in the 2.7.13 The Python Standard Library (Library Reference manual) is careful to cover this unicode - str case (https://docs.python.org/2/library/stdtypes.html#comparisons): "Objects of different types, except different numeric types and different string types, never compare equal; such objects are ordered consistently but arbitrarily (so that sorting a heterogeneous array yields a consistent result)." IMPACT AND RELATED BUG: The current incorrect text is really misleading for anyone reading the Language Ref. It's easy to see the categorical statement and stop reading because your question has been answered. Further, the Library ref about unicode and str (The Python Standard Library (Library Reference manual) section 5.6 "Sequence Types": https://docs.python.org/2/library/stdtypes.html#sequence-types-str-unicode-list-tuple-bytearray-buffer-xrange), links here. Link text: "(For full details see Comparisons in the language reference.)". (Aside: That paragraph has a mistake similar to this present bug: it says "to compare equal, every element must compare equal and the two sequences must be of the same type"; I'll file a separate bug for it.) PS: First time reporting a Python bug; following https://docs.python.org/2/bugs.html. Hope I did ok! :-) ---------- assignee: docs at python components: Documentation messages: 285790 nosy: RK-5wWm9h, docs at python priority: normal severity: normal status: open title: Wrong documentation for unicode and str comparison type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 09:39:52 2017 From: report at bugs.python.org (Michael J) Date: Thu, 19 Jan 2017 14:39:52 +0000 Subject: [New-bugs-announce] [issue29322] SimpleCV error on Raspberry Pi Message-ID: <1484836792.51.0.0433994997007.issue29322@psf.upfronthosting.co.za> New submission from Michael J: Hello, I'm using a Microsoft LifeCam with SimpleCV on the ipython interpreter(or shell) on a Raspberry Pi 3 model B(with Raspbian, tell me if you need the exact OS version as it's quite complicated). I'm following the directions of a book: Raspberry Pi Cookbook by Simon Monk. I get this error: SimpleCV:1> c = Camera() SimpleCV:2> i = c.getImage() SimpleCV:3> i SimpleCV:3: SimpleCV:4> SimpleCV:4> i.show() --------------------------------------------------------------------------- IOError Traceback (most recent call last) /usr/local/lib/python2.7/dist-packages/SimpleCV/Shell/Shell.pyc in () ----> 1 i.show() /usr/local/lib/python2.7/dist-packages/SimpleCV/ImageClass.pyc in show(self, type) 5445 d = Display(displaytype='notebook') 5446 else: -> 5447 d = Display(self.size()) 5448 self.save(d) 5449 return d /usr/local/lib/python2.7/dist-packages/SimpleCV/Display.pyc in __init__(self, resolution, flags, title, displaytype, headless) 156 if not displaytype == 'notebook': 157 self.screen = pg.display.set_mode(resolution, flags) --> 158 scvLogo = SimpleCV.Image("simplecv").scale(32,32) 159 pg.display.set_icon(scvLogo.getPGSurface()) 160 if flags != pg.FULLSCREEN and flags != pg.NOFRAME: /usr/local/lib/python2.7/dist-packages/SimpleCV/ImageClass.pyc in __init__(self, source, camera, colorSpace, verbose, sample, cv2image) 785 self._bitmap = cv.LoadImage(self.filename, iscolor=cv.CV_LOAD_IMAGE_COLOR) 786 except: --> 787 self._pil = pil.open(self.filename).convert("RGB") 788 self._bitmap = cv.CreateImageHeader(self._pil.size, cv.IPL_DEPTH_8U, 3) 789 cv.SetData(self._bitmap, self._pil.tostring()) /usr/local/lib/python2.7/dist-packages/PIL/Image.pyc in open(fp, mode) 2280 2281 if filename: -> 2282 fp = builtins.open(filename, "rb") 2283 2284 try: IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/SimpleCV/sampleimages/simplecv.png' I(Michael J or "MJ" as I'm commonly called) have searched for the directory myself, and I can tell you, it's not there. Tell me if you need more information, as I will be glad to assist. I'm sorry for any inconvenience caused by me using ipython if it's unfamiliar. ---------- components: IO messages: 285791 nosy: MJ priority: normal severity: normal status: open title: SimpleCV error on Raspberry Pi type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 09:40:31 2017 From: report at bugs.python.org (RK-5wWm9h) Date: Thu, 19 Jan 2017 14:40:31 +0000 Subject: [New-bugs-announce] [issue29323] Wrong documentation (Library) for unicode and str comparison Message-ID: <1484836831.64.0.870722472975.issue29323@psf.upfronthosting.co.za> New submission from RK-5wWm9h: PROBLEM (IN BRIEF): In the currently published 2.7.13 The Python Standard Library (Library Reference manual) section 5.6 "Sequence Types" (https://docs.python.org/2/library/stdtypes.html#sequence-types-str-unicode-list-tuple-bytearray-buffer-xrange): "to compare equal, ... the two sequences must be of the same type" This an *incorrect (and misleading) statement*, for the unicode and str case. PROPOSED FIX: Current full paragraph: "Sequence types also support comparisons. In particular, tuples and lists are compared lexicographically by comparing corresponding elements. This means that to compare equal, every element must compare equal and the two sequences must be of the same type and have the same length. (For full details see Comparisons in the language reference.)" Proposed replacement text: "Sequence types also support comparisons. In particular, tuples and lists are compared lexicographically by comparing corresponding elements. This means that to compare equal, every element must compare equal and the two sequences must be of the same type and have the same length. (Unicode and str are treated as the same type here; for full details see Comparisons in the language reference.)" DETAILS, JUSTIFICATION, CORRECTNESS, ETC: The current incorrect text is really misleading. The behaviour that a str and a unicode object -- despite being objects of different types -- may compare equal, is explicitly stated in the 2.7.13 The Python Language Reference manual, section 5.9 "Comparisons" (https://docs.python.org/2/reference/expressions.html#comparisons): "* Strings are compared lexicographically using the numeric equivalents (the result of the built-in function ord()) of their characters. Unicode and 8-bit strings are fully interoperable in this behavior. [4]" (Aside: Incidentally an earlier paragraph in the Language Ref fails to cover the unicode and str case; see separately filed bug Issue 29321.) ---------- assignee: docs at python components: Documentation messages: 285792 nosy: RK-5wWm9h, docs at python priority: normal severity: normal status: open title: Wrong documentation (Library) for unicode and str comparison type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 10:01:06 2017 From: report at bugs.python.org (Christian Heimes) Date: Thu, 19 Jan 2017 15:01:06 +0000 Subject: [New-bugs-announce] [issue29324] test_aead_aes_gcm fails on Kernel 4.9 Message-ID: <1484838066.61.0.93462051202.issue29324@psf.upfronthosting.co.za> New submission from Christian Heimes: $ ./python -m test -m test_aead_aes_gcm test_socket Run tests sequentially 0:00:00 [1/1] test_socket test test_socket failed -- Traceback (most recent call last): File "/home/heimes/dev/python/cpython/Lib/test/support/__init__.py", line 556, in wrapper return func(*args, **kw) File "/home/heimes/dev/python/cpython/Lib/test/test_socket.py", line 5515, in test_aead_aes_gcm res = op.recv(assoclen + len(plain) + taglen) OSError: [Errno 22] Invalid argument The tests were written and passed under Linux Kernel 4.7. I was under the assumption that the API is stable. But the most recent version 4.9 has changed the API for AEAD mode slightly. libkcapi project maintain a well written documentation of the Kernel crypto API, https://github.com/smuellerDD/libkcapi/commit/be242c387b7030cbccae2c183107efa86d9a3cd6 Fedora 24 and 25 are affected. I'm going to update the tests. Downstream distributors: Feel free to disable the test in the mean time. The feature is not critical. ---------- assignee: christian.heimes components: Extension Modules messages: 285794 nosy: christian.heimes priority: normal severity: normal status: open title: test_aead_aes_gcm fails on Kernel 4.9 type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 11:30:50 2017 From: report at bugs.python.org (Brian Vandenberg) Date: Thu, 19 Jan 2017 16:30:50 +0000 Subject: [New-bugs-announce] [issue29325] pysqlite: Evaluate removal of sqlite3_stmt_readonly Message-ID: <1484843450.51.0.0079411502064.issue29325@psf.upfronthosting.co.za> New submission from Brian Vandenberg: I'm not sure where to request changes to pysqlite, so my apologies if this isn't the right place. To begin with: I'll either end up building a newer version of sqlite myself or just accepting that pysqlite won't be part of this python installation. However, I thought it might be useful to know that use of the function "sqlite3_stmt_readonly" is the only thing tying pysqlite to the current minimum requirement to use sqlite 3.7.4. The currently available 'supported' version of sqlite for RHEL6 is 3.6.x and there's likely others out there who (for whatever reason) are stuck on an older release of sqlite and moving to the latest & greatest OS isn't [currently] feasible. ---------- components: Extension Modules messages: 285804 nosy: phantal priority: normal severity: normal status: open title: pysqlite: Evaluate removal of sqlite3_stmt_readonly type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 11:54:32 2017 From: report at bugs.python.org (Steve Dower) Date: Thu, 19 Jan 2017 16:54:32 +0000 Subject: [New-bugs-announce] [issue29326] Blank lines in ._pth file are not ignored Message-ID: <1484844872.11.0.819349056222.issue29326@psf.upfronthosting.co.za> New submission from Steve Dower: If a python._pth file includes a blank line, it gets treated as '\n' which is then appended to the directory and used as an entry in sys.path. Empty lines should be ignored completely. ---------- components: Windows messages: 285809 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: low severity: normal stage: needs patch status: open title: Blank lines in ._pth file are not ignored type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 12:31:08 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 19 Jan 2017 17:31:08 +0000 Subject: [New-bugs-announce] [issue29327] SystemError in sorted(iterable=[]) Message-ID: <1484847068.03.0.460461228187.issue29327@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: In Python 3.6: >>> sorted(iterable=[]) Traceback (most recent call last): File "", line 1, in SystemError: Objects/tupleobject.c:81: bad argument to internal function In Python 3.5 and 2.7: >>> sorted(iterable=[]) Traceback (most recent call last): File "", line 1, in TypeError: 'iterable' is an invalid keyword argument for this function ---------- components: Interpreter Core keywords: 3.6regression messages: 285817 nosy: serhiy.storchaka priority: normal severity: normal status: open title: SystemError in sorted(iterable=[]) type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 13:24:32 2017 From: report at bugs.python.org (Elizabeth Myers) Date: Thu, 19 Jan 2017 18:24:32 +0000 Subject: [New-bugs-announce] [issue29328] struct module should support variable-length strings Message-ID: <1484850272.25.0.472309940141.issue29328@psf.upfronthosting.co.za> New submission from Elizabeth Myers: There was some discussion on python-ideas about this, and I figured it would be more productive to bring it here since to me this appears to be a glaring omission. The struct module has no capability to support variable-length strings; this includes null-terminated and Pascal-ish strings with a different integer datatype (usually in binary) specifying length. This unfortunate omission makes the struct module extremely unwieldy to use in situations where you need to unpack a lot of variable-length strings, especially iteratively; see https://mail.python.org/pipermail/python-ideas/2017-January/044328.html for why. For zero-terminated strings, it is essentially impossible. It's worth noting many modern protocols use variable-length strings, including DHCP. I therefore propose the following extensions to the struct module (details can be bikeshedded over :P): - Z (uppercase) format specifier (I did not invent this idea, see https://github.com/stendec/netstruct - although that uses $), which states the preceding whole-number datatype is the length of a string that follows. - z (lowercase) format specifier, which specifies a null-terminated (also known as C style) string. An optional length parameter can be added to specify the maximum search length. These two additions will make the struct module much more usable in a wider variety of contexts. ---------- components: Library (Lib) messages: 285828 nosy: Elizacat priority: normal severity: normal status: open title: struct module should support variable-length strings type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 13:55:38 2017 From: report at bugs.python.org (=?utf-8?q?Pekka_Kl=C3=A4rck?=) Date: Thu, 19 Jan 2017 18:55:38 +0000 Subject: [New-bugs-announce] [issue29329] Incorrect documentation for custom `hex()` support on Python 2 Message-ID: <1484852138.82.0.311515909069.issue29329@psf.upfronthosting.co.za> New submission from Pekka Kl?rck: Documentation of `hex()` on Python 2 says that custom objects need to implement `__index__` to support it. Based on my tests that doesn't work but `__hex__` is needed instead. Docs are at https://docs.python.org/2/library/functions.html?highlight=hex#hex and here's an example session: Python 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> class Hex(object): ... def __index__(self): ... return 255 ... >>> hex(Hex()) Traceback (most recent call last): File "", line 1, in TypeError: hex() argument can't be converted to hex >>> >>> class Hex(object): ... def __hex__(self): ... return hex(255) ... >>> hex(Hex()) '0xff' Assuming this is fixed, should probably note that with Python 3 you actually *need* to implement `__index__` and `__hex__` has no effect. ---------- messages: 285832 nosy: pekka.klarck priority: normal severity: normal status: open title: Incorrect documentation for custom `hex()` support on Python 2 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 19 17:30:40 2017 From: report at bugs.python.org (saumitra paul) Date: Thu, 19 Jan 2017 22:30:40 +0000 Subject: [New-bugs-announce] [issue29330] __slots__ needs documentation Message-ID: <1484865040.1.0.923136956691.issue29330@psf.upfronthosting.co.za> New submission from saumitra paul: As you said..assiging it to you :) ---------- messages: 285850 nosy: rhettinger, saumitra1978 priority: normal severity: normal status: open title: __slots__ needs documentation versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 20 01:59:39 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 20 Jan 2017 06:59:39 +0000 Subject: [New-bugs-announce] [issue29331] Simplify argument parsing in sorted() and list.sort() Message-ID: <1484895579.74.0.0168401872287.issue29331@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Proposed patch simplifies argument parsing in sorted() and list.sort(). list.sort() now uses the support of keyword-only parameters in PyArg_ParseTupleAndKeywords(). Keyword arguments now are passed as is to list.sorted() in sorted(). ---------- components: Interpreter Core files: sort-arg-parse.patch keywords: patch messages: 285887 nosy: haypo, rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Simplify argument parsing in sorted() and list.sort() type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46351/sort-arg-parse.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 20 03:29:05 2017 From: report at bugs.python.org (Wen Adam) Date: Fri, 20 Jan 2017 08:29:05 +0000 Subject: [New-bugs-announce] [issue29332] Uniform SelectSelector._select behavior Message-ID: <1484900945.96.0.01738502245.issue29332@psf.upfronthosting.co.za> New submission from Wen Adam: SelectSelector._select is differently on different platforms. On win32, SelectSelector._select is a unbound/bound method and pass instance as the first argument, but on *nix, SelectSelector._select is a builtin_function_or_method(Although self.select still works) If someone want to replace(or patch) select, he must implement two select function(one is a function, the other is a instance method), Otherwise you will get?TypeError: select() takes at most 4 arguments (5 given)?. And I think make built-in funtion(like len, select.select) as a class attr/method is a black magic(it's still a function) and hard to maintain ---------- components: Library (Lib) files: uniform_select_behaviour.patch keywords: patch messages: 285891 nosy: Wen Adam, neologix priority: normal severity: normal status: open title: Uniform SelectSelector._select behavior type: behavior versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46352/uniform_select_behaviour.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 20 06:50:36 2017 From: report at bugs.python.org (Gereon Kaiping) Date: Fri, 20 Jan 2017 11:50:36 +0000 Subject: [New-bugs-announce] [issue29333] ConfigParser calls Interpolation.before_read after reading Message-ID: <1484913036.08.0.781257093151.issue29333@psf.upfronthosting.co.za> New submission from Gereon Kaiping: In its current implementation, `ConfigParser` calls its Interpolation's `before_read` method in the very last step of `_read`, when all properties have already been overwritten by their new uninterpolated values. I am developing a program with modular config files: It is possible to supply several configuration files on the command line, and they are all fed through the `.read` method. Now it would be amazing to use `read` time interpolation instead of `get` time interpolation to construct things like outputfilename = %(outputfilename)s_extension_from_this_ini_module By looking at the `Interpolation` class, it seems that behaviour like this should be supported by supplying a `before_read` as follows. def before_read(self, parser, section, option, value): L = [] interpolations = parser[section] self._interpolate_some( parser, option, L, value, section, interpolations, 1) return ''.join(L) However, this is not possible, because `before_read` is only called *after* all values in the config file have been read and all old values in the ConfigParser object have been overridden. The attached file contains a subclass of `BasicInterpolation` and a subclass of `ConfigParser` which in concert allow me to write recursive property definitions as given above. The downside of this change is that (a) interpolation values can't be defined *after* they are used any more, and (b) it is not possible to hack this parser to accept multi-line option names as interpolations. (To me personally, both of these don't sound like useful features to begin with.) ---------- files: earlyinterpolation.py messages: 285902 nosy: Anaphory priority: normal severity: normal status: open title: ConfigParser calls Interpolation.before_read after reading Added file: http://bugs.python.org/file46355/earlyinterpolation.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 20 07:13:47 2017 From: report at bugs.python.org (Greg Stark) Date: Fri, 20 Jan 2017 12:13:47 +0000 Subject: [New-bugs-announce] [issue29334] ssl.SSLObject method getpeercert() is buggy, do_handshake() is strange Message-ID: <1484914427.68.0.380715465195.issue29334@psf.upfronthosting.co.za> New submission from Greg Stark: In my experiments with the relatively new class SSLObject from the ssl module I've noticed the following behavior(s) which I think can be described as bugs. The getpeercert() method raises a ValueError exception "handshake not done" even after the handshake has successfully completed. If, however, I call the do_handshake() method *after* the handshake completes, then getpeercert() correctly runs and returns the peer's certificate. So now let's focus on do_handshake(). This method is basically undocumented, which I thought was ok because what it does should be obvious. It does seem to initiate a handshake if it's the first method call after the SSLObject is created. If called afterward, it doesn't outwardly appear to do anything, but as mentioned previously it does magically make the getpeercert() method start working. ---------- assignee: christian.heimes components: SSL messages: 285903 nosy: Greg Stark, christian.heimes priority: normal severity: normal status: open title: ssl.SSLObject method getpeercert() is buggy, do_handshake() is strange type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 20 15:48:08 2017 From: report at bugs.python.org (Zach Riggle) Date: Fri, 20 Jan 2017 20:48:08 +0000 Subject: [New-bugs-announce] [issue29335] Python 2.7 subprocess module does not check WIFSTOPPED on SIGCHLD Message-ID: <1484945288.47.0.935636853008.issue29335@psf.upfronthosting.co.za> New submission from Zach Riggle: The attached script hits some "This should never happen" code in the subprocess module. These lines here: https://github.com/python/cpython/blob/2.7/Lib/subprocess.py#L1036-L1038 The root cause is a lack of checking WIFSTOPPED and WSTOPSIG in the handler. When a process elects into being ptraced via PTRACE_TRACEME, it is stopped on the SIGSEGV instead of terminating, allowing the user to attach a debugger before the kernel destroys the process. This bug makes it impossible to wait on any process which crashes, which is set up to wait for a debugger. ---------- components: Library (Lib) files: bug.py messages: 285921 nosy: Zach Riggle priority: normal severity: normal status: open title: Python 2.7 subprocess module does not check WIFSTOPPED on SIGCHLD versions: Python 2.7 Added file: http://bugs.python.org/file46363/bug.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 20 22:30:45 2017 From: report at bugs.python.org (INADA Naoki) Date: Sat, 21 Jan 2017 03:30:45 +0000 Subject: [New-bugs-announce] [issue29336] merge tuples in module Message-ID: <1484969445.33.0.406694538272.issue29336@psf.upfronthosting.co.za> New submission from INADA Naoki: Tuples consists of None, True, False, str and bytes can be merged safely. To avoid memory leak, this patch shares such tuples in compile unit (module, in most case.) ---------- files: merge-tuples.patch keywords: patch messages: 285933 nosy: haypo, inada.naoki priority: normal severity: normal status: open title: merge tuples in module Added file: http://bugs.python.org/file46366/merge-tuples.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 21 02:09:46 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 21 Jan 2017 07:09:46 +0000 Subject: [New-bugs-announce] [issue29337] BytesWarning at compile time Message-ID: <1484982586.78.0.422468246503.issue29337@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: BytesWarning can be raised during compilation. $ ./python -Wa -b -c "lambda: 'a'; lambda: b'a'" sys:1: BytesWarning: Comparison between bytes and string sys:1: BytesWarning: Comparison between bytes and string sys:1: BytesWarning: Comparison between bytes and string sys:1: BytesWarning: Comparison between bytes and string _PyCode_ConstantKey() should produce keys that don't allow comparing bytes with strings nested in tuples or frozensets. Currently it returns (tuple, ('a',), ((str, 'a'),)) for ('a',) and (tuple, (b'a',), ((bytes, b'a'),)) for (b'a',). Key tuples have the same size and the same first element. Comparing second elements emits a BytesWarning. ---------- components: Interpreter Core messages: 285940 nosy: haypo, inada.naoki, serhiy.storchaka priority: normal severity: normal status: open title: BytesWarning at compile time type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 21 04:42:36 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 21 Jan 2017 09:42:36 +0000 Subject: [New-bugs-announce] [issue29338] Output the text signature in the help of a class Message-ID: <1484991756.99.0.970269270756.issue29338@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Pydoc outputs the text signature for C functions. It defines parameters and default values and is a part of function description. Help on built-in function format in module builtins: format(value, format_spec='', /) Return value.__format__(format_spec) format_spec defaults to the empty string When builtin or extension class is converted to Argument Clinic, the generated docstring and text signature of __new__ or __init__ methods usually is used as class docstring and text signature. But pydoc doesn't output the text signature for classes. The important part of information is lost. For example, for just converted builtin enumerate class: Help on class enumerate in module builtins: class enumerate(object) | Return an enumerate object. | | iterable | an object supporting iteration | | The enumerate object yields pairs containing a count (from start, which | defaults to zero) and a value yielded by the iterable argument. | | enumerate is useful for obtaining an indexed list: | (0, seq[0]), (1, seq[1]), (2, seq[2]), ... | | Methods defined here: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __iter__(self, /) | Implement iter(self). | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | __next__(self, /) | Implement next(self). | | __reduce__(...) | Return state information for pickling. The iterable and start parameters of the constructor are referred but not defined. ---------- components: Argument Clinic, Library (Lib) messages: 285946 nosy: larry, ncoghlan, rhettinger, serhiy.storchaka, yselivanov priority: normal severity: normal status: open title: Output the text signature in the help of a class type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 21 17:56:15 2017 From: report at bugs.python.org (12345 67890) Date: Sat, 21 Jan 2017 22:56:15 +0000 Subject: [New-bugs-announce] [issue29339] Interactive: Move to same indentation level as previous line Message-ID: <1485039375.56.0.473197770315.issue29339@psf.upfronthosting.co.za> New submission from 12345 67890: Not sure if anyone has ever thought about this, but it would be nice if the interactive interpreter set the same indentation level as the previous line. Of course this isn't urgent, but what do others think? ---------- messages: 285970 nosy: 12345 67890 priority: normal severity: normal status: open title: Interactive: Move to same indentation level as previous line type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 21 18:37:20 2017 From: report at bugs.python.org (Nick Sweeting) Date: Sat, 21 Jan 2017 23:37:20 +0000 Subject: [New-bugs-announce] [issue29340] SSL destructor segfaults in python3.6 threads when an unverified-cert connection is closed Message-ID: <1485041840.84.0.00558025824464.issue29340@psf.upfronthosting.co.za> New submission from Nick Sweeting: I mistakenly thought this bug was a pyOpenSSL bug, so I reported it there (https://github.com/pyca/pyopenssl/issues/588), but it looks like this is actually a bug in CPython. See the link for a nicer formatted bug report with more details. Code to reproduce: https://gist.github.com/pirate/6649314e02384274b29e04364c9d0c16 Crash dump: https://gist.github.com/pirate/e1485110093d2d9fc49596e6ff481777 Description: The bug is a segmentation fault when closing several secure websockets from inside concurrent python3.6 threads: ```pythohn 'python3.6 libssl_bug.py' terminated by signal SIGSEGV (Address boundary error) ``` It does not occur when doing it in a single thread, only when closing multiple threads at once. ```python threads = [] for _ in range(NUM_THREADS): t = SocketThread('wss://echo.websocket.org/', ssl_opt={'cert_reqs': 0}) t.start() threads.append(t) sleep(4) for t in threads: t.keep_running = False t.ws.close() # libssl segfaults on python3.6 when closing a wss:// connection with cert_reqs=0 t.join() ``` This is my first python bug report, so apologies if I didn't get the formatting right or if I'm missing some info. ---------- assignee: christian.heimes components: SSL, macOS files: libssl_bug.py messages: 285971 nosy: Nick Sweeting, christian.heimes, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: SSL destructor segfaults in python3.6 threads when an unverified-cert connection is closed type: crash versions: Python 3.6 Added file: http://bugs.python.org/file46375/libssl_bug.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 22 00:47:41 2017 From: report at bugs.python.org (Xiang Zhang) Date: Sun, 22 Jan 2017 05:47:41 +0000 Subject: [New-bugs-announce] [issue29341] Missing accepting path-like object in docstrings of os module functions Message-ID: <1485064061.59.0.597221589705.issue29341@psf.upfronthosting.co.za> New submission from Xiang Zhang: PathLike objects are added in 3.6 and they are mentioned in the documentation. But in some os module functions' docstrings, acceptable types of path parameter are mentioned and they are not altered to mention path-like object. For example: chown(path, uid, gid, *, dir_fd=None, follow_symlinks=True) Change the owner and group id of path to the numeric uid and gid.\ path Path to be examined; can be string, bytes, or open-file-descriptor int. ---------- messages: 285988 nosy: xiang.zhang priority: normal severity: normal status: open title: Missing accepting path-like object in docstrings of os module functions versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 22 06:20:17 2017 From: report at bugs.python.org (Marian Beermann) Date: Sun, 22 Jan 2017 11:20:17 +0000 Subject: [New-bugs-announce] [issue29342] os.posix_fadvise misreports errors Message-ID: <1485084017.58.0.131551905677.issue29342@psf.upfronthosting.co.za> New submission from Marian Beermann: It has been observed that posix_fadvise will not report the original error if the syscall fails. Eg. https://bugs.alpinelinux.org/issues/6592 >>> os.posix_fadvise(-1, 0, 0, os.POSIX_FADV_DONTNEED) Traceback (most recent call last): File "", line 1, in OSError: [Errno 0] Error Should report EBADF >>> os.posix_fadvise(16, 0, 0, os.POSIX_FADV_DONTNEED) Traceback (most recent call last): File "", line 1, in OSError: [Errno 0] Error Ditto >>> os.posix_fadvise(0, 0, 0, 12345) Traceback (most recent call last): File "", line 1, in OSError: [Errno 0] Error Should be EINVAL ... This might be because unlike most syscall wrappers posix_fadvise does not set errno but only returns it. ---------- components: IO, Library (Lib) messages: 286002 nosy: enkore priority: normal severity: normal status: open title: os.posix_fadvise misreports errors versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 22 07:11:57 2017 From: report at bugs.python.org (Christian Heimes) Date: Sun, 22 Jan 2017 12:11:57 +0000 Subject: [New-bugs-announce] [issue29343] sock.close() raises OSError EBADF when socket's fd is closed Message-ID: <1485087117.22.0.587639771074.issue29343@psf.upfronthosting.co.za> New submission from Christian Heimes: In Python 3.6 the behavior of socket's close method has changed. In Python 2.7, 3.5 and earlier, socket.close() ignored EBADF. Starting with Python 3.6 socket.close() raises an OSError exception when its internal fd has been closed. Python 2.7.12 (default, Sep 29 2016, 12:52:02) [GCC 6.2.1 20160916 (Red Hat 6.2.1-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os, socket >>> sock = socket.socket() >>> os.close(sock.fileno()) >>> sock.close() Python 3.5.2 (default, Sep 14 2016, 11:28:32) [GCC 6.2.1 20160901 (Red Hat 6.2.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> sock = socket.socket() >>> import os, socket >>> os.close(sock.fileno()) >>> sock.close() Python 3.6.0+ (3.6:ea0c488b9bac, Jan 14 2017, 14:08:17) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import os, socket >>> sock = socket.socket() >>> os.close(sock.fileno()) >>> sock.close() Traceback (most recent call last): File "", line 1, in File "/home/heimes/dev/python/python36/lib/python3.6/socket.py", line 417, in close self._real_close() File "/home/heimes/dev/python/python36/lib/python3.6/socket.py", line 411, in _real_close _ss.close(self) OSError: [Errno 9] Bad file descriptor Abstraction layers such as the socket class should ignore EBADF in close(). A debug message or a warning is ok, but an exception is wrong. Even the man page for close discourages it, http://man7.org/linux/man-pages/man2/close.2.html Note, however, that a failure return should be used only for diagnostic purposes (i.e., a warning to the application that there may still be I/O pending or there may have been failed I/O) or remedial purposes (e.g., writing the file once more or creating a backup). ---------- components: Library (Lib) keywords: 3.6regression messages: 286004 nosy: christian.heimes priority: normal severity: normal status: open title: sock.close() raises OSError EBADF when socket's fd is closed type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 22 09:09:45 2017 From: report at bugs.python.org (Jeremy Bustamante) Date: Sun, 22 Jan 2017 14:09:45 +0000 Subject: [New-bugs-announce] [issue29344] sock_recv not detected a coroutine Message-ID: <1485094185.41.0.725056014669.issue29344@psf.upfronthosting.co.za> New submission from Jeremy Bustamante: Documemtation says sock_recv is a coroutine https://docs.python.org/3.6/library/asyncio-eventloop.html#low-level-socket-operations But following code says it isnt: import asyncio loop = asyncio.get_event_loop() asyncio.iscoroutinefunction(loop.sock_recv) False asyncio.iscoroutine(loop.sock_recv) False ---------- components: asyncio messages: 286011 nosy: Jeremy Bustamante, gvanrossum, yselivanov priority: normal severity: normal status: open title: sock_recv not detected a coroutine type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 22 12:02:49 2017 From: report at bugs.python.org (Just a Person) Date: Sun, 22 Jan 2017 17:02:49 +0000 Subject: [New-bugs-announce] [issue29345] More lost updates with multiprocessing.Value and .Array Message-ID: <1485104569.63.0.130882514769.issue29345@psf.upfronthosting.co.za> New submission from Just a Person: Lately, I have been having trouble using the multiprocessing library's shared memory on Windows. Often, updating the .value property seems to fail for no reason. As shown in the attached video, changing ```if __name__ == '__main__':``` in the sample code from the documentation to ```if True:``` causes the program to not work. This issue does not arise under Linux as far as I can tell (testing the same code). Any explanation/fix would be helpful. ---------- components: Windows files: 2017-01-22-1140-25.mp4 messages: 286015 nosy: Just a Person, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: More lost updates with multiprocessing.Value and .Array type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file46380/2017-01-22-1140-25.mp4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 22 12:47:34 2017 From: report at bugs.python.org (Eli Collins) Date: Sun, 22 Jan 2017 17:47:34 +0000 Subject: [New-bugs-announce] [issue29346] datetime.utcfromtimestamp() returns strange result for very large values Message-ID: <1485107254.51.0.0185006280427.issue29346@psf.upfronthosting.co.za> New submission from Eli Collins: I've found an odd behavior when passing very large values to ``datetime.datetime.utcfromtimestamp()`` and ``.fromtimestamp()`` under python 3.6. Under python 3.5, ``utcfromtimestamp(1<<40)`` would throw a ValueError that the year was out of range. Under python 3.6, this now returns a datetime in year 36812 (which seems reasonable given the input). The unexpected behavior occurs when increasing the bits passed: ``utcfromtimestamp(1<<41)`` returns a datetime with a *smaller* year (6118). This pattern proceeds as the bits are increased, with the years increasing & then wrapping around again, up to the point where it exceeds time_t (at that point, python 3.6 throws the same OSError as 3.5). It looks to me like 3.6 dropped a bounds check somewhere, and is now truncating high bits off the resulting year? --- Attached is the "dump_timestamp_output.py" script that I was using to examine boundary behavior of utctimestamp() when I found this bug. System was running Linux Mint 18.1 x86_64, using the python 3.6.0 build from https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes (ubuntu's python 3.6.0 build also shows this behavior). ---------- components: Library (Lib) files: dump_timestamp_output.py messages: 286021 nosy: Eli Collins priority: normal severity: normal status: open title: datetime.utcfromtimestamp() returns strange result for very large values type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file46384/dump_timestamp_output.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 22 22:24:01 2017 From: report at bugs.python.org (Saida Dhanavath) Date: Mon, 23 Jan 2017 03:24:01 +0000 Subject: [New-bugs-announce] [issue29347] Python 2.7.8 is crashing while creating weakref for a given object. Message-ID: <1485141841.25.0.0993319189306.issue29347@psf.upfronthosting.co.za> New submission from Saida Dhanavath: We are using python 2.7.8 on Ubuntu 14.04 to host our services. In one of the crashes python interpreter got segmentation fault while initializing weakref for a given object. Please find snip of backtraces as given below. #0 0x00007f62aa86951a in clear_weakref (self=0x7f5a1ed17520) at Objects/weakrefobject.c:65 #1 proxy_dealloc (self=0x7f5a1ed17520) at Objects/weakrefobject.c:540 #2 0x00007f62aa869b8b in PyWeakref_NewProxy (ob=, callback=) at Objects/weakrefobject.c:855 #3 0x00007f62aa901e56 in weakref_proxy (self=, args=) at ./Modules/_weakref.c:73 #4 0x00007f62aa8a929b in call_function (oparg=, pp_stack=0x7f5d36661c90) at Python/ceval.c:4033 . . . Have tried to root cause the issue and found that PyWeakref_NewProxy at Objects/weakrefobject.c creates new isntance of PyWeakReference struct and does not intialize wr_prev and wr_next of new isntance. These pointers can have garbage and point to random memory locations. As per comment in the code there could be a race while creating new instance and some other thread could have created weakref by the time current thread returns from new_weakref function. If it finds weakref created, current thread destroys instance created by itself and uses the one created by some other thread. Python should not crash while destroying the isntance created in the same interpreter function. As per my understanding, both wr_prev and wr_next of PyWeakReference instance should be initialized to NULL to avoid segfault. ---------- components: Interpreter Core messages: 286044 nosy: dhanavaths priority: normal severity: normal status: open title: Python 2.7.8 is crashing while creating weakref for a given object. versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 23 01:39:24 2017 From: report at bugs.python.org (Tang Weizhi) Date: Mon, 23 Jan 2017 06:39:24 +0000 Subject: [New-bugs-announce] [issue29348] this comment 'iff' should be 'if'? Message-ID: <1485153564.45.0.440343066023.issue29348@psf.upfronthosting.co.za> New submission from Tang Weizhi: I think this comment 'if' should be more clearly, or 'iff' is the abbreviation of 'if and only if'? ---------- assignee: docs at python components: Documentation messages: 286051 nosy: Tangwz, docs at python priority: normal pull_requests: 20 severity: normal status: open title: this comment 'iff' should be 'if'? type: enhancement versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 23 04:41:21 2017 From: report at bugs.python.org (Jim Fasarakis-Hilliard) Date: Mon, 23 Jan 2017 09:41:21 +0000 Subject: [New-bugs-announce] [issue29349] Update old Python 2 code in Docs/tools/extensions/patchlevel.py Message-ID: <1485164481.25.0.457345760711.issue29349@psf.upfronthosting.co.za> New submission from Jim Fasarakis-Hilliard: There's a hidden Python 2 print call in the script that only gets reached after you move the Doc/ folder outside the main CPython directory and run `make html`. Additionally, an obsolete way of assuring a file gets closed is used (changed to use `with` statement). P.S: Tagged this with the Documentation component, maybe build is more applicable but I wasn't sure. ---------- assignee: docs at python components: Documentation files: patchlevel.patch keywords: patch messages: 286065 nosy: Jim Fasarakis-Hilliard, docs at python priority: normal severity: normal status: open title: Update old Python 2 code in Docs/tools/extensions/patchlevel.py type: behavior versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46387/patchlevel.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 23 05:26:05 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Mon, 23 Jan 2017 10:26:05 +0000 Subject: [New-bugs-announce] [issue29350] Add support of multiple signatures Message-ID: <1485167165.19.0.665694725089.issue29350@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Some functions can be described by the single signature. See examples in msg285647. Selected examples: dict.pop(key) dict.pop(key, default) type(obj) type(name, bases, mapping) range(stop) range(start, stop, step=1) min(iterable, *, key=identity) min(iterable, *, default, key=identity) min(*args, key=identity) I think the only way to resolve this problem is to add the support of multiple signatures in inspect, pydoc, Argument Clinic, etc. ---------- components: Library (Lib) messages: 286068 nosy: larry, rhettinger, serhiy.storchaka, yselivanov priority: normal severity: normal status: open title: Add support of multiple signatures type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 23 08:25:03 2017 From: report at bugs.python.org (Markus Gerstel) Date: Mon, 23 Jan 2017 13:25:03 +0000 Subject: [New-bugs-announce] [issue29351] absolute imports for logging Message-ID: <1485177903.18.0.43823292649.issue29351@psf.upfronthosting.co.za> New submission from Markus Gerstel: Running 'import logging' causes at minimum 46 failing 'open' and 12 failing 'stat' calls because python looks for packages inside python/Lib/logging which will never be there, in particular: sys, os, time, cStringIO, traceback, warnings, weakref, collections, codecs, thread, threading, atexit. The impact of this is limited when python is installed locally, but noticeable when run on a networked file system. How to reproduce: run $ strace python -c "import logging;" 2>&1 | grep ENOENT | grep "\/logging\/" How to fix: Add 'from __future__ import absolute_import' to all files in the logging directory. A relevant patch is attached. ---------- components: Library (Lib) files: 0001-absolute-import.patch keywords: patch messages: 286083 nosy: mgerstel priority: normal severity: normal status: open title: absolute imports for logging type: resource usage versions: Python 2.7 Added file: http://bugs.python.org/file46390/0001-absolute-import.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 23 11:49:16 2017 From: report at bugs.python.org (Akira Li) Date: Mon, 23 Jan 2017 16:49:16 +0000 Subject: [New-bugs-announce] [issue29352] provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences Message-ID: <1485190156.24.0.631194950251.issue29352@psf.upfronthosting.co.za> New submission from Akira Li: I've failed to find where the behavior for negative indices in s[i:j] expression (i, j < -len(s)) for standard sequences (str, list, etc) is formally defined. The observed behavior implemented in PySlice_GetIndicesEx(): If "len(s) + i" or "len(s) + j" is negative, use 0. [1] I don't see it in the docs. if (*start < 0) *start += length; if (*start < 0) *start = (*step < 0) ? -1 : 0; ... if (*stop < 0) *stop += length; if (*stop < 0) *stop = (*step < 0) ? -1 : 0; The tutorial mentions [2]: > out of range slice indexes are handled gracefully when used for > slicing" slice.indices() documentation says [3]: > Missing or out-of-bounds indices are handled in a manner consistent > with regular slices. Neither define it explicitly. The behavior for the upper boundary is defined explicitly [4]: > If *i* or *j* is greater than ``len(s)``, use ``len(s)`` I've added the documentation patch that defines the behavior for the lower boundary too. [1] Objects/sliceobject.c [2] Doc/tutorial/introduction.rst [3] Doc/reference/datamodel.rst [4] Doc/library/stdtypes.rst ---------- assignee: docs at python components: Documentation files: docs-negative-slice-indices.patch keywords: patch messages: 286098 nosy: akira, docs at python priority: normal severity: normal status: open title: provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences versions: Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46393/docs-negative-slice-indices.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 23 13:58:25 2017 From: report at bugs.python.org (brokenenglish) Date: Mon, 23 Jan 2017 18:58:25 +0000 Subject: [New-bugs-announce] [issue29353] Incorrect handling of HTTP response with "Content-Type: message/rfc822" header Message-ID: <1485197905.85.0.319696153354.issue29353@psf.upfronthosting.co.za> New submission from brokenenglish: Hello. I found a bug that causes incorrect handling of some values of "Content-Type" header. When you retrieve any URL with "Content-Type: message/rfc822" header, additional payload is added to HTTPMessage. In some cases it causes annoing warnings. Here is a code from packages requests and urllib3 that can cause warning output: 1. Checking and raising excpection in urllib3: https://github.com/shazow/urllib3/blob/0fb5e083b2adf7618db8c26e8e50206de09dd845/urllib3/util/response.py#L61-L66 2. The same code packaged in requests: https://github.com/kennethreitz/requests/blob/362da46e9a46da6e86e1907f03014384ab210151/requests/packages/urllib3/util/response.py#L61-L66 3. Logging the error to output: https://github.com/kennethreitz/requests/blob/362da46e9a46da6e86e1907f03014384ab210151/requests/packages/urllib3/connectionpool.py#L402-L407 The issue arises from the class email.feedparser.FeedParser that handles HTTP and email headers in the same way. So when it handles headers with the message with content-type "message/*" and some other, method _parsegen() tries to parse it like a message with another message (see comments to this condition: https://hg.python.org/cpython/file/tip/Lib/email/feedparser.py#l295). If headers-only argument is set to True, we can avoid some redundant checks on HTTP headers (see this condition: https://hg.python.org/cpython/file/tip/Lib/email/feedparser.py#l244). I read the comment above (https://hg.python.org/cpython/file/tip/Lib/email/feedparser.py#l241) but I am a newbie and I don't see any other solution to my problem for now. I can rewrite the patch if you show me a better way to fix this issue. A patch with the unit test is atached. ---------- files: rfc822_httpmessage_payload.patch keywords: patch messages: 286106 nosy: brokenenglish priority: normal severity: normal status: open title: Incorrect handling of HTTP response with "Content-Type: message/rfc822" header versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46395/rfc822_httpmessage_payload.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 23 16:50:38 2017 From: report at bugs.python.org (Elias Vanderstuyft) Date: Mon, 23 Jan 2017 21:50:38 +0000 Subject: [New-bugs-announce] [issue29354] Python 2.7.12: pydoc.help(lambda (a, ): lambda x: a) raises IndexError Message-ID: <1485208238.9.0.161996393795.issue29354@psf.upfronthosting.co.za> New submission from Elias Vanderstuyft: The following might be either a bug in the pydoc module or in the inspect module: $ python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pydoc >>> pydoc.help(lambda (a,): lambda x: a) # this fails Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/pydoc.py", line 1797, in __call__ self.help(request) File "/usr/lib/python2.7/pydoc.py", line 1844, in help else: doc(request, 'Help on %s:') File "/usr/lib/python2.7/pydoc.py", line 1581, in doc pager(render_doc(thing, title, forceload)) File "/usr/lib/python2.7/pydoc.py", line 1576, in render_doc return title % desc + '\n\n' + text.document(object, name) File "/usr/lib/python2.7/pydoc.py", line 363, in document if inspect.isroutine(object): return self.docroutine(*args) File "/usr/lib/python2.7/pydoc.py", line 1321, in docroutine args, varargs, varkw, defaults = inspect.getargspec(object) File "/usr/lib/python2.7/inspect.py", line 817, in getargspec args, varargs, varkw = getargs(func.func_code) File "/usr/lib/python2.7/inspect.py", line 791, in getargs args[i] = stack[0] IndexError: list index out of range >>> pydoc.help(lambda (a,): lambda x: x) # this succeeds >>> ---------- components: Library (Lib) messages: 286119 nosy: Elias Vanderstuyft priority: normal severity: normal status: open title: Python 2.7.12: pydoc.help(lambda (a,): lambda x: a) raises IndexError type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 23 23:38:13 2017 From: report at bugs.python.org (Ma Lin) Date: Tue, 24 Jan 2017 04:38:13 +0000 Subject: [New-bugs-announce] [issue29355] sqlite3: remove sqlite3_stmt_readonly() Message-ID: <1485232693.83.0.291296040478.issue29355@psf.upfronthosting.co.za> New submission from Ma Lin: In CPython 3.6.0, sqlite3 module uses sqlite3_stmt_readonly(), however this function is only available on SQLite 3.7.4+ (release on 2010-12-07). Then CPython 3.6.0 can not be compiled on RHEL6 (with SQLite 3.6.x), complaints: issue29098, issue29325. sqlite3_stmt_readonly() was introduced in 284676cf2ac8, it was used twice [1][2], but it seems that we can avoid using this function in both of them. [1] https://hg.python.org/cpython/file/3.6/Modules/_sqlite/cursor.c#l517 With palaviv's patches of issue28518, we can eliminate sqlite3_stmt_readonly() in here. [2] https://hg.python.org/cpython/file/3.6/Modules/_sqlite/cursor.c#l612 We can use the old way in here, the old way is even better IMO. This issue depends on issue28518. ---------- components: Library (Lib) messages: 286130 nosy: Ma Lin, berker.peksag, palaviv priority: normal severity: normal status: open title: sqlite3: remove sqlite3_stmt_readonly() type: enhancement versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 23 23:52:52 2017 From: report at bugs.python.org (=?utf-8?q?=C3=81d=C3=A1m_Szieberth?=) Date: Tue, 24 Jan 2017 04:52:52 +0000 Subject: [New-bugs-announce] [issue29356] TypeError by typing for Ellipsis Message-ID: <1485233572.17.0.570161775222.issue29356@psf.upfronthosting.co.za> New submission from ?d?m Szieberth: I would expect Ellipsis the same behavior as None in type hints instead of: TypeError: Union[arg, ...]: each arg must be a type. Got Ellipsis. ... would be much nicer than type(...) there. ---------- messages: 286134 nosy: ?d?m Szieberth priority: normal severity: normal status: open title: TypeError by typing for Ellipsis type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 02:14:54 2017 From: report at bugs.python.org (Elazar Gershuni) Date: Tue, 24 Jan 2017 07:14:54 +0000 Subject: [New-bugs-announce] [issue29357] New NamedTuple syntax silently ignores method definitions Message-ID: <1485242094.09.0.593682639878.issue29357@psf.upfronthosting.co.za> New submission from Elazar Gershuni: The following does not work as expected: ``` from typing import NamedTuple class A(NamedTuple): a: int def __repr__(self): return 'some A' def spam(self): print('spam!') >>> a = A(5) >>> repr(a) # should be 'some A' 'A(a=5)' >>> a.spam() Traceback (most recent call last): File "", line 1, in AttributeError: 'A' object has no attribute 'spam' ``` ---------- components: Library (Lib) messages: 286147 nosy: elazar, gvanrossum, rhettinger priority: normal severity: normal status: open title: New NamedTuple syntax silently ignores method definitions type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 03:25:29 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 24 Jan 2017 08:25:29 +0000 Subject: [New-bugs-announce] [issue29358] Add tp_fastnew and tp_fastinit to PyTypeObject, 15-20% faster object instanciation Message-ID: <1485246329.89.0.254567368952.issue29358@psf.upfronthosting.co.za> New submission from STINNER Victor: After #29259 "Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects", the two last slots which still use the (args: tuple, kwargs: dict) calling convention are tp_new and tp_init, two major slots to instanciate objects. I implemented tp_fastnew/tp_fastinit on top of the issue #29259 pull request (tp_fastcall). The implementation is a WIP, it's just complete enough to start benchmarking the code. Example of benchmarks on the two types currently optimized in my WIP fast_init branch, list and _asyncio.Future: --- haypo at smithers$ ./python -m perf timeit -s 'List=list' 'List()' --duplicate=100 --compare-to=../default-ref/python Median +- std dev: [ref] 81.9 ns +- 0.2 ns -> [fast_init] 69.3 ns +- 0.4 ns: 1.18x faster (-15%) haypo at smithers$ ./python -m perf timeit -s 'List=list' 'List((1,2,3))' --duplicate=100 --compare-to=../default-ref/python Median +- std dev: [ref] 137 ns +- 6 ns -> [fast_init] 107 ns +- 0 ns: 1.28x faster (-22%) haypo at smithers$ ./python -m perf timeit -s 'import _asyncio, asyncio; Future=_asyncio.Future; loop=asyncio.get_event_loop()' 'Future(loop=loop)' --compare-to=../default-ref/python Median +- std dev: [ref] 411 ns +- 20 ns -> [fast_init] 355 ns +- 18 ns: 1.16x faster (-14%) --- The speedup of tp_fastnew + tp_fastinit is between 1.16x faster and 1.28x faster. The question is now if it is worth it. Warning: The code is not fully optimized and is likely to have subtle bugs. The pull request is not ready for a review, but you may take a look if you would like to have an idea of the required changes. The most tricky changes are made in typeobject.c to support backward compatibility (call tp_new if tp_fastnew is not set) and stable API (support Python 3.6 PyTypeObject without the two slots). Note: tp_fastnew and tp_fastinit slots are the expected end of my large FASTCALL optimization project. ---------- components: Interpreter Core messages: 286151 nosy: haypo, inada.naoki, rhettinger, serhiy.storchaka, yselivanov priority: normal pull_requests: 23 severity: normal status: open title: Add tp_fastnew and tp_fastinit to PyTypeObject, 15-20% faster object instanciation type: performance versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 03:32:59 2017 From: report at bugs.python.org (Aivar Annamaa) Date: Tue, 24 Jan 2017 08:32:59 +0000 Subject: [New-bugs-announce] [issue29359] Deprecate string concatenation without plus Message-ID: <1485246779.15.0.108891177308.issue29359@psf.upfronthosting.co.za> New submission from Aivar Annamaa: How quickly will you notice the bug here: for sequence in ["Command", "MagicCommand", "Open", "Save", "SaveAs", "NewFile", "EditorTextCreated" "ShellCommand", "ShellInput", "ShowView", "HideView", "TextInsert", "TextDelete", ]: do_something(sequence) ? Given the title of the issue, its probably not so hard, but usually a list literal is not the first thing to suspect. Similar problem of missing comma may occur easily with multiline calls. If concatenation without plus was deprecated, these mistakes would be so easy to notice. ---------- messages: 286152 nosy: Aivar.Annamaa priority: normal severity: normal status: open title: Deprecate string concatenation without plus type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 03:49:44 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 24 Jan 2017 08:49:44 +0000 Subject: [New-bugs-announce] [issue29360] Don't check if all keys are strings in _PyStack_AsDict() Message-ID: <1485247784.31.0.540630884546.issue29360@psf.upfronthosting.co.za> New submission from STINNER Victor: While running the test suite on issues #29259 (tp_fastcall) and #29358 (tp_fastnew and tp_fastinit), a few test failed on the following assertion of _PyStack_AsDict(): assert(PyUnicode_CheckExact(key)); For example, test_dict calls dict(**{1: 2}) which must raise a TypeError. I'm not sure who is responsible to check if all keys are strings: _PyStack_AsDict(), PyArg_ParseXXX() or the final function? The check is already implemented in dict_init(), dict_update_common() calls PyArg_ValidateKeywordArguments(): >>> dict(**{1:2}) Traceback (most recent call last): File "", line 1, in TypeError: keyword arguments must be strings In Python 3.7, PyArg_ParseTupleAndKeywords(), _PyArg_ParseTupleAndKeywordsFast() and _PyArg_ParseStackAndKeywords() and PyArg_ValidateKeywordArguments() raise an error if a key of keyword argumens is not a string: if (!PyUnicode_Check(key)) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return cleanreturn(0, &freelist); } IMHO the CALL_FUNCTION_EX instruction and the FASTCALL calling convention must not check if all keys are string: the check must only be done in the function (which can be a type constructor like dict_init()), for performance. Almost all functions use one the PyArg_ParseXXX() function. Only very special cases like dict_init() use more specific code to handle keyword arguments. By the way, _PyObject_FastCallKeywords() already contains the following comment: /* kwnames must only contains str strings, no subclass, and all keys must be unique: these checks are implemented in Python/ceval.c and _PyArg_ParseStackAndKeywords(). */ Note: Technically, I know that it's possible to put non-string keys in a dictionary and in a type dictionary. PyPy (and other Python implementations?) don't support non-string in type dictionary. Do you know use cases where func(**kwargs) must accept non-string keys? At the end, this long issue is a simple patch replacing an assertion with a comment in _PyStack_AsDict(): see attached patch ;-) ---------- components: Interpreter Core files: pystack_asdict.patch keywords: patch messages: 286157 nosy: haypo priority: normal severity: normal status: open title: Don't check if all keys are strings in _PyStack_AsDict() versions: Python 3.7 Added file: http://bugs.python.org/file46403/pystack_asdict.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 04:56:41 2017 From: report at bugs.python.org (Reto Cavelti) Date: Tue, 24 Jan 2017 09:56:41 +0000 Subject: [New-bugs-announce] [issue29361] bug in pyserial: serialposix.py Message-ID: <1485251801.63.0.344501122232.issue29361@psf.upfronthosting.co.za> New submission from Reto Cavelti: bug in pyserial: serialposix.py line 50: # set custom divisor buf[6] = buf[7] / baudrate TypeError: integer argument expected, got float fix: do cast: buf[6] = int(buf[7] / baudrate) ---------- components: Library (Lib) messages: 286168 nosy: rc priority: normal severity: normal status: open title: bug in pyserial: serialposix.py type: crash versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 10:35:21 2017 From: report at bugs.python.org (STINNER Victor) Date: Tue, 24 Jan 2017 15:35:21 +0000 Subject: [New-bugs-announce] [issue29362] regrtest: don't fail immediately if a child does crash Message-ID: <1485272121.72.0.342410390691.issue29362@psf.upfronthosting.co.za> New submission from STINNER Victor: When regrtest is used with -jN, regrtest spawn child processes to run tests. If a child crashs, regrtest master process immedialtely fails. It would prefer to be able to continue to run following tests. It's not because a single test crashed that all tests would crash. Example of output when a crash occurs: ----------------- (...) 0:02:45 [118/404/3] test_bytes crashed -- running: test_multiprocessing_spawn (67 sec), test_io (54 sec), test_subprocess (76 sec) python: Objects/abstract.c:2186: _Py_CheckFunctionResult: Assertion `(callable != NULL) ^ (where != NULL)' failed. Fatal Python error: Aborted Current thread 0x00007f9210f11440 (most recent call first): File "/home/haypo/prog/python/git_cpython/Lib/unittest/case.py", line 177 in handle File "/home/haypo/prog/python/git_cpython/Lib/unittest/case.py", line 728 in assertRaises File "/home/haypo/prog/python/git_cpython/Lib/test/test_bytes.py", line 636 in test_maketrans (...) File "/home/haypo/prog/python/git_cpython/Lib/runpy.py", line 85 in _run_code File "/home/haypo/prog/python/git_cpython/Lib/runpy.py", line 193 in _run_module_as_main Traceback (most recent call last): File "/home/haypo/prog/python/git_cpython/Lib/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) (...) File "/home/haypo/prog/python/git_cpython/Lib/test/libregrtest/main.py", line 411, in run_tests run_tests_multiprocess(self) File "/home/haypo/prog/python/git_cpython/Lib/test/libregrtest/runtest_mp.py", line 221, in run_tests_multiprocess raise Exception(msg) Exception: Child error on test_bytes: Exit code -6 ----------------- ---------- components: Tests messages: 286194 nosy: haypo priority: normal severity: normal status: open title: regrtest: don't fail immediately if a child does crash type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 13:06:33 2017 From: report at bugs.python.org (Ethan Furman) Date: Tue, 24 Jan 2017 18:06:33 +0000 Subject: [New-bugs-announce] [issue29363] allow Python code to determine class help text Message-ID: <1485281193.78.0.719790622563.issue29363@psf.upfronthosting.co.za> New submission from Ethan Furman: >From issue29338, msg286139: -------------------------- It is easy to fix the [pydoc] test by adding missed lines. But I'm not sure that output the (correct) signature of enum classes makes the help better. Color(value, names=None, *, module=None, qualname=None, type=None, start=1) Ethan, what are your thoughts? ---------- components: Argument Clinic messages: 286199 nosy: ethan.furman, larry, ncoghlan, rhettinger, serhiy.storchaka, xiang.zhang, yselivanov priority: normal severity: normal status: open title: allow Python code to determine class help text type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 13:54:25 2017 From: report at bugs.python.org (Jason Matthew) Date: Tue, 24 Jan 2017 18:54:25 +0000 Subject: [New-bugs-announce] [issue29364] msilib Fetch raises MSIError rather than return None Message-ID: <1485284065.77.0.143549147327.issue29364@psf.upfronthosting.co.za> New submission from Jason Matthew: Fairly new to MSIs here. Working towards extracting the same information which is available via Orca graphical interfaces. I believe I've hit a bug within _msi.View class, namely the inability to safely determine the number of records in my result. Examples I've found depicting how to obtain query results lead me to believe _msi.View.Fetch() will return None if no more rows exist. My development using python 2.7.11, Windows 7 enterprise and 2.7.13, Windows Server 2016, has shown Fetch() will raise a msilib.MSIError when no more rows are available. MSIError is commonly used within msilib which means explicit error handling (or leniency in this case) may incorrectly suppress other error scenarios. Entering a bug with the hope either a patch addresses this issue or documentation can be updated to reflect proper usage. Example provided below. >>> import msilib >>> db = msilib.OpenDatabase("msi-1.0.0.8.msi", msilib.MSIDBOPEN_READONLY) >>> v = db.OpenView("select * from Property") >>> v.Execute(None) >>> while 1: ... r = v.Fetch() ... if not r:break ... print r.GetString(1) ... UpgradeCode WixSharp_UI_INSTALLDIR WixSharp_InstallDialogs WIXUI_INSTALLDIR Manufacturer ProductCode ProductLanguage ProductName ProductVersion SecureCustomProperties Traceback (most recent call last): File "", line 2, in _msi.MSIError: unknown error 103 ---------- components: Library (Lib) messages: 286204 nosy: Jason Matthew priority: normal severity: normal status: open title: msilib Fetch raises MSIError rather than return None type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 21:30:14 2017 From: report at bugs.python.org (Gregory P. Smith) Date: Wed, 25 Jan 2017 02:30:14 +0000 Subject: [New-bugs-announce] [issue29365] parallel make test or make install can fail building pgen when configure --enable-optimizations is used Message-ID: <1485311414.76.0.958809336193.issue29365@psf.upfronthosting.co.za> New submission from Gregory P. Smith: If you do a make -j12 test or make install before having run a separate 'make all' the build _can_ fail trying to build pgen. (it seems to be parallel make related, it won't always fail) Even if you have run a separate 'make all', the make test and make install steps are likely to rebuild a ton of stuff and rerun the profile generation stage. Making the suggested "make, make test, make install" process effectively useless or at least take 3x longer than it should. something along the lines of: oss/cpython$ make -j12 install gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/parsetok.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Objects/obmalloc.o Python/mysnprintf.o Python/pyctype.o Parser/tokenizer_pgen.o Parser/printgrammar.o Parser/pgenmain.o -lpthread -ldl -lutil -o Parser/pgen Parser/grammar1.o: In function `PyGrammar_LabelRepr': /home/gps/oss/cpython/build27/../2.7/Parser/grammar1.c:35: undefined reference to `__gcov_indirect_call_profiler' Parser/grammar1.o: In function `PyGrammar_FindDFA': /home/gps/oss/cpython/build27/../2.7/Parser/grammar1.c:13: undefined reference to `__gcov_indirect_call_profiler' Parser/grammar1.o:(.data+0x80): undefined reference to `__gcov_merge_add' Parser/grammar1.o: In function `_GLOBAL__sub_I_65535_0_PyGrammar_FindDFA': /home/gps/oss/cpython/build27/../2.7/Parser/grammar1.c:57: undefined reference to `__gcov_init' ... a bunch more similar errors omitted ... Parser/pgenmain.o: In function `_GLOBAL__sub_I_65535_0_Py_Exit': /home/gps/oss/cpython/build27/../2.7/Parser/pgenmain.c:173: undefined reference to `__gcov_init' collect2: error: ld returned 1 exit status make: *** [Parser/pgen] Error 1 make: *** Waiting for unfinished jobs.... Parser/pgen ../2.7/Grammar/Grammar Include/graminit.h Python/graminit.c make[2]: Parser/pgen: Command not found make[2]: *** [Include/graminit.h] Error 127 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory `/home/gps/oss/cpython/build27' make[1]: *** [build_all_generate_profile] Error 2 make[1]: Leaving directory `/home/gps/oss/cpython/build27' make: *** [profile-opt] Error 2 ---------- components: Build messages: 286223 nosy: gregory.p.smith priority: normal severity: normal status: open title: parallel make test or make install can fail building pgen when configure --enable-optimizations is used type: compile error versions: Python 2.7, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 24 21:43:12 2017 From: report at bugs.python.org (raylu) Date: Wed, 25 Jan 2017 02:43:12 +0000 Subject: [New-bugs-announce] [issue29366] os.listdir has inconsistent behavior when run on a non-directory Message-ID: <1485312192.81.0.934042138535.issue29366@psf.upfronthosting.co.za> New submission from raylu: According to https://github.com/python/cpython/blob/4ed71dae9d23a412f9f73d3a0b1f4be37543e49e/Lib/test/test_unicode_file_functions.py#L106 listdir can sometimes return FileNotFoundError on Windows. Tangentially related: https://hg.python.org/cpython/rev/385c2ec78f16 ---------- components: Library (Lib), Windows messages: 286225 nosy: paul.moore, raylu, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: os.listdir has inconsistent behavior when run on a non-directory _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 04:29:36 2017 From: report at bugs.python.org (STINNER Victor) Date: Wed, 25 Jan 2017 09:29:36 +0000 Subject: [New-bugs-announce] [issue29367] python-gdb: display wrapper_call() Message-ID: <1485336576.45.0.391174330106.issue29367@psf.upfronthosting.co.za> New submission from STINNER Victor: python-gdb.py handles various Python calls, but not descriptors. Attached patch adds code to display calls to wrapperobject objects. The patch adds the first "" line of the traceback: --- (gdb) py-bt Traceback (most recent call first): File "/home/haypo/prog/python/git_cpython/Lib/encodings/utf_8.py", line 41, in getregentry streamwriter=StreamWriter, File "/home/haypo/prog/python/git_cpython/Lib/encodings/__init__.py", line 122, in search_function entry = getregentry() --- I wrote this patch while working on the issue #29358. Object instanciation is full of wrappers. A better debugger helps to me understand my bugs ;-) Example to get such tracecback: --- haypo at selma$ gdb -args ./python -m test -v test_sys (gdb) b wrapper_call (gdb) run (gdb) py-bt Traceback (most recent call first): File "/home/haypo/prog/python/default/Lib/enum.py", line 66, in __init__ super().__init__() File "/home/haypo/prog/python/default/Lib/enum.py", line 117, in __prepare__ enum_dict = _EnumDict() File "/home/haypo/prog/python/default/Lib/enum.py", line 509, in class Enum(metaclass=EnumMeta): File "", line 205, in _call_with_frames_removed (...) --- I guess that the next step is to write a test ;-) ---------- files: gdb_wrapper_call.patch keywords: patch messages: 286233 nosy: haypo, inada.naoki priority: normal severity: normal status: open title: python-gdb: display wrapper_call() type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46411/gdb_wrapper_call.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 04:55:50 2017 From: report at bugs.python.org (Serhiy Storchaka) Date: Wed, 25 Jan 2017 09:55:50 +0000 Subject: [New-bugs-announce] [issue29368] Optimize unpickling list-like objects Message-ID: <1485338150.33.0.560817507263.issue29368@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: According to PEP 307 the extend method can be used for appending list items to the object. listitems Optional, and new in this PEP. If this is not None, it should be an iterator (not a sequence!) yielding successive list items. These list items will be pickled, and appended to the object using either obj.append(item) or obj.extend(list_of_items). This is primarily used for list subclasses, but may be used by other classes as long as they have append() and extend() methods with the appropriate signature. (Whether append() or extend() is used depends on which pickle protocol version is used as well as the number of items to append, so both must be supported.) Proposed patch makes the extend method be used in the APPENDS opcode. To avoid breaking existing code the use of the extend method is optional. Microbenchmark: $ ./python -m timeit -s "import pickle, collections; p = pickle.dumps(collections.deque([None]*10000), 4)" -- "pickle.loads(p)" Unpatched: 100 loops, best of 5: 2.02 msec per loop Patched: 500 loops, best of 5: 833 usec per loop ---------- components: Library (Lib) files: pickle-appends-extend.patch keywords: patch messages: 286237 nosy: alexandre.vassalotti, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Optimize unpickling list-like objects type: performance versions: Python 3.7 Added file: http://bugs.python.org/file46412/pickle-appends-extend.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 07:33:14 2017 From: report at bugs.python.org (INADA Naoki) Date: Wed, 25 Jan 2017 12:33:14 +0000 Subject: [New-bugs-announce] [issue29369] Use Py_IDENTIFIER in Python-ast.c Message-ID: <1485347594.14.0.436037009882.issue29369@psf.upfronthosting.co.za> New submission from INADA Naoki: While I'm looking Python's memory usage, I found some dicts which key is not interned "_fields", "_ast" and "__modules__". ---------- components: Interpreter Core files: ast-identifier.patch keywords: patch messages: 286244 nosy: inada.naoki priority: normal severity: normal status: open title: Use Py_IDENTIFIER in Python-ast.c versions: Python 3.7 Added file: http://bugs.python.org/file46413/ast-identifier.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 08:01:21 2017 From: report at bugs.python.org (=?utf-8?b?0JTQuNC70Y/QvSDQn9Cw0LvQsNGD0LfQvtCy?=) Date: Wed, 25 Jan 2017 13:01:21 +0000 Subject: [New-bugs-announce] [issue29370] "./configure --enable-optimizations && make install" does not install files in ${BINDIR} and ${LIBDIR} Message-ID: <1485349281.44.0.908942370293.issue29370@psf.upfronthosting.co.za> New submission from ????? ????????: With Python 3.5.3 "./configure --enable-shared && make install DESTDIR=/tmp/ZZ1" does install files in /tmp/ZZ1/usr/local/bin/ and /tmp/ZZ1/usr/local/bin/ . "./configure --enable-optimizations --enable-shared && make install DESTDIR=/tmp/ZZ2" does not install files in /tmp/ZZ2/usr/local/bin/ and /tmp/ZZ2/usr/local/bin/ . ---------- components: Installation messages: 286247 nosy: dilyan.palauzov priority: normal severity: normal status: open title: "./configure --enable-optimizations && make install" does not install files in ${BINDIR} and ${LIBDIR} type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 08:36:09 2017 From: report at bugs.python.org (Marco Buttu) Date: Wed, 25 Jan 2017 13:36:09 +0000 Subject: [New-bugs-announce] [issue29371] Typo in doctest documentation Message-ID: <1485351369.68.0.185486175403.issue29371@psf.upfronthosting.co.za> New submission from Marco Buttu: >From the doctest documentation [1]: "Symbolic names for the flags are supplied as module constants, which can be or'ed together and passed to various functions." Is there a typo in "...which can be or'ed together..."? Maybe "collected together"? [1] https://docs.python.org/3/library/doctest.html#option-flags ---------- assignee: docs at python components: Documentation messages: 286254 nosy: docs at python, marco.buttu priority: normal severity: normal status: open title: Typo in doctest documentation versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 11:03:44 2017 From: report at bugs.python.org (Lee Griffiths) Date: Wed, 25 Jan 2017 16:03:44 +0000 Subject: [New-bugs-announce] [issue29372] RotatingFileHandler rotates empty logfile if it emits a large string Message-ID: <1485360224.38.0.947637323441.issue29372@psf.upfronthosting.co.za> New submission from Lee Griffiths: If you write a really big string to an empty file, and that string is > maxBytes, then `RotatingFileHandler` (or even `BaseRotatingHandler`) will roll that empty file into the backup queue. I think it should instead use that empty file for the mega-string. By not doing so it "wastes" a slot in the backup queue. It's a very minor issue: I doubt it really happens IRL, but I noticed it when extending RotatingFileHandler in py2.7 to add gzip stuff and my test cases used a really small size (16 bytes!) Here's a test file: #!/usr/bin/env python3 # coding=utf-8 import logging import os import tempfile from logging.handlers import RotatingFileHandler class MockRecord(object): def __init__(self, msg): self.msg = msg self.stack_info = None self.exc_info = None self.exc_text = None def getMessage(self): return self.msg def test_file_rollover_from_mega_string(temp_dir_path): # This is a pretty weird test. # It tests that writing a huge string to a blank file causes the blank # file to be archived and the huge string written to the next log file. # # Normally the log files would have a large max bytes so we'd have to # be writing a giant string to an empty file for this to happen. # But, even if it does, it's what BaseRotatingHandler does, so... log_path = os.path.join(temp_dir_path, "mylog.log") handler = RotatingFileHandler(log_path, maxBytes=16, backupCount=5) handler.setFormatter(logging.Formatter()) with open(log_path) as log: assert log.read() == "" # ---------------------------------------------- handler.emit(MockRecord("There once was a test from bitbucket")) with open(log_path) as log: log_read = log.read() assert log_read == "There once was a test from bitbucket\n" with open(log_path + ".1") as log: log_read = log.read() assert log_read == "" # ---------------------------------------------- handler.emit(MockRecord("11 chars")) with open(log_path) as log: log_read = log.read() assert log_read == "11 chars\n" with open(log_path + ".1") as log: log_read = log.read() assert log_read == "There once was a test from bitbucket\n" with open(log_path + ".2") as log: log_read = log.read() assert log_read == "" handler.close() test_file_rollover_from_mega_string(tempfile.mkdtemp()) and here's a patch that I think will fix it: ~/src/others/cpython (master *%=)$ cat empty_rollover.patch diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 7d77973..0dabfd7 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -186,7 +186,11 @@ class RotatingFileHandler(BaseRotatingHandler): if self.maxBytes > 0: # are we rolling over? msg = "%s\n" % self.format(record) self.stream.seek(0, 2) #due to non-posix-compliant Windows feature - if self.stream.tell() + len(msg) >= self.maxBytes: + size = self.stream.tell() + if size == 0: + # No point rolling-over an empty file + return 0 + elif size + len(msg) >= self.maxBytes: return 1 return 0 ---------- components: Library (Lib) messages: 286265 nosy: Poddster, vinay.sajip priority: normal severity: normal status: open title: RotatingFileHandler rotates empty logfile if it emits a large string type: resource usage versions: Python 2.7, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 12:21:16 2017 From: report at bugs.python.org (Zac Medico) Date: Wed, 25 Jan 2017 17:21:16 +0000 Subject: [New-bugs-announce] [issue29373] subprocess.Popen os.close(p2cread) in _execute_child can cause garbage collection of self.stdout to close a reused file descriptor Message-ID: <1485364876.35.0.214175144503.issue29373@psf.upfronthosting.co.za> New submission from Zac Medico: In Popen _execute_child method, os.close(p2cread) closes a file descriptor which is referenced by self.stdout with closefd=True, created by this code: self.stdout = io.open(c2pread, 'rb', bufsize) When self.stdout is finally garbage collected, it can close a file descriptor which has been reused since the os.close(p2cread) call. In the rare cases when this happens, it results in a traceback like the following: Traceback (most recent call last): File "/usr/lib64/python3.4/subprocess.py", line 1418, in _execute_child part = _eintr_retry_call(os.read, errpipe_read, 50000) File "/usr/lib64/python3.4/subprocess.py", line 491, in _eintr_retry_call return func(*args) OSError: [Errno 9] Bad file descriptor I have observed this issue with python 3.4.5, and the code flaw also appears to be present in 3.5, 3.6, and 3.7. This sort of garbage collection issue has been highlighted in the first comment of http://bugs.python.org/issue16140, but there is still a remaining problem with this os.close(p2cread) call. ---------- messages: 286268 nosy: zmedico priority: normal severity: normal status: open title: subprocess.Popen os.close(p2cread) in _execute_child can cause garbage collection of self.stdout to close a reused file descriptor versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 12:25:31 2017 From: report at bugs.python.org (Petr MOTEJLEK) Date: Wed, 25 Jan 2017 17:25:31 +0000 Subject: [New-bugs-announce] [issue29374] Doc bug: signal.sigwait and signal.sigtimedwait do not work outside the Main thread Message-ID: <1485365131.36.0.15146613889.issue29374@psf.upfronthosting.co.za> New submission from Petr MOTEJLEK: Hi, The documentation for signal.signal() clearly states that it is only supposed to be called on MainThread However, it does not say so for the signal.sigwait() and neither signal.sigtimedwait() I think this is an error on the documentation side of things (unless I misread it). When either signal.sigwait or signal.sigtimedwait are called outside MainThread, they simply never catch any signals (signal.sigwait blocks indefinitely) I did not test this on Windows, but on both Linux and OS X the behavior is the same Consider the below simple code import signal import os def sigwait(): print("Send me a signal, my PID is {p}".format(p=os.getpid())) print("Got the signal: {i}".format(i=signal.sigwait((signal.SIGUSR1,)))) If sigwait() is called on MainThread and the process receives SIGUSR1, "Got the signal: ..." gets printed. However, calling sigwait in a different thread blocks the thread indefinitely. The behavior is the same with signal.sigtimedwait() as well ---------- assignee: docs at python components: Documentation messages: 286269 nosy: docs at python, petr at motejlek.net priority: normal severity: normal status: open title: Doc bug: signal.sigwait and signal.sigtimedwait do not work outside the Main thread type: behavior versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 15:14:44 2017 From: report at bugs.python.org (Jonathan Guthrie) Date: Wed, 25 Jan 2017 20:14:44 +0000 Subject: [New-bugs-announce] [issue29375] httplib: wrong Host header when connecting to IPv6 link-local address Message-ID: <1485375284.1.0.310369100275.issue29375@psf.upfronthosting.co.za> New submission from Jonathan Guthrie: This is related to issue 5111. An IPv6 link-local address must include a scope specifier as part of the address passed to the HTTPConnection or HTTPSConnection constructor, that scope specifier is not being stripped from the address passed in the HTTP 1.1 Host: header line. So, suppose I was attempting to connect to an HTTP server on fe80::8aae:1dff:fea4:29c8. That's a link-local address, so I must give the scope specifier, which is the interface I can use to connect to that address. So, the address I would pass to the HTTPConnection constructor might look like "fe80::8aae:1dff:fea4:29c8%eth0". The appropriate Host line in the HTTP request would be "Host: [fe80::8aae:1dff:fea4:29c8]" but it is actually "Host: [fe80::8aae:1dff:fea4:29c8%eth0]" Compliant HTTP servers reject requests including this line as malformed. ---------- messages: 286276 nosy: JonathanGuthrie priority: normal severity: normal status: open title: httplib: wrong Host header when connecting to IPv6 link-local address type: behavior versions: Python 2.7, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jan 25 18:10:08 2017 From: report at bugs.python.org (Tom Myers) Date: Wed, 25 Jan 2017 23:10:08 +0000 Subject: [New-bugs-announce] [issue29376] threading._DummyThread.__repr__ raises AssertionError Message-ID: <1485385808.95.0.00162143215773.issue29376@psf.upfronthosting.co.za> New submission from Tom Myers: _DummyThread objects have _is_stopped = False, but _tstate_lock = None. This causes an AssertionError in is_alive and __repr__ . File ".../cp34/lib/python3.4/threading.py", line 814, in __repr__ self.is_alive() # easy way to get ._is_stopped set when appropriate File ".../cp34/lib/python3.4/threading.py", line 1110, in is_alive self._wait_for_tstate_lock(False) File ".../cp34/lib/python3.4/threading.py", line 1066, in _wait_for_tstate_lock assert self._is_stopped AssertionError ---------- components: Library (Lib) messages: 286285 nosy: Tom Myers priority: normal severity: normal status: open title: threading._DummyThread.__repr__ raises AssertionError versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 26 05:16:18 2017 From: report at bugs.python.org (Manuel Krebber) Date: Thu, 26 Jan 2017 10:16:18 +0000 Subject: [New-bugs-announce] [issue29377] Add the 'wrapper_descriptor' type to the types module Message-ID: <1485425778.09.0.153066086326.issue29377@psf.upfronthosting.co.za> New submission from Manuel Krebber: There currently is no type in the types module for the slot wrappers/wrapper_descriptor types. I would like to have something like WrapperDescriptor = type(object.__init__) added to it (or maybe even add it to MethodType). This would be helpful to check more easily if some object is a method. I can create a pull request for this if desired. ---------- components: Library (Lib) messages: 286304 nosy: Wheerd priority: normal severity: normal status: open title: Add the 'wrapper_descriptor' type to the types module type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 26 11:25:04 2017 From: report at bugs.python.org (Kaeptm Blaubaer) Date: Thu, 26 Jan 2017 16:25:04 +0000 Subject: [New-bugs-announce] [issue29378] Invalid example in documentation for PyErr_Fetch Message-ID: <1485447904.37.0.693014852804.issue29378@psf.upfronthosting.co.za> New submission from Kaeptm Blaubaer: In the example are the pointers to pointers to PyObject too many, because then PyErr_Fetch and PyErr_Restore would get too many pointers to pointers. ---------- assignee: docs at python components: Documentation messages: 286321 nosy: Kaeptm Blaubaer, docs at python priority: normal severity: normal status: open title: Invalid example in documentation for PyErr_Fetch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 26 12:09:47 2017 From: report at bugs.python.org (Piotr Dobrogost) Date: Thu, 26 Jan 2017 17:09:47 +0000 Subject: [New-bugs-announce] [issue29379] Custom handlers not used when passing "context" argument to urllib2.urlopen() Message-ID: <1485450587.01.0.396469985739.issue29379@psf.upfronthosting.co.za> New submission from Piotr Dobrogost: When urllib2.urlopen() is passed "context" argument the new opener is being built (https://hg.python.org/cpython/file/a06454b1afa1/Lib/urllib2.py#l147) and used instead custom opener which might had been already installed with urllib2.install_opener(). This might lead to problems with proxies if custom ProxyHandler was used in custom opener ? see http://stackoverflow.com/q/36089694/95735 as an example. ---------- components: Library (Lib) messages: 286325 nosy: piotr.dobrogost priority: normal severity: normal status: open title: Custom handlers not used when passing "context" argument to urllib2.urlopen() type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 27 08:47:35 2017 From: report at bugs.python.org (Mirko Tebaldi (Realtebo)) Date: Fri, 27 Jan 2017 13:47:35 +0000 Subject: [New-bugs-announce] [issue29380] A lot of warning while executing make install Message-ID: <1485524855.82.0.489793661635.issue29380@psf.upfronthosting.co.za> New submission from Mirko Tebaldi (Realtebo): /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c: In function 'classify_argument': /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:195:18: warning: suggest braces around empty body in an 'else' statement [-Wempty-body] FFI_ASSERT (0); ^ /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:224:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < words; i++) ^ /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:245:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < num; i++) ^ /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:264:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 1; i < words; i++) ^ /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:270:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < words; i++) ^ /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c: In function 'examine_argument': /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:323:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < n; ++i) ^ /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c: In function 'ffi_call': /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:484:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (j = 0; j < n; j++, a += 8, size -= 8) ^ /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c: In function 'ffi_closure_unix64_inner': /usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:659:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (j = 0; j < n; j++, a += 8) ^ ---------- messages: 286355 nosy: Mirko Tebaldi (Realtebo) priority: normal severity: normal status: open title: A lot of warning while executing make install type: compile error versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 27 12:20:02 2017 From: report at bugs.python.org (Jim Fasarakis-Hilliard) Date: Fri, 27 Jan 2017 17:20:02 +0000 Subject: [New-bugs-announce] [issue29381] Tutorial documentation contains undefined reference Message-ID: <1485537602.74.0.811037724367.issue29381@psf.upfronthosting.co.za> New submission from Jim Fasarakis-Hilliard: After moving a certain chunk of the 'interpreter.rst' contents to 'appendix.rst' in issue16827 the reference to #! in the section '2.2.3. Source Code Encoding' is currently confusing for new readers. Attached patches reword the sentence to remove that reference for 3.4+ and 2.7. ---------- assignee: docs at python components: Documentation files: interpreter_tut.patch keywords: patch messages: 286378 nosy: Jim Fasarakis-Hilliard, docs at python priority: normal severity: normal status: open title: Tutorial documentation contains undefined reference versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46438/interpreter_tut.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 27 20:03:15 2017 From: report at bugs.python.org (d s) Date: Sat, 28 Jan 2017 01:03:15 +0000 Subject: [New-bugs-announce] [issue29382] IDLE search/replace/replace+find is (still?) using the 'hilite' tag instead of 'hit' Message-ID: <1485565395.44.0.960082340731.issue29382@psf.upfronthosting.co.za> New submission from d s: Searching for this issue turned up a bunch of results claiming it's fixed, but it isn't, at least not on my windows 10 machine. I tried replacing 'hit' with 'itdunwork' in colorizer.py, searchbase.py, replace.py, searchengine.py, config.py, search.py, configdialog.py, and of course config-highlight.cfg, but it didn't work. ---------- assignee: terry.reedy components: IDLE, Windows messages: 286393 nosy: d s2, paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware priority: normal severity: normal status: open title: IDLE search/replace/replace+find is (still?) using the 'hilite' tag instead of 'hit' type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 27 22:04:15 2017 From: report at bugs.python.org (INADA Naoki) Date: Sat, 28 Jan 2017 03:04:15 +0000 Subject: [New-bugs-announce] [issue29383] Reduce temporary unicode object while adding descriptors Message-ID: <1485572655.18.0.389188121452.issue29383@psf.upfronthosting.co.za> New submission from INADA Naoki: add_methods(), add_members(), and add_getset() creates PyUnicode from C string 3 times, and calls PyUnicode_InternInplace 2 times. 1. PyDict_GetItemString() at first. (PyUnicode_FromString() is called). 2. In middle, descr_new() calls PyUnicode_InternFromString(). 3. PyDict_SetItemString() at last. (creates unicode and intern it). Skipping (2) is require adding new private APIs to pass PyUnicodeObject. But I don't think it worth enough. (I'll try it later.) So this patch only remove last temporary unicode. (3 PyUnicode_FromString + 2 PyUnicode_InternInplace) becomes (2 PyUnicode_FromString + 2 PyUnicode_InternInplace). It seems ~1% startup speedup (without site). $ ./python -m performance.benchmarks.bm_python_startup --no-site default: python_startup_no_site: Median +- std dev: 12.7 ms +- 0.1 ms patched: python_startup_no_site: Median +- std dev: 12.6 ms +- 0.1 ms While speedup is small, this patch removes time to think "How large this overhead of GetItemString + SetItemString pair?" while reading code :) Additionally, this patch removes this comment in PyDict_SetItemString: - PyUnicode_InternInPlace(&kv); /* XXX Should we really? */ SetItemString is used to add something to namespace. Changing this behavior affects too widely. So we should do it. ---------- assignee: inada.naoki components: Interpreter Core files: descr-remove-getitemstring.patch keywords: patch messages: 286394 nosy: inada.naoki priority: normal severity: normal status: open title: Reduce temporary unicode object while adding descriptors versions: Python 3.7 Added file: http://bugs.python.org/file46441/descr-remove-getitemstring.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 28 23:06:55 2017 From: report at bugs.python.org (Martin Panter) Date: Sun, 29 Jan 2017 04:06:55 +0000 Subject: [New-bugs-announce] [issue29384] Unused beos build scripts Message-ID: <1485662815.62.0.566203367253.issue29384@psf.upfronthosting.co.za> New submission from Martin Panter: Modules/ld_so_beos and Modules/ar_beos are no longer used since Be OS support was dropped from the configure script for Python 3: https://hg.python.org/cpython/diff/a5e984eda45a/configure.in I propose to also remove the scripts. ---------- components: Build files: beos-scripts.patch keywords: patch messages: 286426 nosy: martin.panter priority: normal severity: normal stage: patch review status: open title: Unused beos build scripts type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46447/beos-scripts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 29 00:36:00 2017 From: report at bugs.python.org (Dhiraj) Date: Sun, 29 Jan 2017 05:36:00 +0000 Subject: [New-bugs-announce] [issue29385] Sockets Crashes or Memory Corruption Message-ID: <1485668160.59.0.222592776098.issue29385@psf.upfronthosting.co.za> New submission from Dhiraj: When Python Server receives a string of '/xff' (5 or more) from a page after completing a handshake, the tab immediately crashes. There are variations of this string with other characters mixed in that also cause an immediate close of python server. To reproduce: 1. Run the websockets.py server 2. Then open websockets.html in browser The PY server gets Close/Crash ---------- components: Windows files: REPRO.ZIP messages: 286429 nosy: Dhiraj_Mishra, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Sockets Crashes or Memory Corruption versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46448/REPRO.ZIP _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 29 01:28:41 2017 From: report at bugs.python.org (Gabriel McManus) Date: Sun, 29 Jan 2017 06:28:41 +0000 Subject: [New-bugs-announce] [issue29386] select.epoll.poll may behave differently if timeout = -1 vs timeout = None Message-ID: <1485671321.44.0.0475790676768.issue29386@psf.upfronthosting.co.za> New submission from Gabriel McManus: The select module epoll.poll method takes a "timeout" parameter which is documented as having a default value of -1 [1]. If no timeout (or None) is passed to epoll.poll, then a value of -1 is passed to the epoll_wait system call. But if a timeout of -1 is passed to epoll.poll, then a value of -1000 is passed to epoll_wait. This is because the timeout is converted from seconds to milliseconds. Before Python 3.5, if a negative timeout was passed to epoll.poll then -1 was passed to epoll_wait [2]. The Linux epoll_wait documentation doesn't specify the behaviour if timeout < -1. Linux itself behaves the same for all negative timeouts: never time out. But on Illumos, timeout < -1 currently times out immediately, and only timeout == -1 never times out [3]. Some code does pass -1 to select.epoll.poll expecting it to never time out. For example, selectors.EpollSelector [4]. I suggest restoring the pre-3.5 behaviour: epoll.poll should use -1 if the given timeout is negative. I discovered this because ipython3 uses selectors.EpollSelector on Illumos, and it was using 100% cpu while waiting for input because epoll_wait was returning immediately. To demonstrate the issue you can run: strace python3.5 -c 'import select; select.epoll().poll(timeout=-1)' & On Illumos this completes immediately, and the output contains the -1000 timeout: epoll_wait(3, [], 1023, -1000) = 0 On Linux, it will block. If you then kill the python process with SIGTERM, strace should print the interrupted epoll_wait call, revealing the -1000 timeout: epoll_wait(3, ... 299a070, 1023, -100) = -1 EINTR (Interrupted system call) [1] https://github.com/python/cpython/blob/b9e40ed1bcce127893e40dd355087cda7187ac27/Modules/selectmodule.c#L1489 [2] https://github.com/python/cpython/commit/02e27d1301ea680dce9c3013010e3befedf9628a [3] https://github.com/joyent/illumos-joyent/issues/136 [4] https://github.com/python/cpython/blob/8228a2b306844a213eddb4fb908c1925840ff67e/Lib/selectors.py#L428 ---------- components: Extension Modules messages: 286431 nosy: Gabriel McManus priority: normal severity: normal status: open title: select.epoll.poll may behave differently if timeout = -1 vs timeout = None type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 29 18:53:58 2017 From: report at bugs.python.org (Martin Panter) Date: Sun, 29 Jan 2017 23:53:58 +0000 Subject: [New-bugs-announce] [issue29387] Tabs vs spaces FAQ out of date Message-ID: <1485734038.81.0.0566253928841.issue29387@psf.upfronthosting.co.za> New submission from Martin Panter: The Windows FAQ mentions the ?python -t? command-line option, but in Python 3 this option is undocumented (and I understand has no effect): /media/disk/home/proj/python/cpython/Doc/faq/windows.rst:303: WARNING: unknown option: -t Also, the reference to the tabnanny script is wrong. It exists as a module (Lib/tabnanny.py), not in Tools/scripts/. This aspect also applies to 2.7. ---------- assignee: docs at python components: Documentation, Windows files: tabnanny.patch keywords: patch messages: 286460 nosy: docs at python, martin.panter, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: patch review status: open title: Tabs vs spaces FAQ out of date versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46450/tabnanny.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 29 21:05:32 2017 From: report at bugs.python.org (MaxR) Date: Mon, 30 Jan 2017 02:05:32 +0000 Subject: [New-bugs-announce] [issue29388] regex mismatch in the simple cases Message-ID: <1485741932.85.0.668510587664.issue29388@psf.upfronthosting.co.za> New submission from MaxR: When I compile and match, for example: pattern = re.compile(r""" ([a-z]|\d)+$ # ends with letter or number only """, re.VERBOSE | re.IGNORECASE) print(re.match(pattern, 'abc')) result is correct: <_sre.SRE_Match object; span=(0, 3), match='abc'> but then I use the same pattern with another string: print(re.match(pattern, 'abc.fds')) result is: None I tried to reformulate the pattern to the same, for example: pattern = re.compile(r""" (a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|\d)+$ # ends with letter or number only """, re.VERBOSE | re.IGNORECASE) or to: pattern = re.compile(r""" [a-z\d]+$ # ends with letter or number only """, re.VERBOSE | re.IGNORECASE) or to: pattern = = re.compile(r""" ([a-z]|\d)+$ # ends with letter or number only """, re.VERBOSE | re.IGNORECASE) but the result is all the time the same - None And ?hat is the double strange for the last three pattern - None is result also for print(re.match(pattern, 'abc')) I checked this patterns on the site regex101.com and all of them should work good and right It's achtung! ---------- components: Regular Expressions messages: 286464 nosy: MaxR, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: regex mismatch in the simple cases type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 30 04:02:05 2017 From: report at bugs.python.org (Shmuel Amar) Date: Mon, 30 Jan 2017 09:02:05 +0000 Subject: [New-bugs-announce] [issue29389] math.isclose signature contains incorrect start parameter Message-ID: <1485766925.53.0.41080948643.issue29389@psf.upfronthosting.co.za> New submission from Shmuel Amar: documentation of math.isclose() signature on https://docs.python.org/3/library/math.html#math.isclose is as follows: math.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0) the third star '*' argument is not allowed inside the function: https://hg.python.org/cpython/file/tip/Modules/clinic/mathmodule.c.h#l511 or mentioned in PEP485 here: https://www.python.org/dev/peps/pep-0485/#implementation and does not work when trying provide more than 2 positional values: >>> import math >>> math.isclose(1,2,3, rel_tol=5.) Traceback (most recent call last): File "", line 1, in TypeError: Function takes at most 2 positional arguments (3 given) So IMHO to solve this remove the positional argument on the signature of isclose() as it misleading. ---------- assignee: docs at python components: Documentation messages: 286474 nosy: Shmuel Amar, docs at python priority: normal severity: normal status: open title: math.isclose signature contains incorrect start parameter versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 30 05:05:09 2017 From: report at bugs.python.org (Michael Kesper) Date: Mon, 30 Jan 2017 10:05:09 +0000 Subject: [New-bugs-announce] [issue29390] Python Tutorial should introduce iterators and generators Message-ID: <1485770709.65.0.205484403801.issue29390@psf.upfronthosting.co.za> New submission from Michael Kesper: Please look at http://stackoverflow.com/questions/41932287/how-can-i-create-a-loop-for-these-if-statements/41932494?noredirect=1#41932494 For beginners, it would be good to introduce the concepts of 'pythonic' dealing with sequences (iterators) and streams (generators) as soon as possible and everywhere where sequenceable data structures are discussed. It is a common idiom in other languages to access members of sequences with counters, risking off-by-one errors or IndexErrors. If beginners aren't introduced to the 'right' concepts soon enough, they might have a hard time figuring out the 'iterator' way. Iterators should at least be mentioned in https://docs.python.org/3/tutorial/datastructures.html#looping-techniques. ---------- assignee: docs at python components: Documentation messages: 286480 nosy: docs at python, mkesper priority: normal severity: normal status: open title: Python Tutorial should introduce iterators and generators type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 30 10:53:13 2017 From: report at bugs.python.org (Glenn Clark) Date: Mon, 30 Jan 2017 15:53:13 +0000 Subject: [New-bugs-announce] [issue29391] Windows Defender finds trojan Spursint in Numpy for Py36 Win64 Message-ID: <1485791593.43.0.325442187579.issue29391@psf.upfronthosting.co.za> New submission from Glenn Clark: Windows Defender trojan Spursint Numpy Python3.6 Python 3.4 Win64 ---------- components: Windows messages: 286492 nosy: Glenn Clark, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows Defender finds trojan Spursint in Numpy for Py36 Win64 type: security versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 30 12:30:26 2017 From: report at bugs.python.org (Frazer McLean) Date: Mon, 30 Jan 2017 17:30:26 +0000 Subject: [New-bugs-announce] [issue29392] msvcrt.locking crashes python Message-ID: <1485797426.48.0.513516354213.issue29392@psf.upfronthosting.co.za> New submission from Frazer McLean: On 3.5.2 and 3.5.3, but not 3.4.3 or 2.7.10 (Windows 64-bit), the third line causes Python to crash with exit code 0xC0000417. import msvcrt fp = open('file.txt', 'w') msvcrt.locking(fp.fileno(), msvcrt.LK_NBLCK, -1) print('End') I came across this in the portalocker module. I don't think -1 is a valid third argument, but it doesn't raise an exception on Python 3.4 or 2.7. ---------- components: Windows messages: 286495 nosy: RazerM, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: msvcrt.locking crashes python type: crash versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jan 30 21:44:14 2017 From: report at bugs.python.org (Cooper Lees) Date: Tue, 31 Jan 2017 02:44:14 +0000 Subject: [New-bugs-announce] [issue29393] Enabiling IPv6 by default Message-ID: <1485830654.03.0.638312196963.issue29393@psf.upfronthosting.co.za> New submission from Cooper Lees: Can we discuss the possibility of enabling IPv6 by default now during build. I think enough of the world now NEED IPv6 so people should all be building their Python with it. ---------- components: Build messages: 286506 nosy: cooperlees priority: normal severity: normal status: open title: Enabiling IPv6 by default type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 02:19:43 2017 From: report at bugs.python.org (Maximilian Blochberger) Date: Tue, 31 Jan 2017 07:19:43 +0000 Subject: [New-bugs-announce] [issue29394] Cannot tunnel TLS connection through TLS connection Message-ID: <1485847183.69.0.499542154053.issue29394@psf.upfronthosting.co.za> New submission from Maximilian Blochberger: I have the following scenario: Client ? Proxy ? Target. The following two scenarios are working perfectly fine: 1) Establishing a TLS-secured connection to the proxy and then tunnel traffic through that connection to the target. This results in the proxy being able to observe and manipulate the traffic in both directions. It protects against an adversary who has no control over the proxy, e.g. it prevents observers from learning that you are using a proxy (if the IP/port is not known) and from reading the actual traffic. 2) Establish a non-secured connection to the proxy and then tunnel TLS-secured traffic through that connection to the target. That prevents the proxy from being able to observe or manipulate the traffic. Although an observer could learn that you are using a proxy and what target you are connecting to. Now what I tried was to establish a TLS-secured connection to the proxy and then to establish a TLS-secured tunnel to the target, effectively resulting in two layers of TLS in between the client and the proxy. This would protect from an observer learning that you are using a proxy and where you connect to (the proxy still knows) but preventing the proxy from observing and manipulating the actual traffic to the target. This does not work in Python 3.6. The TLS-secured connection to the proxy is straight forward and can be easily done with ssl.SSLContext.wrap_socket(). The TCP connection between the proxy and the target can then be established by issuing an HTTP CONNECT request. The response can than be read without closing the connection as done in http.client.HTTPConnection._tunnel(). Now my idea was to call ssl.SSLContext.wrap_socket() again (with a different context for the target) and send traffic through that. Unfortunately the TLS handshake fails with the error message "unknown protocol". I looked into the actual traffic transmitted and realised that the handshake was performed in plain text ??so effectively stripping the TLS layer that was established already ? which results in the proxy server not knowing how to handle the traffic (as it is not TLS-secured) aborting the connection (and reporting a fatal TLS alert). This leads to the conclusion that another call to ssl.SSLContext.wrap_socket() will override a previous call of the same function (different context object though). I think this is unexpected behaviour. It might be easier to handle such scenarios if a tunnel would be a separate http.client.HTTP(S)Connection object, see issue #24964. This would also allow to handle ssl-specific calls such as ssl.SSLSocket.getpeercert() as each layer probably uses different certificates. ---------- assignee: christian.heimes components: SSL messages: 286517 nosy: Maximilian Blochberger, christian.heimes priority: normal severity: normal status: open title: Cannot tunnel TLS connection through TLS connection type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 04:03:23 2017 From: report at bugs.python.org (=?utf-8?q?Christian_W=C3=BCste?=) Date: Tue, 31 Jan 2017 09:03:23 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue29395=5D_Edit_with_IDLE_3?= =?utf-8?q?=2E6_don=C2=B4t_work_if_Name_of_File_=22code=2Epy=22?= Message-ID: <1485853403.69.0.0659896818047.issue29395@psf.upfronthosting.co.za> New submission from Christian W?ste: As soon as I specify a file "code.py", it can not be opened via the right click > Edit with IDLE 3.6 (64-Bit). The content of the file is completely irrelevant. All other Python files located in the same folder as "code.py" can not be opened. If I rename the file in for example coder.py everything works. Previously, Python version 3.5.3 was installed. It is also possible that it is attached to my system. ---------- assignee: terry.reedy components: IDLE messages: 286518 nosy: terry.reedy, wueste87 priority: normal severity: normal status: open title: Edit with IDLE 3.6 don?t work if Name of File "code.py" type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 05:53:07 2017 From: report at bugs.python.org (Silvio Ricardo Cordeiro) Date: Tue, 31 Jan 2017 10:53:07 +0000 Subject: [New-bugs-announce] [issue29396] Re-opening /dev/tty breaks readline Message-ID: <1485859987.68.0.026952717617.issue29396@psf.upfronthosting.co.za> New submission from Silvio Ricardo Cordeiro: The following code works on python2 (tested with 2.7.6), but breaks readline for python3 (tested with 3.4.3): >>> import sys, readline >>> sys.stdin = open('/dev/tty', 'r') >>> input("> ") # press "7" >>> input("> ") # press "up" key Re-opening /dev/tty as stdin is a very useful technique. For example, one could debug a script that takes a file as stdin by re-opening the stdin as /dev/tty and using pdb.set_trace(). See bug report for python2 in 2002 here: https://bugs.python.org/issue512981 ---------- components: Library (Lib) messages: 286521 nosy: silvioricardoc priority: normal severity: normal status: open title: Re-opening /dev/tty breaks readline versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 09:21:40 2017 From: report at bugs.python.org (zhaw_munt) Date: Tue, 31 Jan 2017 14:21:40 +0000 Subject: [New-bugs-announce] [issue29397] linux/random.h present but cannot be compiled Message-ID: <1485872500.79.0.0659257887821.issue29397@psf.upfronthosting.co.za> New submission from zhaw_munt: configure: WARNING: linux/random.h: present but cannot be compiled configure: WARNING: linux/random.h: check for missing prerequisite headers? configure: WARNING: linux/random.h: see the Autoconf documentation configure: WARNING: linux/random.h: section "Present But Cannot Be Compiled" configure: WARNING: linux/random.h: proceeding with the compiler's result configure: WARNING: ## --------------------------------------- ## configure: WARNING: ## Report this to https://bugs.python.org/ ## configure: WARNING: ## --------------------------------------- ## 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linu (CentOS 5.5) Buildings seems to work, at the end I have the binary but I've noticed that *at least* _socket is missing. Other libraries such as "_bz2" and "_sqlite" are there (as I've installed their corresponding devel package) ---------- messages: 286533 nosy: zhaw_munt priority: normal severity: normal status: open title: linux/random.h present but cannot be compiled type: compile error versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 09:56:33 2017 From: report at bugs.python.org (zeroinside) Date: Tue, 31 Jan 2017 14:56:33 +0000 Subject: [New-bugs-announce] [issue29398] memory corruption in xxlimited Message-ID: <1485874593.96.0.823310722961.issue29398@psf.upfronthosting.co.za> New submission from zeroinside: Hello I found incorrect gc behavior in xxlimited module. After an hour of investigation, I'm still not sure its security related problem. I have a partial control on RBP register, depends of memory layout. GDB: Starting program: /usr/bin/python3.6 [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Python 3.6.0 (default, Jan 16 2017, 12:12:55) [GCC 6.3.1 20170109] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import xxlimited >>> a=xxlimited.new() >>> del a Program received signal SIGSEGV, Segmentation fault. 0x00007ffff73d612d in PyArena_Free () from /usr/lib/libpython3.6m.so.1.0 (gdb) info reg rax 0x7ffff7457270 140737341911664 rbx 0x7ffff7f812b8 140737353618104 rcx 0x62aa00 6466048 rdx 0x7ffff7457270 140737341911664 rsi 0x1 1 rdi 0x7ffff7f81300 140737353618176 rbp 0x500000a29 0x500000a29 rsp 0x7fffffffe210 0x7fffffffe210 r8 0x7ffff7f81000 140737353617408 r9 0x1c 28 r10 0x1b 27 r11 0x12300 74496 r12 0x7ffff7f812b8 140737353618104 r13 0x6fafd0 7319504 r14 0x7ffff3e7b570 140737285436784 r15 0x7ffff3e7b5a0 140737285436832 rip 0x7ffff73d612d 0x7ffff73d612d eflags 0x10202 [ IF RF ] cs 0x33 51 ss 0x2b 43 ds 0x0 0 es 0x0 0 fs 0x0 0 gs 0x0 0 root@/home/zeroinside/python/pyburst3.6/crash $ /usr/local/bin/python3.6 xlimited_poc.py ASAN:DEADLYSIGNAL ================================================================= ==5082==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x000000557469 bp 0x0fe0603ea23d sp 0x7fff76e98c20 T0) ==5082==The signal is caused by a WRITE memory access. ==5082==Hint: address points to the zero page. #0 0x557468 in PyObject_GC_UnTrack /home/zeroinside/Downloads/Python-3.6.0/Modules/gcmodule.c:1699:9 #1 0x66d0af in subtype_dealloc /home/zeroinside/Downloads/Python-3.6.0/Objects/typeobject.c:1133:5 #2 0x61e557 in _PyDict_DelItem_KnownHash /home/zeroinside/Downloads/Python-3.6.0/Objects/dictobject.c:1641:5 #3 0x7970c0 in _PyEval_EvalFrameDefault /home/zeroinside/Downloads/Python-3.6.0/Python/ceval.c:2187:19 #4 0x7aef44 in PyEval_EvalFrameEx /home/zeroinside/Downloads/Python-3.6.0/Python/ceval.c:718:12 #5 0x7aef44 in _PyEval_EvalCodeWithName /home/zeroinside/Downloads/Python-3.6.0/Python/ceval.c:4119 #6 0x79571c in PyEval_EvalCodeEx /home/zeroinside/Downloads/Python-3.6.0/Python/ceval.c:4140:12 #7 0x79571c in PyEval_EvalCode /home/zeroinside/Downloads/Python-3.6.0/Python/ceval.c:695 #8 0x5295e7 in run_mod /home/zeroinside/Downloads/Python-3.6.0/Python/pythonrun.c:980:9 #9 0x5295e7 in PyRun_FileExFlags /home/zeroinside/Downloads/Python-3.6.0/Python/pythonrun.c:933 #10 0x527e75 in PyRun_SimpleFileExFlags /home/zeroinside/Downloads/Python-3.6.0/Python/pythonrun.c:396:13 #11 0x55340c in run_file /home/zeroinside/Downloads/Python-3.6.0/Modules/main.c:320:11 #12 0x55340c in Py_Main /home/zeroinside/Downloads/Python-3.6.0/Modules/main.c:780 #13 0x519776 in main /home/zeroinside/Downloads/Python-3.6.0/./Programs/python.c:69:11 #14 0x7f0300e01290 in __libc_start_main (/usr/lib/libc.so.6+0x20290) #15 0x432179 in _start (/usr/local/bin/python3.6+0x432179) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/zeroinside/Downloads/Python-3.6.0/Modules/gcmodule.c:1699:9 in PyObject_GC_UnTrack ==5082==ABORTING ---------- components: Build files: xlimited.py messages: 286536 nosy: zeroinside priority: normal severity: normal status: open title: memory corruption in xxlimited type: security versions: Python 3.6 Added file: http://bugs.python.org/file46465/xlimited.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 12:14:06 2017 From: report at bugs.python.org (Elli Pirelli) Date: Tue, 31 Jan 2017 17:14:06 +0000 Subject: [New-bugs-announce] [issue29399] python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior Message-ID: <1485882846.24.0.14620001579.issue29399@psf.upfronthosting.co.za> New submission from Elli Pirelli: Let me first apologize if this issue has already been reported and discussed before. I would be surprised if there are not a few developers that had to deal with this issue before, but i was unable to find an existing bug report or discussion about this. So, here it goes... Importing/using Py_* symbols from python3.dll instead directly from python3?.dll can be a problem when python3.dll and python3?.dll reside in a directory that is not part of the standard DLL search path. An example would be an application that tries loading Python from a sub directory of the application. The functions exported in python3.dll are export forwarders referencing the respective functions in python3?.dll. python3.dll itself has no import dependency on python3?.dll. Without an import dependency on python3?.dll, this DLL will be loaded when one of the export forwarders in python3.dll will be resolved, for example when calling GetProcAddress("Py_Main"). However, in such a case an altered DLL search path will be completely ignored, and python3?.dll will only be looked for in the standard DLL search paths. Since the sub directory with the python DLLs is not part of the standard DLL search paths, the resolution of the export fowarder(s) fails. Trying to alter the DLL search path has no effect. Loading python3.dll with LoadLibraryEx and the flag LOAD_WITH_ALTERED_SEARCH_PATH does not help. Neither does calling SetDllDirectory or AddDllDirectory before loading python3.dll and/or before invoking GetProcAddress. Note that loading python3.dll itself works fine. However, resolving one of the exports with GetProcAddress will fail if python3?.dll cannot be found in the standard DLL search path. I don't know, if there is a way to make it work properly... As of now the only two options out of this dilemma are either to put the python DLLs (and assorted files) in the same directory as the application exe (ugly mess) or to load python3?.dll instead of python3.dll (which sort of defeats the purpose of having python3.dll, i guess). My suggestion for future Python 3 versions is to let python3.dll have a DLL dependency on python3?.dll. Linking python3.dll to python3?.dll (i.e., loading python3.dll will cause python3?.dll being loaded) allows using altered DLL search paths. ---------- messages: 286544 nosy: Elli Pirelli priority: normal severity: normal status: open title: python3.dll export forwarders not resolved in all situations due to missing python3?.dll dependency and DLL search path behavior type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 13:20:52 2017 From: report at bugs.python.org (George King) Date: Tue, 31 Jan 2017 18:20:52 +0000 Subject: [New-bugs-announce] [issue29400] Instruction level tracing via sys.settrace Message-ID: <1485886852.16.0.854514177291.issue29400@psf.upfronthosting.co.za> New submission from George King: I have recently put some effort into developing a code coverage tool that shows correct results for intraline branches. In order to get intraline trace data, I patched CPython, adding an optional "trace instructions" flag to sys.settrace. The patch is fairly simple. http://github.com/gwk/cpython/tree/inst-tracing The crucial detail in ceval is here: @@ -4521,6 +4523,9 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj, frame->f_lineno = line; result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None); } + else if (tstate->inst_tracing) { + result = call_trace(func, obj, tstate, frame, PyTrace_INSTRUCTION, Py_None); + } The call to maybe_call_line_trace is guarded by several checks, so I do not see how this would significantly impact performance, except for when tracing is enabled. I built python3.6 using clang -O3 -flto (I saw lots of test failures during the --with-optimizations PGO tests so I opted for a simpler build), with and without my patch. I then ran `python3 -m performance run --fast` and manually compared the results. The patched version was in most cases slightly slower but within the standard deviation of the normal version. I would appreciate feedback before going any further with this. I looked at haypo's perf project but was unsure how to use it to run a more detailed comparison. * First, will this feature be rejected on performance grounds or some other obvious reason? * Second, does setting `tstate->inst_tracing` in PyEval_SetTraceInstructions require more elaborate guards similar to those in PyEval_SetTrace? I do not understand the intricacies of that function. I am also curious about backwards compatibility. This adds an optional argument to settrace (haypo's recommendation) and some other things that appear to be under Py_LIMITED_API or internal (but I am not sure). * Is a change like this eligible for 3.6.x or would it have to wait until 3.7? * Would it be better to add a completely new function, e.g. sys.settrace_instructions instead of changing the signature of settrace? Lastly, I have a few ideas for enhancing this patch that will require some more work on my end to verify their utility. In particular: * Remove the `else` to always trace with PyTrace_INSTRUCTION, rather than as an alternate to PyTrace_LINE as it does now. * Pass the previous instruction offset as the trace function argument. This would give the tracer complete "edge" information. (In my coverage tool's trace function I track the previous edge as a nonlocal, but it would be better/faster to do it automatically in maybe_call_line_trace). * Finally, if all of this works, it might also be useful (as a performance enhancement) to add a PyTrace_BRANCH option, which would omit runs of opcodes inbetween branches, as these edges tend not be be useful, and even counterproductive (at least for my use case). However it might be too tricky to get all the cases right. ---------- components: Interpreter Core messages: 286546 nosy: George.King, haypo priority: normal severity: normal status: open title: Instruction level tracing via sys.settrace type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 15:10:17 2017 From: report at bugs.python.org (Gerrit Holl) Date: Tue, 31 Jan 2017 20:10:17 +0000 Subject: [New-bugs-announce] [issue29401] Python3.6 docs should not have a "what's new in Python 3.7" page Message-ID: <1485893417.06.0.864310985594.issue29401@psf.upfronthosting.co.za> New submission from Gerrit Holl: I believe this page is not supposed to exist: https://docs.python.org/3.6/whatsnew/3.7.html Nor this one: https://docs.python.org/3.5/whatsnew/3.6.html Neither are maintained, nor would I expect them to be. ---------- assignee: docs at python components: Documentation messages: 286549 nosy: Gerrit.Holl, docs at python priority: normal severity: normal status: open title: Python3.6 docs should not have a "what's new in Python 3.7" page versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 16:34:54 2017 From: report at bugs.python.org (Terry J. Reedy) Date: Tue, 31 Jan 2017 21:34:54 +0000 Subject: [New-bugs-announce] [issue29402] Problem with Checkbutton and duplicate last name components Message-ID: <1485898494.74.0.656128703551.issue29402@psf.upfronthosting.co.za> New submission from Terry J. Reedy: Report and code from George Trojan on python-list. import tkinter class GUI(tkinter.Tk): def __init__(self): tkinter.Tk.__init__(self) frame = tkinter.Frame(self) for tag in ('A', 'B'): w = tkinter.Checkbutton(frame, text=tag) w.pack(side='top', padx=10, pady=10) print(w) frame.pack(side='top') frame = tkinter.Frame(self) for tag in ('C', 'D'): w = tkinter.Checkbutton(frame, text=tag) w.pack(side='top', padx=10, pady=10) print(w) frame.pack(side='top') gui = GUI() gui.mainloop() In 3.5, each Checkbutton has unique last name component. .2028654224384.2028654606600 .2028654224384.2028654608224 .2028654606656.2028654606824 .2028654606656.2028654608336 Clicking any box checks or unchecks exactly that box. In 3.6, last name components are duplicated .!frame.!checkbutton .!frame.!checkbutton2 .!frame2.!checkbutton .!frame2.!checkbutton2 Clicking any box checks or unchecks both button with 'same name'. I verified that the _w strings passed in tk.call are the full unique names. MRAB reported that adding a tk variable attribute fixed the problem. I notice that Brian Oakley said the same thing in the similar issue #25684, though that is marked for 2.7 and 3.5 also. ---------- keywords: 3.6regression messages: 286552 nosy: serhiy.storchaka, terry.reedy priority: normal severity: normal stage: test needed status: open title: Problem with Checkbutton and duplicate last name components type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 18:01:55 2017 From: report at bugs.python.org (Aaron Gallagher) Date: Tue, 31 Jan 2017 23:01:55 +0000 Subject: [New-bugs-announce] [issue29403] mock's autospec's behavior on method-bound builtin functions is broken Message-ID: <1485903715.23.0.569013669104.issue29403@psf.upfronthosting.co.za> New submission from Aaron Gallagher: Cython will, in the right circumstances, offer a MethodType instance where im_func is a builtin function. Any instance of MethodType is automatically assumed to be a python-defined function (more specifically, a function that has an inspectable signature), but _set_signature was still conservative in its assumptions. As a result _set_signature would return early with None instead of a mock since the im_func had no inspectable signature. This causes problems deeper inside mock, as _set_signature is assumed to always return a mock, and nothing checked its return value. In similar corner cases, autospec will simply not check the spec of the function, so _set_signature is amended to now return early with the original, not-wrapped mock object. There is another None early return in _set_signature, but it seems.. harder to trigger? It seems more appropriate to raise an exception there if this is being fixed. ---------- components: Library (Lib) messages: 286565 nosy: Aaron Gallagher priority: normal severity: normal status: open title: mock's autospec's behavior on method-bound builtin functions is broken type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 19:00:11 2017 From: report at bugs.python.org (Vincent Pelletier) Date: Wed, 01 Feb 2017 00:00:11 +0000 Subject: [New-bugs-announce] [issue29404] "TypeError: 'int' does not have the buffer interface" on memoryview over bytearray Message-ID: <1485907211.51.0.510192590668.issue29404@psf.upfronthosting.co.za> New submission from Vincent Pelletier: Quoting a github gist[1] (not mine, I found it while googling for this error) clearly illustrating the issue: # Python 2 >>> b = bytearray(8) >>> v = memoryview(b) >>> v[0] = 42 Traceback (most recent call last): File "", line 1, in TypeError: 'int' does not have the buffer interface >>> b bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') # Python 3 >>> b = bytearray(8) >>> v = memoryview(b) >>> v[0] = 42 >>> b bytearray(b'*\x00\x00\x00\x00\x00\x00\x00') This is especially annoying as on python3 bytearray.__setitem__ only accepts integers, making working py2 code totally incompatible with py3 in a 2to3-undetectable way. [1] https://gist.github.com/superbobry/b90c0cc7c44beaa51ef9 ---------- messages: 286567 nosy: vpelletier priority: normal severity: normal status: open title: "TypeError: 'int' does not have the buffer interface" on memoryview over bytearray type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 19:26:25 2017 From: report at bugs.python.org (Milt Epstein) Date: Wed, 01 Feb 2017 00:26:25 +0000 Subject: [New-bugs-announce] [issue29405] improve csv.Sniffer().sniff() behavior Message-ID: <1485908785.08.0.552892497325.issue29405@psf.upfronthosting.co.za> New submission from Milt Epstein: I'm trying to use csv.Sniffer().sniff(sample_data) to determine the delimiter on a number of input files. Through some trial and error, many "Could not determine delimiter" errors, and analyzing how this routine works/behaves, I settled on sample_data being some number of lines of the input file, particularly 30. This value seems to allow the routine to work more frequently, although not always, particularly on short input files. I realize the way this routine works is somewhat idiosyncratic, and it won't be so easy to improve it generally, but there's one simple change that occurred to me that would help in some cases. Currently the function _guess_delimiter() in csv.py contains the following lines: # build a list of possible delimiters modeList = modes.items() total = float(chunkLength * iteration) So total is increased by chunkLength on each iteration. The problem occurs when total becomes greater than the length of sample_data, that is, the iteration would go beyond the end of sample_data. That reading is handled fine, it's truncated at the end of sample_data, but total is needlessly set too high. My suggested change is to add the following two lines after the above: if total > len(data): total = float(len(data)) ---------- components: Library (Lib) messages: 286570 nosy: mepstein priority: normal severity: normal status: open title: improve csv.Sniffer().sniff() behavior type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 19:39:05 2017 From: report at bugs.python.org (Alexander Mohr) Date: Wed, 01 Feb 2017 00:39:05 +0000 Subject: [New-bugs-announce] [issue29406] asyncio SSL contexts leak sockets after calling close with certain Apache servers Message-ID: <1485909545.04.0.650924943503.issue29406@psf.upfronthosting.co.za> New submission from Alexander Mohr: with the attached code note how HttpClient.connection_lost callback is never called for the madis server. The madis server is an apache server, I tried with the OSX apache server and could not reproduce the issue so it seems something particular about their apache version or configuration. This is a pretty critical issue as close() does not release the socket. ---------- components: asyncio files: scratch_1.py messages: 286573 nosy: gvanrossum, thehesiod, yselivanov priority: normal severity: normal status: open title: asyncio SSL contexts leak sockets after calling close with certain Apache servers type: resource usage versions: Python 3.5 Added file: http://bugs.python.org/file46469/scratch_1.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 20:09:07 2017 From: report at bugs.python.org (Berker Peksag) Date: Wed, 01 Feb 2017 01:09:07 +0000 Subject: [New-bugs-announce] [issue29407] Remove redundant ensure_future() calls in factorial example Message-ID: <1485911347.12.0.0497985806483.issue29407@psf.upfronthosting.co.za> New submission from Berker Peksag: Unless I'm missing something, ensure_future() calls at https://docs.python.org/3.6/library/asyncio-task.html#example-parallel-execution-of-tasks are redundant and can be removed. Off-topic: Can we use the async/await keywords in asyncio docs now? ---------- assignee: docs at python components: Documentation, asyncio files: ensure_future.diff keywords: patch messages: 286576 nosy: berker.peksag, docs at python, gvanrossum, yselivanov priority: normal severity: normal stage: patch review status: open title: Remove redundant ensure_future() calls in factorial example type: enhancement versions: Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46471/ensure_future.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 20:20:08 2017 From: report at bugs.python.org (Daniel Nunes) Date: Wed, 01 Feb 2017 01:20:08 +0000 Subject: [New-bugs-announce] [issue29408] Add timestamp-based dependency system to build_clib Message-ID: <1485912008.84.0.925111372259.issue29408@psf.upfronthosting.co.za> New submission from Daniel Nunes: Summary: - Added newer_pairwise_group function to distutils.dep_util - Added documentation and tests for previous function - Added timestamp-based dependency system to build_libraries in build_clib - Added tests for the above build_clib is sorely missing one thing in distutils - checking outdated dependencies when compiling. This makes it so that, when building a static c library, all objects are always all compiled. The function to create the static library itself does implement something of this sort, but since all objects have been recompiled it has no practical effect (everything still runs every time). This is a small patch designed to fix that, with a couple of qol improvements along the way. Two new keys were added to the build_info dictionary: obj_deps - Allows specifying extra dependencies for each source so they can be recognized as being newer than the object being compiled. cflags - This just allows the user to provide an extra set of flags to the compiler. That is pretty much it, a simple (but important) quality of life improvement for those of us who need to compile static libs with python. Example: setup( ... libraries=[( 'examplelib', {'sources': 'example.c', 'obj_deps': {'': 'global.h', # use an empty string to define global (for all sources) dependencies 'example.c': 'example.h'} } )] ... ) Documentation for the new function is done but there is no documentation for build_clib itself. After submitting this I'll start working on it and will wait to submit it until this patch is accepted/rejected (so I can know what to include). Thanks! ---------- components: Distutils files: build_clib.patch keywords: patch messages: 286577 nosy: daniel.nunes, dstufft, eric.araujo priority: normal severity: normal status: open title: Add timestamp-based dependency system to build_clib type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46472/build_clib.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jan 31 22:06:20 2017 From: report at bugs.python.org (Eryk Sun) Date: Wed, 01 Feb 2017 03:06:20 +0000 Subject: [New-bugs-announce] [issue29409] Implement PEP 529 for io.FileIO Message-ID: <1485918380.71.0.564330613462.issue29409@psf.upfronthosting.co.za> New submission from Eryk Sun: PEP 529 isn't implemented for io.FileIO, and I think it should be. If a UTF-8 path is passed to open(), it ends up calling C _open instead of decoding the path and calling C _wopen. Also, if a pathlike object is passed to io.FileIO, it calls PyUnicode_FSConverter on it, converting it to UTF-8 and then passing it to _open. For example: >>> p = r'C:\Temp\????' >>> os.path.exists(p) True >>> open(p.encode()) Traceback (most recent call last): File "", line 1, in FileNotFoundError: [Errno 2] No such file or directory: b'C:\\Temp\\\xce\xb1\xce\xb2\xcf\x88\xce\xb4' >>> io.FileIO(pathlib.Path(p)) Traceback (most recent call last): File "", line 1, in FileNotFoundError: [Errno 2] No such file or directory: WindowsPath('C:/Temp/????') The Windows implementation should mirror the POSIX implementation via PyUnicode_FSDecoder. ---------- components: IO, Windows messages: 286585 nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Implement PEP 529 for io.FileIO type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________