From report at bugs.python.org Mon Oct 1 01:55:43 2018 From: report at bugs.python.org (pashkasan) Date: Mon, 01 Oct 2018 05:55:43 +0000 Subject: [New-bugs-announce] [issue34859] python core in string substring search Message-ID: <1538373343.13.0.545547206417.issue34859@psf.upfronthosting.co.za> New submission from pashkasan : find substring in string its correct behavior? sample code str = """ Content-Length: 3192 Connection: close Cookie: _secure_admin_session_id=2a5dc26329de17ca4eafxxxxxxxxxxxxe; -----------------------------1477319126846 Content-Disposition: form-data; name="utf8" """ str2 = """ xxxx zzzzz tttttt """ if "\r\n" in str: print ("str found") else: print ("str not found") if "\r\n" in str2: print ("str2 found") else: print ("str2 not found") if str.find("\n\r"): print ("str found") else: print ("str not found") output [root at scw-6ec0de ~]# python a.py str not found str2 not found str found [root at scw-6ec0de ~]# python3 a.py str not found str2 not found str found [root at scw-6ec0de ~]# python --version Python 2.7.15 [root at scw-6ec0de ~]# python3 --version Python 3.6.4 [root at scw-6ec0de ~]# ---------- components: Interpreter Core messages: 326764 nosy: pashkasan priority: normal severity: normal status: open title: python core in string substring search versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 1 04:36:44 2018 From: report at bugs.python.org (Michael Felt) Date: Mon, 01 Oct 2018 08:36:44 +0000 Subject: [New-bugs-announce] [issue34860] fix test_sqlite for AIX Message-ID: <1538383004.27.0.545547206417.issue34860@psf.upfronthosting.co.za> New submission from Michael Felt : On AIX test_sqlite fails with: ====================================================================== FAIL: test_database_source_name (sqlite3.test.backup.BackupTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/aixtools/python/git/aix-pr/Lib/sqlite3/test/backup.py", line 146, in test_database_source_name ['SQL logic error', 'SQL logic error or missing database'] AssertionError: 'unrecognized error code: 1' not found in ['SQL logic error', 'SQL logic error or missing database'] Likely this is because the sqlite3 that is installed either has a bug, is too old, or was overly optimized and the expected error message is not being returned. A simple addition as: def test_database_source_name(self): with sqlite.connect(':memory:') as bck: self.cx.backup(bck, name='main') with sqlite.connect(':memory:') as bck: self.cx.backup(bck, name='temp') with self.assertRaises(sqlite.OperationalError) as cm: with sqlite.connect(':memory:') as bck: self.cx.backup(bck, name='non-existing') self.assertIn( str(cm.exception), ['SQL logic error', 'SQL logic error or missing database', 'unrecognized error code: 1'] ) allows to test to pass. Again, this is not a problem with either python or AIX - only yhe implementation of sqlite3 installed. My hope is that the PR with the modification above (add 'unrecognized error code: 1') will be accepted. Thx for your consideration. ---------- messages: 326769 nosy: Michael.Felt priority: normal severity: normal status: open title: fix test_sqlite for AIX _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 1 07:13:17 2018 From: report at bugs.python.org (=?utf-8?q?Anders_Hovm=C3=B6ller?=) Date: Mon, 01 Oct 2018 11:13:17 +0000 Subject: [New-bugs-announce] [issue34861] Improve cProfile standard output Message-ID: <1538392397.89.0.545547206417.issue34861@psf.upfronthosting.co.za> New submission from Anders Hovm?ller : The standard output for cProfile when run from a command line is not very useful. It has two main flaws: - Default sort order is by name of function - It strips the full path of source files The first makes it very hard to look at the output. The second is very annoying when you get a bunch of __init__.py in the output. Suggested solution: - Default cumulative time sort order - Show one additional folder level when filename is __main__ or __init__ ---------- components: Library (Lib) messages: 326793 nosy: Anders.Hovm?ller priority: normal severity: normal status: open title: Improve cProfile standard output type: enhancement versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 1 14:04:59 2018 From: report at bugs.python.org (William Orr) Date: Mon, 01 Oct 2018 18:04:59 +0000 Subject: [New-bugs-announce] [issue34862] No longer builds on OpenBSD due to missing definition of convert_sched_param Message-ID: <1538417099.97.0.545547206417.issue34862@psf.upfronthosting.co.za> New submission from William Orr : [ worr on locke ] ( cpython ) % make -j15 [0] gcc -pthread -fno-strict-aliasing -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O2 -pipe -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I. -I./Include -fPIC -DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o ./Modules/posixmodule.c:5164: warning: 'convert_sched_param' used but never defined gcc -pthread -c -fno-strict-aliasing -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O2 -pipe -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I. -I./Include -fPIC -DPy_BUILD_CORE -DGITVERSION="\"`LC_ALL=C git --git-dir ./.git rev-parse --short HEAD`\"" -DGITTAG="\"`LC_ALL=C git --git-dir ./.git describe --all --always --dirty`\"" -DGITBRANCH="\"`LC_ALL=C git --git-dir ./.git name-rev --name-only HEAD`\"" -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c if test libpython3.8m.so.1.0 != libpython3.8m.so; then gcc -pthread -shared -fPIC -Wl,-hlibpython3.8m.so.1.0 -o libpython3.8m.so.1.0 Modules/getbuildinfo.o 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 Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/capsule.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/coreconfig.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/import.o Python/importdl.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/peephole.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/context.o Python/hamt.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.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/_abc.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_threadmodule.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/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.o Python/frozen.o -lpthread -lutil -lm -lm ; ln -f libpython3.8m.so.1.0 libpython3.8m.so; else gcc -pthread -shared -fPIC -o libpython3.8m.so Modules/getbuildinfo.o 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 Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/capsule.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/coreconfig.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/import.o Python/importdl.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/peephole.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/context.o Python/hamt.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.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/_abc.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_threadmodule.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/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.o Python/frozen.o -lpthread -lutil -lm -lm ; fi rm -f libpython3.8m.a ar rcs libpython3.8m.a Modules/getbuildinfo.o 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 Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/capsule.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/coreconfig.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/import.o Python/importdl.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/peephole.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/context.o Python/hamt.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.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/_abc.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_threadmodule.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/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.o Python/frozen.o /usr/bin/ld: Modules/posixmodule.o: relocation R_X86_64_PC32 against `convert_sched_param' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status *** Error 1 in /home/worr/proj/cpython (Makefile:642 'libpython3.8m.so') ---------- components: Build messages: 326818 nosy: worr priority: normal severity: normal status: open title: No longer builds on OpenBSD due to missing definition of convert_sched_param versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 1 15:29:30 2018 From: report at bugs.python.org (Andy Harrington) Date: Mon, 01 Oct 2018 19:29:30 +0000 Subject: [New-bugs-announce] [issue34863] Idle Mac scrolling only down Message-ID: <1538422170.25.0.545547206417.issue34863@psf.upfronthosting.co.za> New submission from Andy Harrington : In a source file in Idle I scroll down no matter which way I rotate the mouse wheel. This happens in no other app. Mac High Sierra OS. I have the Mac scrolling setup "natural" - backwards from the Windows directions. ---------- assignee: terry.reedy components: IDLE messages: 326821 nosy: andyharrington, terry.reedy priority: normal severity: normal status: open title: Idle Mac scrolling only down type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 1 15:36:12 2018 From: report at bugs.python.org (Andy Harrington) Date: Mon, 01 Oct 2018 19:36:12 +0000 Subject: [New-bugs-announce] [issue34864] In Idle, Mac tabs make bottom editor line with cursor location disappear Message-ID: <1538422572.97.0.545547206417.issue34864@psf.upfronthosting.co.za> New submission from Andy Harrington : Mac now puts multiple tabs inside of application window instead of starting a separate window (with some OS settings). With just one file being edited in Idle (no tab line) the bottom line with the numerical cursor coordinates is visible. When there are multiple tabs (and the tabbing heading therefore) the bottom cursor coordinates are missing. ---------- assignee: terry.reedy components: IDLE messages: 326822 nosy: andyharrington, terry.reedy priority: normal severity: normal status: open title: In Idle, Mac tabs make bottom editor line with cursor location disappear versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 1 16:36:46 2018 From: report at bugs.python.org (Rob Dalton) Date: Mon, 01 Oct 2018 20:36:46 +0000 Subject: [New-bugs-announce] [issue34865] Incorrect assignment of optional argument when partial match with different argument found. Message-ID: <1538426206.67.0.545547206417.issue34865@psf.upfronthosting.co.za> New submission from Rob Dalton : Parsing an unknown optional argument whose leading characters (e.g. '--user') match those of another, known optional argument (e.g. '--userdata') causes the unknown argument to be parsed as the known one. For example - passing the unknown argument '--user' to a parser with the known argument '--userdata' assigns the passed '--user' value to '--userdata'. Here's my setup info: Python: Python 3.6.3 :: Anaconda custom (64-bit) OS: MacOS High Sierra 10.13.6 Wrote up some example cases here: https://gist.github.com/rob-dalton/9ec06b8d5e2e9083713ddc7884d16072 ---------- components: Library (Lib) messages: 326824 nosy: rob-dalton priority: normal severity: normal status: open title: Incorrect assignment of optional argument when partial match with different argument found. type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 1 17:23:27 2018 From: report at bugs.python.org (Matthew Belisle) Date: Mon, 01 Oct 2018 21:23:27 +0000 Subject: [New-bugs-announce] [issue34866] CGI DOS vulnerability via long post list Message-ID: <1538429007.97.0.545547206417.issue34866@psf.upfronthosting.co.za> New submission from Matthew Belisle : Copied from email to security at python.org: I have been doing memory profiling on a few python web frameworks and I noticed this issue in the cgi.FieldStorage class. $ python example.py Memory used: 523935744 bytes The problem is there is no easy way to limit the number of MiniFieldStorage objects created by FieldStorage, so it goes unchecked in many frameworks like pyramid, pylons, webapp2, and flask. The end result is that on these frameworks, a 9MB request body (gzipped down to 9KB) can chew up ~500MB of memory on the server which is enough to effectively DOS it. The obvious way to prevent this currently is to check the content-length header and fail if it exceeds some value. But that solution has a major shortcoming because many frameworks want to allow large payloads, sometimes up to 10MB, as long as they contain a reasonable number of fields. After talking with the security at python.org team and pylons dev team about it, we think the best solution is to add a max_num_fields param to the FieldStorage class, defaulting to None, which throws an error if max_num_fields is exceeded. ---------- components: Library (Lib) messages: 326831 nosy: Matthew Belisle priority: normal severity: normal status: open title: CGI DOS vulnerability via long post list type: security versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 1 20:40:12 2018 From: report at bugs.python.org (Steven D'Aprano) Date: Tue, 02 Oct 2018 00:40:12 +0000 Subject: [New-bugs-announce] [issue34867] Add mode to disable small integer and interned string caches Message-ID: <1538440812.47.0.545547206417.issue34867@psf.upfronthosting.co.za> New submission from Steven D'Aprano : Split off from #34850 by Guido's request. To help catch incorrect use of `is` when `==` is intended, perhaps we should add an interpreter mode that disables the caches for small ints and interned strings. Nathaniel called it "chaos mode" but I don't like the name as there is nothing chaotic about the lack of such caches, and it doesn't come close to chaos testing (e.g. Netflix's Chaos Monkey tool). ---------- components: Interpreter Core messages: 326838 nosy: gregory.p.smith, njs, steven.daprano priority: normal severity: normal status: open title: Add mode to disable small integer and interned string caches versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 00:10:59 2018 From: report at bugs.python.org (Benjamin Peterson) Date: Tue, 02 Oct 2018 04:10:59 +0000 Subject: [New-bugs-announce] [issue34868] bad error message when combining _ grouping specifier with invalid type Message-ID: <1538453459.12.0.545547206417.issue34868@psf.upfronthosting.co.za> New submission from Benjamin Peterson : >>> format(34, '_n') Traceback (most recent call last): File "", line 1, in ValueError: Cannot specify ',' with 'n'. Why is it talking about ","? ---------- components: Interpreter Core messages: 326848 nosy: benjamin.peterson priority: normal severity: normal status: open title: bad error message when combining _ grouping specifier with invalid type versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 00:41:30 2018 From: report at bugs.python.org (Benjamin Peterson) Date: Tue, 02 Oct 2018 04:41:30 +0000 Subject: [New-bugs-announce] [issue34869] remove LDLAST Message-ID: <1538455290.81.0.545547206417.issue34869@psf.upfronthosting.co.za> New submission from Benjamin Peterson : The last thing setting LDLAST in configure seems to have been OSF/1. Support for OSF/1 was removed in 736e7fc0f6d1242b58ee91708873d14ed7856b77. So, I think we can kill LDLAST, too. ---------- components: Build messages: 326855 nosy: benjamin.peterson priority: normal severity: normal status: open title: remove LDLAST versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 04:50:59 2018 From: report at bugs.python.org (Per Lundberg) Date: Tue, 02 Oct 2018 08:50:59 +0000 Subject: [New-bugs-announce] [issue34870] Core dump when Python VSCode debugger is attached Message-ID: <1538470259.0.0.545547206417.issue34870@psf.upfronthosting.co.za> New submission from Per Lundberg : My code has recently started triggering a core dump in the Python executable when the VSCode debugger is attached. This doesn't happen right away; it seems to happen more or less _after_ the program is done executing (I just placed a breakpoint and stepped it through). The program in question is this: https://github.com/hiboxsystems/trac-to-gitlab/blob/master/migrate.py To help in the debugging of this, I installed python2.7-dbg and gdb-python2 on my Debian machine, and re-ran the script using this version. Here is the GDB output when analyzing the backtrace: $ gdb /usr/bin/python2.7-dbg core GNU gdb (Debian 8.1-4+b1) 8.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/bin/python2.7-dbg...done. [New LWP 19749] [New LWP 19744] [New LWP 19747] [New LWP 19754] [New LWP 19751] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/usr/bin/python2.7-dbg -m ptvsd --host localhost --port 43959 migrate.py --only'. Program terminated with signal SIGSEGV, Segmentation fault. #0 PyEval_EvalFrameEx (f=0x7f815c002310, throwflag=0) at ../Python/ceval.c:3347 3347 if (tstate->frame->f_exc_type != NULL) [Current thread is 1 (Thread 0x7f815bfff700 (LWP 19749))] The python backtrace looks like this: (gdb) py-bt Traceback (most recent call first): File "/usr/lib/python2.7/threading.py", line 371, in wait self._acquire_restore(saved_state) File "/usr/lib/python2.7/Queue.py", line 177, in get self.not_empty.wait(remaining) File "/home/per/.vscode/extensions/ms-python.python-2018.8.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 458, in _on_run cmd = self.cmdQueue.get(1, 0.1) File "/home/per/.vscode/extensions/ms-python.python-2018.8.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py", line 319, in run self._on_run() File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 774, in __bootstrap self.__bootstrap_inner() And the C-level backtrace: (gdb) bt #0 PyEval_EvalFrameEx (f=Frame 0x7f815c002310, for file /usr/lib/python2.7/threading.py, line 371, in wait (), throwflag=0) at ../Python/ceval.c:3347 #1 0x00005624534af42c in PyEval_EvalCodeEx (co=0x7f816216e7d0, globals={'current_thread': None, '_BoundedSemaphore': None, 'currentThread': None, '_Timer': None, '_format_exc': None, 'Semaphore': None, '_deque': None, 'activeCount': None, '_profile_hook': None, '_sleep': None, '_trace_hook': None, 'ThreadError': None, '_enumerate': None, '_start_new_thread': None, 'BoundedSemaphore': None, '_shutdown': None, '__all__': None, '_original_start_new_thread': None, '_Event': None, 'active_count': None, '__package__': None, '_Condition': None, '_RLock': None, '_test': None, 'local': None, '__doc__': None, 'Condition': None, '_Verbose': None, '_DummyThread': None, 'Thread': None, 'warnings': None, '__builtins__': {'bytearray': None, 'IndexError': None, 'all': None, 'help': None, 'vars': None, 'SyntaxError': None, 'unicode': None, 'UnicodeDecodeError': None, 'memoryview': None, 'isinstance': None, 'copyright': None, 'NameError': None, 'BytesWarning': None, 'dict': None, 'input': None, 'oct': None, 'bin': None, 'SystemExit': None, 'StandardError': None, 'format': None, 'repr': None, 'sor...(truncated), locals=0x0, args=0x562454463068, argcount=2, kws=0x562454463078, kwcount=0, defs=0x7f8162116408, defcount=1, closure=0x0) at ../Python/ceval.c:3604 #2 0x00005624534b23a7 in fast_function (func=, pp_stack=0x7f815bffd3e8, n=2, na=2, nk=0) at ../Python/ceval.c:4467 #3 0x00005624534b1f8a in call_function (pp_stack=0x7f815bffd3e8, oparg=1) at ../Python/ceval.c:4392 #4 0x00005624534ac45d in PyEval_EvalFrameEx ( f=Frame 0x562454462eb0, for file /usr/lib/python2.7/Queue.py, line 177, in get (self=, maxsize=0, all_tasks_done=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc0d0>, mutex=, not_full=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc060>, not_empty=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, pp_stack=0x7f815bffd9f8, n=3, na=3, nk=0) at ../Python/ceval.c:4467 #7 0x00005624534b1f8a in call_function (pp_stack=0x7f815bffd9f8, oparg=2) at ../Python/ceval.c:4392 #8 0x00005624534ac45d in PyEval_EvalFrameEx ( f=Frame 0x7f8150000ff0, for file /home/per/.vscode/extensions/ms-python.python-2018.8.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py, line 458, in _on_run (self=, maxsize=0, all_tasks_done=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc0d0>, mutex=, not_full=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610b...(truncated), throwflag=0) at ../Python/ceval.c:3009 #9 0x00005624534b2291 in fast_function (func=, pp_stack=0x7f815bffde78, n=1, na=1, nk=0) at ../Python/ceval.c:4457 #10 0x00005624534b1f8a in call_function (pp_stack=0x7f815bffde78, oparg=0) at ../Python/ceval.c:4392 #11 0x00005624534ac45d in PyEval_EvalFrameEx ( f=Frame 0x7f8150000dd0, for file /home/per/.vscode/extensions/ms-python.python-2018.8.0/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py, line 319, in run (self=, maxsize=0, all_tasks_done=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc0d0>, mutex=, not_full=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc060...(truncated), throwflag=0) at ../Python/ceval.c:3009 #12 0x00005624534b2291 in fast_function (func=, pp_stack=0x7f815bffe2f8, n=1, na=1, nk=0) at ../Python/ceval.c:4457 #13 0x00005624534b1f8a in call_function (pp_stack=0x7f815bffe2f8, oparg=0) at ../Python/ceval.c:4392 #14 0x00005624534ac45d in PyEval_EvalFrameEx ( f=Frame 0x7f8150000b80, for file /usr/lib/python2.7/threading.py, line 801, in __bootstrap_inner (self=, maxsize=0, all_tasks_done=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc0d0>, mutex=, not_full=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc060>, not_empty=<_Condition(_Verbose__verbose=False, _Condition__lock=, pp_stack=0x7f815bffe778, n=1, na=1, nk=0) at ../Python/ceval.c:4457 #16 0x00005624534b1f8a in call_function (pp_stack=0x7f815bffe778, oparg=0) at ../Python/ceval.c:4392 #17 0x00005624534ac45d in PyEval_EvalFrameEx ( f=Frame 0x7f81610b9df0, for file /usr/lib/python2.7/threading.py, line 774, in __bootstrap (self=, maxsize=0, all_tasks_done=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc0d0>, mutex=, not_full=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc060>, not_empty=<_Condition(_Verbose__verbose=False, _Condition__lock=, arg=(, maxsize=0, all_tasks_done=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc0d0>, mutex=, not_full=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc060>, not_empty=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Con...(truncated), kw=0x0) at ../Objects/funcobject.c:523 #20 0x00005624533a3730 in PyObject_Call (func=, arg=(, maxsize=0, all_tasks_done=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc0d0>, mutex=, not_full=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc060>, not_empty=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Con...(truncated), kw=0x0) at ../Objects/abstract.c:2544 #21 0x00005624533bf50c in instancemethod_call (func=, arg=(, maxsize=0, all_tasks_done=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc0d0>, mutex=, not_full=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Condition__waiters=[], release=) at remote 0x7f81610bc060>, not_empty=<_Condition(_Verbose__verbose=False, _Condition__lock=, acquire=, _Con...(truncated), kw=0x0) at ../Objects/classobject.c:2600 #22 0x00005624533a3730 in PyObject_Call (func=, arg=(), kw=0x0) at ../Objects/abstract.c:2544 #23 0x00005624534b14d3 in PyEval_CallObjectWithKeywords (func=, arg=(), kw=0x0) at ../Python/ceval.c:4241 #24 0x00005624535ad097 in t_bootstrap (boot_raw=0x7f81615efaa8) at ../Modules/threadmodule.c:620 #25 0x00007f8162ac6f2a in start_thread (arg=0x7f815bfff700) at pthread_create.c:463 #26 0x00007f816263dedf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 The failing tstate object being mentioned initially looks like this: (gdb) print *tstate $1 = {next = 0x562453b13590, interp = 0x56245391a280, frame = 0x0, recursion_depth = 8, tracing = 0, use_tracing = 0, c_profilefunc = 0x0, c_tracefunc = 0x0, c_profileobj = 0x0, c_traceobj = 0x0, curexc_type = , curexc_value = "local variable 'self' referenced before assignment", curexc_traceback = , exc_type = 0x0, exc_value = 0x0, exc_traceback = 0x0, dict = 0x0, tick_counter = 153, gilstate_counter = 1, async_exc = 0x0, thread_id = 140193571010304, trash_delete_nesting = 0, trash_delete_later = 0x0} So the NULL pointer being dereferenced is tstate->frame, as hinted to by GDB. I do not know the Python internals well enough to dig much deeper than this for now, but maybe this helps? If not, let me know - I have the core dump readily available to debug this further. (Can unfortunately provide a copy of the core dump per se since it likely contains credentials/other sensitive info.) More details: VSCode extension version: 2018.8.0 python2.7-dbg Debian package version: 2.7.15-4 ---------- components: Interpreter Core messages: 326869 nosy: Per Lundberg priority: normal severity: normal status: open title: Core dump when Python VSCode debugger is attached versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 10:37:42 2018 From: report at bugs.python.org (Chih-Hsuan Yen) Date: Tue, 02 Oct 2018 14:37:42 +0000 Subject: [New-bugs-announce] [issue34871] test_site fails if run after test_inspect Message-ID: <1538491062.89.0.545547206417.issue34871@psf.upfronthosting.co.za> New submission from Chih-Hsuan Yen : $ ./python -m test.regrtest test_inspect test_site Run tests sequentially 0:00:00 load avg: 0.03 [1/2] test_inspect 0:00:00 load avg: 0.03 [2/2] test_site test test_site failed -- Traceback (most recent call last): File "/home/yen/Projects/cpython/Lib/test/test_site.py", line 400, in test_abs_paths_cached_None site.abs_paths() File "/home/yen/Projects/cpython/Lib/site.py", line 101, in abs_paths for m in set(sys.modules.values()): TypeError: unhashable type: 'dict' test_site failed If I run test_inspect or test_site individually, both pass. Full log can be found in the attached file. Environment: Arch Linux x86_64 latest. CPython commit 81574b80e92554adf75c13fa42415beb8be383cb, configured with `./configure` ---------- components: Tests files: cpython-failure.txt messages: 326881 nosy: yan12125 priority: normal severity: normal status: open title: test_site fails if run after test_inspect type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file47842/cpython-failure.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 15:30:38 2018 From: report at bugs.python.org (Yury Selivanov) Date: Tue, 02 Oct 2018 19:30:38 +0000 Subject: [New-bugs-announce] [issue34872] investigate task/future cancellation in asynciomodule.c Message-ID: <1538508638.07.0.545547206417.issue34872@psf.upfronthosting.co.za> New submission from Yury Selivanov : Vladimir Matveev has discovered that C and Python implementation of asyncio.Task diverge: * asynciomodule.c: https://github.com/python/cpython/blob/9012a0fb4c4ec1afef9efb9fdb0964554ea17983/Modules/_asynciomodule.c#L2716 * tasks.py: https://github.com/python/cpython/blob/9012a0fb4c4ec1afef9efb9fdb0964554ea17983/Lib/asyncio/tasks.py#L286 In tasks.py we call "fut_obj.cancel()", so either "Task.cancel()" or "Future.cancel()" can be called depending on what "fut_obj" is. In asynciomodule.c we essentially always call "Future.cancel(fut_obj)". This probably leads to unexpected behaviour if "fut_obj" is either a Task or a Task subclass with an overloaded "cancel()" method. We need to first write a set of tests to understand the scope of this; then we'll need to patch asynciomodule.c and backport this to 3.7 & 3.6. ---------- components: asyncio messages: 326896 nosy: Elvis.Pranskevichus, asvetlov, yselivanov priority: normal severity: normal status: open title: investigate task/future cancellation in asynciomodule.c versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 17:29:14 2018 From: report at bugs.python.org (Tom Dawes) Date: Tue, 02 Oct 2018 21:29:14 +0000 Subject: [New-bugs-announce] [issue34873] re.finditer behaviour in re.MULTILINE mode fails to match first 7 characters Message-ID: <1538515754.54.0.545547206417.issue34873@psf.upfronthosting.co.za> New submission from Tom Dawes : re.finditer appears to fail to match within the first 7 characters in a string when re.MULTILINE is used: >>> REGEX = re.compile("y") >>> [list(m.start() for m in REGEX.finditer("{}y".format("x"*i), re.MULTILINE)) for i in range(10)] [[], [], [], [], [], [], [], [], [8], [9]] Without re.MULTILINE, this works fine: >>> [list(m.start() for m in REGEX.finditer("{}y".format("x"*i))) for i in range(10)] [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]] Passing re.MULTILINE to re.compile doesn't seem to have any effect. ---------- components: Regular Expressions messages: 326911 nosy: ezio.melotti, mrabarnett, tdawes priority: normal severity: normal status: open title: re.finditer behaviour in re.MULTILINE mode fails to match first 7 characters type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 17:38:40 2018 From: report at bugs.python.org (Tim McDonough) Date: Tue, 02 Oct 2018 21:38:40 +0000 Subject: [New-bugs-announce] [issue34874] Python 3.6.3 command script wrapped in single quotes produces NameError: name 'A' is not defined Message-ID: <1538516320.45.0.545547206417.issue34874@psf.upfronthosting.co.za> New submission from Tim McDonough : I found an odd behavior that seems to be limited to Python 3.6.3. Python 3.6.3 command scripts seem to prefer wrapping in double quotes instead of single quotes. Here is an example of the error. $ echo -n '{"A":"a"}' | python3 -c 'import sys,json; j=json.load(sys.stdin); print(j["A"])' Traceback (most recent call last): File "", line 1, in NameError: name 'A' is not defined # Swapping single and double quotes works as expected. # $ echo -n '{"A":"a"}' | python3 -c "import sys,json; j=json.load(sys.stdin); print(j['A'])" a # Executing the original, failing script against python 2.6.6 works. # $ echo -n '{"A":"a"}' | python2 -c 'import sys,json; j=json.load(sys.stdin); print(j["A"])' a The failing environment is: $ bash --version GNU bash, version 4.1.2(2)-release (x86_64-redhat-linux-gnu) $ gcc --version gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23) These python versions also seem to work fine: 2.6.6, 2.7.9, 3.5.1, and 3.5.2. Assigning the script to an environment variable follows the single/double quote issue. For example, this fails: $ export python_script='import sys,json; j=json.load(sys.stdin); print(j["A"])' $ echo -n '{"A": "a"}' | python3 -c "${python_script}" This would be a good unit test candidate if not already present. ---------- components: Tests messages: 326916 nosy: Tim McDonough priority: normal severity: normal status: open title: Python 3.6.3 command script wrapped in single quotes produces NameError: name 'A' is not defined type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 18:28:39 2018 From: report at bugs.python.org (Myles Borins) Date: Tue, 02 Oct 2018 22:28:39 +0000 Subject: [New-bugs-announce] [issue34875] Change .js mime to "test/javascript" Message-ID: <1538519319.52.0.545547206417.issue34875@psf.upfronthosting.co.za> New submission from Myles Borins : I propose to change the mapping of file extension .js to mime type "text/javascript" from "application/javascript. "text/javascript" is the currently documented best practice in the whatwg HTML spec. https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages:javascript-mime-type ---------- components: Library (Lib) messages: 326920 nosy: mylesborins priority: normal severity: normal status: open title: Change .js mime to "test/javascript" versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 19:06:44 2018 From: report at bugs.python.org (Ned Batchelder) Date: Tue, 02 Oct 2018 23:06:44 +0000 Subject: [New-bugs-announce] [issue34876] Python3.8 changes how decorators are traced Message-ID: <1538521604.52.0.545547206417.issue34876@psf.upfronthosting.co.za> New submission from Ned Batchelder : When decorating a function, the sequence of lines reported to the trace function is different in Python3.8 than with previous versions $ cat -n decorator.py 1 def decorator(f): 2 return f 3 4 def f(): 5 @decorator 6 @decorator 7 @decorator 8 def func(): 9 pass 10 11 import sys 12 def trace(frame, event, args): 13 print(frame.f_lineno, event) 14 return trace 15 16 sys.settrace(trace) 17 f() $ python3.7 decorator.py 4 call 5 line 6 line 7 line 1 call 2 line 2 return 1 call 2 line 2 return 1 call 2 line 2 return 7 return $ python3.8 decorator.py 4 call 5 line 6 line 7 line 5 line 1 call 2 line 2 return 1 call 2 line 2 return 1 call 2 line 2 return 5 return Is this intentional? Will it be changed back before 3.8 ships? People are testing their projects against 3.8-dev, and reporting problems with coverage. The problems are due to these sorts of changes. ---------- components: Interpreter Core messages: 326921 nosy: nedbat priority: normal severity: normal status: open title: Python3.8 changes how decorators are traced versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 19:16:54 2018 From: report at bugs.python.org (Tom Ashley) Date: Tue, 02 Oct 2018 23:16:54 +0000 Subject: [New-bugs-announce] [issue34877] Inconsistent Behavior Of futures.ProcessPoolExecutor Message-ID: <1538522214.4.0.545547206417.issue34877@psf.upfronthosting.co.za> New submission from Tom Ashley : Not sure if this goes in core or modules. There is an inconsistency in the output of the attached script. From the docs I read it's supposed to have the behavior of: "If something happens to one of the worker processes to cause it to exit unexpectedly, the ProcessPoolExecutor is considered ?broken? and will no longer schedule tasks." That script is supposed to exemplify that. Instead, if I run the code several times, I get the following output: (bot-LP2ewIkY) ?> ~/w/p/b/bot on master ? python brokenPool.py 18:54:55 getting the pid for one worker killing process 4373 submitting another task could not start new tasks: A process in the process pool was terminated abruptly while the future was running or pending. (bot-LP2ewIkY) ?> ~/w/p/b/bot on master ? python brokenPool.py 18:54:56 getting the pid for one worker killing process 4443 submitting another task could not start new tasks: A process in the process pool was terminated abruptly while the future was running or pending. (bot-LP2ewIkY) ?> ~/w/p/b/bot on master ? python brokenPool.py 18:54:57 getting the pid for one worker killing process 4514 submitting another task <----- (No exception thrown after this) The exception isn't always thrown. This seems problematic to me. Related stack post: https://stackoverflow.com/questions/52617558/python-inconsistent-behavior-of-futures-processpoolexecutor ---------- components: Interpreter Core files: brokenPool.py messages: 326922 nosy: TensorTom priority: normal severity: normal status: open title: Inconsistent Behavior Of futures.ProcessPoolExecutor versions: Python 3.7 Added file: https://bugs.python.org/file47843/brokenPool.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 2 19:41:46 2018 From: report at bugs.python.org (ulrich.stern) Date: Tue, 02 Oct 2018 23:41:46 +0000 Subject: [New-bugs-announce] [issue34878] Lock Objects documentation bug Message-ID: <1538523706.16.0.545547206417.issue34878@psf.upfronthosting.co.za> New submission from ulrich.stern : The first sentence of the documentation for Lock Objects (https://docs.python.org/2/library/threading.html#lock-objects) seems incorrect. It currently states "A primitive lock is a synchronization primitive that is not owned by a particular thread when locked." The "not" should be deleted. (Alternatively, one could change "locked" to "unlocked.") ---------- assignee: docs at python components: Documentation messages: 326926 nosy: docs at python, ulrich.stern priority: normal severity: normal status: open title: Lock Objects documentation bug versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 00:53:44 2018 From: report at bugs.python.org (Zackery Spytz) Date: Wed, 03 Oct 2018 04:53:44 +0000 Subject: [New-bugs-announce] [issue34879] bytesobject.c: Possible null pointer dereference due to formatfloat() Message-ID: <1538542424.67.0.545547206417.issue34879@psf.upfronthosting.co.za> New submission from Zackery Spytz : The PyBytes_FromStringAndSize() call in formatfloat() is not checked for failure. ---------- components: Interpreter Core messages: 326933 nosy: ZackerySpytz priority: normal severity: normal status: open title: bytesobject.c: Possible null pointer dereference due to formatfloat() type: crash versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 02:58:30 2018 From: report at bugs.python.org (vtheno athena) Date: Wed, 03 Oct 2018 06:58:30 +0000 Subject: [New-bugs-announce] [issue34880] About the "assert" bytecode Message-ID: <1538549910.96.0.545547206417.issue34880@psf.upfronthosting.co.za> New submission from vtheno athena : When I was involved in the YaPyPy project, I found a problem, An source "assert 0" will compile to an bytecode, On that bytecode sequence, it always raise a "AssertionError" from global, when we rewrite global "AssertionError" like here: ``` class AssertionError(Exception): def __init__(self,msg): self.msg = f"User AssertionError: {msg}" # other code ``` so, "assert" is meta-programming? ---------- messages: 326942 nosy: vtheno athena priority: normal severity: normal status: open title: About the "assert" bytecode type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 03:06:28 2018 From: report at bugs.python.org (Bryce Drennan) Date: Wed, 03 Oct 2018 07:06:28 +0000 Subject: [New-bugs-announce] [issue34881] unnecessary encoded-words usage breaks DKIM signatures Message-ID: <1538550388.79.0.545547206417.issue34881@psf.upfronthosting.co.za> New submission from Bryce Drennan : Since Python 3.6.4 folding of unstructured headers uses the encoded words syntax even if there are no special characters. This makes DKIM-Signature headers that are unreadable to google's gmail servers. It may be that encoded-words are not valid in this header. I don't see them mentioned here: https://tools.ietf.org/html/rfc6376#page-8 Here is the smallest test case I could create to demonstrate the issue. One solution would be to add DKIM-Signature to the HeaderRegistry but I'm not yet expert enough to execute this. I went down that path for a few hours. Didn't see a straight-forward way to disable encoded words. Setting EmailPolicy(max_line_length=None) does output without encoded words but I worry that will cause different incompatibility issues. from email.headerregistry import HeaderRegistry from email.policy import SMTP def test_unstructured_encoded_word_folding(): header = HeaderRegistry()('DKIM-Signature', 'a' * 85) folded = header.fold(policy=SMTP.clone(refold_source=None)) print(f'\nDKIM-Signature: {header}') print(folded) assert '=?utf-8?q?' not in folded Output: DKIM-Signature: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa DKIM-Signature: =?utf-8?q?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?= =?utf-8?q?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?= AssertionError()! ---------- components: email messages: 326943 nosy: barry, bryced, r.david.murray priority: normal severity: normal status: open title: unnecessary encoded-words usage breaks DKIM signatures versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 04:01:12 2018 From: report at bugs.python.org (metaxm) Date: Wed, 03 Oct 2018 08:01:12 +0000 Subject: [New-bugs-announce] [issue34882] f(a=1, *args) should be a SyntaxError Message-ID: <1538553672.9.0.545547206417.issue34882@psf.upfronthosting.co.za> New submission from metaxm : >>> def f(a, b, c): ... pass >>> f(a=1, 2, 3) SyntaxError: positional argument follows keyword argument >>> f(a=1, *(2, 3)) TypeError: f() got multiple values for argument 'a' f(a=1, 2, 3) will cause a SyntaxError, but f(a=1, *(2, 3)) will cause a TypeError. This makes me feel confused. As keyword arguments must follow positional arguments, I suppose a SyntaxError rather than a TypeError should be reported if a variadic argument follows keyword arguments. Would you kindly explain why the CPython takes different actions for these two cases? ---------- components: Interpreter Core messages: 326945 nosy: metaxm priority: normal severity: normal status: open title: f(a=1, *args) should be a SyntaxError type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 06:32:44 2018 From: report at bugs.python.org (=?utf-8?b?TWljaGHFgiBHw7Nybnk=?=) Date: Wed, 03 Oct 2018 10:32:44 +0000 Subject: [New-bugs-announce] [issue34883] test_lzma: Multiple test failures when liblzma is built without complete codec set Message-ID: <1538562764.11.0.545547206417.issue34883@psf.upfronthosting.co.za> New submission from Micha? G?rny : xz-utils has four options to configure codecs supported by liblzma: --enable-encoders --enable-decoders --enable-match-finders --enable-checks In Gentoo, we're using those options to optionally provide smaller footprint liblzma builds that include only the standard set of codecs used by .xz archives (i.e. that work with any archive created by xz/lzma without expert options used). However, it seems that the CPython test suite wrongly presumes that all codecs are always available and it fails on LZMAErrors when those are not present. I'm attaching the verbose output of test_lzma. I think the best solution here would be to catch LZMAError and skipTest() if it's LZMA_OPTIONS_ERROR. I think this would be best done by exposing the underlying error code in LZMAError exception (rather than string-matching, though the latter would also work). ---------- components: Tests files: lzma-test.txt messages: 326960 nosy: mgorny priority: normal severity: normal status: open title: test_lzma: Multiple test failures when liblzma is built without complete codec set type: enhancement versions: Python 3.8 Added file: https://bugs.python.org/file47845/lzma-test.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 06:34:36 2018 From: report at bugs.python.org (Tim Hutt) Date: Wed, 03 Oct 2018 10:34:36 +0000 Subject: [New-bugs-announce] [issue34884] Python loads incorrect libraries Message-ID: <1538562876.74.0.545547206417.issue34884@psf.upfronthosting.co.za> New submission from Tim Hutt : See this issue: https://bugs.llvm.org/show_bug.cgi?id=38974 Basically if you have a copy of Python 2 installed on OSX from brew (as well as the system Python 2), then when you run lldb (which links to the system Python 2), at some point Python gets confused and starts loading libraries from the brew version of Python 2. To reproduce: 1. Install Xcode. 2. `brew install python2` 3. Create some executable. 4. `lldb a.out` The output is: (lldb) target create "a.out" Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in import weakref File "/usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in from _weakref import ( ImportError: cannot import name _remove_dead_weakref You can also run it like this: $ cp /usr/bin/lldb ~/lldb # Work around SIP $ DYLD_PRINT_LIBRARIES=1 ./lldb a.out And it gives the output below (note lines marked with *******). dyld: loaded: /Users/me/./lldb dyld: loaded: /usr/lib/libxcselect.dylib dyld: loaded: /usr/lib/libSystem.B.dylib dyld: loaded: /usr/lib/system/libcache.dylib dyld: loaded: /usr/lib/system/libcommonCrypto.dylib dyld: loaded: /usr/lib/system/libcompiler_rt.dylib dyld: loaded: /usr/lib/system/libcopyfile.dylib dyld: loaded: /usr/lib/system/libcorecrypto.dylib dyld: loaded: /usr/lib/system/libdispatch.dylib dyld: loaded: /usr/lib/system/libdyld.dylib dyld: loaded: /usr/lib/system/libkeymgr.dylib dyld: loaded: /usr/lib/system/liblaunch.dylib dyld: loaded: /usr/lib/system/libmacho.dylib dyld: loaded: /usr/lib/system/libquarantine.dylib dyld: loaded: /usr/lib/system/libremovefile.dylib dyld: loaded: /usr/lib/system/libsystem_asl.dylib dyld: loaded: /usr/lib/system/libsystem_blocks.dylib dyld: loaded: /usr/lib/system/libsystem_c.dylib dyld: loaded: /usr/lib/system/libsystem_configuration.dylib dyld: loaded: /usr/lib/system/libsystem_coreservices.dylib dyld: loaded: /usr/lib/system/libsystem_darwin.dylib dyld: loaded: /usr/lib/system/libsystem_dnssd.dylib dyld: loaded: /usr/lib/system/libsystem_info.dylib dyld: loaded: /usr/lib/system/libsystem_m.dylib dyld: loaded: /usr/lib/system/libsystem_malloc.dylib dyld: loaded: /usr/lib/system/libsystem_network.dylib dyld: loaded: /usr/lib/system/libsystem_networkextension.dylib dyld: loaded: /usr/lib/system/libsystem_notify.dylib dyld: loaded: /usr/lib/system/libsystem_sandbox.dylib dyld: loaded: /usr/lib/system/libsystem_secinit.dylib dyld: loaded: /usr/lib/system/libsystem_kernel.dylib dyld: loaded: /usr/lib/system/libsystem_platform.dylib dyld: loaded: /usr/lib/system/libsystem_pthread.dylib dyld: loaded: /usr/lib/system/libsystem_symptoms.dylib dyld: loaded: /usr/lib/system/libsystem_trace.dylib dyld: loaded: /usr/lib/system/libunwind.dylib dyld: loaded: /usr/lib/system/libxpc.dylib dyld: loaded: /usr/lib/closure/libclosured.dylib dyld: loaded: /usr/lib/libobjc.A.dylib dyld: loaded: /usr/lib/libc++abi.dylib dyld: loaded: /usr/lib/libc++.1.dylib dyld: loaded: /Applications/Xcode.app/Contents/Developer/usr/lib/libxcrun.dylib dyld: loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation dyld: loaded: /usr/lib/libDiagnosticMessagesClient.dylib dyld: loaded: /usr/lib/libicucore.A.dylib dyld: loaded: /usr/lib/libz.1.dylib dyld: loaded: /Applications/Xcode.app/Contents/Developer/usr/bin/lldb dyld: loaded: /usr/lib/libz.1.dylib dyld: loaded: /usr/lib/libcompression.dylib dyld: loaded: /usr/lib/libpanel.5.4.dylib dyld: loaded: /usr/lib/libncurses.5.4.dylib dyld: loaded: /Applications/Xcode.app/Contents/Developer/usr/bin/../../../SharedFrameworks/LLDB.framework/LLDB dyld: loaded: /usr/lib/libc++.1.dylib dyld: loaded: /usr/lib/libSystem.B.dylib dyld: loaded: /usr/lib/system/libcache.dylib dyld: loaded: /usr/lib/system/libcommonCrypto.dylib dyld: loaded: /usr/lib/system/libcompiler_rt.dylib dyld: loaded: /usr/lib/system/libcopyfile.dylib dyld: loaded: /usr/lib/system/libcorecrypto.dylib dyld: loaded: /usr/lib/system/libdispatch.dylib dyld: loaded: /usr/lib/system/libdyld.dylib dyld: loaded: /usr/lib/system/libkeymgr.dylib dyld: loaded: /usr/lib/system/liblaunch.dylib dyld: loaded: /usr/lib/system/libmacho.dylib dyld: loaded: /usr/lib/system/libquarantine.dylib dyld: loaded: /usr/lib/system/libremovefile.dylib dyld: loaded: /usr/lib/system/libsystem_asl.dylib dyld: loaded: /usr/lib/system/libsystem_blocks.dylib dyld: loaded: /usr/lib/system/libsystem_c.dylib dyld: loaded: /usr/lib/system/libsystem_configuration.dylib dyld: loaded: /usr/lib/system/libsystem_coreservices.dylib dyld: loaded: /usr/lib/system/libsystem_darwin.dylib dyld: loaded: /usr/lib/system/libsystem_dnssd.dylib dyld: loaded: /usr/lib/system/libsystem_info.dylib dyld: loaded: /usr/lib/system/libsystem_m.dylib dyld: loaded: /usr/lib/system/libsystem_malloc.dylib dyld: loaded: /usr/lib/system/libsystem_network.dylib dyld: loaded: /usr/lib/system/libsystem_networkextension.dylib dyld: loaded: /usr/lib/system/libsystem_notify.dylib dyld: loaded: /usr/lib/system/libsystem_sandbox.dylib dyld: loaded: /usr/lib/system/libsystem_secinit.dylib dyld: loaded: /usr/lib/system/libsystem_kernel.dylib dyld: loaded: /usr/lib/system/libsystem_platform.dylib dyld: loaded: /usr/lib/system/libsystem_pthread.dylib dyld: loaded: /usr/lib/system/libsystem_symptoms.dylib dyld: loaded: /usr/lib/system/libsystem_trace.dylib dyld: loaded: /usr/lib/system/libunwind.dylib dyld: loaded: /usr/lib/system/libxpc.dylib dyld: loaded: /usr/lib/closure/libclosured.dylib dyld: loaded: /usr/lib/libobjc.A.dylib dyld: loaded: /usr/lib/libc++abi.dylib dyld: loaded: /usr/lib/liblzma.5.dylib dyld: loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python *********** dyld: loaded: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation dyld: loaded: /System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols dyld: loaded: /System/Library/Frameworks/Security.framework/Versions/A/Security dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices dyld: loaded: /usr/lib/libedit.3.dylib dyld: loaded: /usr/lib/libxml2.2.dylib dyld: loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation dyld: loaded: /usr/lib/libauto.dylib dyld: loaded: /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration dyld: loaded: /usr/lib/libarchive.2.dylib dyld: loaded: /usr/lib/libDiagnosticMessagesClient.dylib dyld: loaded: /usr/lib/libicucore.A.dylib dyld: loaded: /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork dyld: loaded: /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration dyld: loaded: /usr/lib/liblangid.dylib dyld: loaded: /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit dyld: loaded: /usr/lib/libCRFSuite.dylib dyld: loaded: /usr/lib/libenergytrace.dylib dyld: loaded: /usr/lib/libbsm.0.dylib dyld: loaded: /usr/lib/system/libkxld.dylib dyld: loaded: /usr/lib/libOpenScriptingUtil.dylib dyld: loaded: /usr/lib/libcoretls.dylib dyld: loaded: /usr/lib/libcoretls_cfhelpers.dylib dyld: loaded: /usr/lib/libpam.2.dylib dyld: loaded: /usr/lib/libsqlite3.dylib dyld: loaded: /usr/lib/libxar.1.dylib dyld: loaded: /usr/lib/libbz2.1.0.dylib dyld: loaded: /usr/lib/libnetwork.dylib dyld: loaded: /usr/lib/libapple_nghttp2.dylib dyld: loaded: /usr/lib/libpcap.A.dylib dyld: loaded: /usr/lib/libboringssl.dylib dyld: loaded: /usr/lib/libusrtcp.dylib dyld: loaded: /usr/lib/libapple_crypto.dylib dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices dyld: loaded: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList dyld: loaded: /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS dyld: loaded: /System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth dyld: loaded: /System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport dyld: loaded: /System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC dyld: loaded: /usr/lib/libmecabra.dylib dyld: loaded: /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics dyld: loaded: /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText dyld: loaded: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO dyld: loaded: /System/Library/Frameworks/ColorSync.framework/Versions/A/ColorSync dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSyncLegacy.framework/Versions/A/ColorSyncLegacy dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis dyld: loaded: /System/Library/PrivateFrameworks/SkyLight.framework/Versions/A/SkyLight dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate dyld: loaded: /System/Library/Frameworks/CoreDisplay.framework/Versions/A/CoreDisplay dyld: loaded: /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface dyld: loaded: /System/Library/Frameworks/Metal.framework/Versions/A/Metal dyld: loaded: /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport dyld: loaded: /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBNNS.dylib dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libQuadrature.dylib dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparse.dylib dyld: loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparseBLAS.dylib dyld: loaded: /System/Library/PrivateFrameworks/GPUWrangler.framework/Versions/A/GPUWrangler dyld: loaded: /System/Library/PrivateFrameworks/IOAccelerator.framework/Versions/A/IOAccelerator dyld: loaded: /System/Library/PrivateFrameworks/IOPresentment.framework/Versions/A/IOPresentment dyld: loaded: /System/Library/PrivateFrameworks/DSExternalDisplay.framework/Versions/A/DSExternalDisplay dyld: loaded: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreFSCache.dylib dyld: loaded: /System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage dyld: loaded: /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo dyld: loaded: /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL dyld: loaded: /System/Library/PrivateFrameworks/GraphVisualizer.framework/Versions/A/GraphVisualizer dyld: loaded: /System/Library/Frameworks/MetalPerformanceShaders.framework/Versions/A/MetalPerformanceShaders dyld: loaded: /usr/lib/libFosl_dynamic.dylib dyld: loaded: /System/Library/PrivateFrameworks/FaceCore.framework/Versions/A/FaceCore dyld: loaded: /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontParser.dylib dyld: loaded: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/Resources/libFontRegistry.dylib dyld: loaded: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib dyld: loaded: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib dyld: loaded: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib dyld: loaded: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libGIF.dylib dyld: loaded: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJP2.dylib dyld: loaded: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libRadiance.dylib dyld: loaded: /System/Library/PrivateFrameworks/AppleJPEG.framework/Versions/A/AppleJPEG dyld: loaded: /System/Library/Frameworks/MetalPerformanceShaders.framework/Frameworks/MPSCore.framework/Versions/A/MPSCore dyld: loaded: /System/Library/Frameworks/MetalPerformanceShaders.framework/Frameworks/MPSImage.framework/Versions/A/MPSImage dyld: loaded: /System/Library/Frameworks/MetalPerformanceShaders.framework/Frameworks/MPSNeuralNetwork.framework/Versions/A/MPSNeuralNetwork dyld: loaded: /System/Library/Frameworks/MetalPerformanceShaders.framework/Frameworks/MPSMatrix.framework/Versions/A/MPSMatrix dyld: loaded: /System/Library/PrivateFrameworks/MetalTools.framework/Versions/A/MetalTools dyld: loaded: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib dyld: loaded: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGFXShared.dylib dyld: loaded: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib dyld: loaded: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib dyld: loaded: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCVMSPluginSupport.dylib dyld: loaded: /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreVMClient.dylib dyld: loaded: /usr/lib/libcups.2.dylib dyld: loaded: /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos dyld: loaded: /System/Library/Frameworks/GSS.framework/Versions/A/GSS dyld: loaded: /usr/lib/libresolv.9.dylib dyld: loaded: /usr/lib/libiconv.2.dylib dyld: loaded: /System/Library/PrivateFrameworks/Heimdal.framework/Versions/A/Heimdal dyld: loaded: /usr/lib/libheimdal-asn1.dylib dyld: loaded: /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory dyld: loaded: /System/Library/PrivateFrameworks/CommonAuth.framework/Versions/A/CommonAuth dyld: loaded: /System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpenDirectory.framework/Versions/A/CFOpenDirectory dyld: loaded: /System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoundation dyld: loaded: /System/Library/PrivateFrameworks/APFS.framework/Versions/A/APFS dyld: loaded: /usr/lib/libutil.dylib dyld: loaded: /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio dyld: loaded: /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox dyld: loaded: /System/Library/PrivateFrameworks/AppleSauce.framework/Versions/A/AppleSauce dyld: loaded: /System/Library/PrivateFrameworks/LinguisticData.framework/Versions/A/LinguisticData dyld: loaded: /usr/lib/libmarisa.dylib dyld: loaded: /System/Library/PrivateFrameworks/Lexicon.framework/Versions/A/Lexicon dyld: loaded: /usr/lib/libChineseTokenizer.dylib dyld: loaded: /usr/lib/libcmph.dylib dyld: loaded: /System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling dyld: loaded: /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData dyld: loaded: /System/Library/PrivateFrameworks/CoreEmoji.framework/Versions/A/CoreEmoji dyld: loaded: /System/Library/Frameworks/ServiceManagement.framework/Versions/A/ServiceManagement dyld: loaded: /System/Library/PrivateFrameworks/BackgroundTaskManagement.framework/Versions/A/BackgroundTaskManagement dyld: loaded: /usr/lib/libxslt.1.dylib (lldb) target create "d1/a.out" dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_locale.so ********* dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so dyld: unloaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_ctypes.so dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_functools.so dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/itertools.so dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/operator.so dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so dyld: loaded: /usr/local/opt/readline/lib/libreadline.7.dylib Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in import weakref File "/usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in from _weakref import ( ImportError: cannot import name _remove_dead_weakref dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/time.so dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/datetime.so dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/strop.so dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_collections.so dyld: loaded: /usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_heapq.so dyld: loaded: /System/Library/PrivateFrameworks/CoreServicesInternal.framework/Versions/A/CoreServicesInternal ---------- components: Library (Lib), macOS messages: 326962 nosy: Tim Hutt, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Python loads incorrect libraries versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 08:07:59 2018 From: report at bugs.python.org (Amirouche Boubekki) Date: Wed, 03 Oct 2018 12:07:59 +0000 Subject: [New-bugs-announce] [issue34885] asycnio documention has lost its paragraph about cancellation Message-ID: <1538568479.97.0.545547206417.issue34885@psf.upfronthosting.co.za> New submission from Amirouche Boubekki : The paragraph was still there in 3.6 https://docs.python.org/3.6/library/asyncio-dev.html#cancellation ---------- assignee: docs at python components: Documentation, asyncio messages: 326966 nosy: abki, asvetlov, docs at python, yselivanov priority: normal severity: normal status: open title: asycnio documention has lost its paragraph about cancellation type: enhancement versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 14:50:38 2018 From: report at bugs.python.org (Alessandro) Date: Wed, 03 Oct 2018 18:50:38 +0000 Subject: [New-bugs-announce] [issue34886] subprocess.run throws exception when input and stdin are passed as kwargs Message-ID: <1538592638.37.0.545547206417.issue34886@psf.upfronthosting.co.za> New submission from Alessandro : If input and stdin parameters are passed as keyword arguments to subprocess.run, an exception is thrown even if input and stdin are both None. The exception is ValueError: stdin and input arguments may not both be used. I attach a minimal working example of the bug ---------- components: Library (Lib) files: subprocess_run_bug.py messages: 327002 nosy: aecant priority: normal severity: normal status: open title: subprocess.run throws exception when input and stdin are passed as kwargs type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47847/subprocess_run_bug.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 19:35:58 2018 From: report at bugs.python.org (Dan Snider) Date: Wed, 03 Oct 2018 23:35:58 +0000 Subject: [New-bugs-announce] [issue34887] bytes subclass __repr__ raise SystemError when set to bytes.decode Message-ID: <1538609758.67.0.545547206417.issue34887@psf.upfronthosting.co.za> New submission from Dan Snider : I've tested it on at least one of each minor version since 3.4 but it looks like it may be specific to 3.6.0. The developer's guide isn't clear enough for me to understand what's eligible for bug fixes but since I'm not sure if it actually is 3.6.0 exclusive I'll post it just in case. Here's how to cause it: if 1: class Bytes(bytes): def __new__(cls, name, encoding='ascii'): return bytes.__new__(cls, name.encode()) __repr__ = bytes.decode print(repr(Bytes("LOAD_NAME"))) Traceback (most recent call last): File "", line 6, in SystemError: returned NULL without setting an error ---------- messages: 327015 nosy: bup priority: normal severity: normal status: open title: bytes subclass __repr__ raise SystemError when set to bytes.decode versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 20:00:41 2018 From: report at bugs.python.org (Ned Batchelder) Date: Thu, 04 Oct 2018 00:00:41 +0000 Subject: [New-bugs-announce] [issue34888] Python3.8 optimizes away a "while" line Message-ID: <1538611241.01.0.545547206417.issue34888@psf.upfronthosting.co.za> New submission from Ned Batchelder : Looks like the optimizer is getting more aggressive. Line 2 (the constant while) no longer even appears in the bytecode: $ cat -n whiletrue.py 1 a = 1 2 while 1: 3 print(a) 4 b = 4 $ python3.7 -m dis < whiletrue.py 1 0 LOAD_CONST 0 (1) 2 STORE_NAME 0 (a) 2 4 SETUP_LOOP 12 (to 18) 3 >> 6 LOAD_NAME 1 (print) 8 LOAD_NAME 0 (a) 10 CALL_FUNCTION 1 12 POP_TOP 14 JUMP_ABSOLUTE 6 16 POP_BLOCK 4 >> 18 LOAD_CONST 1 (4) 20 STORE_NAME 2 (b) 22 LOAD_CONST 2 (None) 24 RETURN_VALUE $ python3.8 -m dis < whiletrue.py 1 0 LOAD_CONST 0 (1) 2 STORE_NAME 0 (a) 3 >> 4 LOAD_NAME 1 (print) 6 LOAD_NAME 0 (a) 8 CALL_FUNCTION 1 10 POP_TOP 12 JUMP_ABSOLUTE 4 4 14 LOAD_CONST 1 (4) 16 STORE_NAME 2 (b) 18 LOAD_CONST 2 (None) 20 RETURN_VALUE I understand why we want to make these optimizations. It's good for those times when we run our programs. But there are other times: when we are analyzing programs. I'm begging you: please please please help me get https://bugs.python.org/issue2506 implemented (a way to disable optimizations). It is becoming more and more difficult to write tools that analyze Python programs. People are testing their libraries on Python 3.8-dev, and reporting problems using coverage.py. I would like to support their efforts to test on the daily Python builds. But it's difficult to keep coverage.py working under these conditions. Anything you can do would be really appreciated. ---------- components: Interpreter Core messages: 327019 nosy: nedbat, serhiy.storchaka priority: normal severity: normal status: open title: Python3.8 optimizes away a "while" line versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 3 21:24:08 2018 From: report at bugs.python.org (Alex Henrie) Date: Thu, 04 Oct 2018 01:24:08 +0000 Subject: [New-bugs-announce] [issue34889] int.to_bytes and int.from_bytes should default to the system byte order like the struct module does Message-ID: <1538616248.5.0.545547206417.issue34889@psf.upfronthosting.co.za> New submission from Alex Henrie : When serializing a single integer, int.to_bytes and int.from_bytes are more efficient alternatives to struct.pack and struct.unpack. However, struct.pack and struct.unpack currently have the advantage that the byteorder does not have to be specified (because it defaults to sys.byteorder). It would avoid a lot of redundant code to make the byteorder argument default to sys.byteorder in int.to_bytes and int.from_bytes too. ---------- components: Library (Lib) messages: 327030 nosy: alex.henrie priority: normal severity: normal status: open title: int.to_bytes and int.from_bytes should default to the system byte order like the struct module does versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 03:29:56 2018 From: report at bugs.python.org (Andrew Svetlov) Date: Thu, 04 Oct 2018 07:29:56 +0000 Subject: [New-bugs-announce] [issue34890] Support functools.partial in inspect.is*function() checks Message-ID: <1538638196.31.0.545547206417.issue34890@psf.upfronthosting.co.za> New submission from Andrew Svetlov : isfunction() processes both `isfunction(func)` and `isfunction(partial(func, arg))` correctly. But `iscoroutinefunction()` misses this functionality. We can implement it easy by adding a check for `isinstance(func, partial)` and applying a coroutine check for `func.func`. Also, we can do the same for `isgeneratorfunction()` and `isasyncgenfunction()`. The patch looks easy and straightforward. Yuri, what do you think about? ---------- components: Library (Lib) messages: 327039 nosy: asvetlov, yselivanov priority: normal severity: normal status: open title: Support functools.partial in inspect.is*function() checks versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 06:40:06 2018 From: report at bugs.python.org (Anthony Flury) Date: Thu, 04 Oct 2018 10:40:06 +0000 Subject: [New-bugs-announce] [issue34891] Multi-processing example inaccurate warning Message-ID: <1538649606.04.0.545547206417.issue34891@psf.upfronthosting.co.za> New submission from Anthony Flury : On the Multi-processing page (just above the reference section) there is a warning that the examples wont work from the interpreter. This is not entirely accurate in that the examples do work, in the interpreter within Linux (and Mac OS I think), where the O/S supports processes being forked. In fact it is only in Windows, where a brand new process needs to be started and the source is effectively re-imported is there an issue running the examples in the interpreter. Should the documentation make this clearer ? ---------- assignee: docs at python components: Documentation messages: 327046 nosy: anthony-flury, docs at python priority: normal severity: normal status: open title: Multi-processing example inaccurate warning versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 09:31:14 2018 From: report at bugs.python.org (Florian Michaux) Date: Thu, 04 Oct 2018 13:31:14 +0000 Subject: [New-bugs-announce] [issue34892] persistence of attributes with new instance Message-ID: <1538659874.64.0.545547206417.issue34892@psf.upfronthosting.co.za> New submission from Florian Michaux : Hello, I don't know what's going on. When using a for loop over multiple same instance creation, i got persistence with instance attributes Code example in attachement. ---------- components: Interpreter Core files: buggyclass.py messages: 327051 nosy: Florian Michaux priority: normal severity: normal status: open title: persistence of attributes with new instance versions: Python 2.7, Python 3.7 Added file: https://bugs.python.org/file47848/buggyclass.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 10:45:00 2018 From: report at bugs.python.org (Pranav Devarakonda) Date: Thu, 04 Oct 2018 14:45:00 +0000 Subject: [New-bugs-announce] [issue34893] Add 2to3 fixer to change send and recv methods of socket object. Message-ID: <1538664300.49.0.545547206417.issue34893@psf.upfronthosting.co.za> New submission from Pranav Devarakonda : The send() method of the the Socket object in Python 3.x requires the data to be sent to be first converted into bytes(object) which was not the case with Python 2.x. The 2to3 tool doesn't handle this case and hence an explicit fixer would help many beginners learning the socket module(most tutorials regarding this online are in Python 2.x) Similarly the fixer can change the recv() method by converting the returned bytes object back to a str object. For example, consider the following lines in Python 2.x, (for demonstration only) s.send("Foo") #where 's' is a socket object data = s.recv(1024) After the 2to3 fixer has been applied the above lines will change to, s.send(str.encode("Foo")) data = s.recv(1024).decode("utf-8") PS: I am a beginner in open source so any changes or suggestions are welcome. ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 327053 nosy: benjamin.peterson, devarakondapranav priority: normal severity: normal status: open title: Add 2to3 fixer to change send and recv methods of socket object. type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 11:13:53 2018 From: report at bugs.python.org (=?utf-8?q?Marcin_Raczy=C5=84ski?=) Date: Thu, 04 Oct 2018 15:13:53 +0000 Subject: [New-bugs-announce] [issue34894] Unexpected error while unpickling lxml.etree.Element object Message-ID: <1538666033.36.0.545547206417.issue34894@psf.upfronthosting.co.za> New submission from Marcin Raczy?ski : If we use pickle.HIGHEST_PROTOCOL we can pickle lxml.etree.Element object but unpickling give us misleading error description: >>> from lxml import etree >>> import pickle >>> import sys sys.version '2.7.15rc1 (default, Apr 15 2018, 21:51:34) \n[GCC 7.3.0]' >>> etree.__version__ u'4.2.5' >>> pickled = pickle.dumps(etree.Element('x'), protocol=pickle.HIGHEST_PROTOCOL) >>> pickle.loads(pickled) Traceback (most recent call last): File "", line 1, in pickle.loads(pickled) File "src/lxml/etree.pyx", line 1131, in lxml.etree._Element.__repr__ File "src/lxml/etree.pyx", line 981, in lxml.etree._Element.tag.__get__ File "src/lxml/apihelpers.pxi", line 19, in lxml.etree._assertValidNode AssertionError: invalid Element proxy at 140260172089392 See also: https://bugs.launchpad.net/lxml/+bug/736708 ---------- components: Library (Lib) messages: 327054 nosy: marc1nr priority: normal severity: normal status: open title: Unexpected error while unpickling lxml.etree.Element object type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 12:33:38 2018 From: report at bugs.python.org (Marcus) Date: Thu, 04 Oct 2018 16:33:38 +0000 Subject: [New-bugs-announce] [issue34895] Mark optional stdlib modules in documentation Message-ID: <1538670818.19.0.545547206417.issue34895@psf.upfronthosting.co.za> New submission from Marcus : Some stdlib modules have external build time dependencies and will be automatically disabled if the dependencies can't be met (cf. detect_modules() in setup.py). >From a user's perspective there is no reason to assume that the presence of a stdlib module may not be relied upon. See also the discussion on python-ideas (https://mail.python.org/pipermail/python-ideas/2018-October/054008.html). A rather simple to implement debugging aid would be to add a note to the affected modules' documentation, stating that these modules may not be available on all systems. ---------- assignee: docs at python components: Documentation messages: 327065 nosy: docs at python, of4tvziy priority: normal severity: normal status: open title: Mark optional stdlib modules in documentation type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 12:52:13 2018 From: report at bugs.python.org (Ruchir Jha) Date: Thu, 04 Oct 2018 16:52:13 +0000 Subject: [New-bugs-announce] [issue34896] Unable to install Python 3.5 Message-ID: <1538671933.56.0.545547206417.issue34896@psf.upfronthosting.co.za> New submission from Ruchir Jha : Hi, I was trying to install Danjo to work on Python. However it was not working fine hence I uninstalled the version 3.5 which I installed and tried to install it again as the earlier version was used for Anaconda. However even after multiple attempts to install Python its throws and error 0x80070643 fatal error during python installation. I have restarted the system and have also cleared the cache. I am working under strict deaadline hence an urgent help will be highly appreciated ---------- components: Installation files: Python 3.5.0rc3 (64-bit)_20181004220550_000_core_JustForMe.log messages: 327067 nosy: ruchirjha priority: normal severity: normal status: open title: Unable to install Python 3.5 type: crash versions: Python 3.5 Added file: https://bugs.python.org/file47849/Python 3.5.0rc3 (64-bit)_20181004220550_000_core_JustForMe.log _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 16:22:26 2018 From: report at bugs.python.org (Michael Felt) Date: Thu, 04 Oct 2018 20:22:26 +0000 Subject: [New-bugs-announce] [issue34897] distutils test errors when CXX is not set Message-ID: <1538684546.1.0.545547206417.issue34897@psf.upfronthosting.co.za> New submission from Michael Felt : while researching issue11191 I cam across 6 additional errors. There is a test in Lib/test/support/__init__.py def missing_compiler_executable(cmd_names=[]): """Check if the compiler components used to build the interpreter exist. Check for the existence of the compiler executables whose names are listed in 'cmd_names' or all the compiler executables when 'cmd_names' is empty and return the first missing executable or None when none is found missing. """ from distutils import ccompiler, sysconfig, spawn compiler = ccompiler.new_compiler() sysconfig.customize_compiler(compiler) for name in compiler.executables: if cmd_names and name not in cmd_names: continue cmd = getattr(compiler, name) if cmd_names: assert cmd is not None, \ "the '%s' executable is not configured" % name elif cmd is None: continue if spawn.find_executable(cmd[0]) is None: return cmd[0] The "elif cmd is None:" is not successful because cmd maybe '' (null string) Initially I thought to change to "elif cmd is None or (not cmd):" but I hope I found a better resolution! In: Lib/distutils/sysconfig.py the final bits of customize_compiler is: compiler.set_executables( preprocessor=cpp, compiler=cc_cmd, compiler_so=cc_cmd + ' ' + ccshared, compiler_cxx=cxx, linker_so=ldshared, linker_exe=cc, archiver=archiver) the value for cxx come from os.environ, if set, otherwise it comes from get_sys_vars() (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') If, during the build, CXX was not set - this sets cxx to the null string (''). So the fix is to assign cxx = None when len(cxx) == 0 if 'CXX' in os.environ: cxx = os.environ['CXX'] if not len(cxx): cxx = None While this only seems to happen for cxx - maybe this should be extended to all the variables in (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags)? So, ultimately - I choose to go with changing : compiler.set_executables() diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py index b71d1d39bc..2e08c4abd2 100644 --- a/Lib/distutils/ccompiler.py +++ b/Lib/distutils/ccompiler.py @@ -148,7 +148,7 @@ class CCompiler: if key not in self.executables: raise ValueError("unknown executable '%s' for class %s" % (key, self.__class__.__name__)) - self.set_executable(key, kwargs[key]) + self.set_executable(key, kwargs[key] if len(kwargs[key]) else None) def set_executable(self, key, value): if isinstance(value, str): Was: ====================================================================== ERROR: test_run (distutils.tests.test_build_clib.BuildCLibTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/data/prj/python/git/python3-3.8/Lib/distutils/tests/test_build_clib.py", line 121, in test_run ccmd = missing_compiler_executable() File "/data/prj/python/git/python3-3.8/Lib/test/support/__init__.py", line 2730, in missing_compiler_executable if spawn.find_executable(cmd[0]) is None: IndexError: list index out of range ====================================================================== ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/data/prj/python/git/python3-3.8/Lib/distutils/tests/test_build_ext.py", line 62, in test_build_ext cmd = support.missing_compiler_executable() File "/data/prj/python/git/python3-3.8/Lib/test/support/__init__.py", line 2730, in missing_compiler_executable if spawn.find_executable(cmd[0]) is None: IndexError: list index out of range ====================================================================== ERROR: test_get_outputs (distutils.tests.test_build_ext.BuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/data/prj/python/git/python3-3.8/Lib/distutils/tests/test_build_ext.py", line 308, in test_get_outputs cmd = support.missing_compiler_executable() File "/data/prj/python/git/python3-3.8/Lib/test/support/__init__.py", line 2730, in missing_compiler_executable if spawn.find_executable(cmd[0]) is None: IndexError: list index out of range ====================================================================== ERROR: test_build_ext (distutils.tests.test_build_ext.ParallelBuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/data/prj/python/git/python3-3.8/Lib/distutils/tests/test_build_ext.py", line 62, in test_build_ext cmd = support.missing_compiler_executable() File "/data/prj/python/git/python3-3.8/Lib/test/support/__init__.py", line 2730, in missing_compiler_executable if spawn.find_executable(cmd[0]) is None: IndexError: list index out of range ====================================================================== ERROR: test_get_outputs (distutils.tests.test_build_ext.ParallelBuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/data/prj/python/git/python3-3.8/Lib/distutils/tests/test_build_ext.py", line 308, in test_get_outputs cmd = support.missing_compiler_executable() File "/data/prj/python/git/python3-3.8/Lib/test/support/__init__.py", line 2730, in missing_compiler_executable if spawn.find_executable(cmd[0]) is None: IndexError: list index out of range ====================================================================== ERROR: test_record_extensions (distutils.tests.test_install.InstallTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/data/prj/python/git/python3-3.8/Lib/distutils/tests/test_install.py", line 200, in test_record_extensions cmd = test_support.missing_compiler_executable() File "/data/prj/python/git/python3-3.8/Lib/test/support/__init__.py", line 2730, in missing_compiler_executable if spawn.find_executable(cmd[0]) is None: IndexError: list index out of range ---------- components: Distutils messages: 327083 nosy: Michael.Felt, dstufft, eric.araujo priority: normal severity: normal status: open title: distutils test errors when CXX is not set type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 17:22:04 2018 From: report at bugs.python.org (Guo Ci Teo) Date: Thu, 04 Oct 2018 21:22:04 +0000 Subject: [New-bugs-announce] [issue34898] add mtime argument to gzip.compress Message-ID: <1538688124.68.0.545547206417.issue34898@psf.upfronthosting.co.za> New submission from Guo Ci Teo : With the `mtime` argument, the output from `gzip.compress` can be reproducible. ---------- components: Library (Lib) messages: 327088 nosy: guoci priority: normal severity: normal status: open title: add mtime argument to gzip.compress versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 18:10:47 2018 From: report at bugs.python.org (Zackery Spytz) Date: Thu, 04 Oct 2018 22:10:47 +0000 Subject: [New-bugs-announce] [issue34899] Possible assertion failure due to int_from_bytes_impl() Message-ID: <1538691047.46.0.545547206417.issue34899@psf.upfronthosting.co.za> New submission from Zackery Spytz : If _PyLong_FromByteArray() fails in int_from_bytes_impl(), PyObject_CallFunctionObjArgs() might be called with a live exception. ---------- components: Interpreter Core messages: 327091 nosy: ZackerySpytz priority: normal severity: normal status: open title: Possible assertion failure due to int_from_bytes_impl() type: crash versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 4 18:24:33 2018 From: report at bugs.python.org (Bruno Oliveira) Date: Thu, 04 Oct 2018 22:24:33 +0000 Subject: [New-bugs-announce] [issue34900] unittest subTests() fails when called from debug() Message-ID: <1538691873.85.0.545547206417.issue34900@psf.upfronthosting.co.za> New submission from Bruno Oliveira : Consider this code: import unittest class TC(unittest.TestCase): def test_subtest(self): with self.subTest(): pass tc = TC('test_subtest') tc.run() This works when executed, but if we change ``tc.run()`` to ``tc.debug()`` we get the following exception: Traceback (most recent call last): File ".tmp\test-unittest-regression.py", line 13, in tc.debug() File "C:\Users\Bruno\AppData\Local\Programs\Python\Python36\lib\unittest\case.py", line 658, in debug getattr(self, self._testMethodName)() File ".tmp\test-unittest-regression.py", line 7, in test_subtest with self.subTest(): File "C:\Users\Bruno\AppData\Local\Programs\Python\Python36\lib\contextlib.py", line 81, in __enter__ return next(self.gen) File "C:\Users\Bruno\AppData\Local\Programs\Python\Python36\lib\unittest\case.py", line 512, in subTest if not self._outcome.result_supports_subtests: AttributeError: 'NoneType' object has no attribute 'result_supports_subtests' Looking at the code, ``subTest`` assumes that the ``TestCase`` instance has the ``self._outcome`` atribute, which is set only by ``run()``. ---------- components: Library (Lib) messages: 327092 nosy: Bruno Oliveira priority: normal severity: normal status: open title: unittest subTests() fails when called from debug() versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 00:16:40 2018 From: report at bugs.python.org (Danish Prakash) Date: Fri, 05 Oct 2018 04:16:40 +0000 Subject: [New-bugs-announce] [issue34901] Missing isolated (-I) flag in sys.flags table Message-ID: <1538713000.05.0.545547206417.issue34901@psf.upfronthosting.co.za> Change by Danish Prakash : ---------- assignee: docs at python components: Documentation nosy: danishprakash, docs at python priority: normal severity: normal status: open title: Missing isolated (-I) flag in sys.flags table versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 01:45:27 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Fri, 05 Oct 2018 05:45:27 +0000 Subject: [New-bugs-announce] [issue34902] Azure pipelines PR build fails with "Unexpected vmImage 'vs2017-win2017'" Message-ID: <1538718327.26.0.545547206417.issue34902@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : Azure pipelines PR seems to fail with the error "Unexpected vmImage 'vs2017-win2017'" . First build failure with this message : https://dev.azure.com/Python/cpython/_build/results?buildId=31800&view=results Last successful build : https://dev.azure.com/Python/cpython/_build/results?buildId=31797&view=results Thanks ---------- components: Build, Windows messages: 327102 nosy: paul.moore, steve.dower, tim.golden, xtreak, zach.ware priority: normal severity: normal status: open title: Azure pipelines PR build fails with "Unexpected vmImage 'vs2017-win2017'" versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 03:31:26 2018 From: report at bugs.python.org (Mike Gleen) Date: Fri, 05 Oct 2018 07:31:26 +0000 Subject: [New-bugs-announce] [issue34903] strptime %d handling of single digit day of month Message-ID: <1538724686.61.0.545547206417.issue34903@psf.upfronthosting.co.za> New submission from Mike Gleen : strptime correctly parses single digit day-of-month values (at least in the case of "%d %b %Y") which is the behavior I want. However, the documentation seems to say that the field must be two digits with a leading zero if necessary. So I hope that this is the intended behavior rather than just an accidental artifact. If so, then my suggestion is that the documentation be updated to reflect this. ---------- assignee: docs at python components: Documentation messages: 327109 nosy: Mike Gleen, docs at python priority: normal severity: normal status: open title: strptime %d handling of single digit day of month type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 06:06:44 2018 From: report at bugs.python.org (Erik Bray) Date: Fri, 05 Oct 2018 10:06:44 +0000 Subject: [New-bugs-announce] [issue34904] Crash in ZipFile.close() when writing zip file to /dev/null Message-ID: <1538734004.78.0.545547206417.issue34904@psf.upfronthosting.co.za> New submission from Erik Bray : Not that there is any great reason to write a zip file to /dev/null, but I had some code that happened to do so which worked on Python 2.7, but at some point this broke: Python 3.8.0a0 (heads/master:fc7d1b3, Oct 5 2018, 09:49:57) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import zipfile >>> f = zipfile.ZipFile('/dev/null', 'w') >>> f.writestr('foo.txt', 'testtesttesttesttest') >>> f.close() Traceback (most recent call last): File "", line 1, in File "/home/embray/src/python/cpython/Lib/zipfile.py", line 1813, in close self._write_end_record() File "/home/embray/src/python/cpython/Lib/zipfile.py", line 1914, in _write_end_record endrec = struct.pack(structEndArchive, stringEndArchive, struct.error: argument out of range ---------- components: Library (Lib) messages: 327118 nosy: erik.bray priority: normal severity: normal status: open title: Crash in ZipFile.close() when writing zip file to /dev/null type: crash _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 08:24:52 2018 From: report at bugs.python.org (Andrey Paramonov) Date: Fri, 05 Oct 2018 12:24:52 +0000 Subject: [New-bugs-announce] [issue34905] Cannot assign memoryview values from array.array Message-ID: <1538742292.09.0.545547206417.issue34905@psf.upfronthosting.co.za> New submission from Andrey Paramonov : Currently, memoryview values can be assigned from all bytes-like objects (https://docs.python.org/3/glossary.html#term-bytes-like-object) except byte array.array: ---- import array mview = memoryview(bytearray(b'hello')) mview[:] = bytes(b'hello') # success mview[:] = bytearray(b'hello') # success mview[:] = memoryview(b'hello') # success mview[:] = array.array('b', b'hello') # fail ---- mview[:] = array.array('b', b'hello') ValueError: memoryview assignment: lvalue and rvalue have different structures ---- ---------- components: Library (Lib) messages: 327133 nosy: aparamon priority: normal severity: normal status: open title: Cannot assign memoryview values from array.array type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 09:57:02 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Fri, 05 Oct 2018 13:57:02 +0000 Subject: [New-bugs-announce] [issue34906] Fix typo in the documentation Message-ID: <1538747822.84.0.545547206417.issue34906@psf.upfronthosting.co.za> Change by St?phane Wirtel : ---------- assignee: matrixise nosy: matrixise priority: normal severity: normal status: open title: Fix typo in the documentation versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 11:54:54 2018 From: report at bugs.python.org (Cem) Date: Fri, 05 Oct 2018 15:54:54 +0000 Subject: [New-bugs-announce] [issue34907] calculation not working properly Message-ID: <1538754894.18.0.545547206417.issue34907@psf.upfronthosting.co.za> New submission from Cem : as shown below for some reason 15.06 + 5 results in an addition of 0.0000002 and i want to know why its an bug or something im doing wrong but below it i tried it with 15.07 it works ---------- components: Windows files: Capture.PNG messages: 327143 nosy: hwk_un1te, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: calculation not working properly versions: Python 3.7 Added file: https://bugs.python.org/file47853/Capture.PNG _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 13:21:24 2018 From: report at bugs.python.org (Ian Remmel) Date: Fri, 05 Oct 2018 17:21:24 +0000 Subject: [New-bugs-announce] [issue34908] netrc parding is overly strict Message-ID: <1538760084.12.0.545547206417.issue34908@psf.upfronthosting.co.za> New submission from Ian Remmel : This started as a bug report for httpie https://github.com/jakubroztocil/httpie/issues/717#issuecomment-426125261 And became a bug report for requests https://github.com/requests/requests/issues/4813 > But turned out to be an issue with Python's netrc parser: > > > it appears that auth via netrc is broken if ~/.netrc includes entries that are not exactly login/password tuples. For example, I have the following entries for circle ci and heroku: > > ``` > machine api.heroku.com > login > password > method interactive > machine circleci.com > login > ``` > > both of these entries prevent my entry for github.com from working with httpie (but curl works just fine). I've used the following script to test python 2.7 and 3.7: ``` import netrc import os.path netrc.netrc(os.path.expanduser('~/.netrc')).authenticators('api.github.com') ``` Python 2: ``` Traceback (most recent call last): File "test.py", line 4, in netrc.netrc(os.path.expanduser('~/.netrc')).authenticators('api.github.com') File "/usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/netrc.py", line 35, in __init__ self._parse(file, fp, default_netrc) File "/usr/local/Cellar/python at 2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/netrc.py", line 117, in _parse file, lexer.lineno) netrc.NetrcParseError: bad follower token 'method' (/Users/ian/.netrc, line 7) ```` Python 3: ``` Traceback (most recent call last): File "test.py", line 4, in netrc.netrc(os.path.expanduser('~/.netrc')).authenticators('api.github.com') File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/netrc.py", line 30, in __init__ self._parse(file, fp, default_netrc) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/netrc.py", line 111, in _parse file, lexer.lineno) netrc.NetrcParseError: bad follower token 'method' (/Users/ian/.netrc, line 7) ``` ---------- messages: 327155 nosy: ianwremmel priority: normal severity: normal status: open title: netrc parding is overly strict versions: Python 2.7, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 16:12:48 2018 From: report at bugs.python.org (Ethan Furman) Date: Fri, 05 Oct 2018 20:12:48 +0000 Subject: [New-bugs-announce] [issue34909] StrEnum subclasses cannot be created Message-ID: <1538770368.25.0.545547206417.issue34909@psf.upfronthosting.co.za> New submission from Ethan Furman : from enum import Enum, unique class StrEnum(str, Enum): def __new__(cls, *args, **kwargs): for a in args: if not isinstance(a, str): raise TypeError("Enumeration '%s' (%s) is not" " a string" % (a, type(a).__name__)) return super(StrEnum, cls).__new__(cls, *args, **kwargs) @unique class Decision(StrEnum): """Decision results/strategy enumeration.""" REVERT = "REVERT" REVERT_ALL = "REVERT_ALL" RETRY = "RETRY" --- Traceback (most recent call last): File "test", line 14, in class Decision(StrEnum): File ".../cpython/Lib/enum.py", line 222, in __new__ enum_member._value_ = member_type(*args) File ".../cpython/Lib/enum.py", line 309, in __call__ return cls.__new__(cls, value) File ".../cpython/Lib/enum.py", line 545, in __new__ return cls._missing_(value) File ".../cpython/Lib/enum.py", line 558, in _missing_ raise ValueError("%r is not a valid %s" % (value, cls.__name__)) ValueError: 'REVERT' is not a valid StrEnum ---------- assignee: ethan.furman keywords: 3.7regression messages: 327182 nosy: ethan.furman, ned.deily priority: release blocker severity: normal stage: test needed status: open title: StrEnum subclasses cannot be created versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 19:05:07 2018 From: report at bugs.python.org (Zackery Spytz) Date: Fri, 05 Oct 2018 23:05:07 +0000 Subject: [New-bugs-announce] [issue34910] PyObject_Print() doesn't always return -1 on error Message-ID: <1538780707.1.0.545547206417.issue34910@psf.upfronthosting.co.za> New submission from Zackery Spytz : PyObject_Print() returns 0 if PyUnicode_AsEncodedString() fails. ---------- components: Interpreter Core messages: 327197 nosy: ZackerySpytz priority: normal severity: normal status: open title: PyObject_Print() doesn't always return -1 on error type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 5 19:38:48 2018 From: report at bugs.python.org (Paul Bailey) Date: Fri, 05 Oct 2018 23:38:48 +0000 Subject: [New-bugs-announce] [issue34911] Allow Cookies for Secure WebSockets Message-ID: <1538782728.4.0.545547206417.issue34911@psf.upfronthosting.co.za> New submission from Paul Bailey : http.cookiejar.DefaultCookiePolicy should support the secure websocket protocol wss. WebSockets start off as HTTP requests and then get upgraded but have a different protocol of `wss` instead of `https`. This means secure cookies are not passed through by default. ---------- components: Library (Lib) messages: 327199 nosy: Paul Bailey priority: normal severity: normal status: open title: Allow Cookies for Secure WebSockets type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 6 01:31:56 2018 From: report at bugs.python.org (Windson Yang) Date: Sat, 06 Oct 2018 05:31:56 +0000 Subject: [New-bugs-announce] [issue34912] Update overflow checks in resize_buffer Message-ID: <1538803916.84.0.545547206417.issue34912@psf.upfronthosting.co.za> New submission from Windson Yang : In [resize_buffer](https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Modules/_io/stringio.c#L85) /* For simplicity, stay in the range of the signed type. Anyway, Python doesn't allow strings to be longer than this. */ if (size > PY_SSIZE_T_MAX) goto overflow; ... IMO, we should check the overflow with if (size > PY_SSIZE_T_MAX/sizeof(Py_UCS4)) Or we can just delete this code because we will check later at [alloc_check](https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Modules/_io/stringio.c#L107? BTW, I found we only use PY_SIZE_MAX here in CPython, I wonder why we do not use PY_SSIZE_T_MAX instead? ---------- components: IO messages: 327223 nosy: Windson Yang priority: normal severity: normal status: open title: Update overflow checks in resize_buffer versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 6 03:06:04 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Sat, 06 Oct 2018 07:06:04 +0000 Subject: [New-bugs-announce] [issue34913] Document gzip command line interface Message-ID: <1538809564.11.0.545547206417.issue34913@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : gzip supports command line interface with `python -m gzip` like zipfile and tarfile but there is no help available from the command line which can be covered when issue23596 is merged that uses argparse along with tests for which are also lacking at the moment. There can be at least docs about command line arguments at https://docs.python.org/3/library/gzip.html. Currently there is no way to know how the command line interface works for gzip without looking at the source code. ---------- assignee: docs at python components: Documentation messages: 327230 nosy: docs at python, xtreak priority: normal severity: normal status: open title: Document gzip command line interface versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 6 04:06:57 2018 From: report at bugs.python.org (Nick Coghlan) Date: Sat, 06 Oct 2018 08:06:57 +0000 Subject: [New-bugs-announce] [issue34914] Clarify text encoding used to enable UTF-8 mode Message-ID: <1538813217.24.0.545547206417.issue34914@psf.upfronthosting.co.za> New submission from Nick Coghlan : While working on the docs updates for bpo-34589 (clarifying that "PYTHONCOERCECLOCALE=0" and "PYTHONCOERCELOCALE=warn" need both the environment variable name and the value to be encoded as ASCII in order to have any effect), I realised that it was less explicit how to reliably enable UTF-8 mode, since that can be enabled even when the current locale is a nominally ASCII-incompatible one like gb18030, and the command line settings get processed as wchar strings rather than 8-bit char strings. >From what I've been able to figure out, the environment variable case is the same as for locale coercion: both the environment variable name and the value need to be encoded as ASCII. This actually happens implicitly, as even encodings like gb18030 still encode ASCII letters and numbers the same way ASCII does - their incompatibilities with ASCII lie elsewhere. Fully incompatible encodings like UTF-16 and UTF-32 don't get used as locale encodings in the first place because they'd break too many applications. I believe the same holds true for the command line arguments, just in the other direction: they get converted to wchar* with either mbstowcs or mrbtowc, and then compared using wcscmp or wcsncmp, but for all encodings that actually get used as locale encodings, the ASCII code points that CPython cares about get mapped directly to the corresponding UTF-16-LE or UTF-32 code point at both compile time (in the code) and at runtime (when reading the arg string). Given that simply not thinking about the problem will actually do the right thing in all cases, I don't think this needs to be documented prominently, but I do think it would be good to explicitly address the point somewhere. ---------- assignee: docs at python components: Documentation messages: 327236 nosy: docs at python, eric.snow, ncoghlan, vstinner priority: low severity: normal stage: needs patch status: open title: Clarify text encoding used to enable UTF-8 mode type: enhancement versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 6 09:58:56 2018 From: report at bugs.python.org (Ales Kvapil) Date: Sat, 06 Oct 2018 13:58:56 +0000 Subject: [New-bugs-announce] [issue34915] LWPCookieJar.save() creates *.lwp file in 644 mode Message-ID: <1538834336.96.0.545547206417.issue34915@psf.upfronthosting.co.za> New submission from Ales Kvapil : The LWPCookieJar.save() creates an *.lwp file containing session cookies in non-safe 644 mode (everyone can read it). This is not a secure behavior, especially for storing session keys or session cookies. The file should be created in 600 mode in my opinion. https://github.com/python/cpython/blob/3.7/Lib/http/cookiejar.py#L1872 ---------- assignee: christian.heimes components: IO, Library (Lib), SSL messages: 327246 nosy: aleskva, christian.heimes priority: normal severity: normal status: open title: LWPCookieJar.save() creates *.lwp file in 644 mode type: security versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 6 13:29:26 2018 From: report at bugs.python.org (Big Stone) Date: Sat, 06 Oct 2018 17:29:26 +0000 Subject: [New-bugs-announce] [issue34916] include sqlite-3.25+ (with window functions) Message-ID: <1538846966.09.0.545547206417.issue34916@psf.upfronthosting.co.za> New submission from Big Stone : sqlite-3.25 now includes window functions, something very important in modern SQL. https://www.sqlite.org/windowfunctions.html Could it be included in next Python maintenance release ? ---------- messages: 327253 nosy: Big Stone priority: normal severity: normal status: open title: include sqlite-3.25+ (with window functions) _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 6 19:46:30 2018 From: report at bugs.python.org (AmjadHD) Date: Sat, 06 Oct 2018 23:46:30 +0000 Subject: [New-bugs-announce] [issue34917] add time decorator to timeit.py Message-ID: <1538869590.35.0.545547206417.issue34917@psf.upfronthosting.co.za> New submission from AmjadHD : I made this simple time decorator, it's not perfect but it does make python more pythonic :) : it can be used as a decorator: ``` @timef def fun_to_time(a, b): ... ``` or as a function call `timef(print)("Hello world!")` just a simple decorator no need for `timeit.timeit("fun_to_time(a, b)", setup="from __main__ import a, b", number=1)` it's also customizable as you can control number of repetitions, garbage collection, unit ... and it produces a formatted output such as: `fun_to_time: 24.1056 ms`. It is somewhat badly written so waiting for your word people of wisdom :). I think python needs this in the standard library as the current way is (sometimes) tedious. ---------- components: Library (Lib) files: timeit.py messages: 327261 nosy: amjad ben hedhili priority: normal severity: normal status: open title: add time decorator to timeit.py type: enhancement versions: Python 3.7 Added file: https://bugs.python.org/file47855/timeit.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 7 01:09:01 2018 From: report at bugs.python.org (Adrian Keister) Date: Sun, 07 Oct 2018 05:09:01 +0000 Subject: [New-bugs-announce] [issue34918] Python 3 tkinter measurement problem Message-ID: <1538888941.11.0.545547206417.issue34918@psf.upfronthosting.co.za> New submission from Adrian Keister : tkinter.Tk().winfo_screenmmwidth() and tkinter.Tk().winfo_screenmmheight() give manifestly incorrect values in Windows. This does not appear to be an issue in Linux. I have not tested a Mac. The values reported in Windows are too large by as much as 58%. Searching online seems to indicate that the issue is some applications in Windows are "dpi aware"; unfortunately, none of the so-called work-arounds I've found actually fix the problem. The tkinter.Tk().winfo_screenwidth() and tkinter.Tk().winfo_screenheight() functions, reporting their results in pixels, appear to be correct. A MWE is simply import tkinter tkinter.Tk().winfo_screenmmwidth() This reports a 508 mm on my 15.6" screen, when the true value is closer to 343 mm. This is a 48% error, and hence an unusable result. Thank you for your time! ---------- components: Tkinter messages: 327265 nosy: Ackbach priority: normal severity: normal status: open title: Python 3 tkinter measurement problem type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 7 06:04:26 2018 From: report at bugs.python.org (cwickens) Date: Sun, 07 Oct 2018 10:04:26 +0000 Subject: [New-bugs-announce] [issue34919] Crash caused by certain characters in a string Message-ID: <1538906666.64.0.545547206417.issue34919@psf.upfronthosting.co.za> New submission from cwickens : Clone the following repo and follow the repro steps described in the readme: https://github.com/oTree-org/py37bug It seems that using certain non-ASCII characters in parts of a string crashes Python. In the README I listed the strings that are OK and those that crash. Also attaching the repo. ---------- components: Windows files: py37bug-master.zip messages: 327270 nosy: cwickens, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Crash caused by certain characters in a string type: crash versions: Python 3.7 Added file: https://bugs.python.org/file47856/py37bug-master.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 7 06:30:17 2018 From: report at bugs.python.org (Nikolaus Rath) Date: Sun, 07 Oct 2018 10:30:17 +0000 Subject: [New-bugs-announce] [issue34920] PYTHONWARNINGS entries are escaped Message-ID: <1538908217.47.0.545547206417.issue34920@psf.upfronthosting.co.za> New submission from Nikolaus Rath : According to https://docs.python.org/3/library/warnings.html#describing-warning-filters: "The meaning of each of these fields [of PYTHONWARNINGS] is as described in ." The description of the "The Warnings filter" says "module is a string containing a regular expression that the module name must match." However, when parsing PYTHONWARNINGS, the warnings module explicitly escapes the module field. ---------- components: Library (Lib) messages: 327272 nosy: nikratio priority: normal severity: normal status: open title: PYTHONWARNINGS entries are escaped type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 7 07:46:05 2018 From: report at bugs.python.org (Ismo Toijala) Date: Sun, 07 Oct 2018 11:46:05 +0000 Subject: [New-bugs-announce] [issue34921] NoReturn not allowed by get_type_hints when future import annotations is used Message-ID: <1538912765.08.0.545547206417.issue34921@psf.upfronthosting.co.za> New submission from Ismo Toijala : The following example should work but does not. Note that it does work without the future import. from __future__ import annotations import typing def f() -> typing.NoReturn: pass typing.get_type_hints(f) Traceback (most recent call last): File "foo.py", line 8, in typing.get_type_hints(f) File "/usr/lib/python3.7/typing.py", line 1001, in get_type_hints value = _eval_type(value, globalns, localns) File "/usr/lib/python3.7/typing.py", line 260, in _eval_type return t._evaluate(globalns, localns) File "/usr/lib/python3.7/typing.py", line 466, in _evaluate is_argument=self.__forward_is_argument__) File "/usr/lib/python3.7/typing.py", line 135, in _type_check raise TypeError(f"Plain {arg} is not valid as type argument") TypeError: Plain typing.NoReturn is not valid as type argument ---------- components: Library (Lib) messages: 327274 nosy: itoijala priority: normal severity: normal status: open title: NoReturn not allowed by get_type_hints when future import annotations is used type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 7 08:40:29 2018 From: report at bugs.python.org (shuoz) Date: Sun, 07 Oct 2018 12:40:29 +0000 Subject: [New-bugs-announce] [issue34922] hashlib segmentation fault Message-ID: <1538916029.97.0.545547206417.issue34922@psf.upfronthosting.co.za> New submission from shuoz : python hashlib a signd overflow maybe cause a memory over read. python version: Python 3.6.7rc1+ (heads/3.6:cb0bec3, Oct 1 2018, 02:19:39) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. ``` [----------------------------------registers-----------------------------------] RAX: 0x0 RBX: 0x7fffffffd5f0 --> 0x41b58ab3 RCX: 0x0 RDX: 0x1ffffffffffffff6 RSI: 0x7ffff35ae880 --> 0x0 RDI: 0x7fffffffd650 --> 0x7d828fe8a42b9c7f RBP: 0xffffffffabe --> 0x0 RSP: 0x7fffffffd5c8 --> 0x7ffff2a5f793 (<_sha3_shake_128_hexdigest+627>: test eax,eax) RIP: 0x7ffff2a5ec60 (<_PySHA3_KeccakWidth1600_SpongeSqueeze>: push r15) R8 : 0x65fc7ba985946aff R9 : 0xefbdaa140b587a16 R10: 0x50573373c9b2b8dc R11: 0xfba4d93abbdabffc R12: 0x7fffffffd770 --> 0x7fffffffd7d0 --> 0xffffffffb00 --> 0x0 R13: 0x7fffffffd650 --> 0x7d828fe8a42b9c7f R14: 0x7ffff35ae880 --> 0x0 R15: 0xfffffffffffffff6 EFLAGS: 0xa06 (carry PARITY adjust zero sign trap INTERRUPT direction OVERFLOW) [-------------------------------------code-------------------------------------] 0x7ffff2a5ec50 <_PySHA3_KeccakP1600_ExtractBytes+160>: jmp 0x7ffff2a54d10 <_PySHA3_KeccakP1600_ExtractBytesInLane at plt> 0x7ffff2a5ec55: nop 0x7ffff2a5ec56: nop WORD PTR cs:[rax+rax*1+0x0] => 0x7ffff2a5ec60 <_PySHA3_KeccakWidth1600_SpongeSqueeze>: push r15 0x7ffff2a5ec62 <_PySHA3_KeccakWidth1600_SpongeSqueeze+2>: push r14 0x7ffff2a5ec64 <_PySHA3_KeccakWidth1600_SpongeSqueeze+4>: push r13 0x7ffff2a5ec66 <_PySHA3_KeccakWidth1600_SpongeSqueeze+6>: push r12 0x7ffff2a5ec68 <_PySHA3_KeccakWidth1600_SpongeSqueeze+8>: mov r13,rdx [------------------------------------stack-------------------------------------] 0000| 0x7fffffffd5c8 --> 0x7ffff2a5f793 (<_sha3_shake_128_hexdigest+627>: test eax,eax) 0008| 0x7fffffffd5d0 --> 0x7fffffffd5f0 --> 0x41b58ab3 0016| 0x7fffffffd5d8 --> 0xffffefdb33b --> 0x0 0024| 0x7fffffffd5e0 --> 0x7ffff7ed99d8 --> 0x0 0032| 0x7fffffffd5e8 --> 0x7ffff3606910 --> 0x6190000096e5 --> 0x9000009828000000 0040| 0x7fffffffd5f0 --> 0x41b58ab3 0048| 0x7fffffffd5f8 --> 0x7ffff2a68c08 ("2 32 8 6 length 96 224 4 temp ") 0056| 0x7fffffffd600 --> 0x7ffff2a5f520 (<_sha3_shake_128_hexdigest>: push r15) [------------------------------------------------------------------------------] Legend: code, data, rodata, value Breakpoint 2, _PySHA3_KeccakWidth1600_SpongeSqueeze (instance=0x7fffffffd650, data=0x7ffff35ae880 "", dataByteLen=0x1ffffffffffffff6) at /home/test/cpython/Modules/_sha3/kcp/KeccakSponge.inc:272 ``` dataByteLen=0x1ffffffffffffff6 ``` RAX: 0x7ffff3615f90 --> 0xfffffffffffffffa RBX: 0xa8 RCX: 0x7ffff3616028 --> 0xf938000001a4 RDX: 0x18 RSI: 0x7fffffffd6e0 --> 0x6ab2a5fe4fe8efd RDI: 0x7ffff3615fe0 --> 0x44b6a41dfdc1a3df RBP: 0x7fffffffd510 --> 0xa8 RSP: 0x7fffffffcc78 --> 0x7ffff6e936cf (mov rcx,QWORD PTR [rbp-0x38]) RIP: 0x7ffff6120786 (<__memmove_sse2_unaligned_erms+614>: movntdq XMMWORD PTR [rdi+0x20],xmm2) R8 : 0xfffffffffffffff0 R9 : 0x10007e6bac07 --> 0x0 R10: 0x7ffff3616038 --> 0x0 R11: 0x7ffff3615f90 --> 0xfffffffffffffffa R12: 0x7ffff3615f90 --> 0xfffffffffffffffa R13: 0x7fffffffd650 --> 0xa35bf3e9cd13e78e R14: 0x7ffff3615f90 --> 0xfffffffffffffffa R15: 0x0 EFLAGS: 0x10206 (carry PARITY adjust zero sign trap INTERRUPT direction overflow) [-------------------------------------code-------------------------------------] 0x7ffff6120779 <__memmove_sse2_unaligned_erms+601>: sub rdx,0x40 0x7ffff612077d <__memmove_sse2_unaligned_erms+605>: movntdq XMMWORD PTR [rdi],xmm0 0x7ffff6120781 <__memmove_sse2_unaligned_erms+609>: movntdq XMMWORD PTR [rdi+0x10],xmm1 => 0x7ffff6120786 <__memmove_sse2_unaligned_erms+614>: movntdq XMMWORD PTR [rdi+0x20],xmm2 0x7ffff612078b <__memmove_sse2_unaligned_erms+619>: movntdq XMMWORD PTR [rdi+0x30],xmm3 0x7ffff6120790 <__memmove_sse2_unaligned_erms+624>: add rdi,0x40 0x7ffff6120794 <__memmove_sse2_unaligned_erms+628>: cmp rdx,0x40 0x7ffff6120798 <__memmove_sse2_unaligned_erms+632>: ja 0x7ffff6120758 <__memmove_sse2_unaligned_erms+568> [------------------------------------stack-------------------------------------] 0000| 0x7fffffffcc78 --> 0x7ffff6e936cf (mov rcx,QWORD PTR [rbp-0x38]) 0008| 0x7fffffffcc80 --> 0x7fffffffccf0 --> 0x41b58ab3 0016| 0x7fffffffcc88 --> 0x7fffffffcd90 --> 0x6 0024| 0x7fffffffcc90 --> 0xffffffff99e --> 0x0 0032| 0x7fffffffcc98 --> 0x7fffffffcd50 --> 0x0 0040| 0x7fffffffcca0 --> 0x0 0048| 0x7fffffffcca8 --> 0x7ffff3616038 --> 0x0 0056| 0x7fffffffccb0 --> 0x7ffff358a068 --> 0x1 [------------------------------------------------------------------------------] Legend: code, data, rodata, value Stopped reason: SIGSEGV __memmove_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:492 492 ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory. gdb-peda$ bt #0 __memmove_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:492 #1 0x00007ffff6e936cf in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.4 #2 0x00007ffff2a5eab4 in memcpy (__len=0xa8, __src=, __dest=) at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34 #3 _PySHA3_KeccakP1600_ExtractLanes (state=, data=, laneCount=0x15) at /home/test/cpython/Modules/_sha3/kcp/KeccakP-1600-opt64.c:342 #4 0x00007ffff2a5ec2c in _PySHA3_KeccakP1600_ExtractBytes (state=0x7fffffffd650, data=0x7ffff3615f90 "\372\377\377\377\377\377\377\377\002", offset=, length=0xa8) at /home/test/cpython/Modules/_sha3/kcp/KeccakP-1600-opt64.c:375 #5 0x00007ffff2a5ee1d in _PySHA3_KeccakWidth1600_SpongeSqueeze (instance=0x7fffffffd650, data=, dataByteLen=0x1ffffffffffffff6) at /home/test/cpython/Modules/_sha3/kcp/KeccakSponge.inc:287 #6 0x00007ffff2a5f793 in _SHAKE_digest (hex=0x1, digestlen=0xfffffffffffffff6, self=0x7ffff7ed98e8) at /home/test/cpython/Modules/_sha3/sha3module.c:620 #7 _sha3_shake_128_hexdigest_impl (length=0xfffffffffffffff6, self=0x7ffff7ed98e8) at /home/test/cpython/Modules/_sha3/sha3module.c:669 #8 _sha3_shake_128_hexdigest (self=0x7ffff7ed98e8, args=, nargs=, kwnames=) at /home/test/cpython/Modules/_sha3/clinic/sha3module.c.h:149 #9 0x000055555583eab6 in _PyCFunction_FastCallDict (kwargs=0x0, nargs=0x1, args=0x616000021518, func_obj=0x7ffff2e86f30) at Objects/methodobject.c:250 #10 _PyCFunction_FastCallKeywords (func=func at entry=0x7ffff2e86f30, stack=0x616000021518, nargs=nargs at entry=0x1, kwnames=kwnames at entry=0x0) at Objects/methodobject.c:294 #11 0x0000555555995945 in call_function (pp_stack=pp_stack at entry=0x7fffffffdc30, oparg=oparg at entry=0x1, kwnames=kwnames at entry=0x0) at Python/ceval.c:4837 #12 0x000055555599feaa in _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3335 #13 0x0000555555994939 in PyEval_EvalFrameEx (throwflag=0x0, f=0x616000021398) at Python/ceval.c:754 #14 _PyEval_EvalCodeWithName (_co=_co at entry=0x7ffff36088a0, globals=globals at entry=0x0, locals=locals at entry=0x7ffff355a9d8, args=args at entry=0x0, argcount=argcount at entry=0x0, kwnames=kwnames at entry=0x0, kwargs=0x0, kwcount=0x0, kwstep=0x2, defs=0x0, defcount=0x0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0) at Python/ceval.c:4166 #15 0x0000555555997b73 in PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, defcount=0x0, defs=0x0, kwcount=0x0, kws=0x0, argcount=0x0, args=0x0, locals=locals at entry=0x7ffff355a9d8, globals=globals at entry=0x0, _co=_co at entry=0x7ffff36088a0) at Python/ceval.c:4187 #16 PyEval_EvalCode (co=co at entry=0x7ffff36088a0, globals=globals at entry=0x7ffff7e5a318, locals=locals at entry=0x7ffff7e5a318) at Python/ceval.c:731 #17 0x00005555556b5b3b in run_mod (arena=0x7ffff7e75150, flags=, locals=0x7ffff7e5a318, globals=0x7ffff7e5a318, filename=0x7ffff358d270, mod=0x62500001e300) at Python/pythonrun.c:1025 #18 PyRun_FileExFlags (fp=, filename_str=, start=, globals=, locals=, closeit=, flags=) at Python/pythonrun.c:978 #19 0x00005555556b5fdc in PyRun_SimpleFileExFlags (fp=, filename=0x7ffff35c2680 "\314\070\064\302\227\a\254\bJf\331u\230N\273\022\355@\200\352\024`z[\267&\257+\022Q\324\017\310\nSyF2+\001{\327\354\355\245\275\002\064d-\235x\\\327O\230?\036?F\222\326\336\060\027q\220\037\217\b\364#=\366\224,\362\355\224i4h\030.c\377\225\360.?M\033\066\251\ve'M=\261\t\365\307\016\267\203Q\316\313n\251]+\351H\222\244\266{\224FG\257\022\340\071\233r\300\220\065\031\236][\266\v\027\071#\354?\310\\\243M\243\251\250\372_\362^?\306?\222\365\062O1nY\224p?\243IV\364\070\356\232\\\222z\242\321\v\027|\342\027\325\325O?\300\252a0\250"..., closeit=0x1, flags=) at Python/pythonrun.c:419 #20 0x00005555556f2704 in run_file (p_cf=0x7fffffffe2b0, filename=0x604000000010 L"crash.py", fp=0x616000034880) at Modules/main.c:340 #21 Py_Main (argc=, argv=) at Modules/main.c:810 #22 0x000055555569a293 in main (argc=argc at entry=0x2, argv=argv at entry=0x7fffffffe528) at ./Programs/python.c:69 #23 0x00007ffff6086b97 in __libc_start_main (main=0x55555569a050
, argc=0x2, argv=0x7fffffffe528, init=, fini=, rtld_fini=, stack_end=0x7fffffffe518) at ../csu/libc-start.c:310 #24 0x000055555569bb2a in _start () ``` x.py ``` import hashlib hashlib.shake_128().hexdigest(-10) ``` ---------- components: Demos and Tools messages: 327277 nosy: shuoz priority: normal severity: normal status: open title: hashlib segmentation fault type: security versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 7 12:53:51 2018 From: report at bugs.python.org (Shadow Raven) Date: Sun, 07 Oct 2018 16:53:51 +0000 Subject: [New-bugs-announce] [issue34923] Decimal Multiplication problems: Wrong solution Message-ID: <1538931231.02.0.545547206417.issue34923@psf.upfronthosting.co.za> New submission from Shadow Raven : Some decimals, when multiplied with others, give wrong solutions: 6.23*5 = 31.150000000000002 6.89*5 = 34.449999999999996 There are more but I can't list all. ---------- messages: 327290 nosy: Shadow Raven priority: normal severity: normal status: open title: Decimal Multiplication problems: Wrong solution versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 7 21:53:51 2018 From: report at bugs.python.org (Dan Snider) Date: Mon, 08 Oct 2018 01:53:51 +0000 Subject: [New-bugs-announce] [issue34924] inspect.signature isn't aware that types.MethodType can wrap any callable Message-ID: <1538963631.37.0.545547206417.issue34924@psf.upfronthosting.co.za> New submission from Dan Snider : I actually noticed this due to it confusingly breaking IDLE call tips and code completion. >>> import inspect >>> from types import MethodType >>> bound_len = MethodType(len, 'abc') >>> bound_len() 3 >>> inspect.signature(bound_len) >>> inspect.signature(len) ---------- components: Library (Lib) messages: 327313 nosy: bup priority: normal severity: normal status: open title: inspect.signature isn't aware that types.MethodType can wrap any callable versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 7 23:33:04 2018 From: report at bugs.python.org (Raymond Hettinger) Date: Mon, 08 Oct 2018 03:33:04 +0000 Subject: [New-bugs-announce] [issue34925] 25% speed-up to common case bisect() Message-ID: <1538969584.76.0.545547206417.issue34925@psf.upfronthosting.co.za> New submission from Raymond Hettinger : The common case for bisect calls is to have two positional arguments and no keyword arguments. For this case, PyArg_ParseTupleAndKeywords() is unnecessarily expensive. Timings ------- $ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)' 2000000 loops, best of 11: 152 nsec per loop $ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)' 2000000 loops, best of 11: 152 nsec per loop $ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)' 2000000 loops, best of 11: 152 nsec per loop ------- patched -------- $ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)' 2000000 loops, best of 11: 112 nsec per loop $ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)' 2000000 loops, best of 11: 113 nsec per loop $ pytime -r 11 -s 'from bisect import bisect' -s 'arr=list(range(5))' 'bisect(arr, 2)' 2000000 loops, best of 11: 113 nsec per loop ---------- components: Extension Modules messages: 327317 nosy: rhettinger priority: normal severity: normal status: open title: 25% speed-up to common case bisect() type: performance versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 02:07:24 2018 From: report at bugs.python.org (YoSTEALTH) Date: Mon, 08 Oct 2018 06:07:24 +0000 Subject: [New-bugs-announce] [issue34926] Adding "mine_type" method to pathlib.Path Message-ID: <1538978844.01.0.545547206417.issue34926@psf.upfronthosting.co.za> New submission from YoSTEALTH : How about adding basic "mime_type" method to "pathlib.Path" ? Code would do something like: import mimetypes def mime_type(name): """Mime-type of the file.""" find = name.rfind('.') ext = '' if find == -1 else name[find:] return mimetypes.types_map.get(ext, 'application/octet-stream') Users would use it like so: import pathlib file = pathlib.Path('hello_world.py') print(file.mime_type) # 'text/x-python' ---------- components: Extension Modules messages: 327323 nosy: YoSTEALTH priority: normal severity: normal status: open title: Adding "mine_type" method to pathlib.Path type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 03:32:02 2018 From: report at bugs.python.org (Aivar Annamaa) Date: Mon, 08 Oct 2018 07:32:02 +0000 Subject: [New-bugs-announce] [issue34927] Tkinter-related segfault on macOS (regression between 3.7.0 and 3.7.1rc1) Message-ID: <1538983922.23.0.545547206417.issue34927@psf.upfronthosting.co.za> New submission from Aivar Annamaa : After switching from Python 3.7.0 to 3.7.1rc1 (macOS, 64-bit only downloaded from python.org), my rather big Tkinter application started to segfault whenever I close a system dialog (eg. the one created by askopenfilename or showerror) by keypress (eg. Escape or Enter). The crash does not happen when I close the dialog with mouse click. The code that calls the dialog runs fine, and the crash seems to happen next time the control goes back to Tk mainloop. It looks like the keypress performed in the dialog somehow remains in Tk event queue. Here is the system log for main thread, (more detailed information can be seen at https://bitbucket.org/plas/thonny/issues/545/quit): Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY VM Regions Near 0: --> __TEXT 000000010ab7e000-000000010ab7f000 [ 4K] r-x/rwx SM=COW /Users/USER/Desktop/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff97e1a8ea __kill + 10 1 libsystem_platform.dylib 0x00007fff96dba52a _sigtramp + 26 2 ??? 000000000000000000 0 + 0 3 libtk8.6.dylib 0x000000010b876e84 -[TKApplication(TKKeyEvent) tkProcessKeyEvent:] + 160 4 libtk8.6.dylib 0x000000010b87d6d9 TkMacOSXEventsCheckProc + 360 5 libtcl8.6.dylib 0x000000010b714d06 Tcl_DoOneEvent + 316 6 _tkinter.cpython-37m-darwin.so 0x000000010b64501d _tkinter_tkapp_mainloop + 269 7 org.python.python 0x000000010aba752e _PyMethodDef_RawFastCallKeywords + 430 8 org.python.python 0x000000010abad192 _PyMethodDescr_FastCallKeywords + 82 9 org.python.python 0x000000010ac6640c call_function + 780 10 org.python.python 0x000000010ac6339c _PyEval_EvalFrameDefault + 25164 11 org.python.python 0x000000010ac66f06 _PyEval_EvalCodeWithName + 2422 12 org.python.python 0x000000010aba6a61 _PyFunction_FastCallKeywords + 257 13 org.python.python 0x000000010ac663e2 call_function + 738 14 org.python.python 0x000000010ac633b6 _PyEval_EvalFrameDefault + 25190 15 org.python.python 0x000000010aba6ed0 function_code_fastcall + 128 16 org.python.python 0x000000010ac663e2 call_function + 738 17 org.python.python 0x000000010ac63457 _PyEval_EvalFrameDefault + 25351 18 org.python.python 0x000000010ac66f06 _PyEval_EvalCodeWithName + 2422 19 org.python.python 0x000000010ac5d074 PyEval_EvalCode + 100 20 org.python.python 0x000000010ac5a65d builtin_exec + 557 21 org.python.python 0x000000010aba752e _PyMethodDef_RawFastCallKeywords + 430 22 org.python.python 0x000000010aba6a9a _PyCFunction_FastCallKeywords + 42 23 org.python.python 0x000000010ac663d4 call_function + 724 24 org.python.python 0x000000010ac63457 _PyEval_EvalFrameDefault + 25351 25 org.python.python 0x000000010ac66f06 _PyEval_EvalCodeWithName + 2422 26 org.python.python 0x000000010aba6a61 _PyFunction_FastCallKeywords + 257 27 org.python.python 0x000000010ac663e2 call_function + 738 28 org.python.python 0x000000010ac63457 _PyEval_EvalFrameDefault + 25351 29 org.python.python 0x000000010ac66f06 _PyEval_EvalCodeWithName + 2422 30 org.python.python 0x000000010aba663b _PyFunction_FastCallDict + 523 31 org.python.python 0x000000010acb8743 pymain_run_module + 147 32 org.python.python 0x000000010acb7b47 pymain_main + 5303 33 org.python.python 0x000000010acb868a _Py_UnixMain + 58 34 libdyld.dylib 0x00007fff921c35ad start + 1 ---------- components: Tkinter messages: 327326 nosy: aivarannamaa priority: normal severity: normal status: open title: Tkinter-related segfault on macOS (regression between 3.7.0 and 3.7.1rc1) versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 05:49:32 2018 From: report at bugs.python.org (Marc Richter) Date: Mon, 08 Oct 2018 09:49:32 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue34928=5D_string_method_=2E?= =?utf-8?b?dXBwZXIoKSBjb252ZXJ0cyAnw58nIHRvICdTUycgaW5zdGVhZCBvZiAn4bqe?= =?utf-8?q?=27?= Message-ID: <1538992172.47.0.545547206417.issue34928@psf.upfronthosting.co.za> New submission from Marc Richter : There's a special letter in German orthography called "eszett" (?). This letter had no uppercase variant for hundreds of years until 2017, there was an uppercase variant added to the official German orthography called "capital eszett" (?) [1]. Python's .upper() string method still translates this to "SS" (which was correct before 2017): ~ $ python3.7.0 Python 3.7.0 (default, Aug 29 2018, 17:15:17) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 'gru?'.upper() 'GRUSS' >>> The result of this example should have been 'GRU?' instead. That being said, it's fair to inform about the fact that this letter is still quite unpopular in Germany; it is not even typeable with German keyboards, yet. Anyways, I think since this became officials orthography, it's not Python's job to adopt behaviors but clear rules instead. I'm not sure if this affects .casefold() as well, since I do not get that method's scope. BR, Marc Richter [1]: https://en.wikipedia.org/wiki/Capital_%E1%BA%9E ---------- components: Interpreter Core messages: 327336 nosy: Marc Richter priority: normal severity: normal status: open title: string method .upper() converts '?' to 'SS' instead of '?' type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 07:13:28 2018 From: report at bugs.python.org (Andrew Svetlov) Date: Mon, 08 Oct 2018 11:13:28 +0000 Subject: [New-bugs-announce] [issue34929] Extract asyncio sendfile tests into a separate test file Message-ID: <1538997208.2.0.545547206417.issue34929@psf.upfronthosting.co.za> Change by Andrew Svetlov : ---------- components: Tests, asyncio nosy: asvetlov, yselivanov priority: normal severity: normal status: open title: Extract asyncio sendfile tests into a separate test file versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 07:37:02 2018 From: report at bugs.python.org (Antoine Pietri) Date: Mon, 08 Oct 2018 11:37:02 +0000 Subject: [New-bugs-announce] [issue34930] sha1module: Switch sha1 implementation to sha1dc/hardened sha1 Message-ID: <1538998622.72.0.545547206417.issue34930@psf.upfronthosting.co.za> New submission from Antoine Pietri : SHA-1 has been broken a while ago. While the general recommandation is to migrate to more recent hashes (like SHA-2 and SHA-3), a lot of industry applications (notably Merkle DAG implementations like Git or Blockchains) require backwards compatibility with SHA-1, at least for the time being required for all the users to transition. The SHAttered authors published along with their paper a reference implementation of a "hardened SHA-1" algorithm, a SHA-1 implementation that uses counter-cryptanalysis to detect inputs that were forged to produce a hash collision. What that means is that Hardened SHA-1 is a secure hash function that produces the same output as SHA-1 in 99.999999...% of cases, and only differs when two inputs were specifically made to generate collisions. The reference implementation is here: https://github.com/cr-marcstevens/sha1collisiondetection A large part of the industry has adopted Hardened SHA-1 as a temporary replacement for SHA-1, most notably Git under the name "sha1dc": https://github.com/git/git/commit/28dc98e343ca4eb370a29ceec4c19beac9b5c01e Since CPython has its own implementation of SHA-1, I think it would be a good idea to provide a hardened SHA-1 implementation. So either: 1. we replace the current implementation of sha1 by sha1dc completely, which might be a problem for people who write script to detect whether two files collide with classic sha1 2. we replace the current implementation but we keep the old one under a new name, like "sha1_broken" or "sha1_classic", which breaks backwards compatibility in a few marginal cases but the functionality can be trivially restored by changing the name of the hash 3. we keep the current implementation but add a new one under a new name "sha1dc", which probably means most people will stay on a broken implementation for no good reason, but it will be fully backwards-compatible even in the marginal cases 4. we don't implement Hardened SHA-1 at all, and we advise people to change their hash algorithm, while realizing that this solution is not feasible in a lot of cases. I'd suggest going with either 1. or 2. What would be your favorite option? Not sure whether this should go in security or enhancement, so I put it in the latter category to be more conservative in issue prioritization. I added the devs who worked the most on Modules/sha1module.c in the Nosy list. ---------- components: Library (Lib) messages: 327343 nosy: antoine.pietri, christian.heimes, loewis, vstinner priority: normal severity: normal status: open title: sha1module: Switch sha1 implementation to sha1dc/hardened sha1 type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 08:06:01 2018 From: report at bugs.python.org (Jan Novak) Date: Mon, 08 Oct 2018 12:06:01 +0000 Subject: [New-bugs-announce] [issue34931] os.path.splitext with more dots Message-ID: <1539000361.1.0.545547206417.issue34931@psf.upfronthosting.co.za> New submission from Jan Novak : There are some old tickets about changing splitext() in 2007: https://bugs.python.org/issue1115886 https://bugs.python.org/issue1681842 Present python documentation: Leading periods on the basename are ignored; splitext('.cshrc') returns ('.cshrc', ''). Changed in version 2.6: Earlier versions could produce an empty root when the only period was the first character. But nobody take care about more than one dots: For example this possible corect filenames: >>> os.path.splitext('....jpg') ('....jpg', '') So present function is insuficient (buggy) to use to detect right extension. Maybe new parameter would be helpfull for that? Like parameter "preserve_dotfiles" discussed in 2007. And what to do with the wrong '.', '..', '...', ... filenames? ---------- messages: 327346 nosy: xnovakj priority: normal severity: normal status: open title: os.path.splitext with more dots type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 09:38:10 2018 From: report at bugs.python.org (Robert) Date: Mon, 08 Oct 2018 13:38:10 +0000 Subject: [New-bugs-announce] [issue34932] Add macOS TCP_KEEPALIVE to available socket options Message-ID: <1539005890.42.0.545547206417.issue34932@psf.upfronthosting.co.za> New submission from Robert : macOS uses TCP_KEEPALIVE in place of TCP_KEEPIDLE. It would be good to have this available in the socket library to use directly. Pull request coming up. ---------- components: Library (Lib) messages: 327351 nosy: llawall priority: normal severity: normal status: open title: Add macOS TCP_KEEPALIVE to available socket options type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 10:11:26 2018 From: report at bugs.python.org (Juozas Masiulis) Date: Mon, 08 Oct 2018 14:11:26 +0000 Subject: [New-bugs-announce] [issue34933] json.dumps serializes double quotes incorrectly Message-ID: <1539007886.12.0.545547206417.issue34933@psf.upfronthosting.co.za> New submission from Juozas Masiulis : currently python behaves like this: >>> import json >>> a={'a': '//a[@asdf="asdf"]'} >>> json.dumps(a) '{"a": "//a[@asdf=\\"asdf\\"]"}' this behaviour is incorrect. the resulting string should be '{"a": "//a[@asdf=\"asdf\"]"}' The difference is that double quotes inside double quotes are escaped twice instead of once. compare it to behaviour in javascript: > var a = {'a': '//a[@asdf="asdf"]'} undefined JSON.stringify(a) "{"a":"//a[@asdf=\"asdf\"]"}" ---------- messages: 327352 nosy: Juozas.Masiulis priority: normal severity: normal status: open title: json.dumps serializes double quotes incorrectly type: behavior versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 10:32:57 2018 From: report at bugs.python.org (Ondra Kutal) Date: Mon, 08 Oct 2018 14:32:57 +0000 Subject: [New-bugs-announce] [issue34934] Consider making Windows select.select interruptable using WSAEventSelect & WSAWaitForMultipleEvents Message-ID: <1539009177.63.0.545547206417.issue34934@psf.upfronthosting.co.za> New submission from Ondra Kutal : At the moment, socket select.select() function is not interruptable on Windows OS (in main thread). Following code cannot be interrupted (for example by CTRL+C): import select, socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setblocking(False) s.bind(('0.0.0.0', 6666)) s.listen(100) select.select([s], [], [], None) s.close() However this can be achieved by replacing select() calls with use of Windows native APIs WSAEventSelect and WSAWaitForMultipleEvents (see for example https://stackoverflow.com/questions/10353017). I have tried a quick prototype in selectmodule.c, replacing Py_BEGIN_ALLOW_THREADS errno = 0; n = select(max, &ifdset, &ofdset, &efdset, tvp); Py_END_ALLOW_THREADS with #ifndef MS_WINDOWS Py_BEGIN_ALLOW_THREADS errno = 0; n = select(max, &ifdset, &ofdset, &efdset, tvp); Py_END_ALLOW_THREADS #else if (!_PyOS_IsMainThread()) { Py_BEGIN_ALLOW_THREADS errno = 0; n = select(max, &ifdset, &ofdset, &efdset, tvp); Py_END_ALLOW_THREADS } else { // quick prototype, only for read sockets WSAEVENT events[50]; for (u_int i = 0; i < ifdset.fd_count; ++i) { events[i+1] = WSACreateEvent(); WSAEventSelect(ifdset.fd_array[i], events[i+1], FD_ACCEPT | FD_READ); } /* putting interrupt event as a first one in the list */ events[0] = _PyOS_SigintEvent(); ResetEvent(events[0]); Py_BEGIN_ALLOW_THREADS errno = 0; n = WSAWaitForMultipleEvents(ifdset.fd_count, events, FALSE, tvp ? (DWORD)_PyTime_AsMilliseconds(timeout, _PyTime_ROUND_CEILING) : WSA_INFINITE, FALSE); Py_END_ALLOW_THREADS if (n == 0) errno = EINTR; else if (n == WSA_WAIT_FAILED) n = SOCKET_ERROR; else n = 1; /* prototype implementation, acting like just 1 socket is ready, for actual number it will be probably necessary to query WSAWaitForMultipleEvents multiple times since it otherwise returns only index of first ready event... */ } #endif and then I was able to interrupt the script above. I noticed slight performance loss when having timeout 0, repeating select 1000 times it took ~2000 us, wile after this update it took ~3000 us. I am just throwing it here to consider as a possibility. Clearly my code above is just proof of concept, modification would be needed (include write fd, some proper fd limit, possibly check multiple times to get actual number of ready fds, etc...). ---------- components: Interpreter Core, Windows messages: 327354 nosy: Ondra Kutal, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Consider making Windows select.select interruptable using WSAEventSelect & WSAWaitForMultipleEvents type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 11:38:20 2018 From: report at bugs.python.org (=?utf-8?q?Walter_D=C3=B6rwald?=) Date: Mon, 08 Oct 2018 15:38:20 +0000 Subject: [New-bugs-announce] [issue34935] Misleading error message in str.decode() Message-ID: <1539013100.29.0.545547206417.issue34935@psf.upfronthosting.co.za> New submission from Walter D?rwald : The following code issues a misleading exception message: >>> b'\xed\xa0\xbd\xed\xb3\x9e'.decode("utf-8") Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 0: invalid continuation byte The cause for the exception is *not* an invalid continuation byte, but UTF-8 encoded surrogates. In fact using the 'surrogatepass' error handler doesn't raise an exception: >>> b'\xed\xa0\xbd\xed\xb3\x9e'.decode("utf-8", "surrogatepass") '\ud83d\udcde' I would have expected an exception message like: UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 0-2: surrogates not allowed (Note that the input bytes are an improperly UTF-8 encoded version of U+1F4DE (telephone receiver)) ---------- components: Unicode messages: 327357 nosy: doerwalter, ezio.melotti, vstinner priority: normal severity: normal status: open title: Misleading error message in str.decode() versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 11:56:55 2018 From: report at bugs.python.org (Juliette Monsel) Date: Mon, 08 Oct 2018 15:56:55 +0000 Subject: [New-bugs-announce] [issue34936] tkinter.Spinbox.selection_element() raises TclError Message-ID: <1539014215.23.0.545547206417.issue34936@psf.upfronthosting.co.za> New submission from Juliette Monsel : Spinbox.selection_element() raises `TclError: expected integer but got "none"` while it should return the currently selected element according to the docstring. I think this issue comes from the Spinbox.selection method which tries to convert to int the output of self.tk.call((self._w, 'selection', 'element')) while it returns a string ("none", "buttonup" or "buttondown"). ---------- components: Tkinter messages: 327359 nosy: j-4321-i priority: normal severity: normal status: open title: tkinter.Spinbox.selection_element() raises TclError type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 15:32:19 2018 From: report at bugs.python.org (Andrew Svetlov) Date: Mon, 08 Oct 2018 19:32:19 +0000 Subject: [New-bugs-announce] [issue34937] Extract asyncio tests for sock_*() methods into a separate test file Message-ID: <1539027139.89.0.545547206417.issue34937@psf.upfronthosting.co.za> Change by Andrew Svetlov : ---------- components: Tests, asyncio nosy: asvetlov, yselivanov priority: normal severity: normal status: open title: Extract asyncio tests for sock_*() methods into a separate test file versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 18:13:09 2018 From: report at bugs.python.org (YoSTEALTH) Date: Mon, 08 Oct 2018 22:13:09 +0000 Subject: [New-bugs-announce] [issue34938] Fix mimetype.init() to account for from import Message-ID: <1539036789.21.0.545547206417.issue34938@psf.upfronthosting.co.za> New submission from YoSTEALTH : When a user uses from import, there is a flaw in how mimetype.init() updates its global references. # Option-1 (flawed) # ----------------- from mimetypes import init, types_map print(types_map.get('.gz')) # None init() # <- initialize print(types_map.get('.gz')) # None # Option-2 # -------- import mimetypes print(mimetypes.types_map.get('.gz')) # None mimetypes.init() # <- initialize print(mimetypes.types_map.get('.gz')) # application/gzip As you can see in https://github.com/python/cpython/blob/master/Lib/mimetypes.py#L344 line:358 global reference is reassigned and thus it prevents `from mimetype import types_map` from being updated and using old `types_map` reference. Potential solution would be to `types_map.update(new dict content)` vs reassigning the variable. ---------- messages: 327375 nosy: YoSTEALTH priority: normal severity: normal status: open title: Fix mimetype.init() to account for from import type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 21:58:38 2018 From: report at bugs.python.org (Rohan Padhye) Date: Tue, 09 Oct 2018 01:58:38 +0000 Subject: [New-bugs-announce] [issue34939] Possibly spurious SyntaxError: annotated name can't be global Message-ID: <1539050318.57.0.545547206417.issue34939@psf.upfronthosting.co.za> New submission from Rohan Padhye : The following code when run as a script file gives syntax error: ``` def set_x(): global x x = 1 x:int = 0 # SyntaxError: annotated name 'x' can't be global ``` PEP 526 does not seem to forbid this. The error message "annotated name [...] can't be global" is usually seen when using the `global x` declaration *in the same scope* as an annotated assignment. In the above case, the annotated assignment is outside the function scope, yet Python 3.7 gives a syntax error. Is this a bug in CPython? Or should the PEP 526 document say something about forward references? Interestingly, if the above program is run in interactive mode, there is no syntax error. In interactive mode: ``` >>> def set_x(): ... global x ... x = 1 ... >>> x:int = 0 >>> set_x() >>> print(x) 1 ``` Further, forward references work fine with `nonlocal`. For example, the following works fine both as a script file and in interactive mode: ``` def outer(): def inner(): nonlocal y y = 1 y:int = 0 ``` I don't see why a forward reference in `global` is a problem. ---------- components: Interpreter Core messages: 327378 nosy: rohanpadhye priority: normal severity: normal status: open title: Possibly spurious SyntaxError: annotated name can't be global type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 8 22:23:39 2018 From: report at bugs.python.org (Zackery Spytz) Date: Tue, 09 Oct 2018 02:23:39 +0000 Subject: [New-bugs-announce] [issue34940] Possible assertion failure due to _check_for_legacy_statements() Message-ID: <1539051819.92.0.545547206417.issue34940@psf.upfronthosting.co.za> New submission from Zackery Spytz : The PyUnicode_Tailmatch() and PyUnicode_FromString() calls in _check_for_legacy_statements() are not properly checked for failure. ---------- components: Interpreter Core messages: 327379 nosy: ZackerySpytz priority: normal severity: normal status: open title: Possible assertion failure due to _check_for_legacy_statements() type: crash versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 05:32:15 2018 From: report at bugs.python.org (Jack Jansen) Date: Tue, 09 Oct 2018 09:32:15 +0000 Subject: [New-bugs-announce] [issue34941] xml.etree.ElementTree findall() fails when using custom TreeBuilder Message-ID: <1539077535.05.0.545547206417.issue34941@psf.upfronthosting.co.za> New submission from Jack Jansen : When using a TreeBuilder with a custom factory (returning a subclass of Element with some extra functionality) there is an issue with findall(). XPaths using an indexed predicate no longer work: the findall() result is always empty. The attached test script shows the problem. I have analysed this as far as finding that the issue is in ElementPath.prepare_predicate..select(), the last one. Specifically, the statement elems = list(parent.findall(elem.tag)) always returns an empty list (if the Element class is subclassed). When using Python 2.7 everything works fine. When adding a findall() method to the Element subclass that simply calls Element.findall() everything also works fine. I suspect some issue with the _elementtree C implementation but I don't understand it. ---------- components: Library (Lib) files: testetns.py messages: 327385 nosy: jackjansen priority: normal severity: normal stage: needs patch status: open title: xml.etree.ElementTree findall() fails when using custom TreeBuilder type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47859/testetns.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 06:06:51 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Tue, 09 Oct 2018 10:06:51 +0000 Subject: [New-bugs-announce] [issue34942] Add an FAQ note about floating point representation Message-ID: <1539079611.42.0.545547206417.issue34942@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : There have been tickets raised due to floating point representation being misleading where "0.1 + 0.2" returns 0.30000000000000004 and "0.1 + 0.3" returns 0.4. This is explained at [0] but I think it's worth to add this as a question to FAQ and link to the tutorial and possibly to some external links like [1] and [2] so that the user can understand the limitation instead of assuming it's a bug in CPython. Searching for "floatingpoint.html" gives 64 issues [4] were the documentation was linked out of which 3 were reported in the past one month. If there is also any other page where this can be linked to get better visibility then this could avoid a lot of confusion especially for beginners where "0.1 + 0.3" silently seems to work fine but "0.1 + 0.2" has a misleading representation along with variations in other floating point arithmetic operations making the user think it's a CPython bug. Adding Raymond to see if it's worth adding it in FAQ or any other place and also that he might have more feedback on teaching users and wording this in a better way. [0] https://docs.python.org/3/tutorial/floatingpoint.html [1] https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html [2] https://0.30000000000000004.com/ [4] https://bugs.python.org/issue?%40columns=id%2Cactivity%2Ctitle%2Ccreator%2Cassignee%2Cstatus%2Ctype&%40sort=-activity&%40filter=status&%40action=searchid&ignore=file%3Acontent&%40search_text=floatingpoint.html&submit=search&status=-1%2C1%2C2%2C3 ---------- assignee: docs at python components: Documentation messages: 327390 nosy: docs at python, rhettinger, xtreak priority: normal severity: normal status: open title: Add an FAQ note about floating point representation versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 08:28:53 2018 From: report at bugs.python.org (ajneu) Date: Tue, 09 Oct 2018 12:28:53 +0000 Subject: [New-bugs-announce] [issue34943] sched cancel (wrong item removed from queue) Message-ID: <1539088133.47.0.545547206417.issue34943@psf.upfronthosting.co.za> New submission from ajneu : Hi, in the code given below, the last assert fails when running with /mingw64/bin/python3 (Python 3.7.0 -- mingw64's python3 from msys2 project) C:\Python36\python.exe (Python 3.6.6 -- windows installer) It does not fail when running with /usr/bin/python3 (Python 3.6.6 -- msys's python3 from msys2 project) import sched, time, threading class A(threading.Thread): def __init__(self, sched): threading.Thread.__init__(self) self._sched = sched self.start() def run(self): self._sched.run() s = sched.scheduler(time.monotonic, time.sleep) ev1=None def go1(a=''): print(a) global ev1 ev1 = s.enterabs(time.monotonic()+1, 1, go1, argument=('a',)) ev2=None def go2(a=''): print(a) global ev2 ev2 = s.enterabs(time.monotonic()+1, 1, go2, argument=('b',)) ev1 = s.enterabs(time.monotonic()+1, 1, go1, argument=('a',)) ev2 = s.enterabs(time.monotonic()+1, 1, go2, argument=('b',)) a = A(s) time.sleep(2.5) print('schedu queue before', s.queue) assert 1 == 1 print('remove', ev2) assert ev2 in s.queue s.cancel(ev2) print('schedu queue after', s.queue) assert ev2 not in s.queue # fails (SOMETIMES) # what is going on here??? # does the last assert also fail from anybody else? ---------- components: Library (Lib) messages: 327396 nosy: ajneu priority: normal severity: normal status: open title: sched cancel (wrong item removed from queue) type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 09:55:54 2018 From: report at bugs.python.org (Joe Pamer) Date: Tue, 09 Oct 2018 13:55:54 +0000 Subject: [New-bugs-announce] [issue34944] Update _dirnameW to accept long path names Message-ID: <1539093354.15.0.545547206417.issue34944@psf.upfronthosting.co.za> New submission from Joe Pamer : The fix for issue 32557 updated os__getdiskusage_impl to use _dirnameW for obtaining the parent directory of a file. This would cause a regression if the path exceeded 260 characters, since _dirnameW currently returns -1 if given a path >= MAX_PATH in length. As suggested in the issue's comments, _dirnameW should be updated to use PathCchRemoveFileSpec when available (on Win8.1 or greater) to avoid throwing an unnecessary error on a long path. Note: If PathCchRemoveFileSpec isn't available, we can call through PathRemoveFileSpecW, which is otherwise deprecated. What's interesting there is that while the docs say it expects a buffer of size MAX_PATH, analysis of the function shows that it doesn't make assumptions about the size of the path other than it's less than 32k characters in length. It calls through PathCchRemoveFileSpec under the hood on Win8 and greater, passing in 0x8000h as the Cch argument. PathCchRemoveFileSpec then scans through the path for '\' via wcschr, stops when it hits the last one and inserts a NULL. (Analysis of PathRemoveFileSpecW on a Win7 VM shows that it does basically the same thing, and is also resilient to paths greater than MAX_PATH in length.) ---------- components: Windows messages: 327402 nosy: jopamer, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Update _dirnameW to accept long path names versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 10:19:39 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Tue, 09 Oct 2018 14:19:39 +0000 Subject: [New-bugs-announce] [issue34945] regression with ./python -m test Message-ID: <1539094779.54.0.545547206417.issue34945@psf.upfronthosting.co.za> New submission from St?phane Wirtel : Hi Steve, I have a regression since the commit d0f49d2f5085ca68e3dc8725f1fb1c9674bfb5ed, commit d0f49d2f5085ca68e3dc8725f1fb1c9674bfb5ed (HEAD) Author: Steve Dower Date: Tue Sep 18 09:10:26 2018 -0700 bpo-34582: Adds JUnit XML output for regression tests (GH-9210) Before, I could use pdb for the debugging or just use the print() function for debugging. Now, this is just impossible, because stdout & stderr are mapped to an other destination. For the test, just add `import pdb; pdb.set_trace()` in a test and try to execute it. Thank you ---------- components: Tests messages: 327405 nosy: matrixise, steve.dower priority: normal severity: normal status: open title: regression with ./python -m test versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 14:13:59 2018 From: report at bugs.python.org (Chris Bremner) Date: Tue, 09 Oct 2018 18:13:59 +0000 Subject: [New-bugs-announce] [issue34946] inspect.getcallargs is marked as deprecated in documentation, but doesn't issue a DeprecationWarning when used Message-ID: <1539108839.31.0.545547206417.issue34946@psf.upfronthosting.co.za> New submission from Chris Bremner : Looking in the documentation for inspect.getcallargs (https://docs.python.org/3/library/inspect.html#inspect.getcallargs), it appears that inspect.getcallargs is deprecated in favor of inspect.Signature.bind and inspect.Signature.bind_partial. However, when I use inspect.getcallargs, I do not get a DeprecationWarning, while I do get one for other methods that have been deprecated in the inspect library. Because a warning is not issued when inspect.getcallargs is used, it confuses me as to whether this method is actually deprecated or not, since there seems to be a lot of discussion in previous issues about whether this method should be deprecated or not. If it is truly deprecated, should a DeprecationWarning be added? For my situation, I would prefer to use inspect.getcallargs due to its more descriptive error messages when incorrect arguments are used, but if it truly is deprecated, then I should use inspect.Signature.bind instead. ---------- messages: 327428 nosy: chrisjbremner priority: normal severity: normal status: open title: inspect.getcallargs is marked as deprecated in documentation, but doesn't issue a DeprecationWarning when used type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 16:58:00 2018 From: report at bugs.python.org (Jan Hermann) Date: Tue, 09 Oct 2018 20:58:00 +0000 Subject: [New-bugs-announce] [issue34947] inspect.getclosurevars() does not get all globals Message-ID: <1539118680.94.0.545547206417.issue34947@psf.upfronthosting.co.za> New submission from Jan Hermann : inspect.getclosurevars() omits globals or nonlocals that are bound within comprehensions: 22:50 ~ python3 Python 3.7.0 (default, Aug 17 2018, 21:14:48) [Clang 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. (ins)>>> import inspect (ins)>>> x = 1 (ins)>>> def f(): (ins)... return [x for _ in range(1)] (ins)... (ins)>>> inspect.getclosurevars(f) ClosureVars(nonlocals={}, globals={}, builtins={'range': }, unbound=set()) (ins)>>> def f(): (ins)... return x (ins)... (ins)>>> inspect.getclosurevars(f) ClosureVars(nonlocals={}, globals={'x': 1}, builtins={}, unbound=set()) It can be fixed quite easily along the following lines: https://github.com/azag0/calcfw/blob/master/caf2/hashing/func.py#L133-L146 Does this look like a reasonable solution? ---------- components: Library (Lib) messages: 327436 nosy: azag0 priority: normal severity: normal status: open title: inspect.getclosurevars() does not get all globals type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 21:50:43 2018 From: report at bugs.python.org (Steven D'Aprano) Date: Wed, 10 Oct 2018 01:50:43 +0000 Subject: [New-bugs-announce] [issue34948] Document __warningregister__ Message-ID: <1539136243.9.0.788709270274.issue34948@psf.upfronthosting.co.za> New submission from Steven D'Aprano : The warnings module makes use of a per-module global ``__warningregister__`` which is briefly mentioned in the docs but not documented. https://docs.python.org/3/library/warnings.html#warnings.warn_explicit Given that it is part of the warn_explicit API, we should accept that the registry file is now part of the public API not just an implementation detail, and so we should explicitly document its existence and state the expected format. ---------- components: Library (Lib) messages: 327449 nosy: steven.daprano priority: normal severity: normal status: open title: Document __warningregister__ type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 22:41:14 2018 From: report at bugs.python.org (joshu coats) Date: Wed, 10 Oct 2018 02:41:14 +0000 Subject: [New-bugs-announce] [issue34949] ntpath.abspath no longer uses normpath Message-ID: <1539139274.74.0.788709270274.issue34949@psf.upfronthosting.co.za> New submission from joshu coats : After the changes from https://github.com/python/cpython/pull/8544, ntpath.abspath no longer calls normpath on the output of nt._getfullpathname. This unfortunately causes "python setup.py develop" on a project to become upset in some instances because two paths (which should be equal) differ by a trailing slash. Presumably this could be corrected by updating https://github.com/python/cpython/blob/0185f34ddcf07b78feb6ac666fbfd4615d26b028/Lib/ntpath.py#L526 to use normpath when it calls _getfullpathname. ---------- components: Library (Lib), Windows messages: 327452 nosy: paul.moore, rhwlo, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: ntpath.abspath no longer uses normpath type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 9 22:58:35 2018 From: report at bugs.python.org (Fabio Amendola) Date: Wed, 10 Oct 2018 02:58:35 +0000 Subject: [New-bugs-announce] [issue34950] Parse more features from X509 certificate in get_peer_cert() Message-ID: <1539140315.19.0.788709270274.issue34950@psf.upfronthosting.co.za> Change by Fabio Amendola : ---------- assignee: christian.heimes components: SSL nosy: christian.heimes, famendola priority: normal severity: normal status: open title: Parse more features from X509 certificate in get_peer_cert() versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 10 04:05:41 2018 From: report at bugs.python.org (Alberto Moral) Date: Wed, 10 Oct 2018 08:05:41 +0000 Subject: [New-bugs-announce] [issue34951] cookielib/cookiejar cookies' Expires date parse fails with long month names Message-ID: <1539158741.03.0.788709270274.issue34951@psf.upfronthosting.co.za> New submission from Alberto Moral : http.cookiejar (cookielib, for python2.*) does not parse some cookies' Expires date. For example: "Friday, 1-August-1997 00:00:00 GMT" does not work (while: "Fri, 01 Aug 1997 00:00:00 GMT" works fine) This is basically due to long names of months (it is compared with MONTHS_LOWER: list of 3-letter months). So, I propose a small change in the definition of LOOSE_HTTP_DATE_RE (see fifth line): LOOSE_HTTP_DATE_RE = re.compile( r"""^ (\d\d?) # day (?:\s+|[-\/]) (\w{3})\w* # month (3 first letters only) ... Instead of: LOOSE_HTTP_DATE_RE = re.compile( r"""^ (\d\d?) # day (?:\s+|[-\/]) (\w+) # month ... I've tested only http.cookiejar (python 3.6), but I suposse the same change will work on cookielib Thanks in advance ---------- components: Library (Lib) messages: 327461 nosy: alb_moral priority: normal severity: normal status: open title: cookielib/cookiejar cookies' Expires date parse fails with long month names type: behavior versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 10 09:14:12 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Wed, 10 Oct 2018 13:14:12 +0000 Subject: [New-bugs-announce] [issue34952] Problems with the warningregistry() decorator in Lib/unittest/test/test_loader.py Message-ID: <1539177252.94.0.788709270274.issue34952@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : There are other issues in the warningregistry() decorator in Lib/unittest/test/test_loader.py. It contains a code: missing = [] saved = getattr(warnings, '__warningregistry__', missing).copy() ... if saved is missing: The problem is that the condition `saved is missing` is always false. If __warningregistry__ was absent, saved is `missing.copy()` which is a new empty list. As result, warnings.__warningregistry__ is set to [] after the test if it did not exist before the test. Other problem is that this decorator works with __warningregistry__ in the warnings module. It is changed only when warnings are emitted by the code of the warnings module. Is it intentional? I don't know any code that emits warnings in the warnings module. It is hard to understand what was the intention of this decorator. From initial it was not working and cause the decorated tests be silently skipped. This was fixed in issue27063, but now I am not sure that it works as intended. Tests continue to pass after removing it. ---------- components: Tests messages: 327468 nosy: barry, ezio.melotti, michael.foord, rbcollins, serhiy.storchaka priority: normal severity: normal status: open title: Problems with the warningregistry() decorator in Lib/unittest/test/test_loader.py versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 10 12:53:18 2018 From: report at bugs.python.org (Ram Rachum) Date: Wed, 10 Oct 2018 16:53:18 +0000 Subject: [New-bugs-announce] [issue34953] Implement `mmap.mmap.__repr__` Message-ID: <1539190398.83.0.788709270274.issue34953@psf.upfronthosting.co.za> Change by Ram Rachum : ---------- components: Library (Lib) nosy: cool-RR priority: normal severity: normal status: open title: Implement `mmap.mmap.__repr__` type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 10 12:55:29 2018 From: report at bugs.python.org (Alex Corcoles) Date: Wed, 10 Oct 2018 16:55:29 +0000 Subject: [New-bugs-announce] [issue34954] Getting an email's subject is error-prone Message-ID: <1539190529.38.0.788709270274.issue34954@psf.upfronthosting.co.za> New submission from Alex Corcoles : Hi, This is something that has hit us a few times, as we write a significant quantity of software which parses email messages. The thing is, we use email.header.decode_header to decode the Subject: header and it is pretty common for headers to be word-wrapped. If they are, decode_header will return a string with newlines in it. This is something which is unexpected for many people, and can cause bugs which are very difficult to detect in code review or testing, as it's easy to not trigger wordwrapping if not done deliberately. We would humbly suggest to provide a friendly way to get an email's subject in the expected fashion (i.e. with no newlines) or point out this caveat in the docs (or maybe change decode_header to remove newlines itself). Kind regards, ?lex ---------- components: email messages: 327481 nosy: Alex Corcoles, barry, r.david.murray priority: normal severity: normal status: open title: Getting an email's subject is error-prone type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 10 15:55:15 2018 From: report at bugs.python.org (Marnanel Thurman) Date: Wed, 10 Oct 2018 19:55:15 +0000 Subject: [New-bugs-announce] [issue34955] passing a dict to bytes() gives unhelpful error message Message-ID: <1539201315.54.0.788709270274.issue34955@psf.upfronthosting.co.za> New submission from Marnanel Thurman : bytes() doesn't accept a dict as parameter. If you attempt to pass one, you receive a TypeError with the baffling message "'str' object cannot be interpreted as an integer". >> bytes({'a':1}) Traceback (most recent call last): File "", line 1, in TypeError: 'str' object cannot be interpreted as an integer ---------- components: Interpreter Core messages: 327490 nosy: marnanel priority: normal severity: normal status: open title: passing a dict to bytes() gives unhelpful error message versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 10 23:29:08 2018 From: report at bugs.python.org (Kevin Walzer) Date: Thu, 11 Oct 2018 03:29:08 +0000 Subject: [New-bugs-announce] [issue34956] 3.7.0 _tkinter module links against /System/Library/Frameworks Message-ID: <1539228548.05.0.788709270274.issue34956@psf.upfronthosting.co.za> New submission from Kevin Walzer : I'm trying to build Python 3.7.0 on macOS 10.14, and Tkinter is not linking to my installation of Tcl/Tk 8.6.8 in /Library/Frameworks. Instead it is linking to the ancient 8.5 Tk installed in /System/Library/Frameworks. My usual way of forcing Python to link to my installation is to edit setup.py and comment out all search directories except /Library/Frameworks, but that seems to be ignored here. My basic invocation is "./configure --enable-framework" which, along with omitting the system libraries from setup.py, has always been sufficient in the past. Please advise. ---------- components: macOS messages: 327508 nosy: ned.deily, ronaldoussoren, wordtech priority: normal severity: normal status: open title: 3.7.0 _tkinter module links against /System/Library/Frameworks versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 11 05:43:26 2018 From: report at bugs.python.org (Stefan Rink) Date: Thu, 11 Oct 2018 09:43:26 +0000 Subject: [New-bugs-announce] [issue34957] Segementation faults on ARM and ARM64 Message-ID: <1539251006.2.0.788709270274.issue34957@psf.upfronthosting.co.za> New submission from Stefan Rink : When trying to run dask distributed on ARM you will end with a segmentation fault on multiple in multiple tests; Works on AMD64 but does not work on ARM or AARCH64 and results in a Signal 11. Example; # python Python 3.6.6 (default, Sep 29 2018, 05:50:41) [GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final 335540)] on freebsd12 Type "help", "copyright", "credits" or "license" for more information. >>> from dask.distributed import Client >>> client = Client() Segmentation fault (core dumped) # gdb /usr/local/bin/python3.6 python3.6.core GNU gdb (GDB) 8.1 [GDB v8.1 for FreeBSD] Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "aarch64-portbld-freebsd12.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/local/bin/python3.6...(no debugging symbols found)...done. [New LWP 101213] Core was generated by `python'. Program terminated with signal SIGSEGV, Segmentation fault. #0 testcancel (curthread=0x3e8) at /usr/src/lib/libthr/thread/thr_cancel.c:144 144 { (gdb) bt #0 testcancel (curthread=0x3e8) at /usr/src/lib/libthr/thread/thr_cancel.c:144 #1 _thr_cancel_enter (curthread=0x3e8) at /usr/src/lib/libthr/thread/thr_cancel.c:146 #2 0x00000000402a5b54 in __thr_connect (fd=3, name=0xffffffffd310, namelen=106) at /usr/src/lib/libthr/thread/thr_syscalls.c:179 #3 0x000000004240e23c in uuid_generate_time () from /usr/local/lib/libuuid.so.1 #4 0x0000000042382068 in ffi_call_SYSV () from /lib/libffi.so.6 #5 0x00000000423822c8 in ffi_call () from /lib/libffi.so.6 #6 0x000000004234664c in _ctypes_callproc () from /usr/local/lib/python3.6/lib-dynload/_ctypes.so #7 0x00000000423403f0 in ?? () from /usr/local/lib/python3.6/lib-dynload/_ctypes.so #8 0x00000000422f5720 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) ---------- components: Build, Cross-Build, FreeBSD, ctypes messages: 327527 nosy: Alex.Willmer, koobs, stefanrink at yahoo.com priority: normal severity: normal status: open title: Segementation faults on ARM and ARM64 type: crash versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 11 09:49:09 2018 From: report at bugs.python.org (Xiao Di Guan) Date: Thu, 11 Oct 2018 13:49:09 +0000 Subject: [New-bugs-announce] [issue34958] urllib.error.HTTPError.fp is not closed when error is finalized on Windows Message-ID: <1539265749.67.0.788709270274.issue34958@psf.upfronthosting.co.za> New submission from Xiao Di Guan : Following changes introduced in bpo-15002, HTTPError closes its fp when GCed via tempfile._TemporaryFileCloser's finalizer. However, the current implementation of _TemporaryFileCloser only defines __del__ for non-NT platforms. Assuming HTTPError.fp is part of the API (though it's currently undocumented), and assuming the desired behaviour is to close fp when HTTPError is finalized, then perhaps _TemporaryFileCloser should always define __del__? A contrived example follows: ``` from urllib.error import HTTPError from urllib.request import urlopen def make_request(): try: urlopen('https://httpbin.org/status/418') assert False except HTTPError as err: assert err.code == 418 return err.fp fp = make_request() assert fp.isclosed() # Fails on Windows, passes on other platforms ``` ---------- components: Library (Lib) messages: 327532 nosy: puxlit priority: normal severity: normal status: open title: urllib.error.HTTPError.fp is not closed when error is finalized on Windows type: behavior versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 11 10:25:13 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Thu, 11 Oct 2018 14:25:13 +0000 Subject: [New-bugs-announce] [issue34959] Are the tests optional on travis? Message-ID: <1539267913.63.0.788709270274.issue34959@psf.upfronthosting.co.za> New submission from St?phane Wirtel : In the config of Travis, we can see there is a OPTIONAL=true env var for the tests at line 72: https://github.com/python/cpython/blob/master/.travis.yml#L72 If I read the doc, normally the tests can crash and this is not a problem? Is it right, because I am not an expert of Travis. Thank you, St?phane ---------- messages: 327533 nosy: matrixise priority: normal severity: normal status: open title: Are the tests optional on travis? _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 11 14:11:21 2018 From: report at bugs.python.org (Simon Wells) Date: Thu, 11 Oct 2018 18:11:21 +0000 Subject: [New-bugs-announce] [issue34960] python-config bad ldflags on macOS Message-ID: <1539281481.26.0.788709270274.issue34960@psf.upfronthosting.co.za> New submission from Simon Wells : if you didn't build python as a framework it adds sysconfig.get_config_vars('LINKFORSHARED') when you run 'python-config --ldflags' this resolves to >>> sysconfig.get_config_var('LINKFORSHARED') '-Wl,-stack_size,1000000 -framework CoreFoundation /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/Python' the '-Wl,-stack_size' ldflag causes issues for clang with the error "ld: -stack_size option can only be used when linking a main executable" ---------- components: macOS messages: 327545 nosy: ned.deily, ronaldoussoren, xzcvczx priority: normal severity: normal status: open title: python-config bad ldflags on macOS type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 11 15:15:04 2018 From: report at bugs.python.org (multun) Date: Thu, 11 Oct 2018 19:15:04 +0000 Subject: [New-bugs-announce] [issue34961] Global scoping when shadowing local names in class definitions Message-ID: <1539285304.26.0.788709270274.issue34961@psf.upfronthosting.co.za> New submission from multun : Hello, >>> a="global" >>> def func(a): ... class wtf(): ... a=a ... return wtf ... >>> func("local").a 'global' >>> def func2(a): ... class wtf(): ... b=a ... return wtf ... >>> func2("local").b 'local' Is this behavior legit ? Best regards, -- Victor "multun" Collod ---------- components: Interpreter Core files: weird_class_scope.py messages: 327547 nosy: multun priority: normal severity: normal status: open title: Global scoping when shadowing local names in class definitions type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47862/weird_class_scope.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 11 16:33:52 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Thu, 11 Oct 2018 20:33:52 +0000 Subject: [New-bugs-announce] [issue34962] make doctest does not pass :/ Message-ID: <1539290032.19.0.788709270274.issue34962@psf.upfronthosting.co.za> New submission from St?phane Wirtel : make -C Doc/ doctest does not pass the tests. ---------- messages: 327553 nosy: matrixise priority: normal severity: normal status: open title: make doctest does not pass :/ versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 11 23:03:15 2018 From: report at bugs.python.org (=?utf-8?q?Alexander_B=C3=B6hn?=) Date: Fri, 12 Oct 2018 03:03:15 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue34963=5D_String_representa?= =?utf-8?q?tion_for_types_created_with_typing=2ENewType=28=E2=80=A6=29_are?= =?utf-8?q?_opaque_and_unappealing?= Message-ID: <1539313395.67.0.788709270274.issue34963@psf.upfronthosting.co.za> New submission from Alexander B?hn : When creating a new type with `typing.NewType(?)` the result is a function defined on-the-fly with no reasonable `__repr__` definition ? the string representation of the type looks something like e.g. ?.new_type at 0x108ae6950>? which isn?t very useful or aesthetically appealing. ---------- components: Extension Modules messages: 327558 nosy: fish2000 priority: normal severity: normal status: open title: String representation for types created with typing.NewType(?) are opaque and unappealing type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 12 09:42:07 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 12 Oct 2018 13:42:07 +0000 Subject: [New-bugs-announce] [issue34964] Make Tkinter sources more readable by adding blank lines Message-ID: <1539351727.5.0.788709270274.issue34964@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : Tkinter sources are old and don't conform PEP 8. Usually we don't reformat existing sources for avoiding problems with backporting and breaking the history of lines. But I think that we can make some refinements in Tkinter sources. The tkinter module contains a lot of small methods (often just 1 or 2 lines of code), but with large multiline docstrings. Currently methods are not separated by blank lines. As result, the code of the method is visually closer to the header of the following method that to the header of its method. The proposed patch adds empty lines between methods and double empty lines between class (and removes few redundant empty lines). Most changes are made automatically: autopep8 --select E301,E303,E305 --in-place --recursive Lib/tkinter/ and edited after this (added missed empty lines and removed few unwanted changes). Since it affects only empty lines, it doesn't break the lines history. And I think this will not make backporting more difficult. ---------- components: Library (Lib), Tkinter messages: 327585 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Make Tkinter sources more readable by adding blank lines type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 12 10:20:59 2018 From: report at bugs.python.org (Srikanth) Date: Fri, 12 Oct 2018 14:20:59 +0000 Subject: [New-bugs-announce] [issue34965] Python on Docker container using flask is going down after sometime Message-ID: <1539354059.88.0.788709270274.issue34965@psf.upfronthosting.co.za> New submission from Srikanth : We are have created Python 3.5 image on docker container. All applications which are running on non-flask are working fine, but applications which are running on flask 0.12.2 are failing after prolonged usage of the application (Approx after 12 hours). Note: We have enabled heart beat check for python to make sure the container is up which hits every 10 seconds. After approx 12 hours, the application is stopping to respond to heart beat. Any expert suggestion plz. ---------- components: Tests messages: 327586 nosy: sri_spl priority: normal severity: normal status: open title: Python on Docker container using flask is going down after sometime type: crash versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 12 11:50:11 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Fri, 12 Oct 2018 15:50:11 +0000 Subject: [New-bugs-announce] [issue34966] Pydoc: better support of method aliases Message-ID: <1539359411.67.0.788709270274.issue34966@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : Pydoc supports aliases. If the alias is defined in the same class class A: def foo(self, x=42): pass bar = foo it will render the docstring only for the original function. For the alias it will output just "bar = foo(self, x=42)". But this doesn't work if the original function or alias are inherited. It often happened in the tkinter and turtle modules which have a hierarchy of classes, and aliases defined in parent classes. Compare for example the rendering for methods itemconfig and lift in help(tkinter.Listbox). The proposed PR makes pydoc detecting aliases for inherited methods. ---------- components: Library (Lib) messages: 327593 nosy: serhiy.storchaka, yselivanov priority: normal severity: normal status: open title: Pydoc: better support of method aliases type: behavior versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 12 13:06:16 2018 From: report at bugs.python.org (Julien Palard) Date: Fri, 12 Oct 2018 17:06:16 +0000 Subject: [New-bugs-announce] [issue34967] Sphinx is deprecating add_description_unit Message-ID: <1539363976.13.0.788709270274.issue34967@psf.upfronthosting.co.za> New submission from Julien Palard : When running `make -C Doc/ autobuild-dev-html` with a recent Sphinx, I'm getting: /.../site-packages/sphinx/application.py:927: RemovedInSphinx20Warning: app.add_description_unit() is now deprecated. Use app.add_object_type() instead. Looks easy to fix. ---------- assignee: docs at python components: Documentation keywords: easy messages: 327600 nosy: docs at python, mdk priority: normal severity: normal status: open title: Sphinx is deprecating add_description_unit versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 12 22:20:02 2018 From: report at bugs.python.org (Nathaniel Smith) Date: Sat, 13 Oct 2018 02:20:02 +0000 Subject: [New-bugs-announce] [issue34968] loop.call_soon_threadsafe should be documented to be re-entrant-safe too Message-ID: <1539397202.71.0.788709270274.issue34968@psf.upfronthosting.co.za> New submission from Nathaniel Smith : Asyncio needs a way to schedule work from other threads; and it also needs a way to scheduler work from code that can run at arbitrary times in the same thread, such as signal handlers or object finalizers ("reentrant contexts"). Currently loop.call_soon_threadsafe is documented to be the way to schedule work from other threads, but there is no documented way to schedule work from reentrant contexts. These are not quite the same thing, because reentrant contexts block the main thread while they're running. Generally, making code safe to call from __del__ or signal handlers is strictly harder than making it safe to call from other threads. (See bpo-14976 for an example of stdlib code being thread-safe but not reentrant-safe.) Technically speaking, this means that right now, if you need to call an asyncio API from a __del__ method, then the only officially supported way to do that is to write something like: def __del__(self): def actual_cleanup_code(): ... def thread_dispatcher(): loop.call_soon_threadsafe(actual_cleanup_code) thread = threading.Thread(target=thread_dispatcher) thread.start() But this is kind of silly. There should be some equivalent of loop.call_soon that *is* safe to call from reentrant contexts, so we could just write: def __del__(self): def actual_cleanup_code(): ... loop.call_soon_reentrant_safe(actual_cleanup_code) But... it doesn't really make sense to add a new method for this, since the desired semantics are strictly more powerful than the current loop.call_soon_threadsafe. Instead, we should tighten the guarantees on call_soon_threadsafe, by documenting that it's safe to use from reentrant contexts. Also, AFAICT the stdlib's implementation of call_soon_threadsafe is already reentrant-safe, so this wouldn't require any changes to stdlib code, only to the docs. But it would provide an additional formal guarantee that user-level code could take advantage of, and impose an additional constraint on developers of third-party loops. (I don't think the constraint is *too* onerous, fortunately. It's quite tricky to implement a version of call_soon that's thread-safe, reentrant-safe, *and* guarantees that the callback will eventually be invoked, even if call_soon races with loop shutdown. But in asyncio, all variants of call_soon are allowed to silently drop callbacks at loop shutdown, which makes this much easier.) ---------- components: asyncio messages: 327618 nosy: asvetlov, njs, yselivanov priority: normal severity: normal status: open title: loop.call_soon_threadsafe should be documented to be re-entrant-safe too versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 01:45:43 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Sat, 13 Oct 2018 05:45:43 +0000 Subject: [New-bugs-announce] [issue34969] Add --fast, --best to the gzip CLI Message-ID: <1539409543.55.0.788709270274.issue34969@psf.upfronthosting.co.za> New submission from St?phane Wirtel : the gzip module has a CLI but this one does not allow to specify the compression method (slow, fast) ---------- assignee: matrixise messages: 327626 nosy: matrixise priority: normal severity: normal status: open title: Add --fast, --best to the gzip CLI versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 04:11:44 2018 From: report at bugs.python.org (Andrew Svetlov) Date: Sat, 13 Oct 2018 08:11:44 +0000 Subject: [New-bugs-announce] [issue34970] Protect all_tasks manipulation in asyncio.all_tasks() Message-ID: <1539418304.75.0.788709270274.issue34970@psf.upfronthosting.co.za> New submission from Andrew Svetlov : Traceback (most recent call last): File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\threading.py", line 917, in _bootstrap_inner self.run() File "D:\Proj\antwork\code\antwork_backend\server\data_handlers\order\playback_hd.py", line 147, in run send_to_ws(channel=self.room_name, data=json.loads(msg)) File "D:\Proj\antwork\code\antwork_backend\server\data_exchange.py", line 26, in send_to_ws asyncio.run(channel_layer.group_send(channel, send_data)) File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\asyncio\runners.py", line 46, in run _cancel_all_tasks(loop) File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\asyncio\runners.py", line 54, in _cancel_all_tasks to_cancel = tasks.all_tasks(loop) File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\asyncio\tasks.py", line 38, in all_tasks return {t for t in _all_tasks File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\asyncio\tasks.py", line 38, in return {t for t in _all_tasks File "C:\Users\max\AppData\Local\Programs\Python\Python37\lib\_weakrefset.py", line 61, in __iter__ for itemref in self.data: RuntimeError: Set changed size during iteration https://github.com/python/cpython/commit/416c1ebd9896b394790dcb4f9f035b1a44ebe9ff#commitcomment-30887909 ---------- components: asyncio messages: 327632 nosy: asvetlov, ned.deily, yselivanov priority: release blocker severity: normal status: open title: Protect all_tasks manipulation in asyncio.all_tasks() versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 04:47:40 2018 From: report at bugs.python.org (=?utf-8?q?R=C3=A9mi_Cardona?=) Date: Sat, 13 Oct 2018 08:47:40 +0000 Subject: [New-bugs-announce] [issue34971] add support for tls/ssl sessions in asyncio Message-ID: <1539420460.92.0.788709270274.issue34971@psf.upfronthosting.co.za> New submission from R?mi Cardona : cpython has had TLS session support since 3.6, using the SSLContext.wrap_* methods. Unfortunately, this support is not available when using asyncio's create_connection. While I've managed to monkeypatch asyncio.sslproto._SSLPipe from my own code (it's a filthy hack but it's short and it gets the job done) running on 3.6.6, I feel this should be properly supported out of the box. A patch is ready (tests work), a github PR will be created shortly. Notes in no particular order: - argument and attribute naming is all over the place, but I could not decide between "sslsession" (matching "sslcontext") and "ssl_session" (matching "ssl_handshake_timeout") so I just picked one - tested on jessie (with openssl 1.0.2 from jessie-backports) and on gentoo - the new asyncio tests added in the patch are adapted from test_ssl.py's test_session, with the server-side stats left out. I felt they were not useful if one assumes that the hard work is done by SSLContext.wrap_*. - I did not reuse test_asyncio.utils.run_test_server which AIUI creates a new server-side context for each incoming connection, thus breaking sessions completely TIA for considering this bug and patch ---------- components: asyncio messages: 327638 nosy: RemiCardona, asvetlov, yselivanov priority: normal severity: normal status: open title: add support for tls/ssl sessions in asyncio type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 06:16:46 2018 From: report at bugs.python.org (My-Tien Nguyen) Date: Sat, 13 Oct 2018 10:16:46 +0000 Subject: [New-bugs-announce] [issue34972] json dump silently converts int keys to string Message-ID: <1539425806.36.0.788709270274.issue34972@psf.upfronthosting.co.za> Change by My-Tien Nguyen : ---------- nosy: My-Tien Nguyen priority: normal severity: normal status: open title: json dump silently converts int keys to string _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 09:37:47 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 13 Oct 2018 13:37:47 +0000 Subject: [New-bugs-announce] [issue34973] Crash in bytes constructor with mutating list Message-ID: <1539437867.82.0.788709270274.issue34973@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : Constructing bytes from mutating list can cause a crash. class X: def __index__(self): if len(a) < 1000: a.append(self) return 0 a = [X()] bytes(a) This is not an issue about weird integer-like objects. It is about . The size of the list can be changed in other thread while iterate it in the bytes constructor. The optimization for the case of the list argument was added in issue6688. The code was refactored several times since, but this flaw was always. ---------- assignee: serhiy.storchaka components: Interpreter Core messages: 327653 nosy: alexandre.vassalotti, serhiy.storchaka priority: normal severity: normal status: open title: Crash in bytes constructor with mutating list type: crash versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 15:18:56 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 13 Oct 2018 19:18:56 +0000 Subject: [New-bugs-announce] [issue34974] bytes and bytearray constructors replace unexpected exceptions Message-ID: <1539458336.75.0.788709270274.issue34974@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : bytes() and bytearray() replace some unexpected exceptions (including MemoryError and KeyboardInterrupt) with TypeError. 1) Exception in __index__. class X: def __index__(self): raise MemoryError `bytes(X())` results in: Traceback (most recent call last): File "", line 1, in TypeError: cannot convert 'X' object to bytes `bytearray(X())` results in: Traceback (most recent call last): File "", line 1, in TypeError: 'X' object is not iterable This is related to issue29159. 2) Exception in __iter__. class X: def __iter__(self): raise MemoryError `bytes(X())` results in: Traceback (most recent call last): File "", line 1, in TypeError: cannot convert 'X' object to bytes `bytearray(X())` works correctly (raises a MemoryError). The proper solution is to replace just a TypeError and allow other exceptions to emerge. ---------- assignee: serhiy.storchaka components: Interpreter Core messages: 327661 nosy: belopolsky, inada.naoki, serhiy.storchaka priority: normal severity: normal status: open title: bytes and bytearray constructors replace unexpected exceptions type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 16:03:13 2018 From: report at bugs.python.org (Ian Good) Date: Sat, 13 Oct 2018 20:03:13 +0000 Subject: [New-bugs-announce] [issue34975] start_tls() difficult when using asyncio.start_server() Message-ID: <1539460993.6.0.788709270274.issue34975@psf.upfronthosting.co.za> New submission from Ian Good : There does not seem to be a public API for replacing the transport of the StreamReader / StreamWriter provided to the callback of a call to asyncio.start_server(). The only way I have found to use the new SSL transport is to update protected members of the StreamReaderProtocol object, e.g.: async def callback(reader, writer): loop = asyncio.get_event_loop() transport = writer.transport protocol = transport.get_protocol() new_transport = await loop.start_tls( transport, protocol, ssl_context, server_side=True) protocol._stream_reader = StreamReader(loop=loop) protocol._client_connected_cb = do_stuff_after_start_tls protocol.connection_made(new_transport) async def do_stuff_after_start_tls(ssl_reader, ssl_writer): ... ---------- components: asyncio messages: 327665 nosy: asvetlov, icgood, yselivanov priority: normal severity: normal status: open title: start_tls() difficult when using asyncio.start_server() versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 17:02:19 2018 From: report at bugs.python.org (Tal Einat) Date: Sat, 13 Oct 2018 21:02:19 +0000 Subject: [New-bugs-announce] [issue34976] IDLE: Replace the search dialog with a search bar Message-ID: <1539464539.46.0.788709270274.issue34976@psf.upfronthosting.co.za> New submission from Tal Einat : Search dialogs are clunky and arguably outdated. Most modern editors, IDEs and browsers use a search bar instead. I created a search bar for IDLE as an extension years ago, it can be found on PyPI as "SearchBar". I hadn't updated it in recent years and it doesn't work with modern IDLE. I doubt that it has seen much use. I suggest that having this built into IDLE would be a great benefit to its users. ---------- assignee: terry.reedy components: IDLE messages: 327672 nosy: cheryl.sabella, taleinat, terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: Replace the search dialog with a search bar type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 18:43:47 2018 From: report at bugs.python.org (Steve Dower) Date: Sat, 13 Oct 2018 22:43:47 +0000 Subject: [New-bugs-announce] [issue34977] Release Windows Store app containing Python Message-ID: <1539470627.18.0.788709270274.issue34977@psf.upfronthosting.co.za> New submission from Steve Dower : The Windows Store can now install unrestricted apps, which means we can provide the Python interpreter in there. Advantages: * far more reliable installation * can have specific executables on PATH * automatic updates * other apps can act as extensions (with permission), so things like Mu could also become store apps in the future Disadvantages: * only --user installs for pip will work * harder to find/modify installed files I think for a (very significant) subset of our users, this will be a much better experience than downloading our current installer. It also has the advantage of making "Python" appear in searches in the start menu, which will link directly to a one-click "Install" button. The biggest issue is likely to be pip not installing with --user by default, as well as subsequent issues with apps that require users to navigate to their %AppData% directories manually (since these will be redirected to different locations). But until we get a package available for testing, it will be hard to figure out what needs fixing. Given this is just distribution and not a new platform, I plan to enable it for Python 3.7 (probably 3.7.2, but it may be possible to bundle 3.7.1 as-is for testing). ---------- assignee: steve.dower components: Windows messages: 327679 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Release Windows Store app containing Python type: enhancement versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 20:05:49 2018 From: report at bugs.python.org (Pranav Devarakonda) Date: Sun, 14 Oct 2018 00:05:49 +0000 Subject: [New-bugs-announce] [issue34978] check type of object in fix_dict.py in 2to3 Message-ID: <1539475549.65.0.788709270274.issue34978@psf.upfronthosting.co.za> New submission from Pranav Devarakonda : fix_dict.py applies fixes to every instance of keys(), items() or values() irrespective of the type of object. Since 2to3 cannot check the type of the object, we can at least add the check to the generated code like... d.keys() -> list(d.keys) if type(d) == dict else d.keys() and similarly d.viewkeys() -> d.keys() if type(d) == dict else d.viewkeys() PFA the tweaked fixer. ---------- components: 2to3 (2.x to 3.x conversion tool) files: fix_dict.py messages: 327682 nosy: benjamin.peterson, devarakondapranav priority: normal severity: normal status: open title: check type of object in fix_dict.py in 2to3 type: enhancement Added file: https://bugs.python.org/file47866/fix_dict.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 13 22:01:39 2018 From: report at bugs.python.org (Lu jaymin) Date: Sun, 14 Oct 2018 02:01:39 +0000 Subject: [New-bugs-announce] =?utf-8?q?=5Bissue34979=5D_Python_throws_?= =?utf-8?q?=E2=80=9CSyntaxError=3A_Non-UTF-8_code_start_with_=5Cxe8=2E=2E?= =?utf-8?q?=2E=E2=80=9D_when_parse_source_file?= Message-ID: <1539482499.11.0.788709270274.issue34979@psf.upfronthosting.co.za> New submission from Lu jaymin : ``` # demo.py s = '????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????' ``` The file on above is for testing, it's encoding is utf-8, the length of `s` is 1020 bytes(3 * 340). When execute `python3 demo.py` on terminal, Python will throws the following error: ``` $ python3 -V Python 3.6.4 $ python3 demo.py File "demo.py", line 2 SyntaxError: Non-UTF-8 code starting with '\xe8' in file demo.py on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details ``` I've found this error occurred on about line 630(the bottom of the function `decoding_fgets`) of the file `cpython/Parser/tokenizer.c` after I read Python-3.6.6's source code. When Python execute xxx.py, Python will call the function `decoding_fgets` to read one line of raw bytes from file and save the raw bytes to a buffer, the initial length of the buffer is 1024 bytes, `decoding_fgets` will use the function `valid_utf8` to check raw bytes's encoding. If the lenght of raw bytes is too long(like greater than 1023 bytes), then Python will call `decoding_fgets` multiple times and increase buffer's size by 1024 bytes every time.so raw bytes read by `decoding_fgets` is maybe incomplete, for example, raw bytes contains a part of bytes of a character, that will cause `valide_utf8` failed. I suggest that we should always use `fp_readl` to read source coe from file. ---------- components: Interpreter Core messages: 327686 nosy: Lu jaymin priority: normal severity: normal status: open title: Python throws ?SyntaxError: Non-UTF-8 code start with \xe8...? when parse source file type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 14 03:26:26 2018 From: report at bugs.python.org (Jeremy Kloth) Date: Sun, 14 Oct 2018 07:26:26 +0000 Subject: [New-bugs-announce] [issue34980] KillPython target doesn't detect 64-bit processes Message-ID: <1539501986.24.0.788709270274.issue34980@psf.upfronthosting.co.za> New submission from Jeremy Kloth : Since the KillPython target has been rewritten as an InlineTask, it can no longer detect 64-bit processes due to MSBuild being 32-bit. This leads to stuck buildbot runs: https://buildbot.python.org/all/#/builders/17/builds/348 A few solutions that I can think of: 1) Switch the InlineTask to an Exec using a PowerShell script to kill the processes. In my limited testing, PowerShell is installed by default on the supported OSes (Win7+). 2) When building for platform x64, modify find_msbuild.bat to locate the 64-bit MSBuild executable 3) On 64-bit OS, always use the 64-bit MSBuild executable 4) Only use the 64-bit MSBuild (when available) for the KillPython target (the 64-bit KillPython target can detect 32-bit processes) I am unsure of any issues that may arise from building with the 64-bit MSBuild toolchain. ---------- components: Build, Windows messages: 327694 nosy: jkloth, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: KillPython target doesn't detect 64-bit processes versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 14 07:32:57 2018 From: report at bugs.python.org (skycraper) Date: Sun, 14 Oct 2018 11:32:57 +0000 Subject: [New-bugs-announce] [issue34981] Unable to install Python from web-based installer and executable installer Message-ID: <1539516777.52.0.788709270274.issue34981@psf.upfronthosting.co.za> New submission from skycraper : I have a PC with 2 HDD with 2 Vista OS at each other. One system is old and it has Python 3.7 installed and working successfully. The second system is new-installed and it has a problems with running web-based installers and executable-installer of the latest Python`s version from there: https://www.python.org/downloads/windows/ So I can run an install from any MSI-package for every version, but 3.5-3.7 versions don`t have it. When I`m trying to install wb-inst or exe-inst nothing happens: no error window, no system lags etc. I suppose that this problem connected with Microsoft libraries or extensions. I installed all Visual Studio C++ packages, but it didn`t help. Could you tell me which components I forgot to intall. ---------- components: Installation messages: 327704 nosy: skycraper priority: normal severity: normal status: open title: Unable to install Python from web-based installer and executable installer type: crash versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 14 09:32:52 2018 From: report at bugs.python.org (purificant) Date: Sun, 14 Oct 2018 13:32:52 +0000 Subject: [New-bugs-announce] [issue34982] re.sub() different behavior in 3.7 Message-ID: <1539523972.89.0.788709270274.issue34982@psf.upfronthosting.co.za> New submission from purificant : A call to re.sub() returns different results in Python 3.7 compared to versions 3.6 / 3.5 and 2.7 Example behavior in 2.7 / 3.5 and 3.6: >>> re.sub(r'(([^/]*)(/.*)?)', r'\2.zip/\1/', 'example') 'example.zip/example/' Example in 3.7.0 and 3.7.1rc2: >>> re.sub(r'(([^/]*)(/.*)?)', r'\2.zip/\1/', 'example') 'example.zip/example/.zip//' As you can see the returned string is different for the same regex. re.subn() confirms that 2 replacements are made instead of 1. Is it intended to have different behaviour in 3.7+ or is this a bug? Thanks ---------- components: Regular Expressions messages: 327707 nosy: ezio.melotti, mrabarnett, purificant priority: normal severity: normal status: open title: re.sub() different behavior in 3.7 versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 14 12:24:56 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Sun, 14 Oct 2018 16:24:56 +0000 Subject: [New-bugs-announce] [issue34983] expose symtable.Symbol.is_nonlocal() Message-ID: <1539534296.44.0.788709270274.issue34983@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : The symtable has information about if a particular symbol is nonlocal though the DEF_LOCAL flag but this information is not exposed in symtable.py, making impossible to ask if a symbol is declared as nonlocal using the python symtable module. ---------- components: Interpreter Core messages: 327713 nosy: pablogsal priority: normal severity: normal status: open title: expose symtable.Symbol.is_nonlocal() type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 14 12:53:27 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 14 Oct 2018 16:53:27 +0000 Subject: [New-bugs-announce] [issue34984] Improve error messages in bytes and bytearray constructors Message-ID: <1539536007.23.0.788709270274.issue34984@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The proposed PR improves error messages in bytes and bytearray constructors. 1. When pass only encoding or errors to the bytes or bytearray constructor, it raises a TypeError with the message "encoding or errors without sequence argument". But the required argument is not a sequence, it is a string. "sequence argument" will be replaced with "a string argument". 2. Also "encoding or errors" will be replaced with just "encoding" or "errors", as in bytes(0, 'utf-8') and bytes(0, errors='utf-8'). 3. When pass an unsupported type to the bytearray constructor, it raises a TypeError with the message like "'float' object is not iterable". It will be replaced with "cannot convert 'float' object to bytearray" (similar to the message raised in the bytes constructor). 4. When pass an unsupported type to the bytearray's extend() method, it raises a TypeError with the message like "'float' object is not iterable". It will be replaced with "can't extend bytearray with float". ---------- assignee: serhiy.storchaka components: Interpreter Core messages: 327715 nosy: r.david.murray, serhiy.storchaka priority: normal severity: normal status: open title: Improve error messages in bytes and bytearray constructors type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 14 22:43:34 2018 From: report at bugs.python.org (Kal Sze) Date: Mon, 15 Oct 2018 02:43:34 +0000 Subject: [New-bugs-announce] [issue34985] python finds test modules from the wrong directory during PGO build Message-ID: <1539571414.02.0.788709270274.issue34985@psf.upfronthosting.co.za> New submission from Kal Sze : OS: Ubuntu Desktop 18.04.1 x86-64 Python 3.7.0 When trying to build Python 3.7 from source, with the `--enable-shared --enable-optimizations --with-lto` configure options, python needs to run the test suite in order to generate PGO data. However, it turns out that it would find test modules from the wrong directory, if there is already another version of Python 3 installed system-wide (Ubuntu 18.04 comes with Python 3.6 pre-installed). I found out because Ubuntu's automatic crash reporter caught a core dump during `python -m tests.regrtest` and I could see that python found the tests.regrtest module at `/usr/lib/python3.6/test/regrtest.py`. In the end, the build is reported as "successful", I guess it's because the Makefile expects it the crash anyway. In any case, it still seems wrong because it means the wrong test suite is run. I have uploaded Ubuntu's crash report in raw format here, for anybody who knows how to read it (it's in plain text anyway): https://www.dropbox.com/s/6ihxoouoqe1k98f/_usr_lib_python3.6_test_regrtest.py.1000.crash?dl=0 ---------- components: Build messages: 327725 nosy: Kal Sze2 priority: normal severity: normal status: open title: python finds test modules from the wrong directory during PGO build type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 14 23:05:18 2018 From: report at bugs.python.org (Kal Sze) Date: Mon, 15 Oct 2018 03:05:18 +0000 Subject: [New-bugs-announce] [issue34986] python finds test modules from the wrong directory during PGO build Message-ID: <1539572718.98.0.788709270274.issue34986@psf.upfronthosting.co.za> New submission from Kal Sze : OS: Ubuntu Desktop 18.04.1 x86-64 Python 3.7.0 When trying to build Python 3.7 from source, with the `--enable-shared --enable-optimizations --with-lto` configure options, python needs to run the test suite in order to generate PGO data. However, it turns out that it would find test modules from the wrong directory, if there is already another version of Python 3 installed system-wide (Ubuntu 18.04 comes with Python 3.6 pre-installed). I found out because Ubuntu's automatic crash reporter caught a core dump during `python -m tests.regrtest` and I could see that python found the tests.regrtest module at `/usr/lib/python3.6/test/regrtest.py`. In the end, the build is reported as "successful", I guess it's because the Makefile expects it the crash anyway. In any case, it still seems wrong because it means the wrong test suite is run. Ubuntu's crash report in raw format is attached, for anybody who knows how to read it (it's in plain text anyway) ---------- components: Build files: _usr_lib_python3.6_test_regrtest.py.1000.crash messages: 327726 nosy: Kal Sze2 priority: normal severity: normal status: open title: python finds test modules from the wrong directory during PGO build type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47868/_usr_lib_python3.6_test_regrtest.py.1000.crash _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 15 02:44:10 2018 From: report at bugs.python.org (Zackery Spytz) Date: Mon, 15 Oct 2018 06:44:10 +0000 Subject: [New-bugs-announce] [issue34987] A possible null pointer dereference in _pickle.c's save_reduce() Message-ID: <1539585850.77.0.788709270274.issue34987@psf.upfronthosting.co.za> New submission from Zackery Spytz : The get_class() call in save_reduce() is not checked for failure. ---------- components: Extension Modules messages: 327732 nosy: ZackerySpytz priority: normal severity: normal status: open title: A possible null pointer dereference in _pickle.c's save_reduce() type: crash versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 15 04:34:33 2018 From: report at bugs.python.org (Michael Felt) Date: Mon, 15 Oct 2018 08:34:33 +0000 Subject: [New-bugs-announce] [issue34988] Rc2 candidates: "gcc" not found on AIX Message-ID: <1539592473.09.0.788709270274.issue34988@psf.upfronthosting.co.za> New submission from Michael Felt : Both rc2 packages - $ ls -l *.xz -rw-r--r-- 1 aixtools staff 17178404 Oct 13 02:41 Python-3.6.7rc2.tar.xz -rw-r--r-- 1 aixtools staff 16974832 Oct 13 02:24 Python-3.7.1rc2.tar.xz return the same error on a system using gcc as default compiler - BUT xlc is installed. $ cc ksh: cc: not found. $ xlc /opt/IBM/xlc/13.1.3/bin/.orig/xlc: 1501-294 (S) No input file specified. Please use -qhelp for more information. $ xlc_r ksh: xlc_r: not found. $ gcc gcc: fatal error: no input files compilation terminated. $ ./configure checking build system type... powerpc-ibm-aix7.2.0.0 checking host system type... powerpc-ibm-aix7.2.0.0 checking for python3.7... no checking for python3... python3 checking for --enable-universalsdk... no checking for --with-universal-archs... no checking MACHDEP... checking for --without-gcc... checking for --with-icc... no checking for gcc... xlc_r checking whether the C compiler works... no configure: error: in `/home/aixtools/Python-3.7.1rc2': configure: error: C compiler cannot create executables See `config.log' for more details Bug being - it does check for gcc - which is in the PATH yet substitutes it for xlc_r which is not in the PATH. excerpt from ksh -x ./configure: aix7 + CONFIGURE_MACOSX_DEPLOYMENT_TARGET= + EXPORT_MACOSX_DEPLOYMENT_TARGET=# + print -r -- configure:3476: checking for --without-gcc + 1>& 5 + print -rn -- checking for --without-gcc... + 1>& 6 checking for --without-gcc... + test = set + CC=xlc_r + without_gcc= + print -r -- configure:3499: result: + 1>& 5 + print -r -- + 1>& 6 + print -r -- configure:3502: checking for --with-icc ---------- components: Build messages: 327736 nosy: Michael.Felt priority: normal severity: normal status: open title: Rc2 candidates: "gcc" not found on AIX type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 15 07:11:42 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 15 Oct 2018 11:11:42 +0000 Subject: [New-bugs-announce] [issue34989] python-gdb.py fails with TypeError("'FakeRepr' object is not subscriptable") is gdb fails to read debug symbols Message-ID: <1539601902.93.0.788709270274.issue34989@psf.upfronthosting.co.za> New submission from STINNER Victor : On Fedora 28, gdb fails to read (some?) debug symbols: "Dwarf Error: could not find partial DIE containing offset 0x316 [in module /usr/lib/debug/usr/bin/python3.6-3.6.6-1.fc28.x86_64.debug]" https://bugzilla.redhat.com/show_bug.cgi?id=1613614 In this case, the "py-bt" command of python-gdb.py fails with a TypeError: (gdb) py-bt Traceback (most recent call first): Python Exception 'FakeRepr' object is not subscriptable: Error occurred in Python command: 'FakeRepr' object is not subscriptable python-gdb.py shouldn't fail on such case, but handle the error. Attached PR fix this issue. ---------- components: Demos and Tools messages: 327742 nosy: vstinner priority: normal severity: normal status: open title: python-gdb.py fails with TypeError("'FakeRepr' object is not subscriptable") is gdb fails to read debug symbols versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 15 07:22:16 2018 From: report at bugs.python.org (Bernhard M. Wiedemann) Date: Mon, 15 Oct 2018 11:22:16 +0000 Subject: [New-bugs-announce] [issue34990] year 2038 problem in compileall.py Message-ID: <1539602536.3.0.788709270274.issue34990@psf.upfronthosting.co.za> New submission from Bernhard M. Wiedemann : To reproduce: touch -d 2038-01-20 /usr/lib/python3.6/site-packages/six.py python3 /usr/lib64/python3.6/compileall.py File "/usr/lib64/python3.6/compileall.py", line 198, in compile_path legacy=legacy, optimize=optimize) File "/usr/lib64/python3.6/compileall.py", line 90, in compile_dir legacy, optimize): File "/usr/lib64/python3.6/compileall.py", line 138, in compile_file mtime) struct.error: 'l' format requires -2147483648 <= number <= 2147483647 It could use either 64 bit int (requires new .pyc format with different magic number) or unsigned 32 bit int (gives us only another 68 years) ---------- components: Build messages: 327743 nosy: bmwiedemann priority: normal severity: normal status: open title: year 2038 problem in compileall.py type: compile error versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 15 08:27:42 2018 From: report at bugs.python.org (Alan) Date: Mon, 15 Oct 2018 12:27:42 +0000 Subject: [New-bugs-announce] [issue34991] variable type list [] referential integrity data loss Message-ID: <1539606462.61.0.788709270274.issue34991@psf.upfronthosting.co.za> New submission from Alan : Dear PythonDev, Thank you for your tremendous work in building a simpler programming language for all. As an avid user of lists, I am upset that my list cannot preserve its referential integrity in the attached pythonissue.txt file. In the following, (EXPECTED) includes my expected checkvisit data values, and the following two (OUTPUT)s include the actual checkvisit data structures when called. Perhaps this is not an issue in Python 3.8., but this is a matter in Python 3.6. Sincerely, Alan Jerry Pan, CPA alan.pan at sjtu.edu.cn alt. alan.pan at alumni.iu.edu (EXPECTED) Checkvisit (for every isGoal iteration): [[5, 3, 4, 2, 1, 0]] [[5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0]] [[5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0]] [[5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0]] [[5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0]] [[5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0]] [[5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0], [5, 3, 4, 2, 1, 0]] (OUTPUT) Checkvisit print result inside def(visitedPath): [] [] [] [] [] [[5]] [[5, 3]] [[5, 3, 4]] [[5, 3, 4, 2]] [[5, 3, 4, 2, 1]] [[5], [5]] [[5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] [[5], [5], [5]] [[5, 3], [5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] [[5], [5], [5], [5]] [[5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] [[5], [5], [5], [5], [5]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] [[5], [5], [5], [5], [5], [5]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] (OUTPUT)Checkvisit print result in while 0 loop [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [[5]] [[5]] [[5]] [[5]] [[5]] [[5, 3]] [[5, 3]] [[5, 3]] [[5, 3]] [[5, 3]] [[5, 3]] [[5, 3, 4]] [[5, 3, 4]] [[5, 3, 4]] [[5, 3, 4]] [[5, 3, 4, 2]] [[5, 3, 4, 2]] [[5, 3, 4, 2, 1]] [[5], [5]] [[5], [5]] [[5], [5]] [[5], [5]] [[5], [5]] [[5, 3], [5, 3]] [[5, 3], [5, 3]] [[5, 3], [5, 3]] [[5, 3], [5, 3]] [[5, 3], [5, 3]] [[5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] [[5], [5], [5]] [[5], [5], [5]] [[5], [5], [5]] [[5], [5], [5]] [[5], [5], [5]] [[5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] [[5], [5], [5], [5]] [[5], [5], [5], [5]] [[5], [5], [5], [5]] [[5], [5], [5], [5]] [[5], [5], [5], [5]] [[5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] [[5], [5], [5], [5], [5]] [[5], [5], [5], [5], [5]] [[5], [5], [5], [5], [5]] [[5], [5], [5], [5], [5]] [[5], [5], [5], [5], [5]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] [[5], [5], [5], [5], [5], [5]] [[5], [5], [5], [5], [5], [5]] [[5], [5], [5], [5], [5], [5]] [[5], [5], [5], [5], [5], [5]] [[5], [5], [5], [5], [5], [5]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3], [5, 3], [5, 3], [5, 3], [5, 3], [5, 3]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4], [5, 3, 4]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2], [5, 3, 4, 2]] [[5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1], [5, 3, 4, 2, 1]] ---------- components: IO, Interpreter Core files: pythonissue.txt messages: 327746 nosy: alan.pan priority: normal severity: normal status: open title: variable type list [] referential integrity data loss type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47870/pythonissue.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 15 09:23:54 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Mon, 15 Oct 2018 13:23:54 +0000 Subject: [New-bugs-announce] [issue34992] many warnings with f28 and gcc 8.1.1 Message-ID: <1539609834.54.0.788709270274.issue34992@psf.upfronthosting.co.za> New submission from St?phane Wirtel : I use Fedora 28 and gcc (GCC) 8.1.1 20180712 (Red Hat 8.1.1-5) and I get a lot of warnings, with the standard config of Python (./configure) Objects/call.c: In function '_PyMethodDef_RawFastCallDict': Objects/call.c:515:24: warning: cast between incompatible function types from 'PyCFunction' {aka 'struct _object * (*)(struct _object *, struct _object *)'} to 'PyObject * (*)(PyObject *, PyObject *, PyObject *)' {aka 'struct _object * (*)(struct _object *, struct _object *, struct _object *)'} [-Wcast-function-type] result = (*(PyCFunctionWithKeywords)meth) (self, argstuple, kwargs); ^ Objects/call.c:530:20: warning: cast between incompatible function types from 'PyCFunction' {aka 'struct _object * (*)(struct _object *, struct _object *)'} to 'PyObject * (*)(PyObject *, PyObject * const*, Py_ssize_t)' {aka 'struct _object * (*)(struct _object *, struct _object * const*, long int)'} [-Wcast-function-type] result = (*(_PyCFunctionFast)meth) (self, args, nargs); ^ Objects/call.c:538:49: warning: cast between incompatible function types from 'PyCFunction' {aka 'struct _object * (*)(struct _object *, struct _object *)'} to 'PyObject * (*)(PyObject *, PyObject * const*, Py_ssize_t, PyObject *)' {aka 'struct _object * (*)(struct _object *, struct _object * const*, long int, struct _object *)'} [-Wcast-function-type] _PyCFunctionFastWithKeywords fastmeth = (_PyCFunctionFastWithKeywords)meth; .... +- 827 warnings ---------- messages: 327752 nosy: matrixise priority: normal severity: normal status: open title: many warnings with f28 and gcc 8.1.1 versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 15 13:27:55 2018 From: report at bugs.python.org (xitop) Date: Mon, 15 Oct 2018 17:27:55 +0000 Subject: [New-bugs-announce] [issue34993] asyncio.streams.FlowControlMixin should be part of the API Message-ID: <1539624475.24.0.788709270274.issue34993@psf.upfronthosting.co.za> New submission from xitop : This issue report is based on a SO question "How to create asyncio stream reader/writer for stdin/stdout?", its answer and comments. Link: https://stackoverflow.com/q/52089869/5378816 The key point is that two unidirectional pipes should be used the same way as one bidirectional network socket. The answer (more precisely the Linux/Unix part of it) and some following comments - both created by highly competent SO members - suggest that FlowControlMixin is a useful class required to write a proper code for this and similar usecases. That's why the FlowControlMixin or an equivalent should be made available to asyncio programmers as a documented part of the library. ---------- components: asyncio messages: 327764 nosy: asvetlov, xitop, yselivanov priority: normal severity: normal status: open title: asyncio.streams.FlowControlMixin should be part of the API versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 15 16:10:06 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Mon, 15 Oct 2018 20:10:06 +0000 Subject: [New-bugs-announce] [issue34994] sysconfig returns the git commands for GITBRANCH, GITVERSION and GITTAG Message-ID: <1539634206.6.0.788709270274.issue34994@psf.upfronthosting.co.za> New submission from St?phane Wirtel : > ./configure --prefix=$PWD-build --with-pydebug --quiet > make -j 4 -s > git --git-dir ./.git rev-parse --short HEAD ee171a26c1 > ./python -m sysconfig | grep GIT GITBRANCH = "git --git-dir ./.git name-rev --name-only HEAD" GITTAG = "git --git-dir ./.git describe --all --always --dirty" GITVERSION = "git --git-dir ./.git rev-parse --short HEAD" Normally, I should get the real values in these variables and not the git commands. I don't understand why there are the git commands, I don't want to execute the commands, just get the git information. The result should be GITBRANCH = "master" GITTAG = "heads/master" GITVERSION = "ee171a26c1" I think there is an issue. Is it right? ---------- messages: 327779 nosy: matrixise priority: normal severity: normal status: open title: sysconfig returns the git commands for GITBRANCH, GITVERSION and GITTAG versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 15 19:30:29 2018 From: report at bugs.python.org (Matt Wilber) Date: Mon, 15 Oct 2018 23:30:29 +0000 Subject: [New-bugs-announce] [issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__ Message-ID: <1539646229.14.0.788709270274.issue34995@psf.upfronthosting.co.za> Change by Matt Wilber : ---------- components: Library (Lib) nosy: mwilbz priority: normal severity: normal status: open title: functools.cached_property does not maintain the wrapped method's __isabstractmethod__ versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 05:47:56 2018 From: report at bugs.python.org (Raz Manor) Date: Tue, 16 Oct 2018 09:47:56 +0000 Subject: [New-bugs-announce] [issue34996] Add name to process and thread pool Message-ID: <1539683276.05.0.788709270274.issue34996@psf.upfronthosting.co.za> Change by Raz Manor : ---------- components: Library (Lib) nosy: Raz Manor priority: normal severity: normal status: open title: Add name to process and thread pool type: enhancement versions: Python 2.7, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 09:09:35 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Tue, 16 Oct 2018 13:09:35 +0000 Subject: [New-bugs-announce] [issue34997] test.test_logging.ConfigDictTest.test_out_of_order fails in x86 Gentoo Refleaks 3.x Message-ID: <1539695375.29.0.788709270274.issue34997@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : When running the test_logging with the huntleaks option (-R), test_out_of_order fails: ====================================================================== FAIL: test_out_of_order (test.test_logging.ConfigDictTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.refleak/build/Lib/test/test_logging.py", line 3278, in test_out_of_order self.assertRaises(ValueError, self.apply_config, self.out_of_order) AssertionError: ValueError not raised by apply_config ---------------------------------------------------------------------- https://buildbot.python.org/all/#/builders/1/builds/377/steps/4/logs/stdio ---------- assignee: pablogsal components: Tests messages: 327825 nosy: pablogsal priority: normal severity: normal status: open title: test.test_logging.ConfigDictTest.test_out_of_order fails in x86 Gentoo Refleaks 3.x type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 10:56:59 2018 From: report at bugs.python.org (P.C. Kroon) Date: Tue, 16 Oct 2018 14:56:59 +0000 Subject: [New-bugs-announce] [issue34998] Logging formatter validation breaks backward ducktyping Message-ID: <1539701819.12.0.788709270274.issue34998@psf.upfronthosting.co.za> New submission from P.C. Kroon : Hi all! This concerns commit 18fb1fb943b7dbd7f8a76017ee2a67ef13effb85 (also known as bpo-34844 or GH-9703). For testing purposes I made something that transparently ducktypes being a string, except that it counts how often its `format` and `__mod__` methods are called. The validation mechanic now tries to pass my object to `self.validation_pattern.search` (line 441), which (of course) doesn't work. Due to backwards compatability I can't pass a validate keyword. To resolve this, I'd like the default `validate` option to be set to `False` instead of `True`. If the judgement is that I'm doing really weird things and should make an actual string subclass I'll also accept that and/or find an alternative solution. Cheers, Peter ---------- messages: 327837 nosy: P.C. Kroon priority: normal severity: normal status: open title: Logging formatter validation breaks backward ducktyping type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 11:39:27 2018 From: report at bugs.python.org (sebix) Date: Tue, 16 Oct 2018 15:39:27 +0000 Subject: [New-bugs-announce] [issue34999] Different behavior of copied loggers in 3.7 Message-ID: <1539704367.04.0.788709270274.issue34999@psf.upfronthosting.co.za> New submission from sebix : For the unittests of project I mock the function returning the logger. The code to tests can re-initialize the logger because of updated configuration (It's a deamon), so it needs to do that correctly and I test if it works. By mocking the function returning I can always control the loggers's and parameters and always return a copy of the same logger. This worked until 3.6 but does no longer work in 3.7 (I tested 3.7.1rc2). Why do I copy it? Because if the tested program sets (for example) a different log level, that would affect my "master copy". I created a minimal example splitted into two files, the code to test and the test itself. The tested code: ------ def log(log_level): pass class Bot(object): def __init__(self): self.logger = None self.__init_logger(logging_level='INFO') self.logger.info('Initialized') self.logger.handlers = [] # remove all existing handlers self.__init_logger(logging_level='DEBUG') self.logger.debug('test') self.logger.info("Bot stopped.") def __init_logger(self, logging_level): self.logger = log(log_level=logging_level) ----- And the test: ----- import copy import io import logging import unittest.mock as mock from intelmq.bot import Bot bot_id = 'test-bot' log_stream = io.StringIO() logger = logging.getLogger(bot_id) logger.setLevel("INFO") console_formatter = logging.Formatter('%(levelname)s - %(message)s') console_handler = logging.StreamHandler(log_stream) console_handler.setFormatter(console_formatter) logger.addHandler(console_handler) def mocked_log(log_level): # Return a copy as the bot may modify the logger and we should always return the intial logger logger_new = copy.copy(logger) logger_new.setLevel(log_level) return logger_new with mock.patch('intelmq.bot.log', mocked_log): bot = Bot() loglines_buffer = log_stream.getvalue() loglines = loglines_buffer.splitlines() print(loglines_buffer) print("INFO - Initialized" in loglines[0]) print('DEBUG - test' in loglines_buffer) print("INFO - Bot stopped." in loglines[-1]) ----- Adapt the import of the "Bot" if you try to run it. In Python 3.4-3.6 it gives: ----- INFO - Initialized DEBUG - test INFO - Bot stopped. True True True ----- And in Python 3.7: ------- INFO - Initialized True False False ------- The minimal code is also here: https://github.com/wagner-certat/intelmq/tree/minimal-1269 ---------- components: Library (Lib) messages: 327838 nosy: sebix priority: normal severity: normal status: open title: Different behavior of copied loggers in 3.7 versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 11:49:11 2018 From: report at bugs.python.org (John Andersen) Date: Tue, 16 Oct 2018 15:49:11 +0000 Subject: [New-bugs-announce] [issue35000] aexit called after loop close Message-ID: <1539704951.84.0.788709270274.issue35000@psf.upfronthosting.co.za> New submission from John Andersen : aexit called after loop close on death by signal. This seems odd, the __aexit__ method must be running in a loop because it is an async function. However if one calls shield then it dies. ''' $ python3.7 test.py Hello! # Ctrl-C before 5 seconds is up $ python3.7 test.py ^CException ignored in: Traceback (most recent call last): File "test.py", line 18, in func await asyncio.sleep(5) File "test.py", line 14, in __aexit__ await asyncio.shield(self.other()) File "/usr/lib/python3.7/asyncio/tasks.py", line 765, in shield inner = ensure_future(arg, loop=loop) File "/usr/lib/python3.7/asyncio/tasks.py", line 577, in ensure_future task = loop.create_task(coro_or_future) File "/usr/lib/python3.7/asyncio/base_events.py", line 384, in create_task self._check_closed() File "/usr/lib/python3.7/asyncio/base_events.py", line 461, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed sys:1: RuntimeWarning: coroutine 'Test.other' was never awaited ''' import os import signal import asyncio class Test(object): async def other(self): print('Hello!') async def __aenter__(self): pass async def __aexit__(self, a, b, c): await asyncio.shield(self.other()) async def func(): async with Test(): await asyncio.sleep(5) def main(): loop = asyncio.get_event_loop() try: loop.run_until_complete(func()) except KeyboardInterrupt: pass loop.run_until_complete(loop.shutdown_asyncgens()) loop.close() if __name__ == '__main__': main() ---------- components: asyncio messages: 327839 nosy: asvetlov, pdxjohnny, yselivanov priority: normal severity: normal status: open title: aexit called after loop close versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 14:39:56 2018 From: report at bugs.python.org (thautwarm) Date: Tue, 16 Oct 2018 18:39:56 +0000 Subject: [New-bugs-announce] [issue35001] ImportFrom level cannot be optional Message-ID: <1539715196.88.0.788709270274.issue35001@psf.upfronthosting.co.za> New submission from thautwarm : This issue is found from a type hinting problem: ``` class ImportFrom(stmt): class ImportFrom(stmt): module = ... # type: Optional[_identifier] module = ... # type: Optional[_identifier] names = ... # type: typing.List[alias] names = ... # type: typing.List[alias] level = ... # type: Optional[int] ``` As we can see that `level` here is optional, and it's strange. I tried `ast.parse` on both Python 3.5/3.6, and found that None of `from a import *`, `from .a import *`, `from ..a import *` and other regular cases result into an ImportFrom AST whose `level` is None. Then I went to Python-asdl: https://github.com/python/cpython/blob/137b0632dccb992ca11e9445142fb33a29c33a51/Parser/Python.asdl#L44 and got ImportFrom(identifier? module, alias* names, int? level) It seems like a bug. To validate it, I went to https://github.com/python/cpython/blob/97cf0828727ac2a269c89c5aa09570a69a22c83c/Python/ast.c#L3311 and got static stmt_ty ast_for_import_stmt(struct compiling *c, const node *n){ int idx, ndots = 0; ... return ImportFrom(modname, aliases, ndots, lineno, col_offset, c->c_arena); ... } It seems that no reason for `level` being None. If it's really a bug, IMO it could be also an example that type hinting helps to error detection :-) ---------- assignee: docs at python components: Documentation messages: 327840 nosy: docs at python, thautwarm priority: normal severity: normal status: open title: ImportFrom level cannot be optional type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 16:23:37 2018 From: report at bugs.python.org (Luna Chen) Date: Tue, 16 Oct 2018 20:23:37 +0000 Subject: [New-bugs-announce] [issue35002] Potential bug in ConfigParser.read() in python3.6, before os.Pathlike was introduced Message-ID: <1539721417.19.0.788709270274.issue35002@psf.upfronthosting.co.za> New submission from Luna Chen : In `configparser.ConfigParser.read()`, it allows us to pass in either a single filepath or a list of filepath. As python3 supports pathlib Path. We can potentially pass in a `PosixPath` to `configparser.ConfigParser.read()`, especially when passing in a list of `PosixPath` is allowed. However, passing in a single `PosixPath` causes it to raise an exception: File "/Users/bnmetrics/workspace/cpython/Lib/configparser.py", line 694, in read for filename in filenames: TypeError: 'PosixPath' object is not iterable This issue had been addressed with later version of python by checking if the filepath passed in is an instance of `os.Pathlike`. I thought it would be nice if we can pass in a single PosixPath object to `configparser.ConfigParser.read()`. ---------- messages: 327842 nosy: BNMetrics, gvanrossum, vinay.sajip priority: normal severity: normal status: open title: Potential bug in ConfigParser.read() in python3.6, before os.Pathlike was introduced type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 18:12:12 2018 From: report at bugs.python.org (Brett Cannon) Date: Tue, 16 Oct 2018 22:12:12 +0000 Subject: [New-bugs-announce] [issue35003] Provide an option to venv to put files in a bin/ directory on Windows Message-ID: <1539727932.79.0.788709270274.issue35003@psf.upfronthosting.co.za> New submission from Brett Cannon : Having venv install files into Scripts/ on Windows but into bin/ on UNIX is troublesome for anything that tries to be cross-platform regarding virtual environments. Having a way to create a virtual environment on Windows where bin/ is used over Scripts/ would be handy. ---------- components: Library (Lib) messages: 327845 nosy: brett.cannon priority: normal severity: normal stage: test needed status: open title: Provide an option to venv to put files in a bin/ directory on Windows type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 18:31:03 2018 From: report at bugs.python.org (Beau Gunderson) Date: Tue, 16 Oct 2018 22:31:03 +0000 Subject: [New-bugs-announce] [issue35004] Odd behavior when using datetime.timedelta under cProfile Message-ID: <1539729063.07.0.788709270274.issue35004@psf.upfronthosting.co.za> New submission from Beau Gunderson : In chasing down a bug in my code that only manifests itself when running under cProfile I managed to find the culprit in datetime.timedelta by way of dateutil. Here is a small repro: https://gist.github.com/beaugunderson/68ea6424a4fdcf763ccad08e42a74974 I believe an exception should still be raised in broken() when run under cProfile, but for some reason it is not. ---------- messages: 327846 nosy: beaugunderson priority: normal severity: normal status: open title: Odd behavior when using datetime.timedelta under cProfile versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 19:59:54 2018 From: report at bugs.python.org (Robert Benson) Date: Tue, 16 Oct 2018 23:59:54 +0000 Subject: [New-bugs-announce] [issue35005] argparse should accept json and yaml argument types Message-ID: <1539734394.94.0.788709270274.issue35005@psf.upfronthosting.co.za> Change by Robert Benson : ---------- components: Library (Lib) nosy: derelbenkoenig priority: normal severity: normal status: open title: argparse should accept json and yaml argument types type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 16 20:38:14 2018 From: report at bugs.python.org (Vaibhav Karve) Date: Wed, 17 Oct 2018 00:38:14 +0000 Subject: [New-bugs-announce] [issue35006] itertools.combinations has wrong type when using the typing package Message-ID: <1539736694.32.0.788709270274.issue35006@psf.upfronthosting.co.za> New submission from Vaibhav Karve : If I run mypy on the following file called test.py, I get an error: # test.py from typing import Iterator, Tuple import itertools as it a : Iterator[Tuple[int, ...]] a = it.product([1,2,3], repeat = 2) b : Iterator[Tuple[int, ...]] b = it.combinations([1,2,3], 2) The line about a goes through without complain. But mypy complains about b by printing the following error message-- test.py:8: error: Incompatible types in assignment (expression has type "Iterable[Tuple[int, ...]]", variable has type "Iterator[Tuple[int, ...]]") test.py:8: note: 'Iterable' is missing following 'Iterator' protocol member: test.py:8: note: __next__ So basically, it.product is an Iterator but it.combinations is an Iterable (I think it should be an iterator too). I think (without a lot of evidence) that this is a bug in itertools and not in typing. PS: I apologize if my comment is not formatted according to best practices. This is my first time registering a new issue. ---------- components: Demos and Tools messages: 327849 nosy: vaibhavkarve priority: normal severity: normal status: open title: itertools.combinations has wrong type when using the typing package type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 17 01:48:33 2018 From: report at bugs.python.org (Frank Millman) Date: Wed, 17 Oct 2018 05:48:33 +0000 Subject: [New-bugs-announce] [issue35007] Minor change to weakref docs Message-ID: <1539755313.9.0.788709270274.issue35007@psf.upfronthosting.co.za> New submission from Frank Millman : weakref.WeakKeyDictionary.keyrefs() - The documentation says 'Return an iterable of the weak references to the keys'. I was not sure if this would expose me to the 'dictionary changed size while iterating' error, so I checked the source. The source shows that it returns a list, and the docstring says 'Return a list of weak references to the keys'. I suggest that the documentation be changed to match the docstring. The same applies to valuerefs(). ---------- assignee: docs at python components: Documentation messages: 327863 nosy: docs at python, frankmillman priority: normal severity: normal status: open title: Minor change to weakref docs type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 17 04:46:01 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Wed, 17 Oct 2018 08:46:01 +0000 Subject: [New-bugs-announce] [issue35008] Leaks xml.etree.ElementTree.Element.__setsate__() Message-ID: <1539765961.94.0.788709270274.issue35008@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : When call the __setstate__() method of xml.etree.ElementTree.Element in the C implementation for already initialized element it leaks old children. ---------- assignee: serhiy.storchaka components: Extension Modules messages: 327873 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Leaks xml.etree.ElementTree.Element.__setsate__() type: resource usage versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 17 05:17:56 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Wed, 17 Oct 2018 09:17:56 +0000 Subject: [New-bugs-announce] [issue35009] argparse throws UnicodeEncodeError for printing help with unicode choices Message-ID: <1539767876.78.0.788709270274.issue35009@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : argparse module uses str() in a few places where passing unicode strings will throw UnicodeDecodeError. In Python 3 these scripts run fine since Python 3 has unicode strings by default. I am working on this along with finding more places where this can throw error along with adding relevant tests for those scenarios. I couldn't find any related issues for this in the bug tracker. Feel free to close this if it's a duplicate. # foo_argparse.py with unicode choices ``` # -*- coding: utf-8 -*- import argparse parser = argparse.ArgumentParser() parser.add_argument('--foo', help='foo help', choices=[u"???", u"??? ???"]) args = parser.parse_args() ``` # printing help causes error since str is used for choices $ ./python.exe ../backups/foo_argparse.py --help Traceback (most recent call last): File "../backups/foo_argparse.py", line 5, in parser.add_argument('--foo', help='foo help', choices=[u"???", u"??? ???"]) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/argparse.py", line 1308, in add_argument self._get_formatter()._format_args(action, None) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/argparse.py", line 578, in _format_args get_metavar = self._metavar_formatter(action, default_metavar) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/argparse.py", line 565, in _metavar_formatter choice_strs = [str(choice) for choice in action.choices] UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128) In case we use unicode() for the above and then also fix the place where comparison is done then using the correct choice passes. But using wrong choice throws an error where exception string is formed using str that causes error $ ./python.exe ../backups/foo_argparse_unicode.py --foo ??? # passes $ ./python.exe ../backups/foo_argparse_unicode.py --help # passes usage: foo_argparse_unicode.py [-h] [--foo {???,??? ???}] optional arguments: -h, --help show this help message and exit --foo {???,??? ???} foo help $ ./python.exe ../backups/foo_argparse_unicode.py --foo 1 # Fails Traceback (most recent call last): File "../backups/foo_argparse_unicode.py", line 7, in args = parser.parse_args() File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/argparse.py", line 1705, in parse_args args, argv = self.parse_known_args(args, namespace) File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/argparse.py", line 1744, in parse_known_args self.error(str(err)) UnicodeEncodeError: 'ascii' codec can't encode characters in position 49-51: ordinal not in range(128) ---------- components: Library (Lib) messages: 327879 nosy: xtreak priority: normal severity: normal status: open title: argparse throws UnicodeEncodeError for printing help with unicode choices type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 17 06:10:40 2018 From: report at bugs.python.org (Cyker Way) Date: Wed, 17 Oct 2018 10:10:40 +0000 Subject: [New-bugs-announce] [issue35010] sort by partially reversed key tuple Message-ID: <1539771040.54.0.788709270274.issue35010@psf.upfronthosting.co.za> New submission from Cyker Way : The current `sorted` function is somewhat limited and doesn't cover a use case that frequently occurs in real applications: sort by a tuple of keys where each key can be in asc or desc order. For example, you may have a list of site configs where each of specify which user on which site gets how much quota. This data may be loaded from a SQL table where there are 3 columns: url, user, quota. Often you may want to sort by url, but when you want to check which users have been allocated most quota, you probably want to sort by quota. Even more likely, when you are sorting by quota, you still want to sort by url for those having the same quota. Unfortunately, current `sorted` function doesn't allow you to sort by desc quota and asc url at the same time, because the `reverse` parameter acts on the final result, regardless of columns. For numeric columns, there is a trick of using minus sign on the data. But this approach usually doesn't apply to other types of data. The general solution is to enhance the key function, allowing users to specify each column to be considered, with an asc/desc flag: keyspec = [ (itemgetter('url'), False), (itemgetter('user'), True), ] An example is worth 1k words. The full example is provided in the attachment. It's not a lot of code to write but making this feature builtin can save a lot of work since sorting a SQL table or other sheet data is quite common in real applications. ---------- components: Library (Lib) files: c.py messages: 327886 nosy: cykerway priority: normal severity: normal status: open title: sort by partially reversed key tuple type: enhancement versions: Python 3.8 Added file: https://bugs.python.org/file47873/c.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 17 20:26:15 2018 From: report at bugs.python.org (Gregory P. Smith) Date: Thu, 18 Oct 2018 00:26:15 +0000 Subject: [New-bugs-announce] [issue35011] Update to expat removed the pyexpatns.h, causing link time symbol conflicts vs other versions in an application Message-ID: <1539822375.56.0.788709270274.issue35011@psf.upfronthosting.co.za> New submission from Gregory P. Smith : These lines used to exist in Modules/expat/expat_external.h: /* Namespace external symbols to allow multiple libexpat version to co-exist. */ #include "pyexpatns.h" https://github.com/python/cpython/commit/5dc3f23b5fb0b510926012cb3732dae63cddea60#diff-3afaf7274c90ce1b7405f75ad825f545 removed them during an expat upgrade. This causes link time conflicts when embedding Python using its own expat in an application that also uses libexpat from the C/C++ side on its own. ---------- messages: 327919 nosy: gregory.p.smith priority: normal severity: normal status: open title: Update to expat removed the pyexpatns.h, causing link time symbol conflicts vs other versions in an application versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 02:47:25 2018 From: report at bugs.python.org (STINNER Victor) Date: Thu, 18 Oct 2018 06:47:25 +0000 Subject: [New-bugs-announce] [issue35012] [3.7] test_multiprocessing_spawn hangs randomly on AppVeyor Message-ID: <1539845245.85.0.788709270274.issue35012@psf.upfronthosting.co.za> New submission from STINNER Victor : On AppVeyor CI, test_multiprocessing_spawn was running for longer than 50 min, whereas usually it only takes around 2 minutes https://ci.appveyor.com/project/python/cpython/builds/19594644 ... running: test_multiprocessing_spawn (50 min 33 sec) running: test_multiprocessing_spawn (51 min 3 sec) Related PR: https://github.com/python/cpython/pull/9936 ---------- messages: 327936 nosy: vstinner priority: normal severity: normal status: open title: [3.7] test_multiprocessing_spawn hangs randomly on AppVeyor versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 02:56:21 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 18 Oct 2018 06:56:21 +0000 Subject: [New-bugs-announce] [issue35013] Add more type checks for children of xml.etree.ElementTree.Element Message-ID: <1539845781.97.0.788709270274.issue35013@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : Currently some methods for xml.etree.ElementTree.Element check the type subelements: append(), extend(), insert(). But there are other ways to add non-Element children: __setitem__(), __setstate__(), __deepcopy__(). This could cause crashes later in the C code and required to add numerous type checks for iterating and searching. Since the intention was to prevent adding non-Element children, it is better to check the type every time when add new children. ---------- assignee: serhiy.storchaka components: Library (Lib), XML messages: 327939 nosy: eli.bendersky, scoder, serhiy.storchaka priority: normal severity: normal status: open title: Add more type checks for children of xml.etree.ElementTree.Element type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 04:50:17 2018 From: report at bugs.python.org (=?utf-8?b?UsOpbXkgSHVic2NoZXIgWzpuYXRpbV0=?=) Date: Thu, 18 Oct 2018 08:50:17 +0000 Subject: [New-bugs-announce] [issue35014] asyncio subprocess accepts string as parameter which lead to UnicodeEncodeError Message-ID: <1539852617.86.0.788709270274.issue35014@psf.upfronthosting.co.za> New submission from R?my Hubscher [:natim] : Asyncio.create_subprocess_exec accepts a list of str as parameter which lead to UnicodeEncodeError I think it should accept only bytes shouldn't it? ---------- components: asyncio messages: 327945 nosy: asvetlov, natim, yselivanov priority: normal severity: normal status: open title: asyncio subprocess accepts string as parameter which lead to UnicodeEncodeError versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 04:50:28 2018 From: report at bugs.python.org (Julien Palard) Date: Thu, 18 Oct 2018 08:50:28 +0000 Subject: [New-bugs-announce] [issue35015] availability directive breaks po files Message-ID: <1539852628.85.0.788709270274.issue35015@psf.upfronthosting.co.za> New submission from Julien Palard : The new availability directive introduced in 2d6097d027e0dd3debbabc702aa9c98d94ba32a3 (https://bugs.python.org/issue11233) breaks po files (sphinx-build -b gettext): Here's the diff I'm getting on os.po from os.rst: msgid "" -"Availability: Unix, Windows. :func:`spawnlp`, :func:`spawnlpe`, :func:" -"`spawnvp` and :func:`spawnvpe` are not available on Windows. :func:" -"`spawnle` and :func:`spawnve` are not thread-safe on Windows; we advise you " -"to use the :mod:`subprocess` module instead." +"Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and " +"spawnvpe() are not available on Windows. spawnle() and spawnve() are not " +"thread-safe on Windows; we advise you to use the subprocess module instead." The roles has been removed in the po files (but not in the original rst files), so it looks like the availability directive caused the drop of roles, but I still don't understand why. ---------- assignee: docs at python components: Documentation messages: 327946 nosy: docs at python, georg.brandl, mdk priority: normal severity: normal status: open title: availability directive breaks po files versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 05:38:34 2018 From: report at bugs.python.org (Ivan Krivosheev) Date: Thu, 18 Oct 2018 09:38:34 +0000 Subject: [New-bugs-announce] [issue35016] \r to match add into address header with not-ascii character Message-ID: <1539855514.48.0.788709270274.issue35016@psf.upfronthosting.co.za> New submission from Ivan Krivosheev : When convert email.message.Message to bytes, into header with non-ascii character in address add to match *\r* symbol. Simple script for reproduce problem: >>> from email.message import Message >>> from email.policy import SMTP >>> msg = Message(policy=SMTP) >>> msg['To'] = '???? ???? ' >>> print(msg.as_bytes()) On python 3.5 result: >>> b'To: =?utf-8?b?0K7Qt9C10YAg0J7QtNC40L0=?= \r\n\r\n' On python 3.6, python 3.7: >>> b'To:\r\n =?utf-8?b?0K7Qt9C10YAg0J7QtNC40L0=?= \r\r\r\r\r\n\r\n' ---------- components: email files: email1.py messages: 327950 nosy: barry, ikrivosheev, r.david.murray priority: normal severity: normal status: open title: \r to match add into address header with not-ascii character type: behavior versions: Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47878/email1.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 07:55:13 2018 From: report at bugs.python.org (Denis Ledoux) Date: Thu, 18 Oct 2018 11:55:13 +0000 Subject: [New-bugs-announce] [issue35017] socketserver accept a last request after shutdown Message-ID: <1539863713.13.0.788709270274.issue35017@psf.upfronthosting.co.za> New submission from Denis Ledoux : After the shutdown of a `BaseServer`, the server may accept a last single request if it is sent between the server socket polling and the polling timeout. This can be problematic for instance for a server restart for which you do not want to interrupt the service, by not closing the listening socket during the restart. One request can fail because of this behavior. Note that only one request will fail, following requests will not be accepted, as expected. ---------- components: Library (Lib) messages: 327969 nosy: beledouxdenis priority: normal severity: normal status: open title: socketserver accept a last request after shutdown type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 12:22:21 2018 From: report at bugs.python.org (Jonathan Gossage) Date: Thu, 18 Oct 2018 16:22:21 +0000 Subject: [New-bugs-announce] [issue35018] Sax parser provides no user access to lexical handlers Message-ID: <1539879741.38.0.788709270274.issue35018@psf.upfronthosting.co.za> New submission from Jonathan Gossage : While working on issues bpo-6686 and bpo-9371 I realized that the solution to both involved the use of Sax lexical handlers. Unfortunately, the Python SAX parser does not expose these handlers to the end user, however, support is available in expatreader.py and pyexpat.c. What is missing is the LexicalHandler class which works the same way as the ContentHandler does for the more common handlers and provides a subclassable interface for these handlers. This class is present in the Java implementation of SAX2 and was also present in Pyxml. I have already verified privately that this class works exactly as expected and I am working on a PR which will provide the class along with supporting unit tests that verify that the lexical handlers work. ---------- messages: 327982 nosy: Jonathan.Gossage, taleinat priority: normal severity: normal status: open title: Sax parser provides no user access to lexical handlers type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 12:28:24 2018 From: report at bugs.python.org (Ken Bassford) Date: Thu, 18 Oct 2018 16:28:24 +0000 Subject: [New-bugs-announce] [issue35019] Minor Bug found in asyncio - Python 3.5.3 Message-ID: <1539880104.22.0.788709270274.issue35019@psf.upfronthosting.co.za> New submission from Ken Bassford : Found that when using the following function ... "asyncio.start_server(self.processCmd, serverhost, serverport, loop=self.loop)" If 'serverhost' is formatted as a ipaddress.IPv4Address() it will cause a very messy failure. Formatting 'serverhost' as a string eliminates the problem, though I suspect that asyncio developers would/should accept IPv4/IPv6 objects, in addition to strings, as the host parameter. ---------- components: asyncio messages: 327984 nosy: asvetlov, bassford, yselivanov priority: normal severity: normal status: open title: Minor Bug found in asyncio - Python 3.5.3 type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 13:13:38 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Thu, 18 Oct 2018 17:13:38 +0000 Subject: [New-bugs-announce] [issue35020] Add multisort recipe to sorting docs Message-ID: <1539882818.57.0.788709270274.issue35020@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : This issue handles the below : 1. Adding a link to sorting HOWTO from list.sort docs as per msg327901 2. Adding multisort recipe to sorting HOWTO with an example as per msg327925. I have raised a PR (GH-9931) for #1 but the issue35010 was closed and hence I will link to this issue. I would also suggest adding single pass sorting example multisort recipe : https://mail.python.org/pipermail/python-ideas/2016-October/043045.html single pass recipe : https://mail.python.org/pipermail/python-ideas/2016-October/043126.html Since English is not my first language feedback welcome on the wording. Thanks ---------- assignee: docs at python components: Documentation messages: 327988 nosy: docs at python, xtreak priority: normal severity: normal status: open title: Add multisort recipe to sorting docs type: enhancement versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 13:37:14 2018 From: report at bugs.python.org (Thomas Wouters) Date: Thu, 18 Oct 2018 17:37:14 +0000 Subject: [New-bugs-announce] [issue35021] Assertion failures in datetimemodule.c. Message-ID: <1539884234.35.0.788709270274.issue35021@psf.upfronthosting.co.za> New submission from Thomas Wouters : The fix for issue #31752 (changeset 5ef883b096895a84123760859f0f34ad37bf2277 for 2.7, as I ran into this while upgrading to 2.7.15) includes assertions that are easily triggered from user code: >>> import datetime, numpy >>> datetime.timedelta(seconds=numpy.int64(0)) python: .../Modules/datetimemodule.c:1859: accum: Assertion `_PyAnyInt_CheckExact(prod)' failed. Aborted (core dumped) The code asserts that the product of a known type and an unknown type is a known type, which is not a valid assumption. Pure-python reproducer (requires a build with assertions enabled, like a --with-pydebug build). >>> import datetime >>> class C(int): ... def __rmul__(self, other): ... return self ... >>> datetime.timedelta(seconds=C()) python: .../Modules/datetimemodule.c:1859: accum: Assertion `_PyAnyInt_CheckExact(prod)' failed. Aborted (core dumped) (It fails in a similar way in at least Python 3.7, and since the fix was backported I'm going to assume 3.6 as well.) Please do not use assertions for things that aren't guaranteed by the code making the assertions. These should either not be assertions, or the input types should be validated beforehand. I do not know why these assertions are being made in the first place. What do they guard against? ---------- assignee: serhiy.storchaka components: Interpreter Core keywords: 3.6regression, 3.7regression messages: 327989 nosy: gregory.p.smith, serhiy.storchaka, twouters priority: high severity: normal stage: needs patch status: open title: Assertion failures in datetimemodule.c. type: crash versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 20:29:51 2018 From: report at bugs.python.org (Maxime Belanger) Date: Fri, 19 Oct 2018 00:29:51 +0000 Subject: [New-bugs-announce] [issue35022] MagicMock should support `__fspath__` Message-ID: <1539908991.05.0.788709270274.issue35022@psf.upfronthosting.co.za> New submission from Maxime Belanger : We have plenty of tests calling into `os.path.*` functions, and as Python 3.6+ gets more stringent about checking for `os.PathLike` compliance, it would greatly simplify our lives for `MagicMock` to support `__fspath__`. ---------- components: Library (Lib) messages: 328014 nosy: Maxime Belanger priority: normal severity: normal status: open title: MagicMock should support `__fspath__` type: enhancement versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 18 21:58:12 2018 From: report at bugs.python.org (Sapan) Date: Fri, 19 Oct 2018 01:58:12 +0000 Subject: [New-bugs-announce] [issue35023] Missed a key when iterating over dictionary Message-ID: <1539914292.46.0.788709270274.issue35023@psf.upfronthosting.co.za> New submission from Sapan : The issue occurs in the second level of nested dictionary.Iterating over nested dictionary and editing the key by popping the old key and entering the new key. The next iteration, at the second level of nested dictionary, then skips the second key in dictionary and continues from the third key. In debug mode found that on editing the first key, the new memory allocated points to an address that lies between second and third keys memory address. Let me know if some other information is required. I am attaching the python file where I successfully reproduced the issue. ---------- files: Dictissue.py messages: 328016 nosy: Saps priority: normal severity: normal status: open title: Missed a key when iterating over dictionary type: resource usage versions: Python 3.7 Added file: https://bugs.python.org/file47882/Dictissue.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 19 00:00:41 2018 From: report at bugs.python.org (Quentin Agren) Date: Fri, 19 Oct 2018 04:00:41 +0000 Subject: [New-bugs-announce] [issue35024] Incorrect logging in importlib when '.pyc' file creation fails Message-ID: <1539921641.62.0.788709270274.issue35024@psf.upfronthosting.co.za> New submission from Quentin Agren : Hi, This is the first issue I submit so please correct me if I do anything wrong. Description of the issue: imporlib logs 'wrote ' even when file creation fails with OSError (for lack of write persmission for example) Reproducing the bug in Python 3.6 on ubuntu 16.04: cd /home/quentin/tmp mkdir __pycache__ chmod -R -w __pycache__ echo '1 + 1' > spam.py python -vv -c'import spam' 2>&1 | grep '__pycache__/spam' Output: # could not create '/home/quentin/tmp/__pycache__/spam.cpython-36.pyc': PermissionError(13, 'Permission denied') # wrote '/home/quentin/tmp/__pycache__/spam.cpython-36.pyc' Reason: SourceFileLoader.set_data() silences OSError raised by _write_atomic (importlib/_bootstrap_external.py line 875) Then SourceLoader.get_code() does not see that something went awry and logs file creation (same file, line 789) If it is worth fixing I would be glad to contribute a patch, but would probably need a little guidance. ---------- components: Library (Lib) messages: 328029 nosy: qagren priority: normal severity: normal status: open title: Incorrect logging in importlib when '.pyc' file creation fails type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 19 02:24:57 2018 From: report at bugs.python.org (Maxime Belanger) Date: Fri, 19 Oct 2018 06:24:57 +0000 Subject: [New-bugs-announce] [issue35025] Compiling `timemodule.c` can fail on macOS due to availability warnings Message-ID: <1539930297.83.0.788709270274.issue35025@psf.upfronthosting.co.za> New submission from Maxime Belanger : We build Python on macOS with `-Werror=unguarded-availability` and `-mmacosx-version-min=` to ensure `libpython` is binary-compatible with earlier versions of macOS. This can create problems when building some modules, including `timemodule.c`, which was recently altered to fix bpo-28081. The initial fix is inappropriate, because attempting to reference `CLOCK_REALTIME` et al when `HAVE_CLOCK_GETTIME` is unset (in our case, due to being too "new"), results in a compiler error: ``` ./Modules/timemodule.c:1368:29: error: '_CLOCK_REALTIME' is only available on macOS 10.12 or newer [-Werror,-Wunguarded-availability] PyModule_AddIntMacro(m, CLOCK_REALTIME); ^~~~~~~~~~~~~~ /usr/include/time.h:154:24: note: expanded from macro 'CLOCK_REALTIME' #define CLOCK_REALTIME _CLOCK_REALTIME ^~~~~~~~~~~~~~~ ./Include/modsupport.h:78:67: note: expanded from macro 'PyModule_AddIntMacro' #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c) ``` A more correct patch (I'm attaching ours) is to only add the macros to the module if at least one of the three functions is defined. This should continue to work for the author of the original issue as well as fix our problem. ---------- components: Extension Modules, macOS messages: 328030 nosy: Maxime Belanger, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: Compiling `timemodule.c` can fail on macOS due to availability warnings type: compile error versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 19 05:14:10 2018 From: report at bugs.python.org (George Fischhof) Date: Fri, 19 Oct 2018 09:14:10 +0000 Subject: [New-bugs-announce] [issue35026] Winreg's documentation lacks mentioning required permission at some points Message-ID: <1539940450.92.0.788709270274.issue35026@psf.upfronthosting.co.za> New submission from George Fischhof : Winreg's documentation lacks mentioning required permission at some points Hi there, on page https://docs.python.org/3/library/winreg.html it is not mentioned in the description of the following functions: winreg.DeleteKey winreg.DeleteKeyEx winreg.DeleteValue that they require KEY_SET_VALUE when the registry key is opened. It is mentioned for example at: winreg.SetValue with the following text: The key identified by the key parameter must have been opened with KEY_SET_VALUE access. BR, George ---------- assignee: docs at python components: Documentation messages: 328034 nosy: docs at python, georgefischhof priority: normal severity: normal status: open title: Winreg's documentation lacks mentioning required permission at some points type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 19 11:41:11 2018 From: report at bugs.python.org (Tilman Krummeck) Date: Fri, 19 Oct 2018 15:41:11 +0000 Subject: [New-bugs-announce] [issue35027] distutils.core.setup does not raise TypeError when if classifiers, keywords and platforms fields are not specified as a list Message-ID: <1539963671.26.0.788709270274.issue35027@psf.upfronthosting.co.za> New submission from Tilman Krummeck : The python documentation states at this point: "Changed in version 3.7: setup now raises a TypeError if classifiers, keywords and platforms fields are not specified as a list." https://docs.python.org/3.7/distutils/setupscript.html#additional-meta-data I wrote a simple foo example that does show, that eigther the documentation is wrong or a bug exists in setup(). Here's what I get in my console: (venv) D:\Workspaces\pyCharm\dist_utils_test>setup.py sdist running sdist running check warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list) writing manifest file 'MANIFEST' creating foo-1.0 creating foo-1.0\foo making hard links in foo-1.0... hard linking README -> foo-1.0 hard linking setup.py -> foo-1.0 hard linking foo\__init__.py -> foo-1.0\foo hard linking foo\foo.py -> foo-1.0\foo creating dist Creating tar archive removing 'foo-1.0' (and everything under it) (venv) D:\Workspaces\pyCharm\dist_utils_test>pip install dist/foo-1.0.tar.gz Processing d:\workspaces\pycharm\dist_utils_test\dist\foo-1.0.tar.gz Building wheels for collected packages: foo Running setup.py bdist_wheel for foo ... done Stored in directory: C:\Users\Tilman Krummeck\AppData\Local\pip\Cache\wheels\c3\f0\b9\c1066a85814139442fec00ee29293f0f96f0c6e0d6c24ed149 Successfully built foo Installing collected packages: foo Successfully installed foo-1.0 I'm doing this on Python 3.7 (32bit) with pip 18.1 and setuptools 40.4.3. ---------- components: Distutils files: dist_utils_test.zip messages: 328048 nosy: TilmanKrummeck, dstufft, eric.araujo priority: normal severity: normal status: open title: distutils.core.setup does not raise TypeError when if classifiers, keywords and platforms fields are not specified as a list type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47884/dist_utils_test.zip _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 19 14:36:56 2018 From: report at bugs.python.org (Matthew Belisle) Date: Fri, 19 Oct 2018 18:36:56 +0000 Subject: [New-bugs-announce] [issue35028] Off by one error in cgi.FieldStorage(max_num_fields) Message-ID: <1539974216.92.0.788709270274.issue35028@psf.upfronthosting.co.za> New submission from Matthew Belisle : The cgi.FieldStorage class added in https://github.com/python/cpython/pull/9660 has an off by one error in the logic for recursively nested objects. The problem is that sub_max_num_fields should be initialized outside of the while loop, not inside of it. Adding a unit test to cover this case. Note: This problem does not exist in the 2.7 backport in https://github.com/python/cpython/pull/9969. ---------- components: Library (Lib) messages: 328060 nosy: Matthew Belisle priority: normal severity: normal status: open title: Off by one error in cgi.FieldStorage(max_num_fields) type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 20 03:24:03 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 20 Oct 2018 07:24:03 +0000 Subject: [New-bugs-announce] [issue35029] Convert SyntaxWarning exception raised at code generation time to a SyntaxError Message-ID: <1540020243.93.0.788709270274.issue35029@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : SyntaxError contains more useful information than SyntaxWarning, and SyntaxError is special cased in tracebacks for better reporting. When SyntaxWarning is raised as an exception, the error report doesn't contain information about the source. It is hard to find the source of a SyntaxWarning. Currently: $ ./python syntaxwarning.py syntaxwarning.py:1: SyntaxWarning: assertion is always true, perhaps remove parentheses? x = 1; assert (x, "msg") $ ./python -We syntaxwarning.py SyntaxWarning: assertion is always true, perhaps remove parentheses? $ ./python -m syntaxwarning /home/serhiy/py/cpython3.7/syntaxwarning.py:1: SyntaxWarning: assertion is always true, perhaps remove parentheses? x = 1; assert (x, "msg") $ ./python -We -m syntaxwarning Traceback (most recent call last): File "/home/serhiy/py/cpython3.7/Lib/runpy.py", line 183, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/home/serhiy/py/cpython3.7/Lib/runpy.py", line 153, in _get_module_details code = loader.get_code(mod_name) File "", line 860, in get_code File "", line 791, in source_to_code File "", line 219, in _call_with_frames_removed SyntaxWarning: assertion is always true, perhaps remove parentheses? The proposed PR replaces SyntaxWarning with a SyntaxError if the former was raised as an exception: $ ./python -We syntaxwarning.py File "syntaxwarning.py", line 1 x = 1; assert (x, "msg") ^ SyntaxError: assertion is always true, perhaps remove parentheses? $ ./python -We -m syntaxwarning Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/runpy.py", line 183, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/home/serhiy/py/cpython/Lib/runpy.py", line 153, in _get_module_details code = loader.get_code(mod_name) File "", line 909, in get_code File "", line 839, in source_to_code File "", line 219, in _call_with_frames_removed File "/home/serhiy/py/cpython/syntaxwarning.py", line 1 x = 1; assert (x, "msg") ^ SyntaxError: assertion is always true, perhaps remove parentheses? Similar replacement is already performed for warnings raised for unrecognized escape sequences at parsing time (see issue32912). ---------- components: Interpreter Core messages: 328130 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Convert SyntaxWarning exception raised at code generation time to a SyntaxError type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 20 04:37:02 2018 From: report at bugs.python.org (tzickel) Date: Sat, 20 Oct 2018 08:37:02 +0000 Subject: [New-bugs-announce] [issue35030] Python 2.7 OrderedDict leaks memory Message-ID: <1540024622.42.0.788709270274.issue35030@psf.upfronthosting.co.za> New submission from tzickel : https://github.com/requests/requests/issues/4553#issuecomment-431514753 It was fixed in Python 3 by using weakref, but not backported to Python 2. Also might be nice to somehow to that leak test in more places to detect such issues ? ---------- components: Library (Lib) messages: 328133 nosy: rhettinger, tzickel priority: normal severity: normal status: open title: Python 2.7 OrderedDict leaks memory versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 20 10:06:47 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Sat, 20 Oct 2018 14:06:47 +0000 Subject: [New-bugs-announce] [issue35031] test_asyncio test_start_tls_server_1 fails in Message-ID: <1540044407.71.0.788709270274.issue35031@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : https://buildbot.python.org/all/#/builders/168/builds/91 https://buildbot.python.org/all/#/builders/172/builds/41 https://buildbot.python.org/all/#/builders/173/builds/51 CURRENT-amd64% ./python -m test test_asyncio -m test_start_tls_server_1 Run tests sequentially 0:00:00 load avg: 3.36 [1/1] test_asyncio Stderr: /usr/home/pablo/cpython/Lib/test/test_asyncio/test_sslproto.py:497: DeprecationWarning: The loop argument is deprecated and scheduled for removal in Python 3.10. await asyncio.wait_for( /usr/home/pablo/cpython/Lib/asyncio/sslproto.py:321: ResourceWarning: unclosed transport warnings.warn(f"unclosed transport {self!r}", ResourceWarning, Unhandled error in exception handler context: {'message': 'Future exception was never retrieved', 'exception': ConnectionResetError(54, 'Connection reset by peer'), 'future': } Traceback (most recent call last): File "/usr/home/pablo/cpython/Lib/test/libregrtest/runtest.py", line 179, in runtest_inner test_runner() File "/usr/home/pablo/cpython/Lib/test/libregrtest/runtest.py", line 175, in test_runner support.run_unittest(tests) File "/usr/home/pablo/cpython/Lib/test/support/__init__.py", line 2001, in run_unittest _run_suite(suite) File "/usr/home/pablo/cpython/Lib/test/support/__init__.py", line 1920, in _run_suite raise TestFailed(err) test.support.TestFailed: Traceback (most recent call last): File "/usr/home/pablo/cpython/Lib/test/test_asyncio/test_sslproto.py", line 504, in test_start_tls_server_1 self.loop.run_until_complete(run_main()) File "/usr/home/pablo/cpython/Lib/asyncio/base_events.py", line 582, in run_until_complete return future.result() File "/usr/home/pablo/cpython/Lib/test/test_asyncio/test_sslproto.py", line 497, in run_main await asyncio.wait_for( File "/usr/home/pablo/cpython/Lib/asyncio/tasks.py", line 457, in wait_for raise exceptions.TimeoutError() asyncio.exceptions.TimeoutError Stderr: /usr/home/pablo/cpython/Lib/test/test_asyncio/test_sslproto.py:497: DeprecationWarning: The loop argument is deprecated and scheduled for removal in Python 3.10. await asyncio.wait_for( /usr/home/pablo/cpython/Lib/asyncio/sslproto.py:321: ResourceWarning: unclosed transport warnings.warn(f"unclosed transport {self!r}", ResourceWarning, During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/home/pablo/cpython/Lib/asyncio/base_events.py", line 1647, in call_exception_handler self._exception_handler(self, context) File "/usr/home/pablo/cpython/Lib/test/test_asyncio/functional.py", line 22, in loop_exception_handler self.loop.default_exception_handler(context) AttributeError: 'NoneType' object has no attribute 'default_exception_handler' /usr/home/pablo/cpython/Lib/test/support/__init__.py:1550: ResourceWarning: unclosed gc.collect() test test_asyncio failed -- Traceback (most recent call last): File "/usr/home/pablo/cpython/Lib/test/test_asyncio/test_sslproto.py", line 504, in test_start_tls_server_1 self.loop.run_until_complete(run_main()) File "/usr/home/pablo/cpython/Lib/asyncio/base_events.py", line 582, in run_until_complete return future.result() File "/usr/home/pablo/cpython/Lib/test/test_asyncio/test_sslproto.py", line 497, in run_main await asyncio.wait_for( File "/usr/home/pablo/cpython/Lib/asyncio/tasks.py", line 457, in wait_for raise exceptions.TimeoutError() asyncio.exceptions.TimeoutError Stderr: /usr/home/pablo/cpython/Lib/test/test_asyncio/test_sslproto.py:497: DeprecationWarning: The loop argument is deprecated and scheduled for removal in Python 3.10. await asyncio.wait_for( /usr/home/pablo/cpython/Lib/asyncio/sslproto.py:321: ResourceWarning: unclosed transport warnings.warn(f"unclosed transport {self!r}", ResourceWarning, test_asyncio failed in 1 min 749 ms == Tests result: FAILURE == 1 test failed: test_asyncio Total duration: 1 min 800 ms Tests result: FAILURE ---------- components: Tests, asyncio messages: 328138 nosy: asvetlov, pablogsal, yselivanov priority: normal severity: normal status: open title: test_asyncio test_start_tls_server_1 fails in type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 20 10:30:55 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Sat, 20 Oct 2018 14:30:55 +0000 Subject: [New-bugs-announce] [issue35032] Remove the videos from faq/Windows Message-ID: <1540045855.07.0.788709270274.issue35032@psf.upfronthosting.co.za> New submission from St?phane Wirtel : In the FAQ of Windows, there are two references to external videos for the configuration of a dev environment for Windows, but these videos are no longer available because the domain name no longer exists. ---------- assignee: docs at python components: Documentation, Windows messages: 328139 nosy: docs at python, matrixise, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Remove the videos from faq/Windows versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 20 12:28:35 2018 From: report at bugs.python.org (Julien Palard) Date: Sat, 20 Oct 2018 16:28:35 +0000 Subject: [New-bugs-announce] [issue35033] Column or row spanning cells are not implemented. Message-ID: <1540052915.48.0.788709270274.issue35033@psf.upfronthosting.co.za> New submission from Julien Palard : Recent tables introduced in Doc/c-api/typeobj.rst are using columns spanning. But columns spanning is not implemented in the sphinx text builder, resulting in: $ cd Doc $ sphinx-build -b text -d build/doctrees -W -D latex_elements.papersize= -Ea -A daily=1 -A switchers=1 . build/text Running Sphinx v1.8.1 building [mo]: all of 0 po files building [text]: all source files updating environment: 475 added, 0 changed, 0 removed reading sources... [100%] whatsnew/index looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done writing output... [ 12%] c-api/typeobj Exception occurred: File "/home/mdk/.venvs/mdk/lib/python3.6/site-packages/sphinx/writers/text.py", line 623, in visit_entry raise NotImplementedError('Column or row spanning cells are ' NotImplementedError: Column or row spanning cells are not implemented. The full traceback has been saved in /tmp/sphinx-err-3q24uv89.log, if you want to report the issue to the developers. Please also report this if it was a user error, so that a better error message can be provided next time. A bug report can be filed in the tracker at . Thanks! we could either try to remove our column spannings (but they're usefull, first table, 2nd header line), either implement it sphinx-side. ---------- assignee: docs at python components: Documentation messages: 328159 nosy: docs at python, mdk priority: normal severity: normal status: open title: Column or row spanning cells are not implemented. versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 20 19:29:15 2018 From: report at bugs.python.org (=?utf-8?q?Vladimir_Filipovi=C4=87?=) Date: Sat, 20 Oct 2018 23:29:15 +0000 Subject: [New-bugs-announce] [issue35034] Add closing and iteration to threading.Queue Message-ID: <1540078155.51.0.788709270274.issue35034@psf.upfronthosting.co.za> New submission from Vladimir Filipovi? : Code using threading.Queue often needs to coordinate a "work is finished as far as far as I care" state between the producing and consuming side. When going from the producer to the consumer ("No more items after this, so don't bother waiting"), this is usually implemented with sentinel objects, which is at best needlessly verbose and at worst tricky to get right (as with multiple consumers, or communicating a non-trivial sentinel object). When going the other direction ("I'm not interested in consuming any more, so you can stop putting them on the queue"), or when a third component needs to notify both sides ("You two start wrapping up, but don't drop any in-flight items") there isn't even a clear usual solution. Adding a close() method to the Queue (with accompanying exception treatment etc.) would solve all of this in a very clean way. It would not change anything for code that doesn't want to use it. It would simplify a lot of everyday uses of Queue. Many simple producers could reduce their coordination code to a `with closing(queue)` idiom. A further __iter__() method would enable many simple consumers to safely cut all their coordination boilerplate down to just `for item in queue`. I've got a sample implementation ready for Queue and its children, and I'm about to submit it as a PR. I'd be happy to contribute an equivalent (within limits of its API promises) implementation for SimpleQueue, but I don't have it written, and I'm unsure if I should make a separate issue for that. ---------- components: Library (Lib) messages: 328181 nosy: hemflit priority: normal severity: normal status: open title: Add closing and iteration to threading.Queue type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 21 02:17:19 2018 From: report at bugs.python.org (Zhiming Wang) Date: Sun, 21 Oct 2018 06:17:19 +0000 Subject: [New-bugs-announce] [issue35035] Documentation for email.utils is named email.util.rst Message-ID: <1540102639.17.0.788709270274.issue35035@psf.upfronthosting.co.za> New submission from Zhiming Wang : Documentation for PSL module email.utils is named email.util.rst. See . This seems to violate the principle of least surprise. (I have a command line tool to open documentation for any PSL module, and I found this name mismatch when I used that with email.utils.) It should be named email.utils.rst instead, unless there's a specific reason not to. ---------- assignee: docs at python components: Documentation messages: 328190 nosy: docs at python, zmwangx priority: normal severity: normal status: open title: Documentation for email.utils is named email.util.rst versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 21 02:56:45 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Sun, 21 Oct 2018 06:56:45 +0000 Subject: [New-bugs-announce] [issue35036] logger failure in suspicious.py Message-ID: <1540105005.86.0.788709270274.issue35036@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : There were some recent changes made in ee171a26c11 to fix Sphinx related deprecation warnings. During the change self.info() was changed to self.logger.info() . Logger expects a positional argument that contains the message thus causing failure. I think empty string can be passed here. I changed it back to self.info() and ran `make suspicious` locally and it only printed deprecation warning. Looking the source the previous method had message default to '' thus self.info() was working. def info(self, message='', nonl=False): # type: (unicode, bool) > None """Emit an informational message. If *nonl* is true, don't emit a newline at the end (which implies that more info output will follow soon.) .. deprecated:: 1.6 Use :mod:`sphinx.util.logging` instead. """ warnings.warn('app.info() is now deprecated. Use sphinx.util.logging instead.', RemovedInSphinx20Warning) logger.info(message, nonl=nonl) Sample failure : https://travis-ci.org/python/cpython/jobs/444263040#L560 I am adding @pablogsal for thoughts on the fix. I will add a PR shortly. ---------- components: Build messages: 328191 nosy: pablogsal, xtreak priority: normal severity: normal status: open title: logger failure in suspicious.py type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 21 04:22:52 2018 From: report at bugs.python.org (Stefan Behnel) Date: Sun, 21 Oct 2018 08:22:52 +0000 Subject: [New-bugs-announce] [issue35037] PYLONG_BITS_IN_DIGIT differs between MinGW and MSVC Message-ID: <1540110172.83.0.788709270274.issue35037@psf.upfronthosting.co.za> New submission from Stefan Behnel : I see reports from Cython users on Windows-64 that extension modules that use "longintrepr.h" get miscompiled by MinGW. A failing setup looks as follows: Stock 64 bit CPython on Windows, e.g. Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] MinGW uses this compile time setup, i.e. 15 bit digits: PyLong_BASE 0x8000 PyLong_MASK 7FFF PyLong_SHIFT 15 sizeof(digit) 2 sizeof(sdigit) 2 Whereas CPython reports the following, indicating that it was in fact built with 30 bit digits: sys.getsize(1, 2**14, 2**15, 2**29, 2**30, 2**63, 2**64) (28, 28, 28, 28, 32, 36, 36) I'm not sure if this also applies to Py2.7, but I don't think the PyLong implementations differ in this regard. The compile time PyLong digit size is not remembered by the CPython installation and instead determined on the fly by the extension compiler. It seems that the MSVC build of the stock CPython packages differs from what MinGW decides here. This renders MinGW unusable for code that uses "longintrepr.h", which Cython does by default in order to accelerate its unpacking of PyLong values. Is there a reason why CPython cannot store its compile time value for the PYLONG_BITS_IN_DIGIT setting somewhere? ---------- components: Extension Modules, Windows messages: 328197 nosy: paul.moore, scoder, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: PYLONG_BITS_IN_DIGIT differs between MinGW and MSVC type: compile error versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 21 11:02:02 2018 From: report at bugs.python.org (Adrien) Date: Sun, 21 Oct 2018 15:02:02 +0000 Subject: [New-bugs-announce] [issue35038] AttributeError: 'frame' object has no attribute 'f_restricted' Message-ID: <1540134122.28.0.788709270274.issue35038@psf.upfronthosting.co.za> New submission from Adrien : In the documentation (https://docs.python.org/3/library/inspect.html#types-and-members), the attribute `f_restricted` is listed as a member of `frame` objects. However, while trying to access it or even when calling `help()`, the object does not seem to have such attribute. Is it a issue with the documentation that has not been updated? I'm using Python 3.6.3 on Linux. ---------- assignee: docs at python components: Documentation messages: 328217 nosy: Delgan, docs at python priority: normal severity: normal status: open title: AttributeError: 'frame' object has no attribute 'f_restricted' type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 21 16:52:39 2018 From: report at bugs.python.org (Srinivas Reddy Thatiparthy) Date: Sun, 21 Oct 2018 20:52:39 +0000 Subject: [New-bugs-announce] [issue35039] remove unused vars in Lib/turtledemo module Message-ID: <1540155159.14.0.788709270274.issue35039@psf.upfronthosting.co.za> Change by Srinivas Reddy Thatiparthy : ---------- components: Library (Lib) nosy: thatiparthy priority: normal severity: normal status: open title: remove unused vars in Lib/turtledemo module versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 21 21:39:51 2018 From: report at bugs.python.org (Liran Nuna) Date: Mon, 22 Oct 2018 01:39:51 +0000 Subject: [New-bugs-announce] [issue35040] functools.lru_cache does not work with coroutines Message-ID: <1540172391.19.0.788709270274.issue35040@psf.upfronthosting.co.za> New submission from Liran Nuna : lru_cache is a very useful method but it does not work well with coroutines since they can only be executed once. Take for example, the attached code (test-case.py) - It will throw a RuntimeError because you cannot reuse an already awaited coroutine. A solution would be to call `asyncio.ensure_future` on the result of the coroutine if detected. ---------- components: asyncio files: test-case.py messages: 328228 nosy: Liran Nuna, asvetlov, yselivanov priority: normal severity: normal status: open title: functools.lru_cache does not work with coroutines versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47887/test-case.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 21 22:25:11 2018 From: report at bugs.python.org (william.ayd) Date: Mon, 22 Oct 2018 02:25:11 +0000 Subject: [New-bugs-announce] [issue35041] urllib.parse.quote safe Parameter Not Optional Message-ID: <1540175111.44.0.788709270274.issue35041@psf.upfronthosting.co.za> New submission from william.ayd : The safe parameter in urllib.parse.quote is documented as optional. However, the following will raise TypeError: 'NoneType' object is not iterable: urllib.parse.quote("/", safe=None) whereas explicitly providing an iterable will allow the function to succeed: urllib.parse.quote("/", safe=[]) ---------- messages: 328229 nosy: william.ayd priority: normal severity: normal status: open title: urllib.parse.quote safe Parameter Not Optional versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 22 04:11:03 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Mon, 22 Oct 2018 08:11:03 +0000 Subject: [New-bugs-announce] [issue35042] Use the role :pep: for the PEP \d+ Message-ID: <1540195863.27.0.788709270274.issue35042@psf.upfronthosting.co.za> New submission from St?phane Wirtel : In the doc, we write PEP XYZ but there is a sphinx role for that, just replace PEP XYZ by :pep:`XYZ` and convert the :PEP: by :pep: ---------- assignee: docs at python components: Documentation messages: 328240 nosy: docs at python, matrixise priority: normal severity: normal status: open title: Use the role :pep: for the PEP \d+ versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 22 07:49:58 2018 From: report at bugs.python.org (Vasantha Ganesh Kanniappan) Date: Mon, 22 Oct 2018 11:49:58 +0000 Subject: [New-bugs-announce] [issue35043] functools.reduce doesn't work properly with itertools.chain Message-ID: <1540208998.92.0.788709270274.issue35043@psf.upfronthosting.co.za> New submission from Vasantha Ganesh Kanniappan : I'm facing this issue in python 3.6.5 How to reproduce: my_list = [[1, 2], [3, 4]] a = reduce(itertools.chain, my_list) The output of `a' is [1, 2, 3, 4] as expected, but now my_list is [[1, 2, 3, 4], [3, 4]] ---------- components: Library (Lib) messages: 328248 nosy: Vasantha Ganesh Kanniappan priority: normal severity: normal status: open title: functools.reduce doesn't work properly with itertools.chain type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 22 08:07:50 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Mon, 22 Oct 2018 12:07:50 +0000 Subject: [New-bugs-announce] [issue35044] Use the :exc: role for the exceptions in the doc Message-ID: <1540210070.18.0.788709270274.issue35044@psf.upfronthosting.co.za> New submission from St?phane Wirtel : In the doc, there is some locations where we do not use the :exc: role for the exceptions, I try to fix that with this PR. ---------- assignee: docs at python components: Documentation messages: 328249 nosy: docs at python, matrixise priority: normal severity: normal status: open title: Use the :exc: role for the exceptions in the doc versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 22 10:30:27 2018 From: report at bugs.python.org (Charalampos Stratakis) Date: Mon, 22 Oct 2018 14:30:27 +0000 Subject: [New-bugs-announce] [issue35045] test_min_max_version (test.test_ssl.ContextTests) fails on Fedora 29+ and openssl 1.1.1 Message-ID: <1540218627.92.0.788709270274.issue35045@psf.upfronthosting.co.za> New submission from Charalampos Stratakis : There is an Python test that checks the minimum TLS version - test_min_max_version (test.test_ssl.ContextTests). Fedora 29+ sets TLSv1 as explicit minimum version. Python's test suite assumes that the minimum protocol version is set to a magic marker. FAIL: test_min_max_version (test.test_ssl.ContextTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.7.0/Lib/test/test_ssl.py", line 1084, in test_min_max_version ctx.minimum_version, ssl.TLSVersion.MINIMUM_SUPPORTED AssertionError: != We currently workaround the problem by setting: export OPENSSL_CONF=/non-existing-file ---------- assignee: christian.heimes components: SSL messages: 328255 nosy: christian.heimes, cstratak priority: normal severity: normal status: open title: test_min_max_version (test.test_ssl.ContextTests) fails on Fedora 29+ and openssl 1.1.1 versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 22 14:51:21 2018 From: report at bugs.python.org (Josh Snyder) Date: Mon, 22 Oct 2018 18:51:21 +0000 Subject: [New-bugs-announce] [issue35046] logging.StreamHandler performs two syscalls when one would do Message-ID: <1540234281.84.0.788709270274.issue35046@psf.upfronthosting.co.za> New submission from Josh Snyder : logging.StreamHandler contains the following code: stream.write(msg) stream.write(self.terminator) stream.flush() When sys.stderr (or whatever other stream) is unbuffered, this results in two system calls and allows log records from different processes to concatenate on the same line in the output stream (followed by multiple newlines). This issue is new in Python 3.7, as stdout and stderr became "truly unbuffered" (cf. #30404). As a simple solution, I believe the following would fix the issue and also be backward compatible: stream.write(msg + self.terminator) stream.flush() ---------- messages: 328269 nosy: josnyder priority: normal severity: normal status: open title: logging.StreamHandler performs two syscalls when one would do type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 04:35:36 2018 From: report at bugs.python.org (Petter S) Date: Tue, 23 Oct 2018 08:35:36 +0000 Subject: [New-bugs-announce] [issue35047] Better error messages un unittest.mock Message-ID: <1540283736.06.0.788709270274.issue35047@psf.upfronthosting.co.za> New submission from Petter S : When developing unit tests with `unittest.mock`, it is common to see error messages like this: AssertionError: Expected 'info' to not have been called. Called 3 times. It would be really helpful if those 3 calls were listed in the assertion error. I am happy to add this if people agree it is a good thing. ---------- components: Library (Lib) messages: 328292 nosy: Petter S priority: normal severity: normal status: open title: Better error messages un unittest.mock versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 06:07:18 2018 From: report at bugs.python.org (Dan Snider) Date: Tue, 23 Oct 2018 10:07:18 +0000 Subject: [New-bugs-announce] [issue35048] Can't reassign __class__ despite the assigned class having identical slots Message-ID: <1540289238.37.0.788709270274.issue35048@psf.upfronthosting.co.za> New submission from Dan Snider : >>> class a(dict): __slots__ = '__dict__', 'x' >>> class b(dict): __slots__ = '__dict__', 'x' >>> self = a(); self.__class__ = b Traceback (most recent call last): File "", line 1, in self=a(); self.__class__ = b TypeError: __class__ assignment: 'b' object layout differs from 'a' This always occurs when __dict__ and/or __weakref__ are defined as slots, even when both classes have otherwise identical slots. This behavior appears to contradict what the docs say wrt to __class__ assignment, which is (in its entirety): "__class__ assignment works only if both classes have the same __slots__. " Not sure if this is just a case of ambiguous documentation and intentional behavior or not. Since two classes with identical slots will always have identical internal struct layouts, I can't see a reason for this error. ---------- messages: 328296 nosy: bup priority: normal severity: normal status: open title: Can't reassign __class__ despite the assigned class having identical slots versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 06:26:52 2018 From: report at bugs.python.org (Lene Preuss) Date: Tue, 23 Oct 2018 10:26:52 +0000 Subject: [New-bugs-announce] [issue35049] argparse.ArgumentParser fails on arguments with leading dash and comma Message-ID: <1540290412.14.0.788709270274.issue35049@psf.upfronthosting.co.za> New submission from Lene Preuss : Obligatory apologies if this has been reported before, I could not find it. It is similar to but different from https://bugs.python.org/issue9334. >>> from argparse import ArgumentParser >>> p = ArgumentParser() >>> p.add_argument('-d') _StoreAction(option_strings=['-d'], dest='d', nargs=None, const=None, default=None, type=None, choices=None, help=None, metavar=None) >>> p.parse_args(['-d', '12']) Namespace(d='12') >>> p.parse_args(['-d', '1,2']) Namespace(d='1,2') >>> p.parse_args(['-d', '-12']) Namespace(d='-12') >>> p.parse_args(['-d', '-1,2']) usage: [-h] [-d D] : error: argument -d: expected one argument As suggested in issue 9334, passing the argument with an equals sign works: >>> p.parse_args(['-d=-1,2']) Namespace(d='-1,2') But I don't think that this is the intended behavior. ---------- messages: 328299 nosy: lene priority: normal severity: normal status: open title: argparse.ArgumentParser fails on arguments with leading dash and comma type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 09:00:21 2018 From: report at bugs.python.org (Christian Heimes) Date: Tue, 23 Oct 2018 13:00:21 +0000 Subject: [New-bugs-announce] [issue35050] Off-by-one bug in AF_ALG Message-ID: <1540299621.45.0.788709270274.issue35050@psf.upfronthosting.co.za> New submission from Christian Heimes : The error checking code for salg_name and salg_type have an off-by-one bug. It should check that both strings are NUL terminated strings. It's not a security bug, because the Linux kernel ensures that the last byte is a NULL byte. ---------- components: Extension Modules messages: 328311 nosy: christian.heimes priority: normal severity: normal status: open title: Off-by-one bug in AF_ALG type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 09:39:04 2018 From: report at bugs.python.org (Emmanuel Arias) Date: Tue, 23 Oct 2018 13:39:04 +0000 Subject: [New-bugs-announce] [issue35051] Fix pep8 on Lib/turtledemo module Message-ID: <1540301944.91.0.788709270274.issue35051@psf.upfronthosting.co.za> New submission from Emmanuel Arias : This issue is related to #35039 Fix pep8. See comments on https://github.com/python/cpython/pull/10044 ---------- components: Library (Lib) messages: 328316 nosy: eamanu, thatiparthy priority: normal severity: normal status: open title: Fix pep8 on Lib/turtledemo module versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 11:30:54 2018 From: report at bugs.python.org (Charalampos Stratakis) Date: Tue, 23 Oct 2018 15:30:54 +0000 Subject: [New-bugs-announce] [issue35052] Coverity scan: copy/paste error in Lib/xml/dom/minidom.py Message-ID: <1540308654.33.0.788709270274.issue35052@psf.upfronthosting.co.za> New submission from Charalampos Stratakis : Analyzing some coverity scan results I stumbled upon this issue: Python-3.6.5/Lib/xml/dom/minidom.py:1914: original: "n._call_user_data_handler(operation, n, notation)" looks like the original copy. Python-3.6.5/Lib/xml/dom/minidom.py:1924: copy_paste_error: "n" in "e._call_user_data_handler(operation, n, entity)" looks like a copy-paste error. Python-3.6.5/Lib/xml/dom/minidom.py:1924: remediation: Should it say "e" instead? # 1922| clone.entities._seq.append(entity) # 1923| if hasattr(e, '_call_user_data_handler'): # 1924|-> e._call_user_data_handler(operation, n, entity) # 1925| else: # 1926| # Note the cloning of Document and DocumentType nodes is It seems that the warning is indeed a bug, and the code in question was basically merged into python from pyxml 16 years ago. ---------- components: Library (Lib) messages: 328321 nosy: cstratak priority: normal severity: normal status: open title: Coverity scan: copy/paste error in Lib/xml/dom/minidom.py versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 12:42:14 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 23 Oct 2018 16:42:14 +0000 Subject: [New-bugs-announce] [issue35053] Enhance tracemalloc to trace properly free lists Message-ID: <1540312934.43.0.788709270274.issue35053@psf.upfronthosting.co.za> New submission from STINNER Victor : CPython uses many "free lists": list of "deallocated" objects which are kept alive to optimize allocation of new objects. For example, the builtin list type has a free list. Problem: tracemalloc only traces the memory allocation when the object is created, but it doesn't update the traceback when the "free object" is reused to create "a new object". Attached PR modifies _Py_NewReference() to update the Python traceback in the tracemalloc trace. ---------- components: Library (Lib) messages: 328326 nosy: vstinner priority: normal severity: normal status: open title: Enhance tracemalloc to trace properly free lists versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 13:45:03 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 23 Oct 2018 17:45:03 +0000 Subject: [New-bugs-announce] [issue35054] Add more index entries for symbols Message-ID: <1540316703.62.0.788709270274.issue35054@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The proposed PR adds index entries for all operators, syntax elements and keywords. It also adds index entries for symbols in related minilanguages: * escape sequences in string literals * metacharacters and escape sequences in regular expressions * symbols in printf-style formatting, string formatting, f-strings and template strings * special symbols for OS (pathnames and interpolation) * special symbols in doctests * and others Also fixed several errors in formatting. ---------- assignee: docs at python components: Documentation messages: 328329 nosy: docs at python, eric.araujo, ezio.melotti, georg.brandl, serhiy.storchaka, willingc priority: normal severity: normal status: open title: Add more index entries for symbols type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 15:14:45 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Tue, 23 Oct 2018 19:14:45 +0000 Subject: [New-bugs-announce] [issue35055] Error when we try to download the epub archive Message-ID: <1540322085.68.0.788709270274.issue35055@psf.upfronthosting.co.za> New submission from St?phane Wirtel : On this page https://docs.python.org/3/download.html, there is a link for the epub archive but we can not download it because there is 404 Not Found. https://docs.python.org/3/archives/python-3.7.1-docs.epub ---------- messages: 328332 nosy: matrixise, mdk, ned.deily priority: normal severity: normal status: open title: Error when we try to download the epub archive versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 23 15:36:59 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 23 Oct 2018 19:36:59 +0000 Subject: [New-bugs-announce] [issue35056] Test leaks of memory not managed by Python allocator Message-ID: <1540323419.75.0.788709270274.issue35056@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : Would be nice to add a possibility to test memory leaks if memory is allocated not by Python allocators, but inside external libraries. This would allow to catch leaks on the bridge between Python and external libraries. See for example issue34794. ---------- components: Tests messages: 328336 nosy: serhiy.storchaka, vstinner priority: normal severity: normal status: open title: Test leaks of memory not managed by Python allocator type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 24 07:54:53 2018 From: report at bugs.python.org (Michael Thies) Date: Wed, 24 Oct 2018 11:54:53 +0000 Subject: [New-bugs-announce] [issue35057] Email header refolding adds additional \r in nested parse trees Message-ID: <1540382093.01.0.788709270274.issue35057@psf.upfronthosting.co.za> New submission from Michael Thies : Email header refolding in email._header_value_parser adds additional carriage return symbols to the end of nested parse trees, when used with an EmailPolicy with linesep='\r\n'. This leads to broken email headers when composing an email with a "To:" or "CC:" header having a comma-separated list of recipients with some of them containing non-ASCII characters in their DisplayName. The bug seems to be caused by the following line (in Python 3.7): `encoded_part = part.fold(policy=policy)[:-1] # strip nl` (email/_header_value_parser.py, line 2629) This line calls part.fold() / _refold_parse_tree() recursively and tries to remove the trailing newline, which is added by the recursive call of _refold_parse_tree(). Unfortunately, it fails to do so, if the length of the policy's line separator sequence does not equal 1. Thus, this line should be corrected to something like `encoded_part = part.fold(policy=policy)[:-len(policy.linesep)] # strip nl` ---------- components: email messages: 328362 nosy: barry, michael.thies, r.david.murray priority: normal severity: normal status: open title: Email header refolding adds additional \r in nested parse trees type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 24 10:15:09 2018 From: report at bugs.python.org (Alex Bach) Date: Wed, 24 Oct 2018 14:15:09 +0000 Subject: [New-bugs-announce] [issue35058] Unable to Install Python on Windows Message-ID: <1540390509.38.0.788709270274.issue35058@psf.upfronthosting.co.za> New submission from Alex Bach : So I had to learn Python this semester and eventually I followed an online tutorial to install python on Windows 7 (64 bit). But during the installation, I got the error: 0x80070643: Failed to Install MSI Package: What's wrong with the installation? I even tried the x84 bit setup as well. ---------- components: Windows messages: 328366 nosy: alexbach, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Unable to Install Python on Windows type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 24 10:31:56 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 24 Oct 2018 14:31:56 +0000 Subject: [New-bugs-announce] [issue35059] Convert PyObject_INIT() and _Py_NewReference() to inlined functions Message-ID: <1540391516.33.0.788709270274.issue35059@psf.upfronthosting.co.za> New submission from STINNER Victor : CPython has been created in 1990. In 1990, it made sense to use C macros. But nowadays, inlined functions can be used instead: "Python versions greater than or equal to 3.6 use C89 with several select C99 features: (...) static inline functions" https://www.python.org/dev/peps/pep-0007/#c-dialect I propose to convert 4 macros to inlined functions: * PyObject_INIT(), PyObject_INIT_VAR() * _Py_NewReference(), _Py_ForgetReference() Advantages: * Functions use regular C syntax * No more corner cases ("traps") of macros * Function arguments have a type Drawbacks: * Require a specific type can introduce compiler warnings if the caller doesn't pass the proper type (PyObject* or PyVarObject*). _Py_NewReference() and _Py_ForgetReference() seem to be properly used, but not PyObject_INIT() and PyObject_INIT_VAR(). The two attached PRs implements these changes. ---------- components: Interpreter Core messages: 328367 nosy: vstinner priority: normal severity: normal status: open title: Convert PyObject_INIT() and _Py_NewReference() to inlined functions versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 24 11:36:53 2018 From: report at bugs.python.org (Edward Pratt) Date: Wed, 24 Oct 2018 15:36:53 +0000 Subject: [New-bugs-announce] [issue35060] subprocess output seems to depend on size of terminal screen Message-ID: <1540395413.56.0.788709270274.issue35060@psf.upfronthosting.co.za> New submission from Edward Pratt : I am looking for a string inside of a process, and it seems that the output of the check_output command depends on the screen size of the terminal I run the code in. Here I ran the code with a normal screen resolution: >>> result = subprocess.check_output(['ps', 'aux']).decode('ascii', errors='ignore') >>> 'app-id' in result False Then I zoom out to the point where I can barely read the text on the screen, and this is the output I get: >>> result = subprocess.check_output(['ps', 'aux']).decode('ascii', errors='ignore') >>> 'app-id' in result True ---------- components: Demos and Tools messages: 328371 nosy: epsolos priority: normal severity: normal status: open title: subprocess output seems to depend on size of terminal screen type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 24 22:04:30 2018 From: report at bugs.python.org (Yongkwan Kim) Date: Thu, 25 Oct 2018 02:04:30 +0000 Subject: [New-bugs-announce] [issue35061] Specify libffi.so soname for ctypes Message-ID: <1540433070.81.0.788709270274.issue35061@psf.upfronthosting.co.za> New submission from Yongkwan Kim : As python 3.7 excludes libffi from it's package, my build on centos6 doesn't work on centos7. Error message is following. ImportError: libffi.so.5: cannot open shared object file: No such file or directory centos7 have libffi.so.6 instead of libffi.so.5 as does centos6. I hope to specify libffi version with libffi.so. I figured out that any configure option can fix this through seeing setup.py . Thanks in advance. ---------- messages: 328406 nosy: tturbs priority: normal severity: normal status: open title: Specify libffi.so soname for ctypes _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 00:03:41 2018 From: report at bugs.python.org (Xiang Zhang) Date: Thu, 25 Oct 2018 04:03:41 +0000 Subject: [New-bugs-announce] [issue35062] io.IncrementalNewlineDecoder assign out-of-range value to bitwise struct field Message-ID: <1540440221.28.0.788709270274.issue35062@psf.upfronthosting.co.za> New submission from Xiang Zhang : io.IncrementalNewlineDecoder gets a *translate* bitwise struct field, but it could be assigned arbitrary int value. This leads to inconsistent behaviour, evens are evaluated to False and odds to True. >>> io.IncrementalNewlineDecoder(encodings.utf_8.IncrementalDecoder(), 4).decode(b"abcd\r\n") u'abcd\r\n' >>> io.IncrementalNewlineDecoder(encodings.utf_8.IncrementalDecoder(), 5).decode(b"abcd\r\n") u'abcd\n' ---------- components: IO messages: 328407 nosy: xiang.zhang priority: normal severity: normal stage: needs patch status: open title: io.IncrementalNewlineDecoder assign out-of-range value to bitwise struct field type: behavior versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 04:51:44 2018 From: report at bugs.python.org (Antony Lee) Date: Thu, 25 Oct 2018 08:51:44 +0000 Subject: [New-bugs-announce] [issue35063] Checking for abstractmethod implementation fails to consider MRO for builtins Message-ID: <1540457504.91.0.788709270274.issue35063@psf.upfronthosting.co.za> New submission from Antony Lee : When checking whether a class implements all abstractmethods (to know whether the class can be instantiated), one should only consider methods that come *before* the abstractmethod in the MRO -- methods that come after cannot be said to override the abstractmethod. Indeed, this is currently the case: from abc import ABC, abstractmethod class NeedsFoo(ABC): foo = abstractmethod(lambda self: None) class HasFoo(ABC): foo = lambda self: None class FooImplFirst(HasFoo, NeedsFoo): pass class FooImplSecond(NeedsFoo, HasFoo): pass FooImplFirst() try: FooImplSecond() except TypeError: pass else: raise Exception("Expected error") Here FooImplFirst correctly overrides the foo method (using the HasFoo mixin first), so can be instantiated; FooImplSecond doesn't (by the MRO, FooImplSecond().foo would resolve to the abstract implementation), and we get a TypeError on instantiation. However, this is not the case when considering builtins: from abc import ABC, abstractmethod class NeedsKeys(ABC): keys = abstractmethod(lambda self: None) HasKeys = dict # dict has a keys method. class KeysImplFirst(HasKeys, NeedsKeys): pass class KeysImplSecond(NeedsKeys, HasKeys): pass KeysImplFirst() try: KeysImplSecond() except TypeError: pass else: raise Exception("Expected error") This example differs from the first only by having dict be the mixin that provides the keys method. However, running this example shows that KeysImplSecond() will incorrectly succeed: the ABC machinery does not realize that the keys method has not been overridden. (Alternatively, one could say that "providing the method later in the MRO" is also sufficient; I think that goes against the expectations about ABCs but at least consistency between the non-builtin and builtin cases would be better.) ---------- components: Library (Lib) messages: 328419 nosy: Antony.Lee priority: normal severity: normal status: open title: Checking for abstractmethod implementation fails to consider MRO for builtins versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 06:13:55 2018 From: report at bugs.python.org (STINNER Victor) Date: Thu, 25 Oct 2018 10:13:55 +0000 Subject: [New-bugs-announce] [issue35064] COUNT_ALLOCS build export inc_count() and dec_count() functions which don't have a "Py_" prefix Message-ID: <1540462435.94.0.788709270274.issue35064@psf.upfronthosting.co.za> New submission from STINNER Victor : Extract of Include/object.c: #ifdef COUNT_ALLOCS PyAPI_FUNC(void) inc_count(PyTypeObject *); PyAPI_FUNC(void) dec_count(PyTypeObject *); The "make smelly" fails with 10 symbols: --- $ ./configure --with-pydebug CFLAGS="-D COUNT_ALLOCS -O0" $ make smelly (...) ./python Tools/scripts/smelly.py + nm -p libpython3.8dm.a Ignored symbol types: b, d, r, t Smelly symbol: dec_count (type: T) Smelly symbol: dump_counts (type: T) Smelly symbol: fast_tuple_allocs (type: C) Smelly symbol: get_counts (type: T) Smelly symbol: inc_count (type: T) Smelly symbol: null_strings (type: C) Smelly symbol: one_strings (type: C) Smelly symbol: quick_int_allocs (type: C) Smelly symbol: quick_neg_int_allocs (type: C) Smelly symbol: tuple_zero_allocs (type: C) ERROR: Found 10 smelly symbols! --- These functions should be made private (declared with "static") or get a "Py_" prefix. ---------- components: Interpreter Core messages: 328422 nosy: vstinner priority: normal severity: normal status: open versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 08:32:26 2018 From: report at bugs.python.org (Vincent Michel) Date: Thu, 25 Oct 2018 12:32:26 +0000 Subject: [New-bugs-announce] [issue35065] Reading received data from a closed TCP stream using `StreamReader.read` might hang forever Message-ID: <1540470746.12.0.788709270274.issue35065@psf.upfronthosting.co.za> New submission from Vincent Michel : I'm not sure whether it is intended or not, but I noticed a change in the behavior of `StreamReader` between version 3.7 and 3.8. Basically, reading some received data from a closed TCP stream using `StreamReader.read` might hang forever, under certain conditions. I'm not sure what those conditions are but I managed to reproduce the issue consistently with the following workflow: - server writes some data - client reads a part of the data - client closes the writer - server closes the writer - client tries to read the remaining data The test attached implements the behavior. It fails on 3.8 but passes on 3.7 ---------- components: asyncio files: stuck_on_py38.py messages: 328430 nosy: asvetlov, vxgmichel, yselivanov priority: normal severity: normal status: open title: Reading received data from a closed TCP stream using `StreamReader.read` might hang forever versions: Python 3.8 Added file: https://bugs.python.org/file47891/stuck_on_py38.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 10:33:30 2018 From: report at bugs.python.org (Michael Saah) Date: Thu, 25 Oct 2018 14:33:30 +0000 Subject: [New-bugs-announce] [issue35066] Inconsistency between dangling '%' handling in time.strftime() and datetime.strftime() Message-ID: <1540478010.12.0.788709270274.issue35066@psf.upfronthosting.co.za> New submission from Michael Saah : A call to time.strftime('%') returns '%' A similar call to datetime.utcfromtimestamp(int(time.time()).strftime('%') raises ValueError: strftime format ends with raw % Similar inputs like '%D %' behave similarly. I might take a crack at fixing this, but first I wanted to see what the official guidance is. Seems to me like similar error handling behavior between the functions would be desirable. ---------- components: Library (Lib) messages: 328443 nosy: mjsaah priority: normal severity: normal status: open title: Inconsistency between dangling '%' handling in time.strftime() and datetime.strftime() type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 11:28:59 2018 From: report at bugs.python.org (Steve Dower) Date: Thu, 25 Oct 2018 15:28:59 +0000 Subject: [New-bugs-announce] [issue35067] Use vswhere instead of _distutils_findvs Message-ID: <1540481339.78.0.788709270274.issue35067@psf.upfronthosting.co.za> New submission from Steve Dower : We have much simpler needs for distutils that don't require the more complex build/dependencies we currently have. We should remove the extra native module and just shell out to vswhere.exe, which is always included in the VS installer in a known location. ---------- assignee: steve.dower components: Distutils, Windows messages: 328451 nosy: dstufft, eric.araujo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Use vswhere instead of _distutils_findvs type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 12:58:45 2018 From: report at bugs.python.org (Zackery Spytz) Date: Thu, 25 Oct 2018 16:58:45 +0000 Subject: [New-bugs-announce] [issue35068] [2.7] Possible crashes due to incorrect error handling in pyexpat.c Message-ID: <1540486725.8.0.788709270274.issue35068@psf.upfronthosting.co.za> Change by Zackery Spytz : ---------- components: Extension Modules nosy: ZackerySpytz priority: normal severity: normal status: open title: [2.7] Possible crashes due to incorrect error handling in pyexpat.c type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 15:28:51 2018 From: report at bugs.python.org (James Hewitt) Date: Thu, 25 Oct 2018 19:28:51 +0000 Subject: [New-bugs-announce] [issue35069] Unexecuted import in function causes UnboundLocalError Message-ID: <1540495731.24.0.788709270274.issue35069@psf.upfronthosting.co.za> New submission from James Hewitt : Having 'import logging.config' in an if statement in a function causes a namespace issue, despite the fact that the import is not reached. Example code: --- #!/usr/bin/env python3 # Test weird import bug import logging config = {} config['log'] = {} config['log']['log_type'] = 'file' config['log']['log_file'] = './log' config['log']['config'] = { 'version' : 1 } def do_config_logging(): if config['log']['log_type'] == 'from_config': import logging.config logging.config.dictConfig(config['log']['config']) elif config['log']['log_type'] == 'file': logging.basicConfig(filename=config['log']['log_file']) logging.info("start logging") if __name__ == "__main__": do_config_logging() --- This results in: Traceback (most recent call last): File "./bug.py", line 25, in do_config_logging() File "./bug.py", line 20, in do_config_logging logging.basicConfig(filename=config['log']['log_file']) UnboundLocalError: local variable 'logging' referenced before assignment Notes: This was run on Ubuntu Linux 18.04 Intel 64-bit, Python version 3.6.6 The problem does not occur if the branch is actually taken, and it does not occur if the 'if' statement is not in a function. It also does not occur if 'logging.config' is imported as some other name, eg. 'configlogging'. virtualenv is installed (via the distribution package) but not in use in the test case. ---------- components: Library (Lib) messages: 328470 nosy: jhewitt priority: normal severity: normal status: open title: Unexecuted import in function causes UnboundLocalError type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 15:52:09 2018 From: report at bugs.python.org (Barry A. Warsaw) Date: Thu, 25 Oct 2018 19:52:09 +0000 Subject: [New-bugs-announce] [issue35070] test_posix Message-ID: <1540497129.89.0.788709270274.issue35070@psf.upfronthosting.co.za> New submission from Barry A. Warsaw : It looks like macOS 10.14 Mojave has changed the return value for getgroups(). On 10.13 it returns the set of GIDs give by `id -G` but afaict on 10.14 it returns only the primary GID. $ python3 -c "import os; print(os.getgroups())" [101] $ id -G 101 503 701 501 12 62 80 502 33 98 100 204 250 395 398 This breaks test_posix.py. ---------- components: Library (Lib), macOS messages: 328474 nosy: barry, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: test_posix versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Oct 25 16:20:14 2018 From: report at bugs.python.org (Yhojann Aguilera) Date: Thu, 25 Oct 2018 20:20:14 +0000 Subject: [New-bugs-announce] [issue35071] Canot send real string from c api to module (corrupted string) Message-ID: <1540498814.71.0.788709270274.issue35071@psf.upfronthosting.co.za> New submission from Yhojann Aguilera : The functios like as PyUnicode_FromString use a printf format in char array argument. Example: PyUnicode_FromString("a%22b"); in module interprete the %22 as 22 blank spaces. A double quote in module add a backslash. Poc: Y try send a string from c++ to python string using: PyObject* pyString = PyUnicode_FromString("/abc/def.html/a%22.php?abc=&def=%22;%00s%01"); .... PyObject* pyArgs = Py_BuildValue("(z)", pyString); ... PyObject_CallObject(pFunc, pyArgs); But in script the string is bad: function(data): print(data) The result is: /abc/def.html/a bogus %pp?abc=&def= %;(null)% ---------- components: Library (Lib) messages: 328484 nosy: Yhojann Aguilera priority: normal severity: normal status: open title: Canot send real string from c api to module (corrupted string) type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 00:36:16 2018 From: report at bugs.python.org (Samuel Warfield) Date: Fri, 26 Oct 2018 04:36:16 +0000 Subject: [New-bugs-announce] [issue35072] re.sub does not play nice with chr(92) Message-ID: <1540528576.04.0.788709270274.issue35072@psf.upfronthosting.co.za> New submission from Samuel Warfield : Bug with regex substitutions. When calling the re.sub() method directly char(92), the double backslash charecter as the replacement, throws an exception. Whereas compiling a regex object then calling its own .sub() method works completely fine. I did a quick look through the bug tracker search for similar issues and none were reported. # Breaks re.sub(r'\\\\', chr(92), stringy_thingy) vs # Works parser = re.compile(r'\\\\') parser.sub(chr(92), stringy_thingy) # Where stringy_thingy is a string that is being substituted ---------- components: Regular Expressions messages: 328509 nosy: Samuel Warfield, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: re.sub does not play nice with chr(92) versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 01:31:45 2018 From: report at bugs.python.org (Quentin Agren) Date: Fri, 26 Oct 2018 05:31:45 +0000 Subject: [New-bugs-announce] [issue35073] 'from app import __init__' behaves differently with native import and importlib Message-ID: <1540531905.09.0.788709270274.issue35073@psf.upfronthosting.co.za> New submission from Quentin Agren : I'm running Python 3.6 on Ubuntu 16.04 I don't know if this should qualify as a bug, but I noticed the following behavior difference in the (contrived?) scenario of directly importing '__init__' from a package: ## Setup ## mkdir app echo 'print(f"Executing app/__init__.py as {__name__}")' > app/__init__.py ## Native: executes __init__ *once* ## python -c 'from app import __init__' # Output: # Executing app/__init__.py as app ## Importlib: executes __init__ *twice* ## python -c "import importlib; importlib.import_module('.__init__', 'app')" # Output: # Executing app/__init__.py as app # Executing app/__init__.py as app.__init__ Note in addition that absolute import (either with importlib or native) executes '__init__' twice. ---------- components: Library (Lib) messages: 328512 nosy: qagren priority: normal severity: normal status: open title: 'from app import __init__' behaves differently with native import and importlib type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 02:57:55 2018 From: report at bugs.python.org (Leo Li) Date: Fri, 26 Oct 2018 06:57:55 +0000 Subject: [New-bugs-announce] [issue35074] source install [3.7.1] on debian jessie Message-ID: <1540537075.17.0.788709270274.issue35074@psf.upfronthosting.co.za> New submission from Leo Li : Hi Team, I met the issue consistently on 3.7 and 3.7.1. The configure is well, but when the make will output error messges: step1: [ok] sudo ./configure --prefix=/opt/python3.71 --enable-optimizations step2: make [fail] if test $? -ne 0 ; then \ echo "generate-posix-vars failed" ; \ rm -f ./pybuilddir.txt ; \ exit 1 ; \ fi Could not import runpy module Traceback (most recent call last): File "/opt/Python-3.7.1/Lib/runpy.py", line 15, in import importlib.util File "/opt/Python-3.7.1/Lib/importlib/util.py", line 14, in from contextlib import contextmanager File "/opt/Python-3.7.1/Lib/contextlib.py", line 4, in import _collections_abc SystemError: returned NULL without setting an error generate-posix-vars failed Makefile:595: recipe for target 'pybuilddir.txt' failed make[1]: *** [pybuilddir.txt] Error 1 make[1]: Leaving directory '/opt/Python-3.7.1' Makefile:523: recipe for target 'profile-opt' failed make: *** [profile-opt] Error 2 (venv36) myhost ? Python-3.7.1 gcc --version gcc (Debian 4.9.2-10+deb8u1) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. (venv36) myhost ? Python-3.7.1 uname -a Linux docker 3.16.0-6-amd64 #1 SMP Debian 3.16.57-2 (2018-07-14) x86_64 GNU/Linux Any questions pls mail me. ---------- messages: 328516 nosy: foxleoly priority: normal severity: normal status: open title: source install [3.7.1] on debian jessie type: compile error versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 03:40:43 2018 From: report at bugs.python.org (INADA Naoki) Date: Fri, 26 Oct 2018 07:40:43 +0000 Subject: [New-bugs-announce] [issue35075] Doc: pprint example uses dead URL Message-ID: <1540539643.28.0.788709270274.issue35075@psf.upfronthosting.co.za> New submission from INADA Naoki : https://mail.python.org/pipermail/docs/2018-October/037913.html Dead URL: http://pypi.org/project/Twisted/json Valid URL: https://pypi.org/pypi/Twisted/json But JSON returned by the valid URL seems too long for the example. Is there a better sample JSON we can use in the example? ---------- assignee: docs at python components: Documentation messages: 328517 nosy: docs at python, inada.naoki priority: normal severity: normal status: open title: Doc: pprint example uses dead URL versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 07:56:17 2018 From: report at bugs.python.org (jean-michel) Date: Fri, 26 Oct 2018 11:56:17 +0000 Subject: [New-bugs-announce] [issue35076] FAIL: test_min_max_version (test.test_ssl.ContextTests) with libressl-2.8.2 Message-ID: <1540554977.97.0.788709270274.issue35076@psf.upfronthosting.co.za> New submission from jean-michel : Hi. Python-3.7.1 with LibreSSL-2.8.2 and patches from https://github.com/python/cpython/pull/8055 and https://github.com/python/cpython/pull/8050 Compilation failed because of test_ssl failed. A detailed list of all the patches that I use for my python-3.7.1 compilation with LibreSSL-2.8.2: https://github.com/python/cpython/commit/4254483b21ec534ea942afa4ccd39dcb9bce3794 https://github.com/python/cpython/commit/8352fd3bbeef09cc14af61a0b88a8fcefd2279e3 https://github.com/python/cpython/commit/77d24d830fa4976998ac41b253d06654fae3ed5b https://github.com/python/cpython/commit/2a0961153b15b032bae03f46297e56555e4612ba https://github.com/python/cpython/commit/f415a39463e8bffb338f39d846c3141f3635271c https://github.com/python/cpython/commit/abc1b0aefd79ad8b412d4e74900dd43cdea46f97 https://github.com/python/cpython/commit/3a421ebdefaedb8522cf5ebe86d16a683a580607 https://github.com/python/cpython/commit/d98c1603a1c9583eddab92b30b091a583229fb3f FAIL: test_min_max_version (test.test_ssl.ContextTests) Traceback (most recent call last): File "/tmp/makepkg/python/src/Python-3.7.1/Lib/test/test_ssl.py", line 1163, in test_min_max_version ctx.maximum_version, ssl.TLSVersion.MAXIMUM_SUPPORTED AssertionError: != ---------- assignee: christian.heimes components: SSL files: python-3.7.1-2-libressl-2.8.2-1-WithPatches.txt messages: 328541 nosy: christian.heimes, jean-michel priority: normal severity: normal status: open title: FAIL: test_min_max_version (test.test_ssl.ContextTests) with libressl-2.8.2 type: compile error versions: Python 3.7 Added file: https://bugs.python.org/file47892/python-3.7.1-2-libressl-2.8.2-1-WithPatches.txt _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 11:52:43 2018 From: report at bugs.python.org (coyot linden) Date: Fri, 26 Oct 2018 15:52:43 +0000 Subject: [New-bugs-announce] [issue35077] Make TypeError message less ambiguous Message-ID: <1540569163.5.0.788709270274.issue35077@psf.upfronthosting.co.za> New submission from coyot linden : The TypeError message: TypeError: string indices must be integers is ambiguously written. While some may understand the intent, others will read it as confusingly saying that strings must be integers since dicts among other things do have string indices. Suggest changing the message to: TypeError: indices of strings must be integers ---------- messages: 328565 nosy: coyot priority: normal severity: normal status: open title: Make TypeError message less ambiguous type: enhancement versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 13:26:56 2018 From: report at bugs.python.org (=?utf-8?b?U3Jpbml2YXMgIFJlZGR5IFRoYXRpcGFydGh5KOCwtuCxjeCwsOCxgOCwqA==?= =?utf-8?b?4LC/4LC14LC+4LC44LGNIOCwsOCxhuCwoeCxjeCwoeCwvyDgsKTgsL7gsJ8=?= =?utf-8?b?4LC/4LCq4LCw4LGN4LCk4LC/KQ==?=) Date: Fri, 26 Oct 2018 17:26:56 +0000 Subject: [New-bugs-announce] [issue35078] Allow customization of css class name of a month in calendar module Message-ID: <1540574816.58.0.788709270274.issue35078@psf.upfronthosting.co.za> Change by Srinivas Reddy Thatiparthy(?????????? ?????? ?????????) : ---------- components: Library (Lib) nosy: thatiparthy priority: normal severity: normal status: open title: Allow customization of css class name of a month in calendar module versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 15:00:41 2018 From: report at bugs.python.org (Springem Springsbee) Date: Fri, 26 Oct 2018 19:00:41 +0000 Subject: [New-bugs-announce] [issue35079] difflib.SequenceMatcher.get_matching_blocks omits common strings Message-ID: <1540580441.56.0.788709270274.issue35079@psf.upfronthosting.co.za> New submission from Springem Springsbee : Hello, I'm using difflib's SequenceMatcher to locate common substrings. It seems like the matcher is missing a common substrings. I'm guessing this is a rather low-level issue in difflib. The autojunk parameter has no effect for obvious reasons. Alternate pairwise comparisons between the following 3 strings omit the 2-character match 'AC' GATTACA TAGACCA ATACA The following Github gist captures the issue, which I'll repeat here for redundancy https://gist.github.com/MatthewRalston/b0ab6ac1dbe322cb12063310ccdbb786 >import difflib >string1 = "TAGACCA" >string2 = "ATACA" >s = difflib.SequenceMatcher(None, string1, string2) >blox = s.get_matching_blocks() >print(blox) [Match(a=0, b=1, size=2), Match(a=5, b=3, size=2), Match(a=7, b=5, size=0)] # Missing Match(a=3, b=2, size=2) >print([string1[x.a:x.a+x.size] for x in blox if x.size > 1]) ['TA', 'CA'] # Missing the substring 'CA' ---------- components: Library (Lib) messages: 328593 nosy: Springem Springsbee, terry.reedy priority: normal severity: normal status: open title: difflib.SequenceMatcher.get_matching_blocks omits common strings type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 19:35:56 2018 From: report at bugs.python.org (Maxime Belanger) Date: Fri, 26 Oct 2018 23:35:56 +0000 Subject: [New-bugs-announce] [issue35080] The tests for the `dis` module can be too rigid when changing opcodes Message-ID: <1540596956.61.0.788709270274.issue35080@psf.upfronthosting.co.za> New submission from Maxime Belanger : For various reasons, one may want to change the `Lib/opcode.py` module. In doing so, this has caused us to frequently rewrite `test_dis.py`. It would be great if those tests used `dis.opmap` rather than hard-coded/magic numbers, as this would allow easier changes. ---------- messages: 328615 nosy: Maxime Belanger priority: normal severity: normal status: open title: The tests for the `dis` module can be too rigid when changing opcodes type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Oct 26 20:42:24 2018 From: report at bugs.python.org (STINNER Victor) Date: Sat, 27 Oct 2018 00:42:24 +0000 Subject: [New-bugs-announce] [issue35081] Rename Include/internals/ to Include/pycore/ Message-ID: <1540600944.05.0.788709270274.issue35081@psf.upfronthosting.co.za> New submission from STINNER Victor : Currently, #include "pymem.h" may include Include/pymem.h or Include/internal/pymem.h depending where is the C file (.c) and if Include/internal/ is in the header search path or not. I propose to: * Rename Include/internal/ to Include/pycore/ * In this subdirectory, rename xxx.h to pycore_xxx.h to avoid any risk of confusion * Automatically include pycore_xxx.h in xxx.h if Py_BUILD_CORE is defined: this should avoid the need of explicit #include "internal/xxx.h" in C files For example, Include/internal/pystate.h becomes Include/pycore/pycore_pystate.h. Attached PR implements this idea. I chose to rename "internal" subdirectory to "pycore" to prepare the addition of other subdirectories. See: * https://pythoncapi.readthedocs.io/split_include.html * https://pythoncapi.readthedocs.io/ Next steps: * Move all code surrounded by #ifdef Py_BUILD_CORE from Include/*.h into Include/pycore/*.h: see the second commit of my PR for an example * Move core surrounded by #ifndef Py_LIMITED_API from Include/*.h into Include/limited/ (example of filename: Include/limited/limited_object.h) This change should be backward compatible since Include/internal/ must not be used outside CPython core. If someone does that, well, be ready for breakage :-) It's not supported. ---------- components: Interpreter Core messages: 328619 nosy: vstinner priority: normal severity: normal status: open title: Rename Include/internals/ to Include/pycore/ versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 27 06:45:10 2018 From: report at bugs.python.org (Mario Corchero) Date: Sat, 27 Oct 2018 10:45:10 +0000 Subject: [New-bugs-announce] [issue35082] Mock.__dir__ lists deleted attributes Message-ID: <1540637110.3.0.788709270274.issue35082@psf.upfronthosting.co.za> New submission from Mario Corchero : Calling dir on unittest.mock.Mock will return deleted attributes. This is a result of the way del is implemented in Mock, which just sets a sentinel in the child mocks, so an AttributeError is raised if the attribute is later accessed. We can just check for such sentinel in the __dir__ method and not return those. ---------- components: Library (Lib) messages: 328647 nosy: mariocj89 priority: low severity: normal status: open title: Mock.__dir__ lists deleted attributes type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 27 16:14:41 2018 From: report at bugs.python.org (Joy Diamond) Date: Sat, 27 Oct 2018 20:14:41 +0000 Subject: [New-bugs-announce] [issue35083] Fix documentation for __instancecheck__ Message-ID: <1540671281.62.0.788709270274.issue35083@psf.upfronthosting.co.za> New submission from Joy Diamond : This is a request to fix the documentation for __instancecheck__. Please add the following: """ (Note that any object `x` is always considered to be an instance of `type(x)`, and this cannot be overridden.) """ Consider the following program: class M(type): def __instancecheck__(m, t): print('instancecheck(%s, %s)' % (m, t)) return False # LIE! Test = M('Test', ((object,)), {}) something = Test() print('Does *NOT* call __instancecheck__:') print('isinstance(something, Test): %s' % isinstance(something, Test)) print() print('Does call __instancecheck__:') print('isinstance(0, Test): %s' % isinstance(0, Test)) Under python 2, python 3, and pypy, in all cases, the first examples does *NOT* call __instancecheck__. You can see the optimization here: https://github.com/python/cpython/blob/master/Objects/abstract.c#L2397-L2405 Which reads: int PyObject_IsInstance(PyObject *inst, PyObject *cls) { _Py_IDENTIFIER(__instancecheck__); PyObject *checker; /* Quick test for an exact match */ if (Py_TYPE(inst) == (PyTypeObject *)cls) return 1; I'm fine with the optimization -- I am not suggesting to get rid of it. I just want the documentation to match the actual implementation. The following documentation needs to be fixed: https://docs.python.org/2/reference/datamodel.html https://docs.python.org/3/reference/datamodel.html https://www.python.org/dev/peps/pep-3119/ It took me half an hour to figure out why my version of __instancecheck__ was not working, as I tried to test it using the super simple code above ... One of the best things about python is how accurate and consistent the documentation is. This request is to keep these high standards. ---------- assignee: docs at python components: Documentation messages: 328658 nosy: docs at python, joydiamond priority: normal severity: normal status: open title: Fix documentation for __instancecheck__ type: enhancement versions: Python 2.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 27 19:49:55 2018 From: report at bugs.python.org (TestUser) Date: Sat, 27 Oct 2018 23:49:55 +0000 Subject: [New-bugs-announce] [issue35084] binascii.Error: Incorrect padding Message-ID: <1540684195.55.0.788709270274.issue35084@psf.upfronthosting.co.za> New submission from TestUser : The below "test.code1" is not base64 encoded. Though, it is a good file. t:~$ python3 -m base64 -d test.code1 Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/python3.6/base64.py", line 602, in main() File "/usr/lib/python3.6/base64.py", line 586, in main func(f, sys.stdout.buffer) File "/usr/lib/python3.6/base64.py", line 512, in decode s = binascii.a2b_base64(line) binascii.Error: Incorrect padding ---------- components: Library (Lib) messages: 328664 nosy: Tester priority: normal severity: normal status: open title: binascii.Error: Incorrect padding type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 27 20:06:56 2018 From: report at bugs.python.org (TestUser) Date: Sun, 28 Oct 2018 00:06:56 +0000 Subject: [New-bugs-announce] [issue35085] FileNotFoundError: [Errno 2] No such file or directory: Message-ID: <1540685216.33.0.788709270274.issue35085@psf.upfronthosting.co.za> New submission from TestUser : Seems the base64 module has issues with bad file(s). This does not seems to generate a Crash Report. t:~$ python3 -m base64 -d "12s345a2" Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/python3.6/base64.py", line 602, in main() File "/usr/lib/python3.6/base64.py", line 585, in main with open(args[0], 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: '12s345a2' test at TestNut:~$ python3 -m base64 -d /test.txt Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/python3.6/base64.py", line 602, in main() File "/usr/lib/python3.6/base64.py", line 585, in main with open(args[0], 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: '/test.txt' ---------- components: Library (Lib) messages: 328666 nosy: Tester priority: normal severity: normal status: open title: FileNotFoundError: [Errno 2] No such file or directory: versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 27 21:04:56 2018 From: report at bugs.python.org (Daniel Lovell) Date: Sun, 28 Oct 2018 01:04:56 +0000 Subject: [New-bugs-announce] [issue35086] tkinter docs: errors in A Simple Hello World Program Message-ID: <1540688696.85.0.788709270274.issue35086@psf.upfronthosting.co.za> New submission from Daniel Lovell : In the documentation for tkinter, "A Simple Hello World Program" Application class does not hold onto the master Tk() instance as a class attribute. This is a good practice, and newcomers to tkinter would likely have trouble closing the window without this since root will almost never be in the global namespace. The original example: """"" import tkinter as tk class Application(tk.Frame): def __init__(self, master=None): super().__init__(master) self.pack() self.create_widgets() def create_widgets(self): self.hi_there = tk.Button(self) self.hi_there["text"] = "Hello World\n(click me)" self.hi_there["command"] = self.say_hi self.hi_there.pack(side="top") self.quit = tk.Button(self, text="QUIT", fg="red", command=root.destroy) self.quit.pack(side="bottom") def say_hi(self): print("hi there, everyone!") root = tk.Tk() app = Application(master=root) app.mainloop() """" The proposed fix: """" import tkinter as tk class Application(tk.Frame): def __init__(self, master=None): super().__init__(master) self.master = master self.pack() self.create_widgets() def create_widgets(self): self.hi_there = tk.Button(self) self.hi_there["text"] = "Hello World\n(click me)" self.hi_there["command"] = self.say_hi self.hi_there.pack(side="top") self.quit = tk.Button(self, text="QUIT", fg="red", command=self.master.destroy) self.quit.pack(side="bottom") def say_hi(self): print("hi there, everyone!") def main(): root = tk.Tk() app = Application(master=root) app.mainloop() if __name__ == "__main__": main() """" ---------- components: Tkinter files: tkinter_hello_world_issue.png messages: 328669 nosy: NuclearLemon priority: normal severity: normal status: open title: tkinter docs: errors in A Simple Hello World Program type: enhancement versions: Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47894/tkinter_hello_world_issue.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Oct 27 23:16:45 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Sun, 28 Oct 2018 03:16:45 +0000 Subject: [New-bugs-announce] [issue35087] IDLE: update idlelib help files for current doc build Message-ID: <1540696605.72.0.788709270274.issue35087@psf.upfronthosting.co.za> New submission from Terry J. Reedy : https://docs.python.org/3.6/library/idle.html starts with '25.5 IDLE'. https://docs.python.org/3.7/library/idle.html starts with 'IDLE'. The chapter and sections numbers are gone. The current idlelib/help.html was copied (and stripped) from a Doc/build/library/idle.html built from the current Doc/library/idle.rst with Sphinx 1.7.4. It was merged 2018 June 10. See #33610. Headers have chapter-section numbers. (The chapter number is detected on the first line and removed from all headers before display.) When I changed idle.rst on a branch of master and rebuilt the docs with 1.7.4, there were over 100 warnings about an unknown doctest directive 'skipif'. When I upgraded to Sphinx 1.8.1, the warnings disappeared, and so did the chapter-section numbers. So it appears that the 3.7+ docs are meant to be built, and 3.7+ online docs are being built, with the newer Sphinx. I am not sure of whether the loss of numbers is intentional and permanent, but for the present, I will use the 1.8 versions of idle.html and the derived help.html. idlelib/help.html is currently the same for all of 3.6 to 3.8, so one diff can be merged and back-ported. help.py is also the same for all 3 versions. But the loss of numbers breaks it. The upcoming patch will also fix this (but not immediately delete the code that handles numbers. For the moment, I will replace the numbers in the Table of Contents with indents. ---------- assignee: terry.reedy components: IDLE messages: 328670 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: update idlelib help files for current doc build type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 00:48:58 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Sun, 28 Oct 2018 04:48:58 +0000 Subject: [New-bugs-announce] [issue35088] Update idlelib.help.copy_string docstring Message-ID: <1540702138.58.0.788709270274.issue35088@psf.upfronthosting.co.za> New submission from Terry J. Reedy : The current docstring still refers to hg and forward merging. ---------- assignee: terry.reedy components: IDLE messages: 328671 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: Update idlelib.help.copy_string docstring type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 07:40:23 2018 From: report at bugs.python.org (Sebastian Rittau) Date: Sun, 28 Oct 2018 11:40:23 +0000 Subject: [New-bugs-announce] [issue35089] Remove typing.io and typing.re from documentation Message-ID: <1540726823.63.0.788709270274.issue35089@psf.upfronthosting.co.za> New submission from Sebastian Rittau : Per the discussion in https://github.com/python/typing/issues/589 and https://github.com/python/typeshed/issues/1652, IO, BinaryIO, TextIO, Pattern, and Match should be imported directly from typing, not from typing.io and typing.re. The documentation needs to be adjusted accordingly. ---------- assignee: docs at python components: Documentation messages: 328683 nosy: docs at python, srittau priority: normal severity: normal status: open title: Remove typing.io and typing.re from documentation _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 08:13:54 2018 From: report at bugs.python.org (Alexey Izbyshev) Date: Sun, 28 Oct 2018 12:13:54 +0000 Subject: [New-bugs-announce] [issue35090] bz2: Potential division by zero in BZ2_Malloc() Message-ID: <1540728834.21.0.788709270274.issue35090@psf.upfronthosting.co.za> New submission from Alexey Izbyshev : BZ2_Malloc() checks for size < 0 at https://github.com/python/cpython/blob/6015cc50bc38b9e920ce4986ee10658eaa14f561/Modules/_bz2module.c#L278 , but doesn't check for size == 0 before dividing by it: if (items < 0 || size < 0) return NULL; if ((size_t)items > (size_t)PY_SSIZE_T_MAX / (size_t)size) return NULL; Reported by Svace static analyzer. ---------- components: Extension Modules messages: 328686 nosy: berker.peksag, izbyshev, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: bz2: Potential division by zero in BZ2_Malloc() type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 09:40:23 2018 From: report at bugs.python.org (Alexey Izbyshev) Date: Sun, 28 Oct 2018 13:40:23 +0000 Subject: [New-bugs-announce] [issue35091] Objects/listobject.c: gallop functions rely on signed integer overflow Message-ID: <1540734023.23.0.788709270274.issue35091@psf.upfronthosting.co.za> New submission from Alexey Izbyshev : gallop_left() and gallop_right() functions explicitly rely on overflowing behavior of Py_ssize_t (https://github.com/python/cpython/blob/6015cc50bc38b9e920ce4986ee10658eaa14f561/Objects/listobject.c#L1361): ofs = (ofs << 1) + 1; if (ofs <= 0) /* int overflow */ ofs = maxofs; Signed integer overflow is undefined in C, and the above is guaranteed to work only if compiler-specific workarounds are applied, such as GCC's -fwrapv (that is what CPython does). Without such workarounds the compiler would be free to remove the if statement. ---------- components: Interpreter Core messages: 328688 nosy: berker.peksag, izbyshev, pitrou, serhiy.storchaka priority: normal severity: normal status: open title: Objects/listobject.c: gallop functions rely on signed integer overflow type: behavior versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 11:08:18 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Sun, 28 Oct 2018 15:08:18 +0000 Subject: [New-bugs-announce] [issue35092] test_socket fails in MacOS High Sierra when running with -Werror Message-ID: <1540739298.61.0.788709270274.issue35092@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : .... ====================================================================== ERROR: testCmsgTruncLen0Plus1 (test.test_socket.RecvmsgIntoSCMRightsStreamTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/pgalindo3/github/cpython/Lib/test/test_socket.py", line 3387, in testCmsgTruncLen0Plus1 self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(0) + 1, maxdata=1) File "/Users/pgalindo3/github/cpython/Lib/test/test_socket.py", line 3362, in checkTruncatedArray len(MSG), ancbuf) File "/Users/pgalindo3/github/cpython/Lib/test/test_socket.py", line 2436, in doRecvmsg result = sock.recvmsg_into([buf], *args) RuntimeWarning: received malformed or improperly-truncated ancillary data ====================================================================== ERROR: testCmsgTruncLen1 (test.test_socket.RecvmsgIntoSCMRightsStreamTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/pgalindo3/github/cpython/Lib/test/test_socket.py", line 3394, in testCmsgTruncLen1 maxdata=SIZEOF_INT) File "/Users/pgalindo3/github/cpython/Lib/test/test_socket.py", line 3362, in checkTruncatedArray len(MSG), ancbuf) File "/Users/pgalindo3/github/cpython/Lib/test/test_socket.py", line 2436, in doRecvmsg result = sock.recvmsg_into([buf], *args) RuntimeWarning: received malformed or improperly-truncated ancillary data ====================================================================== ERROR: testCmsgTruncLen2Minus1 (test.test_socket.RecvmsgIntoSCMRightsStreamTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/pgalindo3/github/cpython/Lib/test/test_socket.py", line 3401, in testCmsgTruncLen2Minus1 maxdata=(2 * SIZEOF_INT) - 1) File "/Users/pgalindo3/github/cpython/Lib/test/test_socket.py", line 3362, in checkTruncatedArray len(MSG), ancbuf) File "/Users/pgalindo3/github/cpython/Lib/test/test_socket.py", line 2436, in doRecvmsg result = sock.recvmsg_into([buf], *args) RuntimeWarning: received malformed or improperly-truncated ancillary data ---------------------------------------------------------------------- Ran 555 tests in 24.708s FAILED (errors=8, skipped=142) test test_socket failed test_socket failed 1 test failed: test_socket Total duration: 25 sec Tests result: FAILURE ---------- components: macOS messages: 328690 nosy: ned.deily, pablogsal, ronaldoussoren priority: normal severity: normal status: open title: test_socket fails in MacOS High Sierra when running with -Werror versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 14:42:09 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Sun, 28 Oct 2018 18:42:09 +0000 Subject: [New-bugs-announce] [issue35093] IDLE: document the help document viewer Message-ID: <1540752129.6.0.788709270274.issue35093@psf.upfronthosting.co.za> New submission from Terry J. Reedy : Implement issue 33396 item 6: document the IDLE Doc viewer. ---------- assignee: docs at python components: Documentation, IDLE messages: 328725 nosy: docs at python, terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: document the help document viewer type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 15:00:35 2018 From: report at bugs.python.org (Paul Crowley) Date: Sun, 28 Oct 2018 19:00:35 +0000 Subject: [New-bugs-announce] [issue35094] Improved algorithms for random.sample Message-ID: <1540753235.51.0.788709270274.issue35094@psf.upfronthosting.co.za> New submission from Paul Crowley : random.sample currently uses either a Fisher-Yates shuffle, or rejection sampling, to achieve sampling without replacement. I propose using reservoir sampling or "cardchoose"; these are similar performance or sometimes faster, and don't need to allocate anything except the list used for the results. ---------- components: Library (Lib) messages: 328728 nosy: ciphergoth priority: normal severity: normal status: open title: Improved algorithms for random.sample type: resource usage versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 15:17:21 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Sun, 28 Oct 2018 19:17:21 +0000 Subject: [New-bugs-announce] [issue35095] Implement pathlib.Path.append_bytes and pathlib.Path.append_text Message-ID: <1540754241.69.0.788709270274.issue35095@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : Right now we have: Path.read_bytes Path.read_text Path.write_bytes Path.write_text as opening the file, appending something and closing the file is also a very typical operation to do it would be nice to have: Path.append_bytes Path.append_text ---------- components: Library (Lib) messages: 328730 nosy: pablogsal priority: normal severity: normal status: open title: Implement pathlib.Path.append_bytes and pathlib.Path.append_text versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 19:49:09 2018 From: report at bugs.python.org (Lysandros Nikolaou) Date: Sun, 28 Oct 2018 23:49:09 +0000 Subject: [New-bugs-announce] [issue35096] Change _PY_VERSION to derive from sys.version_info in sysconfig Message-ID: <1540770549.89.0.788709270274.issue35096@psf.upfronthosting.co.za> New submission from Lysandros Nikolaou : In sysconfig.py there is a comment starting with FIXME that states that _PY_VERSION should get its value from sys.version_info instead of sys.version, because it is an implementation detail. Should this be changed? If so, I would like to create a PR. ---------- messages: 328769 nosy: lys.nikolaou priority: normal severity: normal status: open title: Change _PY_VERSION to derive from sys.version_info in sysconfig versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 20:02:38 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 29 Oct 2018 00:02:38 +0000 Subject: [New-bugs-announce] [issue35097] IDLE add doc subsection for editor windows Message-ID: <1540771358.38.0.788709270274.issue35097@psf.upfronthosting.co.za> New submission from Terry J. Reedy : Briefly explain opening a file, running code, and the title and status bars. ---------- assignee: terry.reedy components: IDLE messages: 328771 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE add doc subsection for editor windows type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 20:16:25 2018 From: report at bugs.python.org (Joy Diamond) Date: Mon, 29 Oct 2018 00:16:25 +0000 Subject: [New-bugs-announce] [issue35098] Deleting __new__ does not restore previous behavior Message-ID: <1540772185.07.0.788709270274.issue35098@psf.upfronthosting.co.za> New submission from Joy Diamond : Related: https://bugs.python.org/issue5322 Consider the following program: class Color(object): __slots__ = (('name',)) def __init__(self, name): self.name = name green = Color('green') # Works assert green.name == 'green' Color.__new__ = 0 del Color.__new__ red = Color('red') # Fails in Python 3; works in Python 2 & pypy assert red.name == 'red' This works in Python 2, pypy, but fails in Python 3 as follows: Traceback (most recent call last): File "x.py", line 13, in red = Color('red') # Fails in Python 3; works in Python 2 & pypy TypeError: object() takes no parameters ---------- messages: 328773 nosy: joydiamond priority: normal severity: normal status: open title: Deleting __new__ does not restore previous behavior versions: Python 3.5, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 23:25:13 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 29 Oct 2018 03:25:13 +0000 Subject: [New-bugs-announce] [issue35099] IDLE: say more about Shell - console differences Message-ID: <1540783513.03.0.788709270274.issue35099@psf.upfronthosting.co.za> New submission from Terry J. Reedy : Differences added in initial PR: * threading.activeCount()`` returns 2 instead of 1; * run user code in separate process; * user-created subprocesses do not inherit sys.stdxxx objects; must run IDLE from console for such to have i/o connection; * Shell ignores anything after first statement in pasted code. Dependencies Issue #23220 added the "IDLE-console differences" subsection to IDLE doc. Discussing 'Shell not a terminal' left for another patch. Issue 33000 is about finite versus infinite buffer. Or should any of these be in new Shell subsection? ---------- assignee: terry.reedy components: IDLE messages: 328785 nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: say more about Shell - console differences type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Oct 28 23:55:54 2018 From: report at bugs.python.org (Henry Zhu) Date: Mon, 29 Oct 2018 03:55:54 +0000 Subject: [New-bugs-announce] [issue35100] urllib.parse.unquote_to_bytes: needs "escape plus" option Message-ID: <1540785354.09.0.788709270274.issue35100@psf.upfronthosting.co.za> New submission from Henry Zhu : `urllib.parse.unquote_to_bytes` should have an "escape plus" option, just like `urllib.parse.unquote_plus` does. It's very necessary in some cases: ``` # Say I have a url string: 'a+%2b%c0'. # In Python2, I can parse it into b'a +\xc0' with urllib.unquote_plus. # Note that the first "+" was escaped into space, and the second "+" was decoded from "%2b". # But in Python3, this just can't be done, either with urllib.parse.unquote, urllib.par.unquote_plus or urllib.parse.unquote_to_bytes. # This is the example: >>> from urllib import parse >>> s = 'a+%2b%c0' >>> parse.unquote(s) 'a++?' >>> parse.unquote_plus(s) 'a +?' >>> parse.unquote_to_bytes(s) b'a++\xc0' ``` PS: the character "?" should be "?", but it can't be shown in command line. The result of `urllib.parse.unquote_to_bytes` is almost what I want, except that it doesn't escape the first "+" into space. ---------- components: Library (Lib) messages: 328786 nosy: Henry Zhu priority: normal severity: normal status: open title: urllib.parse.unquote_to_bytes: needs "escape plus" option type: enhancement versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 29 00:17:50 2018 From: report at bugs.python.org (orlnub123) Date: Mon, 29 Oct 2018 04:17:50 +0000 Subject: [New-bugs-announce] [issue35101] inspect.findsource breaks on class frame objects Message-ID: <1540786670.85.0.788709270274.issue35101@psf.upfronthosting.co.za> New submission from orlnub123 : If you pass a frame object belonging to a class into findsource, it'll incorrectly give you the starting line number of the first function above it or 0 if no functions are defined. Here's some code to reproduce the issue: import inspect def test_func(): ... # This should not get printed class Test: frame = inspect.currentframe() print(inspect.getsource(Test.frame)) # Depends on findsource This unexpectedly prints the source of test_func instead of the class right below it. ---------- components: Library (Lib) messages: 328788 nosy: orlnub123 priority: normal severity: normal status: open title: inspect.findsource breaks on class frame objects type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 29 04:21:02 2018 From: report at bugs.python.org (jimmy) Date: Mon, 29 Oct 2018 08:21:02 +0000 Subject: [New-bugs-announce] [issue35102] Struct pack() Message-ID: <1540801262.05.0.788709270274.issue35102@psf.upfronthosting.co.za> New submission from jimmy : The result of variable "a" should be b'30\x11\x00\x00' not b'0\x11\x00\x00' . >>> import struct >>> a = struct.pack(">> print(a) b'0\x11\x00\x00' >>> ---------- messages: 328794 nosy: jimmy priority: normal severity: normal status: open title: Struct pack() _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 29 04:59:54 2018 From: report at bugs.python.org (=?utf-8?b?VG9tw6HFoSBIZXJhbg==?=) Date: Mon, 29 Oct 2018 08:59:54 +0000 Subject: [New-bugs-announce] [issue35103] format_exception() doesn't work with PyErr_Fetch Message-ID: <1540803594.22.0.788709270274.issue35103@psf.upfronthosting.co.za> New submission from Tom?? Heran : When embedding Python into a C/C++ based programs, one of the ways to access the formatted traceback is/was to get the type, value and tb by calling the C API PyErr_Fetch() and then call native Python traceback.format_exception() function to get a list of strings representing the tracback. This worked fine in 2.7. Doing the same in 3.5 doesn't work because: 1. PyErr_Fetch()'s middle output argument 'value' is not an instance of Exception (or a subclass), but rather (what seems to me) a __str__ or __repr__ (i.e. the type is str) of said raised exception. An aside - this seems to be the case both in 2.7 and 3.5, but differs (in both 2.7 and 3.5, I believe) from what sys.exc_info() returns, as there the middle output 'value' is of an Exception (or a subclass) type. 2. In the overhauled traceback module in 3.x, functions like format_exception() now use an internal class TracebackException which expects the exc_value (which it gets from format_exception()'s value argument) to be an instance of Exception (or a subclass), thus feeding traceback.format_exception() whatever I got from PyErr_Fetch() ends up throwing another exception. As a temporary workaround, I can use traceback.format_tb() which luckily doesn't use the TracebackException class and works fine in 3.5. ---------- messages: 328796 nosy: tomasheran priority: normal severity: normal status: open title: format_exception() doesn't work with PyErr_Fetch versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 29 07:30:06 2018 From: report at bugs.python.org (Tal Einat) Date: Mon, 29 Oct 2018 11:30:06 +0000 Subject: [New-bugs-announce] [issue35104] IDLE: On macOS, Command-M minimizes & opens "Open Module..." Message-ID: <1540812606.17.0.788709270274.issue35104@psf.upfronthosting.co.za> New submission from Tal Einat : On macOS, Command-M simultaneously minimizes the window and opens the "Open Module..." dialog. This happens with a very confusing sequence of visual effects (see attached animated gif). This doesn't happen when activating either of the menu items; only when using the keyboard shortcut. Tested with current master (3.8.0a0, 53835e92d3). ---------- assignee: terry.reedy components: IDLE files: command-M.gif messages: 328802 nosy: taleinat, terry.reedy priority: normal severity: normal stage: needs patch status: open title: IDLE: On macOS, Command-M minimizes & opens "Open Module..." type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file47895/command-M.gif _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 29 08:24:51 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 29 Oct 2018 12:24:51 +0000 Subject: [New-bugs-announce] [issue35105] Document that CPython accepts "invalid" identifiers Message-ID: <1540815891.13.0.788709270274.issue35105@psf.upfronthosting.co.za> New submission from STINNER Victor : The Python 3 language has a strict definition for an identifier: https://docs.python.org/dev/reference/lexical_analysis.html#identifiers ... but in practice, it's possible to create "invalid" identifiers using setattr(). Example with PyPy: $ pypy Python 2.7.13 (0e7ea4fe15e82d5124e805e2e4a37cae1a402d4b, Apr 12 2018, 14:50:12) >>>> class A: pass >>>> >>>> a=A() >>>> setattr(a, "1", 2) >>>> getattr(a, "1") 2 >>>> vars(a) {'1': 2} >>>> a.__dict__ {'1': 2} >>>> a.1 File "", line 1 a.1 ^ SyntaxError: invalid syntax The exact definition of "identifiers" is a common question. Recent examples: * bpo-25205 * [Python-Dev] Arbitrary non-identifier string keys when using **kwargs https://mail.python.org/pipermail/python-dev/2018-October/155435.html It would be nice to document the answer. Maybe in the Langage Specification, maybe in the setattr() documentation, maybe in a FAQ, maybe everywhere? ---------- assignee: docs at python components: Documentation messages: 328816 nosy: docs at python, serhiy.storchaka, steven.daprano, vstinner priority: normal severity: normal status: open title: Document that CPython accepts "invalid" identifiers versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 29 14:20:27 2018 From: report at bugs.python.org (Joy Diamond) Date: Mon, 29 Oct 2018 18:20:27 +0000 Subject: [New-bugs-announce] [issue35106] Add documentation for `type.__subclasses__` to docs.python.org Message-ID: <1540837227.59.0.788709270274.issue35106@psf.upfronthosting.co.za> New submission from Joy Diamond : Add documentation for `type.__subclasses__` to docs.python.org Python ideas discussion: https://mail.python.org/pipermail/python-ideas/2018-October/054361.html ---------- assignee: docs at python components: Documentation messages: 328848 nosy: docs at python, joydiamond priority: normal severity: normal status: open title: Add documentation for `type.__subclasses__` to docs.python.org versions: Python 2.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Oct 29 18:26:38 2018 From: report at bugs.python.org (Gregory P. Smith) Date: Mon, 29 Oct 2018 22:26:38 +0000 Subject: [New-bugs-announce] [issue35107] untokenize() fails on tokenize output when a newline is missing Message-ID: <1540851998.41.0.788709270274.issue35107@psf.upfronthosting.co.za> New submission from Gregory P. Smith : The behavior change introduced in 3.6.7 and 3.7.1 via https://bugs.python.org/issue33899 has further consequences: ```python >>> tokenize.untokenize(tokenize.generate_tokens(io.StringIO('#').readline)) Traceback (most recent call last): File "", line 1, in File ".../cpython/cpython-upstream/Lib/tokenize.py", line 332, in untokenize out = ut.untokenize(iterable) File ".../cpython/cpython-upstream/Lib/tokenize.py", line 266, in untokenize self.add_whitespace(start) File ".../cpython/cpython-upstream/Lib/tokenize.py", line 227, in add_whitespace raise ValueError("start ({},{}) precedes previous end ({},{})" ValueError: start (1,1) precedes previous end (2,0) ``` The same goes for using the documented tokenize API (`generate_tokens` is not documented): ``` tokenize.untokenize(tokenize.tokenize(io.BytesIO(b'#').readline)) ... ValueError: start (1,1) precedes previous end (2,0) ``` `untokenize()` is no longer able to work on output of `generate_tokens()` if the input to generate_tokens() did not end in a newline. Today's workaround: Always append a newline if one is missing to the line that the readline callable passed to tokenize or generate_tokens returns. Very annoying to implement. ---------- messages: 328876 nosy: ammar2, gregory.p.smith, meador.inge, taleinat, terry.reedy priority: normal severity: normal status: open title: untokenize() fails on tokenize output when a newline is missing versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 04:20:35 2018 From: report at bugs.python.org (Roman Inflianskas) Date: Tue, 30 Oct 2018 08:20:35 +0000 Subject: [New-bugs-announce] [issue35108] inspect.getmembers passes exceptions from object's properties through Message-ID: <1540887635.53.0.788709270274.issue35108@psf.upfronthosting.co.za> New submission from Roman Inflianskas : I use inspect.getmembers for getting members of splinter.webdriver.BaseWebDriver. The problem is that it has a property status_code raises NotImplementedError: https://github.com/cobrateam/splinter/blob/master/splinter/driver/webdriver/__init__.py#L191. This exception passes through try block in https://github.com/python/cpython/blob/master/Lib/inspect.py#L343 because it doesn't contain: except Exception: pass section. In the result, instead of members of the object, I get an exception. I think there are two possible expected behaviors: 1. Just ignore the exceptions and return members without the members, that raise exceptions. 2. Instead of members, return tuple like: ... try: ... except Exception as e: RAISES_EXCEPTION = object() value = (RAISES_EXCEPTION, e) ... ---------- components: Library (Lib) messages: 328885 nosy: rominf priority: normal severity: normal status: open title: inspect.getmembers passes exceptions from object's properties through type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 04:34:25 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Tue, 30 Oct 2018 08:34:25 +0000 Subject: [New-bugs-announce] [issue35109] Doctest in CI uses python binary built from master causing DeprecationWarnings Message-ID: <1540888465.31.0.788709270274.issue35109@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : Currently we run doctest in CI and we use the environment variable PYTHON to get the path of python binary to be used for virtualenv creation. We set PYTHON=../python in .travis.yml at [0] before running tests thus this causes the CI to use development version of the binary. Some of the modules used for doctest have incompatible changes related to importing from collections. The DeprecationWarning related code will be removed in 3.8 thus it will cause the doctest to fail while using the modules in CI. Since I have enabled -W in issue34081 they are visible now. I propose using stable version of Python like python 3.7 so that when we remove collections import related code in master the doctest doesn't fail on Travis. There are respective PRs for this warnings in the repo but using stable version will fix this. We don't need to test the modules against the master branch of Python for doctest which is currently doing. Sample warning : https://travis-ci.org/python/cpython/jobs/448195459#L2603 > /home/travis/build/python/cpython/Doc/venv/lib/python3.8/site-packages/babel/localedata.py:17: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working > from collections import MutableMapping On local machine the .travis.yml is not executed thus it uses PYTHON=python3 in Doc/Makefile and thus this not a problem locally building the docs that uses a stable version of Python. Adding @mdk for feedback on this. [0] https://github.com/python/cpython/blob/master/.travis.yml#L164 ---------- assignee: docs at python components: Build, Documentation messages: 328886 nosy: docs at python, mdk, xtreak priority: normal severity: normal status: open title: Doctest in CI uses python binary built from master causing DeprecationWarnings versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 05:40:33 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 30 Oct 2018 09:40:33 +0000 Subject: [New-bugs-announce] [issue35110] Fix more spaces around hyphens and dashes Message-ID: <1540892433.13.0.788709270274.issue35110@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The following PR fixes several common errors in reStructuredText formatting. * When the line is broken after or before a hyphen or dash, a space will be inserted after or before a hyphen or dash in the rendered text. This is not always appropriate. It is a common error when use old blurb (was blurb with the fix released?), but can be introduced also manually. * Backslash followed by a space is used as a separator after a mark up, which doesn't insert a space. But when the line was broken on this space, this is not always work. Fixed also other similar errors. ---------- assignee: docs at python components: Documentation messages: 328889 nosy: docs at python, mdk, serhiy.storchaka priority: normal severity: normal status: open title: Fix more spaces around hyphens and dashes versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 07:43:02 2018 From: report at bugs.python.org (andrew c) Date: Tue, 30 Oct 2018 11:43:02 +0000 Subject: [New-bugs-announce] [issue35111] Make Custom Object Classes JSON Serializable Message-ID: <1540899782.53.0.788709270274.issue35111@psf.upfronthosting.co.za> New submission from andrew c : When creating a custom class that doesn't inherit from the accepted classes, there is no way to serialize it using json.dumps or json.dump. I propose that __fromjson__ and __tojson__ that when present will be used by the Python's default encoder. This issue is widely documented on stackoverflow as a deficiency. You basically have a couple of options to solve this: 1. Implement a custom json.JSONEncoder/json.JSONDecoder 2. Implement a method like to/from json 3. Monkey patch the json library 4. Use a 3rd party library These are not very good options. If you can serialize an object using pickle, why not have the ability to serialize objects using json? Thank you ---------- messages: 328897 nosy: andrewchap priority: normal severity: normal status: open title: Make Custom Object Classes JSON Serializable type: enhancement versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 08:02:15 2018 From: report at bugs.python.org (nubirstein) Date: Tue, 30 Oct 2018 12:02:15 +0000 Subject: [New-bugs-announce] [issue35112] SpooledTemporaryFile and seekable() method Message-ID: <1540900935.98.0.788709270274.issue35112@psf.upfronthosting.co.za> New submission from nubirstein : Although seekable() method is implemented in the IOBase (which means it is callable in BytesIO and StringIO), SpooledTemporaryFile class from lib/tempfile.py still does not implement it. ---------- components: Library (Lib) messages: 328904 nosy: nubirstein priority: normal severity: normal status: open title: SpooledTemporaryFile and seekable() method type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 08:32:57 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Tue, 30 Oct 2018 12:32:57 +0000 Subject: [New-bugs-announce] [issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings Message-ID: <1540902777.26.0.788709270274.issue35113@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : inspect.getsource uses inspect.findsource that uses a regex to check for class declaration and starts matching against the regex from the start of the program. When there is a match it checks for the first character to be 'c' to return the line number from which getblock is used to get the class definition. If there are multiple matches and there is no line with 'c' as the first character in the line then they are sorted based on the number of whitespaces preceding class keyword. This poses the following problem : 1. When a class definition like string occurs as part of a multiline string before the actual definition then this causes the function to return the multiline string instead of actual definition. This occurs both while using the multiline string also as comment and also using them in variable definition in other places. 2. When the class is defined inside another class and there is a similar multiline string inside another class which is indented along the same indentation level of the class then they are sorted by whitespace where they are equal and then followed by line number. Since the class definition occurs after the multiline string it causes the multiline string to be taken up as the source of the class. This was last changed in 89f507fe8c4 (Dec 2006) which is also a merge commit. I searched for issues and relevant test cases but I couldn't find any in the test suite or issue tracker regarding the same. Hence I am filing a new issue. # backups/bpo35101.py import inspect class Bar: a = """ class MultilineStringVariable: ... """ class MultilineStringVariable: def foo(self): pass ''' class MultilineStringComment: pass ''' class MultilineStringComment: def foo(self): pass class NestedClass: a = ''' class Spam: ... ''' class Nested: class Spam: pass print(inspect.getsource(MultilineStringVariable)) print(inspect.getsource(MultilineStringComment)) print(inspect.getsource(Nested.Spam)) # Incorrect results $ ./python.exe ../backups/bpo35101.py class MultilineStringVariable: ... class MultilineStringComment: pass class Spam: ... ---------- components: Library (Lib) messages: 328909 nosy: xtreak priority: normal severity: normal status: open title: inspect.getsource returns incorrect source for classes when class definition is part of multiline strings type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 09:40:17 2018 From: report at bugs.python.org (Josh Rosenberg) Date: Tue, 30 Oct 2018 13:40:17 +0000 Subject: [New-bugs-announce] [issue35114] ssl.RAND_status docs describe it as returning True/False; actually returns 1/0 Message-ID: <1540906817.06.0.788709270274.issue35114@psf.upfronthosting.co.za> New submission from Josh Rosenberg : The ssl.RAND_status online docs say (with code format on True/False): "Return True if the SSL pseudo-random number generator has been seeded with ?enough? randomness, and False otherwise." This is incorrect; the function actually returns 1 or 0 (and the docstring agrees). Fix can be one of: 1. Update docs to be less specific about the return type (use true/false, not True/False) 2. Update docs to match docstring (which specifically says 1/0, not True/False) 3. Update implementation and docstring to actually return True/False (replacing PyLong_FromLong with PyBool_FromLong and changing docstring to use True/False to match online docs) #3 involves a small amount of code churn, but it also means we're not needlessly replicating a C API's use of int return values when the function is logically bool (there is no error status for the C API AFAICT, so it's not like returning int gains us anything on flexibility). bool would be mathematically equivalent to the original 1/0 return value in the rare cases someone uses it mathematically. ---------- assignee: docs at python components: Documentation, SSL messages: 328917 nosy: docs at python, josh.r priority: low severity: normal status: open title: ssl.RAND_status docs describe it as returning True/False; actually returns 1/0 type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 11:12:16 2018 From: report at bugs.python.org (fcurella) Date: Tue, 30 Oct 2018 15:12:16 +0000 Subject: [New-bugs-announce] [issue35115] UUID objects can't be casted by `hex()` Message-ID: <1540912336.8.0.788709270274.issue35115@psf.upfronthosting.co.za> New submission from fcurella : Casting a UUID to an `int` or to a string works as expected: ``` import uuid value = uuid.UUID() str(value) int(value) ``` but casting to an `hex()` raises an exception: ``` import uuid value = uuid.UUID() # uuid instances already have the correct value stored in the `.hex` attribute value.hex # this raises `TypeError: 'UUID' object cannot be interpreted as an integer` hex(value) # this behaves correctly hex(value.int) ``` Adding support for `hex()` should be simple enough as adding the following to the UUID class in https://github.com/python/cpython/blob/54752533b2ed1c898ffe5ec2e795c6910ee46a39/Lib/uuid.py#L69: ``` def __index__(self): return self.int ``` ---------- components: Library (Lib) messages: 328929 nosy: fcurella priority: normal severity: normal status: open title: UUID objects can't be casted by `hex()` type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 14:48:53 2018 From: report at bugs.python.org (Matthew Belisle) Date: Tue, 30 Oct 2018 18:48:53 +0000 Subject: [New-bugs-announce] [issue35116] Doc/library entries for cgi.FieldStorage max_num_fields Message-ID: <1540925333.22.0.788709270274.issue35116@psf.upfronthosting.co.za> New submission from Matthew Belisle : vstinner pointed out that cgi.FieldStorage max_num_fields needs documentation added to Doc/library. https://bugs.python.org/issue34866#msg328401 ---------- assignee: docs at python components: Documentation messages: 328937 nosy: Matthew Belisle, docs at python priority: normal severity: normal status: open title: Doc/library entries for cgi.FieldStorage max_num_fields type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 14:50:32 2018 From: report at bugs.python.org (tzickel) Date: Tue, 30 Oct 2018 18:50:32 +0000 Subject: [New-bugs-announce] [issue35117] set.discard should return True or False based on if element existed. Message-ID: <1540925432.63.0.788709270274.issue35117@psf.upfronthosting.co.za> New submission from tzickel : Sometimes you want to do something based on if the item existed before removal, so instead of checking if it exists, then removing and doing something, if would be nice to make the function return True or False based on if the element existed. ---------- components: Interpreter Core messages: 328938 nosy: tzickel priority: normal severity: normal status: open title: set.discard should return True or False based on if element existed. type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Oct 30 23:20:18 2018 From: report at bugs.python.org (Windson Yang) Date: Wed, 31 Oct 2018 03:20:18 +0000 Subject: [New-bugs-announce] [issue35118] Add peek() or first() method in queue Message-ID: <1540956018.19.0.788709270274.issue35118@psf.upfronthosting.co.za> New submission from Windson Yang : I found other languages like Java and C++ have the method to access the first value in Queue like first() and peek(). Since we use deque_ to create Queue now, it's easy to implement in python using the index. Otherwise, we can add this to the document? I also found some discussion_ here. .. _deque: https://github.com/python/cpython/blob/master/Lib/queue.py#L205 .. _discussion https://mail.python.org/pipermail/python-list/2010-March/569930.html ---------- assignee: docs at python components: Documentation messages: 328963 nosy: Windson Yang, docs at python priority: normal severity: normal status: open title: Add peek() or first() method in queue type: enhancement versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 00:26:14 2018 From: report at bugs.python.org (Denis Osipov) Date: Wed, 31 Oct 2018 04:26:14 +0000 Subject: [New-bugs-announce] [issue35119] Customizing module attribute access example raises RecursionError Message-ID: <1540959974.35.0.788709270274.issue35119@psf.upfronthosting.co.za> New submission from Denis Osipov : Customizing module attribute access example raises RecursionError: >>> import sys >>> from types import ModuleType >>> class VerboseModule(ModuleType): ... def __repr__(self): ... return f'Verbose {self.__name__}' ... def __setattr__(self, attr, value): ... print(f'Setting {attr}...') ... setattr(self, attr, value) ... >>> sys.modules[__name__].__class__ = VerboseModule >>> sys.modules[__name__].a = 5 Setting a... <...> Setting a... Traceback (most recent call last): File "", line 1, in File "", line 6, in __setattr__ File "", line 6, in __setattr__ File "", line 6, in __setattr__ [Previous line repeated 495 more times] File "", line 5, in __setattr__ RecursionError: maximum recursion depth exceeded while calling a Python object Setting a...>>> Something like this can fix it: def __setattr__(self, attr, value): ... print(f'Setting {attr}...') ... super().setattr(self, attr, value) ---------- assignee: docs at python components: Documentation messages: 328966 nosy: denis-osipov, docs at python priority: normal severity: normal status: open title: Customizing module attribute access example raises RecursionError type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 01:49:56 2018 From: report at bugs.python.org (Mohit Sharma) Date: Wed, 31 Oct 2018 05:49:56 +0000 Subject: [New-bugs-announce] [issue35120] SSH tunnel support to ftp lib Message-ID: <1540964996.8.0.788709270274.issue35120@psf.upfronthosting.co.za> New submission from Mohit Sharma : SSH tunnel forwarding doesn't work with ftp lib ---------- messages: 328970 nosy: msharma priority: normal severity: normal status: open title: SSH tunnel support to ftp lib type: enhancement versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 02:52:48 2018 From: report at bugs.python.org (=?utf-8?b?6KW/55Sw6ZuE5rK7?=) Date: Wed, 31 Oct 2018 06:52:48 +0000 Subject: [New-bugs-announce] [issue35121] Cookie domain check returns incorrect results Message-ID: <1540968768.96.0.788709270274.issue35121@psf.upfronthosting.co.za> New submission from ???? : http.cookiejar.DefaultPolicy.domain_return_ok returns incorrect results. So, HTTP clients send cookies which issued from wrong server. policy = http.cookiejar.DefaultCookiePolicy() req = urllib.request.Request('https://xxxfoo.co.jp/') print(policy.domain_return_ok('foo.co.jp', req) # should be False, but it returns True ---------- components: Library (Lib) messages: 328973 nosy: ???? priority: normal severity: normal status: open title: Cookie domain check returns incorrect results type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 07:16:38 2018 From: report at bugs.python.org (akhi singhania) Date: Wed, 31 Oct 2018 11:16:38 +0000 Subject: [New-bugs-announce] [issue35122] Process not exiting on unhandled exception when using multiprocessing module Message-ID: <1540984598.88.0.788709270274.issue35122@psf.upfronthosting.co.za> New submission from akhi singhania : I am not sure if this is an implementation bug or just a documentation bug. When using the multiprocessing module, I have come across a scenario where the process fails to exit when it throws an unhandled exception because it is waiting for the feeder thread to join forever. Sending SIGINT doesn't cause the process to exit either but sending SIGTERM does cause it to exit. I have attached a simple reproducer. When main() raises the unhandled exception, the process does not exit. However, if the size of data that is enqueued is reduced or the child process closes the queue on exiting, then the process exits fine. In the scenario, when the process exits successfully, I see the following output: **** creating queue [DEBUG/MainProcess] created semlock with handle 140197742751744 [DEBUG/MainProcess] created semlock with handle 140197742747648 [DEBUG/MainProcess] created semlock with handle 140197742743552 [DEBUG/MainProcess] Queue._after_fork() **** created queue **** creating process **** starting process **** started process **** starting enqueue [DEBUG/MainProcess] Queue._start_thread() [DEBUG/MainProcess] doing self._thread.start() [DEBUG/Process-1] Queue._after_fork() [INFO/Process-1] child process calling self.run() [DEBUG/MainProcess] starting thread to feed data to pipe [DEBUG/MainProcess] ... done self._thread.start() **** done enqueue **** starting sleep **** done sleep Traceback (most recent call last): File "example.py", line 58, in main() File "example.py", line 54, in main raise Exception('foo') Exception: foo [INFO/MainProcess] process shutting down [DEBUG/MainProcess] running all "atexit" finalizers with priority >= 0 [DEBUG/MainProcess] telling queue thread to quit [DEBUG/MainProcess] running the remaining "atexit" finalizers [DEBUG/MainProcess] joining queue thread [DEBUG/MainProcess] feeder thread got sentinel -- exiting [DEBUG/MainProcess] ... queue thread joined In the scenario when the process does not exit successfully, I see the following output: **** creating queue [DEBUG/MainProcess] created semlock with handle 139683574689792 [DEBUG/MainProcess] created semlock with handle 139683574685696 [DEBUG/MainProcess] created semlock with handle 139683574681600 [DEBUG/MainProcess] Queue._after_fork() **** created queue **** creating process **** starting process **** started process **** starting enqueue [DEBUG/MainProcess] Queue._start_thread() [DEBUG/MainProcess] doing self._thread.start() [DEBUG/Process-1] Queue._after_fork() [INFO/Process-1] child process calling self.run() [DEBUG/MainProcess] starting thread to feed data to pipe [DEBUG/MainProcess] ... done self._thread.start() **** done enqueue **** starting sleep **** done sleep Traceback (most recent call last): File "example.py", line 58, in main() File "example.py", line 54, in main raise Exception('foo') Exception: foo [INFO/MainProcess] process shutting down [DEBUG/MainProcess] running all "atexit" finalizers with priority >= 0 [DEBUG/MainProcess] telling queue thread to quit [DEBUG/MainProcess] running the remaining "atexit" finalizers [DEBUG/MainProcess] joining queue thread <<<< Process hangs here >>>> I found the "solution" of closing the queue in the child by trial and error and looking through the code. The current documentation suggests that multiprocessing.Queue.close() and multiprocessing.Queue.join_thread() are "usually unnecessary for most code". I am not sure if the attached code can be classified as normal code. I believe that at the very least, the documentation should be updated or maybe it should be investigated if some code changes can address this. ---------- components: Extension Modules files: example.py messages: 328983 nosy: akhi singhania priority: normal severity: normal status: open title: Process not exiting on unhandled exception when using multiprocessing module type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47896/example.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 07:22:05 2018 From: report at bugs.python.org (Robert Wright) Date: Wed, 31 Oct 2018 11:22:05 +0000 Subject: [New-bugs-announce] [issue35123] Add style guide for sentinel usage Message-ID: <1540984925.04.0.788709270274.issue35123@psf.upfronthosting.co.za> New submission from Robert Wright : Sentinel values are used inconsistently in the Python code base. It would be helpful to have a style guide (about eg. casing, placement, and sentinel reuse) to prevent arguments about their use in future code. ---------- messages: 328984 nosy: madman bob priority: normal severity: normal status: open title: Add style guide for sentinel usage _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 07:31:54 2018 From: report at bugs.python.org (Robert Wright) Date: Wed, 31 Oct 2018 11:31:54 +0000 Subject: [New-bugs-announce] [issue35124] Add style guide for unit tests Message-ID: <1540985514.2.0.788709270274.issue35124@psf.upfronthosting.co.za> New submission from Robert Wright : There should be a style guide for tests, to prevent arguments about their use in future code. ---------- messages: 328986 nosy: madman bob priority: normal severity: normal status: open title: Add style guide for unit tests _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 11:18:41 2018 From: report at bugs.python.org (mainro) Date: Wed, 31 Oct 2018 15:18:41 +0000 Subject: [New-bugs-announce] [issue35125] asyncio shield: remove inner callback on outer cancellation Message-ID: <1540999121.33.0.788709270274.issue35125@psf.upfronthosting.co.za> New submission from mainro : When the future returned by shield is cancelled, its completion callback of the inner future is not removed. This makes the callback list of inner inner future grow each time a shield is created. ---------- components: asyncio files: shield_cancel.patch keywords: patch messages: 328997 nosy: asvetlov, mainro, yselivanov priority: normal severity: normal status: open title: asyncio shield: remove inner callback on outer cancellation type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47897/shield_cancel.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 13:07:39 2018 From: report at bugs.python.org (Pawel) Date: Wed, 31 Oct 2018 17:07:39 +0000 Subject: [New-bugs-announce] [issue35126] Mistake in FAQ about converting number to string. Message-ID: <1541005659.07.0.788709270274.issue35126@psf.upfronthosting.co.za> New submission from Pawel : In this question: https://docs.python.org/2.7/faq/programming.html#how-do-i-convert-a-number-to-a-string There is a statement: "{:.3f}".format(1/3) yields '0.333' While In [2]: "{:.3f}".format(1/3) Out[2]: '0.000' In [3]: "{:.3f}".format(1/3.0) Out[3]: '0.333' ---------- assignee: docs at python components: Documentation messages: 329000 nosy: docs at python, grottrumsel priority: normal severity: normal status: open title: Mistake in FAQ about converting number to string. versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 15:06:46 2018 From: report at bugs.python.org (Gyff Mjord) Date: Wed, 31 Oct 2018 19:06:46 +0000 Subject: [New-bugs-announce] [issue35127] pyurandom() fails if user does not have an entropy device Message-ID: <1541012806.8.0.788709270274.issue35127@psf.upfronthosting.co.za> New submission from Gyff Mjord : Because of [reasons], I installed a FreeBSD and recompiled it to provide a minimalist kernel. Thus, it does not have the entropy devices /dev/urandom and /dev/random It is a FreeBSD-10-0 running in a Hyper-V virutalization platform. I kinda recompiled python-3.7.1 from the source code to get my own version of python running, but I got stuck in this part. So looking at the Modules/bootstrap_hash.c file I do not see the code of pyurandom() falling back to a something silly. Plus, there is a problem that happens only in Unix at least in this version of python. Looking at the code of the same file. we can see: static int pyurandom(...) { ... int res ... if (res < 0){ return -1 } if (res == 1){ return 0 } ... } I am sorry for the laziness but I believe my point is clear. The thing is. If the random function returns 0 it will return 0 but if it returns 1 it will also return 0. In other words, the number 1 is out of the scope of the random numbers. It is a small prejudice for the random function, but it is not mathematically right. This issue with the number 1, does not happen if the user does not have /dev/random (But it still needs /dev/urandom) ---------- components: FreeBSD messages: 329005 nosy: koobs, pehdrah priority: normal severity: normal status: open title: pyurandom() fails if user does not have an entropy device type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 17:47:42 2018 From: report at bugs.python.org (Pablo Santiago Blum de Aguiar) Date: Wed, 31 Oct 2018 21:47:42 +0000 Subject: [New-bugs-announce] [issue35128] warning.warn messages with spacing issues Message-ID: <1541022462.19.0.788709270274.issue35128@psf.upfronthosting.co.za> New submission from Pablo Santiago Blum de Aguiar : Some warn messages miss space between words, such as: Use of 'buffering' argument is deprecated and ignoredsince Python 3.0. in bz2 library, and: keyfile and certfile are deprecated, use acustom context instead in many libraries, such as poplib and smtplib. Other warn messages contain too much spaces between words, such as: The 'filename' attribute will be removed in future versions. Use 'source' instead. in configparser library. I'm not sure if such issues affect older versions of Python. I might need help on that. ---------- messages: 329016 nosy: scorphus priority: normal severity: normal status: open title: warning.warn messages with spacing issues versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Oct 31 18:28:42 2018 From: report at bugs.python.org (davide moro) Date: Wed, 31 Oct 2018 22:28:42 +0000 Subject: [New-bugs-announce] [issue35129] Different behaviour comparing versions (distutils.version.LooseVersion) between python2.7 and python3.x Message-ID: <1541024922.77.0.788709270274.issue35129@psf.upfronthosting.co.za> New submission from davide moro : I noticed that with the python2.7 version of distutils.version.LooseVersion let you compare '7' with 'xp' without exceptions (e.g., LooseVersion('7') > LooseVersion('xp')). If you do the same with python3.6 or python3.7, you'll get the following exception: * TypeError: '<' not supported between instances of 'int' and 'str' You can see the full example with complete traceback and differences between python2.x and python3.x here: * https://pastebin.com/kAwUTihe Thanks, davide ---------- components: Distutils messages: 329018 nosy: davide moro, dstufft, eric.araujo priority: normal severity: normal status: open title: Different behaviour comparing versions (distutils.version.LooseVersion) between python2.7 and python3.x type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________