From report at bugs.python.org Sun Jul 1 15:28:46 2018 From: report at bugs.python.org (Lucas Sampaio) Date: Sun, 01 Jul 2018 19:28:46 +0000 Subject: [New-bugs-announce] [issue34016] Bug in sort() Message-ID: <1530473326.57.0.56676864532.issue34016@psf.upfronthosting.co.za> New submission from Lucas Sampaio : lista4 = input().split() print(lista4) lista4.sort() print(lista4) Input = 6 8 10 Output: 6 8 10 ['6', '8', '10'] ['10', '6', '8'] a bug occurs when setting the 10 ---------- messages: 320843 nosy: lucassdssampaio priority: normal severity: normal status: open title: Bug in sort() type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 03:57:21 2018 From: report at bugs.python.org (elfantroussi) Date: Mon, 02 Jul 2018 07:57:21 +0000 Subject: [New-bugs-announce] [issue34017] Tkinter CheckButton not working in EXE Message-ID: <1530518241.17.0.56676864532.issue34017@psf.upfronthosting.co.za> New submission from elfantroussi : I work with Tkinter on spyder python3.6. In my program I use Tkinter CheckButtons with a command. When I execute my program in Spyder, It works well. But when I generate the EXE using cx Freeze, I'm not able to check the checkbuttons on my interface, like if they pass to Disable state. I write this code to illustrate my situation. ---------- components: Tkinter files: debug.py messages: 320853 nosy: elfantroussi priority: normal severity: normal status: open title: Tkinter CheckButton not working in EXE type: performance versions: Python 3.6 Added file: https://bugs.python.org/file47664/debug.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 04:23:53 2018 From: report at bugs.python.org (Sergey Fedoseev) Date: Mon, 02 Jul 2018 08:23:53 +0000 Subject: [New-bugs-announce] [issue34018] SQLite converters are documented to be sensitive to the case of type names, but they're not Message-ID: <1530519833.89.0.56676864532.issue34018@psf.upfronthosting.co.za> New submission from Sergey Fedoseev : SQLite converters are documented to be sensitive to the case of type names, but they're not. In [50]: import sqlite3 ...: ...: sqlite3.converters.clear() ...: sqlite3.register_converter('T', lambda x: 'UPPER') ...: sqlite3.register_converter('t', lambda x: 'lower') ...: ...: con = sqlite3.connect(':memory:', detect_types=sqlite3.PARSE_DECLTYPES) ...: cur = con.cursor() ...: cur.execute('create table test(upper T, lower t)') ...: cur.execute('insert into test values (?, ?)', ('X', 'x')) ...: cur.execute('select * from test') ...: cur.fetchone() ...: Out[50]: ('lower', 'lower') In [51]: sqlite3.converters Out[51]: {'T': >} Original commit in pysqlite that makes converters case insensitive: https://github.com/ghaering/pysqlite/commit/1e8bd36be93b7d7425910642b72e4152c77b0dfd ---------- assignee: docs at python components: Documentation messages: 320855 nosy: docs at python, sir-sigurd priority: normal severity: normal status: open title: SQLite converters are documented to be sensitive to the case of type names, but they're not _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 05:51:20 2018 From: report at bugs.python.org (Bumsik Kim) Date: Mon, 02 Jul 2018 09:51:20 +0000 Subject: [New-bugs-announce] [issue34019] webbrowser: wrong arguments for Opera browser. Message-ID: <1530525080.65.0.56676864532.issue34019@psf.upfronthosting.co.za> New submission from Bumsik Kim : webbrowser module currently opens Opera Browser using the following command: opera -remote "openURL(https://google.com,new-window)" While this follows Opera's documentation (https://www.opera.com/docs/switches/#remote), this is broken since Opera switched from its own engine to Chromium. The working command is exactly the same as Chrome: opera --new-window https://google.com ---------- components: Library (Lib) messages: 320863 nosy: kbumsik priority: normal severity: normal status: open title: webbrowser: wrong arguments for Opera browser. versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 06:04:44 2018 From: report at bugs.python.org (Leon H.) Date: Mon, 02 Jul 2018 10:04:44 +0000 Subject: [New-bugs-announce] [issue34020] Add '%(asctime)s' into default BASIC_FORMAT in logging module Message-ID: <1530525884.27.0.56676864532.issue34020@psf.upfronthosting.co.za> New submission from Leon H. : Current BASIC_FORMAT: BASIC_FORMAT = "%(levelname)s:%(name)s:%(message)s" The first thing people do is set the format to '%(asctime)s:%(levelname)s:%(name)s:%(message)s' or like after importing logging module. Could we put the '%(asctime)s' into the default BASIC_FORMAT setting and save everyone's time? ---------- components: Library (Lib) messages: 320864 nosy: Leon H. priority: normal severity: normal status: open title: Add '%(asctime)s' into default BASIC_FORMAT in logging module type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 06:05:38 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 02 Jul 2018 10:05:38 +0000 Subject: [New-bugs-announce] [issue34021] test_regrtest: test_env_changed() fails on x86 Windows XP VS9.0 2.7 Message-ID: <1530525938.11.0.56676864532.issue34021@psf.upfronthosting.co.za> New submission from STINNER Victor : http://buildbot.python.org/all/#/builders/105/builds/182 d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build>"d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\PC\VS9.0\\python_d" -Wd -3 -E -tt "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\PC\VS9.0\\..\..\Lib\test\regrtest.py" -uall -rwW --slowest -j2 == CPython 2.7.15+ (default, Jun 30 2018, 07:15:20) [MSC v.1500 32 bit (Intel)] == Windows-XP-5.1.2600-SP3 little-endian == d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\build\test_python_3044 == CPU count: 1 Using random seed 5527885 Run tests in parallel using 2 child processes ... 0:11:15 [256/403/1] test_regrtest failed d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\support\__init__.py:808: RuntimeWarning: tests may fail, unable to create temp dir: d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\build\test_python_2228 with temp_dir(path=name, quiet=quiet) as temp_path: test test_regrtest failed -- Traceback (most recent call last): File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 662, in test_env_changed self.check_executed_tests(output, [testname], env_changed=testname) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 140, in check_executed_tests self.check_line(output, regex) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 87, in check_line self.assertRegexpMatches(output, regex) AssertionError: Regexp didn't match: '^1 test altered the execution environment:\\n test_regrtest_noop33$' not found in 'Run tests sequentially\n0:00:00 [1/1] test_regrtest_noop33\n\n== Tests result: SUCCESS ==\n\n1 test OK.\n\nTotal duration: 131 ms\nTests result: SUCCESS\n' ... Re-running failed tests in verbose mode Re-running test 'test_regrtest' in verbose mode d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\support\__init__.py:808: RuntimeWarning: tests may fail, unable to create temp dir: d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\build\test_python_2336 with temp_dir(path=name, quiet=quiet) as temp_path: test_module_autotest (test.test_regrtest.ProgramsTestCase) ... ok test_module_from_test_autotest (test.test_regrtest.ProgramsTestCase) ... ok test_module_regrtest (test.test_regrtest.ProgramsTestCase) ... ok test_module_test (test.test_regrtest.ProgramsTestCase) ... ok test_pcbuild_rt (test.test_regrtest.ProgramsTestCase) ... skipped 'Tools/buildbot/test.bat requires PCbuild build, found PC' test_script_autotest (test.test_regrtest.ProgramsTestCase) ... ok test_script_regrtest (test.test_regrtest.ProgramsTestCase) ... ok test_tools_buildbot_test (test.test_regrtest.ProgramsTestCase) ... skipped 'Tools/buildbot/test.bat requires PCbuild build, found PC' test_coverage (test.test_regrtest.ArgsTestCase) ... ok test_crashed (test.test_regrtest.ArgsTestCase) ... ok test_env_changed (test.test_regrtest.ArgsTestCase) ... FAIL test_failing_test (test.test_regrtest.ArgsTestCase) ... ok test_forever (test.test_regrtest.ArgsTestCase) ... ok test_fromfile (test.test_regrtest.ArgsTestCase) ... ok test_huntrleaks (test.test_regrtest.ArgsTestCase) ... ok test_huntrleaks_fd_leak (test.test_regrtest.ArgsTestCase) ... ok test_interrupted (test.test_regrtest.ArgsTestCase) ... ok test_list_cases (test.test_regrtest.ArgsTestCase) ... ok test_list_tests (test.test_regrtest.ArgsTestCase) ... ok test_matchfile (test.test_regrtest.ArgsTestCase) ... ok test_random (test.test_regrtest.ArgsTestCase) ... ok test_rerun_fail (test.test_regrtest.ArgsTestCase) ... ok test_resources (test.test_regrtest.ArgsTestCase) ... ok test_slow_interrupted (test.test_regrtest.ArgsTestCase) ... ok test_slowest (test.test_regrtest.ArgsTestCase) ... ok test_format_duration (test.test_regrtest.TestUtils) ... ok ====================================================================== FAIL: test_env_changed (test.test_regrtest.ArgsTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 665, in test_env_changed output = self.run_tests("--fail-env-changed", testname, exitcode=3) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 335, in run_tests return self.run_python(cmdargs, **kw) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 216, in run_python proc = self.run_command(args, **kw) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 211, in run_command self.fail(msg) AssertionError: Command ['d:\\cygwin\\home\\db3l\\buildarea\\2.7.bolen-windowsvs9\\build\\PC\\VS9.0\\python_d.exe', '-m', 'test', '--testdir=c:\\docume~1\\db3l\\locals~1\\temp\\tmpvaq672', '--fail-env-changed', 'test_regrtest_noop33'] failed with exit code 0 stdout: --- Run tests sequentially 0:00:00 [1/1] test_regrtest_noop33 == Tests result: SUCCESS == 1 test OK. Total duration: 10 ms Tests result: SUCCESS --- stderr: --- d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\support\__init__.py:808: RuntimeWarning: tests may fail, unable to create temp dir: d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\build\test_python_3992 with temp_dir(path=name, quiet=quiet) as temp_path: --- ---------------------------------------------------------------------- Ran 26 tests in 16.384s FAILED (failures=1, skipped=2) 1 test failed again: test_regrtest == Tests result: FAILURE then FAILURE == 359 tests OK. 10 slowest tests: - test_mmap: 357.3s - test_largefile: 277.8s - test_io: 275.1s - test_multiprocessing: 194.6s - test_decimal: 57.8s - test_lib2to3: 45.3s - test_tokenize: 42.2s - test_subprocess: 36.7s - test_file2k: 36.7s - test_ssl: 30.9s 1 test failed: test_regrtest 43 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_commands test_crypt test_curses test_dbm test_dl test_epoll test_fcntl test_fork1 test_gdb test_gdbm test_gl test_grp test_imgfile test_ioctl test_kqueue test_linuxaudiodev test_macos test_macostools test_mhlib test_nis test_openpty test_ossaudiodev test_pipes test_poll test_posix test_pty test_pwd test_readline test_resource test_scriptpackages test_spwd test_sunaudiodev test_threadsignals test_wait3 test_wait4 test_zipfile64 2 skips unexpected on win32: test_gdb test_readline 1 re-run test: test_regrtest Total duration: 24 min 6 sec Tests result: FAILURE then FAILURE test test_regrtest failed -- Traceback (most recent call last): File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 665, in test_env_changed output = self.run_tests("--fail-env-changed", testname, exitcode=3) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 335, in run_tests return self.run_python(cmdargs, **kw) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 216, in run_python proc = self.run_command(args, **kw) File "d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\test_regrtest.py", line 211, in run_command self.fail(msg) AssertionError: Command ['d:\\cygwin\\home\\db3l\\buildarea\\2.7.bolen-windowsvs9\\build\\PC\\VS9.0\\python_d.exe', '-m', 'test', '--testdir=c:\\docume~1\\db3l\\locals~1\\temp\\tmpvaq672', '--fail-env-changed', 'test_regrtest_noop33'] failed with exit code 0 stdout: --- Run tests sequentially 0:00:00 [1/1] test_regrtest_noop33 == Tests result: SUCCESS == 1 test OK. Total duration: 10 ms Tests result: SUCCESS --- stderr: --- d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\lib\test\support\__init__.py:808: RuntimeWarning: tests may fail, unable to create temp dir: d:\cygwin\home\db3l\buildarea\2.7.bolen-windowsvs9\build\build\test_python_3992 with temp_dir(path=name, quiet=quiet) as temp_path: --- program finished with exit code 2 elapsedTime=1447.752000 ---------- components: Windows messages: 320865 nosy: paul.moore, steve.dower, tim.golden, vstinner, zach.ware priority: normal severity: normal status: open title: test_regrtest: test_env_changed() fails on x86 Windows XP VS9.0 2.7 versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 08:18:35 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 02 Jul 2018 12:18:35 +0000 Subject: [New-bugs-announce] [issue34022] Python 3.7: 6 tests failed on OpenSUSE Message-ID: <1530533915.92.0.56676864532.issue34022@psf.upfronthosting.co.za> New submission from STINNER Victor : https://build.opensuse.org/package/show/home:mcepl:work/python3 6 tests failed: test_cmd_line_script test_compileall test_importlib test_multiprocessing_main_handling test_py_compile test_runpy ====================================================================== ERROR: test_zipfile_compiled (test.test_runpy.RunPathTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 153, in _get_module_details code = loader.get_code(mod_name) zipimport.ZipImportError: can't find module '__main__' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 219, in _get_main_module_details return _get_module_details(main_name) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 155, in _get_module_details raise error(format(e)) from e ImportError: can't find module '__main__' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_runpy.py", line 715, in test_zipfile_compiled mod_name=mod_name, check_loader=False) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_runpy.py", line 631, in _check_script self.check_code_execution(create_ns, expected_ns) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_runpy.py", line 130, in check_code_execution result_ns = create_namespace(None) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_runpy.py", line 606, in create_ns return run_path(script_name, init_globals) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 275, in run_path mod_name, mod_spec, code = _get_main_module_details() File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 223, in _get_main_module_details (main_name, sys.path[0])) from exc ImportError: can't find '__main__' module in '/tmp/tmp40k8q99u/test_zip.zip' ====================================================================== FAIL: test_zipfile_compiled (test.test_cmd_line_script.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_cmd_line_script.py", line 268, in test_zipfile_compiled zipimport.zipimporter) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_cmd_line_script.py", line 129, in _check_script *run_args, __isolated=False, __cwd=cwd, **env_vars File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 157, in assert_python_ok return _assert_python(True, *args, **env_vars) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 143, in _assert_python res.fail(cmd_line) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 84, in fail err)) AssertionError: Process return code is 1 command line: ['/home/abuild/rpmbuild/BUILD/Python-3.7.0/python', '-X', 'faulthandler', '-E', '/tmp/tmpwlsj3czm/test_zip.zip', 'test1', 'test2', 'test3'] stdout: --- --- stderr: --- /home/abuild/rpmbuild/BUILD/Python-3.7.0/python: can't find '__main__' module in '/tmp/tmpwlsj3czm/test_zip.zip' --- ====================================================================== FAIL: test_overiden_unchecked_hash_based_pyc (test.test_importlib.source.test_file_loader.Frozen_SimpleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper to_return = fxn(*args, **kwargs) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 349, in test_overiden_unchecked_hash_based_pyc self.assertEqual(int.from_bytes(data[4:8], 'little'), 0b1) AssertionError: 3 != 1 ====================================================================== FAIL: test_unchecked_hash_based_pyc (test.test_importlib.source.test_file_loader.Frozen_SimpleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper to_return = fxn(*args, **kwargs) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 315, in test_unchecked_hash_based_pyc self.assertEqual(mod.state, 'old') AssertionError: 'new' != 'old' - new + old ====================================================================== FAIL: test_old_timestamp (test.test_importlib.source.test_file_loader.Frozen_SourceLoaderBadBytecodeTestPEP302) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper to_return = fxn(*args, **kwargs) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 635, in test_old_timestamp self.assertEqual(bytecode_file.read(4), source_timestamp) AssertionError: b'\xf0%\x1e8' != b'\xe2L6[' ====================================================================== FAIL: test_old_timestamp (test.test_importlib.source.test_file_loader.Frozen_SourceLoaderBadBytecodeTestPEP451) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper to_return = fxn(*args, **kwargs) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 635, in test_old_timestamp self.assertEqual(bytecode_file.read(4), source_timestamp) AssertionError: b'\xf0%\x1e8' != b'\xe2L6[' ====================================================================== FAIL: test_overiden_unchecked_hash_based_pyc (test.test_importlib.source.test_file_loader.Source_SimpleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper to_return = fxn(*args, **kwargs) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 349, in test_overiden_unchecked_hash_based_pyc self.assertEqual(int.from_bytes(data[4:8], 'little'), 0b1) AssertionError: 3 != 1 ====================================================================== FAIL: test_unchecked_hash_based_pyc (test.test_importlib.source.test_file_loader.Source_SimpleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper to_return = fxn(*args, **kwargs) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 315, in test_unchecked_hash_based_pyc self.assertEqual(mod.state, 'old') AssertionError: 'new' != 'old' - new + old ====================================================================== FAIL: test_old_timestamp (test.test_importlib.source.test_file_loader.Source_SourceLoaderBadBytecodeTestPEP302) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper to_return = fxn(*args, **kwargs) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 635, in test_old_timestamp self.assertEqual(bytecode_file.read(4), source_timestamp) AssertionError: b'\xf0%\x1e8' != b'\xe2L6[' ====================================================================== FAIL: test_old_timestamp (test.test_importlib.source.test_file_loader.Source_SourceLoaderBadBytecodeTestPEP451) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper to_return = fxn(*args, **kwargs) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 635, in test_old_timestamp self.assertEqual(bytecode_file.read(4), source_timestamp) AssertionError: b'\xf0%\x1e8' != b'\xe2L6[' ====================================================================== FAIL: test_zipfile_compiled (test.test_multiprocessing_main_handling.ForkCmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 225, in test_zipfile_compiled self._check_script(zip_name) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 156, in _check_script rc, out, err = assert_python_ok(*run_args, __isolated=False) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 157, in assert_python_ok return _assert_python(True, *args, **env_vars) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 143, in _assert_python res.fail(cmd_line) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 84, in fail err)) AssertionError: Process return code is 1 command line: ['/home/abuild/rpmbuild/BUILD/Python-3.7.0/python', '-X', 'faulthandler', '-E', '/tmp/tmpjsax7ksh/test_zip.zip', 'fork'] stdout: --- --- stderr: --- /home/abuild/rpmbuild/BUILD/Python-3.7.0/python: can't find '__main__' module in '/tmp/tmpjsax7ksh/test_zip.zip' --- ====================================================================== FAIL: test_zipfile_compiled (test.test_multiprocessing_main_handling.ForkServerCmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 225, in test_zipfile_compiled self._check_script(zip_name) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 156, in _check_script rc, out, err = assert_python_ok(*run_args, __isolated=False) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 157, in assert_python_ok return _assert_python(True, *args, **env_vars) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 143, in _assert_python res.fail(cmd_line) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 84, in fail err)) AssertionError: Process return code is 1 command line: ['/home/abuild/rpmbuild/BUILD/Python-3.7.0/python', '-X', 'faulthandler', '-E', '/tmp/tmp50n_prgl/test_zip.zip', 'forkserver'] stdout: --- --- stderr: --- /home/abuild/rpmbuild/BUILD/Python-3.7.0/python: can't find '__main__' module in '/tmp/tmp50n_prgl/test_zip.zip' --- ====================================================================== FAIL: test_zipfile_compiled (test.test_multiprocessing_main_handling.SpawnCmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 225, in test_zipfile_compiled self._check_script(zip_name) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 156, in _check_script rc, out, err = assert_python_ok(*run_args, __isolated=False) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 157, in assert_python_ok return _assert_python(True, *args, **env_vars) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 143, in _assert_python res.fail(cmd_line) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 84, in fail err)) AssertionError: Process return code is 1 command line: ['/home/abuild/rpmbuild/BUILD/Python-3.7.0/python', '-X', 'faulthandler', '-E', '/tmp/tmp1npoq9bq/test_zip.zip', 'spawn'] stdout: --- --- stderr: --- /home/abuild/rpmbuild/BUILD/Python-3.7.0/python: can't find '__main__' module in '/tmp/tmp1npoq9bq/test_zip.zip' --- ====================================================================== FAIL: test_invalidation_mode (test.test_py_compile.PyCompileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_py_compile.py", line 153, in test_invalidation_mode self.assertEqual(flags, 0b1) AssertionError: 3 != 1 ---------------------------------------------------------------------- ====================================================================== FAIL: test_force (test.test_compileall.CommandLineTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 365, in test_force self.assertEqual(mtime, mtime2) AssertionError: 1530285241.0427392 != 1530285301.18 ====================================================================== FAIL: test_no_args_respects_force_flag (test.test_compileall.CommandLineTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 299, in test_no_args_respects_force_flag self.assertEqual(mtime, mtime2) AssertionError: 1530285243.012693 != 1530285303.168 ====================================================================== FAIL: test_pyc_invalidation_mode (test.test_compileall.CommandLineTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 533, in test_pyc_invalidation_mode self.assertEqual(int.from_bytes(data[4:8], 'little'), 0b01) AssertionError: 3 != 1 ====================================================================== FAIL: test_magic_number (test.test_compileall.CompileallTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 78, in test_magic_number self.recreation_check(b'\0\0\0\0') File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 61, in recreation_check self.assertEqual(*self.data()) AssertionError: b'B\r\r\n\x03\x00\x00\x00\\s\xa0J' != b'B\r\r\n\x00\x00\x00\x00\xfaL6[' ====================================================================== FAIL: test_mtime (test.test_compileall.CompileallTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 74, in test_mtime 0, 1)) File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 61, in recreation_check self.assertEqual(*self.data()) AssertionError: b'B\r\r\n\x03\x00\x00\x00\\s\xa0J' != b'B\r\r\n\x00\x00\x00\x00\xfaL6[' ---------- components: Tests messages: 320875 nosy: vstinner priority: normal severity: normal status: open title: Python 3.7: 6 tests failed on OpenSUSE versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 09:43:51 2018 From: report at bugs.python.org (Mark Dickinson) Date: Mon, 02 Jul 2018 13:43:51 +0000 Subject: [New-bugs-announce] [issue34023] timedelta(seconds=x) strange results when type(x) == np.int32 Message-ID: <1530539031.68.0.56676864532.issue34023@psf.upfronthosting.co.za> New submission from Mark Dickinson : On Python 2.x on Windows, creating a timedelta with an `np.int32` instance for the number of seconds can (somewhat) silently give wrong results. Enthought Deployment Manager -- https://www.enthought.com Python 2.7.13 |Enthought, Inc. (x86_64)| (default, Mar 2 2017, 16:05:12) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> import datetime >>> datetime.timedelta(seconds=np.int32(123456789)) __main__:1: RuntimeWarning: overflow encountered in long_scalars datetime.timedelta(-1, 84354, 76480) There's at least a warning from NumPy there as NumPy attempts to scale the np.int32 by 10**6, but depending on settings and on how the code is invoked, the user may not see that warning. This is not an issue on Python 3.x / Windows or on Python 2.x / Unix; in both those cases, the same code gives a TypeError. This is related to, but not the same as, #5476. This may well count as a "won't fix", but it seemed at least worth reporting. ---------- components: Extension Modules messages: 320884 nosy: mark.dickinson priority: normal severity: normal status: open title: timedelta(seconds=x) strange results when type(x) == np.int32 type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 11:03:21 2018 From: report at bugs.python.org (Kay Hayen) Date: Mon, 02 Jul 2018 15:03:21 +0000 Subject: [New-bugs-announce] [issue34024] Builtin types take no keyword arguments anymore Message-ID: <1530543801.89.0.56676864532.issue34024@psf.upfronthosting.co.za> New submission from Kay Hayen : Hello, things like list(sequence = something) ought to work in Python 3.6 back to the oldest Python2 I know. However, in 3.7 this raises an exception about not accepting keyword arguments. I noticed the same for tuple, int, float(x=9.0), and probably a lot others. It is not described in the release notes either. I think it's a bug and might affect existing code. Or is this how thing will be from now on? Yours, Kay ---------- components: Interpreter Core messages: 320888 nosy: kayhayen priority: normal severity: normal status: open title: Builtin types take no keyword arguments anymore type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 12:18:14 2018 From: report at bugs.python.org (Douglas Thor) Date: Mon, 02 Jul 2018 16:18:14 +0000 Subject: [New-bugs-announce] [issue34025] SMTP EmailPolicy not setting max_line_length as expected. RCF 2045 states 76 char, Default policy uses 78 Message-ID: <1530548294.1.0.56676864532.issue34025@psf.upfronthosting.co.za> New submission from Douglas Thor : It appears that the SMTP EmailPolicy object does not correctly set max_line_length. RFC 2045 (https://www.ietf.org/rfc/rfc2045.txt) requires a max_line_length of 76 characters, while email._policybase.Policy sets it to 78 (which typically is correct). This causes email attachments to be truncated/corrupted. While the workaround is quite trivial, debugging the root cause was not as easy. Thus I think this should be fixed in at the std lib level, or at the very least mentioned in the docs. This was tested on Python 3.5.2. I did not test on 3.7, but I did check the source code and it appears that the bug still exists. To reproduce: import smtplib from email.message import EmailMessage from email.policy import SMTP msg = EmailMessage() msg['Subject'] = "Test message" msg['To'] = "to at valid_address.com" msg['From'] = "from at valid_address.com" content = "hello world, I should have an attachment" msg.set_content(content) maintype = 'image' subtype = 'png' test_file = './aaa.png' with open(test_file, 'rb') as fp: data = fp.read() msg.add_attachment(data, maintype=maintype, subtype=subtype, filename='aaa.png') with smtplib.SMTP_SSL('smtp.address.com', port=465) as s: s.ehlo() user = 'smtp_user at valid_address.com' pw = 'smtp_password' s.login(user, pw) s.send_message(msg) Check the raw email message received. You'll see that lines have a length of 78 and are padded with "==" which makes the total length 80 chars: ... MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1585876390557366757==" --===============1585876390557366757== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit hello world, I should have an attachment --===============1585876390557366757== Content-Type: image/png Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="aaa.png" MIME-Version: 1.0 iVBORw0KGgoAAAANSUhEUgAABE0AAALFCAYAAAA2rB2uAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjw== C/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAD/jklEQVR4Xg== 7P1rsHVJWecBvl4RFFAuIpcCEYQuLkUDBcgBoQsULLnJXaoaEApe5FLSTVFUC4JACQ1NiQdsQoFBAQ== iW4aQSWEt4cQwwB6xqC+CPYHqX5jQno+jHyYCCMmZsKJmYjZs3/rnOe8uXNnrpW5LrlzrfVfVSfOeQ== 986Vl/+T678y//nkk9+3OXdu+78uISAEhIAQEAJCQAgIASEgBISAEBACQkAICIEdBBBN9CMM1AfUBw== ... Next, modify the code with: from email.policy import SMTP smtp_pol = SMTP.clone(max_line_length=76) msg = EmailMessage(policy=smtp_pol) msg['Subject'] = ... And check the raw email again. This time, lines are 76 chars long and have no padding. Data is the same, just wrapped differently as expected. ... MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4874323426669347622==" --===============4874323426669347622== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit hello world, I should have an attachment --===============4874323426669347622== Content-Type: image/png Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="aaa.png" MIME-Version: 1.0 iVBORw0KGgoAAAANSUhEUgAABE0AAALFCAYAAAA2rB2uAAAAAXNSR0IArs4c6QAAAARnQU1BAACx jwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA/45JREFU eF7s/WuwdUlZ5wG+XhEUUC4ilwIRhC4uRQMFyAGhCxQsucldqhoQCl7kUtJNUVQLgkAJDU2JB2xC gUEBiW4aQSWEt4cQwwB6xqC+CPYHqX5jQno+jHyYCCMmZsKJmYjZs3/rnOe8uXNnrpW5LrlzrfVf ... This fix *should* be extremely easy: diff --git "a/policy.py" "b/policy.py" index 6ac64a5..046b788 100644 --- "a/policy.py" +++ "b/policy.py" @@ -209,6 +209,6 @@ default = EmailPolicy() # Make the default policy use the class default header_factory del default.header_factory strict = default.clone(raise_on_defect=True) -SMTP = default.clone(linesep='\r\n') +SMTP = default.clone(linesep='\r\n', max_line_length=76) HTTP = default.clone(linesep='\r\n', max_line_length=None) SMTPUTF8 = SMTP.clone(utf8=True) ---------- components: email messages: 320898 nosy: Douglas Thor, barry, r.david.murray priority: normal severity: normal status: open title: SMTP EmailPolicy not setting max_line_length as expected. RCF 2045 states 76 char, Default policy uses 78 type: behavior versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 14:09:58 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 02 Jul 2018 18:09:58 +0000 Subject: [New-bugs-announce] [issue34026] Request for 2 Windows installation changes. Message-ID: <1530554998.5.0.56676864532.issue34026@psf.upfronthosting.co.za> New submission from Terry J. Reedy : 1. On 3.7.0, but not 3.6.6, 'Python 3.7 Module Docs' is listed twice. 2. On both, 'Python x.y Manuals' always opens the .chm full-screen, even after the user closes in part-screen mode. I think part-screen would be better for the initial open. It would definitely be better to remember a user's setting when re-opening. ---------- components: Installation, Windows messages: 320904 nosy: paul.moore, steve.dower, terry.reedy, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Request for 2 Windows installation changes. type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 2 17:31:08 2018 From: report at bugs.python.org (Daiderd Jordan) Date: Mon, 02 Jul 2018 21:31:08 +0000 Subject: [New-bugs-announce] [issue34027] python 3.7 openpty/forkpty build failure on macOS Message-ID: <1530567068.14.0.56676864532.issue34027@psf.upfronthosting.co.za> New submission from Daiderd Jordan : I can't really figure out why, but the import in posixmodule.c seems to get skipped since python 3.7. The condition doesn't look entirely correct in case libutil.h is also available on macOS, however this has not changed since 3.6 and it worked fine there while both where available. Part of the configure log: checking pty.h usability... no checking pty.h presence... no checking for pty.h... no checking libutil.h usability... yes checking libutil.h presence... yes checking for libutil.h... yes ... checking util.h usability... yes checking util.h presence... yes checking for util.h... yes Build error: ./Modules/posixmodule.c:5924:9: error: implicit declaration of function 'openpty' is invalid in C99 [-Werror,-Wimplicit-function-declaration] if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0) ^ ./Modules/posixmodule.c:5924:9: note: did you mean 'openat'? /nix/store/q819d3vjz7vswpvkrfa9gck3ys8rmvcj-Libsystem-osx-10.11.6/include/sys/fcntl.h:480:5: note: 'openat' declared here int openat(int, const char *, int, ...) __DARWIN_NOCANCEL(openat) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0); ^ ./Modules/posixmodule.c:5924:9: warning: this function declaration is not a prototype [-Wstrict-prototypes] if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0) ^ ./Modules/posixmodule.c:6018:11: error: implicit declaration of function 'forkpty' is invalid in C99 [-Werror,-Wimplicit-function-declaration] pid = forkpty(&master_fd, NULL, NULL, NULL); ^ ./Modules/posixmodule.c:6018:11: warning: this function declaration is not a prototype [-Wstrict-prototypes] 2 warnings and 2 errors generated. make: *** [Makefile:1793: Modules/posixmodule.o] Error 1 ---------- components: Build messages: 320913 nosy: LnL7 priority: normal severity: normal status: open title: python 3.7 openpty/forkpty build failure on macOS type: compile error versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 3 05:13:31 2018 From: report at bugs.python.org (simon) Date: Tue, 03 Jul 2018 09:13:31 +0000 Subject: [New-bugs-announce] [issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support Message-ID: <1530609211.5.0.56676864532.issue34028@psf.upfronthosting.co.za> New submission from simon : when compiling Python 3.7.0 setup.py is reporting that the ssl module failed to compile due to missing support for X509_VERIFY_PARAM_set1_host() despite it existing in rsa.h for all versions of OpenSSL 1.1.0. Could not build the ssl module! Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host(). LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381 In addition _ssl.o does actually compile. The issue appears that _ssl is appearing in "missing", "self.failed", "self.failed_on_import" setup.py 366 if any('_ssl' in l 367 for l in (missing, self.failed, self.failed_on_import)): 368 print() 369 print("Could not build the ssl module!") 370 print("Python requires an OpenSSL 1.0.2 or 1.1 compatible " 371 "libssl with X509_VERIFY_PARAM_set1_host().") 372 print("LibreSSL 2.6.4 and earlier do not provide the necessary " 373 "APIs, https://github.com/libressl-portable/portable/issues/381") 374 print() I havent had time to go through the code yet to find out where the error is gettng flagged and if its a associated with how I have compiled openssl i.e. I need a compilation flag to enabled X509_VERIFY_PARAM_set1_host() support. ---------- assignee: christian.heimes components: SSL messages: 320947 nosy: christian.heimes, simon at simonfoley.net priority: normal severity: normal status: open title: Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 3 05:20:25 2018 From: report at bugs.python.org (Ryan) Date: Tue, 03 Jul 2018 09:20:25 +0000 Subject: [New-bugs-announce] [issue34029] tkinter.filedialog.askdirectory() crashing before dialog opens Message-ID: <1530609625.32.0.56676864532.issue34029@psf.upfronthosting.co.za> New submission from Ryan : I'm creating a GUI application that needs to give the user the option to change a folder that's used for saving data. I managed to track it down to the import of pywinauto to the application. All other filedialogs seem to work, it's only askdirectory that's having issues. I've attached a small file that shows the crash - if you comment out the pywinauto import, no crash occurs. ---------- components: Tkinter messages: 320949 nosy: gpolo, rsteel1 priority: normal severity: normal status: open title: tkinter.filedialog.askdirectory() crashing before dialog opens type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 3 06:51:05 2018 From: report at bugs.python.org (Gabriele Tornetta) Date: Tue, 03 Jul 2018 10:51:05 +0000 Subject: [New-bugs-announce] [issue34030] easy_install from Python 3.7 (Win64) cannot install modules Message-ID: <1530615065.91.0.56676864532.issue34030@psf.upfronthosting.co.za> New submission from Gabriele Tornetta : When trying to install a module (pycrypto in this case), easy_install fails with the following error (run via Git Bash) $ easy_install pycrypto-2.6.win-amd64-py3.3.exe Processing pycrypto-2.6.win-amd64-py3.3.exe error: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\\\AppData\\Local\\Temp\\easy_install-z4dfyyqo\\pycrypto-2.6-py3.7-win32.egg.tmp\\Crypto\\Cipher\\__pycache__\\AES.cpython-33.pyc' The version of easy_install that ships with Python 3.6 works as expected. ---------- components: Demos and Tools messages: 320957 nosy: Gabriele Tornetta priority: normal severity: normal status: open title: easy_install from Python 3.7 (Win64) cannot install modules type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 3 08:35:20 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Tue, 03 Jul 2018 12:35:20 +0000 Subject: [New-bugs-announce] [issue34031] Incorrect usage of unittest.TestCase in test_urllib2_localnet Message-ID: <1530621320.5.0.56676864532.issue34031@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : In /Lib/test/test_urllib2_localnet.py there is an incorrect usage of unittest.TestCase (an extra comma makes it use two arguments instead of one): class BasicAuthTests(unittest.TestCase): ... def test_basic_auth_success(self): ... try: self.assertTrue(urllib.request.urlopen(self.server_url)) except urllib.error.HTTPError: self.fail("Basic auth failed for the url: %s", self.server_url) here self.fail takes two argument, but it only admits one. This produces this traceback if there are proxy issues when running the tests: Traceback (most recent call last): File "/home7/pablogsal/Python-3.7.0/Lib/test/test_urllib2_localnet.py", line 307, in test_basic_auth_success self.assertTrue(urllib.request.urlopen(self.server_url)) File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 531, in open response = meth(req, response) File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 569, in error return self._call_chain(*args) File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 503, in _call_chain result = func(*args) File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbidden During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/pablogsal/Python-3.7.0/Lib/test/test_urllib2_localnet.py", line 309, in test_basic_auth_success self.fail("Basic auth failed for the url: %s", self.server_url) TypeError: fail() takes from 1 to 2 positional arguments but 3 were given ---------------------------------------------------------------------- ---------- assignee: pablogsal components: Tests messages: 320975 nosy: pablogsal priority: normal severity: normal status: open title: Incorrect usage of unittest.TestCase in test_urllib2_localnet 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 Jul 3 11:00:40 2018 From: report at bugs.python.org (Matej Cepl) Date: Tue, 03 Jul 2018 15:00:40 +0000 Subject: [New-bugs-announce] [issue34032] Add platlibdir to allow distinction between /usr/lib and /usr/lib64 for Linux Message-ID: <1530630040.09.0.56676864532.issue34032@psf.upfronthosting.co.za> New submission from Matej Cepl : Many Linux distribution (most of them) distinguish between library directory /usr/lib for noarch or 32bit libraries and /usr/lib64. This patch (originally from openSUSE) enables to capture this distinction. ---------- components: Build files: python-3.6.0-multilib-new.patch keywords: patch messages: 320985 nosy: mcepl, vstinner priority: normal severity: normal status: open title: Add platlibdir to allow distinction between /usr/lib and /usr/lib64 for Linux versions: Python 3.8 Added file: https://bugs.python.org/file47668/python-3.6.0-multilib-new.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 3 11:46:25 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 03 Jul 2018 15:46:25 +0000 Subject: [New-bugs-announce] [issue34033] distutils is not reproducible Message-ID: <1530632785.81.0.56676864532.issue34033@psf.upfronthosting.co.za> New submission from STINNER Victor : Follow up of bpo-29708: OpenSUSE uses a downstream patch for distutils to fix https://bugzilla.opensuse.org/show_bug.cgi?id=1049186: distutils-reproducible-compile.patch. I converted the patch as a PR: PR 8057. Naoki INADA wrote: """ Currently, marshal uses refcnt to determine using w_ref or not. Some immutable objects (especially, long and str) can be cached and reused. It may affects refcnt when byte compiling. I think we should use more deterministic way instead of refcnt. Maybe, count all constants in the module before marshal, like we did in compiling function for co_consts and co_names. As a bonus, it may reduce resource usage too by merging constants over functions. (e.g. ('self',) co_varnames and (None,) co_consts) """ https://github.com/python/cpython/pull/8057#issuecomment-402065657 Serhiy Storchaka added: """ I think we need to understand the issue better before committing changes. When found the source of unstability of file names, we can find other similar sources and make them stable too. For example if the source is listdir() or glob(), we can consider sorting results of all listdir() or glob() in distutils and related methods. On other side, if the problem is with reference counters in marshal, we can change the marshal module instead. """ https://github.com/python/cpython/pull/8057#issuecomment-402198390 ---------- components: Library (Lib) messages: 320988 nosy: vstinner priority: normal severity: normal status: open title: distutils is not reproducible versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 3 14:06:26 2018 From: report at bugs.python.org (Santiago Hernandez) Date: Tue, 03 Jul 2018 18:06:26 +0000 Subject: [New-bugs-announce] [issue34034] Python 3.7.0 multiprocessing forkserver ForkingPickler behaviour change Message-ID: <1530641186.32.0.56676864532.issue34034@psf.upfronthosting.co.za> New submission from Santiago Hernandez : Hi, I am splitting some processing among different processes with the forkserver start method using multiprocessing. In python 3.4 to 3.6 this worked fine. In python 3.7.0 it's breaking with the following Traceback: ``` File "/data/venvs/py37/Python-3.7.0/lib/python3.7/multiprocessing/process.py", line 112, in start self._popen = self._Popen(self) File "/data/venvs/py37/Python-3.7.0/lib/python3.7/multiprocessing/context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "/data/venvs/py37/Python-3.7.0/lib/python3.7/multiprocessing/context.py", line 284, in _Popen return Popen(process_obj) File "/data/venvs/py37/Python-3.7.0/lib/python3.7/multiprocessing/popen_spawn_posix.py", line 32, in __init__ super().__init__(process_obj) File "/data/venvs/py37/Python-3.7.0/lib/python3.7/multiprocessing/popen_fork.py", line 20, in __init__ self._launch(process_obj) File "/data/venvs/py37/Python-3.7.0/lib/python3.7/multiprocessing/popen_spawn_posix.py", line 47, in _launch reduction.dump(process_obj, fp) File "/data/venvs/py37/Python-3.7.0/lib/python3.7/multiprocessing/reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) TypeError: can't pickle weakref objects ``` I am attaching a minimum example where this happens. In the example this can be solved by making self._run_single a staticmethod. However, I would like to understand what is going on and what changed in python for this to throw an exception now, when before it did not. Thanks. Santiago ---------- files: example.py messages: 320995 nosy: Santiago Hernandez priority: normal severity: normal status: open title: Python 3.7.0 multiprocessing forkserver ForkingPickler behaviour change versions: Python 3.7 Added file: https://bugs.python.org/file47670/example.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 3 14:24:34 2018 From: report at bugs.python.org (Evgeny Prilepin) Date: Tue, 03 Jul 2018 18:24:34 +0000 Subject: [New-bugs-announce] [issue34035] zipfile: AttributeError in "seek" method of "_SharedFile" class Message-ID: <1530642274.73.0.56676864532.issue34035@psf.upfronthosting.co.za> New submission from Evgeny Prilepin : The misprint in the file lib/zipfile.py in the line 704 leads to AttributeError: '_SharedFile' object has no attribute 'writing' "self.writing()" should be replaced by "self._writing()". I also think this code shold be covered by tests. ---------- components: Library (Lib) messages: 320996 nosy: espdev priority: normal severity: normal status: open title: zipfile: AttributeError in "seek" method of "_SharedFile" class type: crash versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 3 15:10:48 2018 From: report at bugs.python.org (Semyon Levin) Date: Tue, 03 Jul 2018 19:10:48 +0000 Subject: [New-bugs-announce] [issue34036] ModuleNotFoundError: No module named '_ctypes' when install Python 3.7 on Linux Message-ID: <1530645048.53.0.56676864532.issue34036@psf.upfronthosting.co.za> New submission from Semyon Levin : make install failed with File "/tmp/tmp2gwe2ma_/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in File "/common/dev/slevin/tools/Python-3.7.0/Lib/ctypes/__init__.py", line 7, in from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes' make: *** [install] Error 1 I used PKG_CONFIG_PATH in config and LIBFFI_INCLUDEDIR was created correctly in Makefile. How to configure location for libffi.a ? ---------- messages: 320998 nosy: semkin priority: normal severity: normal status: open title: ModuleNotFoundError: No module named '_ctypes' when install Python 3.7 on Linux _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 3 18:57:26 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 03 Jul 2018 22:57:26 +0000 Subject: [New-bugs-announce] [issue34037] test_asyncio: test_run_in_executor_cancel() leaked a dangling thread on AMD64 FreeBSD 10.x Shared 3.7 Message-ID: <1530658646.63.0.56676864532.issue34037@psf.upfronthosting.co.za> New submission from STINNER Victor : AMD64 FreeBSD 10.x Shared 3.7: http://buildbot.python.org/all/#/builders/124/builds/410 ... test_remove_fds_after_closing (test.test_asyncio.test_events.KqueueEventLoopTests) ... ok test_run_in_executor (test.test_asyncio.test_events.KqueueEventLoopTests) ... ok test_run_in_executor_cancel (test.test_asyncio.test_events.KqueueEventLoopTests) ... Warning -- threading_cleanup() failed to cleanup 1 threads (count: 1, dangling: 2) Dangling thread: Dangling thread: <_MainThread(MainThread, started 34393318400)> ok test_run_until_complete (test.test_asyncio.test_events.KqueueEventLoopTests) ... ok test_run_until_complete_nesting (test.test_asyncio.test_events.KqueueEventLoopTests) ... ok ... 1 test altered the execution environment: test_asyncio ---------- components: Tests, asyncio messages: 321006 nosy: asvetlov, vstinner, yselivanov priority: normal severity: normal status: open title: test_asyncio: test_run_in_executor_cancel() leaked a dangling thread on AMD64 FreeBSD 10.x Shared 3.7 versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 00:33:55 2018 From: report at bugs.python.org (T L) Date: Wed, 04 Jul 2018 04:33:55 +0000 Subject: [New-bugs-announce] [issue34038] urllib2.urlopen fails if http_proxy(s) is set to a sock5 proxy Message-ID: <1530678835.56.0.56676864532.issue34038@psf.upfronthosting.co.za> New submission from T L : Changing the urlopen call to a curl commnand invoke works. $ export http_proxy=socks5://127.0.0.1:8888 https_proxy=socks5://127.0.0.1:8888 # this will raise an exception with string representation is a blank string # at least for url: https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/tag/linux_64bit/emscripten-llvm-e1.37.35.tar.gz from urllib2 import urlopen, HTTPError u = urlopen(url) mkdir_p(os.path.dirname(file_name)) with open(file_name, 'wb') as f: file_size = get_content_length(u) if file_size > 0: print("Downloading: %s from %s, %s Bytes" % (file_name, url, file_size)) else: print("Downloading: %s from %s" % (file_name, url)) file_size_dl = 0 block_sz = 8192 while True: buffer = u.read(block_sz) if not buffer: break file_size_dl += len(buffer) f.write(buffer) # this alternative way works import commands status, output = commands.getstatusoutput("curl -L --output " + file_name + " " + url) ---------- components: Library (Lib) messages: 321010 nosy: T L2 priority: normal severity: normal status: open title: urllib2.urlopen fails if http_proxy(s) is set to a sock5 proxy type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 03:02:00 2018 From: report at bugs.python.org (Benjamin Gear) Date: Wed, 04 Jul 2018 07:02:00 +0000 Subject: [New-bugs-announce] [issue34039] Loop limited to 1000 Message-ID: <1530687720.09.0.56676864532.issue34039@psf.upfronthosting.co.za> New submission from Benjamin Gear : I think this is a bug or maybe I'm seeing it wrong so I have a while loop witch collects data from a website json outs it into a list then does the same thing into a 2nd list then it calls the my comparing function and outputs the changes at 1st with only a while loop no call to function and would run no problem for days now I have changed it to collect all the data and now I'm getting limited to 1000 recursions I then attempted to alter the 100 limit witch works until seg fault now https://github.com/blkph0x/pyinator ---------- messages: 321013 nosy: Blkph0x priority: normal severity: normal status: open title: Loop limited to 1000 type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 03:49:19 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 04 Jul 2018 07:49:19 +0000 Subject: [New-bugs-announce] [issue34040] test_multiprocessing_forkserver: test_forkserver_sigkill() fails randomly Message-ID: <1530690559.26.0.56676864532.issue34040@psf.upfronthosting.co.za> New submission from STINNER Victor : AMD64 FreeBSD 10.x Shared 3.x: http://buildbot.python.org/all/#/builders/87/builds/1137 ====================================================================== FAIL: test_forkserver_sigkill (test.test_multiprocessing_forkserver.WithProcessesTestProcess) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/_test_multiprocessing.py", line 680, in test_forkserver_sigkill self.check_forkserver_death(signal.SIGKILL) File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/_test_multiprocessing.py", line 670, in check_forkserver_death self.assertTrue(evt.is_set()) AssertionError: False is not true Re-running test 'test_multiprocessing_forkserver' in verbose mode Ran 310 tests in 100.124s OK (skipped=27) ---------- components: Tests messages: 321015 nosy: vstinner priority: normal severity: normal status: open title: test_multiprocessing_forkserver: test_forkserver_sigkill() fails randomly versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 06:04:14 2018 From: report at bugs.python.org (Sergey Fedoseev) Date: Wed, 04 Jul 2018 10:04:14 +0000 Subject: [New-bugs-announce] [issue34041] add *deterministic* parameter to sqlite3.Connection.create_function() Message-ID: <1530698654.39.0.56676864532.issue34041@psf.upfronthosting.co.za> New submission from Sergey Fedoseev : SQLiter 3.8.3 and higher allows to mark created functions as deterministic to allow additional optimizations. There isn't currently a way to it from Python. https://sqlite.org/c3ref/create_function.html ---------- components: Extension Modules messages: 321027 nosy: sir-sigurd priority: normal severity: normal status: open title: add *deterministic* parameter to sqlite3.Connection.create_function() type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 07:42:51 2018 From: report at bugs.python.org (Kay Hayen) Date: Wed, 04 Jul 2018 11:42:51 +0000 Subject: [New-bugs-announce] [issue34042] Reference loss for local classes Message-ID: <1530704571.33.0.56676864532.issue34042@psf.upfronthosting.co.za> New submission from Kay Hayen : I have a test in Nuitka, designed to detect reference counting problems with Python code. It basically takes a snapshot of the refcount, runs a function until it stabilizes, then says PASS, or else reports the last diff. Obviously for CPython it's supposed to pass. Testing with self compiled 3.7.0 and 3.7.0-1 as in Debian testing (buster) currently, this happens for me: This is a cutout, there are more than 100 functions, I am listing the ones that report: simpleFunction16: FAILED 118414 118412 leaked -2 simpleFunction17: FAILED 118395 118393 leaked -2 simpleFunction18: FAILED 118375 118373 leaked -2 ... simpleFunction21: FAILED 118337 118333 leaked -4 ... simpleFunction25: FAILED 118315 118313 leaked -2 simpleFunction26: FAILED 118295 118293 leaked -2 ... simpleFunction38: FAILED 118257 118253 leaked -4 simpleFunction39: FAILED 118235 118233 leaked -2 ... simpleFunction43: FAILED 118215 118213 leaked -2 simpleFunction48: FAILED 118195 118193 leaked -2 ... simpleFunction76: FAILED 118422 118418 leaked -4 ... simpleFunction88: FAILED 118400 118398 leaked -2 This is really bad, because normally values are positive, merely preventing a release. A negative value indicates that references have been lost. This will normally result in corruption of the memory allocator for Python, although I have not yet seen that. I have a few remaining cases, where compiled code causes negative leaks too, there is happens. But I didn't force the issue yet. Notice that this is of course with the debug Python version and let me express, pure CPython is used to run the test code. When compiling with Nuitka and 3.7, my private code gives the same ref counts for there, but it also pretty much does the same things, these are some of the functions: def simpleFunction16(): class EmptyClass: pass return EmptyClass def simpleFunction39(): class Parent(object): pass All the other cases also use locally defined classes and only test cases using local classes are failing for me here. To reproduce is easy: git clone --branch develop http://git.nuitka.net/Nuitka.git python3.7-dbg Nuitka/tests/basics/Referencing.py Thanks, Kay Hayen ---------- messages: 321037 nosy: kayhayen priority: normal severity: normal status: open title: Reference loss for local classes versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 08:10:32 2018 From: report at bugs.python.org (INADA Naoki) Date: Wed, 04 Jul 2018 12:10:32 +0000 Subject: [New-bugs-announce] [issue34043] Optimize tarfile uncompression performance Message-ID: <1530706232.53.0.56676864532.issue34043@psf.upfronthosting.co.za> Change by INADA Naoki : ---------- components: Library (Lib) nosy: inada.naoki priority: normal severity: normal status: open title: Optimize tarfile uncompression performance type: performance versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 10:55:46 2018 From: report at bugs.python.org (Sebastian Bank) Date: Wed, 04 Jul 2018 14:55:46 +0000 Subject: [New-bugs-announce] [issue34044] subprocess: reusing STARTUPINFO breaks under 3.7 (Windows) Message-ID: <1530716146.72.0.56676864532.issue34044@psf.upfronthosting.co.za> New submission from Sebastian Bank : AFAIU, the change for https://bugs.python.org/issue19764 broke the following usage of subprocess on Windows (re-using a subprocess.STARTUPINFO instance to hide the command window): import os, subprocess STARTUPINFO = subprocess.STARTUPINFO() STARTUPINFO.dwFlags |= subprocess.STARTF_USESHOWWINDOW STARTUPINFO.wShowWindow = subprocess.SW_HIDE # raises OSError: [WinError 87] # in the second loop iteration starting with Python 3.7 for i in range(2): print(i) with open(os.devnull, 'w') as stderr: subprocess.check_call(['attrib'], stderr=stderr, startupinfo=STARTUPINFO) AFAICT, this works on Python 2.7, 3.4, 3.5, and 3.6 I think the documentation in https://docs.python.org/3/library/subprocess.html#windows-popen-helpers does not mention that every Popen call should be done with a fresh instance, so either the documentation needs to be changed, or the implementation (e.g. by deep-copying the instance). See also https://bugs.python.org/issue19764#msg320784 ---------- components: Library (Lib) messages: 321047 nosy: eryksun, vstinner, xflr6 priority: normal severity: normal status: open title: subprocess: reusing STARTUPINFO breaks under 3.7 (Windows) type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 11:02:58 2018 From: report at bugs.python.org (Krishna Ram Prakash R) Date: Wed, 04 Jul 2018 15:02:58 +0000 Subject: [New-bugs-announce] [issue34045] DoS due to null pointer dereference in marshal.dumps() Message-ID: <1530716578.74.0.56676864532.issue34045@psf.upfronthosting.co.za> New submission from Krishna Ram Prakash R : By passing a malformed string as input to marshal.loads() an attacker can trigger a null pointer dereference resulting in DoS. This happens because when a Python object is unmarshalled by reference, it is assumed that the target object is fully constructed. We can construct a marshal string such that it can reference partially constructed Python objects. Example ------- tuple(FrozenSet(REF(0))) Tuple -> FrozenSet -> REF(0) When unmarshalling of the tuple object starts, a new PyTuple_New() object is created and its address is added to p->refs array before starting to parse and load all its children elements in a loop. A FrozenSet can be added as 0th element of this tuple. And then add the 0th element of this FrozenSet as p->refs[0]. After an element is added to FrozenSet, it tries to hash it believing that it is a completely constructed Python object. While it tries to hash the original tuple, it does not have any valid addresses in ob_item array. This results in a null pointer dereference throwing a SIGSEGV and crashing of interpreter. Running the below script results in a segmentation fault. ``` #!/usr/bin/env python3 import marshal marshal.loads(b"\xa9\x01\xbe\x01\x00\x00\x00r\x00\x00\x00\x00") ``` ---------- components: Interpreter Core, Library (Lib) messages: 321050 nosy: benjamin.peterson, rkrp priority: normal severity: normal status: open title: DoS due to null pointer dereference in marshal.dumps() type: security versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 12:19:59 2018 From: report at bugs.python.org (Nir Barel) Date: Wed, 04 Jul 2018 16:19:59 +0000 Subject: [New-bugs-announce] [issue34046] subparsers -> add_parser doesn't support hyphen char '-' Message-ID: <1530721199.23.0.56676864532.issue34046@psf.upfronthosting.co.za> New submission from Nir Barel : parent_parser = argparse.ArgumentParser(add_help=False) main_parser = argparse.ArgumentParser(prog='app_cli') service_subparsers = main_parser.add_subparsers(title="service", dest="service_command", ) service_parser = service_subparsers.add_parser("-dr", help="sample help", parents=[parent_parser]) service_parser.add_argument("-old_host",help="my old host", dest="oldHost", required=False) args = main_parser.parse_args() when I try to run the app_cli -dr I am getting an error "error:unrecognized arguments: -dr" when I try to run the app_cli with -dr -h I am getting the help of the main application and not the help of the service subparser only if I change '-dr' to 'dr' it works as expected, but I need to support the hyphen for all arguments ---------- components: Library (Lib) messages: 321057 nosy: nir_barel at bmc.com priority: normal severity: normal status: open title: subparsers -> add_parser doesn't support hyphen char '-' type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 13:14:47 2018 From: report at bugs.python.org (Bruce Elgort) Date: Wed, 04 Jul 2018 17:14:47 +0000 Subject: [New-bugs-announce] [issue34047] Scrolling in IDLE for OS X is not working Message-ID: <1530724487.68.0.56676864532.issue34047@psf.upfronthosting.co.za> New submission from Bruce Elgort : When using IDLE on OS X and scrolling to the bottom of a file you are not able to scroll using a mouse back up. You need to use the arrow keys. ---------- assignee: terry.reedy components: IDLE messages: 321058 nosy: belgort, terry.reedy priority: normal severity: normal status: open title: Scrolling in IDLE for OS X is not working type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 4 16:41:58 2018 From: report at bugs.python.org (=?utf-8?b?SmFuIMWgdmVj?=) Date: Wed, 04 Jul 2018 20:41:58 +0000 Subject: [New-bugs-announce] [issue34048] Bad behavior of re.IGNORECASE Message-ID: <1530736918.23.0.56676864532.issue34048@psf.upfronthosting.co.za> New submission from Jan ?vec : re.sub() is behaving incorrectly, if re.IGNORECASE is used. Tested on 2.7, 3.4 and 3.6. The code follows: import re def subst(text): text = re.sub(r"\bnine\b", "niner", text, re.IGNORECASE) return text print(subst("nine nine nine nine")) It prints "niner niner nine nine". Without the re.IGNORECASE, the output is correct: "niner niner niner niner" ---------- components: Regular Expressions messages: 321062 nosy: Jan ?vec, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: Bad behavior of re.IGNORECASE type: behavior versions: Python 2.7, Python 3.4, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 02:44:31 2018 From: report at bugs.python.org (Windson Yang) Date: Thu, 05 Jul 2018 06:44:31 +0000 Subject: [New-bugs-announce] [issue34049] abs() method accept argument that implement __abs__() Message-ID: <1530773071.47.0.56676864532.issue34049@psf.upfronthosting.co.za> New submission from Windson Yang : Just like callable() method in https://docs.python.org/3/library/functions.html#callable > ...instances are callable if their class has a __call__() method. I think we should also mention this in abs(), abs(x) Return the absolute value of a number. If x defines __abs__, abs(x) returns x.__abs__(). The argument may be an integer or a floating point number. If the argument is a complex number, its magnitude is returned. ---------- components: Library (Lib) messages: 321080 nosy: Windson Yang priority: normal severity: normal status: open title: abs() method accept argument that implement __abs__() type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 04:17:41 2018 From: report at bugs.python.org (Roland Weber) Date: Thu, 05 Jul 2018 08:17:41 +0000 Subject: [New-bugs-announce] [issue34050] Broken links to "OpenSSL cipher list format" in documentation Message-ID: <1530778661.86.0.56676864532.issue34050@psf.upfronthosting.co.za> New submission from Roland Weber : The docs for SSLContext.set_ciphers [1] in Python 3 and ssl.wrap_socket [2] in Python 2 contain a link for "OpenSSL cipher list format", which points to an empty wiki page at https://wiki.openssl.org/index.php/Manual:Ciphers(1)#CIPHER_LIST_FORMAT The OpenSSL cipher list format is currently documented here instead: https://www.openssl.org/docs/manmaster/man1/ciphers.html [1] https://docs.python.org/3/library/ssl.html#ssl.SSLContext.set_ciphers [2] https://docs.python.org/2/library/ssl.html#ssl.wrap_socket ---------- assignee: docs at python components: Documentation messages: 321085 nosy: docs at python, rolweber priority: normal severity: normal status: open title: Broken links to "OpenSSL cipher list format" in documentation _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 04:45:49 2018 From: report at bugs.python.org (Windson Yang) Date: Thu, 05 Jul 2018 08:45:49 +0000 Subject: [New-bugs-announce] [issue34051] Update multiprocessing example Message-ID: <1530780349.49.0.56676864532.issue34051@psf.upfronthosting.co.za> New submission from Windson Yang : The docs at https://docs.python.org/3.8/library/multiprocessing.html#synchronization-between-processes give an example: from multiprocessing import Process, Lock def f(l, i): l.acquire() try: print('hello world', i) finally: l.release() if __name__ == '__main__': lock = Lock() for num in range(10): Process(target=f, args=(lock, num)).start() and point out "For instance one can use a lock to ensure that only one process prints to standard output at a time...". I'm not sure this is a good enough example for the reader. The reader can't tell the difference between the function with l.acquire() or not, The output just shows in the terminal at the same time. So I think a better idea just add time.sleep(0.1) before print('hello world', i) like this: l.acquire() try: # do something here # time.sleep(0.1) print('hello world', i) I can provide a pr if you guys like this idea. ---------- assignee: docs at python components: Documentation messages: 321088 nosy: Windson Yang, docs at python priority: normal severity: normal status: open title: Update multiprocessing example versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 06:34:47 2018 From: report at bugs.python.org (Sergey Fedoseev) Date: Thu, 05 Jul 2018 10:34:47 +0000 Subject: [New-bugs-announce] [issue34052] sqlite's create_function() raises exception on unhashable callback, but creates function Message-ID: <1530786887.48.0.56676864532.issue34052@psf.upfronthosting.co.za> New submission from Sergey Fedoseev : In [1]: import sqlite3 In [2]: con = sqlite3.connect(':memory:') In [3]: con.execute('SELECT f()') --------------------------------------------------------------------------- OperationalError Traceback (most recent call last) in () ----> 1 con.execute('SELECT f()') OperationalError: no such function: f In [4]: con.create_function('f', 0, []) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 con.create_function('f', 0, []) TypeError: unhashable type: 'list' In [5]: con.execute('SELECT f()') --------------------------------------------------------------------------- OperationalError Traceback (most recent call last) in () ----> 1 con.execute('SELECT f()') OperationalError: user-defined function raised exception It seems that something like this cause segmentation fault, but I can't reproduce it. Some other similar sqlite functions also affected. They can be easily modified to accept unhashable objects, but probably it should be done in another issue. ---------- components: Extension Modules messages: 321094 nosy: sir-sigurd priority: normal severity: normal status: open title: sqlite's create_function() raises exception on unhashable callback, but creates function type: behavior versions: Python 2.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 06:52:10 2018 From: report at bugs.python.org (Pander) Date: Thu, 05 Jul 2018 10:52:10 +0000 Subject: [New-bugs-announce] [issue34053] Support localization of unicode descriptions Message-ID: <1530787930.49.0.56676864532.issue34053@psf.upfronthosting.co.za> New submission from Pander : Please, support localization for Unicode block description and character description. Translations are available from https://github.com/unicode-table/unicode-table-data/tree/master/loc If possible, use a gettext approach similar to https://pypi.org/project/pycountry/ Implementing this feature will allow users to read Unicode descriptions in their own language, other than English. For example, now is possible only in English: from unicodedata import name print(name('?')) LATIN SMALL LETTER SHARP S So unicodedata could provide a way to translate LATIN SMALL LETTER SHARP S to e.g. German with: from unicodedata import name, LOCALED_DIR from gettext import translation german = translation('UnicodeData' LOCALED_DIR, languages=['de']) german.install() print(_(name('?'))) LATEINISCHER KLEINBUCHSTABE SCHARFES S and something similar for unicodedata.category ---------- components: Unicode messages: 321095 nosy: PanderMusubi, ezio.melotti, vstinner priority: normal severity: normal status: open title: Support localization of unicode descriptions type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 12:33:47 2018 From: report at bugs.python.org (STINNER Victor) Date: Thu, 05 Jul 2018 16:33:47 +0000 Subject: [New-bugs-announce] [issue34054] multiprocessing should use time.monotonic() for timeout Message-ID: <1530808427.84.0.56676864532.issue34054@psf.upfronthosting.co.za> New submission from STINNER Victor : In different functions, the multiprocessing module uses the system clock: time.time(). The system clock can be updated manually by the system administrator or automatically by NTP (for example). Attached PR modifies multiprocessing to use time.monotonic() instead to not be affected by system clock changes. time.monotonic() is always available since Python 3.5. See also the PEP 418. ---------- components: Library (Lib) messages: 321115 nosy: vstinner priority: normal severity: normal status: open title: multiprocessing should use time.monotonic() for timeout versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 15:05:33 2018 From: report at bugs.python.org (Grant Jenks) Date: Thu, 05 Jul 2018 19:05:33 +0000 Subject: [New-bugs-announce] [issue34055] IDLE inserts extra blank line in prompt after SyntaxError Message-ID: <1530817533.77.0.56676864532.issue34055@psf.upfronthosting.co.za> New submission from Grant Jenks : IDLE inserts an extra blank line after the prompt after encountering a SyntaxError: ``` >>> 1 + 2 3 >>> print('Hello') Hello v-- Missing single quote! >>> d = {1: 'uno', 2: 'dos', 3: 'tres} SyntaxError: EOL while scanning string literal >>> print('Hello') <-- Extra blank line and whitespace (tab and space). Hello >>> 1 + 2 <-- Extra blank line and whitespace (tab and space). 3 >>> ``` Notice the line starting with ">>> d =" above contains a missing single quote which causes a "SyntaxError: EOL while scanning string literal". This causes IDLE to insert extra blank lines with one tab and one space after every input. The old behavior looked like: ``` >>> 1 + 2 3 >>> print('Hello') Hello >>> d = {1: 'uno', 2: 'dos', 3: 'tres} SyntaxError: EOL while scanning string literal >>> print('Hello') Hello >>> 1 + 2 3 ``` ---------- assignee: terry.reedy components: IDLE messages: 321126 nosy: grantjenks, terry.reedy priority: normal severity: normal status: open title: IDLE inserts extra blank line in prompt after SyntaxError type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 18:31:12 2018 From: report at bugs.python.org (Patrick McCarty) Date: Thu, 05 Jul 2018 22:31:12 +0000 Subject: [New-bugs-announce] [issue34056] checked hash-based pyc files not working with imp module Message-ID: <1530829872.86.0.56676864532.issue34056@psf.upfronthosting.co.za> New submission from Patrick McCarty : OS: Clear Linux build 23460 Python version: 3.7.0 Description: I am seeing an uncaught exception in Python 3.7.0 when using the "imp" module to import a module that has a checked hash-based pyc file. See the attached source files. Steps to reproduce: 1) Copy attached source files to a directory 2) In that directory, run $ python3.7 -m compileall --invalidation-mode checked-hash imp-test-mod.py $ python3.7 imp-test.py 3) See the resulting output (omitting the imp deprecation notice): Traceback (most recent call last): File "imp-test.py", line 6, in mod = imp.load_module(modname, f, p, d) File "/usr/lib/python3.7/imp.py", line 235, in load_module return load_source(name, filename, file) File "/usr/lib/python3.7/imp.py", line 172, in load_source module = _load(spec) File "", line 696, in _load File "", line 677, in _load_unlocked File "", line 724, in exec_module File "", line 838, in get_code TypeError: a bytes-like object is required, not 'str' ---------- components: Interpreter Core files: imp-test.py messages: 321139 nosy: phmccarty priority: normal severity: normal status: open title: checked hash-based pyc files not working with imp module type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47671/imp-test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 18:41:49 2018 From: report at bugs.python.org (Alberto) Date: Thu, 05 Jul 2018 22:41:49 +0000 Subject: [New-bugs-announce] [issue34057] Py_Initialize aborts when using static Python version. Windows Message-ID: <1530830509.1.0.56676864532.issue34057@psf.upfronthosting.co.za> New submission from Alberto : Hi, I've followed the build instructions to get a statically linked Python library in windows. The compilation works great and I get a big fat statically linked .lib file. When I use it and in my code I call Py_Initialize() the program aborts and I get this error: Fatal Python error: initfsencoding: unable to load the file system codec ModuleNotFoundError: No module named 'encodings' It seems that python is looking for encodings on the file system instead of looking for the built-in one since if I do Py_SetPythonHome(L"C:\\Python37.0-x64"); before calling Py_Initialize it works fine. Why is Python looking for external modules when it is a statically linked library and encodings should be built-in? How can I indicate Python to look for the modules in itself and not externally? Regards ---------- components: Interpreter Core messages: 321140 nosy: illera88 priority: normal severity: normal status: open title: Py_Initialize aborts when using static Python version. Windows type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 20:53:40 2018 From: report at bugs.python.org (Ted Kandell) Date: Fri, 06 Jul 2018 00:53:40 +0000 Subject: [New-bugs-announce] [issue34058] Default Python 3.7 install broken on openSUSE Leap 42.3: $PYTHONHOME/lib64/python3.7/lib-dynload/ not linked to $PYTHONHOME/lib/python3.7/lib-dynload/ Message-ID: <1530838420.77.0.56676864532.issue34058@psf.upfronthosting.co.za> New submission from Ted Kandell : The default Python 3.7 install (./configure with no parameters) does not work (at least) on openSUSE Leap 42.3. Python3 gives a ModuleNotFoundError: No module named 'readline' error, and pip3 has a ModuleNotFoundError: No module named '_socket' error, because the site libraries cannot be found. The fix is to manually: sudo ln -s /usr/local/lib64/python3.7/lib-dynload/ /usr/local/lib/python3.7/lib-dynload The same problem should also be present with a PYTHONHOME other than the default /usr/local . I suspect this is a more widespread problem than just openSUSE Leap 42.3, and may exist in other distros as well. The fix should be for make install to automatically create the symbolic link for the $PYTHONHOME/lib64/python3.7/lib-dynload directory in $PYTHONHOME/lib/python3.7/ . ---------- components: Installation messages: 321145 nosy: tkandell priority: normal severity: normal status: open title: Default Python 3.7 install broken on openSUSE Leap 42.3: $PYTHONHOME/lib64/python3.7/lib-dynload/ not linked to $PYTHONHOME/lib/python3.7/lib-dynload/ type: crash versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 5 23:42:18 2018 From: report at bugs.python.org (Guillaume Perrault-Archambault) Date: Fri, 06 Jul 2018 03:42:18 +0000 Subject: [New-bugs-announce] [issue34059] multiprocessing deadlock Message-ID: <1530848538.94.0.56676864532.issue34059@psf.upfronthosting.co.za> New submission from Guillaume Perrault-Archambault : The simple code attached causes a deadlock in Linux. Problem is I have to slightly muck around with it depending on the distro and python version to get it to deadlock. On the cluster I use the most (python 3.6.3, CentOS Linux release 7.4.1708, pytorch 0.4.0 with no CUDA), the code attached causes a deadlock. ---------- components: Library (Lib) files: multiprocess_torch.py messages: 321146 nosy: gobbedy priority: normal severity: normal status: open title: multiprocessing deadlock type: crash versions: Python 3.6 Added file: https://bugs.python.org/file47673/multiprocess_torch.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 6 12:01:09 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 06 Jul 2018 16:01:09 +0000 Subject: [New-bugs-announce] [issue34060] regrtest: log "CPU usage" on Windows Message-ID: <1530892869.55.0.56676864532.issue34060@psf.upfronthosting.co.za> New submission from STINNER Victor : I would help to debug race conditions on Windows to log the "CPU usage" on regrtest, as we do on other platforms (using os.getloadavg()). Links: * https://stackoverflow.com/questions/13666458/python-collect-system-stats * https://docs.microsoft.com/en-us/windows/desktop/api/pdh/nf-pdh-pdhmakecounterpatha * GetSystemTimes()? * https://stackoverflow.com/questions/23143693/retrieving-cpu-load-percent-total-in-windows-with-c ---------- components: Tests, Windows messages: 321177 nosy: paul.moore, steve.dower, tim.golden, vstinner, zach.ware priority: normal severity: normal status: open title: regrtest: log "CPU usage" on Windows versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 6 12:51:48 2018 From: report at bugs.python.org (Berker Peksag) Date: Fri, 06 Jul 2018 16:51:48 +0000 Subject: [New-bugs-announce] [issue34061] Document sqlite3.NotSupportedError exception Message-ID: <1530895908.13.0.56676864532.issue34061@psf.upfronthosting.co.za> New submission from Berker Peksag : Most of the exceptions in sqlite3 module were documented in issue 6057 (https://github.com/python/cpython/commit/ed789f9cf9586d94e85115bb516a2ab6b9a2f668) Unfortunately, I noticed that I missed NotSupportedError while reviewing PR 8086. I think it should be documented in the Exceptions section as well: https://docs.python.org/3.8/library/sqlite3.html#exceptions We can adapt the text in PEP 249: https://www.python.org/dev/peps/pep-0249/#notsupportederror ---------- assignee: docs at python components: Documentation keywords: easy messages: 321184 nosy: berker.peksag, docs at python priority: normal severity: normal stage: needs patch status: open title: Document sqlite3.NotSupportedError exception type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 6 14:13:30 2018 From: report at bugs.python.org (Brett Cannon) Date: Fri, 06 Jul 2018 18:13:30 +0000 Subject: [New-bugs-announce] [issue34062] Python launcher on Windows does not work with --list or --list-paths Message-ID: <1530900810.19.0.56676864532.issue34062@psf.upfronthosting.co.za> New submission from Brett Cannon : When you run `py -h` it says you can use -0 or --list as well as -0p or --list-paths, but both --list and --list-paths don't work (the -0-based options do, though). ---------- components: Windows messages: 321187 nosy: brett.cannon, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: test needed status: open title: Python launcher on Windows does not work with --list or --list-paths type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 6 17:42:25 2018 From: report at bugs.python.org (Jim Jewett) Date: Fri, 06 Jul 2018 21:42:25 +0000 Subject: [New-bugs-announce] [issue34063] binhex REASONABLY_LARGE = 32768 so what is 128000 Message-ID: <1530913345.39.0.56676864532.issue34063@psf.upfronthosting.co.za> New submission from Jim Jewett : binhex defines a module-wide constant of REASONABLY_LARGE = 32768 # Minimal amount we pass the rle-coder Later on, in 5 locations it does either ifp.read(128000) or ifp.read_rsrc(128000) It isn't clear why a different constant is used, let alone why a literal is used instead of something like REASONABLY_LARGE. ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 321193 nosy: Jim.Jewett, docs at python priority: low severity: normal stage: needs patch status: open title: binhex REASONABLY_LARGE = 32768 so what is 128000 type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 7 06:30:07 2018 From: report at bugs.python.org (Ryusei Yamaguchi) Date: Sat, 07 Jul 2018 10:30:07 +0000 Subject: [New-bugs-announce] [issue34064] subprocess functions with shell=1 pass wrong command to win32 shell Message-ID: <1530959407.22.0.56676864532.issue34064@psf.upfronthosting.co.za> New submission from Ryusei Yamaguchi : In some cases, functions defined in subprocess modules pass wrong command to win32 shell. Python 3.8.0a0 (heads/master:4629c0d531, Jul 7 2018, 16:37:33) [MSC v.1914 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess >>> subprocess.check_output('cmd /c echo hello', shell=1) b'hello"\r\n' The result is as same as the following command run with cmd.exe: C:\> %COMSPEC% /c "cmd /c echo hello" hello" Specifying /s switch fixes the issue: C:\> %COMSPEC% /s /c "cmd /c echo hello" hello ---------- components: Library (Lib), Windows messages: 321213 nosy: mandel59, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: subprocess functions with shell=1 pass wrong command to win32 shell 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 Sat Jul 7 07:32:03 2018 From: report at bugs.python.org (Dong-hee Na) Date: Sat, 07 Jul 2018 11:32:03 +0000 Subject: [New-bugs-announce] [issue34065] 'force' should be printed as italic font not highlight font. Message-ID: <1530963123.0.0.56676864532.issue34065@psf.upfronthosting.co.za> New submission from Dong-hee Na : https://docs.python.org/3.8/library/logging.html#logging.basicConfig Although I wrote the 'force' as '``force`` ' but it is printed as a highlighted font. The 'force' section should be printed as italic font not highlight font. Maybe there is something mistake I didn't catch. ---------- assignee: docs at python components: Documentation messages: 321214 nosy: corona10, docs at python priority: normal severity: normal status: open title: 'force' should be printed as italic font not highlight font. versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 7 13:11:52 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 07 Jul 2018 17:11:52 +0000 Subject: [New-bugs-announce] [issue34066] Possible resource warning in "with open()" Message-ID: <1530983512.39.0.56676864532.issue34066@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The bytecode generated for "with open()": with open(path) as file: data = file.read() 1 0 LOAD_NAME 0 (open) 2 LOAD_NAME 1 (path) 4 CALL_FUNCTION 1 6 SETUP_WITH 14 (to 22) 8 STORE_NAME 2 (file) 2 10 LOAD_NAME 2 (file) 12 LOAD_METHOD 3 (read) 14 CALL_METHOD 0 16 STORE_NAME 4 (data) 18 POP_BLOCK 20 BEGIN_FINALLY >> 22 WITH_CLEANUP_START 24 WITH_CLEANUP_FINISH 26 END_FINALLY 28 LOAD_CONST 0 (None) 30 RETURN_VALUE The execution can be interrupted by Ctrl-C between calling open() and entering the 'with' block. In this case the file object will be created, but its __enter__ and __exit__ methods will be not executed. As a result it will be closed after disappearing a reference to it and a ResourceWarning will be emitted. The solution is disabling interruption before the SETUP_WITH opcode. It is already disabled before SETUP_FINALLY and YIELD_FROM. It is worth to disable it before BEFORE_ASYNC_WITH for consistency although I don't have examples for it. See also issue29988. ---------- components: Interpreter Core messages: 321224 nosy: Mark.Shannon, benjamin.peterson, ncoghlan, serhiy.storchaka, yselivanov priority: normal severity: normal status: open title: Possible resource warning in "with open()" type: resource usage versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 7 13:33:25 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 07 Jul 2018 17:33:25 +0000 Subject: [New-bugs-announce] [issue34067] Problem with contextlib.nullcontext Message-ID: <1530984805.95.0.56676864532.issue34067@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : There is a flaw in the example in the documentation for contextlib.nullcontext. def process_file(file_or_path): if isinstance(file_or_path, str): # If string, open file cm = open(file_or_path) else: # Caller is responsible for closing file cm = nullcontext(file_or_path) with cm as file: # Perform processing on the file The execution can be interrupted by Ctrl-C between opening a file and entering a 'with' block. There is the same problem with the simple "with open(path) as file:", but it can be easily solved (see issue34066). It is harder to do for this example, because there are more opcodes between calling open() and entering 'with'. I afraid that this problem can't be solved in general case. Maybe contextlib.nullcontext has a flaw similar to the flaw in contextlib.nested(). ---------- messages: 321226 nosy: ncoghlan, serhiy.storchaka priority: normal severity: normal status: open title: Problem with contextlib.nullcontext type: resource usage versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 8 02:34:42 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 08 Jul 2018 06:34:42 +0000 Subject: [New-bugs-announce] [issue34068] Assertion failure in _PyType_Lookup Message-ID: <1531031682.19.0.56676864532.issue34068@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : I got the following failure when running tests with coverage on VSTS. https://python.visualstudio.com/cpython/cpython%20Team/_build/results?buildId=14680&view=logs 2018-07-05T12:11:22.0719913Z 0:17:49 load avg: 0.82 [373/413] test_urllib 2018-07-05T12:11:22.2574704Z python: Objects/typeobject.c:3086: _PyType_Lookup: Assertion `!PyErr_Occurred()' failed. 2018-07-05T12:11:22.2603179Z Fatal Python error: Aborted 2018-07-05T12:11:22.2608453Z 2018-07-05T12:11:22.2622441Z Current thread 0x00007fb6465c7700 (most recent call first): 2018-07-05T12:11:22.2634973Z File "/opt/vsts/work/1/s/Lib/http/client.py", line 405 in close 2018-07-05T12:11:22.2650517Z File "/opt/vsts/work/1/s/Lib/traceback.py", line 216 in clear_frames 2018-07-05T12:11:22.2663944Z File "/opt/vsts/work/1/s/Lib/unittest/case.py", line 205 in __exit__ 2018-07-05T12:11:22.2676467Z File "/opt/vsts/work/1/s/Lib/test/test_urllib.py", line 368 in test_invalid_redirect 2018-07-05T12:11:22.2704792Z File "/opt/vsts/work/1/s/Lib/unittest/case.py", line 615 in run 2018-07-05T12:11:22.2727078Z File "/opt/vsts/work/1/s/Lib/unittest/case.py", line 663 in __call__ 2018-07-05T12:11:22.2738921Z File "/opt/vsts/work/1/s/Lib/unittest/suite.py", line 122 in run 2018-07-05T12:11:22.2754215Z File "/opt/vsts/work/1/s/Lib/unittest/suite.py", line 84 in __call__ 2018-07-05T12:11:22.2768065Z File "/opt/vsts/work/1/s/Lib/unittest/suite.py", line 122 in run 2018-07-05T12:11:22.2784999Z File "/opt/vsts/work/1/s/Lib/unittest/suite.py", line 84 in __call__ 2018-07-05T12:11:22.2797611Z File "/opt/vsts/work/1/s/Lib/unittest/suite.py", line 122 in run 2018-07-05T12:11:22.2813174Z File "/opt/vsts/work/1/s/Lib/unittest/suite.py", line 84 in __call__ 2018-07-05T12:11:22.2826999Z File "/opt/vsts/work/1/s/Lib/test/support/__init__.py", line 1782 in run 2018-07-05T12:11:22.2841544Z File "/opt/vsts/work/1/s/Lib/test/support/__init__.py", line 1883 in _run_suite 2018-07-05T12:11:22.2854173Z File "/opt/vsts/work/1/s/Lib/test/support/__init__.py", line 1973 in run_unittest 2018-07-05T12:11:22.2868193Z File "/opt/vsts/work/1/s/Lib/test/libregrtest/runtest.py", line 175 in test_runner 2018-07-05T12:11:22.2883280Z File "/opt/vsts/work/1/s/Lib/test/libregrtest/runtest.py", line 179 in runtest_inner 2018-07-05T12:11:22.2898238Z File "/opt/vsts/work/1/s/Lib/test/libregrtest/runtest.py", line 140 in runtest 2018-07-05T12:11:22.2912684Z File "/opt/vsts/work/1/s/Lib/test/libregrtest/main.py", line 384 in run_tests_sequential 2018-07-05T12:11:22.2927233Z File "/opt/vsts/work/1/s/Lib/test/libregrtest/main.py", line 488 in run_tests 2018-07-05T12:11:22.2941508Z File "/opt/vsts/work/1/s/Lib/test/libregrtest/main.py", line 566 in _main 2018-07-05T12:11:22.2955879Z File "/opt/vsts/work/1/s/Lib/test/libregrtest/main.py", line 531 in main 2018-07-05T12:11:22.2971440Z File "/opt/vsts/work/1/s/Lib/test/libregrtest/main.py", line 584 in main 2018-07-05T12:11:22.2985417Z File "/opt/vsts/work/1/s/Lib/test/__main__.py", line 2 in 2018-07-05T12:11:22.3002269Z File "/opt/vsts/work/1/s/venv/lib/python3.8/site-packages/coverage/execfile.py", line 184 in run_python_file 2018-07-05T12:11:22.3017503Z File "/opt/vsts/work/1/s/venv/lib/python3.8/site-packages/coverage/execfile.py", line 114 in run_python_module 2018-07-05T12:11:22.3035688Z File "/opt/vsts/work/1/s/venv/lib/python3.8/site-packages/coverage/cmdline.py", line 624 in do_run 2018-07-05T12:11:22.3051283Z File "/opt/vsts/work/1/s/venv/lib/python3.8/site-packages/coverage/cmdline.py", line 488 in command_line 2018-07-05T12:11:22.3067258Z File "/opt/vsts/work/1/s/venv/lib/python3.8/site-packages/coverage/cmdline.py", line 753 in main 2018-07-05T12:11:22.3083839Z File "/opt/vsts/work/1/s/venv/lib/python3.8/site-packages/coverage/__main__.py", line 8 in 2018-07-05T12:11:22.3099563Z File "/opt/vsts/work/1/s/Lib/runpy.py", line 85 in _run_code 2018-07-05T12:11:22.3113337Z File "/opt/vsts/work/1/s/Lib/runpy.py", line 193 in _run_module_as_main 2018-07-05T12:11:22.4058762Z Aborted (core dumped) 2018-07-05T12:11:22.4252037Z ##[error]Bash exited with code '134'. 2018-07-05T12:11:22.5073689Z ##[section]Finishing: Tests with coverage It is not related to changes made in PR 8071. Is Coverage.py doing something wrong or just exposes a flaw in the interpreter? ---------- components: Interpreter Core messages: 321261 nosy: nedbat, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: Assertion failure in _PyType_Lookup type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 8 06:57:23 2018 From: report at bugs.python.org (Joshua Avalon) Date: Sun, 08 Jul 2018 10:57:23 +0000 Subject: [New-bugs-announce] [issue34069] Fail to move file in Windows (AttributeError) Message-ID: <1531047443.22.0.56676864532.issue34069@psf.upfronthosting.co.za> New submission from Joshua Avalon : from shutil import move from pathlib import Path a = Path("s") b = Path("a.txt") move(b, a) This will throw AttributeError: 'WindowsPath' object has no attribute 'rstrip' >From the document, it should able to move: If the destination is an existing directory, then src is moved inside that directory. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If a = Path("s/a.txt"), it does not throw error. Enviroment: Window 10 Python 3.7.0 ---------- components: Windows messages: 321270 nosy: joshuaavalon, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Fail to move file in Windows (AttributeError) versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 8 14:12:53 2018 From: report at bugs.python.org (David Herberth) Date: Sun, 08 Jul 2018 18:12:53 +0000 Subject: [New-bugs-announce] [issue34070] Superfluous call to isatty in open() when buffering >= 0 Message-ID: <1531073573.35.0.56676864532.issue34070@psf.upfronthosting.co.za> New submission from David Herberth : _iomodule.c:_io_open_impl checks for isatty even if not necessary (when buffering >= 0). Code: https://github.com/python/cpython/blob/c0ee341b29bd7d978b49272a2c0e2dcfa77404d5/Modules/_io/_iomodule.c#L392 { PyObject *res = _PyObject_CallMethodId(raw, &PyId_isatty, NULL); if (res == NULL) goto error; isatty = PyLong_AsLong(res); Py_DECREF(res); if (isatty == -1 && PyErr_Occurred()) goto error; } if (buffering == 1 || (buffering < 0 && isatty)) { buffering = -1; line_buffering = 1; } else line_buffering = 0; Python Code to reproduce: with open('foo', 'rb', buffering=0) as f: f.read() This generates an error (can be seen with strace): ioctl(5, TCGETS, 0x7ffef1435b60) = -1 ENOTTY (Inappropriate ioctl for device) I'll open a PR shortly. ---------- components: IO messages: 321281 nosy: Dav1d priority: normal severity: normal status: open title: Superfluous call to isatty in open() when buffering >= 0 type: performance versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 8 19:32:51 2018 From: report at bugs.python.org (Jim DeLaHunt) Date: Sun, 08 Jul 2018 23:32:51 +0000 Subject: [New-bugs-announce] [issue34071] repr(task) raises AssertionError for coros which loop.create_task accepts; complications ensue Message-ID: <1531092771.84.0.56676864532.issue34071@psf.upfronthosting.co.za> New submission from Jim DeLaHunt : In Python 3.6.5, Task.__repr__() with raise an AssertionError for certain, arguably incorrect, coroutines which the instantiation of Task() accepts. repr(task) thus fails with an AssertionError, instead of returning a string which describes the task object and why its coroutine is wrong. Complications ensue. In particular, if this Task is used in a unittest.TestCase, and appears in test failure diagnostics, the test diagnostics are discarded when the AssertionError occurs, masking the problem in the code under test. In Python 3.7.0, Task.__init__() checks the supplied coroutine argument, using the same asyncio.iscoroutine() method which Task.__repr__() calls. Thus, while repr(task) can still raise an AssertionError, it is much harder to reach this situation. Task.__init__() is likely to raise an exception first, and the diagnostics will be pretty clear. To reproduce: 1. Here is a simple, perhaps misguided, attempt at a coroutine, and a Task which uses it: import asyncio async def ag(): yield None print("type(ag()) is ", type(ag())) print("asyncio.iscoroutine(ag)? ", asyncio.iscoroutine(ag)) print("repr(ag()) is ", repr(ag())) task = asyncio.get_event_loop().create_task(ag()) print("type(task) is ", type(task)) print("asyncio.iscoroutine(task._coro)? ", asyncio.iscoroutine(task._coro)) print("repr(task) is ") print(repr(task)) The output from Python 3.6.5 is: type(ag()) is asyncio.iscoroutine(ag)? False repr(ag()) is type(task) is asyncio.iscoroutine(task._coro)? False repr(task) is Traceback (most recent call last): File "bug_task_repr_1.py", line 31, in print(repr(task)) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_tasks.py", line 15, in _task_repr_info coro = coroutines._format_coroutine(task._coro) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/coroutines.py", line 276, in _format_coroutine assert iscoroutine(coro) AssertionError Observed behaviour: Here is a unit test which attempts to exercise the above Task. The test fails, but the AssertionError in Task.__repr__() discards the error diagnostics: from asyncio import test_utils class Test(test_utils.TestCase): def setUp(self): super().setUp() self.loop = self.new_test_loop() def test_wrongly_scheduled(self): # this is a simple, and maybe mistaken, coroutine async def ag(): yield None _ = self.loop.create_task(ag()) test_utils.run_once(self.loop) The output from Python 3.6.5 is: % python -m unittest bug_task_repr_2.py Exception in default exception handler Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 1291, in call_exception_handler self.default_exception_handler(context) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 1263, in default_exception_handler value = repr(value) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_tasks.py", line 15, in _task_repr_info coro = coroutines._format_coroutine(task._coro) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/coroutines.py", line 276, in _format_coroutine assert iscoroutine(coro) AssertionError . ---------------------------------------------------------------------- Ran 1 test in 0.001s OK Note that the error traceback is all about the exception from Task.__repr__(), and the diagnostics about why the unit test failed is discarded. Expected behaviour: Here is the same unit test, but this time with a replacement method for Task._task_repr_info() which avoids the AssertionError. import asyncio from asyncio import test_utils import types class Test(test_utils.TestCase): def setUp(self): super().setUp() self.loop = self.new_test_loop() def test_wrongly_scheduled(self): # this is a simple, and maybe mistaken, coroutine async def ag(): yield None task = self.loop.create_task(ag()) task._repr_info = types.MethodType( task_safe_repr_info, task ) test_utils.run_once(self.loop) def task_safe_repr_info(self): '''task.task_safe_repr_info(): string list representation of task. Won't raise AssertionError If you have a Task object which is raising an AssertionError from "assert iscoroutine(coro)", then assign to instantiated object: task._repr_info = task_safe_repr_info Patched task object should be able to survive the AssertionError and deliver a useful representation. ''' try: # from Task._repr_info(self), which calls base_tasks._task_repr_info(self) info = asyncio.base_futures._future_repr_info(self) if self._must_cancel: # replace status info[0] = 'cancelling' # Expand: coro = coroutines._format_coroutine(task._coro) # coro_repr = coroutines._format_coroutine(task._coro):276 does assert iscoroutine(coro) # This fails. Expand that routine, without the assert. coro = self._coro if not hasattr(coro, 'cr_code') and not hasattr(coro, 'gi_code'): # Most likely a built-in type or a Cython coroutine. # Built-in types might not have __qualname__ or __name__. coro_name = getattr( coro, '__qualname__', getattr(coro, '__name__', type(coro).__name__)) coro_name = '{}()'.format(coro_name) running = False try: running = coro.cr_running except AttributeError: try: running = coro.gi_running except AttributeError: pass if running: coro_repr = '{} running'.format(coro_name) else: coro_repr = coro_name else: coro_name = None if isinstance(coro, asyncio.coroutines.CoroWrapper): func = coro.func coro_name = coro.__qualname__ if coro_name is not None: coro_name = '{}()'.format(coro_name) else: func = coro if coro_name is None: coro_name = asyncio.events._format_callback(func, (), {}) try: coro_code = coro.gi_code except AttributeError: coro_code = coro.cr_code try: coro_frame = coro.gi_frame except AttributeError: coro_frame = coro.cr_frame filename = coro_code.co_filename lineno = 0 if (isinstance(coro, asyncio.coroutines.CoroWrapper) and not inspect.isgeneratorfunction(coro.func) and coro.func is not None): source = asyncio.events._get_function_source(coro.func) if source is not None: filename, lineno = source if coro_frame is None: coro_repr = ('%s done, defined at %s:%s' % (coro_name, filename, lineno)) else: coro_repr = ('%s running, defined at %s:%s' % (coro_name, filename, lineno)) elif coro_frame is not None: lineno = coro_frame.f_lineno coro_repr = ('%s running at %s:%s' % (coro_name, filename, lineno)) else: lineno = coro_code.co_firstlineno coro_repr = ('%s done, defined at %s:%s' % (coro_name, filename, lineno)) # end of coroutines._format_coroutine(task._coro) # return coro_repr info.insert(1, 'coro=%s(<%s>)' % (type(coro), coro_repr)) if self._fut_waiter is not None: info.insert(2, 'wait_for=%r' % self._fut_waiter) return info except: return [type(self), id(self)] Here is the result of running that unit test on the patched Task object. Note that there is no AssertionError from repr(), and the diagnostics about the failing unit tests are now clear: % python -m unittest bug_task_repr_3.py . ---------------------------------------------------------------------- Ran 1 test in 0.000s OK Task exception was never retrieved future: (.ag()>) exception=AttributeError("'async_generator' object has no attribute 'send'",)> AttributeError: 'async_generator' object has no attribute 'send' ---------- components: asyncio messages: 321292 nosy: JDLH, asvetlov, yselivanov priority: normal severity: normal status: open title: repr(task) raises AssertionError for coros which loop.create_task accepts; complications ensue type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 8 19:41:25 2018 From: report at bugs.python.org (hyu) Date: Sun, 08 Jul 2018 23:41:25 +0000 Subject: [New-bugs-announce] [issue34072] 3.7.0 Windows embeddable zip vcruntime140.dll Message-ID: <1531093285.64.0.56676864532.issue34072@psf.upfronthosting.co.za> New submission from hyu : 3.7.0 Windows embeddable zip is missing vcruntime140.dll(?) Running python would display error about VCRUNTIME140.DLL. Copying vcruntime140.dll from earlier 3.6.x release is a work around. ---------- components: Windows messages: 321294 nosy: hyu, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: 3.7.0 Windows embeddable zip vcruntime140.dll type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 8 21:30:20 2018 From: report at bugs.python.org (Jon Banafato) Date: Mon, 09 Jul 2018 01:30:20 +0000 Subject: [New-bugs-announce] [issue34073] asyncio and ProcessPoolExecutor: OSError on loop.close() Message-ID: <1531099820.7.0.56676864532.issue34073@psf.upfronthosting.co.za> New submission from Jon Banafato : Calling loop.close() on an eventloop configured to use a ProcessPoolExecutor can result in an OSError. Expected behavior: no exception raised. Actual behavior: an OSError is raised, and following this call, quit() fails to terminate the process gracefully. Example: Python 3.8.0a0 (default, Jul 7 2018, 14:35:49) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import asyncio >>> from concurrent.futures import ProcessPoolExecutor >>> import os >>> >>> loop = asyncio.get_event_loop_policy().new_event_loop() >>> loop.set_default_executor(ProcessPoolExecutor()) >>> future = loop.run_in_executor(None, os.getpid) >>> loop.run_until_complete(future) 24697 >>> loop.close() Exception ignored in: .weakref_cb at 0x7f52e7f643f0> Traceback (most recent call last): File "/code/Lib/concurrent/futures/process.py", line 567, in weakref_cb thread_wakeup.wakeup() File "/code/Lib/concurrent/futures/process.py", line 89, in wakeup self._writer.send_bytes(b"") File "/code/Lib/multiprocessing/connection.py", line 183, in send_bytes self._check_closed() File "/code/Lib/multiprocessing/connection.py", line 136, in _check_closed Exception in thread QueueManagerThread: Traceback (most recent call last): File "/code/Lib/threading.py", line 917, in _bootstrap_inner self.run() File "/code/Lib/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/code/Lib/concurrent/futures/process.py", line 368, in _queue_management_worker thread_wakeup.clear() File "/code/Lib/concurrent/futures/process.py", line 92, in clear while self._reader.poll(): File "/code/Lib/multiprocessing/connection.py", line 255, in poll self._check_closed() File "/code/Lib/multiprocessing/connection.py", line 136, in _check_closed raise OSError("handle is closed") OSError: handle is closed raise OSError("handle is closed") OSError: handle is closed ---------- components: Library (Lib), asyncio messages: 321297 nosy: asvetlov, jonafato, yselivanov priority: normal severity: normal status: open title: asyncio and ProcessPoolExecutor: OSError on loop.close() type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 9 10:01:52 2018 From: report at bugs.python.org (Andriy Maletsky) Date: Mon, 09 Jul 2018 14:01:52 +0000 Subject: [New-bugs-announce] [issue34074] Asyncio breaks coroutine finalization process Message-ID: <1531144912.36.0.56676864532.issue34074@psf.upfronthosting.co.za> New submission from Andriy Maletsky : Source: https://stackoverflow.com/q/51245011/6275324 Asyncio somehow breaks coroutine finalization. I believe there may be a bug in C implementation (_asyncio) of tasks or futures. Reproducible within version 3.7.0 at python:3.7 docker container. Consider this example (except and finally blocks will never execute): import asyncio async def work(): try: print('started working') await asyncio.sleep(3600) except BaseException as e: print('caught ' + str(type(e))) finally: print('finalization completed') async def stopper(): await asyncio.sleep(5) loop.stop() loop = asyncio.get_event_loop() loop.create_task(work()) loop.create_task(stopper()) loop.run_forever() And there is asyncio-free piece of code, which works properly, catching GeneratorExit, thrown by coro destructor: import asyncio async def work(): try: print('started working') await asyncio.sleep(3600) except BaseException as e: print('caught ' + str(type(e))) finally: print('finalization completed') coro = work() coro.send(None) del coro ---------- components: asyncio messages: 321321 nosy: and800, asvetlov, yselivanov priority: normal severity: normal status: open title: Asyncio breaks coroutine finalization process type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 9 11:29:34 2018 From: report at bugs.python.org (Yury Selivanov) Date: Mon, 09 Jul 2018 15:29:34 +0000 Subject: [New-bugs-announce] [issue34075] We should prohibit setting a ProcessPoolExecutor in with set_default_executor Message-ID: <1531150174.99.0.56676864532.issue34075@psf.upfronthosting.co.za> New submission from Yury Selivanov : I've had a few conversations with people who were confused that asyncio starts to behave weirdly when a ProcessPoolExecutor is set as the default one. We don't really test that asyncio's built-in functionality (like DNS resolving) works well with a process-pool, which leads to bug reports like [1]. Third-party libraries also always assume that the loop is always configured to use the ThreadPoolExecutor (as it is by default), and also don't even test against ProcessPool. My idea here would be to deprecate setting ProcessPoolExecutor as a default one in 3.8 and prohibit that in 3.9. Guido, Andrew, what do you think? [1] https://bugs.python.org/issue34073 ---------- components: asyncio messages: 321324 nosy: asvetlov, gvanrossum, yselivanov priority: normal severity: normal status: open title: We should prohibit setting a ProcessPoolExecutor in with set_default_executor type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 9 11:57:52 2018 From: report at bugs.python.org (Jan Christoph) Date: Mon, 09 Jul 2018 15:57:52 +0000 Subject: [New-bugs-announce] [issue34076] Nested loop in dictionary comprehension gives `global name not defined` inside class Message-ID: <1531151872.26.0.56676864532.issue34076@psf.upfronthosting.co.za> New submission from Jan Christoph : The python code: ``` class _tri(object): infts = '(+/-)inf, (+/-)infty, (+/-)infinity' strange_failing = {x+s.replace('(+/-)',''):None for x in ('+','-','') for s in infts.split(', ')} ``` gives a `global name 'infts' is not defined` exception, when normal dictionary comprehensions (without nested loops) and regular nested for-loops work perfectly well. For a complete shell session and more illustrative example in versions 2.7.15 and 3.6.4 see: https://pastebin.ubuntu.com/p/9Pg8DThbsd/ ---------- components: Interpreter Core files: what_a_dict.py messages: 321326 nosy: con-f-use priority: normal severity: normal status: open title: Nested loop in dictionary comprehension gives `global name not defined` inside class type: behavior versions: Python 2.7 Added file: https://bugs.python.org/file47678/what_a_dict.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 9 11:57:57 2018 From: report at bugs.python.org (=?utf-8?q?Andr=C3=A9s_Delfino?=) Date: Mon, 09 Jul 2018 15:57:57 +0000 Subject: [New-bugs-announce] [issue34077] doc Be explicit about mock_open created mocks not supporting __iter__ Message-ID: <1531151877.58.0.56676864532.issue34077@psf.upfronthosting.co.za> New submission from Andr?s Delfino : I've been bitten by this one, and while the docs are clear in what the created mock objects support, I think something explicit about __iter__ will help. ---------- assignee: docs at python components: Documentation messages: 321327 nosy: adelfino, docs at python priority: normal severity: normal status: open title: doc Be explicit about mock_open created mocks not supporting __iter__ type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 9 15:13:36 2018 From: report at bugs.python.org (Joe N) Date: Mon, 09 Jul 2018 19:13:36 +0000 Subject: [New-bugs-announce] [issue34078] Broken CRL functionality in ssl.py Message-ID: <1531163616.13.0.56676864532.issue34078@psf.upfronthosting.co.za> New submission from Joe N : CRLs in ssl.py or at the documentation is broken. Specifically I think the documentation here is wrong: https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_verify_locations Here is a stackoverflow post: https://stackoverflow.com/questions/51196492/how-to-use-crls-in-pyopenssl?noredirect=1#comment89407186_51196492 I made a very user friendly test suite of files to show how it is broken. Run the code in here (follow readme instructions) to see the bug. https://github.com/nettijoe96/bugInSSL ---------- assignee: christian.heimes components: SSL messages: 321343 nosy: Joe N, christian.heimes, docs at python priority: normal severity: normal status: open title: Broken CRL functionality in ssl.py type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 03:54:31 2018 From: report at bugs.python.org (Clint Allen) Date: Tue, 10 Jul 2018 07:54:31 +0000 Subject: [New-bugs-announce] [issue34079] Multiprocessing module fails to build on Solaris 11.3 Message-ID: <1531209271.96.0.56676864532.issue34079@psf.upfronthosting.co.za> New submission from Clint Allen : The build of this module fails with this error: In file included from /usr/include/limits.h:12:0, from /usr/gcc/5/lib/gcc/sparcv9-sun-solaris2.11/5.4.0/include-fixed/limits.h:168, from /usr/gcc/5/lib/gcc/sparcv9-sun-solaris2.11/5.4.0/include-fixed/syslimits.h:7, from /usr/gcc/5/lib/gcc/sparcv9-sun-solaris2.11/5.4.0/include-fixed/limits.h:34, from Include/Python.h:19, from /opt/apps/salt-build/Python-2.7.15/Modules/_multiprocessing/multiprocessing.h:12, from /opt/apps/salt-build/Python-2.7.15/Modules/_multiprocessing/multiprocessing.c:9: /usr/gcc/5/lib/gcc/sparcv9-sun-solaris2.11/5.4.0/include-fixed/sys/feature_tests.h:363:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications" Changing the value of _XOPEN_SOURCE from 500 to 600 in Modules/_multiprocessing/multiprocessing.h fixes it. ---------- components: Extension Modules messages: 321364 nosy: clallen priority: normal severity: normal status: open title: Multiprocessing module fails to build on Solaris 11.3 type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 04:20:42 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 10 Jul 2018 08:20:42 +0000 Subject: [New-bugs-announce] [issue34080] Memory leak in the compiler in case of errors Message-ID: <1531210842.03.0.56676864532.issue34080@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : Merging PR 6517 for issue33305 exposed a leak in the compiler: https://buildbot.python.org/all/#/builders/1/builds/280 $ ./python -m test -R 3:3 test_compile test_grammar Run tests sequentially 0:00:00 load avg: 1.95 [1/2] test_compile beginning 6 repetitions 123456 ...... test_compile leaked [15, 16, 15] memory blocks, sum=46 0:00:14 load avg: 1.97 [2/2/1] test_grammar -- test_compile failed beginning 6 repetitions 123456 ...... test_grammar leaked [50, 50, 50] memory blocks, sum=150 test_grammar failed == Tests result: FAILURE == 2 tests failed: test_compile test_grammar Total duration: 15 sec 226 ms Tests result: FAILURE This branch was not common, but after issue33305 it has became more common and heavily tested. ---------- assignee: serhiy.storchaka components: Interpreter Core messages: 321367 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Memory leak in the compiler in case of errors type: resource usage versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 04:32:01 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Tue, 10 Jul 2018 08:32:01 +0000 Subject: [New-bugs-announce] [issue34081] Sphinx duplicate label warning in docs Message-ID: <1531211521.37.0.56676864532.issue34081@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : While running make docs sphinx generates a warning that there are duplicate labels named `_examples`. It seems it's present in `c-api/typeobj.rst` and `distutils/examples.rst` as below : ? Doc git:(master) rg '.. _examples:' c-api/typeobj.rst 2324:.. _examples: distutils/examples.rst 1:.. _examples: # Warning 2018-07-10T07:30:36.8709047Z /opt/vsts/work/1/s/Doc/distutils/examples.rst:5: WARNING: duplicate label examples, other instance in /opt/vsts/work/1/s/Doc/c-api/typeobj.rst Sample log : https://python.visualstudio.com/cpython/cpython%20Team/_build/results?buildId=16141&view=logs There are no references to the label as far as I have checked and I suppose this is an easy fix to be done if someone wants to take it up. The effect is that in the page https://docs.python.org/3.8/c-api/typeobj.html the following text links to distutils/examples for the text "Examples" which should ideally link to https://docs.python.org/3.8/c-api/typeobj.html#examples "In addition to the following quick reference, the Examples section provides at-a-glance insight into the meaning and use of PyTypeObject." It will be also helpful if sphinx warnings are made as an error in CI so that these are caught there. Thanks ---------- assignee: docs at python components: Documentation messages: 321368 nosy: docs at python, xtreak priority: normal severity: normal status: open title: Sphinx duplicate label warning in docs versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 05:43:46 2018 From: report at bugs.python.org (Pav) Date: Tue, 10 Jul 2018 09:43:46 +0000 Subject: [New-bugs-announce] [issue34082] EnumMeta.__new__ should use enum_class.__new__ Message-ID: <1531215826.62.0.56676864532.issue34082@psf.upfronthosting.co.za> New submission from Pav : ```python class Foo: pass class Works(str, Foo, Enum): BAR = 'baz' class Fails(Foo, str, Enum): BAR = 'baz' ``` `Fails` fails to be created with an error: `TypeError: object.__new__(Fails) is not safe, use Fails.__new__()` See https://github.com/python/cpython/blob/e57f91a0f0d5700ec466c9dd0fd2d2b5323a5e76/Lib/enum.py#L205 ---------- components: Library (Lib) messages: 321370 nosy: rs2 priority: normal severity: normal status: open title: EnumMeta.__new__ should use enum_class.__new__ type: behavior versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 06:17:05 2018 From: report at bugs.python.org (Stig Johan Berggren) Date: Tue, 10 Jul 2018 10:17:05 +0000 Subject: [New-bugs-announce] [issue34083] Functional Programming HOWTO: Dictionary ordering isn't "essentially random" Message-ID: <1531217825.24.0.56676864532.issue34083@psf.upfronthosting.co.za> New submission from Stig Johan Berggren : The section about iterators in the Functional Programming HOWTO (https://docs.python.org/3/howto/functional.html#data-types-that-support-iterators) states the following about looping over dictionary keys: "Note that the order is essentially random, because it?s based on the hash ordering of the objects in the dictionary." Starting with 3.7, dictionary order is guaranteed to be the same as insertion order. ---------- assignee: docs at python components: Documentation messages: 321375 nosy: Stig Johan Berggren, docs at python priority: normal severity: normal status: open title: Functional Programming HOWTO: Dictionary ordering isn't "essentially random" versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 07:37:01 2018 From: report at bugs.python.org (Xiang Zhang) Date: Tue, 10 Jul 2018 11:37:01 +0000 Subject: [New-bugs-announce] [issue34084] possible free statically allocated string Message-ID: <1531222621.9.0.56676864532.issue34084@psf.upfronthosting.co.za> New submission from Xiang Zhang : While reviewing PR8222, I found `err_ret->text` is assigned a not malloced string, but it will finally get freed in `err_input`. ---------- keywords: easy messages: 321381 nosy: serhiy.storchaka, xiang.zhang priority: normal severity: normal status: open title: possible free statically allocated string versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 12:33:43 2018 From: report at bugs.python.org (=?utf-8?q?Andr=C3=A9s_Delfino?=) Date: Tue, 10 Jul 2018 16:33:43 +0000 Subject: [New-bugs-announce] [issue34085] doc Improve wording on classmethod/staticmethod Message-ID: <1531240423.32.0.56676864532.issue34085@psf.upfronthosting.co.za> New submission from Andr?s Delfino : 1. The classmethod definition reads: """ The @classmethod form is a function decorator ? see the description of function definitions in Function definitions for details. It can be called either on the class (such as C.f()) or on an instance (such as C().f()) """ The second paragraph seems like talking about the classmethod function instead of a class method. The same goes for staticmethod. 2. The staticmethod definition reads: """ It can be called either on the class (such as C.f()) or on an instance (such as C().f()). The instance is ignored except for its class. """ "The instance is ignored except for its class." seems to have been copied from classmethod definition. 3. There is redundant text: "see the description of function definitions in Function definitions" "consult the documentation on the standard type hierarchy in The standard type hierarchy" PR fixes this. ---------- assignee: docs at python components: Documentation messages: 321390 nosy: adelfino, docs at python priority: normal severity: normal status: open title: doc Improve wording on classmethod/staticmethod type: enhancement versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 13:58:53 2018 From: report at bugs.python.org (Oren) Date: Tue, 10 Jul 2018 17:58:53 +0000 Subject: [New-bugs-announce] [issue34086] logging.Handler.handleError regressed in python3 Message-ID: <1531245533.0.0.56676864532.issue34086@psf.upfronthosting.co.za> New submission from Oren : In python2, calling Handler.handleError may not be strictly correct, but it doesn't raise an exception. However, this has regressed since this patch: https://hg.python.org/cpython/rev/d7b868cdd9bb $ cat logbug.py import logging class CustomHandler(logging.Handler): def transmit(self, record): return False def emit(self, record): if not self.transmit(record): self.handleError(record) def main(): logger = logging.getLogger() logger.addHandler(CustomHandler()) logger.warning('this will work in python 2.7, but not 3') if __name__ == '__main__': main() $ python2 logbug.py None Logged from file logbug.py, line 15 $ python3 logbug.py --- Logging error --- NoneType: None Call stack: Traceback (most recent call last): File "logbug.py", line 20, in main() File "logbug.py", line 15, in main logger.warning('this will work in python 2.7, but not 3') File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 1318, in warning self._log(WARNING, msg, args, **kwargs) File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 1442, in _log self.handle(record) File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 1452, in handle self.callHandlers(record) File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 1514, in callHandlers hdlr.handle(record) File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 863, in handle self.emit(record) File "logbug.py", line 9, in emit self.handleError(record) File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 920, in handleError frame = tb.tb_frame AttributeError: 'NoneType' object has no attribute 'tb_frame' ---------- components: Library (Lib) messages: 321391 nosy: orenl priority: normal severity: normal status: open title: logging.Handler.handleError regressed in python3 versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 15:36:06 2018 From: report at bugs.python.org (=?utf-8?q?Rodrigo_Pinheiro_Marques_de_Ara=C3=BAjo?=) Date: Tue, 10 Jul 2018 19:36:06 +0000 Subject: [New-bugs-announce] [issue34087] Segmentation fault on visit_decref Message-ID: <1531251366.29.0.56676864532.issue34087@psf.upfronthosting.co.za> New submission from Rodrigo Pinheiro Marques de Ara?jo : * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x656d6f6e2236) frame #0: 0x000000010014c819 python3`visit_decref(op=0x0000656d6f6e222e, data=0x0000000000000000) at gcmodule.c:271 [opt] 268 visit_decref(PyObject *op, void *data) 269 { 270 assert(op != NULL); -> 271 if (PyObject_IS_GC(op)) { 272 PyGC_Head *gc = AS_GC(op); 273 /* We're only interested in gc_refs for objects in the 274 * generation being collected, which can be recognized Target 0: (python3) stopped. (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x656d6f6e2236) * frame #0: 0x000000010014c819 python3`visit_decref(op=0x0000656d6f6e222e, data=0x0000000000000000) at gcmodule.c:271 [opt] frame #1: 0x000000010003af38 python3`list_traverse(o=0x0000000116971608, visit=(python3`visit_decref at gcmodule.c:269), arg=0x0000000000000000) at listobject.c:2574 [opt] frame #2: 0x000000010014aca3 python3`collect [inlined] subtract_refs at gcmodule.c:296 [opt] frame #3: 0x000000010014ac72 python3`collect(generation=2, n_collected=0x00007ffeefbff0a8, n_uncollectable=0x00007ffeefbff0b0, nofail=0) at gcmodule.c:853 [opt] frame #4: 0x000000010014a8f5 python3`PyGC_Collect [inlined] collect_with_callback(generation=2) at gcmodule.c:1028 [opt] frame #5: 0x000000010014a8cc python3`PyGC_Collect at gcmodule.c:1573 [opt] frame #6: 0x000000010011f7a8 python3`Py_FinalizeEx at pylifecycle.c:1087 [opt] frame #7: 0x0000000100149605 python3`pymain_main(pymain=) at main.c:2664 [opt] frame #8: 0x000000010014a280 python3`_Py_UnixMain(argc=5, argv=0x00007ffeefbff4b8) at main.c:2697 [opt] frame #9: 0x00007fff5869a015 libdyld.dylib`start + 1 frame #10: 0x00007fff5869a015 libdyld.dylib`start + 1 ---------- components: Interpreter Core messages: 321394 nosy: fenrrir priority: normal severity: normal status: open title: Segmentation fault on visit_decref type: crash versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 16:50:06 2018 From: report at bugs.python.org (Jussi Judin) Date: Tue, 10 Jul 2018 20:50:06 +0000 Subject: [New-bugs-announce] [issue34088] sndhdr.what() throws exceptions on unknown files Message-ID: <1531255806.14.0.56676864532.issue34088@psf.upfronthosting.co.za> New submission from Jussi Judin : sndhdr.what() function throws several types of exceptions on unknown files instead of returning None (as documentation says). Following code can replicate these crashes: ``` import sndhdr import sys sndhdr.what(sys.argv[1]) ``` First crash is from wave or chunk module (input data is base64 encoded in the echo command): ``` $ echo UklGRjAwMDBXQVZFZm10IDAwMDABADAwMDAwMDAwMDAwMDAw | python3.7 -mbase64 -d > in.file $ python3.7 sndhdr/test.py in.file Traceback (most recent call last): File "sndhdr/test.py", line 4, in sndhdr.what(sys.argv[1]) File "/tmp/python-3.7-bin/lib/python3.7/sndhdr.py", line 54, in what res = whathdr(filename) File "/tmp/python-3.7-bin/lib/python3.7/sndhdr.py", line 63, in whathdr res = tf(h, f) File "/tmp/python-3.7-bin/lib/python3.7/sndhdr.py", line 163, in test_wav w = wave.open(f, 'r') File "/tmp/python-3.7-bin/lib/python3.7/wave.py", line 510, in open return Wave_read(f) File "/tmp/python-3.7-bin/lib/python3.7/wave.py", line 164, in __init__ self.initfp(f) File "/tmp/python-3.7-bin/lib/python3.7/wave.py", line 153, in initfp chunk.skip() File "/tmp/python-3.7-bin/lib/python3.7/chunk.py", line 160, in skip self.file.seek(n, 1) File "/tmp/python-3.7-bin/lib/python3.7/chunk.py", line 113, in seek raise RuntimeError RuntimeError ``` Second crash comes from sndhdr module itself (again base64 encoded data is first decoded on command line): ``` $ echo AAA= | python3.7 -mbase64 -d > in.file $ python3.7 sndhdr/test.py in.fileTraceback (most recent call last): File "sndhdr/test.py", line 4, in sndhdr.what(sys.argv[1]) File "/tmp/python-3.7-bin/lib/python3.7/sndhdr.py", line 54, in what res = whathdr(filename) File "/tmp/python-3.7-bin/lib/python3.7/sndhdr.py", line 63, in whathdr res = tf(h, f) File "/tmp/python-3.7-bin/lib/python3.7/sndhdr.py", line 192, in test_sndr rate = get_short_le(h[2:4]) File "/tmp/python-3.7-bin/lib/python3.7/sndhdr.py", line 213, in get_short_le return (b[1] << 8) | b[0] IndexError: index out of range ``` ---------- components: Library (Lib) messages: 321396 nosy: Barro priority: normal severity: normal status: open title: sndhdr.what() throws exceptions on unknown files versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 19:11:10 2018 From: report at bugs.python.org (Neil Schemenauer) Date: Tue, 10 Jul 2018 23:11:10 +0000 Subject: [New-bugs-announce] [issue34089] Remove required (non-optional) modules from Modules/Setup.dist Message-ID: <1531264270.58.0.56676864532.issue34089@psf.upfronthosting.co.za> New submission from Neil Schemenauer : This is related to Issue32430. The behavior of Modules/Setup.dist and Modules/Setup is quirky and problematic. Issue32430 links to some of the related issues. The problem discussed in Issue24575 is also related (Py_BUILD_CORE not being defined when it should be because Modules/Setup is not updated after a git pull). I think it is better if, by default, Python does not require Module/Setup to contain anything. The modules currently listed in there are not optional anyhow as they are required to run setup.py. So, I think moving them to Makefile.pre.in and Modules/config.c.in directly is better. That way, they are contained in files tracked by the VCS and the build dependencies will work as they should. There are some downsides. First, it is more verbose in terms of source lines of code to add them directly. I suspect that is the main reason why new modules ended up in Setup.dist rather than in Makefile.pre.in (e.g. in contrast to gcmodule.c). However, a few extra lines of code seems better than a complicated build system. Modules/Setup and makesetup is complicated, for sure. For example, the Makefile depends on Setup. So, if you run "make", the Makefile can be re-generated. That is slightly crazy. Setup is created on the first run of configure but not on following runs (most people don't realize that, even I forget). Another possible downside is that perhaps someone does not want these modules to be built-in. That would be strange as these modules are quite important and you cannot run setup.py without them. After this change, they would have to edit source code rather than a config file in order to disable these modules. A third downside is that this change could break existing 3rd party build systems. E.g. if they create a Setup file that includes some of these always built-in modules. You will end up trying to link the same .o multiple times into "python". I expect that would cause a link error. However, if these 3rd party builds start with Setup.dist and then edit it, things should continue to work. Rather than this approach, I considered introducing Modules/Setup.builtin. It would contain all the modules needed to run setup.py plus whatever else people wanted to include statically. The Modules/Setup.builtin file would not get the same weird treatment as Modules/Setup. I.e. Modules/Setup.builtin would be tracked by the VCS and no copy to the build folder would be made. That would take care of some issues we currently have with the build. However, I don't like that approach because it makes it more complicated to understand how things are built. With this patch, you can look at Makefile and Modules/config.c to see what is getting built. ---------- components: Build messages: 321399 nosy: nascheme priority: low severity: normal stage: patch review status: open title: Remove required (non-optional) modules from Modules/Setup.dist type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 10 19:13:39 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 10 Jul 2018 23:13:39 +0000 Subject: [New-bugs-announce] [issue34090] Python function call optimization: avoid temporary tuple to pass **kwargs Message-ID: <1531264419.35.0.56676864532.issue34090@psf.upfronthosting.co.za> New submission from STINNER Victor : On the following code, f() uses CALL_FUNCTION_EX bytecode to call g(). The bytecode loads 'kw' variable which is a dictionary. But internally, the dictionary is converted to a temporary tuple, and later a new dictionary is created. Maybe the temporary tuple could be avoided? def g(*args, **kw): ... def f(*args, **kw): g(*args, **kw) In Python 3.6, before FASTCALL, CALL_FUNCTION_EX calls: * do_call_core(): kw dict * PyObject_Call(): kw dict * function_call(): kw dict -> create a temporary tuple of keys and names: (key[0], value[0], ...) * _PyEval_EvalCodeWithName(): if CO_VARKEYWORDS, rebuild a new dictionary for keyword arguments (**kw) In Python master branch (future 3.8) with FASTCALL, CALL_FUNCTION_EX calls: * do_call_core(): kw dict * _PyFunction_FastCallDict(): kw dict -> a temporary tuple for keyword names ('kwnames') is created * _PyEval_EvalCodeWithName(): if CO_VARKEYWORDS, rebuild a new dictionary for keyword arguments (**kw) To be clear: FASTCALL didn't make this specific function call (Python => Python with **kw) worse nor better. ---------- components: Interpreter Core messages: 321400 nosy: inada.naoki, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: Python function call optimization: avoid temporary tuple to pass **kwargs type: performance versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 11 05:02:12 2018 From: report at bugs.python.org (=?utf-8?q?Maximilian_N=C3=B6the?=) Date: Wed, 11 Jul 2018 09:02:12 +0000 Subject: [New-bugs-announce] [issue34091] REPL does not work in msys2, ConEmu terminals on windows Message-ID: <1531299732.09.0.56676864532.issue34091@psf.upfronthosting.co.za> New submission from Maximilian N?the : The REPL won't start in interactive mode, it only starts when explicitly given the `-i` option. The problems IPython is having, e.g. missing syntax highlighting and no tab completion should have the same root. See this issue for mingw: https://github.com/Alexpux/MINGW-packages/issues/730 They fixed it by patching python using this patch: https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-python3/1700-cygpty-isatty.patch And this issue at msys2: https://sourceforge.net/p/msys2/tickets/32/ ---------- messages: 321417 nosy: maxnoe priority: normal severity: normal status: open title: REPL does not work in msys2, ConEmu terminals on windows 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 Jul 11 05:45:45 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 11 Jul 2018 09:45:45 +0000 Subject: [New-bugs-announce] [issue34092] test_logging: SMTPHandlerTest.test_basic() fails randomly on x86 Gentoo Refleaks 3.7 Message-ID: <1531302345.99.0.56676864532.issue34092@psf.upfronthosting.co.za> New submission from STINNER Victor : https://buildbot.python.org/all/#builders/114/builds/163 1:26:51 load avg: 4.83 [117/415/1] test_logging failed -- running: test_multiprocessing_forkserver (8 min 18 sec) beginning 6 repetitions 123456 .--- Logging error --- Traceback (most recent call last): File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/smtplib.py", line 387, in getreply line = self.file.readline(_MAXLINE + 1) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/socket.py", line 589, in readinto return self._sock.recv_into(b) socket.timeout: timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/logging/handlers.py", line 1007, in emit smtp = smtplib.SMTP(self.mailhost, port, timeout=self.timeout) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/smtplib.py", line 251, in __init__ (code, msg) = self.connect(host, port) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/smtplib.py", line 338, in connect (code, msg) = self.getreply() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/smtplib.py", line 391, in getreply + str(e)) smtplib.SMTPServerDisconnected: Connection unexpectedly closed: timed out Call stack: File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/runpy.py", line 85, in _run_code exec(code, run_globals) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/regrtest.py", line 50, in _main() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/regrtest.py", line 46, in _main main() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/main.py", line 584, in main Regrtest().main(tests=tests, **kwargs) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/main.py", line 531, in main self._main(tests, kwargs) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/main.py", line 547, in _main run_tests_slave(self.ns.slaveargs) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/runtest_mp.py", line 68, in run_tests_slave result = runtest(ns, testname) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/runtest.py", line 140, in runtest result = runtest_inner(ns, test, display_failure=not ns.verbose) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/runtest.py", line 177, in runtest_inner refleak = dash_R(the_module, test, test_runner, ns.huntrleaks) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/refleak.py", line 69, in dash_R indirect_test() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/support/__init__.py", line 1606, in inner return func(*args, **kwds) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/test_logging.py", line 4641, in test_main support.run_unittest(*tests) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/support/__init__.py", line 1972, in run_unittest _run_suite(suite) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/support/__init__.py", line 1882, in _run_suite result = runner.run(suite) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/support/__init__.py", line 1781, in run test(result) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/suite.py", line 84, in __call__ return self.run(*args, **kwds) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/suite.py", line 122, in run test(result) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/suite.py", line 84, in __call__ return self.run(*args, **kwds) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/suite.py", line 122, in run test(result) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/case.py", line 663, in __call__ return self.run(*args, **kwds) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/case.py", line 615, in run testMethod() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/test_logging.py", line 988, in test_basic h.handle(r) Message: 'Hello ?' Arguments: () test test_logging failed -- Traceback (most recent call last): File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/test_logging.py", line 991, in test_basic self.assertTrue(self.handled.is_set()) AssertionError: False is not true (...) test_basic (test.test_logging.SMTPHandlerTest) ... --- Logging error --- Traceback (most recent call last): File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/smtplib.py", line 387, in getreply line = self.file.readline(_MAXLINE + 1) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/socket.py", line 589, in readinto return self._sock.recv_into(b) socket.timeout: timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/logging/handlers.py", line 1007, in emit smtp = smtplib.SMTP(self.mailhost, port, timeout=self.timeout) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/smtplib.py", line 251, in __init__ (code, msg) = self.connect(host, port) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/smtplib.py", line 338, in connect (code, msg) = self.getreply() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/smtplib.py", line 391, in getreply + str(e)) smtplib.SMTPServerDisconnected: Connection unexpectedly closed: timed out Call stack: File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/runpy.py", line 85, in _run_code exec(code, run_globals) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/__main__.py", line 2, in main() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/main.py", line 584, in main Regrtest().main(tests=tests, **kwargs) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/main.py", line 531, in main self._main(tests, kwargs) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/main.py", line 570, in _main self.rerun_failed_tests() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/main.py", line 286, in rerun_failed_tests ok = runtest(self.ns, test) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/runtest.py", line 140, in runtest result = runtest_inner(ns, test, display_failure=not ns.verbose) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/runtest.py", line 177, in runtest_inner refleak = dash_R(the_module, test, test_runner, ns.huntrleaks) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/libregrtest/refleak.py", line 69, in dash_R indirect_test() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/support/__init__.py", line 1606, in inner return func(*args, **kwds) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/test_logging.py", line 4641, in test_main support.run_unittest(*tests) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/support/__init__.py", line 1972, in run_unittest _run_suite(suite) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/support/__init__.py", line 1882, in _run_suite result = runner.run(suite) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/runner.py", line 176, in run test(result) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/suite.py", line 84, in __call__ return self.run(*args, **kwds) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/suite.py", line 122, in run test(result) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/suite.py", line 84, in __call__ return self.run(*args, **kwds) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/suite.py", line 122, in run test(result) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/case.py", line 663, in __call__ return self.run(*args, **kwds) File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/unittest/case.py", line 615, in run testMethod() File "/buildbot/buildarea/cpython/3.7.ware-gentoo-x86.refleak/build/Lib/test/test_logging.py", line 988, in test_basic h.handle(r) Message: 'Hello ?' Arguments: () FAIL ---------- components: Tests messages: 321423 nosy: vstinner priority: normal severity: normal status: open title: test_logging: SMTPHandlerTest.test_basic() fails randomly on x86 Gentoo Refleaks 3.7 versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 11 06:36:33 2018 From: report at bugs.python.org (INADA Naoki) Date: Wed, 11 Jul 2018 10:36:33 +0000 Subject: [New-bugs-announce] [issue34093] Reproducible pyc: FLAG_REF is not stable. Message-ID: <1531305393.76.0.56676864532.issue34093@psf.upfronthosting.co.za> Change by INADA Naoki : ---------- components: Extension Modules nosy: inada.naoki priority: normal severity: normal status: open title: Reproducible pyc: FLAG_REF is not stable. versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 11 06:42:09 2018 From: report at bugs.python.org (Bruce Richardson) Date: Wed, 11 Jul 2018 10:42:09 +0000 Subject: [New-bugs-announce] [issue34094] Porting Python 2 to Python 3 example contradicts its own advice Message-ID: <1531305729.89.0.56676864532.issue34094@psf.upfronthosting.co.za> New submission from Bruce Richardson : https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection In this section, the (very good) advice is "It would be better to treat Python 2 as the exceptional case instead of Python 3 and assume that future Python versions will be more compatible with Python 3 than Python 2" However, it then goes on to present the best solution (for dealing with library imports) is this: try: from importlib import abc except ImportError: from importlib2 import abc This is literally treating Python 3 as the exception, completely contradicting the advice given a few lines earlier. Practically, it also has the effect that, as Python 3 adoption spreads, import errors and automatic retries will become *more* common and then universal, adding a small amount of delay and noise to the entire Python estate. And that's not considering the case where both libraries are installed to cope with old code relying on the old library (in which case you surely want new code to default to using the new library) If the example is simply changed to try: from importlib2 import abc except ImportError: from importlib import abc then both the contradiction and the practical problems go away ---------- assignee: docs at python components: Documentation messages: 321436 nosy: Bruce Richardson, brett.cannon, docs at python priority: normal severity: normal status: open title: Porting Python 2 to Python 3 example contradicts its own advice _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 11 09:04:12 2018 From: report at bugs.python.org (Erich Eckner) Date: Wed, 11 Jul 2018 13:04:12 +0000 Subject: [New-bugs-announce] [issue34095] segfault in testsuite Message-ID: <1531314252.99.0.56676864532.issue34095@psf.upfronthosting.co.za> New submission from Erich Eckner : building python 2.7.15 on archlinux32 from source succeeds, but running the testsuite segfaults with: test_writelines (idlelib.idle_test.test_io.PseudeOutputFilesTest) ... /usr/bin/xvfb-run: line 181: 3617 Segmentation fault (core dumped) DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1 the executed commands are: cd Python-${pkgver} # Temporary workaround for FS#22322 # See http://bugs.python.org/issue10835 for upstream report sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c # Enable built-in SQLite module to load extensions (fix FS#22122) sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py # FS#23997 sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python2|" Lib/cgi.py sed -i "s/python2.3/python2/g" Lib/distutils/tests/test_build_scripts.py \ Lib/distutils/tests/test_install_scripts.py # Ensure that we are using the system copy of various libraries (expat, zlib and libffi), # rather than copies shipped in the tarball rm -r Modules/expat rm -r Modules/zlib rm -r Modules/_ctypes/{darwin,libffi}* # clean up #!s find . -name '*.py' | \ xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" # Workaround asdl_c.py/makeopcodetargets.py errors after we touched the shebangs touch Include/Python-ast.h Python/Python-ast.c Python/opcode_targets.h # FS#48761 # http://bugs.python.org/issue25750 patch -Np1 -i ../descr_ref.patch export OPT="${CFLAGS}" ./configure --prefix=/usr \ --enable-shared \ --with-threads \ --enable-optimizations \ --with-lto \ --enable-ipv6 \ --enable-unicode=ucs4 \ --with-system-expat \ --with-system-ffi \ --with-dbmliborder=gdbm:ndbm \ --without-ensurepip make LD_LIBRARY_PATH="${srcdir}/Python-${pkgver}":${LD_LIBRARY_PATH} \ xvfb-run "${srcdir}/Python-${pkgver}/python" -m test.regrtest -v -uall 2>&1 | tee log.all ---------- components: Build files: log.all messages: 321447 nosy: deep42thought priority: normal severity: normal status: open title: segfault in testsuite versions: Python 2.7 Added file: https://bugs.python.org/file47682/log.all _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 11 09:10:57 2018 From: report at bugs.python.org (Erich Eckner) Date: Wed, 11 Jul 2018 13:10:57 +0000 Subject: [New-bugs-announce] [issue34096] testsuite fails assertion Message-ID: <1531314657.47.0.56676864532.issue34096@psf.upfronthosting.co.za> New submission from Erich Eckner : building python 2.7.15 on archlinux32 (the i686 branch of archlinux) from source succeeds, but running the testsuite (with some segfaulting tests disabled - see issue34095) results in an assertion error: test_wrongsize (test.test_audioop.TestAudioop) ... test test_audioop failed -- Traceback (most recent call last): File "/home/vagrant/python2/src/Python-2.7.15/Lib/test/test_audioop.py", line 48, in test_max self.assertEqual(audioop.max(p(minvalues[w]), w), -minvalues[w]) AssertionError: -2147483648 != 2147483648L ok ====================================================================== FAIL: test_max (test.test_audioop.TestAudioop) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vagrant/python2/src/Python-2.7.15/Lib/test/test_audioop.py", line 48, in test_max self.assertEqual(audioop.max(p(minvalues[w]), w), -minvalues[w]) AssertionError: -2147483648 != 2147483648L The commands leading to this are: cd Python-${pkgver} # Temporary workaround for FS#22322 # See http://bugs.python.org/issue10835 for upstream report sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c # Enable built-in SQLite module to load extensions (fix FS#22122) sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py # FS#23997 sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python2|" Lib/cgi.py sed -i "s/python2.3/python2/g" Lib/distutils/tests/test_build_scripts.py \ Lib/distutils/tests/test_install_scripts.py # Ensure that we are using the system copy of various libraries (expat, zlib and libffi), # rather than copies shipped in the tarball rm -r Modules/expat rm -r Modules/zlib rm -r Modules/_ctypes/{darwin,libffi}* # clean up #!s find . -name '*.py' | \ xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" # Workaround asdl_c.py/makeopcodetargets.py errors after we touched the shebangs touch Include/Python-ast.h Python/Python-ast.c Python/opcode_targets.h # FS#48761 # http://bugs.python.org/issue25750 patch -Np1 -i ../descr_ref.patch export OPT="${CFLAGS}" ./configure --prefix=/usr \ --enable-shared \ --with-threads \ --enable-optimizations \ --with-lto \ --enable-ipv6 \ --enable-unicode=ucs4 \ --with-system-expat \ --with-system-ffi \ --with-dbmliborder=gdbm:ndbm \ --without-ensurepip make LD_LIBRARY_PATH="${srcdir}/Python-${pkgver}":${LD_LIBRARY_PATH} \ xvfb-run "${srcdir}/Python-${pkgver}/python" -m test.regrtest -v -uall -x test_idle test_bytes test_str test_string test_unicode test_userstring test_tuple test_tk test_ttk_guionly test_ctypes 2>&1 | tee log.reduced ---------- components: Build files: log.reduced messages: 321449 nosy: deep42thought priority: normal severity: normal status: open title: testsuite fails assertion versions: Python 2.7 Added file: https://bugs.python.org/file47684/log.reduced _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 11 10:35:58 2018 From: report at bugs.python.org (Petr Viktorin) Date: Wed, 11 Jul 2018 14:35:58 +0000 Subject: [New-bugs-announce] [issue34097] ZIP does not support timestamps before 1980 Message-ID: <1531319758.26.0.56676864532.issue34097@psf.upfronthosting.co.za> New submission from Petr Viktorin : The ZIP format cannot handle times before 1980. Issue6090 provided a nice error message for trying to add such files. I'm seeing a system for reproducible builds that sets mtime to 1970 (zero UNIX timestamp), resulting in files that Python can't package into (zip-based) wheels. At least here on Fedora, the `zip` command-line utility silently bumps old timestamps to 1980-01-01. Of course, silently corrupting data would not be good default behavior for Python. But in many cases timestamps don't matter. It would be nice to give ZipFile and ZipFile.write() a `strict_timestamps=True` keyword argument that could be turned off. ---------- components: Library (Lib) messages: 321460 nosy: petr.viktorin priority: normal severity: normal status: open title: ZIP does not support timestamps before 1980 versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 11 11:20:31 2018 From: report at bugs.python.org (Guilherme Salgado) Date: Wed, 11 Jul 2018 15:20:31 +0000 Subject: [New-bugs-announce] [issue34098] multiprocessing.Server swallows original exception traceback Message-ID: <1531322431.82.0.56676864532.issue34098@psf.upfronthosting.co.za> New submission from Guilherme Salgado : multiprocessing.Server swallows original exception traceback, making it hard to debug. For example, the following code: ``` from multiprocessing.managers import BaseManager class FooBar(object): def m(self): self._raise() def _raise(self): raise ValueError class MyManager(BaseManager): pass MyManager.register('Foo', callable=FooBar) manager = MyManager() manager.start() manager.Foo()._callmethod('m') manager.shutdown() ``` Gives me the following exception: ``` Traceback (most recent call last): File "/tmp/foo.py", line 15, in manager.Foo()._callmethod('m') File "/usr/lib/python3.6/multiprocessing/managers.py", line 772, in _callmethod raise convert_to_error(kind, result) ValueError ``` Ideally, I'd like to get something like this: ``` multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/salgado/src/cpython/Lib/multiprocessing/managers.py", line 254, in serve_client res = function(*args, **kwds) File "/tmp/foo.py", line 5, in m self._raise() File "/tmp/foo.py", line 7, in _raise raise ValueError ValueError """ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/tmp/foo.py", line 15, in manager.Foo()._callmethod('m') File "/home/salgado/src/cpython/Lib/multiprocessing/managers.py", line 811, in _callmethod raise convert_to_error(kind, result) ValueError ``` ---------- components: Library (Lib) messages: 321480 nosy: salgado priority: normal severity: normal status: open title: multiprocessing.Server swallows original exception traceback type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 11 14:07:01 2018 From: report at bugs.python.org (Fabio Zadrozny) Date: Wed, 11 Jul 2018 18:07:01 +0000 Subject: [New-bugs-announce] [issue34099] Provide debuggers with a way to know that a function is exiting with an unhandled exception. Message-ID: <1531332421.42.0.56676864532.issue34099@psf.upfronthosting.co.za> New submission from Fabio Zadrozny : Right now, debuggers can deal with handled exceptions by detecting the 'exception' event, but it's hard to know if the exception is handled or unhandled at that point (so, debuggers end up checking if it happens in a top-level function, but this isn't good if the user started the code and did a remote attach later on, where the top-level code is still user code). My suggestion would be creating another event type (such as 'exception_return') which would be issued after the 'return' event with the same information passed on the 'exception' info so that debuggers can detect that some exception is unhandled (the 'return' would still be issued as usual to minimize breakage to existing debuggers). Another option could be adding that information to the frame itself during a 'return' event (and then removing right after calling the debugger to avoid any cycles) -- although I think the other option is better to avoid making the frame bigger. ---------- components: Interpreter Core messages: 321492 nosy: fabioz priority: normal severity: normal status: open title: Provide debuggers with a way to know that a function is exiting with an unhandled exception. type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 11 15:08:31 2018 From: report at bugs.python.org (Dan Rose) Date: Wed, 11 Jul 2018 19:08:31 +0000 Subject: [New-bugs-announce] [issue34100] Python doesn't intern integers in a tuple of constant literals Message-ID: <1531336111.06.0.56676864532.issue34100@psf.upfronthosting.co.za> New submission from Dan Rose : In the Python 3.7.0 interpreter, the following evaluates to False. In 3.6.4, it was True: c,d = 500,500 c is d This seems to be because, in some cases, Python 3.7 fails to intern integers inside tuples: a = (500,500) print(a[0] is a[1]) # False a = (500,500,42) print(a[0] is a[1]) # False a = (500,500,'42') print(a[0] is a[1]) # False answer = 42 a = (500,500,answer) print(a[0] is a[1]) # True a = (500,500,[42]) print(a[0] is a[1]) # True a = [500,500] print(a[0] is a[1]) # True I believe the above should all return True. ---------- messages: 321495 nosy: Dan Rose priority: normal severity: normal status: open title: Python doesn't intern integers in a tuple of constant literals type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 12 03:55:33 2018 From: report at bugs.python.org (Antoine Pitrou) Date: Thu, 12 Jul 2018 07:55:33 +0000 Subject: [New-bugs-announce] [issue34101] PyBuffer_GetPointer() not documented Message-ID: <1531382133.01.0.56676864532.issue34101@psf.upfronthosting.co.za> Change by Antoine Pitrou : ---------- assignee: docs at python components: Documentation nosy: docs at python, pitrou, skrah priority: normal severity: normal status: open title: PyBuffer_GetPointer() not documented type: behavior versions: Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 12 08:13:49 2018 From: report at bugs.python.org (Sagi (Sergey) Shnaidman) Date: Thu, 12 Jul 2018 12:13:49 +0000 Subject: [New-bugs-announce] [issue34102] local variable 'parts' referenced before assignment in feedparser in email module Message-ID: <1531397629.91.0.56676864532.issue34102@psf.upfronthosting.co.za> New submission from Sagi (Sergey) Shnaidman : sudo pip install ansible-lint Requirement already satisfied: ansible-lint in /usr/lib/python2.7/site-packages (3.4.21) Exception: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/pip/_internal/basecommand.py", line 228, in main status = self.run(options, args) File "/usr/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 291, in run resolver.resolve(requirement_set) File "/usr/lib/python2.7/site-packages/pip/_internal/resolve.py", line 103, in resolve self._resolve_one(requirement_set, req) File "/usr/lib/python2.7/site-packages/pip/_internal/resolve.py", line 262, in _resolve_one check_dist_requires_python(dist) File "/usr/lib/python2.7/site-packages/pip/_internal/utils/packaging.py", line 46, in check_dist_requires_python feed_parser.feed(metadata) File "/usr/lib64/python2.7/email/feedparser.py", line 178, in feed self._input.push(data) File "/usr/lib64/python2.7/email/feedparser.py", line 99, in push print(parts) UnboundLocalError: local variable 'parts' referenced before assignment pip2 --version pip 10.0.1 from /usr/lib/python2.7/site-packages/pip (python 2.7) ---------- components: email messages: 321544 nosy: barry, r.david.murray, sshnaidm priority: normal severity: normal status: open title: local variable 'parts' referenced before assignment in feedparser in email module type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 12 11:06:11 2018 From: report at bugs.python.org (AndreasPK) Date: Thu, 12 Jul 2018 15:06:11 +0000 Subject: [New-bugs-announce] [issue34103] Python3.7 places cwd instead of a scripts path in sys.path. Message-ID: <1531407971.94.0.56676864532.issue34103@psf.upfronthosting.co.za> New submission from AndreasPK : Andi at Horzube MINGW64 ~/tmp $ python3.7 ../pyTest.py ['', 'C:/ghc/msys64/mingw64/lib/python37.zip', 'C:/ghc/msys64/home/Andi/tmp', 'C:/ghc/msys64/mingw64/lib/python3.7', 'C:/ghc/msys64/mingw64/bin', 'C:/ghc/msys64/mingw64/lib/python3.7/lib-dynload', 'C:/ghc/msys64/mingw64/lib/python3.7/site-packages'] Andi at Horzube MINGW64 ~/tmp $ python3.6 ../pyTest.py ['/home/Andi', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/lib/python3.6/site-packages'] Ignore the path prefix differences, they comes from slight differences how I installed these two versions. 3.6 lists '/home/Andi', path of the script 3.7 lists /home/Andi/tmp , path of cwd This breaks existing code looking for files (imports primarily) relative to a scripts path. If a file is placed in the right relative path to cwd it will be picked up over the intended file. This should be at least mentioned in breaking changes. ---------- messages: 321563 nosy: AndreasPK priority: normal severity: normal status: open title: Python3.7 places cwd instead of a scripts path in sys.path. type: security versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 12 14:25:22 2018 From: report at bugs.python.org (Serge Droz) Date: Thu, 12 Jul 2018 18:25:22 +0000 Subject: [New-bugs-announce] [issue34104] email.message.get_payload should enforce correct encoding Message-ID: <1531419922.51.0.56676864532.issue34104@psf.upfronthosting.co.za> New submission from Serge Droz : The issue is really this: https://noxxi.de/research/mime-5-easy-steps-to-bypass-av.html get_payload should with decode=Treu should check the validity of the syntax and throw an error if it is not. This would happen if the underlying call to base64.decode would be called with validate=True ---------- messages: 321574 nosy: droz priority: normal severity: normal status: open title: email.message.get_payload should enforce correct encoding _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 12 14:49:50 2018 From: report at bugs.python.org (Lysandros Nikolaou) Date: Thu, 12 Jul 2018 18:49:50 +0000 Subject: [New-bugs-announce] [issue34105] test_socket.test_host_resolution_bad_address fails on Mac OS X 10.13.6 Message-ID: <1531421390.98.0.56676864532.issue34105@psf.upfronthosting.co.za> New submission from Lysandros Nikolaou : On my Mac OS X 10.13.6 system test_socket.test_host_resolution_bad_address fails with the following error: ====================================================================== FAIL: test_host_resolution_bad_address (test.test_socket.GeneralModuleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/path/to/cpython/Lib/test/test_socket.py", line 897, in test_host_resolution_bad_address socket.gethostbyname(addr) AssertionError: OSError not raised : 0.1.1.~1 ---------------------------------------------------------------------- Ran 555 tests in 24.950s FAILED (failures=1, skipped=141) /path/to/cpython/Lib/test/test_socket.py:2345: RuntimeWarning: received malformed or improperly-truncated ancillary data result = sock.recvmsg(bufsize, *args) /path/to/cpython/Lib/test/test_socket.py:2436: RuntimeWarning: received malformed or improperly-truncated ancillary data result = sock.recvmsg_into([buf], *args) test test_socket failed == Tests result: FAILURE == 1 test failed: test_socket Total duration: 25 sec 423 ms Tests result: FAILURE When I manually run socket.gethostbyname('0.1.1.~1'), it returns an IP address, no exception thrown. ---------- components: Tests messages: 321575 nosy: lys.nikolaou priority: normal severity: normal status: open title: test_socket.test_host_resolution_bad_address fails on Mac OS X 10.13.6 type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 12 15:56:39 2018 From: report at bugs.python.org (Neil Schemenauer) Date: Thu, 12 Jul 2018 19:56:39 +0000 Subject: [New-bugs-announce] [issue34106] Add --with-module-config= to 'configure' script Message-ID: <1531425399.74.0.56676864532.issue34106@psf.upfronthosting.co.za> New submission from Neil Schemenauer : This patch is based on top of GH-8229 but could be changed to work without it. ---------- components: Build messages: 321580 nosy: nascheme priority: normal severity: normal stage: patch review status: open title: Add --with-module-config= to 'configure' script type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 12 20:25:05 2018 From: report at bugs.python.org (Michael Kearney) Date: Fri, 13 Jul 2018 00:25:05 +0000 Subject: [New-bugs-announce] [issue34107] root.warning('msg') output format modified by logging.warning('msg') Message-ID: <1531441505.36.0.56676864532.issue34107@psf.upfronthosting.co.za> New submission from Michael Kearney : 0 >>> import logging 1 >>> root=logging.getLogger(name='root') 2 >>> root.warning('msg') 3 msg <----- Compare this line 4 >>> logging.warning('msg') 5 WARNING:root:msg 6 >>> root.warning('msg') 7 WARNING:root:msg <------ with this line Specifically, I was surprised to see line 7 response to line 6 given line 3 response to line 2 logger methods log(),critical(),error(),info() act the same way. A workaround from issue 33897 fixes things logging.basicConfig(level=logging.DEBUG, force=True) I discovered this when exploring "logging" module defaults, It is the sort of thing someone new to the module might encounter. I did. Slightly more comprehensive unittest example attached. This may be my first real submission. Feedback appreciated ---------- files: logTest.py messages: 321582 nosy: Michael Kearney priority: normal severity: normal status: open title: root.warning('msg') output format modified by logging.warning('msg') type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file47686/logTest.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 13 08:31:21 2018 From: report at bugs.python.org (Jason R. Coombs) Date: Fri, 13 Jul 2018 12:31:21 +0000 Subject: [New-bugs-announce] [issue34108] 2to3 munges new lines on Windows Message-ID: <1531485081.25.0.56676864532.issue34108@psf.upfronthosting.co.za> New submission from Jason R. Coombs : In issue11594, we attempted to solve the newlines issue but inadvertently introduced extraneous CR before CRLF newlines when running on Windows. See https://github.com/python/cpython/pull/6483#issuecomment-401957049 for more details. ---------- assignee: jason.coombs keywords: 3.7regression messages: 321599 nosy: jason.coombs priority: high severity: normal stage: commit review status: open title: 2to3 munges new lines on Windows type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 13 12:54:10 2018 From: report at bugs.python.org (Victor Pires) Date: Fri, 13 Jul 2018 16:54:10 +0000 Subject: [New-bugs-announce] [issue34109] Accumulator bug Message-ID: <1531500850.33.0.56676864532.issue34109@psf.upfronthosting.co.za> New submission from Victor Pires : A function to return a number from 1 to 5 (inclusive) sometimes returns -1 when called thousands of times. from random import randint import sys def rand5(): """Returns a random integer from 1 to 5 (inclusive)""" r5 = -5 # This *should* accumulate from zero to 24 for _ in range(4): r5 += randint(1, 7) for i in range(5): if (r5 == -1): # BUG: This should never happen, r5 = [0; 24] return r5 if (r5 in [(i + j*5) for j in range(5)]): return (i + 1) d = {key: 0 for key in range(-1, 6)} # Should only be range(1, 6)... for _ in range(int(1e6)): # One million d[rand5()] += 1 print(sys.version) for key in d: print(key, d[key]) $ python2.7 Bug.py 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] (0, 0) (1, 200514) (2, 200273) (3, 200689) (4, 199588) (5, 198543) (-1, 393) $ python3.5 Bug.py 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] 0 0 1 200956 2 200529 3 200017 4 199047 5 199030 -1 421 $ python3.6 Bug.py 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51) [GCC 7.2.0] -1 421 0 0 1 200562 2 202025 3 200116 4 198899 5 197977 $ python3.7 Bug.py 3.7.0 (default, Jun 28 2018, 13:15:42) [GCC 7.2.0] -1 433 0 0 1 200039 2 200676 3 200629 4 199322 5 198901 ---------- components: Interpreter Core files: Bug.html messages: 321623 nosy: vicpires priority: normal severity: normal status: open title: Accumulator bug type: behavior versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47689/Bug.html _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 13 14:40:08 2018 From: report at bugs.python.org (Guoqiang Zhang) Date: Fri, 13 Jul 2018 18:40:08 +0000 Subject: [New-bugs-announce] [issue34110] cPickle may raise AttributeError when loading concurrently in threads Message-ID: <1531507208.03.0.56676864532.issue34110@psf.upfronthosting.co.za> New submission from Guoqiang Zhang : If two threads use cPickle to load objects simultaneously, one thread may raise an AttributeError. This problem is caused by the partially loaded module. To reproduce, create a file 'foo.py': import time time.sleep(0.1) class foo(): pass Then in main.py: import threading import cPickle threads = [threading.Thread(target=cPickle.loads, args=('cfoo\nfoo\np0\n.',)) for _ in range(2)] [thread.start() for thread in threads] [thread.join() for thread in threads] Run main.py, there should be a crash: Exception in thread Thread-2: Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run self.__target(*self.__args, **self.__kwargs) AttributeError: 'module' object has no attribute 'foo' ---------- components: Library (Lib) messages: 321627 nosy: sangongs priority: normal severity: normal status: open title: cPickle may raise AttributeError when loading concurrently in threads type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 14 07:21:51 2018 From: report at bugs.python.org (tobik) Date: Sat, 14 Jul 2018 11:21:51 +0000 Subject: [New-bugs-announce] [issue34111] python-config breaks when symlinked to another location Message-ID: <1531567311.02.0.56676864532.issue34111@psf.upfronthosting.co.za> New submission from tobik : When symlinking python3.6-config to another location, it starts outputting bogus paths. It's convenient to symlink the system python3.6-config to somewhere else in PATH to make sure the build of an application with a hardcoded use of python3-config is using the right Python version. This is something that we would like to do in FreeBSD Ports instead of having to patch build files. It works fine with python2.7-config. However when I try a similar thing with python3.6-config it starts outputting bogus paths. For example $ pwd /home/tobias $ python2.7-config --includes -I/usr/local/include/python2.7 -I/usr/local/include/python2.7 $ ln -s /usr/local/bin/python2.7-config python2-config $ ./python2-config --includes -I/usr/local/include/python2.7 -I/usr/local/include/python2.7 $ python3.6-config --includes -I/usr/local/include/python3.6m -I/usr/local/include/python3.6m $ ln -s /usr/local/bin/python3.6-config python3-config $ ./python3-config --includes -I/home/include/python3.6m -I/home/include/python3.6m It would be nice if this could just work. This was on FreeBSD but the same problem exists on e.g. Void Linux too. The problem seems to be that the path to the original script is not resolved properly when trying to determine the install prefix. Adding realpath(1) to python-config seems to solve it. ---------- files: patch-Misc__python-config.sh.in messages: 321650 nosy: tobik priority: normal severity: normal status: open title: python-config breaks when symlinked to another location type: behavior versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47690/patch-Misc__python-config.sh.in _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 14 12:25:41 2018 From: report at bugs.python.org (Jayanth Koushik) Date: Sat, 14 Jul 2018 16:25:41 +0000 Subject: [New-bugs-announce] [issue34112] 3.7.0 build error with --enable-optimizations Message-ID: <1531585541.57.0.56676864532.issue34112@psf.upfronthosting.co.za> New submission from Jayanth Koushik : I'm trying to build 3.7.0 locally (not as superuser) on a server. I am able to successfully build without `--enable-optimizations` enabled, but the build fails with it enabled. I have dependencies installed in custom locations as well, and this is my environment. PREF=/scratch export LC_ALL=C export CC=gcc export CXX=g++ export PATH=/opt/gcc/4.9.2/bin:$PREF/binutils/bin:/bin:/usr/bin export LD_LIBRARY_PATH=/opt/gcc/4.9.2/lib64:/opt/gcc/4.9.2/lib:$PREF/bzip2/lib:$PREF/gdbm/lib:$PREF/libffi/lib64:$PREF/ncurses/lib:$PREF/openmpi/lib:$PREF/openssl/lib:$PREF/readline/lib:$PREF/sqlite/lib:$PREF/util-linux/lib:$PREF/xz/lib:$PREF/zlib/lib:/usr/lib64 export CPATH=/opt/gcc/4.9.2/include:$PREF/bzip2/include:$PREF/gdbm/include:$PREF/libffi/include:$PREF/ncurse s/include:$PREF/openmpi/include:$PREF/openssl/include:$PREF/readline/include:$PREF/sqlite/include:$PREF/util -linux/include:$PREF/xz/include:$PREF/zlib/include I also have to update setup.py to point to the right locations for dependencies. This is the diff, and I've attached the full file. 46c46 < disabled_module_list = ["_tkinter", "_uuid"] --- > disabled_module_list = [] 544,567c544,545 < add_dir_to_list(self.compiler.library_dirs, < '/scratch/readline/lib') < add_dir_to_list(self.compiler.include_dirs, < '/scratch/readline/include') < add_dir_to_list(self.compiler.library_dirs, < '/scratch/bzip2/lib') < add_dir_to_list(self.compiler.include_dirs, < '/scratch/bzip2/include') < add_dir_to_list(self.compiler.library_dirs, < '/scratch/ncurses/lib') < add_dir_to_list(self.compiler.include_dirs, < '/scratch/ncurses/include') < add_dir_to_list(self.compiler.library_dirs, < '/scratch/xz/lib') < add_dir_to_list(self.compiler.include_dirs, < '/scratch/xz/include') < add_dir_to_list(self.compiler.library_dirs, < '/scratch/gdbm/lib') < add_dir_to_list(self.compiler.include_dirs, < '/scratch/gdbm/include') < add_dir_to_list(self.compiler.library_dirs, < '/scratch/libffi/lib64') < add_dir_to_list(self.compiler.include_dirs, < '/scratch/libffi/include') --- > add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') > add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') 835,836c813,814 < #elif self.compiler.find_library_file(lib_dirs, 'ncursesw'): < # curses_library = 'ncursesw' --- > elif self.compiler.find_library_file(lib_dirs, 'ncursesw'): > curses_library = 'ncursesw' 1152c1130,1136 < sqlite_inc_paths = [ '/scratch/sqlite/include' ] --- > sqlite_inc_paths = [ '/usr/include', > '/usr/include/sqlite', > '/usr/include/sqlite3', > '/usr/local/include', > '/usr/local/include/sqlite', > '/usr/local/include/sqlite3', > ] 1195a1180 > os.path.join(sqlite_incdir, '..', 'lib64'), 1196a1182,1183 > os.path.join(sqlite_incdir, '..', '..', 'lib64'), > os.path.join(sqlite_incdir, '..', '..', 'lib'), This is my build process. mkdir build && cd build LDFLAGS="-Wl,--rpath=$PREF/glibc/lib -Wl,--rpath=$PREF/bzip2/lib -Wl,--rpath=$PREF/gdbm/lib -Wl,--rpath=$PRE F/ncurses/lib -Wl,--rpath=$PREF/openssl/lib -Wl,--rpath=$PREF/readline/lib -Wl,--rpath=$PREF/sqlite/lib -Wl, --rpath=$PREF/xz/lib -Wl,--rpath=$PREF/zlib/lib -Wl,--rpath=$PREF/libffi/lib64 -Wl,--rpath=$PREF/openmpi/lib -Wl,--rpath=$PREF/util-linux/lib -Wl,--dynamic-linker=$PREF/glibc/lib/ld-linux-x86-64.so.2" ../configure -- enable-shared --prefix=$PREF/python-latest --with-openssl=$PREF/openssl --enable-optimizations make -j 8 And this is the error that I get. It's when rebuilding with optimizations. Rebuilding with profile guided optimizations: rm -f profile-clean-stamp make build_all CFLAGS_NODIST=" -fprofile-use -fprofile-correction" LDFLAGS="" make[1]: Entering directory `/scratch/src/Python-latest/build' LD_LIBRARY_PATH=/scratch/src/Python-latest/build:/opt/gcc/4.9.2/lib64:/opt/gcc/4.9.2/lib:/scratch/bzip2/lib:/scratch/gdbm/lib:/scratch/libffi/lib64:/scratch/ncurses/lib:/scratch/openmpi/lib:/scratch/openssl/lib:/scratch/readline/lib:/scratch/sqlite/lib:/scratch/util-linux/lib:/scratch/xz/lib:/scratch/zlib/lib:/usr/lib64 ./python -E -S -m sysconfig --generate-posix-vars ;\ 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 "/scratch/src/Python-latest/build/../Lib/runpy.py", line 15, in import importlib.util File "/scratch/src/Python-latest/build/../Lib/importlib/util.py", line 14, in from contextlib import contextmanager File "/scratch/src/Python-latest/build/../Lib/contextlib.py", line 4, in import _collections_abc SystemError: returned NULL without setting an error generate-posix-vars failed make[1]: *** [pybuilddir.txt] Error 1 make[1]: Leaving directory `/scratch/src/Python-latest/build' make: *** [profile-opt] Error 2 I tried searching for the error, and there seem to be similar errors related to improper PYTHONHOME, but I couldn't find anything related to build. I was able to build 3.6 with the same procedure, so I'm not sure if I'm doing something wrong. ---------- components: Build files: setup.py messages: 321655 nosy: jayanthkoushik priority: normal severity: normal status: open title: 3.7.0 build error with --enable-optimizations type: compile error versions: Python 3.7 Added file: https://bugs.python.org/file47691/setup.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 14 16:54:22 2018 From: report at bugs.python.org (Andrew Valencia) Date: Sat, 14 Jul 2018 20:54:22 +0000 Subject: [New-bugs-announce] [issue34113] LLTRACE segv Message-ID: <1531601662.45.0.56676864532.issue34113@psf.upfronthosting.co.za> New submission from Andrew Valencia : Build with -DLLTRACE, then: >>> __lltrace__ = 1 >>> a = [1, 2, 3] 0: 100, 0 push 1 3: 100, 1 push 2 6: 100, 2 push 3 9: 103, 3 pop 3 pop 2 pop 1 push [1, 2, 3] 12: 90, 0 pop [1, 2, 3] 15: 100, 3 push None 18: 83 pop None >>> a[0] = 1 0: 100, 0 push 1 3: 101, 0 push [1, 2, 3] 6: 100, 1 push 0 9: 60Program received signal SIGSEGV, Segmentation fault. 0x004535ae in internal_print (op=0x84002364, fp=0xb7f3bd60 <_IO_2_1_stdout_>, flags=0, nesting=0) at Objects/object.c:293 293 if (op->ob_refcnt <= 0) (gdb) bt #0 0x004535ae in internal_print (op=0x84002364, fp=0xb7f3bd60 <_IO_2_1_stdout_>, flags=0, nesting=0) at Objects/object.c:293 #1 0x0045370a in PyObject_Print (op=0x84002364, fp=0xb7f3bd60 <_IO_2_1_stdout_>, flags=0) at Objects/object.c:330 #2 0x004ada11 in prtrace (v=0x84002364, str=0x54b61d "stackadj") at Python/ceval.c:3979 #3 0x004a505b in PyEval_EvalFrameEx (f=0xb7d11994, throwflag=0) at Python/ceval.c:1919 #4 0x004ace97 in PyEval_EvalCodeEx (co=0xb7ce7bf0, globals=0xb7d7c714, locals=0xb7d7c714, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3604 #5 0x004a0671 in PyEval_EvalCode (co=0xb7ce7bf0, globals=0xb7d7c714, locals=0xb7d7c714) at Python/ceval.c:669 #6 0x004d26ab in run_mod (mod=0x646d78, filename=0x53ddfe "", globals=0xb7d7c714, locals=0xb7d7c714, flags=0xbffff568, arena=0x5f2b10) at Python/pythonrun.c:1385 #7 0x004d1106 in PyRun_InteractiveOneFlags (fp=0xb7f3b5a0 <_IO_2_1_stdin_>, filename=0x53ddfe "", flags=0xbffff568) at Python/pythonrun.c:866 #8 0x004d0e72 in PyRun_InteractiveLoopFlags (fp=0xb7f3b5a0 <_IO_2_1_stdin_>, filename=0x53ddfe "", flags=0xbffff568) at Python/pythonrun.c:786 #9 0x004d0d1a in PyRun_AnyFileExFlags (fp=0xb7f3b5a0 <_IO_2_1_stdin_>, filename=0x53ddfe "", closeit=0, flags=0xbffff568) at Python/pythonrun.c:755 #10 0x0041d798 in Py_Main (argc=1, argv=0xbffff694) at Modules/main.c:645 #11 0x0041c5eb in main (argc=1, argv=0xbffff694) at ./Modules/python.c:20 ---------- components: Interpreter Core messages: 321661 nosy: vandyswa priority: normal severity: normal status: open title: LLTRACE segv type: crash versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 14 17:11:56 2018 From: report at bugs.python.org (Sanyam Khurana) Date: Sat, 14 Jul 2018 21:11:56 +0000 Subject: [New-bugs-announce] [issue34114] Build failing: use of undeclared identifier '_Py_END_SUPPRESS_IPH' & '_Py_BEGIN_SUPPRESS_IPH' Message-ID: <1531602716.1.0.56676864532.issue34114@psf.upfronthosting.co.za> New submission from Sanyam Khurana : The step for configuration works correctly and gives a makefile. On running `./make` the following traceback is produced: ``` $ make ----------------------------------------------- Modules/Setup.dist is newer than Modules/Setup; check to make sure you have all the updates you need in your Modules/Setup file. Usually, copying Modules/Setup.dist to Modules/Setup will work. ----------------------------------------------- gcc -Wno-unused-result -Wsign-compare -g -O0 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -I. -I./Include -c ./Modules/posixmodule.c -o Modules/posixmodule.o ./Modules/posixmodule.c:1548:9: error: use of undeclared identifier '_Py_BEGIN_SUPPRESS_IPH' _Py_BEGIN_SUPPRESS_IPH ^ ./Modules/posixmodule.c:1550:9: error: use of undeclared identifier '_Py_END_SUPPRESS_IPH' _Py_END_SUPPRESS_IPH ^ ./Modules/posixmodule.c:4356:5: error: use of undeclared identifier '_Py_BEGIN_SUPPRESS_IPH' _Py_BEGIN_SUPPRESS_IPH ^ ./Modules/posixmodule.c:4364:5: error: expected expression else ^ ./Modules/posixmodule.c:4368:5: error: use of undeclared identifier '_Py_END_SUPPRESS_IPH' _Py_END_SUPPRESS_IPH ^ ./Modules/posixmodule.c:5075:5: error: use of undeclared identifier '_Py_BEGIN_SUPPRESS_IPH' _Py_BEGIN_SUPPRESS_IPH ^ ./Modules/posixmodule.c:5081:5: error: use of undeclared identifier '_Py_END_SUPPRESS_IPH' _Py_END_SUPPRESS_IPH ^ ./Modules/posixmodule.c:5146:5: error: use of undeclared identifier '_Py_BEGIN_SUPPRESS_IPH' _Py_BEGIN_SUPPRESS_IPH ^ ./Modules/posixmodule.c:5157:5: error: use of undeclared identifier '_Py_END_SUPPRESS_IPH' _Py_END_SUPPRESS_IPH ^ ./Modules/posixmodule.c:5376:5: error: use of undeclared identifier '_Py_BEGIN_SUPPRESS_IPH' _Py_BEGIN_SUPPRESS_IPH ^ ./Modules/posixmodule.c:5379:5: error: use of undeclared identifier '_Py_END_SUPPRESS_IPH' _Py_END_SUPPRESS_IPH ^ ./Modules/posixmodule.c:7996:5: error: use of undeclared identifier '_Py_BEGIN_SUPPRESS_IPH' _Py_BEGIN_SUPPRESS_IPH ^ ./Modules/posixmodule.c:8011:5: error: use of undeclared identifier '_Py_END_SUPPRESS_IPH' _Py_END_SUPPRESS_IPH ^ ./Modules/posixmodule.c:8048:5: error: use of undeclared identifier '_Py_BEGIN_SUPPRESS_IPH' _Py_BEGIN_SUPPRESS_IPH ^ ./Modules/posixmodule.c:8050:5: error: use of undeclared identifier '_Py_END_SUPPRESS_IPH' _Py_END_SUPPRESS_IPH ^ ./Modules/posixmodule.c:8074:5: error: use of undeclared identifier '_Py_BEGIN_SUPPRESS_IPH' _Py_BEGIN_SUPPRESS_IPH ^ ./Modules/posixmodule.c:8077:5: error: use of undeclared identifier '_Py_END_SUPPRESS_IPH' _Py_END_SUPPRESS_IPH ^ ./Modules/posixmodule.c:8265:5: error: use of undeclared identifier '_Py_BEGIN_SUPPRESS_IPH' _Py_BEGIN_SUPPRESS_IPH ^ ./Modules/posixmodule.c:8271:5: error: use of undeclared identifier '_Py_END_SUPPRESS_IPH' _Py_END_SUPPRESS_IPH ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [Modules/posixmodule.o] Error 1 ``` ---------- components: Interpreter Core messages: 321662 nosy: CuriousLearner priority: high severity: normal stage: needs patch status: open title: Build failing: use of undeclared identifier '_Py_END_SUPPRESS_IPH' & '_Py_BEGIN_SUPPRESS_IPH' type: compile error versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 14 18:49:43 2018 From: report at bugs.python.org (Yonatan Zunger) Date: Sat, 14 Jul 2018 22:49:43 +0000 Subject: [New-bugs-announce] [issue34115] code.InteractiveConsole.interact() closes stdin Message-ID: <1531608583.62.0.56676864532.issue34115@psf.upfronthosting.co.za> New submission from Yonatan Zunger : code.InteractiveConsole.interact() closes stdin on exit, which can be very surprising to successive code, not least future calls to interact(). A simple repro with a workaround is: import code import io import os import sys def run(): print(sys.stdin.buffer.raw) dupstdin = os.dup(0) try: code.InteractiveConsole().interact() except SystemExit: pass finally: # Workaround: Without this line, the second call to run() will fail with a ValueError when # it tries to call input(). sys.stdin = io.TextIOWrapper( io.BufferedReader(io.FileIO(dupstdin, mode='rb', closefd=False)), encoding='utf8') run() run() - The exciting behavior appears to happen inside the exec() of a 'quit()' command, and I haven't searched it out further. - That behavior inside exec() is likely there for a good reason, in which case the best fix is probably to just save and restore stdin in the code library. ---------- components: Library (Lib) messages: 321666 nosy: Yonatan Zunger priority: normal severity: normal status: open title: code.InteractiveConsole.interact() closes stdin type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 14 20:07:30 2018 From: report at bugs.python.org (=?utf-8?q?Andr=C3=A9s_Delfino?=) Date: Sun, 15 Jul 2018 00:07:30 +0000 Subject: [New-bugs-announce] [issue34116] Move all bytes/bytearray/int/float/complex documentation to Built-in Types Message-ID: <1531613250.34.0.56676864532.issue34116@psf.upfronthosting.co.za> New submission from Andr?s Delfino : Right now, bytearray, bytes, complex, float and int documentation is splitted into stdtypes.rst and functions.rst. I think stdtypes.rst should be the only source with all documentation, and functions.rst should just point out to stdtypes.rst. This would make it easier to get the complete picture of a given type without having to jump between pages. This is how the documentation of dict, frozenset, list, memoryview, range, set, str and tuple works. I believe bool() is more useful in functions.rst, as it's really short. ---------- assignee: docs at python components: Documentation messages: 321667 nosy: adelfino, docs at python priority: normal severity: normal status: open title: Move all bytes/bytearray/int/float/complex documentation to Built-in Types type: enhancement versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 14 20:27:13 2018 From: report at bugs.python.org (Brett Cannon) Date: Sun, 15 Jul 2018 00:27:13 +0000 Subject: [New-bugs-announce] [issue34117] Rename "generator expressions" to "generator comprehensions" Message-ID: <1531614433.94.0.56676864532.issue34117@psf.upfronthosting.co.za> New submission from Brett Cannon : The idea came up on python-dev to tweak the names of generator expressions to "generator comprehensions" to align more with list|set|dict comprehensions. This would be strictly a doc change (for now). A reference to generator expressions should be left if nothing else than to point to the new name. ---------- assignee: docs at python components: Documentation messages: 321670 nosy: brett.cannon, docs at python priority: low severity: normal status: open title: Rename "generator expressions" to "generator comprehensions" _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 14 23:04:38 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Sun, 15 Jul 2018 03:04:38 +0000 Subject: [New-bugs-announce] [issue34118] Fix some class entries entries in 'Built-in Functions' Message-ID: <1531623878.78.0.56676864532.issue34118@psf.upfronthosting.co.za> New submission from Terry J. Reedy : The Library Reference 'Built-in Functions' chapter includes build-in classes because classes are functions in the sense of being callable with arguments and returning objects. A proposal to change the name to Built-in Functions and Classes was rejected (by Raymond, as I remember). I suspect that 'Built-in Callables' has also been proposed. Some of the current entries need one or both of two fixes. 1. Most, but not all, of the classes are tagged with '*class*' before the class name. Classes classmethod and staticmethed are instead tagged with '@' since they are mostly used as decorators, although property is tagged *class*. Classes enumerate, filter, map, memoryview, range, reversed, tuple, and zip are untagged. I think, to be consistent, that they should all get the *class* tag. 2. Nearly all entries fully describe the arguments and return values. The exceptions are those for 6 collection classes. The first 3 have an abbreviated description of the result and a reference for further details on the relationship of input to result. class dict(iterable, **kwarg) Create a new dictionary. The dict object is the dictionary class. See dict and Mapping Types ? dict for documentation about this class. For other containers see the built-in list, set, and tuple classes, as well as the collections module. class frozenset([iterable]) Return a new frozenset object, optionally with elements taken from iterable. frozenset is a built-in class. See frozenset and Set Types ? set, frozenset for documentation about this class. For other containers see the built-in set, list, tuple, and dict classes, as well as the collections module. class set([iterable]) Return a new set object, optionally with elements taken from iterable. set is a built-in class. See set and Set Types ? set, frozenset for documentation about this class. For other containers see the built-in frozenset, list, tuple, and dict classes, as well as the collections module. The next 3 replace 'Return a ___' with 'Rather than being a function'. (This is from Nick's patch 6 years ago. https://github.com/python/cpython/commit/83c0ae5de642145ec225d29e7b239aa410229539.) I object to this because it is wrong if one uses the broad definition of function used in the chapter title. It is also wrong in the implication there is anything special about these classes in regard to being functions verses classess. class list([iterable]) Rather than being a function, list is actually a mutable sequence type, as documented in Lists and Sequence Types ? list, tuple, range. range(start, stop[, step]) Rather than being a function, range is actually an immutable sequence type, as documented in Ranges and Sequence Types ? list, tuple, range. tuple([iterable]) Rather than being a function, tuple is actually an immutable sequence type, as documented in Tuples and Sequence Types ? list, tuple, range. I propose that the 2nd 3 follow the model of the 1st 3, except that the final line should be: "For other collections see the built-in range, tuple, list, frozenset, set, and dict classes, as well as the collections module." (with 1 of the 6 omitted as appropriate). (Range represents a collection, but is not a container in the sense that the others are.) ---------- assignee: docs at python components: Documentation messages: 321674 nosy: docs at python, ncoghlan, rhettinger, terry.reedy priority: normal severity: normal stage: needs patch status: open title: Fix some class entries entries in 'Built-in Functions' type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 15 02:11:28 2018 From: report at bugs.python.org (Kishore Aadada) Date: Sun, 15 Jul 2018 06:11:28 +0000 Subject: [New-bugs-announce] [issue34119] Able to name a variable as 'input'. This creates problem when using input() function. Message-ID: <1531635088.28.0.56676864532.issue34119@psf.upfronthosting.co.za> New submission from Kishore Aadada : When i used input as a variable name, there is no error provided. After that I am calling input() function to read data. In such case, below error is reported. Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> input = "Test input" >>> data = input("Please enter some input") Traceback (most recent call last): File "", line 1, in data = input("Please enter some input") TypeError: 'str' object is not callable >>> ---------- components: IO files: inputError.png messages: 321680 nosy: kishoreaadada priority: normal severity: normal status: open title: Able to name a variable as 'input'. This creates problem when using input() function. type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47692/inputError.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 15 05:53:29 2018 From: report at bugs.python.org (Vlad Tudorache) Date: Sun, 15 Jul 2018 09:53:29 +0000 Subject: [New-bugs-announce] [issue34120] IDLE Caret/Focus Lost Message-ID: <1531648409.88.0.56676864532.issue34120@psf.upfronthosting.co.za> New submission from Vlad Tudorache : When closing the IDLE's Preferences dialog the IDLE's Console window and/or Editor window (whichever was active before) doesn't show cursor/caret any more. One must click on Desktop or another window then click again in the IDLE's window in order to regain cursor/caret. This problem shows on macOS High Sierra, Python 3.6.N and 3.7.N (and even 3.5.N), with the provided installers (64 bit, 64/32 bit, Tk 8.6.8) and with self-compiled Python(s). After a number of openings IDLE will crash with an @autoreleasepool issue. I've compiled Tcl/Tk and Python with CC=clang CXX=clang++ MACOSX_DEPLOYMENT_TARGET=10.9 (10.10, 10.12 also), Tcl/Tk with and without --enable-threads, always with --enable-64bit --enable-framework and --enable-dtrace, clang 902.0.39.2 (Apple LLVM version 9.1.0), Python was compiled with and without --enable-dtrace and --enable-optimizations, with --enable-framework. ---------- assignee: terry.reedy components: IDLE messages: 321686 nosy: terry.reedy, vtudorache priority: normal severity: normal status: open title: IDLE Caret/Focus Lost type: behavior versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 15 19:47:57 2018 From: report at bugs.python.org (Benjamin Peterson) Date: Sun, 15 Jul 2018 23:47:57 +0000 Subject: [New-bugs-announce] [issue34121] configure fails to detect C11 atomic support on clang Message-ID: <1531698477.65.0.56676864532.issue34121@psf.upfronthosting.co.za> New submission from Benjamin Peterson : clang supports C11 atomic APIs just fine but Python's configure fails to detect it: configure:16529: checking for stdatomic.h configure:16545: clang -pthread -o conftest conftest.c -lpthread -ldl -lutil >&5 conftest.c:389:5: error: _Atomic cannot be applied to incomplete type 'void' _Atomic void *py_atomic_address = (void*) &value; ^ 1 error generated. Indeed, the atomic uninhabited type is not very useful. If we wanted an atomic pointer, we should write _Atomic(void *). ---------- components: Interpreter Core messages: 321697 nosy: benjamin.peterson priority: normal severity: normal status: open title: configure fails to detect C11 atomic support on clang versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 00:12:50 2018 From: report at bugs.python.org (Dong-hee Na) Date: Mon, 16 Jul 2018 04:12:50 +0000 Subject: [New-bugs-announce] [issue34122] inspect.getmembers does not retrive dataclass's __dataclass_fields__ properly Message-ID: <1531714370.47.0.56676864532.issue34122@psf.upfronthosting.co.za> New submission from Dong-hee Na : When I execute this script. import inspect from dataclasses import * import enum @dataclass class SimpleDataObject(object): field_a: int = field() field_b: str = "asdad" print([a[0] for a in inspect.getmembers(SimpleDataObject)]) I expected ['__annotations__', '__class__', '__dataclass_fields__', '__dataclass_params__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'field_a', 'field_b'] but got ['__annotations__', '__class__', '__dataclass_fields__', '__dataclass_params__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'field_b'] If this behavior is not intended, I propose a new patch with providing Inspect.isdataclass for Python 3.8 and Inspect._is_dataclss for Python 3.7 https://github.com/corona10/cpython/commit/c2665176ce836a7b328ddc09c6c7d3de0a2b29a0 ---------- components: Library (Lib) files: inspect_dataclass.py messages: 321706 nosy: corona10, eric.smith, serhiy.storchaka, yselivanov priority: normal severity: normal status: open title: inspect.getmembers does not retrive dataclass's __dataclass_fields__ properly versions: Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47693/inspect_dataclass.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 02:00:27 2018 From: report at bugs.python.org (Dan Snider) Date: Mon, 16 Jul 2018 06:00:27 +0000 Subject: [New-bugs-announce] [issue34123] ambiguous documentation for dict.popitem Message-ID: <1531720827.11.0.56676864532.issue34123@psf.upfronthosting.co.za> New submission from Dan Snider : https://docs.python.org/3/library/stdtypes.html#dict.popitem `dict.popitem` no longer returns an "arbitrary" (key, value) pair as the documentation suggests. Rather, it always returns the pair whose key was most recently *inserted* (ie., the last entry in `dk_entries`). Perhaps the docs could reflect that this method is now always LIFO rather arbitrary now that insertion order is guaranteed? ---------- assignee: docs at python components: Documentation messages: 321708 nosy: bup, docs at python priority: normal severity: normal status: open title: ambiguous documentation for dict.popitem versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 07:39:16 2018 From: report at bugs.python.org (Jon Ribbens) Date: Mon, 16 Jul 2018 11:39:16 +0000 Subject: [New-bugs-announce] [issue34124] email.message_from_binary_file documentation is broken Message-ID: <1531741156.21.0.56676864532.issue34124@psf.upfronthosting.co.za> New submission from Jon Ribbens : The documentation for email.message_from_binary_file is missing a line-continuation backslash at the end of the `.. function::` line which means the output formatting is mangled and it has no permalink. ---------- assignee: docs at python components: Documentation messages: 321733 nosy: docs at python, jribbens priority: normal severity: normal status: open title: email.message_from_binary_file documentation is broken type: compile error versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 13:16:00 2018 From: report at bugs.python.org (Jeroen Demeyer) Date: Mon, 16 Jul 2018 17:16:00 +0000 Subject: [New-bugs-announce] [issue34125] Profiling depends on whether **kwargs is given Message-ID: <1531761360.51.0.56676864532.issue34125@psf.upfronthosting.co.za> New submission from Jeroen Demeyer : Enable profiling for C functions: >>> def prof(frame, typ, arg): ... if typ.startswith("c_"): ... print(arg, typ) >>> import sys; sys.setprofile(prof) and notice how profiling depends on **kwargs: >>> list.append([], None) c_call c_return >>> list.append([], None, **{}) There is no specification of what should be profiled and what not, so it's not clear what is the "correct" behavior. For the record: in Python 3.6, neither of these were profiled. ---------- components: Interpreter Core messages: 321746 nosy: jdemeyer priority: normal severity: normal status: open title: Profiling depends on whether **kwargs is given versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 13:17:10 2018 From: report at bugs.python.org (Jeroen Demeyer) Date: Mon, 16 Jul 2018 17:17:10 +0000 Subject: [New-bugs-announce] [issue34126] Profiling dict.get() crashes Python Message-ID: <1531761430.57.0.56676864532.issue34126@psf.upfronthosting.co.za> New submission from Jeroen Demeyer : >>> import sys; sys.setprofile(lambda *args:None) >>> dict.get() Segmentation fault ---------- components: Interpreter Core messages: 321747 nosy: jdemeyer priority: normal severity: normal status: open title: Profiling dict.get() crashes Python versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 14:38:33 2018 From: report at bugs.python.org (ppperry) Date: Mon, 16 Jul 2018 18:38:33 +0000 Subject: [New-bugs-announce] [issue34127] Gramatically incorrect error message for some descriptor calls with wrong number of arguments Message-ID: <1531766313.86.0.56676864532.issue34127@psf.upfronthosting.co.za> New submission from ppperry : `{}.get()` Traceback (most recent call last): File "", line 1, in TypeError: get expected at least 1 arguments, got 0 Shouldn't that be "TypeError: get expected at least 1 argument, got 0" instead? ---------- components: Interpreter Core messages: 321752 nosy: ppperry priority: normal severity: normal status: open title: Gramatically incorrect error message for some descriptor calls with wrong number of arguments versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 14:55:37 2018 From: report at bugs.python.org (Martin Bammer) Date: Mon, 16 Jul 2018 18:55:37 +0000 Subject: [New-bugs-announce] [issue34128] Do not block threads when pickle/unpickle Message-ID: <1531767337.85.0.56676864532.issue34128@psf.upfronthosting.co.za> New submission from Martin Bammer : Hi, the old and slow python implementation of pickle didn't block background thread. But the newer C-implementation blocks other threads while dump/load is running. Wouldn't it be possible to allow other threads during this time? Especially could load/loads release the GIL, because Python objects are not available to the Python code until these functions have finished? Regards, Martin ---------- components: Interpreter Core messages: 321755 nosy: Martin Bammer priority: normal severity: normal status: open title: Do not block threads when pickle/unpickle type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 15:04:19 2018 From: report at bugs.python.org (Pavel Jurkas) Date: Mon, 16 Jul 2018 19:04:19 +0000 Subject: [New-bugs-announce] [issue34129] CGITB does not mangle variables names Message-ID: <1531767859.43.0.56676864532.issue34129@psf.upfronthosting.co.za> New submission from Pavel Jurkas : CGITB does not mangle private variables names. So they are displayed as undefined even though they are defined. Example: self.__core undefined ---------- messages: 321757 nosy: pjurkas priority: normal severity: normal status: open title: CGITB does not mangle variables names _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 18:19:02 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 16 Jul 2018 22:19:02 +0000 Subject: [New-bugs-announce] [issue34130] test_signal: test_warn_on_full_buffer() failed on AppVeyor Message-ID: <1531779542.02.0.56676864532.issue34130@psf.upfronthosting.co.za> New submission from STINNER Victor : test_signal.test_warn_on_full_buffer() failed on AppVeyor. https://ci.appveyor.com/project/python/cpython/build/3.8build19372 ====================================================================== FAIL: test_warn_on_full_buffer (test.test_signal.WakeupSocketSignalTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\projects\cpython\lib\test\test_signal.py", line 538, in test_warn_on_full_buffer assert_python_ok('-c', code) File "C:\projects\cpython\lib\test\support\script_helper.py", line 157, in assert_python_ok return _assert_python(True, *args, **env_vars) File "C:\projects\cpython\lib\test\support\script_helper.py", line 143, in _assert_python res.fail(cmd_line) File "C:\projects\cpython\lib\test\support\script_helper.py", line 84, in fail err)) AssertionError: Process return code is 1 command line: ['C:\\projects\\cpython\\PCbuild\\win32\\python.exe', '-X', 'faulthandler', '-I', '-c', 'if 1:\n import errno\n import signal\n import socket\n import sys\n import time\n import _testcapi\n from test.support import captured_stderr\n\n signum = signal.SIGINT\n\n # This handler will be called, but we intentionally won\'t read from\n # the wakeup fd.\n def handler(signum, frame):\n pass\n\n signal.signal(signum, handler)\n\n read, write = socket.socketpair()\n read.setblocking(False)\n write.setblocking(False)\n\n # Fill the send buffer\n try:\n while True:\n write.send(b"x")\n except BlockingIOError:\n pass\n\n # By default, we get a warning when a signal arrives\n signal.set_wakeup_fd(write.fileno())\n\n with captured_stderr() as err:\n _testcapi.raise_signal(signum)\n\n err = err.getvalue()\n if (\'Exception ignored when trying to send to the signal wakeup fd\'\n not in err):\n raise AssertionError(err)\n\n # And also if warn_on_full_buffer=True\n signal.set_wakeup_fd(write.fileno(), warn_on_full_buffer=True)\n\n with captured_stderr() as err:\n _testcapi.raise_signal(signum)\n\n err = err.getvalue()\n if (\'Exception ignored when trying to send to the signal wakeup fd\'\n not in err):\n raise AssertionError(err)\n\n # But not if warn_on_full_buffer=False\n signal.set_wakeup_fd(write.fileno(), warn_on_full_buffer=False)\n\n with captured_stderr() as err:\n _testcapi.raise_signal(signum)\n\n err = err.getvalue()\n if err != "":\n raise AssertionError("got unexpected output %r" % (err,))\n\n # And then check the default again, to make sure warn_on_full_buffer\n # settings don\'t leak across calls.\n signal.set_wakeup_fd(write.fileno())\n\n with captured_stderr() as err:\n _testcapi.raise_signal(signum)\n\n err = err.getvalue()\n if (\'Exception ignored when trying to send to the signal wakeup fd\'\n not in err):\n raise AssertionError(err)\n\n '] stdout: --- --- stderr: --- Traceback (most recent call last): File "", line 39, in AssertionError --- ---------------------------------------------------------------------- The test passed when run again sequentially ("Re-running test 'test_signal' in verbose mode"). ---------- components: Tests messages: 321775 nosy: njs, pitrou, vstinner priority: normal severity: normal status: open title: test_signal: test_warn_on_full_buffer() failed on AppVeyor versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 18:32:27 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 16 Jul 2018 22:32:27 +0000 Subject: [New-bugs-announce] [issue34131] test_threading: BarrierTests.test_default_timeout() failed on AppVeyor Message-ID: <1531780347.81.0.56676864532.issue34131@psf.upfronthosting.co.za> New submission from STINNER Victor : test_threading.BarrierTests.test_default_timeout() failed on AppVeyor. Related issues: * bpo-11871, commit d4d1d068dcf4e1aaf93772ccc0824207a21606e5: change timeout * bpo-30316 https://ci.appveyor.com/project/python/cpython/build/3.8build19370 test_barrier (test.test_threading.BarrierTests) ... ok test_barrier_10 (test.test_threading.BarrierTests) ... ok test_default_timeout (test.test_threading.BarrierTests) ... ERROR test_reset (test.test_threading.BarrierTests) ... Unhandled exception in thread started by .task at 0x03266728> Traceback (most recent call last): File "C:\projects\cpython\lib\test\lock_tests.py", line 41, in task f() File "C:\projects\cpython\lib\test\lock_tests.py", line 938, in f i = barrier.wait() File "C:\projects\cpython\lib\threading.py", line 613, in wait self._wait(timeout) File "C:\projects\cpython\lib\threading.py", line 653, in _wait raise BrokenBarrierError threading.BrokenBarrierError Unhandled exception in thread started by .task at 0x03266728> Traceback (most recent call last): File "C:\projects\cpython\lib\test\lock_tests.py", line 41, in task f() File "C:\projects\cpython\lib\test\lock_tests.py", line 938, in f i = barrier.wait() File "C:\projects\cpython\lib\threading.py", line 613, in wait self._wait(timeout) File "C:\projects\cpython\lib\threading.py", line 653, in _wait raise BrokenBarrierError threading.BrokenBarrierError Unhandled exception in thread started by .task at 0x03266728> Traceback (most recent call last): File "C:\projects\cpython\lib\test\lock_tests.py", line 41, in task f() File "C:\projects\cpython\lib\test\lock_tests.py", line 938, in f i = barrier.wait() File "C:\projects\cpython\lib\threading.py", line 604, in wait self._enter() # Block while the barrier drains. File "C:\projects\cpython\lib\threading.py", line 628, in _enter raise BrokenBarrierError threading.BrokenBarrierError Unhandled exception in thread started by .task at 0x03266728> Traceback (most recent call last): File "C:\projects\cpython\lib\test\lock_tests.py", line 41, in task f() File "C:\projects\cpython\lib\test\lock_tests.py", line 938, in f i = barrier.wait() File "C:\projects\cpython\lib\threading.py", line 604, in wait self._enter() # Block while the barrier drains. File "C:\projects\cpython\lib\threading.py", line 628, in _enter raise BrokenBarrierError threading.BrokenBarrierError ok test_single_thread (test.test_threading.BarrierTests) ... ok test_timeout (test.test_threading.BarrierTests) ... ok test_wait_return (test.test_threading.BarrierTests) ... ok test_acquire (test.test_threading.BoundedSemaphoreTests) ... ok ... ====================================================================== ERROR: test_default_timeout (test.test_threading.BarrierTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\projects\cpython\lib\test\lock_tests.py", line 943, in test_default_timeout self.run_threads(f) File "C:\projects\cpython\lib\test\lock_tests.py", line 772, in run_threads f() File "C:\projects\cpython\lib\test\lock_tests.py", line 938, in f i = barrier.wait() File "C:\projects\cpython\lib\threading.py", line 613, in wait self._wait(timeout) File "C:\projects\cpython\lib\threading.py", line 651, in _wait raise BrokenBarrierError threading.BrokenBarrierError test_threading succeeded when it has been re-run in verbose mode. ---------- components: Tests messages: 321778 nosy: vstinner priority: normal severity: normal status: open title: test_threading: BarrierTests.test_default_timeout() failed on AppVeyor versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 19:13:33 2018 From: report at bugs.python.org (Skip Montanaro) Date: Mon, 16 Jul 2018 23:13:33 +0000 Subject: [New-bugs-announce] [issue34132] Obscure netrc parser "bug" Message-ID: <1531782813.71.0.56676864532.issue34132@psf.upfronthosting.co.za> New submission from Skip Montanaro : Not sure I can really call this a bug, however there is a behavioral change between 2.7 and at least 3.6 and 3.7 (probably earlier versions of the 3.x series as well). There is no spec for .netrc files that I can find, certainly nothing which mentions comment or blank lines. Still, Python's netrc file parser seems happy with both. However, in 3.x a blank line followed immediately by a comment line containing actual comment text causes the parser to raise a parse error. I've attached two netrc files, netrc-comment-blank, and netrc-blank-comment, identical save for the ordering of a blank line and a comment line. Here's what a 2.7.14 session looks like: Python 2.7.14 |Anaconda, Inc.| (default, Mar 27 2018, 17:29:31) [GCC 7.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import netrc >>> rc = netrc.netrc(file="/home/skip/tmp/netrc-comment-blank") >>> rc = netrc.netrc(file="/home/skip/tmp/netrc-blank-comment") Here's 3.7.0: Python 3.7.0 (default, Jun 28 2018, 13:15:42) [GCC 7.2.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import netrc >>> rc = netrc.netrc(file="/home/skip/tmp/netrc-comment-blank") >>> rc = netrc.netrc(file="/home/skip/tmp/netrc-blank-comment") Traceback (most recent call last): File "", line 1, in File "/home/skip/miniconda3/envs/python3/lib/python3.7/netrc.py", line 30, in __init__ self._parse(file, fp, default_netrc) File "/home/skip/miniconda3/envs/python3/lib/python3.7/netrc.py", line 63, in _parse "bad toplevel token %r" % tt, file, lexer.lineno) netrc.NetrcParseError: bad toplevel token 'Comment' (/home/skip/tmp/netrc-blank-comment, line 2) ---------- components: Library (Lib) files: netrc-comment-blank messages: 321779 nosy: skip.montanaro priority: normal severity: normal stage: needs patch status: open title: Obscure netrc parser "bug" type: behavior versions: Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47696/netrc-comment-blank _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 16 20:51:44 2018 From: report at bugs.python.org (Nathaniel Manista) Date: Tue, 17 Jul 2018 00:51:44 +0000 Subject: [New-bugs-announce] [issue34133] ValueError should not be documented as being restricted to only "a built-in operation or function" Message-ID: <1531788704.26.0.56676864532.issue34133@psf.upfronthosting.co.za> New submission from Nathaniel Manista : The documentation for ValueError currently describes it as being "Raised when a built-in operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError.", but the Python community has (quite rightly!) adopted it as the exception to raise in any system when that system is passed a value for a parameter that is type-correct but of an invalid value. (Because what, is every library going to present a "my_library.ValueError" exception instead? That would be ridiculous.) ValueError's documentation should drop the "a built-in operation or function" wording. Perhaps go with something like "When raised indicates that a function or method was passed a value of the correct type but an invalid value"? ---------- assignee: docs at python components: Documentation messages: 321784 nosy: Nathaniel Manista, docs at python priority: normal severity: normal status: open title: ValueError should not be documented as being restricted to only "a built-in operation or function" 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 Jul 17 00:03:50 2018 From: report at bugs.python.org (Windson Yang) Date: Tue, 17 Jul 2018 04:03:50 +0000 Subject: [New-bugs-announce] [issue34134] multiprocessing memory huge usage Message-ID: <1531800230.72.0.56676864532.issue34134@psf.upfronthosting.co.za> New submission from Windson Yang : I'm using macOX and I got huge memory usage when using generator with multiprocess. (see file) I think this is because (https://github.com/python/cpython/blob/master/Lib/multiprocessing/pool.py#L383) if not hasattr(iterable, '__len__'): iterable = list(iterable) if chunksize is None: chunksize, extra = divmod(len(iterable), len(self._pool) * 4) if extra: chunksize += 1 When we convert an iterable to list(iterable), we lost the advantage of using the generator. I'm not sure how to fix it, maybe we can set a default value for an object don't have '__len__' attr, any ideas? ---------- files: test.py messages: 321788 nosy: Windson Yang, zach.ware priority: normal severity: normal status: open title: multiprocessing memory huge usage type: resource usage 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/file47698/test.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 17 00:52:03 2018 From: report at bugs.python.org (=?utf-8?b?6rmA7YOc7ZmY?=) Date: Tue, 17 Jul 2018 04:52:03 +0000 Subject: [New-bugs-announce] [issue34135] The results of time.tzname print broken. Message-ID: <1531803123.68.0.56676864532.issue34135@psf.upfronthosting.co.za> New submission from ??? : When I call time.tzname at Korean Windows. (Microsoft Windows 10 Pro(10.0.17134 Build 17134)) It prints like below. This problem occurred Python 2 and 3 both. >>> import time >>> time.tzname ('???????? ??????', '???????? ???? ???? ????') I used chardet for getting correct tzname. >>> import chardet >>> tzname = [tzn.encode('latin-1').decode('cp949') for tzn in time.tzname] >>> tzname ['???? ???', '???? ?? ?? ??'] I think that cause of this problem is tzname encoded by 'latin-1' at Window s. ---------- components: Windows messages: 321790 nosy: paul.moore, steve.dower, tim.golden, zach.ware, ??? priority: normal severity: normal status: open title: The results of time.tzname print broken. type: behavior versions: Python 2.7, Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 17 04:15:16 2018 From: report at bugs.python.org (Kay Hayen) Date: Tue, 17 Jul 2018 08:15:16 +0000 Subject: [New-bugs-announce] [issue34136] Del on class __annotations__ regressed, failing test Message-ID: <1531815316.63.0.56676864532.issue34136@psf.upfronthosting.co.za> New submission from Kay Hayen : I am getting this: PYTHONPATH=`pwd` /c/Python37_32/python test/test_opcodes.py .F...... ====================================================================== FAIL: test_do_not_recreate_annotations (__main__.OpcodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "test/test_opcodes.py", line 45, in test_do_not_recreate_annotations class C: File "test/test_opcodes.py", line 48, in C x: int AssertionError: NameError not raised I have seen this on Linux as well. I first notices that as a regression of Nuitka in the CPython36 test suite. It actually took me a while to implement support for "del __annotations__" to make later references not fall back to the module "__annotation__", for 3.6 compatibility. However, now with 3.7 behavior is back to what 3.5 I think would have done, while the test is not updated to match. I am confused now, which is the intended way for this to work? Should I follow this change, or will it be fixed, or am I doing something wrong in running something wrong here? Yours, Kay ---------- components: Interpreter Core messages: 321807 nosy: kayhayen priority: normal severity: normal status: open title: Del on class __annotations__ regressed, failing test type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 17 06:59:41 2018 From: report at bugs.python.org (Daniel Pope) Date: Tue, 17 Jul 2018 10:59:41 +0000 Subject: [New-bugs-announce] [issue34137] Add Path.lexist() to pathlib Message-ID: <1531825181.93.0.56676864532.issue34137@psf.upfronthosting.co.za> New submission from Daniel Pope : When using pathlib to manipulate paths that may be symlinks or regular files, a pattern that comes up frequently is this expression: path.is_symlink() or path.exists() os.path.lexists(path) can be used for this, but when using pathlib going back to os.path for this seems like defeat. ---------- components: Library (Lib) messages: 321812 nosy: lordmauve priority: normal severity: normal status: open title: Add Path.lexist() to pathlib type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 17 08:31:07 2018 From: report at bugs.python.org (Sam Varshavchik) Date: Tue, 17 Jul 2018 12:31:07 +0000 Subject: [New-bugs-announce] [issue34138] RFC 6855 issue Message-ID: <1531830667.9.0.56676864532.issue34138@psf.upfronthosting.co.za> New submission from Sam Varshavchik : Greetings. I am in the process of implementing RFC 6855 in Courier-IMAP. A Google search for IMAP clients that implement RFC 6855 led me to https://bugs.python.org/issue21800 and looking over the code that was added to imaplib, to support RFC 6855, a few things stood out. I checked, and the changes introduces in 21800 still appear to be unchanged in https://github.com/python/cpython/blob/master/Lib/imaplib.py Issue 21800 modified sub append(), that implements the IMAP APPEND command, thusly: - self.literal = MapCRLF.sub(CRLF, message) + literal = MapCRLF.sub(CRLF, message) + if self.utf8_enabled: + literal = b'UTF8 (' + literal + b')' + self.literal = literal "literal" here appears to be the contents of the message with CRLF line ending. But section 4 of https://tools.ietf.org/html/rfc6855.html states: The ABNF for the "APPEND" data extension and "CATENATE" extension follows: utf8-literal = "UTF8" SP "(" literal8 ")" literal8 = append-data =/ utf8-literal cat-part =/ utf8-literal As indicated above, "literal8" comes from RFC 4466, which also defines "append-data". RFC 4466 additionally states: In addition, the non-terminal "literal8" defined in [BINARY] got extended to allow for non-synchronizing literals if both [BINARY] and [LITERAL+] extensions are supported by the server. I'll come back to this revealing paragraph in a moment, but, as stated, "literal8" actually comes from [BINARY] which is RFC 3516, which specifies the following: append =/ "APPEND" SP mailbox [SP flag-list] [SP date-time] SP literal8 fetch-att =/ "BINARY" [".PEEK"] section-binary [partial] / "BINARY.SIZE" section-binary literal8 = "~{" number "}" CRLF *OCTET ; represents the number of OCTETs ; in the response string. An exhaustive search of imaplib.py seems to indicate that this pesky tilde is in hiding. And the wrong thing seems to be quoted as the actual literal. Anyway, back to the RFCs: combine all of the above together, spin it in a blender, and you get the following result: Supposing that the message being appended consists of a single header line "Subject: test", and a blank line, a sample command of what actually goes out the wire (based on the above, and other parts of these, and related RFCs): APPEND INBOX NIL NIL UTF8 (~{17}Subject: test) I haven't tested imaplib against Courier-IMAP in this respect, but it doesn't seem like this is going to be results. But wait, there's more! "literal8" is a synchronizing literal, like "literal" from RFC 3501, which specifies: ...In the case of literals transmitted from client to server, the client MUST wait to receive a command continuation request (described later in this document) before sending the octet data (and the remainder of the command). The LITERAL+ IMAP extension, that was mentioned in the excerpt from RFC 4466 that I cited above, introduced non-synchronizing literals: The protocol receiver of an IMAP4 server must check the end of every received line for an open brace ('{') followed by an octet count, a plus ('+'), and a close brace ('}') immediately preceeding the CRLF. If it finds this sequence, it is the octet count of a non- synchronizing literal and the server MUST treat the specified number of following octets and the following line as part of the same command. Otherwise, after the closing brace and the the IMAP client must wait for the continuation response from the server. So, to summarize: 1) RFC 4466, combined with RFC 6855 an IMAP UTF-8 client talking to an IMAP UTF-8 server can send the following, on the wire, if the server supports LITERAL+: APPEND INBOX NIL NIL UTF8 (~{17+}Subject: test) 2) But, if the server did not advertise LITERAL+, the IMAP client is required to send only: APPEND INBOX NIL NIL UTF8 (~{17} Then wait for the continuation response from the server, then send the rest of the command. IMAP specifications have been painful to read, for the 20+ years I've been reading them. Historically there's been a lot of interoperability problems between IMAP clients and servers. I lay the blame squarely on the horrible specs, but that's off-topic. Suffice to say, nothing of that sort has been observed for POP3 and SMTP, and I think there's a very good reason for that. ---------- components: email messages: 321819 nosy: Sam Varshavchik, barry, r.david.murray priority: normal severity: normal status: open title: RFC 6855 issue versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 17 09:52:23 2018 From: report at bugs.python.org (Quentin Dawans) Date: Tue, 17 Jul 2018 13:52:23 +0000 Subject: [New-bugs-announce] [issue34139] Remove stale unix datagram socket before binding Message-ID: <1531835543.49.0.56676864532.issue34139@psf.upfronthosting.co.za> New submission from Quentin Dawans : Like https://github.com/python/asyncio/commit/806cc68d762acc30490cf5583569e41441c25c35 but for unix datagram socket. I'm looking into making a PR ---------- components: asyncio messages: 321829 nosy: asvetlov, qdawans, yselivanov priority: normal severity: normal status: open title: Remove stale unix datagram socket before binding _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 17 10:21:19 2018 From: report at bugs.python.org (Horace Stoica) Date: Tue, 17 Jul 2018 14:21:19 +0000 Subject: [New-bugs-announce] [issue34140] Possible multiprocessing deadlock when placing too many objects in Queue() Message-ID: <1531837279.07.0.56676864532.issue34140@psf.upfronthosting.co.za> New submission from Horace Stoica : I am trying to use the multiprocessing module for a simulation on a spherical lattice, but the process hangs when the lattice is too large. In the file IssuesWithQueueMultiProcessing.py, the method createLattice(), use either "return(I4)" for the small lattice or "return(I5)" for the large lattice. Running the script when using the large lattice causes the process to hang while for the small lattice it works fine. I have tested with Python 3.5.2 and 3.6.1 and the behavior is the same in both versions. ---------- files: IssuesWithQueueMultiProcessing.tar.bz messages: 321832 nosy: fhstoica priority: normal severity: normal status: open title: Possible multiprocessing deadlock when placing too many objects in Queue() type: performance versions: Python 3.5, Python 3.6 Added file: https://bugs.python.org/file47702/IssuesWithQueueMultiProcessing.tar.bz _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 17 12:49:06 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 17 Jul 2018 16:49:06 +0000 Subject: [New-bugs-announce] [issue34141] Speed up pickling simple non-recusive values Message-ID: <1531846146.68.0.56676864532.issue34141@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The proposed PR reduces an overhead of calling Py_EnterRecursiveCall() when pickle simple non-recusive values: None, True, False, instances of int, float, bytes, str. $ ./python -m timeit -s 'data = list(range(10**7)); import pickle' -- 'pickle.dumps(data)' Unpatched: 218 msec per loop Patched: 147 msec per loop $ ./python -m timeit -s 'data = list(map(float, range(10**7))); import pickle' -- 'pickle.dumps(data)' Unpatched: 218 msec per loop Patched: 179 msec per loop $ ./python -m timeit -s 'data = list(map(str, range(10**6))); import pickle' -- 'pickle.dumps(data)' Unpatched: 212 msec per loop Patched: 201 msec per loop ---------- components: Library (Lib) messages: 321841 nosy: alexandre.vassalotti, pitrou, serhiy.storchaka priority: normal severity: normal status: open title: Speed up pickling simple non-recusive values type: performance versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 17 22:09:35 2018 From: report at bugs.python.org (LarryZA) Date: Wed, 18 Jul 2018 02:09:35 +0000 Subject: [New-bugs-announce] [issue34142] Windows launcher version lookup flawed Message-ID: <1531879775.21.0.56676864532.issue34142@psf.upfronthosting.co.za> New submission from LarryZA : In the manual it says that the following .ini file will cause the launcher to run Python3.1 for calls of `py` or `py -3` [defaults] python=3 python3=3.1 On my Windows 7 machine I have Python2.7-32, Python3.4-64, and Python3.7-64 (installed in that order). Setting the ini to: [defaults] python=3 python3=3.4 results in `py` running 3.7-64 (expected 3.4-64) and `py -3` running 3.4-64. Setting both to point to 3.4 in the ini will run 3.4-64 for both commands. ---------- components: Windows messages: 321855 nosy: LarryZA, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows launcher version lookup flawed type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 03:26:34 2018 From: report at bugs.python.org (lktoken) Date: Wed, 18 Jul 2018 07:26:34 +0000 Subject: [New-bugs-announce] [issue34143] There is a constant definition error in errno.py Message-ID: <1531898794.31.0.56676864532.issue34143@psf.upfronthosting.co.za> New submission from lktoken : In errno.py, the constant EDEADLK has a defined value of 11, and the constant EAGAIN has a defined value of 35, which is exactly the opposite of the linux constant definition. See: https://www.thegeekstuff.com/2010/10/linux -error-codes/. ---------- components: Library (Lib), macOS files: pythonbug.png messages: 321863 nosy: lktoken, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: There is a constant definition error in errno.py type: behavior versions: Python 2.7 Added file: https://bugs.python.org/file47703/pythonbug.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 04:18:42 2018 From: report at bugs.python.org (Lorenz Mende) Date: Wed, 18 Jul 2018 08:18:42 +0000 Subject: [New-bugs-announce] [issue34144] venv activate.bat reset codepage fails on windows 10 Message-ID: <1531901922.72.0.56676864532.issue34144@psf.upfronthosting.co.za> New submission from Lorenz Mende : environment: Windows 10 Pro German/ 1803 cpython @master When running the venv activate.bat the script fails to reset the codepage to the stored. # Parameterformat falsch - 65001. It seems that version 1803 brought a small change to the output of chcp.com - a dot is appended at the output The issue can be solved by modifying the codepage grep of activate.bat: for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do (... A pull will be requested. ---------- components: Library (Lib) messages: 321868 nosy: LorenzMende priority: normal severity: normal status: open title: venv activate.bat reset codepage fails on windows 10 type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 04:46:07 2018 From: report at bugs.python.org (Bence Romsics) Date: Wed, 18 Jul 2018 08:46:07 +0000 Subject: [New-bugs-announce] [issue34145] uuid3 and uuid5 hard to use portably between Python 2 and 3 Message-ID: <1531903567.77.0.56676864532.issue34145@psf.upfronthosting.co.za> New submission from Bence Romsics : The issue I'd like to report may not be an outright bug neither in cPython 2 nor in cPython 3, but more of a wishlist item to help Python programmers writing UUID-handling code that's valid in Python 2 and 3 at the same time. Please consider these one-liners: $ python2 -c 'import uuid ; uuid.uuid5(namespace=uuid.UUID("850aeee8-e173-4da1-9d6b-dd06e4b06747"), name="foo")' $ python3 -c 'import uuid ; uuid.uuid5(namespace=uuid.UUID("850aeee8-e173-4da1-9d6b-dd06e4b06747"), name="foo")' As long as the 'name' input to uuid.uuid3() or uuid.uuid5() is the literal string type of the relevant Python version there's no problem at all. However if you'd like to handle both unicode and non-unicode 'name' input in valid Python2/3 code then I find that's impossible to express without relying on Python version checking. cPython2's uuid module is incompatible with unicode input: $ python2 -c 'import uuid ; uuid.uuid5(namespace=uuid.UUID("850aeee8-e173-4da1-9d6b-dd06e4b06747"), name=u"foo")' Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.7/uuid.py", line 589, in uuid5 hash = sha1(namespace.bytes + name).digest() UnicodeDecodeError: 'ascii' codec can't decode byte 0x85 in position 0: ordinal not in range(128) cPython3's uuid module is incompatible with non-unicode input: $ python3 -c 'import uuid ; uuid.uuid5(namespace=uuid.UUID("850aeee8-e173-4da1-9d6b-dd06e4b06747"), name=b"foo")' Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.5/uuid.py", line 608, in uuid5 hash = sha1(namespace.bytes + bytes(name, "utf-8")).digest() TypeError: encoding without a string argument The reason is obvious looking at the uuid modules' source code: cPython 2.7: https://github.com/python/cpython/blob/ea9a0994cd0f4bd37799b045c34097eb21662b3d/Lib/uuid.py#L603 cPython 3.6: https://github.com/python/cpython/blob/e9e2fd75ccbc6e9a5221cf3525e39e9d042d843f/Lib/uuid.py#L628 Therefore portable code has to resort to version checking like this: import six import uuid if six.PY2: name = name.encode('utf-8') uuid.uuid5(namespace=namespace, name=name) IMHO this inconvenience could be avoided if cPython2's uuid.uuid3() and uuid.uuid5() had been changed to also accept unicode 'name' arguments and encode() them implicitly. What do you think? ---------- components: Library (Lib) messages: 321870 nosy: rubasov priority: normal severity: normal status: open title: uuid3 and uuid5 hard to use portably between Python 2 and 3 versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 06:41:57 2018 From: report at bugs.python.org (Dan Snider) Date: Wed, 18 Jul 2018 10:41:57 +0000 Subject: [New-bugs-announce] [issue34146] PyCData_Type.tp_hash doesn't use PyObject_HashNotImplemented Message-ID: <1531910517.42.0.56676864532.issue34146@psf.upfronthosting.co.za> New submission from Dan Snider : So not only does the function it does use (`PyCData_nohash`) prevent PyType_Ready from setting _ctypes._SimpleCData.__dict__["__hash__"] to `None`, (contrary to to every other unhashable type in the standard library) but the error message it returns is less detailed. It seems like a big deal if this were to be changed as it could break backwards compatibility so I won't open PR myself as I'm still not that familiar with the contribution process. ---------- components: ctypes messages: 321878 nosy: bup priority: normal severity: normal status: open title: PyCData_Type.tp_hash doesn't use PyObject_HashNotImplemented versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 09:51:41 2018 From: report at bugs.python.org (=?utf-8?q?Andr=C3=A9s_Delfino?=) Date: Wed, 18 Jul 2018 13:51:41 +0000 Subject: [New-bugs-announce] [issue34147] doc Describe briefly sampling w/out replacement in random Message-ID: <1531921901.63.0.56676864532.issue34147@psf.upfronthosting.co.za> New submission from Andr?s Delfino : I think a short footnote explaining these terms could be useful to those without statistics knowledge. ---------- assignee: docs at python components: Documentation messages: 321882 nosy: adelfino, docs at python priority: normal severity: normal status: open title: doc Describe briefly sampling w/out replacement in random type: enhancement versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 10:23:04 2018 From: report at bugs.python.org (yjq) Date: Wed, 18 Jul 2018 14:23:04 +0000 Subject: [New-bugs-announce] [issue34148] Fatal error on SSL transport Message-ID: <1531923784.93.0.56676864532.issue34148@psf.upfronthosting.co.za> New submission from yjq : Fatal read error on socket transport protocol: transport: <_SelectorSocketTransport fd=47 read=polling write=> Traceback (most recent call last): File "/var/containers/Bundle/Application/9F565D30-C54B-4210-902B-874D7A5AB814/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/asyncio/selector_events.py", line 725, in _read_ready data = self._sock.recv(self.max_size) TimeoutError: [Errno 60] Operation timed out ---------- components: asyncio messages: 321883 nosy: asvetlov, yjqiang, yselivanov priority: normal severity: normal status: open title: Fatal error on SSL transport type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 12:06:09 2018 From: report at bugs.python.org (Alexander Marshalov) Date: Wed, 18 Jul 2018 16:06:09 +0000 Subject: [New-bugs-announce] [issue34149] Behavior of the min/max with key=None Message-ID: <1531929969.94.0.56676864532.issue34149@psf.upfronthosting.co.za> New submission from Alexander Marshalov <_ at marshalov.org>: I was faced with the fact that the behavior of the functions "min"/"max" and "sorted" is a little different. For example, this code works fine: >>> sorted([3, 2, 1], key=None) [1, 2, 3] But the same example for "min" and "max" doesn't work: >>> min([3, 2, 1], key=None) Traceback (most recent call last): File "", line 1, in TypeError: 'NoneType' object is not callable That is why the heapq library has this code: ... def nsmallest(n, iterable, key=None): ... if key is None: result = min(it, default=sentinel) else: result = min(it, default=sentinel, key=key) ... At the same time, there are many places where such checks are not performed for the "sorted" function. I think the behavior of the "min" / "max" / "sorted" functions should be unified. That is, they should work as if "None" is the default value for "key". ---------- messages: 321891 nosy: amper priority: normal severity: normal status: open title: Behavior of the min/max with key=None type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 12:54:44 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 18 Jul 2018 16:54:44 +0000 Subject: [New-bugs-announce] [issue34150] test_multiprocessing_spawn: Dangling processes leaked on AMD64 FreeBSD 10.x Shared 3.x Message-ID: <1531932884.13.0.56676864532.issue34150@psf.upfronthosting.co.za> New submission from STINNER Victor : https://buildbot.python.org/all/#/builders/87/builds/1175 0:07:52 load avg: 4.38 [369/417/1] test_multiprocessing_spawn failed (env changed) (2 min 43 sec) -- running: test_lib2to3 (1 min 11 sec), test_tools (2 min 4 sec) (...) test_lock (test.test_multiprocessing_spawn.WithProcessesTestLock) ... ok test_lock_context (test.test_multiprocessing_spawn.WithProcessesTestLock) ... ok test_rlock (test.test_multiprocessing_spawn.WithProcessesTestLock) ... ok test_enable_logging (test.test_multiprocessing_spawn.WithProcessesTestLogging) ... ok test_level (test.test_multiprocessing_spawn.WithProcessesTestLogging) ... ok test_rapid_restart (test.test_multiprocessing_spawn.WithProcessesTestManagerRestart) ... ok Warning -- Dangling processes: {} test_access (test.test_multiprocessing_spawn.WithProcessesTestPicklingConnections) ... ok test_pickling (test.test_multiprocessing_spawn.WithProcessesTestPicklingConnections) ... ok test_boundaries (test.test_multiprocessing_spawn.WithProcessesTestPoll) ... ok test_dont_merge (test.test_multiprocessing_spawn.WithProcessesTestPoll) ... ok (...) 1 test altered the execution environment: test_multiprocessing_spawn (...) Tests result: ENV CHANGED ---------- components: Tests messages: 321895 nosy: vstinner priority: normal severity: normal status: open title: test_multiprocessing_spawn: Dangling processes leaked on AMD64 FreeBSD 10.x Shared 3.x versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 13:31:49 2018 From: report at bugs.python.org (Sergey Fedoseev) Date: Wed, 18 Jul 2018 17:31:49 +0000 Subject: [New-bugs-announce] [issue34151] use malloc() for better performance of some list operations Message-ID: <1531935109.04.0.56676864532.issue34151@psf.upfronthosting.co.za> New submission from Sergey Fedoseev : Currently list concatenation, slicing and repeating operations are using PyList_New() which allocates memory for the items by calloc(). malloc() could be used instead, since the allocated memory is overwritten by mentioned operations. I made benchmarks with this script: NAME=list-malloc-master.json python -m perf timeit --name slice0 -s "l = [None]*1000000" "l[:0]" --duplicate=2048 --append $NAME python -m perf timeit --name slice1 -s "l = [None]*1000000" "l[:1]" --duplicate=1024 --append $NAME python -m perf timeit --name slice2 -s "l = [None]*1000000" "l[:2]" --duplicate=1024 --append $NAME python -m perf timeit --name slice3 -s "l = [None]*1000000" "l[:3]" --duplicate=1024 --append $NAME python -m perf timeit --name slice1000000 -s "l = [None]*1000000" "l[:1000000]" --append $NAME python -m perf timeit --name cat0 -s "l = [None]*0" "l + l" --duplicate=1024 --append $NAME python -m perf timeit --name cat1 -s "l = [None]*1" "l * 1" --duplicate=1024 --append $NAME python -m perf timeit --name cat2 -s "l = [None]*2" "l * 1" --duplicate=1024 --append $NAME python -m perf timeit --name cat3 -s "l = [None]*3" "l * 1" --duplicate=1024 --append $NAME python -m perf timeit --name cat1000000 -s "l = [None]*1000000" "l * 1" --append $NAME python -m perf timeit --name 1x0 -s "l = [None]" "l * 0" --duplicate=1024 --append $NAME python -m perf timeit --name 1x1 -s "l = [None]" "l * 1" --duplicate=1024 --append $NAME python -m perf timeit --name 1x2 -s "l = [None]" "l * 2" --duplicate=1024 --append $NAME python -m perf timeit --name 1x3 -s "l = [None]" "l * 3" --duplicate=1024 --append $NAME python -m perf timeit --name 1x1000000 -s "l = [None]" "l * 1000000" --append $NAME Here's comparison table: +--------------+--------------------+------------------------------+ | Benchmark | list-malloc-master | list-malloc | +==============+====================+==============================+ | slice1 | 84.5 ns | 59.6 ns: 1.42x faster (-30%) | +--------------+--------------------+------------------------------+ | slice2 | 71.6 ns | 61.8 ns: 1.16x faster (-14%) | +--------------+--------------------+------------------------------+ | slice3 | 74.4 ns | 63.6 ns: 1.17x faster (-15%) | +--------------+--------------------+------------------------------+ | slice1000000 | 4.39 ms | 4.08 ms: 1.08x faster (-7%) | +--------------+--------------------+------------------------------+ | cat0 | 23.9 ns | 24.9 ns: 1.04x slower (+4%) | +--------------+--------------------+------------------------------+ | cat1 | 73.2 ns | 51.9 ns: 1.41x faster (-29%) | +--------------+--------------------+------------------------------+ | cat2 | 61.6 ns | 53.1 ns: 1.16x faster (-14%) | +--------------+--------------------+------------------------------+ | cat3 | 63.0 ns | 54.3 ns: 1.16x faster (-14%) | +--------------+--------------------+------------------------------+ | cat1000000 | 4.38 ms | 4.08 ms: 1.07x faster (-7%) | +--------------+--------------------+------------------------------+ | 1x0 | 27.1 ns | 27.7 ns: 1.02x slower (+2%) | +--------------+--------------------+------------------------------+ | 1x1 | 72.9 ns | 51.9 ns: 1.41x faster (-29%) | +--------------+--------------------+------------------------------+ | 1x2 | 60.9 ns | 52.9 ns: 1.15x faster (-13%) | +--------------+--------------------+------------------------------+ | 1x3 | 62.5 ns | 54.8 ns: 1.14x faster (-12%) | +--------------+--------------------+------------------------------+ | 1x1000000 | 2.67 ms | 2.34 ms: 1.14x faster (-12%) | +--------------+--------------------+------------------------------+ Not significant (1): slice0 ---------- components: Interpreter Core messages: 321905 nosy: sir-sigurd priority: normal severity: normal status: open title: use malloc() for better performance of some list operations type: performance _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 14:26:09 2018 From: report at bugs.python.org (Sergey Fedoseev) Date: Wed, 18 Jul 2018 18:26:09 +0000 Subject: [New-bugs-announce] [issue34152] performance of some list slice assignment can be improved Message-ID: <1531938369.41.0.56676864532.issue34152@psf.upfronthosting.co.za> New submission from Sergey Fedoseev : Script for benchmarks: NAME=list-slice.json python -m perf timeit --name "l[len(l):] = reversed(l)" -l 1 -s "l = [None] * 1000000" "l[len(l):] = reversed(l)" --append $NAME python -m perf timeit --name "l[len(l):] = l" -l 1 -s "l = [None] * 1000000" "l[len(l):] = l" --append $NAME python -m perf timeit --name "l[::-1] = l" -s "l = [None] * 1000000" "l[::-1] = l" --append $NAME python -m perf timeit --name "l[:] = l" -s "l = [None] * 1000000" "l[:] = l" --append $NAME python -m perf timeit --name "l[len(l)//2:] = l" -l 1 -s "l = [None] * 1000000" "l[len(l)//2:] = l" --append $NAME python -m perf timeit --name "l[:len(l)//2] = l" -l 1 -s "l = [None] * 1000000" "l[:len(l)//2] = l" --append $NAME python -m perf timeit --name "l[len(l)//4:len(l)*3//4] = l" -l 1 -s "l = [None] * 1000000" "l[len(l)//4:len(l)*3//4] = l" --append $NAME Results table: +------------------------------+-------------------+------------------------------------+ | Benchmark | list-slice-master | list-slice | +==============================+===================+====================================+ | l[len(l):] = reversed(l) | 8.44 ms | 5.18 ms: 1.63x faster (-39%) | +------------------------------+-------------------+------------------------------------+ | l[len(l):] = l | 7.88 ms | 3.37 ms: 2.34x faster (-57%) | +------------------------------+-------------------+------------------------------------+ | l[::-1] = l | 10.4 ms | 582 us: 17.85x faster (-94%) | +------------------------------+-------------------+------------------------------------+ | l[:] = l | 10.6 ms | 86.1 ns: 123128.46x faster (-100%) | +------------------------------+-------------------+------------------------------------+ | l[len(l)//2:] = l | 11.1 ms | 2.08 ms: 5.33x faster (-81%) | +------------------------------+-------------------+------------------------------------+ | l[:len(l)//2] = l | 11.5 ms | 1.76 ms: 6.53x faster (-85%) | +------------------------------+-------------------+------------------------------------+ | l[len(l)//4:len(l)*3//4] = l | 11.3 ms | 2.27 ms: 4.98x faster (-80%) | +------------------------------+-------------------+------------------------------------+ ---------- components: Interpreter Core messages: 321908 nosy: sir-sigurd priority: normal severity: normal status: open title: performance of some list slice assignment can be improved type: performance _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 15:18:40 2018 From: report at bugs.python.org (wassersteinchen) Date: Wed, 18 Jul 2018 19:18:40 +0000 Subject: [New-bugs-announce] [issue34153] 10/3 - last digit Message-ID: <1531941520.1.0.56676864532.issue34153@psf.upfronthosting.co.za> New submission from wassersteinchen : Hi, I am new to python and just installed it on my win pc. First thing what I did were some calculations (see below). There is a failure in th last digit at 10/3 and 100/3. Sorry if this is a RTFM-issue... armin Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> 3+6 9 >>> 10/3 3.3333333333333335 >>> 1/3 0.3333333333333333 >>> 10/3 3.3333333333333335 >>> 100/3 33.333333333333336 >>> 1000/3 333.3333333333333 >>> 10000/3 3333.3333333333335 >>> 100000/3 33333.333333333336 >>> 1000000/3 333333.3333333333 >>> 200/3 66.66666666666667 ---------- components: Windows messages: 321909 nosy: paul.moore, steve.dower, tim.golden, wassersteinchen, zach.ware priority: normal severity: normal status: open title: 10/3 - last digit versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 18 23:08:30 2018 From: report at bugs.python.org (Creation Elemental) Date: Thu, 19 Jul 2018 03:08:30 +0000 Subject: [New-bugs-announce] [issue34154] Tkinter __init__ documentations sometimes missing valid keyword values Message-ID: <1531969710.94.0.56676864532.issue34154@psf.upfronthosting.co.za> New submission from Creation Elemental : Priority: Low Type: Documentation issue Some of the Tkinter documentation is incomplete. I've only checked it on the Listbox so far, but some of the valid keyword arguments are missing. The one I noticed was "disabledforeground" which changes how the foreground color of text when the Listbox is in the disabled state or has a selection mode of none. I've noticed this across multiple versions of python, including Python 2.7 and Python 3.6, both of which accepted "disabledforeground" as a valid keyword without it being in the list shown in the help for Listbox.__init__ I found the disabledforeground keyword argument when looking at the Listbox documentation here: https://www.tcl.tk/man/tcl8.4/TkCmd/listbox.htm ---------- components: Tkinter messages: 321921 nosy: Creation Elemental priority: normal severity: normal status: open title: Tkinter __init__ documentations sometimes missing valid keyword values versions: Python 2.7, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 19 10:53:43 2018 From: report at bugs.python.org (=?utf-8?q?Cyril_Nicod=C3=A8me?=) Date: Thu, 19 Jul 2018 14:53:43 +0000 Subject: [New-bugs-announce] [issue34155] email.utils.parseaddr mistakenly parse an email Message-ID: <1532012023.85.0.56676864532.issue34155@psf.upfronthosting.co.za> New submission from Cyril Nicod?me : Hi! I'm trying to parse some emails, and I discovered that email.utils.parseaddr wrongly parse an email. Here's the corresponding header: > From: =?utf-8?Q?zq at redacted.com.cn=E3=82=86=E2=86=91=E3=82=86?= =?utf-8?Q?=E3=82=83=E3=82=85=E3=81=87=E3=81=BA=E3=81=BD=E3=81=BC"\=E3?= =?utf-8?Q?=81=A9=E3=81=A5=E3=81=A2l=E3=81=A0=E3=81=B0=E3=81=A8=E3=81?= =?utf-8?Q?=8FKL=E3=81=84=E3=82=8C=E3=82=8B=E3=82=86>KL=E3=82=89JF?= Once this has been parsed via `decode_header`, we obtain this value: > From: zq at redacted.com.cn?????????"\???l????KL????>KL?JF (I agree, not really a nice looking From email ...) Then, when this value is given to parseaddr, here's the result: > ('', 'zq at redacted.com.cn?????????') But it should be: > ('zq at redacted.com.cn?????????"\???l????KL????>KL?JF', 'mxvu at redacted2.com') (Note that the email in the "name" part is not the same as the email in the "email" part!) ---------- components: email messages: 321956 nosy: Cyril Nicod?me, barry, r.david.murray priority: normal severity: normal status: open title: email.utils.parseaddr mistakenly parse an email type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 19 15:03:20 2018 From: report at bugs.python.org (Zack Weinberg) Date: Thu, 19 Jul 2018 19:03:20 +0000 Subject: [New-bugs-announce] [issue34156] Nail down and document the behavior of range expressions in RE character classes Message-ID: <1532027000.32.0.56676864532.issue34156@psf.upfronthosting.co.za> New submission from Zack Weinberg : The documentation of the semantics of range expressions in regular expression character classes is not precise enough. All it says is Ranges of characters can be indicated by giving two characters and separating them by a '-', for example [a-z] will match any lowercase ASCII letter [... more examples, none involving non-ASCII characters] In testing it seems that the behavior is simply to expand the range to a set of characters by numeric code point, e.g. '[?-?]' will match any single character whose ord() is in between ord('?') and ord('?') (inclusive). If that is the intended behavior, I would like the documentation to explicitly say so. If that is _not_ the intended behavior, I would like to know what the intended behavior actually is, and for both the code and the documentation to be changed to reflect the intent. (I think expansion by numeric code point makes sense and is probably what most existing programs want, but this is a contended issue in the context of POSIX regular expressions, e.g. some C libraries try (not always successfully) to make [0-9] match all of the characters that Python's \d matches, so it's not "obvious".) ---------- assignee: docs at python components: Documentation, Regular Expressions messages: 321963 nosy: docs at python, ezio.melotti, mrabarnett, zwol priority: normal severity: normal status: open title: Nail down and document the behavior of range expressions in RE character classes type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 19 15:29:32 2018 From: report at bugs.python.org (Jakub Wilk) Date: Thu, 19 Jul 2018 19:29:32 +0000 Subject: [New-bugs-announce] [issue34157] NamedTemporaryFile can leave temporary files behind Message-ID: <1532028572.02.0.56676864532.issue34157@psf.upfronthosting.co.za> New submission from Jakub Wilk : If you press Ctrl+C at the wrong moment, NamedTemporaryFile won't delete the temporary file. To reproduce, you can try this script: import tempfile while True: with tempfile.NamedTemporaryFile(dir='.'): pass I get a stray temporary file when I press Ctrl+C about 40% of the time. ---------- components: Library (Lib) messages: 321965 nosy: jwilk priority: normal severity: normal status: open title: NamedTemporaryFile can leave temporary files behind type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 19 17:34:47 2018 From: report at bugs.python.org (Christophe Nanteuil) Date: Thu, 19 Jul 2018 21:34:47 +0000 Subject: [New-bugs-announce] [issue34158] Documentation of datetime '%z' format code is odd Message-ID: <1532036087.85.0.56676864532.issue34158@psf.upfronthosting.co.za> New submission from Christophe Nanteuil : In ? 8.1.8. "strftime() and strptime() Behavior", the documentation states that "%z" format code is a string of the form '?HHMM[SS[.uuuuuu]]' where uuuuuu is a 2-digit string giving the number of UTC offset microseconds. I think it's a 6-digit string. ---------- assignee: docs at python components: Documentation files: datetime.rst.patch keywords: patch messages: 321968 nosy: Christophe Nanteuil, docs at python priority: normal severity: normal status: open title: Documentation of datetime '%z' format code is odd versions: Python 3.7 Added file: https://bugs.python.org/file47704/datetime.rst.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 19 18:19:35 2018 From: report at bugs.python.org (Sheng Zhong) Date: Thu, 19 Jul 2018 22:19:35 +0000 Subject: [New-bugs-announce] [issue34159] asyncio basic event loop stuck with no tasks scheduled or ready Message-ID: <1532038775.06.0.56676864532.issue34159@psf.upfronthosting.co.za> New submission from Sheng Zhong : An exception is raised and propagates up the call stack without being consumed until the asyncio/events.py:_run function. The exception seemingly doesn't get consumed according to my breakpoint (quite strange and a part of my confusion) but the task does get removed from the next loop cycle as expected. However, a subsequent call to the loop's _run_once() gets stuck forever on `event_list = self._selector.select(timeout)` with no tasks in its `_ready` or `_scheduled` queue. A snippet of the debug session is below https://i.imgur.com/YLcU8I6.png Shouldn't an event loop with no tasks left exit? ---------- components: asyncio messages: 321969 nosy: Sheng Zhong, asvetlov, yselivanov priority: normal severity: normal status: open title: asyncio basic event loop stuck with no tasks scheduled or ready type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 19 20:42:07 2018 From: report at bugs.python.org (Raymond Hettinger) Date: Fri, 20 Jul 2018 00:42:07 +0000 Subject: [New-bugs-announce] [issue34160] ElementTree not preserving attribute order Message-ID: <1532047327.92.0.56676864532.issue34160@psf.upfronthosting.co.za> New submission from Raymond Hettinger : Starting with Python3.6, the order of keyword arguments has been guaranteed. Something in ElementTree is not respecting that order. $ python3.7 Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from xml.etree.ElementTree import Element, dump >>> dump(Element('cirriculum', status='public', company='example')) >>> # ^-----------------^-------------------- These are swapped ---------- components: Library (Lib) messages: 321973 nosy: eli.bendersky, rhettinger, scoder priority: normal severity: normal status: open title: ElementTree not preserving attribute order type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 00:52:03 2018 From: report at bugs.python.org (Orlando) Date: Fri, 20 Jul 2018 04:52:03 +0000 Subject: [New-bugs-announce] [issue34161] Tutorial 7.1 str.format() code example syntax error Message-ID: <1532062323.28.0.56676864532.issue34161@psf.upfronthosting.co.za> New submission from Orlando : Tutorial 7.1 str.format() example (https://docs.python.org/3.7/tutorial/inputoutput.html#fancier-output-formatting): [1]yes_votes = 42_572_654 ; no_votes = 43_132_495 [2]percentage = (yes_votes/(yes_votes+no_votes) [3]'{:-9} YES votes {:2.2%}'.format(yes_votes, percentage)) Proposed Fix: Remove first open parens on line 2 and last close parens on line 3. ---------- assignee: docs at python components: Documentation messages: 321977 nosy: docs at python, oboff priority: normal severity: normal status: open title: Tutorial 7.1 str.format() code example syntax error versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 01:33:12 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Fri, 20 Jul 2018 05:33:12 +0000 Subject: [New-bugs-announce] [issue34162] idlelib/NEWS.txt for 3.8.0 (and backports) Message-ID: <1532064792.76.0.56676864532.issue34162@psf.upfronthosting.co.za> Change by Terry J. Reedy : ---------- assignee: terry.reedy components: IDLE nosy: terry.reedy priority: normal severity: normal stage: needs patch status: open title: idlelib/NEWS.txt for 3.8.0 (and backports) type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 01:45:22 2018 From: report at bugs.python.org (Janibasha) Date: Fri, 20 Jul 2018 05:45:22 +0000 Subject: [New-bugs-announce] [issue34163] Python latest release 2.7 shows SSL error Message-ID: <1532065522.97.0.56676864532.issue34163@psf.upfronthosting.co.za> New submission from Janibasha : I have downloaded & installed python latest 2.7 version (on date - 16th July). Initially i was unable to install even pip using cmd - python get-pip.py, somehow i managed to installed pip. Then i was unable to install any package using pip. It throws SSL error. Tried multiple ways to install but no go. No proxy or admin issues observed (admin confirmed the same). Then i uninstalled & reinstalled 2.7.10 which resolved the issue. Please check the attached screenshots and resolve it. ---------- assignee: christian.heimes components: SSL files: pip-error.JPG messages: 321981 nosy: Janibasha, christian.heimes priority: normal severity: normal status: open title: Python latest release 2.7 shows SSL error type: compile error versions: Python 2.7 Added file: https://bugs.python.org/file47705/pip-error.JPG _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 05:21:09 2018 From: report at bugs.python.org (Jussi Judin) Date: Fri, 20 Jul 2018 09:21:09 +0000 Subject: [New-bugs-announce] [issue34164] base64.b32decode() leads into UnboundLocalError on some data Message-ID: <1532078469.74.0.56676864532.issue34164@psf.upfronthosting.co.za> New submission from Jussi Judin : base64.b32decode() function leads into "UnboundLocalError: local variable 'acc' referenced before assignment" when passing 8 equality signs as data: >>> import base64 >>> base64.b32decode(b"========") Traceback (most recent call last): File "", line 1, in File "/tmp/python-3.7-bin/lib/python3.7/base64.py", line 235, in b32decode acc <<= 5 * padchars UnboundLocalError: local variable 'acc' referenced before assignment When passing a different number of equality signs, the documented binascii.Error exception is thrown. ---------- components: Library (Lib) messages: 321991 nosy: Barro priority: normal severity: normal status: open title: base64.b32decode() leads into UnboundLocalError on some data type: crash versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 05:53:48 2018 From: report at bugs.python.org (Jussi Judin) Date: Fri, 20 Jul 2018 09:53:48 +0000 Subject: [New-bugs-announce] [issue34165] uu.decode() raises binascii.Error instead of uu.Error on invalid data Message-ID: <1532080428.61.0.56676864532.issue34165@psf.upfronthosting.co.za> New submission from Jussi Judin : uu.decode() function can leak the internal binascii.Error exception from binascii.a2b_uu() function call instead of the documented uu.Error exception. Following code demonstrates the issue: >>> import uu >>> with open("in.uu", "wb") as fp: ... fp.write(b'begin 0 \n0\xe8') >>> uu.decode("in.uu", "out.uu") Traceback (most recent call last): File "/tmp/python-3.7-bin/lib/python3.7/uu.py", line 148, in decode data = binascii.a2b_uu(s) binascii.Error: Illegal char During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/tmp/python-3.7-bin/lib/python3.7/uu.py", line 152, in decode data = binascii.a2b_uu(s[:nbytes]) binascii.Error: Illegal char It looks like the the workaround for broken encoders that catches the first binascii.Error exception just lets the second one to propagate if the recovery fails. I would except uu.Error to be raised instead, as that is mentioned in the documentation. ---------- components: Library (Lib) messages: 321994 nosy: Barro priority: normal severity: normal status: open title: uu.decode() raises binascii.Error instead of uu.Error on invalid data versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 08:06:04 2018 From: report at bugs.python.org (Lele Gaifax) Date: Fri, 20 Jul 2018 12:06:04 +0000 Subject: [New-bugs-announce] [issue34166] Tools/msgfmt.py emits a DeprecationWarning under Python 3.7 Message-ID: <1532088364.94.0.56676864532.issue34166@psf.upfronthosting.co.za> New submission from Lele Gaifax : $ python3.7 msgfmt.py -o test.mo test.po msgfmt.py:199: DeprecationWarning: tostring() is deprecated. Use tobytes() instead. output = generate() ---------- components: Demos and Tools messages: 322001 nosy: lelit priority: normal severity: normal status: open title: Tools/msgfmt.py emits a DeprecationWarning under Python 3.7 versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 08:35:12 2018 From: report at bugs.python.org (Eric Janson) Date: Fri, 20 Jul 2018 12:35:12 +0000 Subject: [New-bugs-announce] [issue34167] Standard library docs: prev/next skip right over 16.11 Message-ID: <1532090112.81.0.56676864532.issue34167@psf.upfronthosting.co.za> New submission from Eric Janson : Hitting next from 16.10 in standard library online docs jumps to 16.12. Previous goes from 16.12 back to 16.10. Curses.Textpad(16.11) must be random-accessed. ---------- assignee: docs at python components: Documentation messages: 322002 nosy: Eric Janson, docs at python priority: normal severity: normal status: open title: Standard library docs: prev/next skip right over 16.11 type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 08:53:50 2018 From: report at bugs.python.org (Dem) Date: Fri, 20 Jul 2018 12:53:50 +0000 Subject: [New-bugs-announce] [issue34168] RAM consumption too high using concurrent.futures (Python 3.7 / 3.6 ) Message-ID: <1532091230.61.0.56676864532.issue34168@psf.upfronthosting.co.za> New submission from Dem : I have a list of 30 million strings, and I want to run a dns query to all of them. I do not understand how this operation can get memory intensive. I would assume that the threads would exit after the job is done, and there is also a timeout of 1 minute as well ({'dns_request_timeout': 1}). Here is a sneak peek of the machine's resources while running the script: [![enter image description here][1]][1] My code is as follows: # -*- coding: utf-8 -*- import dns.resolver import concurrent.futures from pprint import pprint from json import json bucket = json.load(open('30_million_strings.json','r')) def _dns_query(target, **kwargs): global bucket resolv = dns.resolver.Resolver() resolv.timeout = kwargs['function']['dns_request_timeout'] try: resolv.query(target + '.com', kwargs['function']['query_type']) with open('out.txt', 'a') as f: f.write(target + '\n') except Exception: pass def run(**kwargs): global bucket temp_locals = locals() pprint({k: v for k, v in temp_locals.items()}) with concurrent.futures.ThreadPoolExecutor(max_workers=kwargs['concurrency']['threads']) as executor: future_to_element = dict() for element in bucket: future = executor.submit(kwargs['function']['name'], element, **kwargs) future_to_element[future] = element for future in concurrent.futures.as_completed(future_to_element): result = future_to_element[future] run(function={'name': _dns_query, 'dns_request_timeout': 1, 'query_type': 'MX'}, concurrency={'threads': 15}) [1]: https://i.stack.imgur.com/686SW.png ---------- components: Library (Lib) messages: 322004 nosy: DemGiran priority: normal severity: normal status: open title: RAM consumption too high using concurrent.futures (Python 3.7 / 3.6 ) versions: Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 10:11:03 2018 From: report at bugs.python.org (Clint Hepner) Date: Fri, 20 Jul 2018 14:11:03 +0000 Subject: [New-bugs-announce] [issue34169] itertools.repeat does not accept None as an explicit count Message-ID: <1532095863.33.0.56676864532.issue34169@psf.upfronthosting.co.za> New submission from Clint Hepner : I expected to be able to pass None as an explicit count to itertools.repeat to get the default behavior of an infinite iterator: >>> list(islice(repeat(1), 10)) [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] >>> list(islice(repeat(1, None), 10)) Traceback (most recent call last): File "", line 1 in TypeError: 'NoneType' object cannot be interpreted as an integer ---------- components: Library (Lib) messages: 322010 nosy: chepner priority: normal severity: normal status: open title: itertools.repeat does not accept None as an explicit count versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 11:22:57 2018 From: report at bugs.python.org (STINNER Victor) Date: Fri, 20 Jul 2018 15:22:57 +0000 Subject: [New-bugs-announce] [issue34170] Py_Initialize(): computing path configuration must not have side effect (PEP 432) Message-ID: <1532100177.89.0.56676864532.issue34170@psf.upfronthosting.co.za> New submission from STINNER Victor : Attached ---------- components: Interpreter Core messages: 322014 nosy: vstinner priority: normal severity: normal status: open title: Py_Initialize(): computing path configuration must not have side effect (PEP 432) versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 12:08:57 2018 From: report at bugs.python.org (Matthias Klose) Date: Fri, 20 Jul 2018 16:08:57 +0000 Subject: [New-bugs-announce] [issue34171] Lib/trace.cover not removed by the clean target Message-ID: <1532102937.62.0.56676864532.issue34171@psf.upfronthosting.co.za> New submission from Matthias Klose : Lib/trace.cover is not removed by the clean target, and apparently this file is always created in the source tree, not in the build tree. It should be created in the build tree, if that's not possible, it should be cleaned in any case. ---------- components: Build messages: 322026 nosy: doko priority: normal severity: normal status: open title: Lib/trace.cover not removed by the clean target versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 12:45:29 2018 From: report at bugs.python.org (tzickel) Date: Fri, 20 Jul 2018 16:45:29 +0000 Subject: [New-bugs-announce] [issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted Message-ID: <1532105129.76.0.56676864532.issue34172@psf.upfronthosting.co.za> New submission from tzickel : In multiprocessing.Pool documentation it's written "When the pool object is garbage collected terminate() will be called immediately.": https://docs.python.org/3.7/library/multiprocessing.html#multiprocessing.pool.Pool.terminate A. This does not happen, creating a Pool, deleting it and collecting the garbage, does not call terminate. B. The documentation for Pool itself does not specify it has a context manager (but the examples show it). C. This bug is both in Python 3 & 2. ---------- components: Library (Lib) messages: 322028 nosy: tzickel priority: normal severity: normal status: open title: multiprocessing.Pool and ThreadPool leak resources after being deleted type: behavior versions: Python 2.7, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 15:31:47 2018 From: report at bugs.python.org (Corey Bryant) Date: Fri, 20 Jul 2018 19:31:47 +0000 Subject: [New-bugs-announce] [issue34173] [3.7] possible race condition in /usr/lib/python3.7/concurrent/futures/thread.py Message-ID: <1532115107.08.0.56676864532.issue34173@psf.upfronthosting.co.za> New submission from Corey Bryant : I initially reported this on launchpad at https://bugs.launchpad.net/bugs/1782647. I'm running a test for a project that hangs and requires a Control-C to cancel it. The results look like this: https://paste.ubuntu.com/p/SwXsCcghjt/ In narrowing down on this some more, the use of queue.SimpleQueue() seems to make the difference that causes the hang. If I switch that back to queue.Queue() (which was the case for py3.6) the hang goes away: - self._work_queue = queue.Queue() + self._work_queue = queue.SimpleQueue() To reproduce with OpenStack designate: git clone https://github.com/openstack/designate. Then, update tox.ini with the following: --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.0 -envlist = py35,py27,flake8 +envlist = py35,py37,py27,flake8 skipsdist = True [testenv] @@ -39,6 +39,12 @@ commands = {[testenv]commands} stestr run '{posargs}' +[testenv:py37] +basepython = python3.7 +commands = + {[testenv]commands} + stestr run 'designate\.tests\.test_workers\.test_processing\.TestProcessingExecutor\.(test_execute_multiple_tasks)' + [testenv:docs] basepython = python3 deps = And run: tox -e py37 ---------- components: Library (Lib) messages: 322032 nosy: corey.bryant priority: normal severity: normal status: open title: [3.7] possible race condition in /usr/lib/python3.7/concurrent/futures/thread.py type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 16:34:50 2018 From: report at bugs.python.org (Chris Kessler) Date: Fri, 20 Jul 2018 20:34:50 +0000 Subject: [New-bugs-announce] [issue34174] argparse formatter_class issue for RawDescriptionHelpFormatter Message-ID: <1532118890.75.0.56676864532.issue34174@psf.upfronthosting.co.za> New submission from Chris Kessler : In document https://docs.python.org/2/library/argparse.html#argparse.RawDescriptionHelpFormatter this will fail with NameError: global name 'textwrap' is not defiend >>> parser = argparse.ArgumentParser( ... prog='PROG', ... formatter_class=argparse.RawDescriptionHelpFormatter, ... description=textwrap.dedent('''\ ... Please do not mess up this text! ... -------------------------------- ... I have indented it ... exactly the way ... I want it ... ''')) ---------- assignee: docs at python components: Documentation messages: 322034 nosy: ckessler, docs at python priority: normal severity: normal status: open title: argparse formatter_class issue for RawDescriptionHelpFormatter type: resource usage versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 17:08:00 2018 From: report at bugs.python.org (Keith Campbell) Date: Fri, 20 Jul 2018 21:08:00 +0000 Subject: [New-bugs-announce] [issue34175] typing.NamedTuple: type-checking error when "index" used as member Message-ID: <1532120880.21.0.56676864532.issue34175@psf.upfronthosting.co.za> New submission from Keith Campbell : Find the test case below: ---- from typing import NamedTuple class Foo(NamedTuple): alpha: int index: int ---- This results in the following error when run through type-checking with mypy: ---- % mypy --version mypy 0.620 % mypy go.py go.py:5: error: Incompatible types in assignment (expression has type "int", base class "tuple" defined the type as "Callable[[Tuple[int, ...], Any, int, int], int]") ---- When I instantiate this class in the python interpreter, I have no problem accessing the "index" member, so I suspect this is a bug in the type checker. ---------- components: Library (Lib) messages: 322038 nosy: campkeith priority: normal severity: normal status: open title: typing.NamedTuple: type-checking error when "index" used as member versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 20 20:30:19 2018 From: report at bugs.python.org (Jim DeLaHunt) Date: Sat, 21 Jul 2018 00:30:19 +0000 Subject: [New-bugs-announce] [issue34176] Asyncio StreamReader fails to close Transport Message-ID: <1532133019.54.0.56676864532.issue34176@psf.upfronthosting.co.za> New submission from Jim DeLaHunt : Asyncio's StreamReaderProtocol[1] often returns True from Protocol.eof_received(). This tells the Transport that "closing the transport is up to the protocol" [2]. However, StreamReaderProtocol does not call Transport.close(). More precisely, StreamReaderProtocol leaves the transport interaction to StreamReader. It calls StreamReader.feed_eof()[3]. But StreamReader does not call self._transport.close(). It only sets a self._eof flag, and awakens any of its functions which were waiting for data. The only occurrence of self._transport.close() occurs in StreamWriter[4]. There is none in StreamReader or StreamReaderProtocol. I believe that the fix should be for StreamReader to call self._transport.close(). However, it may need to avoid this if StreamReaderProtocol._over_ssl is True, and I don't immediately see how it can tell this. Also, it may need to wait for anything waiting for self._waiter to run, before closing the Transport. Or, maybe StreamReaderProtocol should not return True from Protocol.eof_received(). I discovered this when using a Transport of my own devising, which reads from a file instead of from a socket, with asyncio.streams. The file did not close in the unit test. My transport duly called Protocol.eof_received(), but received a True in response, so did not close the file. My workaround will probably be to not believe what Protocol.eof_received() tells me, and to close my transport regardless. [1] Lib/asyncio.streams.StreamReaderProtocol.eof_received, line 259-266. [2] 19.5.4.2.3. "Streaming protocols" [3] Lib/Lib/asyncio.streams.StreamReader.feed_eof, lines 419-421. [4] Lib/Lib/asyncio.streams.StreamWriter.close, lines 316-317. All line numbers are as of tag v3.7.0, commit 1bf9cc509326bc42cd8cb1650eb9bf64550d817e . Bug observed in v3.7.0. Not yet investigated in HEAD revision. ---------- components: asyncio messages: 322047 nosy: JDLH, asvetlov, yselivanov priority: normal severity: normal status: open title: Asyncio StreamReader fails to close Transport type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 03:32:04 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Sat, 21 Jul 2018 07:32:04 +0000 Subject: [New-bugs-announce] [issue34177] test_site fails in macOS-PR VSTS builds for 3.7 branch Message-ID: <1532158324.8.0.56676864532.issue34177@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : Mac OS builds fail due to test_site in VSTS for 3.7 branches only Ref : https://python.visualstudio.com/cpython/_build/results?buildId=17921&view=logs 2018-07-21T07:01:08.5912930Z Traceback (most recent call last): 2018-07-21T07:01:08.5927520Z File "/Users/vsts/agent/2.136.1/work/1/s/Lib/test/test_site.py", line 199, in test_s_option 2018-07-21T07:01:08.5942120Z self.assertIn(usersite, sys.path) 2018-07-21T07:01:08.5959870Z AssertionError: '/Users/vsts/.local/lib/python3.7/site-packages' not found in ['/Users/vsts/agent/2.136.1/work/1/s', '/usr/local/lib/python37.zip', '/Users/vsts/agent/2.136.1/work/1/s/Lib', '/Users/vsts/agent/2.136.1/work/1/s/build/lib.macosx-10.13-x86_64-3.7-pydebug', '/usr/local/lib/python3.7/site-packages'] 2018-07-21T07:01:08.5971110Z 2018-07-21T07:01:08.5985860Z ====================================================================== 2018-07-21T07:01:08.6000880Z FAIL: test_startup_imports (test.test_site.StartupImportTests) 2018-07-21T07:01:08.6017050Z ---------------------------------------------------------------------- 2018-07-21T07:01:08.6033630Z Traceback (most recent call last): 2018-07-21T07:01:08.6048270Z File "/Users/vsts/agent/2.136.1/work/1/s/Lib/test/test_site.py", line 487, in test_startup_imports 2018-07-21T07:01:08.6063180Z self.assertFalse(modules.intersection(collection_mods), stderr) 2018-07-21T07:01:08.6079990Z AssertionError: {'reprlib', 'heapq', 'collections', 'keyword', 'operator', 'functools', 'types'} is not false : import _frozen_importlib # frozen I couldn't find any related issues in search and hence opened this. Feel free to close this if it's a duplicate or fixed in some other branch. Thanks ---------- messages: 322082 nosy: xtreak priority: normal severity: normal status: open title: test_site fails in macOS-PR VSTS builds for 3.7 branch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 04:24:55 2018 From: report at bugs.python.org (Matthias Klose) Date: Sat, 21 Jul 2018 08:24:55 +0000 Subject: [New-bugs-announce] [issue34178] test_tcl fails on the 3.7 branch Message-ID: <1532161495.01.0.56676864532.issue34178@psf.upfronthosting.co.za> New submission from Matthias Klose : test_tcl fails at least on the 3.7 branch with: ====================================================================== FAIL: test_join (test.test_tcl.TclTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.7/test/test_tcl.py", line 670, in test_join check('{spam}') File "/usr/lib/python3.7/test/test_tcl.py", line 660, in check self.assertEqual(unpack(unpack(join([[value]]))), value) AssertionError: 'spam' != '{spam}' - spam + {spam} ? + + ---------- components: Tkinter messages: 322086 nosy: doko priority: normal severity: normal status: open title: test_tcl fails on the 3.7 branch versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 09:17:44 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 21 Jul 2018 13:17:44 +0000 Subject: [New-bugs-announce] [issue34179] test_statistics fails after test_time Message-ID: <1532179064.99.0.56676864532.issue34179@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : $ ./python -m test -v test_time test_statistics ... ====================================================================== FAIL: test_decimals_exact (test.test_statistics.TestHarmonicMean) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/test/test_statistics.py", line 1484, in test_decimals_exact self.assertEqual(self.func(data), D(66528)/70723) AssertionError: Decimal('0.9406840773157247288717955969') != Decimal('0.9406840773157247288717955970') ====================================================================== FAIL: test_repeated_single_value (test.test_statistics.TestHarmonicMean) (x=Decimal('4.125'), count=2) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/test/test_statistics.py", line 1332, in test_repeated_single_value self.assertEqual(self.func(data), x) AssertionError: Decimal('4.124999999999999999999999999') != Decimal('4.125') ====================================================================== FAIL: test_repeated_single_value (test.test_statistics.TestHarmonicMean) (x=Decimal('4.125'), count=5) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/test/test_statistics.py", line 1332, in test_repeated_single_value self.assertEqual(self.func(data), x) AssertionError: Decimal('4.124999999999999999999999999') != Decimal('4.125') ====================================================================== FAIL: test_repeated_single_value (test.test_statistics.TestHarmonicMean) (x=Decimal('4.125'), count=10) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/test/test_statistics.py", line 1332, in test_repeated_single_value self.assertEqual(self.func(data), x) AssertionError: Decimal('4.124999999999999999999999999') != Decimal('4.125') ====================================================================== FAIL: test_repeated_single_value (test.test_statistics.TestHarmonicMean) (x=Decimal('4.125'), count=20) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/serhiy/py/cpython/Lib/test/test_statistics.py", line 1332, in test_repeated_single_value self.assertEqual(self.func(data), x) AssertionError: Decimal('4.124999999999999999999999999') != Decimal('4.125') ---------------------------------------------------------------------- ---------- components: Tests messages: 322098 nosy: serhiy.storchaka priority: normal severity: normal status: open title: test_statistics fails after test_time type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 11:53:57 2018 From: report at bugs.python.org (Victor Porton) Date: Sat, 21 Jul 2018 15:53:57 +0000 Subject: [New-bugs-announce] [issue34180] bool(Q) always return True for a priority queue Q Message-ID: <1532188437.33.0.56676864532.issue34180@psf.upfronthosting.co.za> New submission from Victor Porton : It seems that bool(Q) always return True for a priority queue Q. It should behave the same way as for bool(L) where L is a list, that is return False on an empty queue. Please check also other objects in https://docs.python.org/3/library/queue.html After the bug is fixed, the documentation should be clear that there was a change in the behavior in certain Python version. ---------- components: Library (Lib) messages: 322103 nosy: porton priority: normal severity: normal status: open title: bool(Q) always return True for a priority queue Q type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 13:23:21 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 21 Jul 2018 17:23:21 +0000 Subject: [New-bugs-announce] [issue34181] Lib/test/test_typing.py failed when ran as a script Message-ID: <1532193801.1.0.56676864532.issue34181@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : $ ./python Lib/test/test_typing.py ... ====================================================================== FAIL: test_repr (__main__.GenericTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_typing.py", line 654, in test_repr "") AssertionError: "" != "" - ? ^^^ ^^ + ? +++++++++ ^^^ ^ ---------------------------------------------------------------------- ---------- assignee: serhiy.storchaka components: Tests messages: 322109 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Lib/test/test_typing.py failed when ran as a script type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 13:32:53 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 21 Jul 2018 17:32:53 +0000 Subject: [New-bugs-announce] [issue34182] Lib/test/test_pydoc.py failed when ran as a script Message-ID: <1532194373.75.0.56676864532.issue34182@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : $ ./python Lib/test/test_pydoc.py ... ====================================================================== ERROR: test_mixed_case_module_names_are_lower_cased (__main__.PydocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_pydoc.py", line 460, in test_mixed_case_module_names_are_lower_cased self.assertIn('xml.etree.elementtree', doc_link) File "/home/serhiy/py/cpython/Lib/unittest/case.py", line 1103, in assertIn if member not in container: TypeError: argument of type 'NoneType' is not iterable ---------------------------------------------------------------------- Since it works in 3.6, seems the regression was introduced in issue32031. ---------- components: Tests messages: 322111 nosy: serhiy.storchaka, xdegaye priority: normal severity: normal status: open title: Lib/test/test_pydoc.py failed when ran as a script type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 13:40:37 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 21 Jul 2018 17:40:37 +0000 Subject: [New-bugs-announce] [issue34183] Lib/test/test_contextlib_async.py failed when run as a script Message-ID: <1532194837.43.0.56676864532.issue34183@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : $ ./python Lib/test/test_contextlib_async.py Lib/test/test_contextlib_async.py:7: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ from .test_contextlib import TestBaseExitStack Traceback (most recent call last): File "Lib/test/test_contextlib_async.py", line 7, in from .test_contextlib import TestBaseExitStack ModuleNotFoundError: No module named '__main__.test_contextlib'; '__main__' is not a package ---------- assignee: serhiy.storchaka components: Tests messages: 322112 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Lib/test/test_contextlib_async.py failed when run as a script type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 13:47:26 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 21 Jul 2018 17:47:26 +0000 Subject: [New-bugs-announce] [issue34184] Lib/test/test_dataclasses.py failed when ran as a script Message-ID: <1532195246.19.0.56676864532.issue34184@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : $ ./python Lib/test/test_dataclasses.py ... ====================================================================== ERROR: test_classvar_module_level_import (__main__.TestStringAnnotations) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_dataclasses.py", line 2716, in test_classvar_module_level_import from . import dataclass_module_1 ImportError: cannot import name 'dataclass_module_1' from '__main__' (Lib/test/test_dataclasses.py) ====================================================================== FAIL: test_no_repr (__main__.TestRepr) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_dataclasses.py", line 1970, in test_no_repr repr(C(3))) AssertionError: 'test_dataclasses.TestRepr.test_no_repr..C object at' not found in '<__main__.TestRepr.test_no_repr..C object at 0x7f11745df2c8>' ---------------------------------------------------------------------- ---------- assignee: serhiy.storchaka components: Tests messages: 322113 nosy: eric.smith, serhiy.storchaka priority: normal severity: normal status: open title: Lib/test/test_dataclasses.py failed when ran as a script type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 14:02:02 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sat, 21 Jul 2018 18:02:02 +0000 Subject: [New-bugs-announce] [issue34185] Lib/test/test_bdb.py failed when ran as a script Message-ID: <1532196122.3.0.56676864532.issue34185@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : $ ./python Lib/test/test_bdb.py ... ====================================================================== FAIL: test_skip (__main__.StateTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 731, in test_skip tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 448, in __exit__ self.test_case.fail(err_msg) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: Wrong event type at expect_set item 2, got 'call' Expected: ('line', 3, 'tfunc_import') Got: ('call', 84, '_id'), ('quit',), ====================================================================== FAIL: test_runeval_step (__main__.RunTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 976, in test_runeval_step tracer.runeval('test_module.main()', globals(), locals()) File "Lib/test/test_bdb.py", line 448, in __exit__ self.test_case.fail(err_msg) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: Wrong event type at expect_set item 2, got 'exception' Expected: ('call', 2, 'main') Got: ('exception', 1, '', AttributeError), ('step',), All paired tuples have not been processed, the last one was number 2 ====================================================================== FAIL: test_bp_condition (__main__.BreakpointTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 843, in test_bp_condition tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_bp_exception_on_condition_evaluation (__main__.BreakpointTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 862, in test_bp_exception_on_condition_evaluation tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_bp_ignore_count (__main__.BreakpointTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 883, in test_bp_ignore_count tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_clear_two_bp_on_same_line (__main__.BreakpointTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 935, in test_clear_two_bp_on_same_line tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 4 ====================================================================== FAIL: test_disabled_temporary_bp (__main__.BreakpointTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 823, in test_disabled_temporary_bp tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_ignore_count_on_disabled_bp (__main__.BreakpointTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 910, in test_ignore_count_on_disabled_bp tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_temporary_bp (__main__.BreakpointTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 795, in test_temporary_bp tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_next_command_in_generator_for_loop (__main__.IssuesTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 1081, in test_next_command_in_generator_for_loop tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_next_command_in_generator_with_subiterator (__main__.IssuesTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 1112, in test_next_command_in_generator_with_subiterator tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_next_until_return_in_generator (__main__.IssuesTestCase) (set_type='next') ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 1050, in test_next_until_return_in_generator tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_next_until_return_in_generator (__main__.IssuesTestCase) (set_type='until') ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 1050, in test_next_until_return_in_generator tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_next_until_return_in_generator (__main__.IssuesTestCase) (set_type='return') ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 1050, in test_next_until_return_in_generator tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_return_command_in_generator_with_subiterator (__main__.IssuesTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 1143, in test_return_command_in_generator_with_subiterator tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 1 ====================================================================== FAIL: test_step_at_return_with_no_trace_in_caller (__main__.IssuesTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bdb.py", line 1009, in test_step_at_return_with_no_trace_in_caller tracer.runcall(tfunc_import) File "Lib/test/test_bdb.py", line 456, in __exit__ self.test_case.fail(not_empty) File "Lib/test/test_bdb.py", line 582, in fail raise self.failureException(msg) from None AssertionError: All paired tuples have not been processed, the last one was number 2 ---------------------------------------------------------------------- ---------- components: Tests messages: 322116 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Lib/test/test_bdb.py failed when ran as a script type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 21 22:36:57 2018 From: report at bugs.python.org (Todd) Date: Sun, 22 Jul 2018 02:36:57 +0000 Subject: [New-bugs-announce] [issue34186] [3.6.6 on macOS] os.listdir replacing "/" with ":" Message-ID: <1532227017.3.0.56676864532.issue34186@psf.upfronthosting.co.za> New submission from Todd : Short back story - I am organizing music where "/" appears in a lot a metadata for the songs. For instance, the artist "AC/DC" or "ACDC w/ Axl Rose". On macOS, it is acceptable to name a folder "AC/DC" while the slash would cause an issue in Windows. Issue - While using os.listdir to list a number of artist folders inside my iTunes music folder os.listdir replaced "/" with ":" IF the "/" appears in the name itself. It does not replace the slash delimiters. I have included a screen shot. On the right side of the image is an example directory I made with a few folders. Two of the folders have "/" in their names. On the left side of the image is the Python shell showing the use of os.listdir along with the output. You'll notice that the listed directories don't include "/", but instead include ":". ---------- components: macOS files: Screen Shot 2018-07-21 at 9.29.59 PM.png messages: 322128 nosy: coleman45.1 at hotmail.com, ned.deily, ronaldoussoren priority: normal severity: normal status: open title: [3.6.6 on macOS] os.listdir replacing "/" with ":" type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47708/Screen Shot 2018-07-21 at 9.29.59 PM.png _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 22 05:05:49 2018 From: report at bugs.python.org (Eryk Sun) Date: Sun, 22 Jul 2018 09:05:49 +0000 Subject: [New-bugs-announce] [issue34187] Issues with lazy fd support in _WindowsConsoleIO fileno() and close() Message-ID: <1532250349.34.0.56676864532.issue34187@psf.upfronthosting.co.za> New submission from Eryk Sun : The _WindowsConsoleIO implementation of fileno should raise a ValueError if the internal handle value is INVALID_HANDLE_VALUE. Currently it raises io.UnsupportedOperation, and only if closefd=True. >>> f = open('conin$', 'r') >>> f.close() >>> f.fileno() Traceback (most recent call last): File "", line 1, in io.UnsupportedOperation: Console buffer does not support fileno >>> f = open(0, 'r', closefd=False) >>> f.close() >>> f.fileno() 0 Also, if lazily opening an fd fails when opening by name (con, conin$, conout$), it should also close the file handle to maintain a consistent state. This can be fixed as follows: error out immediately and call err_closed instead of err_mode; and close the handle if _open_osfhandle fails (i.e. fd == -1) and closehandle is set: static PyObject * _io__WindowsConsoleIO_fileno_impl(winconsoleio *self) { if (self->handle == INVALID_HANDLE_VALUE) { return err_closed(); } if (self->fd < 0) { _Py_BEGIN_SUPPRESS_IPH if (self->writable) { self->fd = _open_osfhandle((intptr_t)self->handle, _O_WRONLY | _O_BINARY); } else { self->fd = _open_osfhandle((intptr_t)self->handle, _O_RDONLY | _O_BINARY); } _Py_END_SUPPRESS_IPH } if (self->fd < 0) { if (self->closehandle) { CloseHandle(self->handle); } self->handle = INVALID_HANDLE_VALUE; return err_closed(); } return PyLong_FromLong(self->fd); } On a related note, there's a bug in internal_close that could potentially be a race condition that closes a handle to an unrelated object. If an fd has been opened, the CRT takes control of the handle. Calling close() will also close the underlying handle. In this case CloseHandle should not be called. This just needs a minor fix to add an `else` clause: static int internal_close(winconsoleio *self) { if (self->handle != INVALID_HANDLE_VALUE) { if (self->closehandle) { if (self->fd >= 0) { _Py_BEGIN_SUPPRESS_IPH close(self->fd); _Py_END_SUPPRESS_IPH } else { CloseHandle(self->handle); } } self->handle = INVALID_HANDLE_VALUE; self->fd = -1; } return 0; } ---------- components: IO, Windows keywords: easy (C) messages: 322138 nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: Issues with lazy fd support in _WindowsConsoleIO fileno() and close() type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 22 08:53:50 2018 From: report at bugs.python.org (Victor Porton) Date: Sun, 22 Jul 2018 12:53:50 +0000 Subject: [New-bugs-announce] [issue34188] Use dicts to "transform" argparse arguments to values Message-ID: <1532264030.24.0.56676864532.issue34188@psf.upfronthosting.co.za> New submission from Victor Porton : The below code produces "rock", but it should produce "a". This (to use dict value instead of the key by argparse result) is both to be a new useful feature (for example to map strings in a command line to certain functions or classes provided as dict values) and conform to intuition better. My feature proposal breaks backward compatibility, but I think no reasonable programmer wrote it in such a way that he relied on the current behavior for `dict` values for `choices`. import argparse parser = argparse.ArgumentParser(prog='game.py') parser.add_argument('move', choices={'rock':'a', 'paper':'b', 'scissors':'c'}) print(parser.parse_args(['rock'])) ---------- components: Library (Lib) messages: 322142 nosy: porton priority: normal severity: normal status: open title: Use dicts to "transform" argparse arguments to values versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 22 12:07:53 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 22 Jul 2018 16:07:53 +0000 Subject: [New-bugs-announce] [issue34189] Add simple tests for new Tk widget options Message-ID: <1532275673.86.0.56676864532.issue34189@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The following PR adds simple tests for Tk widget options added in Tk 8.6.5. TIP 441: Add -justify Configuration Option to the listbox Widget https://core.tcl.tk/tips/doc/trunk/tip/441.md TIP 437: Tk panedwindow options for proxy window https://core.tcl.tk/tips/doc/trunk/tip/437.md ---------- assignee: serhiy.storchaka components: Tests, Tkinter messages: 322149 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Add simple tests for new Tk widget options type: enhancement versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 22 15:22:01 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Sun, 22 Jul 2018 19:22:01 +0000 Subject: [New-bugs-announce] [issue34190] x86 Gentoo Refleaks 3.x: test_sys_setprofile leaked [1, 1, 1] references, sum=3 Message-ID: <1532287321.5.0.56676864532.issue34190@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : The x86 Gentoo Refleaks 3.x report that test_sys_setprofile is potentially leaking referenecs: https://buildbot.python.org/all/#/builders/1/builds/292 ---------------------------------------------------------------------- Ran 21 tests in 0.007s OK . test_sys_setprofile leaked [1, 1, 1] references, sum=3 1 test failed again: test_sys_setprofile == Tests result: FAILURE then FAILURE == 408 tests OK. 10 slowest tests: - test_asyncio: 28 min 19 sec - test_concurrent_futures: 23 min 10 sec - test_multiprocessing_spawn: 22 min 1 sec - test_multiprocessing_forkserver: 11 min 24 sec - test_multiprocessing_fork: 8 min 35 sec - test_lib2to3: 6 min 39 sec - test_zipfile: 6 min 21 sec - test_decimal: 6 min 18 sec - test_io: 5 min 44 sec - test_gdb: 5 min 39 sec 1 test failed: test_sys_setprofile 8 tests skipped: test_devpoll test_kqueue test_msilib test_startfile test_winconsoleio test_winreg test_winsound test_zipfile64 1 re-run test: test_sys_setprofile Total duration: 2 hour 10 min Tests result: FAILURE then FAILURE ---------- components: Tests messages: 322162 nosy: pablogsal priority: normal severity: normal status: open title: x86 Gentoo Refleaks 3.x: test_sys_setprofile leaked [1, 1, 1] references, sum=3 type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 22 15:58:30 2018 From: report at bugs.python.org (Victor Porton) Date: Sun, 22 Jul 2018 19:58:30 +0000 Subject: [New-bugs-announce] [issue34191] argparse: Missing subparser error message should be more clear Message-ID: <1532289510.54.0.56676864532.issue34191@psf.upfronthosting.co.za> New submission from Victor Porton : argparse produces a long unreadable, non-understandable for non-programmers error message when a subparser is not specified in the command line. Note that the below message contains Ubuntu specifics, but it seems it would be nearly as unclear on other OSes too. The worst thing about this error message is that to produce something readable instead I need to somehow parse the command string (or at least to catch TypeError). $ python3.7 test.py Traceback (most recent call last): File "test.py", line 10, in args = parser.parse_args() File "/usr/lib/python3.7/argparse.py", line 1754, in parse_args args, argv = self.parse_known_args(args, namespace) File "/usr/lib/python3.7/argparse.py", line 1786, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/usr/lib/python3.7/argparse.py", line 2021, in _parse_known_args ', '.join(required_actions)) TypeError: sequence item 0: expected str instance, NoneType found Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in from apport.packaging_impl import impl as packaging File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in import apt File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' Original exception was: Traceback (most recent call last): File "test.py", line 10, in args = parser.parse_args() File "/usr/lib/python3.7/argparse.py", line 1754, in parse_args args, argv = self.parse_known_args(args, namespace) File "/usr/lib/python3.7/argparse.py", line 1786, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/usr/lib/python3.7/argparse.py", line 2021, in _parse_known_args ', '.join(required_actions)) TypeError: sequence item 0: expected str instance, NoneType found The script follows. #!/usr/bin/env python import argparse parser = argparse.ArgumentParser(description="Automatically process XML") subparsers = parser.add_subparsers(title='subcommands') chain_parser = subparsers.add_parser('chain', aliases=['c'], help='Automatically run a chain of transformations') args = parser.parse_args() ---------- components: Library (Lib) messages: 322164 nosy: porton priority: normal severity: normal status: open title: argparse: Missing subparser error message should be more clear type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 22 23:57:25 2018 From: report at bugs.python.org (Dan Snider) Date: Mon, 23 Jul 2018 03:57:25 +0000 Subject: [New-bugs-announce] [issue34192] FunctionType.__new__ can generate functions that immediately crash Message-ID: <1532318245.8.0.56676864532.issue34192@psf.upfronthosting.co.za> New submission from Dan Snider : The following program crashes on 3.3.1, 3.4.2, 3.5.2, and 3.6.1 because despite having a non-empty co_cellvars slot due to the generator object, the NOFREE flag was set. 3.7 isn't immune to some bad behavior here, either. While I only have access to 3.7.03b right now, I noted the assertion at the bottom failing because it appears CodeType.__new__ is silently stripping the NOFREE flag out, which is why it's highlighted as well. Since the interpreter doesn't actually use FunctionType.__new__ it shouldn't hurt performance too much to add a check for when NOFREE is set that co_cellvars and co_freevars are indeed empty. Anyway, the code: from functools import reduce from itertools import repeat from operator import or_ from types import FunctionType, CodeType OPTIMIZED, NEWLOCALS, NOFREE = 1, 2, 64 FLAGS = [OPTIMIZED, NEWLOCALS, NOFREE] fields=('argcount kwonlyargcount nlocals stacksize flags code consts ' 'names varnames filename name firstlineno lnotab freevars cellvars').split() def edit_code(code, *args, **kws): """Construct a new code object using `code` as a template""" params = [] atrs = ('co_%s'%a for a in fields) kwds = map(kws.pop, fields, repeat(kws)) for arg, kwv, k in zip(args, kwds, atrs): if kwv is not kws: raise TypeError("edit_code() got multiple parameters for %r"%k) params.append(arg) for kwv, atr in zip(kwds, atrs): params.append(kwv if kwv is not kws else getattr(code, atr)) if kws: k, v = kws.popitem() raise TypeError("edit_code() got unexpected keyword argument %r"%k) return CodeType(*params) def get_co_flags(flags): if isinstance(flags, FunctionType): flags = flags.__code__.co_flags elif isinstance(flags, CodeType): flags = flags.co_flags return reduce(or_, (i for i in FLAGS if flags & i)) if __name__ == '__main__': co = get_co_flags.__code__ ns = get_co_flags.__globals__ flags = co.co_flags assert flags == OPTIMIZED|NEWLOCALS assert NOFREE == 64 a = FunctionType(edit_code(co, flags=flags), ns) b = FunctionType(edit_code(co, flags=flags|NOFREE), ns) # this assertion fails on 3.7.0b3 assert b.__code__.co_flags == OPTIMIZED|NEWLOCALS|NOFREE print('calling a...') a(get_co_flags) t = input("Blow up the universe? y/n : ") if t != 'n': b(get_co_flags) ---------- components: Interpreter Core messages: 322174 nosy: bup priority: normal severity: normal status: open title: FunctionType.__new__ can generate functions that immediately crash type: crash versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 01:54:16 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Mon, 23 Jul 2018 05:54:16 +0000 Subject: [New-bugs-announce] [issue34193] Fix pluralization in TypeError messages in getargs.c Message-ID: <1532325256.19.0.56676864532.issue34193@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : This ticket is to address comments by @terry.reedy on GitHub for PR https://github.com/python/cpython/pull/8395. Ref : https://github.com/python/cpython/pull/8395#issuecomment-406894241 Tests: In the 3 tests before this, the suffix 0, 2, or 3 is the number of arguments given. This would suggest 0a, 0b, 2a, and 3a for the suffixes here. I like 1min, 2min, 1max, and 2max even better. You can wait a bit for other reviews before changing. Blurb: Let us be more specific. For the patch as is, Fix pluralization of 'argument' in TypeError message with 'expected at least/most 1 argument', instead of '1 arguments'. But if we add all the remaining fixes needed in this file (see below), we could write. Fix pluralization in TypeError messages in getargs.c: '1 argument' instead of '1 arguments' and '1 element' instead of '1 elements'. Fixes: This patch follows existing expressions formatted into argument%s: line 380: (nargs < min ? min : max) == 1 ? "" : "s", lines 1667 and 2093: (len == 1) ? "" : "s", (parens not needed) Scope: I think we should finish the job in the file. The next line in both else clauses, "unpacked tuple should have %s%zd elements," should get the same treatment. This may break existing tests. (These are the only two formatted 'elements'. Fixes for the following will break some test, which will then need fixing also. 542: "expected %d arguments, not %" PY_FORMAT_SIZE_T "d", 1720, "%.200s%s takes %s %d positional arguments" 1799, "%.200s%s takes %s %d positional arguments" 2106, "%200s%s takes %s %d positional arguments (%d given)", 2154: "%.200s%s takes %s %d positional arguments" I checked all PyErr_Format entries and did not see anything other than %d arguments and %d elements. ---------- components: Interpreter Core messages: 322176 nosy: rhettinger, terry.reedy, xtreak priority: normal severity: normal status: open title: Fix pluralization in TypeError messages in getargs.c type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 02:40:16 2018 From: report at bugs.python.org (Michael Felt) Date: Mon, 23 Jul 2018 06:40:16 +0000 Subject: [New-bugs-announce] [issue34194] test_ssl, AIX, and defaults for _ssl connections Message-ID: <1532328016.0.0.56676864532.issue34194@psf.upfronthosting.co.za> New submission from Michael Felt : As far as I can tell _ssl works properly. However, test_ssl returns FAIL at some very basic levels, e.g. ... test_constructor (test.test_ssl.ContextTests) ... ERROR ... test_protocol (test.test_ssl.ContextTests) ... ERROR test_python_ciphers (test.test_ssl.ContextTests) ... ok test_session_stats (test.test_ssl.ContextTests) ... ERROR When using applications that depend on python (e.g., git) and getting "SSL" related errors - doing export SSL_CERT_FILE=/var/ssl/somefile.pem the problems go away. However, it looks asif that variable is not being used by python (3.7). Given: AIX openssl does not have a default CAFile nor CAPath, etc., only that openssl.cnf is at /var/ssl/openssl.cnf. Also - AIX openssl.base does not include any certificates. Question: does python have a documented (or undocumented) env variable it uses to look for, provide, or override a system/distribution default? ---------- assignee: christian.heimes components: Library (Lib), SSL, Tests messages: 322180 nosy: Michael.Felt, christian.heimes priority: normal severity: normal status: open title: test_ssl, AIX, and defaults for _ssl connections type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 03:41:35 2018 From: report at bugs.python.org (Tim Golden) Date: Mon, 23 Jul 2018 07:41:35 +0000 Subject: [New-bugs-announce] [issue34195] test_nt_helpers fails with case difference in drive letter Message-ID: <1532331695.99.0.56676864532.issue34195@psf.upfronthosting.co.za> New submission from Tim Golden : >From a fresh build on Win10 with VS2017: python -munittest -v test.test_ntpath.TestNtpath.test_nt_helpers gives the following error: ====================================================================== FAIL: test_nt_helpers (test.test_ntpath.TestNtpath) ---------------------------------------------------------------------- Traceback (most recent call last): File "c:\work-in-progress\python\cpython\lib\test\test_ntpath.py", line 432, in test_nt_helpers self.assertEqual(drive, nt._getvolumepathname(sys.executable)) AssertionError: 'c:\\' != 'C:\\' - c:\ ? ^ + C:\ ? ^ Ad hoc, it appears that: `sys.executable` gives a lower-case path while `nt._getvolumepathname` gives an upper-case drive letter. While the test could be trivially fixed, it seems worth investigating a little further to see what's happening inside `nt._getvolumepathname` ---------- assignee: tim.golden components: Windows messages: 322185 nosy: paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal stage: needs patch status: open title: test_nt_helpers fails with case difference in drive letter type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 06:15:08 2018 From: report at bugs.python.org (Leeland Morgan) Date: Mon, 23 Jul 2018 10:15:08 +0000 Subject: [New-bugs-announce] [issue34196] @staticmethod mangles name of outside class with __ (it is not inside class with staticmethod, but name mangled anyway), so NameError is produced Message-ID: <1532340908.45.0.56676864532.issue34196@psf.upfronthosting.co.za> New submission from Leeland Morgan : Hi! I'm not sure this is bug, but I did not find info about outside classes name mangling. Here is a repro url: https://repl.it/@LeelandMorgan/FlatSociableResource ---------- components: Interpreter Core messages: 322188 nosy: Leeland Morgan priority: normal severity: normal status: open title: @staticmethod mangles name of outside class with __ (it is not inside class with staticmethod, but name mangled anyway), so NameError is produced versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 07:06:28 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Mon, 23 Jul 2018 11:06:28 +0000 Subject: [New-bugs-announce] [issue34197] Make csv.Dialect attributes skipinitialspace, doublequote and strict booleans Message-ID: <1532343988.37.0.56676864532.issue34197@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : Currently attributes skipinitialspace, doublequote and strict of the csv.Dialect class are integers 0 or 1. >>> import csv >>> d = csv.reader([]).dialect >>> d.skipinitialspace 0 >>> d.doublequote 1 >>> d.strict 0 The proposed PR makes them False or True. ---------- assignee: serhiy.storchaka components: Library (Lib) messages: 322193 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Make csv.Dialect attributes skipinitialspace, doublequote and strict booleans type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 07:48:17 2018 From: report at bugs.python.org (Narito Takizawa) Date: Mon, 23 Jul 2018 11:48:17 +0000 Subject: [New-bugs-announce] [issue34198] Additional encoding options to tkinter.filedialog Message-ID: <1532346497.63.0.56676864532.issue34198@psf.upfronthosting.co.za> Change by Narito Takizawa : ---------- components: Tkinter nosy: narito priority: normal severity: normal status: open title: Additional encoding options to tkinter.filedialog type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 08:09:31 2018 From: report at bugs.python.org (Chetan kolhe) Date: Mon, 23 Jul 2018 12:09:31 +0000 Subject: [New-bugs-announce] [issue34199] Add support for delete logger in log module. Message-ID: <1532347771.53.0.56676864532.issue34199@psf.upfronthosting.co.za> New submission from Chetan kolhe : Hi, Currently, there is no support for whether the logger object is present or not. when logging module imported in current namespace all logger object get imported. which uses the memory. Add the option explicitly to delete the logger object. e.g logging.deletLoger("name for logger object") ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 322202 nosy: chetankolhe priority: normal severity: normal status: open title: Add support for delete logger in log module. type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 08:45:09 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 23 Jul 2018 12:45:09 +0000 Subject: [New-bugs-announce] [issue34200] [Windows] python -X utf8 -m test test_pkg fails Message-ID: <1532349909.53.0.56676864532.issue34200@psf.upfronthosting.co.za> New submission from STINNER Victor : vstinner at WIN C:\vstinner\python\master>python -X utf8 -m test -v test_pkg ====================================================================== ERROR: test_4 (test.test_pkg.TestPkg) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\vstinner\python\master\lib\test\test_pkg.py", line 180, in test_4 self.run_code(s) File "C:\vstinner\python\master\lib\test\test_pkg.py", line 69, in run_code exec(textwrap.dedent(code), globals(), {"self": self}) File "", line 2, in File "C:\Users\vstinner\AppData\Local\Temp\tmpgr2te1hp\t4.py", line 1, in RuntimeError: Shouldnt load t4.py ====================================================================== FAIL: test_7 (test.test_pkg.TestPkg) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\vstinner\python\master\lib\test\test_pkg.py", line 260, in test_7 '__name__', '__package__', '__path__', '__spec__']) AssertionError: Lists differ: ['__c[34 chars]__loader__', '__name__', '__package __', '__spec__'] != ['__c[34 chars]__loader__', '__name__', '__package__', '__pa th__', '__spec__'] First differing element 6: '__spec__' '__path__' Second list contains 1 additional elements. First extra element 7: '__spec__' ['__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', + '__path__', '__spec__'] ---------------------------------------------------------------------- ---------- components: Tests, Windows messages: 322208 nosy: paul.moore, steve.dower, tim.golden, vstinner, zach.ware priority: normal severity: normal status: open title: [Windows] python -X utf8 -m test test_pkg fails versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 10:01:22 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Mon, 23 Jul 2018 14:01:22 +0000 Subject: [New-bugs-announce] [issue34201] Make ndarray.readonly a bool Message-ID: <1532354482.59.0.56676864532.issue34201@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : memoryview.readonly is a bool, but ndarray.readonly is an int 0 or 1. The proposed PR makes ndarray.readonly a bool and makes test_buffer using more strict assertIs() instead of assertEqual() for testing boolean values. ---------- components: Tests messages: 322221 nosy: serhiy.storchaka, skrah priority: normal severity: normal status: open title: Make ndarray.readonly a bool type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 19:17:13 2018 From: report at bugs.python.org (Michael Kleehammer) Date: Mon, 23 Jul 2018 23:17:13 +0000 Subject: [New-bugs-announce] [issue34202] 3.6 ZipFile fails with Path Message-ID: <1532387833.75.0.56676864532.issue34202@psf.upfronthosting.co.za> New submission from Michael Kleehammer : ZipFile is documented to accept "path-like" objects but is failing when I try to create one. I've distilled it down to this small test: import zipfile from pathlib import Path path = Path('test.zip') zf = zipfile.ZipFile(path, 'w') zf.writestr('test.txt', 'Hello, Sailor!') zf.close() On macOS I'm getting this error: Traceback (most recent call last): File "test.py", line 7, in zf.writestr('test.txt', 'Hello, Sailor!') File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/zipfile.py", line 1644, in writestr with self.open(zinfo, mode='w') as dest: File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/zipfile.py", line 1348, in open return self._open_to_write(zinfo, force_zip64=force_zip64) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/zipfile.py", line 1461, in _open_to_write self.fp.write(zinfo.FileHeader(zip64)) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/zipfile.py", line 721, in write n = self.fp.write(data) AttributeError: 'PosixPath' object has no attribute 'write' Using str(path) works fine. ---------- components: Library (Lib) messages: 322272 nosy: mkleehammer priority: normal severity: normal status: open title: 3.6 ZipFile fails with Path type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 23 21:55:28 2018 From: report at bugs.python.org (abcdef) Date: Tue, 24 Jul 2018 01:55:28 +0000 Subject: [New-bugs-announce] [issue34203] documentation: recommend Python 3 over 2 in faq Message-ID: <1532397328.96.0.56676864532.issue34203@psf.upfronthosting.co.za> New submission from abcdef : FAQ "How stable is Python" https://docs.python.org/3/faq/general.html#how-stable-is-python" states "There are two recommended production-ready versions at this point in time, because at the moment there are two branches of stable releases: 2.x and 3.x. Python 3.x may be less useful than 2.x, since currently there is more third party software available for Python 2 than for Python 3. Python 2 code will generally not run unchanged in Python 3." According to git blame, this is from 2009. Could we change this to recommend Python 3 over Python 2 now? ---------- assignee: docs at python components: Documentation messages: 322273 nosy: abcdef, docs at python priority: normal severity: normal status: open title: documentation: recommend Python 3 over 2 in faq versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 05:16:42 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Tue, 24 Jul 2018 09:16:42 +0000 Subject: [New-bugs-announce] [issue34204] Bump the default pickle protocol in shelve Message-ID: <1532423802.47.0.56676864532.issue34204@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The default pickle protocol is 4 now. But shelve still uses the pickle protocol 3. Shouldn't it be bumped? Shouldn't shelve use pickle.DEFAULT_PROTOCOL by default? Disadvantages: 1. This will make shelve files incompatible with Python 3.3 by default. 2. Protocol 4 adds 9 bytes of overhead in comparison with protocol 3. This can be too large for the shelve containing a lot of small objects. Maybe strip redundant frame header for small pickles? ---------- components: Library (Lib) messages: 322281 nosy: alexandre.vassalotti, lukasz.langa, serhiy.storchaka priority: normal severity: normal status: open title: Bump the default pickle protocol in shelve type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 05:58:44 2018 From: report at bugs.python.org (Julien Palard) Date: Tue, 24 Jul 2018 09:58:44 +0000 Subject: [New-bugs-announce] [issue34205] Segmentation fault in _PyObject_Dump Message-ID: <1532426324.25.0.56676864532.issue34205@psf.upfronthosting.co.za> New submission from Julien Palard : On a freshly installed python3.6.6 using "pyenv install --debug 3.6.6", on a freshly created venv, after running a `pip install ansible`, I'm getting exactly those dependencies: ansible==2.6.1 asn1crypto==0.24.0 bcrypt==3.1.4 cffi==1.11.5 cryptography==2.3 idna==2.7 Jinja2==2.10 MarkupSafe==1.0 paramiko==2.4.1 pyasn1==0.4.3 pycparser==2.18 PyNaCl==1.2.1 PyYAML==3.13 six==1.11.0 If I run: $ python $(which ansible-playbook) I'm getting: * ob object : type : bytes refcount: 0 address : 0x7f2600ecc820 * op->_ob_prev->_ob_next object : Segmentation fault An excerpt of the stack trace: #0 _PyObject_Dump (op=0x7ffff0e667bf) at Objects/object.c:450 #1 0x000055555566a4cf in _Py_ForgetReference (op=0x7ffff0e667c0) at Objects/object.c:1767 #2 0x000055555566a579 in _Py_Dealloc (op=0x7ffff0e667c0) at Objects/object.c:1790 #3 0x00005555557982c2 in _PyImport_LoadDynamicModuleWithSpec (spec=0x7ffff130ec20, fp=0x0) at ./Python/importdl.c:227 #4 0x0000555555797439 in _imp_create_dynamic_impl (module=0x7ffff7f3e558, spec=0x7ffff130ec20, file=0x0) at Python/import.c:1994 #5 0x0000555555791760 in _imp_create_dynamic (module=0x7ffff7f3e558, args=0x7ffff1307e90) at Python/clinic/import.c.h:289 #6 0x00005555556618fc in PyCFunction_Call (func=0x7ffff7f43aa8, args=0x7ffff1307e90, kwds=0x7ffff126bb20) at Objects/methodobject.c:114 #7 0x0000555555768e90 in do_call_core (func=0x7ffff7f43aa8, callargs=0x7ffff1307e90, kwdict=0x7ffff126bb20) at Python/ceval.c:5095 #8 0x0000555555760fab in _PyEval_EvalFrameDefault (f=0x7ffff0ecb058, throwflag=0) at Python/ceval.c:3397 #9 0x000055555574e22a in PyEval_EvalFrameEx (f=0x7ffff0ecb058, throwflag=0) at Python/ceval.c:754 And what I see in gdb: (gdb) p (PyObject*)(op) $1 = (PyObject *) 0x7ffff0e667bf (gdb) p *(PyObject*)(op) $2 = {_ob_next = 0x7ffff1307e90fb, _ob_prev = 0x7ffff12df95000, ob_refcnt = 0, ob_type = 0x555555ad9f8000} (gdb) p (((PyObject*)(op))->ob_type) $3 = (struct _typeobject *) 0x555555ad9f8000 (gdb) p *(((PyObject*)(op))->ob_type) Cannot access memory at address 0x555555ad9f8000 I now have to go eat, but don't hesitate to ask me further investigations. ---------- components: Interpreter Core messages: 322285 nosy: mdk, vstinner priority: normal severity: normal status: open title: Segmentation fault in _PyObject_Dump type: crash versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 09:37:49 2018 From: report at bugs.python.org (Nick Coghlan) Date: Tue, 24 Jul 2018 13:37:49 +0000 Subject: [New-bugs-announce] [issue34206] Move and clarify Py_Main documentation Message-ID: <1532439469.19.0.56676864532.issue34206@psf.upfronthosting.co.za> New submission from Nick Coghlan : In resolving issue 34008, we determined that we *do* support calling Py_Main after Py_Initialize, but it's not clear from that current documentation that this implies a Py_Finalize() call, so you don't need to call that again yourself (and it's actually an error to do so). So this issue covers updating the draft PR I wrote at https://github.com/python/cpython/pull/8023 to move the Py_Main documentation into the initialization and finalization section, and clarify how it relates to the other initialization and finalization functions. ---------- assignee: ncoghlan components: Documentation messages: 322301 nosy: ncoghlan, vstinner priority: normal severity: normal stage: patch review status: open title: Move and clarify Py_Main documentation type: enhancement versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 10:08:35 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Tue, 24 Jul 2018 14:08:35 +0000 Subject: [New-bugs-announce] [issue34207] test_cmd_line test_utf8_mode test_warnings fail in AMD64 FreeBSD CURRENT buildbots Message-ID: <1532441315.45.0.56676864532.issue34207@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : test_cmd_line test_utf8_mode test_warnings fail in AMD64 FreeBSD CURRENT buildbots: https://buildbot.python.org/all/#/builders/79/builds/186 https://buildbot.python.org/all/#/builders/60/builds/182 Sample error: test_xoptions (test.test_cmd_line.CmdLineTest) ... ok test_ignore_PYTHONHASHSEED (test.test_cmd_line.IgnoreEnvironmentTest) ... ok test_ignore_PYTHONPATH (test.test_cmd_line.IgnoreEnvironmentTest) ... ok test test_cmd_line failed test_sys_flags_not_set (test.test_cmd_line.IgnoreEnvironmentTest) ... ok ====================================================================== FAIL: test_non_ascii (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current.nondebug/build/Lib/test/test_cmd_line.py", line 149, in test_non_ascii assert_python_ok('-c', command) File "/usr/home/buildbot/python/3.x.koobs-freebsd-current.nondebug/build/Lib/test/support/script_helper.py", line 157, in assert_python_ok return _assert_python(True, *args, **env_vars) File "/usr/home/buildbot/python/3.x.koobs-freebsd-current.nondebug/build/Lib/test/support/script_helper.py", line 143, in _assert_python res.fail(cmd_line) File "/usr/home/buildbot/python/3.x.koobs-freebsd-current.nondebug/build/Lib/test/support/script_helper.py", line 84, in fail err)) AssertionError: Process return code is 1 command line: ['/usr/home/buildbot/python/3.x.koobs-freebsd-current.nondebug/build/python', '-X', 'faulthandler', '-I', '-c', "assert(ord('??') == 230)"] stdout: --- --- stderr: --- Unable to decode the command from the command line: UnicodeEncodeError: 'utf-8' codec can't encode characters in position 12-13: surrogates not allowed --- ---------------------------------------------------------------------- Ran 43 tests in 17.680s FAILED (failures=1, skipped=2) 3 tests failed again: test_cmd_line test_utf8_mode test_warnings and est_showwarning_not_callable (test.test_warnings._WarningsTests) ... ok test_showwarnmsg_missing (test.test_warnings._WarningsTests) ... ok test test_warnings failed test_stderr_none (test.test_warnings._WarningsTests) ... ok ====================================================================== FAIL: test_nonascii (test.test_warnings.CEnvironmentVariableTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_warnings/__init__.py", line 1151, in test_nonascii "['ignore:Deprecaci??nWarning']".encode('utf-8')) AssertionError: b"['ignore:Deprecaci\\udcc3\\udcb3nWarning']" != b"['ignore:Deprecaci\xc3\xb3nWarning']" ====================================================================== FAIL: test_nonascii (test.test_warnings.PyEnvironmentVariableTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_warnings/__init__.py", line 1151, in test_nonascii "['ignore:Deprecaci??nWarning']".encode('utf-8')) AssertionError: b"['ignore:Deprecaci\\udcc3\\udcb3nWarning']" != b"['ignore:Deprecaci\xc3\xb3nWarning']" ---------------------------------------------------------------------- Ran 111 tests in 4.635s FAILED (failures=2) 3 tests failed again: test_cmd_line test_utf8_mode test_warnings == Tests result: FAILURE then FAILURE == ---------- components: Tests messages: 322303 nosy: pablogsal priority: normal severity: normal status: open title: test_cmd_line test_utf8_mode test_warnings fail in AMD64 FreeBSD CURRENT buildbots type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 10:21:42 2018 From: report at bugs.python.org (Dave Opstad) Date: Tue, 24 Jul 2018 14:21:42 +0000 Subject: [New-bugs-announce] [issue34208] Change in 3.7 expression evaluation? Message-ID: <1532442102.57.0.56676864532.issue34208@psf.upfronthosting.co.za> New submission from Dave Opstad : In 3.6 I get this: >>> x = (100 * 20) >>> x is 2000 False >>> (100 * 20) is 2000 False But in 3.7, I get this: >>> x = (100 * 20) >>> x is 2000 False >>> (100 * 20) is 2000 True This isn't necessarily a problem, but I'm curious why this behavior changed from 3.6 to 3.7. ---------- components: Interpreter Core messages: 322304 nosy: opstad priority: normal severity: normal status: open title: Change in 3.7 expression evaluation? type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 10:31:37 2018 From: report at bugs.python.org (Dhiraj) Date: Tue, 24 Jul 2018 14:31:37 +0000 Subject: [New-bugs-announce] [issue34209] racecondition Message-ID: <1532442697.44.0.56676864532.issue34209@psf.upfronthosting.co.za> New submission from Dhiraj : File: /cpython/blob/master/Modules/posixmodule.c#L2657 #endif result = access(path->narrow, mode); Py_END_ALLOW_THREADS return_value = !result; #endif If an attacker could change anything along the path between the call `access()` and the files actually used, it may exploit the race condition or a time-of-check, time-of-use race condition https://linux.die.net/man/2/access ---------- components: Build messages: 322305 nosy: Dhiraj_Mishra priority: normal severity: normal status: open title: racecondition type: security versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 11:06:20 2018 From: report at bugs.python.org (Alexander Marshalov) Date: Tue, 24 Jul 2018 15:06:20 +0000 Subject: [New-bugs-announce] [issue34210] Small improvements in heapq (refatoring) Message-ID: <1532444780.82.0.56676864532.issue34210@psf.upfronthosting.co.za> New submission from Alexander Marshalov <_ at marshalov.org>: I would like to make three small improvements to the "heapq" module. 1) The "nsmallest" function has the following code (a similar code exists in the "nlargest" function): # When n>=size, it's faster to use sorted() try: size = len(iterable) except (TypeError, AttributeError): pass else: if n >= size: return sorted(iterable, key=key)[:n] I think "[:n]" is redundant, because "iterable" contains no more than n elements. Therefore, that code can be rewritten as follows: # When n>=size, it's faster to use sorted() try: size = len(iterable) except (TypeError, AttributeError): pass else: if n >= size: return sorted(iterable, key=key) 2) It seems to me that the line: ????for i in reversed(range(n//2)): ???will be more optimal in this version: ????for i in range(n//2 + 1, -1, -1): 3) Top-level functions can be surrounded with two blank lines for greater compliance with PEP-8. ---------- messages: 322307 nosy: amper priority: normal severity: normal status: open title: Small improvements in heapq (refatoring) type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 13:00:16 2018 From: report at bugs.python.org (Erik Bray) Date: Tue, 24 Jul 2018 17:00:16 +0000 Subject: [New-bugs-announce] [issue34211] Cygwin build broken due to use of &PyType_Type in static declaration in _abc module Message-ID: <1532451616.3.0.56676864532.issue34211@psf.upfronthosting.co.za> New submission from Erik Bray : This is essentially the same as issue21124, but introduced more recently with the addition of the _abc_data_type in the _abc module. The workaround is simply to use PyVarObject_HEAD_INIT(NULL, 0) instead of PyVarObject_HEAD_INIT(&PyType_Type, 0); PyType_Ready should take care of the rest. P.S. I'm trying to get going again on the project of adding an AppVeyor build, and eventually a buildbot for Cygwin. My previous attempt was doomed because I wanted to fix all failing tests on Cygwin *first*. This time I am going for a more "instant gratification" approach of just skipping the tests that fail (for now) so that I can at least catch new regressions, and then gradually re-enabled skipped tests as I can find fixes for them. However, for that to happen we at least need a minimal build to work. ---------- components: Build keywords: 3.7regression messages: 322315 nosy: erik.bray priority: normal severity: normal stage: needs patch status: open title: Cygwin build broken due to use of &PyType_Type in static declaration in _abc module type: compile error versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 13:10:52 2018 From: report at bugs.python.org (Erik Bray) Date: Tue, 24 Jul 2018 17:10:52 +0000 Subject: [New-bugs-announce] [issue34212] Cygwin link failure with builtin modules since issue30860 Message-ID: <1532452252.87.0.56676864532.issue34212@psf.upfronthosting.co.za> New submission from Erik Bray : Since issue30860, libpython is no longer able to be linked as a shared library, because built-in modules are not compiled with the correct external linkage flags. This is due to the removal of -DPy_BUILD_CORE, which in pyport.h is used to control wither __declspec(dllexport) is used as opposed to __declspec(dllimport). Fortunately Eric Snow already added in https://github.com/python/cpython/pull/3458 a new flag Py_BUILD_CORE_BUILTIN which is used sparingly on Windows, and which should also be used, e.g. on Cygwin or MinGW, when compiling modules that are linked into libpython as built-ins. It sets the right external linkage flags without carrying the additional weight of Py_BUILD_CORE. This along with issue34211 need to be fixed in order to get Python 3.7+ building on Cygwin again. ---------- components: Build keywords: 3.7regression messages: 322316 nosy: erik.bray priority: normal severity: normal status: open title: Cygwin link failure with builtin modules since issue30860 versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 14:34:20 2018 From: report at bugs.python.org (Edward Jones) Date: Tue, 24 Jul 2018 18:34:20 +0000 Subject: [New-bugs-announce] [issue34213] Frozen dataclass __init__ fails for "object" property" Message-ID: <1532457260.21.0.56676864532.issue34213@psf.upfronthosting.co.za> New submission from Edward Jones : When `__init__` is called for a class which 1) is annotated with `@dataclasses.dataclass(frozen=True)` and 2) has a attribute named `object` a TypeError is raised because `object` is overridden for the local scope and as a result `__setattr__` is called on the passed in argument value instead of the standard `object` base type. I was able to reproduce this in a Docker container running https://github.com/docker-library/python/blob/7a794688c7246e7eff898f5288716a3e7dc08484/3.7/stretch/Dockerfile with the attached .py file. Python 3.7.0 (default, Jul 17 2018, 11:04:33) [GCC 6.3.0 20170516] on linux ---------- components: Library (Lib) files: frozen_dataclass_init_typeerror.py messages: 322321 nosy: Omenien priority: normal severity: normal status: open title: Frozen dataclass __init__ fails for "object" property" type: behavior versions: Python 3.7 Added file: https://bugs.python.org/file47710/frozen_dataclass_init_typeerror.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 16:16:21 2018 From: report at bugs.python.org (Nick Drozd) Date: Tue, 24 Jul 2018 20:16:21 +0000 Subject: [New-bugs-announce] [issue34214] Pylint recusion stack overflow abort Message-ID: <1532463381.11.0.56676864532.issue34214@psf.upfronthosting.co.za> New submission from Nick Drozd : In certain very, very specific circumstances, Pylint can cause the interpreter to abort with a stack overflow error. I've seen this issue on 3.5, 3.6, and 3.8 (I assume it affects 3.7 as well) and on both Mac and Ubuntu. It requires: * 1.7 <= Pylint version < 1.9 * 1.6.0 <= Astroid version < 1.6.2 - (For interpreter versions > 3.6, commit https://github.com/PyCQA/astroid/commit/ceeee09743079d07ffc3918969ab203f766b29e0 is also required.) * The dependencies of Pylint and Astroid (I'm not aware of any specific versions needed.) The crash comes from running Pylint on the file stack-overflow-abort.py (https://github.com/nickdrozd/pylint/blob/80b05dace5049b8a837b8c530a57321381717ddb/stack-overflow-abort.py). This causes the interpreter to abort with the message "Fatal Python error: Cannot recover from stack overflow." Now, it's not surprising that some kind of stack depth error occurs here, as the target code is recursive, Pylint is recursive, and and Astroid 1.6.0 had a bug in its handling of augmented assign statements (this bug was fixed in 1.6.2 with a one-line change: https://github.com/PyCQA/astroid/commit/3fae32f99c7f432a1281b151ea17e163a2e8dc47). But this recursion bug should be handled with a RecursionError instead of an abort. What's strange is that running Pylint on the file caught-recursion-error.py (https://github.com/nickdrozd/pylint/blob/80b05dace5049b8a837b8c530a57321381717ddb/caught-recursion-error.py), which differs from stack-overflow-abort.py in just three characters, does end up with a RecursionError (neither file is large at all). So it looks like something subtle is happening here. I tried looking around to see if I could figure it out, and I could not. All I was able to discover is that changing 50 to other numbers in _Py_CheckRecursiveCall causes the error to come from different places: at the beginning of the eval loop, "while calling a Python object" at several points, and "in comparison". I've included the text of a shell session showing the errors. Repo links to versions of Pylint and Astroid that cause the error: https://github.com/nickdrozd/pylint/tree/crash https://github.com/nickdrozd/astroid/tree/crash See https://github.com/PyCQA/pylint/issues/1805 for further discussion. ---------- components: Interpreter Core files: shell-session messages: 322328 nosy: nickdrozd priority: normal severity: normal status: open title: Pylint recusion stack overflow abort type: crash versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 Added file: https://bugs.python.org/file47711/shell-session _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 16:43:44 2018 From: report at bugs.python.org (Tyler Bell) Date: Tue, 24 Jul 2018 20:43:44 +0000 Subject: [New-bugs-announce] [issue34215] streams.py:readuntil IncompleteReadError is message is incorrect Message-ID: <1532465024.45.0.56676864532.issue34215@psf.upfronthosting.co.za> New submission from Tyler Bell : This may have already been cleared as I opened the PR months ago But the gist is that the Exception is misleading and the test is incorrect. ---------- components: Library (Lib) messages: 322329 nosy: mrbell321 at gmail.com priority: normal pull_requests: 7975 severity: normal status: open title: streams.py:readuntil IncompleteReadError is message is incorrect type: enhancement versions: Python 3.5 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 17:02:51 2018 From: report at bugs.python.org (sachin) Date: Tue, 24 Jul 2018 21:02:51 +0000 Subject: [New-bugs-announce] [issue34216] python platform no child error Message-ID: <1532466171.52.0.56676864532.issue34216@psf.upfronthosting.co.za> New submission from sachin : We are trying to utilize librosa library for some processing. When we try to load the librosa library, python platform library is triggered via the Numba library. Numba is trying to find the underlying OS which is installed. Function "_syscmd_uname" is triggered to find out the underlying os, but in the above function the os.popen object which is opened to determine the OS , but when the object is closed it throws a no child process error. This is mainly due to the closure of the popen object before the close fuction is called. we can get around this problem by catching the error and returning a default value if the closing of the popen pipeline fails python platform.py file def _syscmd_uname(option, default=''): """ Interface to the system's uname command. """ if sys.platform in ('dos', 'win32', 'win16'): # XXX Others too ? return default try: f = os.popen('uname %s 2> %s' % (option, DEV_NULL)) except (AttributeError, OSError): return default output = f.read().strip() rc = f.close() # error at this place enclose in a try except statement to catrch the exception if not output or rc: return default else: return output ---------- components: Build messages: 322330 nosy: sskamble619 priority: normal severity: normal status: open title: python platform no child error type: compile error versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 24 19:42:09 2018 From: report at bugs.python.org (Erik Janssens) Date: Tue, 24 Jul 2018 23:42:09 +0000 Subject: [New-bugs-announce] [issue34217] windows: cross compilation fails due to headers with uppercase Message-ID: <1532475729.27.0.56676864532.issue34217@psf.upfronthosting.co.za> New submission from Erik Janssens : When cross compiling python on a linux host with a case sensitive file system for a windows target. The compilation will fail due to header files which contain uppercases. ---------- components: Cross-Build, Windows messages: 322333 nosy: Alex.Willmer, erikjanss, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: windows: cross compilation fails due to headers with uppercase type: compile error versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 04:43:53 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Wed, 25 Jul 2018 08:43:53 +0000 Subject: [New-bugs-announce] [issue34218] test_xml_etree_c leaked [68, 68, 74] references, sum=210 Message-ID: <1532508233.04.0.56676864532.issue34218@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : Builder x86 Gentoo Refleaks 3.x reports that test_xml_etree_c is potentially leaking references and blocks: https://buildbot.python.org/all/#builders/1/builds/295 ---------------------------------------------------------------------- Ran 148 tests in 0.487s OK . test_xml_etree_c leaked [68, 68, 74] references, sum=210 test_xml_etree_c leaked [51, 52, 52] memory blocks, sum=155 1 test failed again: test_xml_etree_c == Tests result: FAILURE then FAILURE == ---------- components: Tests messages: 322343 nosy: pablogsal priority: normal severity: normal status: open title: test_xml_etree_c leaked [68, 68, 74] references, sum=210 type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 04:58:00 2018 From: report at bugs.python.org (monson) Date: Wed, 25 Jul 2018 08:58:00 +0000 Subject: [New-bugs-announce] [issue34219] distutils: build_ext -D wrongly assume defining a symbol with no value Message-ID: <1532509080.28.0.56676864532.issue34219@psf.upfronthosting.co.za> New submission from monson : `python setup.py build_ext -D zero,one=v1,two=k2=v2` will generate preprocessor argument `-D zero=1 -D one=v1=1 -D two=k2=v2=1`. Expect `-D zero=1 -D one=v1 -D two=k2=v2`. ---------- components: Library (Lib) messages: 322344 nosy: monson priority: normal severity: normal status: open title: distutils: build_ext -D wrongly assume defining a symbol with no value type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 08:56:44 2018 From: report at bugs.python.org (Grigory Statsenko) Date: Wed, 25 Jul 2018 12:56:44 +0000 Subject: [New-bugs-announce] [issue34222] Email message serialization enters an infinite loop when folding non-ASCII headers with long words Message-ID: <1532523404.04.0.56676864532.issue34222@psf.upfronthosting.co.za> New submission from Grigory Statsenko : (Discovered together with https://bugs.python.org/msg322348) Email message serialization (in function _fold_as_ew) enters an infinite loop when folding non-ASCII headers whose words (after encoding) are longer than the given maxlen. Besides being stuck in an infinite loop, it keeps appending to the `lines` list, so its memory usage keeps on growing also infinitely. The code keeps appending encoded empty strings to the list like this: lines: [ 'Subject: =?utf-8?q??=', ' =?utf-8?q??=', ' =?utf-8?q??=', ' =?utf-8?q??=', ' =?utf-8?q??=', ' =?utf-8?q??=', ' ' ] (and it keeps on growing) Here is my code that can reproduce this issue (as a unittest): import email.generator import email.policy from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from unittest import TestCase def create_message(subject, sender, recipients, body): msg = MIMEMultipart() msg.set_charset('utf-8') msg.policy = email.policy.SMTP msg.attach(MIMEText(body, 'html')) msg['Subject'] = subject msg['From'] = sender msg['To'] = ';'.join(recipients) return msg class TestEmailMessage(TestCase): def _make_message(self, subject): return create_message( subject=subject, sender='me at site.com', recipients=['me at site.com'], body='Some text', ) def test_ascii_message_with_len_limit(self): # very long subject consisting of a single word subject = 'Q' * 100 msg = self._make_message(subject) self.assertTrue(msg.as_string(maxheaderlen=76)) def test_non_ascii_message_with_len_limit(self): # very long subject consisting of a single word subject = '?' * 100 msg = self._make_message(subject) self.assertTrue(msg.as_string(maxheaderlen=76)) The ASCII test passes, but the non-ASCII one never finishes. >From what I can tell, the problem is in line 2728 of email/_header_value_parser.py: first_part = first_part[:-excess] where `excess` is calculated from the encoded string (which is several times longer than the original one), but it truncates the original (non-encoded string). The problem arises when `excess` is actually greater than `first_part` So, it attempts to encode the exact same part of the header and fails in every iteration, instead appending an empty string to the list and encoding it as ' =?utf-8?q??=' What this amounts to is that it's now practically impossible to send emails with non-ACSII subjects without either disregarding the RFC recommendations and requirements for line length or risking hangs and memory leaks. Just like in https://bugs.python.org/msg322348, this behavior is new in Python 3.6. Also does not work in 3.7 and 3.8 ---------- components: email messages: 322351 nosy: altvod, barry, r.david.murray priority: normal severity: normal status: open title: Email message serialization enters an infinite loop when folding non-ASCII headers with long words versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 10:22:36 2018 From: report at bugs.python.org (Andreas Jung) Date: Wed, 25 Jul 2018 14:22:36 +0000 Subject: [New-bugs-announce] [issue34224] python 3.7 inside venv tries to write back to installation directory Message-ID: <1532528556.54.0.56676864532.issue34224@psf.upfronthosting.co.za> Change by Andreas Jung : ---------- components: Installation nosy: ajung priority: normal severity: normal status: open title: python 3.7 inside venv tries to write back to installation directory _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 12:54:55 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 25 Jul 2018 16:54:55 +0000 Subject: [New-bugs-announce] [issue34228] Allow PYTHONTRACEMALLOC=0 and -X tracemalloc=0 to disable explicitly tracemalloc Message-ID: <1532537695.14.0.56676864532.issue34228@psf.upfronthosting.co.za> New submission from STINNER Victor : Currently, -X tracemalloc=0 command line option is reject as an invalid value. I would like to allow to explicitly disable tracemalloc. That's useful to ignore the PYTHONTRACEMALLOC environment variable: "PYTHONTRACEMALLOC=1 python3 -X tracemalloc=0" would not enable tracemalloc at startup. ---------- components: Library (Lib) messages: 322369 nosy: vstinner priority: normal severity: normal status: open title: Allow PYTHONTRACEMALLOC=0 and -X tracemalloc=0 to disable explicitly tracemalloc versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 11:58:34 2018 From: report at bugs.python.org (Piotr Jurkiewicz) Date: Wed, 25 Jul 2018 15:58:34 +0000 Subject: [New-bugs-announce] [issue34227] Weighted random.sample() (weighted sampling without replacement) Message-ID: <1532534314.27.0.56676864532.issue34227@psf.upfronthosting.co.za> New submission from Piotr Jurkiewicz : Function random.choices(), which appeared in Python 3.6, allows to perform weighted random sampling with replacement. Function random.sample() performs random sampling without replacement, but cannot do it weighted. I propose to enhance random.sample() to perform weighted sampling. That way all four possibilities will be supported: - non-weighted sampling with replacement: random.choices(..., weights=None) (exists) - weighted sampling with replacement: random.choices(..., weights=weights) (exists) - non-weighted sampling without replacement: random.sample(..., weights=None) (exists) - weighted sampling without replacement: random.sample(..., weights=weights) (NEW) Rationale: Weighted sampling without replacement is a popular problem. There are lot of questions on StackOverflow and similar sites how to implement it. Unfortunately, many proposed solutions are wrong, for example: https://stackoverflow.com/a/353510/2178047 https://softwareengineering.stackexchange.com/a/233552/161807 or have excessive computational complexity (e.g. quadratic). There are lot of suggestions to use numpy.random.choice() to do that, which supports all four possibilities with a single function: numpy.random.choice(a, size=None, replace=True, p=None) But of course this is an overkill to install numpy just to do that. I think that this should be possible with stdlib, without the need to implement it by yourself or to install numpy. Especially, that it can be implemented in 2 lines (plus 4 lines of error checking), as you can see in the PR. ---------- components: Library (Lib) messages: 322367 nosy: piotrjurkiewicz priority: normal severity: normal status: open title: Weighted random.sample() (weighted sampling without replacement) type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 08:19:20 2018 From: report at bugs.python.org (Grigory Statsenko) Date: Wed, 25 Jul 2018 12:19:20 +0000 Subject: [New-bugs-announce] [issue34220] Serialization of email message without header line length limit and a non-ASCII subject fails with TypeError Message-ID: <1532521160.35.0.56676864532.issue34220@psf.upfronthosting.co.za> New submission from Grigory Statsenko : I have the following code that creates a simple email message with a) a pure-ASCII subject, b) non-ASCII subject (I made it into a unittest): import email.generator import email.policy from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from unittest import TestCase def create_message(subject, sender, recipients, body): msg = MIMEMultipart() msg.set_charset('utf-8') msg.policy = email.policy.SMTP msg.attach(MIMEText(body, 'html')) msg['Subject'] = subject msg['From'] = sender msg['To'] = ';'.join(recipients) return msg class TestEmailMessage(TestCase): def _make_message(self, subject): return create_message( subject=subject, sender='me at site.com', recipients=['me at site.com'], body='Some text', ) def test_ascii_message_no_len_limit(self): # very long subject consisting of a single word subject = 'Q' * 100 msg = self._make_message(subject) self.assertTrue(str(msg)) def test_non_ascii_message_no_len_limit(self): # very long subject consisting of a single word subject = '?' * 100 msg = self._make_message(subject) self.assertTrue(str(msg)) The ASCII one passes, while the non-ASCII version fails with the following exception: Traceback (most recent call last): File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/unittest/case.py", line 59, in testPartExecutor yield File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/unittest/case.py", line 605, in run testMethod() File "/home/grigory/PycharmProjects/smtptest/test_message.py", line 36, in test_non_ascii_message_no_len_limit self.assertTrue(str(msg)) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/message.py", line 135, in __str__ return self.as_string() File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/message.py", line 158, in as_string g.flatten(self, unixfrom=unixfrom) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/generator.py", line 116, in flatten self._write(msg) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/generator.py", line 195, in _write self._write_headers(msg) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/generator.py", line 222, in _write_headers self.write(self.policy.fold(h, v)) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/policy.py", line 183, in fold return self._fold(name, value, refold_binary=True) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/policy.py", line 205, in _fold return value.fold(policy=self) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/headerregistry.py", line 258, in fold return header.fold(policy=policy) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/_header_value_parser.py", line 144, in fold return _refold_parse_tree(self, policy=policy) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/_header_value_parser.py", line 2645, in _refold_parse_tree part.ew_combine_allowed, charset) File "/home/grigory/.pyenv/versions/3.6.4/lib/python3.6/email/_header_value_parser.py", line 2722, in _fold_as_ew first_part = to_encode[:text_space] TypeError: slice indices must be integers or None or have an __index__ method The problem is that _fold_as_ew treats maxlen as an integer, but it can also have inf and None as valid values. In my case it's inf, but None can also get there if the HTTP email policy is used and its max_line_length value is not overridden when serializing. I am supposing that the correct behavior in both of these cases should be no wrapping at all. And/or maybe one of these (inf & None) should be converted to the other at some point, so only one special case has to handled in the low-level code This behavior is new in Python 3.6. It works in 3.5. Also fails in 3.7 and 3.8 ---------- components: email messages: 322348 nosy: altvod, barry, r.david.murray priority: normal severity: normal status: open title: Serialization of email message without header line length limit and a non-ASCII subject fails with TypeError type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 10:54:28 2018 From: report at bugs.python.org (Steve Dower) Date: Wed, 25 Jul 2018 14:54:28 +0000 Subject: [New-bugs-announce] [issue34225] distutils._msvccompiler should trim INCLUDE/LIB directories Message-ID: <1532530468.57.0.56676864532.issue34225@psf.upfronthosting.co.za> New submission from Steve Dower : _msvccompiler reads the INCLUDE and LIB environment variables when building and adds each directory to the command line. However, if any of these end with os.sep (specifically, '\'), then it will escape the quoting and break the entire command. We should rstrip(os.sep) on each item from this list. ---------- assignee: steve.dower components: Distutils, Windows messages: 322361 nosy: dstufft, eric.araujo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: distutils._msvccompiler should trim INCLUDE/LIB directories versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 10:55:40 2018 From: report at bugs.python.org (Chih-Hsuan Yen) Date: Wed, 25 Jul 2018 14:55:40 +0000 Subject: [New-bugs-announce] [issue34226] cgi.parse_multipart() requires undocumented CONTENT-LENGTH in Python 3.7 Message-ID: <1532530540.72.0.56676864532.issue34226@psf.upfronthosting.co.za> New submission from Chih-Hsuan Yen : In Python 3.7, cgi.parse_multipart() requires "CONTENT-LENGTH" in the second parameter `pdict`. This is not necesary in Python 3.6. For example, the following code runs with 3.6: $ python3.6 Python 3.6.6 (default, Jun 27 2018, 13:11:40) [GCC 8.1.1 20180531] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cgi, io >>> data = b'--heyDavid\r\nContent-Disposition: form-data; name="cfield"\r\n\r\njust a string\r\n\r\n--heyDavid--\r\n' >>> cgi.parse_multipart(io.BytesIO(data), {"boundary": b"heyDavid"}) {'cfield': [b'just a string\r\n']} While not on 3.7: $ python3.7 Python 3.7.0 (default, Jul 15 2018, 10:44:58) [GCC 8.1.1 20180531] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cgi, io >>> data = b'--heyDavid\r\nContent-Disposition: form-data; name="cfield"\r\n\r\njust a string\r\n\r\n--heyDavid--\r\n' >>> cgi.parse_multipart(io.BytesIO(data), {"boundary": b"heyDavid"}) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.7/cgi.py", line 220, in parse_multipart headers['Content-Length'] = pdict['CONTENT-LENGTH'] KeyError: 'CONTENT-LENGTH' I looked into the source code of CPython, and found CONTENT-LENGTH in nowhere but cgi.py and test_cgi.py. I guess it has the same meaning as the Content-Length header in HTTP or CONTENT_LENGTH environment variable in CGI? It would be great to document such a backward-incompatible behavior. Environment: Arch Linux with Python 3.6.6 from [extra] repo and 3.7.0 from [staging] repo. CC the author and the reviewer of issue29979, where relevant codes are introduced. ---------- assignee: docs at python components: Documentation, Library (Lib) messages: 322362 nosy: docs at python, orsenthil, quentel, yan12125 priority: normal severity: normal status: open title: cgi.parse_multipart() requires undocumented CONTENT-LENGTH in Python 3.7 type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 09:53:37 2018 From: report at bugs.python.org (STINNER Victor) Date: Wed, 25 Jul 2018 13:53:37 +0000 Subject: [New-bugs-announce] [issue34223] PYTHONDUMPREFS=1 ./python -c pass does crash Message-ID: <1532526817.78.0.56676864532.issue34223@psf.upfronthosting.co.za> New submission from STINNER Victor : It seems like Python has an invalid object somewhere. PYTHONDUMPREFS=1 makes Python crash at exit. $ PYTHONDUMPREFS=1 ./python -c pass (...) 0x7f1992292448 [1] (, ) 0x7f1992241aa8 [1] {'__doc__': 'Thread-local dummy'} 0x7f199222c740 [1] (,) 0x9c98a0 [2] 0x7f1992217dc0 [1] Segmentation fault (core dumped) ---------- components: Interpreter Core messages: 322353 nosy: vstinner priority: normal severity: normal status: open title: PYTHONDUMPREFS=1 ./python -c pass does crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Wed Jul 25 08:43:24 2018 From: report at bugs.python.org (iMath) Date: Wed, 25 Jul 2018 12:43:24 +0000 Subject: [New-bugs-announce] [issue34221] Any plans to combine collections.OrderedDict with dict Message-ID: <1532522604.07.0.56676864532.issue34221@psf.upfronthosting.co.za> New submission from iMath : Since Python 3.7?dicts remember the order that items were inserted, so any plans to combine collections.OrderedDict with dict? https://docs.python.org/3/library/collections.html?#collections.OrderedDict https://docs.python.org/3/library/stdtypes.html#dict BTW, I think it would be better to move "Dictionaries preserve insertion order" part at the end of the doc of https://docs.python.org/3/library/stdtypes.html#dict up below the doc for class dict(**kwarg) class dict(mapping, **kwarg) class dict(iterable, **kwarg) so that people won't miss the feature when consulting the doc ---------- messages: 322349 nosy: redstone-cold priority: normal severity: normal status: open title: Any plans to combine collections.OrderedDict with dict type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 00:55:28 2018 From: report at bugs.python.org (Petru-Florin Mihancea) Date: Thu, 26 Jul 2018 04:55:28 +0000 Subject: [New-bugs-announce] [issue34229] Possible access to unintended variable in "cpython/Objects/sliceobject.c" line 116 Message-ID: <1532580928.78.0.56676864532.issue34229@psf.upfronthosting.co.za> New submission from Petru-Florin Mihancea : While experimenting with a CodeSonar plugin we develop, we noticed a potential bug in file "cpython/Objects/sliceobject.c" line 116 function PySlice_GetIndices. if (r->start == Py_None) { *start = *step < 0 ? length-1 : 0; } else { if (!PyInt_Check(r->start) && !PyLong_Check(r->step)) return -1;//HERE *start = PyInt_AsSsize_t(r->start); if (*start < 0) *start += length; } Shouldn't start field of r be used in the second check (instead of step)? In a related potential issue, in line 123, shouldn't r->stop be checked in the second verification? Thanks, Petru Florin Mihancea ---------- messages: 322394 nosy: petrum at gmail.com priority: normal severity: normal status: open title: Possible access to unintended variable in "cpython/Objects/sliceobject.c" line 116 versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 01:33:24 2018 From: report at bugs.python.org (Sergey Fedoseev) Date: Thu, 26 Jul 2018 05:33:24 +0000 Subject: [New-bugs-announce] [issue34230] crashes in pysqlite_build_row_cast_map() on memory allocation failure Message-ID: <1532583204.12.0.56676864532.issue34230@psf.upfronthosting.co.za> New submission from Sergey Fedoseev : pysqlite_build_row_cast_map() can crash on memory allocation failure: 1. it doesn't check that PyList_New() returns non-NULL 2. Py_DECREF() borrowed reference when ---------- components: Extension Modules messages: 322396 nosy: sir-sigurd priority: normal severity: normal status: open title: crashes in pysqlite_build_row_cast_map() on memory allocation failure type: crash _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 04:53:13 2018 From: report at bugs.python.org (=?utf-8?q?St=C3=A9phane_Wirtel?=) Date: Thu, 26 Jul 2018 08:53:13 +0000 Subject: [New-bugs-announce] [issue34231] PYTHONBREAKPOINT is not documented with python --help Message-ID: <1532595193.74.0.56676864532.issue34231@psf.upfronthosting.co.za> Change by St?phane Wirtel : ---------- assignee: matrixise nosy: matrixise priority: normal severity: normal status: open title: PYTHONBREAKPOINT is not documented with python --help versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 06:15:52 2018 From: report at bugs.python.org (Wolfgang Maier) Date: Thu, 26 Jul 2018 10:15:52 +0000 Subject: [New-bugs-announce] [issue34232] Python3.7.0 exe installers (32 and 64 bit) failing on Windows7 Message-ID: <1532600152.06.0.56676864532.issue34232@psf.upfronthosting.co.za> New submission from Wolfgang Maier : System: Windows7 Enterprise SP1 64-bit Downloaded the executable installer from python.org (tried both 32- and 64-bit -> same error) Selected the default user-install and got an almost immediate Error message: The TARGETDIR variable must be provided when invoking this installer. Clicking OK reveals 0x80070643 - Fatal error during installation and the attached log file. Rebooting didn't help and I also tried playing with custom installation settings, too, but no success so far. ---------- components: Installation messages: 322409 nosy: steve.dower, wolma priority: normal severity: normal status: open title: Python3.7.0 exe installers (32 and 64 bit) failing on Windows7 versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 06:44:12 2018 From: report at bugs.python.org (sanjay patel) Date: Thu, 26 Jul 2018 10:44:12 +0000 Subject: [New-bugs-announce] [issue34233] subprocess.check_output goes to infinte loop Message-ID: <1532601852.46.0.56676864532.issue34233@psf.upfronthosting.co.za> New submission from sanjay patel : Below snipped goes to infinite loop when running through windows command prompt but works in python IDLE import subprocess subprocess.check_output('cmd.exe dir', stderr=subprocess.STDOUT) save as:test.py in windows cmd use command: python test.py then it goes to infine loop but the same program works in Python IDLE. ---------- components: Library (Lib) messages: 322413 nosy: sanjay patel priority: normal severity: normal status: open title: subprocess.check_output goes to infinte loop type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 07:28:00 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 26 Jul 2018 11:28:00 +0000 Subject: [New-bugs-announce] [issue34234] Use _PyAnyInt_Check() and _PyAnyInt_CheckExact() in 2.7 Message-ID: <1532604480.11.0.56676864532.issue34234@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The proposed PR adds two private helpers #define _PyAnyInt_Check(op) (PyInt_Check(op) || PyLong_Check(op)) #define _PyAnyInt_CheckExact(op) (PyInt_CheckExact(op) || PyLong_CheckExact(op)) and make it used it in the code. This may help to avoid bugs like issue34229. ---------- components: Interpreter Core messages: 322415 nosy: benjamin.peterson, serhiy.storchaka priority: normal severity: normal status: open title: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact() in 2.7 versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 09:04:17 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Thu, 26 Jul 2018 13:04:17 +0000 Subject: [New-bugs-announce] [issue34235] PyArg_ParseTupleAndKeywords: support required keyword arguments Message-ID: <1532610257.0.0.56676864532.issue34235@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : In Python the function can have 4 kinds of parameters: def f(a, b=1, *, c, d=2): 1. a is a required positional-or-keyword parameter. 2. b is an optional positional-or-keyword parameter. 3. c is a required keyword-only parameter. 4. d is an optional keyword-only parameter. But PyArg_ParseTupleAndKeywords() supports only 3 of them. Keyword-only parameters can only be optional. PyArg_ParseTupleAndKeywords(args, kwds, "O|O$O", kwlist, &a, &b, &d) This makes impossible using PyArg_ParseTupleAndKeywords() for haslib.scrypt(). Currently it parses all keyword-only arguments as optional, and checks that they are specified specially, but this does not allow to use the full power of the PyArg_Parse* API. ---------- assignee: serhiy.storchaka components: Interpreter Core messages: 322419 nosy: serhiy.storchaka priority: normal severity: normal status: open title: PyArg_ParseTupleAndKeywords: support required keyword arguments type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 09:42:17 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Thu, 26 Jul 2018 13:42:17 +0000 Subject: [New-bugs-announce] [issue34236] Test6012 in test_capi is not run as part of make test Message-ID: <1532612537.28.0.56676864532.issue34236@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : Test6012 is not run as part of make test since it's not added to support.run_unittest at the end of the file. Hence running the test as a single file causes error. It seems argparsing related test which is a part of _testcapi.module.c in Python 3 branch was not cleanly backported and I tried backporting it but it requires PyUnicode_FSConverter which I think is Python 3 only. Since the test was not running during make test there was no error about this during backporting during merge. Relevant backport commit : ef19fd200d0768919f1658466f8b6080b191fba0 # No argparsing defined in _testcapimodule.c ? cpython git:(1c8f655) grep -inr argparsing * Lib/test/test_capi.py:108: self.assertEqual(_testcapi.argparsing("Hello", "World"), 1) ? cpython git:(1c8f655) grep -inr PyUnicode_FSConverter * # Test case failure ? cpython git:(1c8f655) ./python -m unittest -v test.test_capi test_buildvalue_N (test.test_capi.CAPITest) ... ok test_bad_use (test.test_capi.SkipitemTest) ... ok test_parse_tuple_and_keywords (test.test_capi.SkipitemTest) ... ok test_skipitem (test.test_capi.SkipitemTest) ... ok test_skipitem_with_suffix (test.test_capi.SkipitemTest) ... ok test (test.test_capi.Test6012) ... ERROR test_pendingcalls_non_threaded (test.test_capi.TestPendingCalls) ... ok test_pendingcalls_threaded (test.test_capi.TestPendingCalls) ... ok test_thread_state (test.test_capi.TestThreadState) ... ok ====================================================================== ERROR: test (test.test_capi.Test6012) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/cpython/Lib/test/test_capi.py", line 108, in test self.assertEqual(_testcapi.argparsing("Hello", "World"), 1) AttributeError: 'module' object has no attribute 'argparsing' ---------------------------------------------------------------------- Ran 9 tests in 2.753s FAILED (errors=1) # Test passes because Test6012 is not added to support.run_unittest ? cpython git:(1c8f655) ./python Lib/test/test_capi.py internal test_L_code internal test_broken_memoryview internal test_buildvalue_N internal test_capsule internal test_config internal test_datetime_capi internal test_dict_iteration internal test_empty_argparse internal test_from_contiguous internal test_k_code internal test_lazy_hash_inheritance internal test_list_api internal test_long_and_overflow internal test_long_api internal test_long_long_and_overflow internal test_long_numbits internal test_longlong_api internal test_null_strings internal test_string_from_format internal test_to_contiguous internal test_u_code internal test_widechar internal test_with_docstring test_buildvalue_N (__main__.CAPITest) ... ok test_pendingcalls_non_threaded (__main__.TestPendingCalls) ... ok test_pendingcalls_threaded (__main__.TestPendingCalls) ... ok test_bad_use (__main__.SkipitemTest) ... ok test_parse_tuple_and_keywords (__main__.SkipitemTest) ... ok test_skipitem (__main__.SkipitemTest) ... ok test_skipitem_with_suffix (__main__.SkipitemTest) ... ok test_thread_state (__main__.TestThreadState) ... ok ---------------------------------------------------------------------- Ran 8 tests in 2.741s OK Adding serhiy.storchaka who did the relevant backport. Thanks ---------- components: Build messages: 322423 nosy: serhiy.storchaka, xtreak priority: normal severity: normal status: open title: Test6012 in test_capi is not run as part of make test versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 10:19:36 2018 From: report at bugs.python.org (Jonathan Fine) Date: Thu, 26 Jul 2018 14:19:36 +0000 Subject: [New-bugs-announce] [issue34237] faq/design: PEP 572 adds assignment expressions Message-ID: <1532614776.63.0.56676864532.issue34237@psf.upfronthosting.co.za> New submission from Jonathan Fine : The title says it all. faq/design: PEP 572 adds assignment expressions https://docs.python.org/3.8/faq/design.html#why-can-t-i-use-an-assignment-in-an-expression [Can't use] this C idiom: while (line = readline(f)) { // do something with line } https://www.python.org/dev/peps/pep-0572/ while chunk := file.read(8192): process(chunk) ---------- assignee: docs at python components: Documentation messages: 322430 nosy: docs at python, jfine2358 priority: normal severity: normal status: open title: faq/design: PEP 572 adds assignment expressions type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 12:44:44 2018 From: report at bugs.python.org (Jason) Date: Thu, 26 Jul 2018 16:44:44 +0000 Subject: [New-bugs-announce] [issue34238] When BROWSER is set on Mac webbrowser.register_standard_browsers doesn't work Message-ID: <1532623484.23.0.56676864532.issue34238@psf.upfronthosting.co.za> New submission from Jason : Description: When BROWSER is set, webbrowser.get fails because register_standard_browsers throws an error. Work around: You can still use `webbroswer._browsers[key][1].open(url)` to open a browser. Operating system: macOS High Sierra v10.13.6 Reproduction 1: ``` ? BROWSER=lynx python3 Python 3.7.0 (default, Jul 23 2018, 20:22:55) [Clang 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.get() Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 42, in get register_standard_browsers() File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 567, in register_standard_browsers cmd = _synthesize(cmdline, -1) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 116, in _synthesize register(browser, None, controller, update_tryorder) TypeError: register() takes from 2 to 3 positional arguments but 4 were given ``` Reproduction 2: ``` ? BROWSER=lynx python3 Python 3.7.0 (default, Jul 23 2018, 20:22:55) [Clang 9.1.0 (clang-902.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import webbrowser >>> webbrowser.register_standard_browsers() Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 567, in register_standard_browsers cmd = _synthesize(cmdline, -1) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/webbrowser.py", line 116, in _synthesize register(browser, None, controller, update_tryorder) TypeError: register() takes from 2 to 3 positional arguments but 4 were given >>> webbrowser.lynx Traceback (most recent call last): File "", line 1, in AttributeError: module 'webbrowser' has no attribute 'lynx' >>> webbrowser._browsers {'macosx': [None, ], 'chrome': [None, ], 'firefox': [None, ], 'safari': [None, ], 'lynx': [None, ]} >>> webbrowser._browsers['lynx'].open('http://google.com') Traceback (most recent call last): File "", line 1, in AttributeError: 'list' object has no attribute 'open' >>> webbrowser._browsers['lynx'][1].open('http://google.com') # This works True ``` ---------- components: macOS messages: 322439 nosy: ned.deily, ograycode, ronaldoussoren priority: normal severity: normal status: open title: When BROWSER is set on Mac webbrowser.register_standard_browsers doesn't work type: crash versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 13:28:08 2018 From: report at bugs.python.org (Tim Golden) Date: Thu, 26 Jul 2018 17:28:08 +0000 Subject: [New-bugs-announce] [issue34239] Convert test_bz2 to use tempfile Message-ID: <1532626088.94.0.56676864532.issue34239@psf.upfronthosting.co.za> New submission from Tim Golden : test_bz2 currently uses the test.support.TESTFN functionality which creates a temporary file local to the test directory named around the pid. This can give rise to race conditions where tests are competing with each other to delete and recreate the file. ---------- assignee: tim.golden messages: 322441 nosy: tim.golden priority: normal severity: normal status: open title: Convert test_bz2 to use tempfile type: behavior versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 15:22:54 2018 From: report at bugs.python.org (Tim Golden) Date: Thu, 26 Jul 2018 19:22:54 +0000 Subject: [New-bugs-announce] [issue34240] Convert test_mmap to use tempfile Message-ID: <1532632974.46.0.56676864532.issue34240@psf.upfronthosting.co.za> New submission from Tim Golden : test_mmap currently uses the test.support.TESTFN functionality which creates a temporary file local to the test directory named around the pid. This can give rise to race conditions where tests are competing with each other to delete and recreate the file. ---------- assignee: tim.golden messages: 322444 nosy: tim.golden priority: normal severity: normal status: open title: Convert test_mmap to use tempfile versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 15:35:33 2018 From: report at bugs.python.org (vhelke) Date: Thu, 26 Jul 2018 19:35:33 +0000 Subject: [New-bugs-announce] [issue34241] Segfault while Django template rendering Message-ID: <1532633733.84.0.56676864532.issue34241@psf.upfronthosting.co.za> New submission from vhelke : I have found a segfault in Django 2.0 while rendering a template. Detailed info here, and instructions of how to reproduce the fault: ?https://github.com/vhelke/django-cas-crash *** Here are the traces I was able to collect. $ gdb python Program received signal SIGSEGV, Segmentation fault. 0x00007ffff711f547 in kill () at ../sysdeps/unix/syscall-template.S:81 81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS) (gdb) py-bt Traceback (most recent call first): File "/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/utils/autoreload.py", line 303, in python_reloader os.kill(os.getpid(), -exit_code) File "/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/utils/autoreload.py", line 317, in main python_reloader(wrapped_main_func, args, kwargs) File "/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 105, in run autoreload.main(self.inner_run, None, options) File "/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 98, in handle self.run(**options) File "/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/base.py", line 335, in execute output = self.handle(*args, **options) File "/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 61, in execute super().execute(*args, **options) File "/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **cmd_options) File "/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/__init__.py", line 365, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line utility.execute() File "manage.py", line 15, in execute_from_command_line(sys.argv) (gdb) bt #0 0x00007ffff711f547 in kill () at ../sysdeps/unix/syscall-template.S:81 #1 0x000000000054c420 in os_kill_impl (module=, signal=, pid=) at ./Modules/posixmodule.c:6534 #2 os_kill (module=module at entry=, args=args at entry=0x7fffea24d5b0, nargs=) at ./Modules/clinic/posixmodule.c.h:2624 #3 0x0000000000439dcd in _PyMethodDef_RawFastCallKeywords (kwnames=0x0, nargs=0, args=0x7fffea24d5b0, self=, method=0x8c8aa0 ) at Objects/call.c:651 #4 _PyCFunction_FastCallKeywords (func=, args=args at entry=0x7fffea24d5b0, nargs=nargs at entry=2, kwnames=kwnames at entry=0x0) at Objects/call.c:730 #5 0x0000000000428f1c in call_function (kwnames=0x0, oparg=2, pp_stack=) at Python/ceval.c:4547 #6 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3086 #7 0x000000000041fc18 in function_code_fastcall (co=, args=, nargs=3, globals=) at Objects/call.c:283 #8 0x00000000004392f6 in _PyFunction_FastCallKeywords (func=, stack=, nargs=, kwnames=) at Objects/call.c:415 #9 0x00000000004284bc in call_function (kwnames=0x0, oparg=, pp_stack=) at Python/ceval.c:4586 #10 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3117 #11 0x00000000004ec058 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7fffea3ecaf8, for file /home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/utils/autoreload.py, line 317, in main (main_func=, args=(), kwargs={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}, wrapped_main_func=)) at Python/ceval.c:547 #12 _PyEval_EvalCodeWithName (_co=, globals=, locals=locals at entry=0x0, args=, argcount=3, kwnames=0x0, kwargs=kwargs at entry=0x7fffeabfa1f0, kwcount=0, kwstep=kwstep at entry=1, defs=defs at entry=0x7fffefc93160, defcount=defcount at entry=2, kwdefs=kwdefs at entry=0x0, closure=closure at entry=0x0, name='main', qualname='main') at Python/ceval.c:3923 #13 0x0000000000439228 in _PyFunction_FastCallKeywords (func=, stack=, nargs=, kwnames=) at Objects/call.c:433 #14 0x0000000000428beb in call_function (kwnames=0x0, oparg=, pp_stack=) at Python/ceval.c:4586 #15 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3086 #16 0x00000000004ec058 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7fffeabfa048, for file /home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py, line 105, in run (self=, _style_func=, ending='\n') at remote 0x7fffeb311438>, stderr=, _style_func=, ending='\n') at remote 0x7fffead2cf60>, style=, SUCCESS=, WARNING=, NOTICE=, SQL_FIELD=, SQL_COLTYPE=, SQL_KEYWORD=, SQL_TABLE=, HTTP_INFO=, HTTP_SUCCESS=, HTTP_REDIRECT=, globals=globals at entry={'__name__': 'django.core.management.commands.runserver', '__doc__': None, '__package__': 'django.core.management.commands', '__loader__': , '__spec__': , origin='/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached='/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/__pycache__/runserver.cpython-37.pyc', _initializing=False) at remote 0x7fffebecf780>, '__file__': '/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py', '__cached__': '/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages...(truncated), locals=locals at entry=0x0, args=args at entry=0x7fffffffc560, argcount=argcount at entry=1, kwnames=kwnames at entry=0x7fffea234e60, kwargs=kwargs at entry=0x7fffea234e68, kwcount=22, kwcount at entry=11, kwstep=kwstep at entry=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name='run', qualname='Command.run') at Python/ceval.c:3923 #18 0x0000000000439017 in _PyFunction_FastCallDict (func=func at entry=, args=args at entry=0x7fffffffc560, nargs=nargs at entry=1, kwargs=kwargs at entry={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:376 #19 0x000000000043c739 in _PyObject_FastCallDict ( kwargs={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}, nargs=1, args=0x7fffffffc560, callable=) at Objects/call.c:98 #20 _PyObject_Call_Prepend (callable=, obj=, args=(), kwargs={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:904 #21 0x000000000043a628 in PyObject_Call (callable=callable at entry=, args=args at entry=(), kwargs=kwargs at entry={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:245 #22 0x0000000000423747 in do_call_core ( kwdict={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}, callargs=(), func=) at Python/ceval.c:4615 #23 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3184 ---Type to continue, or q to quit--- #24 0x00000000004ec058 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0xc87188, for file /home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py, line 98, in handle (self=, _style_func=, ending='\n') at remote 0x7fffeb311438>, stderr=, _style_func=, ending='\n') at remote 0x7fffead2cf60>, style=, SUCCESS=, WARNING=, NOTICE=, SQL_FIELD=, SQL_COLTYPE=, SQL_KEYWORD=, SQL_TABLE=, HTTP_INFO=, HTTP_SUCCESS=, HTTP_REDIRECT=, H...(truncated)) at Python/ceval.c:547 #25 _PyEval_EvalCodeWithName (_co=_co at entry=, globals=globals at entry={'__name__': 'django.core.management.commands.runserver', '__doc__': None, '__package__': 'django.core.management.commands', '__loader__': , '__spec__': , origin='/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached='/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/__pycache__/runserver.cpython-37.pyc', _initializing=False) at remote 0x7fffebecf780>, '__file__': '/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py', '__cached__': '/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages...(truncated), locals=locals at entry=0x0, args=args at entry=0x7fffffffc8d0, argcount=argcount at entry=1, kwnames=kwnames at entry=0x7fffea234ae0, kwargs=kwargs at entry=0x7fffea234ae8, kwcount=22, kwcount at entry=11, kwstep=kwstep at entry=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name='handle', qualname='Command.handle') at Python/ceval.c:3923 #26 0x0000000000439017 in _PyFunction_FastCallDict (func=func at entry=, args=args at entry=0x7fffffffc8d0, nargs=nargs at entry=1, kwargs=kwargs at entry={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:376 #27 0x000000000043c739 in _PyObject_FastCallDict ( kwargs={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}, nargs=1, args=0x7fffffffc8d0, callable=) at Objects/call.c:98 #28 _PyObject_Call_Prepend (callable=, obj=, args=(), kwargs={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:904 #29 0x000000000043a628 in PyObject_Call (callable=callable at entry=, args=args at entry=(), kwargs=kwargs at entry={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:245 #30 0x0000000000423747 in do_call_core ( kwdict={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}, callargs=(), func=) at Python/ceval.c:4615 #31 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3184 #32 0x00000000004ec058 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0xed1ec8, for file /home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/base.py, line 335, in execute (self=, _style_func=, ending='\n') at remote 0x7fffeb311438>, stderr=, _style_func=, ending='\n') at remote 0x7fffead2cf60>, style=, SUCCESS=, WARNING=, NOTICE=, SQL_FIELD=, SQL_COLTYPE=, SQL_KEYWORD=, SQL_TABLE=, HTTP_INFO=, HTTP_SUCCESS=, HTTP_REDIRECT=, HTTP_NOT_MODI...(truncated)) at Python/ceval.c:547 #33 _PyEval_EvalCodeWithName (_co=_co at entry=, globals=globals at entry={'__name__': 'django.core.management.base', '__doc__': '\nBase classes for writing management commands (named commands which can\nbe executed through ``django-admin`` or ``manage.py``).\n', '__package__': 'django.core.management', '__loader__': , '__spec__': , origin='/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/base.py', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached='/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/__pycache__/base.cpython-37.pyc', _initializing=False) at remote 0x7fffefd0ac50>, '__file__': '/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/base.py', '__cached__': '/home/vhelke/Envs/django-cas-crash/lib/p...(truncated), locals=locals at entry=0x0, args=args at entry=0x7fffffffcc40, argcount=argcount at entry=1, kwnames=kwnames at entry=0x7fffea234a00, kwargs=kwargs at entry=0x7fffea234a08, kwcount=22, kwcount at entry=11, kwstep=kwstep at entry=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name='execute', qualname='BaseCommand.execute') at Python/ceval.c:3923 #34 0x0000000000439017 in _PyFunction_FastCallDict (func=func at entry=, args=args at entry=0x7fffffffcc40, nargs=nargs at entry=1, kwargs=kwargs at entry={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:376 #35 0x000000000043c739 in _PyObject_FastCallDict ( kwargs={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': Tr---Type to continue, or q to quit--- ue, 'insecure_serving': False}, nargs=1, args=0x7fffffffcc40, callable=) at Objects/call.c:98 #36 _PyObject_Call_Prepend (callable=, obj=, args=(), kwargs={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:904 #37 0x000000000043a628 in PyObject_Call (callable=callable at entry=, args=args at entry=(), kwargs=kwargs at entry={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:245 #38 0x0000000000423747 in do_call_core ( kwdict={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}, callargs=(), func=) at Python/ceval.c:4615 #39 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3184 #40 0x00000000004ec058 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0xea1fe8, for file /home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py, line 61, in execute (self=, _style_func=, ending='\n') at remote 0x7fffeb311438>, stderr=, _style_func=, ending='\n') at remote 0x7fffead2cf60>, style=, SUCCESS=, WARNING=, NOTICE=, SQL_FIELD=, SQL_COLTYPE=, SQL_KEYWORD=, SQL_TABLE=, HTTP_INFO=, HTTP_SUCCESS=, HTTP_REDIRECT=, ...(truncated)) at Python/ceval.c:547 #41 _PyEval_EvalCodeWithName (_co=_co at entry=, globals=globals at entry={'__name__': 'django.core.management.commands.runserver', '__doc__': None, '__package__': 'django.core.management.commands', '__loader__': , '__spec__': , origin='/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py', loader_state=None, submodule_search_locations=None, _set_fileattr=True, _cached='/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/__pycache__/runserver.cpython-37.pyc', _initializing=False) at remote 0x7fffebecf780>, '__file__': '/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/commands/runserver.py', '__cached__': '/home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages...(truncated), locals=locals at entry=0x0, args=args at entry=0x7fffffffcfb0, argcount=argcount at entry=1, kwnames=kwnames at entry=0x7fffea3c4d80, kwargs=kwargs at entry=0x7fffea3c4d88, kwcount=22, kwcount at entry=11, kwstep=kwstep at entry=2, defs=0x0, defcount=0, kwdefs=0x0, closure=(,), name='execute', qualname='Command.execute') at Python/ceval.c:3923 #42 0x0000000000439017 in _PyFunction_FastCallDict (func=func at entry=, args=args at entry=0x7fffffffcfb0, nargs=nargs at entry=1, kwargs=kwargs at entry={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:376 #43 0x000000000043c739 in _PyObject_FastCallDict ( kwargs={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}, nargs=1, args=0x7fffffffcfb0, callable=) at Objects/call.c:98 #44 _PyObject_Call_Prepend (callable=, obj=, args=(), kwargs={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:904 #45 0x000000000043a628 in PyObject_Call (callable=callable at entry=, args=args at entry=(), kwargs=kwargs at entry={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}) at Objects/call.c:245 #46 0x0000000000423747 in do_call_core ( kwdict={'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'addrport': None, 'use_ipv6': False, 'use_threading': True, 'use_reloader': True, 'use_static_handler': True, 'insecure_serving': False}, callargs=(), func=) at Python/ceval.c:4615 #47 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3184 #48 0x000000000041fc18 in function_code_fastcall (co=, args=, nargs=2, globals=) at Objects/call.c:283 #49 0x00000000004392f6 in _PyFunction_FastCallKeywords (func=, stack=, nargs=, kwnames=) at Objects/call.c:415 #50 0x0000000000428482 in call_function (kwnames=0x0, oparg=, pp_stack=) at Python/ceval.c:4586 #51 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3103 #52 0x000000000041fc18 in function_code_fastcall (co=, args=, nargs=1, globals=) at Objects/call.c:283 #53 0x00000000004392f6 in _PyFunction_FastCallKeywords (func=, stack=, nargs=, kwnames=) at Objects/call.c:415 #54 0x0000000000428482 in call_function (kwnames=0x0, oparg=, pp_stack=) at Python/ceval.c:4586 #55 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3103 #56 0x00000000004ec058 in PyEval_EvalFrameEx (throwflag=0, ---Type to continue, or q to quit--- f=Frame 0x7ffff7f80be8, for file /home/vhelke/Envs/django-cas-crash/lib/python3.7/site-packages/django/core/management/__init__.py, line 371, in execute_from_command_line (argv=['manage.py', 'runserver'], utility=)) at Python/ceval.c:547 #57 _PyEval_EvalCodeWithName (_co=, globals=, locals=locals at entry=0x0, args=, argcount=1, kwnames=0x0, kwargs=kwargs at entry=0x7ffff7f80b70, kwcount=0, kwstep=kwstep at entry=1, defs=defs at entry=0x7fffefd82e28, defcount=defcount at entry=1, kwdefs=kwdefs at entry=0x0, closure=closure at entry=0x0, name='execute_from_command_line', qualname='execute_from_command_line') at Python/ceval.c:3923 #58 0x0000000000439228 in _PyFunction_FastCallKeywords (func=, stack=, nargs=, kwnames=) at Objects/call.c:433 #59 0x00000000004284bc in call_function (kwnames=0x0, oparg=, pp_stack=) at Python/ceval.c:4586 #60 _PyEval_EvalFrameDefault (f=, throwflag=) at Python/ceval.c:3117 #61 0x00000000004ec058 in PyEval_EvalFrameEx (throwflag=0, f=Frame 0x7ffff7f809f8, for file manage.py, line 15, in ()) at Python/ceval.c:547 #62 _PyEval_EvalCodeWithName (_co=_co at entry=, globals=globals at entry=, locals=locals at entry='manage.py', args=args at entry=0x0, argcount=argcount at entry=0, kwnames=kwnames at entry=0x0, kwargs=kwargs at entry=0x0, kwcount=kwcount at entry=0, kwstep=kwstep at entry=2, defs=defs at entry=0x0, defcount=defcount at entry=0, kwdefs=kwdefs at entry=0x0, closure=closure at entry=0x0, name=name at entry=0x0, qualname=qualname at entry=0x0) at Python/ceval.c:3923 #63 0x00000000004ec180 in PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, defcount=0, defs=0x0, kwcount=0, kws=0x0, argcount=0, args=0x0, locals=locals at entry='manage.py', globals=globals at entry=, _co=_co at entry=) at Python/ceval.c:3952 #64 PyEval_EvalCode (co=co at entry=, globals=globals at entry={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': , '__spec__': None, '__annotations__': {}, '__builtins__': , '__file__': 'manage.py', '__cached__': None, 'os': , 'sys': , 'execute_from_command_line': }, locals=locals at entry={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': , '__spec__': None, '__annotations__': {}, '__builtins__': , '__file__': 'manage.py', '__cached__': None, 'os': , 'sys': , 'execute_from_command_line': }) at Python/ceval.c:524 #65 0x0000000000526df8 in run_mod (arena=0x7ffff7fcf180, flags=0x7fffffffda20, locals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': , '__spec__': None, '__annotations__': {}, '__builtins__': , '__file__': 'manage.py', '__cached__': None, 'os': , 'sys': , 'execute_from_command_line': }, globals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': , '__spec__': None, '__annotations__': {}, '__builtins__': , '__file__': 'manage.py', '__cached__': None, 'os': , 'sys': , 'execute_from_command_line': }, filename='manage.py', mod=0x96cae0) at Python/pythonrun.c:1035 #66 PyRun_FileExFlags (fp=0x980770, filename_str=, start=, globals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': , '__spec__': None, '__annotations__': {}, '__builtins__': , '__file__': 'manage.py', '__cached__': None, 'os': , 'sys': , 'execute_from_command_line': }, locals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': , '__spec__': None, '__annotations__': {}, '__builtins__': , '__file__': 'manage.py', '__cached__': None, 'os': , 'sys': , 'execute_from_command_line': }, closeit=1, flags=0x7fffffffda20) at Python/pythonrun.c:988 #67 0x0000000000526fdd in PyRun_SimpleFileExFlags (fp=0x980770, filename=, closeit=1, flags=0x7fffffffda20) at Python/pythonrun.c:430 #68 0x000000000042d90c in pymain_run_file (p_cf=0x7fffffffda20, filename=0x929450 L"manage.py", fp=0x980770) at Modules/main.c:425 #69 pymain_run_filename (cf=0x7fffffffda20, pymain=0x7fffffffdb20) at Modules/main.c:1520 #70 pymain_run_python (pymain=0x7fffffffdb20) at Modules/main.c:2520 #71 pymain_main (pymain=pymain at entry=0x7fffffffdb20) at Modules/main.c:2662 #72 0x000000000042e0dc in _Py_UnixMain (argc=, argv=) at Modules/main.c:2697 #73 0x00007ffff710b445 in __libc_start_main (main=0x41fba0
, argc=3, ubp_av=0x7fffffffdd48, init=, fini=, rtld_fini=, stack_end=0x7fffffffdd38) at ../csu/libc-start.c:274 #74 0x0000000000429924 in _start () (gdb) ---------- messages: 322445 nosy: vhelke priority: normal severity: normal status: open title: Segfault while Django template rendering type: crash versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 16:23:23 2018 From: report at bugs.python.org (Stig Johan Berggren) Date: Thu, 26 Jul 2018 20:23:23 +0000 Subject: [New-bugs-announce] [issue34242] configparser: SectionProxy.get is silent on missing options Message-ID: <1532636603.09.0.56676864532.issue34242@psf.upfronthosting.co.za> New submission from Stig Johan Berggren : `get()` on a ConfigParser object behaves differently from `get()` on a section. The former raises an exception when the key does not exist and no fallback has been explicitly set. The latter returns None, with no option to raise an error for missing keys. I think this is confusing, and that both classes should have the same behaviour. I prefer raising an error, as it makes it easier to find errors such as typos in config files. In addition, the docs state that the "parser-level `get` method provides a custom, more complex interface, maintained for backwards compatibility". The SectionProxy `get` method internally uses the parser-level `get`, so it seems unlikely that it is only maintained for backwards compatibility. My proposed change is not backwards compatible, as any code that relies on a None being returned when a key does not exist would have to make this explicit through the fallback argument in `get`. Here is the current behaviour in the latest build (3.8.0a0): >>> import configparser >>> c = configparser.ConfigParser() >>> c.add_section('spam') >>> c['spam'].get('eggs') # Returns None >>> c['spam']['eggs'] Traceback (most recent call last): ... KeyError: 'eggs' >>> c.get('spam', 'eggs') Traceback (most recent call last): ... configparser.NoOptionError: No option 'eggs' in section: 'spam' >>> ---------- components: Library (Lib) messages: 322448 nosy: Stig Johan Berggren priority: normal severity: normal status: open title: configparser: SectionProxy.get is silent on missing options type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jul 26 19:54:56 2018 From: report at bugs.python.org (zerx) Date: Thu, 26 Jul 2018 23:54:56 +0000 Subject: [New-bugs-announce] [issue34243] pty.spawn: inconsistent interface Message-ID: <1532649296.79.0.56676864532.issue34243@psf.upfronthosting.co.za> New submission from zerx : # spawn(argv, master_read=_read, stdin_read=_read) With stdin_read function it's possible to customize how one can read from stdin, but it makes little sense without stdout counterpart. For example, you cannot use a wrapped ssl socket to forward a terminal over secure connection, because os.write(STDOUT_FILENO, data) is not suitable for ssl sockets. The proposal is to add stdout_write argument. diff --git a/pty.py b/pty.py index e841f12..ed4a12f 100644 --- a/pty.py +++ b/pty.py @@ -126,10 +126,10 @@ def _read(fd): """Default read function.""" return os.read(fd, 1024) -def _copy(master_fd, master_read=_read, stdin_read=_read): +def _copy(master_fd, master_read=_read, stdin_read=_read, stdout_write=_writen): """Parent copy loop. Copies - pty master -> standard output (master_read) + pty master -> standard output (master_read, stdout_write) standard input -> pty master (stdin_read)""" fds = [master_fd, STDIN_FILENO] while True: @@ -139,7 +139,7 @@ def _copy(master_fd, master_read=_read, stdin_read=_read): if not data: # Reached EOF. fds.remove(master_fd) else: - os.write(STDOUT_FILENO, data) + stdout_write(STDOUT_FILENO, data) if STDIN_FILENO in rfds: data = stdin_read(STDIN_FILENO) if not data: @@ -147,7 +147,7 @@ def _copy(master_fd, master_read=_read, stdin_read=_read): else: _writen(master_fd, data) -def spawn(argv, master_read=_read, stdin_read=_read): +def spawn(argv, master_read=_read, stdin_read=_read, stdout_write=_writen): """Create a spawned process.""" if type(argv) == type(''): argv = (argv,) @@ -161,7 +161,7 @@ def spawn(argv, master_read=_read, stdin_read=_read): except tty.error: # This is the same as termios.error restore = 0 try: - _copy(master_fd, master_read, stdin_read) + _copy(master_fd, master_read, stdin_read, stdout_write) except OSError: if restore: tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) ---------- components: Library (Lib) messages: 322452 nosy: statix priority: normal severity: normal status: open title: pty.spawn: inconsistent interface type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 27 01:15:40 2018 From: report at bugs.python.org (Chetan kolhe) Date: Fri, 27 Jul 2018 05:15:40 +0000 Subject: [New-bugs-announce] [issue34244] Add support of check logger Message-ID: <1532668540.12.0.56676864532.issue34244@psf.upfronthosting.co.za> New submission from Chetan kolhe : Add support in logging library which will check whether the logger object already created or not . Module:- logging Code:- def check_logger(self, logger_name): """ Description :- It will check whether the logger object is already present or not . :param logger_name: :return: True/False """ if Logger.manager.loggerDict.get(logger_name): return False else: return True ---------- components: Library (Lib) messages: 322462 nosy: chetankolhe priority: normal severity: normal status: open title: Add support of check logger type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 27 03:48:30 2018 From: report at bugs.python.org (Jeroen Demeyer) Date: Fri, 27 Jul 2018 07:48:30 +0000 Subject: [New-bugs-announce] [issue34245] Python library should be installed writable Message-ID: <1532677710.44.0.56676864532.issue34245@psf.upfronthosting.co.za> New submission from Jeroen Demeyer : In Makefile.pre.in, there is this: # Shared libraries must be installed with executable mode on some systems; # rather than figuring out exactly which, we always give them executable mode. # Also, making them read-only seems to be a good idea... INSTALL_SHARED= ${INSTALL} -m 555 Installing libraries read-only is very non-standard (I'm not aware of any other build system which does that). Python should just use the more standard 755 install mode. ---------- components: Build messages: 322469 nosy: jdemeyer priority: normal severity: normal status: open title: Python library should be installed writable 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 Jul 27 06:02:13 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Fri, 27 Jul 2018 10:02:13 +0000 Subject: [New-bugs-announce] [issue34246] Gentoo Refleaks 3.7: test_smtplib has dangling threads Message-ID: <1532685733.19.0.56676864532.issue34246@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : The Gentoo Refleaks 3.7 buildbot is reporting that test_smtplib may be leaving with dangling threads: https://buildbot.python.org/all/#builders/114/builds/179 FAILED (errors=7) Warning -- threading._dangling was modified by test_smtplib Before: <_weakrefset.WeakSet object at 0xb6918bcc> After: <_weakrefset.WeakSet object at 0xb68e761c> test test_smtplib failed 1 test failed again: test_smtplib == Tests result: FAILURE then FAILURE == ---------- messages: 322481 nosy: pablogsal priority: normal severity: normal status: open title: Gentoo Refleaks 3.7: test_smtplib has dangling threads _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 27 08:07:30 2018 From: report at bugs.python.org (Ronald Oussoren) Date: Fri, 27 Jul 2018 12:07:30 +0000 Subject: [New-bugs-announce] [issue34247] PYTHONOPTIMZE ignored in 3.7.0 when using custom launcher Message-ID: <1532693250.08.0.56676864532.issue34247@psf.upfronthosting.co.za> New submission from Ronald Oussoren : Attached is a very basic launcher for python scripts. This script works as expected in Python 3.6, but not in 3.7.0. In particular, the launcher sets the environment variable PYTHONOPTIMIZE before calling Py_Initialize and that setting is ignored. I haven't tried testing with the tip of the tree yet. ---------- components: Interpreter Core keywords: 3.7regression messages: 322487 nosy: ronaldoussoren priority: normal severity: normal status: open title: PYTHONOPTIMZE ignored in 3.7.0 when using custom launcher type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 27 09:33:58 2018 From: report at bugs.python.org (sds) Date: Fri, 27 Jul 2018 13:33:58 +0000 Subject: [New-bugs-announce] [issue34248] dbm errors should contain file names Message-ID: <1532698438.31.0.56676864532.issue34248@psf.upfronthosting.co.za> New submission from sds : `dbm` errors should contain file names when appropriate, just like `OSError`. E.g.: ``` >>> open("fooooo") Traceback (most recent call last): File "", line 1, in FileNotFoundError: [Errno 2] No such file or directory: 'fooooo' >>> import dbm.gnu >>> dbm.gnu.open("fooooo") Traceback (most recent call last): File "", line 1, in _gdbm.error: [Errno 2] No such file or directory ``` the `_gdbm.error` should report the file name `'fooooo'` just like `FileNotFoundError` does (and `exn.args` should contain the file name too!) ---------- components: Extension Modules messages: 322492 nosy: sam-s priority: normal severity: normal status: open title: dbm errors should contain file names 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 Jul 27 11:07:15 2018 From: report at bugs.python.org (v kats) Date: Fri, 27 Jul 2018 15:07:15 +0000 Subject: [New-bugs-announce] [issue34249] Full set of format codes applies to strftime only Message-ID: <1532704035.87.0.56676864532.issue34249@psf.upfronthosting.co.za> New submission from v kats : Section "strftime() and strptime() Behavior" says: "The full set of format codes supported varies across platforms, because Python calls the platform C library?s strftime() function, and platform variations are common. To see the full set of format codes supported on your platform, consult the strftime(3) documentation." It implies that this applies for strftime only, and indeed it refers to C library?s strftime(). However, it's easy to miss (at least I got confused and lost some time), so I propose to clarify the paragraph. strptime and %s # python Python 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from datetime import datetime >>> datetime.strptime('1532689414','%s') Traceback (most recent call last): File "", line 1, in strftime and %s python Python 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from datetime import datetime >>> datetime.now().strftime('%s') '1532702817' File "/usr/lib/python2.7/_strptime.py", line 317, in _strptime (bad_directive, format)) ValueError: 's' is a bad directive in format '%s' ---------- assignee: docs at python components: Documentation messages: 322498 nosy: docs at python, v kats priority: normal severity: normal status: open title: Full set of format codes applies to strftime only type: enhancement versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 27 12:17:54 2018 From: report at bugs.python.org (=?utf-8?q?Fekete_Gy=C3=B6rgy?=) Date: Fri, 27 Jul 2018 16:17:54 +0000 Subject: [New-bugs-announce] [issue34250] import xmlrpclib not works in file named "xml.py" Message-ID: <1532708274.27.0.56676864532.issue34250@psf.upfronthosting.co.za> New submission from Fekete Gy?rgy : Big magic in python 2.7.15 win version: Create file: "xml.py" containing 2 code lines: import xmlrpclib proxy = xmlrpclib.ServerProxy("http://localhost:8000/") run it, and it gives u a nice error: C:\work\mitre>\Python27\python.exe xml.py Traceback (most recent call last): File "xml.py", line 1, in import xmlrpclib File "C:\Python27\lib\xmlrpclib.py", line 538, in from xml.parsers import expat File "C:\work\mitre\xml.py", line 3, in proxy = xmlrpclib.ServerProxy("http://localhost:8000/") AttributeError: 'module' object has no attribute 'ServerProxy' U also get this error, when this file present in the directory where u want to import xmlrpclib in another py. ANd if only the compiled xml.pyc exist, the bug comes. But if you rename it to xm.py, it works! Maybe a bad import from wrong directory in xmlrpclib. Not tested on another version or platform. ---------- components: Windows files: xml.py messages: 322505 nosy: fgyuri, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: import xmlrpclib not works in file named "xml.py" type: compile error versions: Python 2.7 Added file: https://bugs.python.org/file47718/xml.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 27 15:52:35 2018 From: report at bugs.python.org (Kay Hayen) Date: Fri, 27 Jul 2018 19:52:35 +0000 Subject: [New-bugs-announce] [issue34251] MSI build fails Message-ID: <1532721155.89.0.56676864532.issue34251@psf.upfronthosting.co.za> New submission from Kay Hayen : Hello there, building an MSI for my project fails. I am calling it like this: assert subprocess.call( ( sys.executable, "setup.py", "bdist_msi", "--target-version=" + sys.version[:3] ) ) == 0 Giving the target version is probably non-sense and from a time, where one script was building multiple MSIs, I no longer do that. and it gives: File "C:\Python37_64\lib\site-packages\setuptools\__init__.py", line 129, in setup return distutils.core.setup(**attrs) File "C:\Python37_64\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Python37_64\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File "C:\Python37_64\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "C:\Python37_64\lib\distutils\command\bdist_msi.py", line 256, in run self.add_find_python() File "C:\Python37_64\lib\distutils\command\bdist_msi.py", line 346, in add_find_python if msilib.Win64: AttributeError: module 'msilib' has no attribute 'Win64' This happens for 32 and 64 bit CPython 3.7.0 installations. The same code works for all of 2.7, 3.3 through to 3.6, so this is a regression. Any idea? Thanks, Kay ---------- components: Distutils messages: 322510 nosy: dstufft, eric.araujo, kayhayen priority: normal severity: normal status: open title: MSI build fails type: crash versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 27 16:05:42 2018 From: report at bugs.python.org (Alberto) Date: Fri, 27 Jul 2018 20:05:42 +0000 Subject: [New-bugs-announce] [issue34252] Bunch of path leaks on Python 3.7 on Release Message-ID: <1532721942.43.0.56676864532.issue34252@psf.upfronthosting.co.za> New submission from Alberto : I've downloaded and compiled from sources Python 3.7 in windows. The compilation process goes great but there are a lot of paths (using __FILE__ in the source) that gets leaked in the Release version and that should not happen. This is because __FILE__ is used outside of assert or DEBUG ifdefs which should be avoided. Here is the list I've got after doing a strings on a build release: c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\typeobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\python\import.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\moduleobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\longobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\python\getargs.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\frameobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\gcmodule.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\object.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\listobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\fileobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\dictobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\python\traceback.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\tupleobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\classobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\unicodeobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\bytearrayobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\setobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\bytesobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\weakrefobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\cellobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\iterobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\objects\codeobject.c c:\users\mysupersecretuser\downloads\python-3.7.0_\python\ast.c c:\users\mysupersecretuser\downloads\python-3.7.0_\python\pystrtod.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\_asynciomodule.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\arraymodule.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\_sha3\sha3module.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\parsermodule.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\zipimport.c FFI_TRAMPOLINE_SIZE too small in c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\_ctypes\libffi_msvc\ffi.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\_decimal\libmpdec\typearith.h c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\_decimal\libmpdec\mpdecimal.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\_decimal\libmpdec\context.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\_ssl.c c:\users\mysupersecretuser\downloads\python-3.7.0_\modules\pyexpat.c ---------- components: Build messages: 322512 nosy: illera88 priority: normal severity: normal status: open title: Bunch of path leaks on Python 3.7 on Release type: enhancement versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jul 27 19:28:13 2018 From: report at bugs.python.org (Novel) Date: Fri, 27 Jul 2018 23:28:13 +0000 Subject: [New-bugs-announce] [issue34253] Tkinter- On windows, calling filedialog or messagebox before the window is drawn causes focus issues Message-ID: <1532734093.09.0.56676864532.issue34253@psf.upfronthosting.co.za> New submission from Novel : Code to reproduce the problem: ``` import tkinter as tk from tkinter.messagebox import showinfo root = tk.Tk() entry = tk.Entry(root) entry.pack() # root.update() # remove comment to fix the problem showinfo('alert', 'this parrot is dead!') root.mainloop() ``` Running this code will show the alert, and when the user clicks "ok" the entry widget acts as if it's disabled and won't focus. Minimizing and restoring the tkinter window brings the entry widget back to normal operation. Workaround: Calling `update()` before the messagebox or filedialog call gives normal behaviour. This issue only affects Windows as far as I can tell. ---------- components: Tkinter messages: 322516 nosy: nyt priority: normal severity: normal status: open title: Tkinter- On windows, calling filedialog or messagebox before the window is drawn causes focus issues versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 03:48:32 2018 From: report at bugs.python.org (Karthikeyan Singaravelan) Date: Sat, 28 Jul 2018 07:48:32 +0000 Subject: [New-bugs-announce] [issue34254] Include type annotations in error messages for better errors Message-ID: <1532764112.96.0.56676864532.issue34254@psf.upfronthosting.co.za> New submission from Karthikeyan Singaravelan : Python 3 supports type annotations in functions but when there is a TypeError due to calling a function then only the arguments are given in the error message. If the function has type annotations then adding them to the error message will give better experience and context. This doesn't break any existing code without type annotations but improves errors for code that has type annotations giving a better error reporting experience. Currently format_missing method one of the methods used to raise TypeError that returns the name of the required positional arguments. The function receives the code object and type annotations are present in the function object. Hence I have used the code_object->co_name to get the function object from globals. After getting the function object I go through the annotations if present to form an error message to be attached with the existing error message. I have implemented it in my branch : https://github.com/tirkarthi/cpython/tree/error-message-annotations # foo_signature.py from typing import List, Dict, NoReturn def get_profile_a(user_id: int, likes: Dict[str, int]) -> Dict[str, int]: return {'user_id': user_id, 'likes': len(likes.keys())} if __name__ == "__main__": get_profile_a() # Error message for functions without type hints patch cpython git:(master) ? ./python foo_signature.py Traceback (most recent call last): File "foo_signature.py", line 11, in get_profile_a() TypeError: get_profile_a() missing 2 required positional arguments: 'user_id' and 'likes' # Error message for functions with type hints patch in my branch cpython git:(error-message-annotations) ? ./python foo_signature.py Traceback (most recent call last): File "foo_signature.py", line 11, in get_profile_a() TypeError: get_profile_a() missing 2 required positional arguments: 'user_id' and 'likes' Annotation: (user_id: , likes: typing.Dict[str, int], return: typing.Dict[str, int]) The proposed patch adds the annotations in the end thus giving more context to the user. Pros : * Better error reporting and more context that helps beginners like Elm/Rust that have improved error messages. * This will also motivate developers to write type annotations since error messages become more useful. Cons : * Since code_object is present in the call site where TypeError is raised I need to do a lookup of the globals to get the function object. This can be fixed in the way get_type_hints works on a function object. This also blocks me from writing tests where the function is defined inside a class that inherits from unittest.TestCase. * After getting the annotations I need to form a string with the relevant parameters. Since most of them are hash lookups I don't think there is a cost involved here. Most of the time TypeError is raised to the user. My C skills are also low and I hope code can be improved much better here. I am good with the core team rejecting this patch but just wanted to put forward the idea. I have also created a thread in python-ideas mailing list to gather feedback about this and hope it gains some traction. I received good feedback from Ethan Smith, mypy core developer on Reddit : https://www.reddit.com/r/Python/comments/92eh1g/type_annotations_in_error_messages_for_better/e3655z1/ python-ideas thread : https://mail.python.org/pipermail/python-ideas/2018-July/052463.html I am adding Raymond and Terry since the previous PRs I have raised regarding error messages were reviewed by them. Also from the past discussions they make decisions on whether the change and it's effect is worth enough to be added to the core given the implementation complexity. Feel free to un-assign yourself if this is irrelevant. Thanks ---------- components: Interpreter Core messages: 322527 nosy: rhettinger, terry.reedy, xtreak priority: normal severity: normal status: open title: Include type annotations in error messages for better errors type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 05:23:42 2018 From: report at bugs.python.org (Ronald Oussoren) Date: Sat, 28 Jul 2018 09:23:42 +0000 Subject: [New-bugs-announce] [issue34255] test_embed skipped when srcdir != builddir Message-ID: <1532769822.63.0.56676864532.issue34255@psf.upfronthosting.co.za> New submission from Ronald Oussoren : The testsuite skips test_embed when srcdir != builddir, that's because test.test_embed assumes that _testembed is in the source directory. I noticed this while working on issue34247. ---------- components: Tests messages: 322531 nosy: ronaldoussoren priority: normal severity: normal stage: needs patch status: open title: test_embed skipped when srcdir != builddir type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 06:09:09 2018 From: report at bugs.python.org (Tim McNamara) Date: Sat, 28 Jul 2018 10:09:09 +0000 Subject: [New-bugs-announce] [issue34256] Python treats ASCII record seperator ('\x1e as a newline Message-ID: <1532772549.2.0.56676864532.issue34256@psf.upfronthosting.co.za> New submission from Tim McNamara : Hello, I apologize if this is expected behavior, however it doesn't appear to be documented haven't. >>> "single\x1eline\x1estring".splitlines() ['single', 'line', 'string'] ---------- messages: 322537 nosy: timClicks priority: normal severity: normal status: open title: Python treats ASCII record seperator ('\x1e as a newline versions: Python 3.5, Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 06:31:52 2018 From: report at bugs.python.org (Rico Lin) Date: Sat, 28 Jul 2018 10:31:52 +0000 Subject: [New-bugs-announce] [issue34257] SSL should accept cert content, instead of just cert file path Message-ID: <1532773912.07.0.56676864532.issue34257@psf.upfronthosting.co.za> New submission from Rico Lin : Currently, SSL module [1] only allows file path as input. That led to a lot of libraries only accept file path to a local file. This lead to issues when people who trigger this python code, didn't have any right to access a local file. Here are two examples: 1. In multi-cloud orchestration service design, you (as an operator) like to create resources in another cloud with orchestration service(like Heat in OpenStack), but you like to set up SSL for this connection. You should not allow accessing a local file from the first cloud (where the orchestration service is running). And you can't guarantee the first cloud provider allow you to inject a Cert file in their environment. In this case we need to allow operators to input their own cert information and parse it to ssl option for request. 2. Serverless. In serverless, we give a python code and cloud will provide an environment to run it. We can try to inject cert when we try to create environment for operators, but it will be more secure to directly pass it to python instead of store it around. The first case is what we're looking for an answer. Didn't look into the design for the second case, but I guess that might face the same issue. [1] https://github.com/python/cpython/blob/master/Modules/_ssl.c#L3683 ---------- assignee: christian.heimes components: SSL messages: 322539 nosy: christian.heimes, rico-lin priority: normal severity: normal status: open title: SSL should accept cert content, instead of just cert file path type: enhancement versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 06:59:29 2018 From: report at bugs.python.org (Aleksa Bulatovic) Date: Sat, 28 Jul 2018 10:59:29 +0000 Subject: [New-bugs-announce] [issue34258] Python shell keeps restarting Message-ID: <1532775569.15.0.56676864532.issue34258@psf.upfronthosting.co.za> New submission from Aleksa Bulatovic : I was writing a code for my test in idle python.When i run the module it's just keeps restarting. This is my code: sins = 0 check = input() if check == "check_sins": print(sins) second = input("Ok,you can start when you are ready,type Im Ready! if you want to start the game") print("Welcome to How smart are you test") name = input("What's your name? ") print(name) if name == "Dimitrije": print("Nice to meet you Dimitrije") start = input("Ready to start the test: ") if start == "Yes": print("A) Gorillaz") print("B) Alvin and the chipmunks") print("C) Despacito 2") print("D) Who are you even") q1 = input("Which was the first animated band ever created? ") a1 = "A) Gorillaz" b1 = "B) Alvin and the chipmunks" c1 = "C) Despacito 2" d1 = "D) Who are you even" if q1 == "A" or q1 == "a": print("You are right,adding 10 sins for that") sins += 10 else: sins = sins - 10 print("A) Milan") print("B) ") print("") print("") else: print(second) if start == "Im ready!": print("Ok,let's start") print(q1) print(a1) print(b1) print(c1) print(d1) if q1 == "A": print("You are right,adding 10 sins for that") sins = sins + 10 Note:I started learning python yesterday and sins are just a refrence of the youtube channel name called CinemaSins.So don't judge. ---------- components: Windows messages: 322542 nosy: Cross!Alex21, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Python shell keeps restarting versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 07:52:07 2018 From: report at bugs.python.org (Tim Hoffmann) Date: Sat, 28 Jul 2018 11:52:07 +0000 Subject: [New-bugs-announce] [issue34259] Improve docstring of list.sort Message-ID: <1532778727.04.0.56676864532.issue34259@psf.upfronthosting.co.za> New submission from Tim Hoffmann : The current docstring of list.sort is just "Stable sort *IN PLACE*." This is missing a description of the arguments key and reverse. Also a short explanation of stable and in-place would be helpful for less experienced users. ---------- messages: 322545 nosy: timhoffm priority: normal pull_requests: 8036 severity: normal status: open title: Improve docstring of list.sort type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 08:43:01 2018 From: report at bugs.python.org (Zsolt Cserna) Date: Sat, 28 Jul 2018 12:43:01 +0000 Subject: [New-bugs-announce] [issue34260] shutil.copy2 is not the same as cp -p Message-ID: <1532781781.14.0.56676864532.issue34260@psf.upfronthosting.co.za> New submission from Zsolt Cserna : The docstring of shutil.copy2 says the following: Copy data and all stat info ("cp -p src dst"). This can be misleading as it is not the same as 'cp -p', as it does not copy the file owner (uid and gid). That would need to have a chown() call to be made, which is currently not called unavailable. I would like to have the documentation fixed by adding that it does not copies file owner and group. ---------- components: Library (Lib) messages: 322551 nosy: csernazs priority: normal severity: normal status: open title: shutil.copy2 is not the same as cp -p versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 08:47:29 2018 From: report at bugs.python.org (Tim Hoffmann) Date: Sat, 28 Jul 2018 12:47:29 +0000 Subject: [New-bugs-announce] [issue34261] Add description to clinic.py Message-ID: <1532782049.63.0.56676864532.issue34261@psf.upfronthosting.co.za> New submission from Tim Hoffmann : When trying to update a docstring of a CPython builtin, I had problems finding out what Argument Clinic actually does. First, I looked at the devguide, which does only mention that the clinic exists, but not what it does or how it's used. Next, I tried "clinic.py --help". This unfortunately doesn't tell anything about itself. The actual clinic doc is at https://docs.python.org/3/howto/clinic.html To make the clinic a bit more discoverable, I propose a description including the link to clinic.py (see github #8518). ---------- components: Argument Clinic messages: 322552 nosy: larry, timhoffm priority: normal pull_requests: 8039 severity: normal status: open title: Add description to clinic.py versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 08:58:41 2018 From: report at bugs.python.org (=?utf-8?q?W=C3=B6llert?=) Date: Sat, 28 Jul 2018 12:58:41 +0000 Subject: [New-bugs-announce] [issue34262] Asyncio test fails under Win 7 Message-ID: <1532782721.54.0.56676864532.issue34262@psf.upfronthosting.co.za> New submission from W?llert : When running tests I encounter the following error for the test: test_sock_sendfile_not_regular_file (test.test_asyncio.test_proactor_events.ProactorEventLoopUnixSockSendfileTests) --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Debug Assertion Failed! Program: ...\EP2018\cpython\PCbuild\win32\python_d.exe File: minkernel\crts\ucrt\src\appcrt\lowio\osfinfo.cpp Line: 257 Expression: fh >= 0 && (unsigned)fh < (unsigned)_nhandle --------------------------- However, when ignoring the MSCR error, the tests succeed without failing. In addition the following failed (but not consistently): ====================================================================== FAIL: test_sendfile_close_peer_in_the_middle_of_receiving (test.test_asyncio.test_events.ProactorEventLoopTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\woellert\Desktop\EP2018\cpython\lib\test\test_asyncio\test_events.py", line 2510, in test_sendfile_close_peer_in_the_middle_of_receiving self.file.tell()) AssertionError: False is not true : 131072 ---------------------------------------------------------------------- Specs: Windows 7 SP1 64bit, Process: - Cloned master from github - Installed Visual Studio 2017 Community - Compiled with `PCbuild\build.bat -e -d` (also used 64bit via -p x64) - Ran tests with `python.bat -m test.test_asyncio -v` ---------- components: Build, Windows, asyncio messages: 322558 nosy: asvetlov, pansen, paul.moore, steve.dower, tim.golden, yselivanov, zach.ware priority: normal severity: normal status: open title: Asyncio test fails under Win 7 type: crash versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 09:49:09 2018 From: report at bugs.python.org (Yury Selivanov) Date: Sat, 28 Jul 2018 13:49:09 +0000 Subject: [New-bugs-announce] [issue34263] asyncio: "relative *delay* or absolute *when* should not exceed one day" Message-ID: <1532785749.04.0.56676864532.issue34263@psf.upfronthosting.co.za> New submission from Yury Selivanov : asyncio documentation has this bit on timeouts: Timeouts (relative *delay* or absolute *when*) should not exceed one day. Victor told me that the actual reason for this recommendation is a limitation in epoll (or other OS/selector) that prevents us from waiting for events longer than a day or so. The solution to this problem is simple: we need to cap the maximum time we pass to the "selector.select()" function (in base_events.py/_run_once) to one day. ---------- components: asyncio messages: 322561 nosy: asvetlov, vstinner, yselivanov priority: normal severity: normal status: open title: asyncio: "relative *delay* or absolute *when* should not exceed one day" versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 12:00:44 2018 From: report at bugs.python.org (Ronald Oussoren) Date: Sat, 28 Jul 2018 16:00:44 +0000 Subject: [New-bugs-announce] [issue34264] Inconsistency between stack size in main thread and secondary threads on macOS Message-ID: <1532793644.93.0.56676864532.issue34264@psf.upfronthosting.co.za> New submission from Ronald Oussoren : configure.ac sets the stack size for the main thread on macOS to 1000000 (hex), while Python/threading_pthread.h sets the default stack size for other threads to 0x500000. The latter is half of the former. IMHO both should be the same, as both claim to have been chosen to be just large enough to accommodate the default recursion limit. I'd prefer to increase the default stack size of secondary threads to match the main thread. I tagged this as a 3.8 thread because there is a (very) small chance that changing the stack size breaks existing programs (although you'd have to create a lot of threads to use a significant amount of memory). This is vaguely related to issue33955. ---------- components: Interpreter Core, macOS messages: 322569 nosy: ned.deily, ronaldoussoren priority: normal severity: normal stage: needs patch status: open title: Inconsistency between stack size in main thread and secondary threads on macOS type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 12:01:36 2018 From: report at bugs.python.org (Kay Hayen) Date: Sat, 28 Jul 2018 16:01:36 +0000 Subject: [New-bugs-announce] [issue34265] Dataclasses test doesn't run independently Message-ID: <1532793696.91.0.56676864532.issue34265@psf.upfronthosting.co.za> New submission from Kay Hayen : When I run: python3.7 test/test_dataclasses.py ====================================================================== ERROR: test_classvar_module_level_import (__main__.TestStringAnnotations) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/hayen/repos/Py2C/tests/CPython37/test/test_dataclasses.py", line 2716, in test_classvar_module_level_import from . import dataclass_module_1 ImportError: cannot import name 'dataclass_module_1' from '__main__' (/home/hayen/repos/Py2C/tests/CPython37/test/test_dataclasses.py) ====================================================================== FAIL: test_no_repr (__main__.TestRepr) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/hayen/repos/Py2C/tests/CPython37/test/test_dataclasses.py", line 1970, in test_no_repr repr(C(3))) AssertionError: 'test_dataclasses.TestRepr.test_no_repr..C object at' not found in '<__main__.TestRepr.test_no_repr..C object at 0x7f6a2d4ffd68>' The relative imports cannot work, as the main program is not in the test package. Also it has the name __main__ not the module name in repr. As Guido said in another bug report, tests are expected to pass. Can you please adapt them? I hope "Library" is proper component, as tests are below it. Thanks, Kay ---------- components: Library (Lib) messages: 322570 nosy: kayhayen priority: normal severity: normal status: open title: Dataclasses test doesn't run independently versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 19:24:25 2018 From: report at bugs.python.org (ppperry) Date: Sat, 28 Jul 2018 23:24:25 +0000 Subject: [New-bugs-announce] [issue34266] Bad behavior with "restart \" in pdb Message-ID: <1532820265.2.0.56676864532.issue34266@psf.upfronthosting.co.za> New submission from ppperry : (Pdb) restart \ Traceback (most recent call last): File "C:\Program Files\Python36\lib\pdb.py", line 1667, in main pdb._runscript(mainpyfile) File "C:\Program Files\Python36\lib\pdb.py", line 1548, in _runscript self.run(statement) File "C:\Program Files\Python36\lib\bdb.py", line 431, in run exec(cmd, globals, locals) File "", line 1, in File "C:\Program Files\Python36\lib\bdb.py", line 48, in trace_dispatch return self.dispatch_line(frame) File "C:\Program Files\Python36\lib\bdb.py", line 66, in dispatch_line self.user_line(frame) File "C:\Program Files\Python36\lib\pdb.py", line 261, in user_line self.interaction(frame, None) File "C:\Program Files\Python36\lib\pdb.py", line 352, in interaction self._cmdloop() File "C:\Program Files\Python36\lib\pdb.py", line 321, in _cmdloop self.cmdloop() File "C:\Program Files\Python36\lib\cmd.py", line 138, in cmdloop stop = self.onecmd(line) File "C:\Program Files\Python36\lib\pdb.py", line 418, in onecmd return cmd.Cmd.onecmd(self, line) File "C:\Program Files\Python36\lib\cmd.py", line 217, in onecmd return func(arg) File "C:\Program Files\Python36\lib\pdb.py", line 1025, in do_run sys.argv = shlex.split(arg) File "C:\Program Files\Python36\lib\shlex.py", line 305, in split return list(lex) File "C:\Program Files\Python36\lib\shlex.py", line 295, in __next__ token = self.get_token() File "C:\Program Files\Python36\lib\shlex.py", line 105, in get_token raw = self.read_token() File "C:\Program Files\Python36\lib\shlex.py", line 206, in read_token raise ValueError("No escaped character") ---------- components: Library (Lib) messages: 322595 nosy: ppperry priority: normal severity: normal status: open title: Bad behavior with "restart \" in pdb type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 19:33:17 2018 From: report at bugs.python.org (Segev Finer) Date: Sat, 28 Jul 2018 23:33:17 +0000 Subject: [New-bugs-announce] [issue34267] find_python.bat doesn't find installed Python 3.7 Message-ID: <1532820797.37.0.56676864532.issue34267@psf.upfronthosting.co.za> New submission from Segev Finer : The PCbuild/find_python.bat script doesn't find an installed Python 3.7 and will proceed to download Python using nuget. This is caused by it invoking py with "-3.6" which will only find Python 3.6 (py doesn't seem to support a 3.6 or above flag), despite the fact that the build can use 3.7 and the nuget fallback will install 3.7. ---------- components: Windows messages: 322597 nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: find_python.bat doesn't find installed Python 3.7 type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jul 28 23:25:08 2018 From: report at bugs.python.org (gaoxinge) Date: Sun, 29 Jul 2018 03:25:08 +0000 Subject: [New-bugs-announce] [issue34268] run pool.submit in callback when future.set_result Message-ID: <1532834708.12.0.56676864532.issue34268@psf.upfronthosting.co.za> New submission from gaoxinge : ## abstract When using concurrent.futures.ThreadPoolExecutor module, if we code pool.submit in callback, the callback may be not run. This is because main thread will terminate, and call _python_exit to add none to _work_queue before subthread run callback. ## code ``` # -*- coding: utf-8 -*- from concurrent.futures import ThreadPoolExecutor def func(x, y): import time time.sleep(1) return x + y def do_many(n): def callback(fut): nonlocal n result = fut.result() print('Got: ', result) n -= 1 if n > 0: future = pool.submit(func, n, n) future.add_done_callback(callback) if n > 0: future = pool.submit(func, n, n) future.add_done_callback(callback) # _python_exit will be called here, and then # add none to _work_queue pool = ThreadPoolExecutor(max_workers=8) do_many(10) ``` ## result and expectation The code's result may be ``` Got: 20 Got: 18 Got: 16 Got: 14 Got: 12 Got: 10 Got: 8 Got: 6 ``` But my expectation is ``` Got: 20 Got: 18 Got: 16 Got: 14 Got: 12 Got: 10 Got: 8 Got: 6 Got: 4 Got: 2 ``` ## question Is my expectation reasonable? ### if not reasonable If not, my solution is ``` from concurrent.futures import ThreadPoolExecutor def func(x, y): import time time.sleep(1) return x + y def do_many(): def callback(fut): global n result = fut.result() print('Got: ', result) n -= 1 if n > 0: future = pool.submit(func, n, n) future.add_done_callback(callback) if n > 0: future = pool.submit(func, n, n) future.add_done_callback(callback) n = 10 pool = ThreadPoolExecutor(max_workers=8) do_many() while n > 0: # use while to block main thread pass ``` and is there any elegant solution? ### if reasonable ... ---------- components: Library (Lib) messages: 322605 nosy: gaoxinge priority: normal severity: normal status: open title: run pool.submit in callback when future.set_result type: behavior versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 29 05:03:56 2018 From: report at bugs.python.org (Thomas Waldmann) Date: Sun, 29 Jul 2018 09:03:56 +0000 Subject: [New-bugs-announce] [issue34269] logging in 3.7 behaves different due to caching Message-ID: <1532855036.26.0.56676864532.issue34269@psf.upfronthosting.co.za> New submission from Thomas Waldmann : When running the borgbackup tests on 3.7.0, quite some tests will be broken because expected log output is not emitted. I traced this down up the point when I noticed that reverting the caching feature change of isEnabledFor method in Logger makes the tests work on 3.7. I reviewed the logging code and the caching change, but could not easily find what is broken. There is of course some suspicion that cache invalidation might be the issue (it is present, but maybe it does not cover all the cases). See there for more info: https://github.com/borgbackup/borg/issues/3805 So, I suggest to first revert the caching feature change so we get a fixed logging in 3.7.1 and then to retry to add caching. Note: I'm at EuroPython sprints today at the borgbackup table. ---------- messages: 322617 nosy: Thomas.Waldmann priority: normal severity: normal status: open title: logging in 3.7 behaves different due to caching versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 29 05:25:37 2018 From: report at bugs.python.org (=?utf-8?q?Alex_Gr=C3=B6nholm?=) Date: Sun, 29 Jul 2018 09:25:37 +0000 Subject: [New-bugs-announce] [issue34270] Add names to asyncio tasks Message-ID: <1532856337.57.0.56676864532.issue34270@psf.upfronthosting.co.za> New submission from Alex Gr?nholm : Having names on tasks helps tremendously when something goes wrong in a complex asyncio application. Threads have names and even trio has the ability to name its tasks. This would also greatly benefit PyCharm's concurrency visualization: https://www.jetbrains.com/help/pycharm/thread-concurrency-visualization.html#asyncio ---------- components: asyncio messages: 322620 nosy: alex.gronholm, asvetlov, yselivanov priority: normal severity: normal status: open title: Add names to asyncio tasks type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 29 08:38:09 2018 From: report at bugs.python.org (Johannes Frank) Date: Sun, 29 Jul 2018 12:38:09 +0000 Subject: [New-bugs-announce] [issue34271] Please support logging of SSL master secret by env variable SSLKEYLOGFILe Message-ID: <1532867889.16.0.56676864532.issue34271@psf.upfronthosting.co.za> New submission from Johannes Frank : As discussed on the EuroPython 2018 it would be a great improvement if the python SSL module would respect the SSLKEYLOGFILE environment variable to log the master secret and the client random for packet trace decryption. The pycurl module compiled against libopenssl 1.1.0h does already work. OpenSSL 1.1.1 will offer to register a callback that will log the keys. There is also c code available using LD_PRELOAD here: https://git.lekensteyn.nl/peter/wireshark-notes/tree/src/sslkeylog.c It would be great if a call to the requests, aiohttp, urllib3 or asks library would lead to the keys logged if the environment variable is set from within python. Thank you ---------- assignee: christian.heimes components: SSL files: pycurl-get.py messages: 322632 nosy: christian.heimes, jmfrank63 priority: normal severity: normal status: open title: Please support logging of SSL master secret by env variable SSLKEYLOGFILe type: enhancement versions: Python 3.7 Added file: https://bugs.python.org/file47719/pycurl-get.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 29 08:56:01 2018 From: report at bugs.python.org (Serhiy Storchaka) Date: Sun, 29 Jul 2018 12:56:01 +0000 Subject: [New-bugs-announce] [issue34272] Reorganize C API tests Message-ID: <1532868961.04.0.56676864532.issue34272@psf.upfronthosting.co.za> New submission from Serhiy Storchaka : The proposed PR reorganizes C API tests. Most C API tests will be moved into the new directory Lib/test/test_capi/. ---------- components: Tests messages: 322635 nosy: ezio.melotti, michael.foord, serhiy.storchaka priority: normal severity: normal status: open title: Reorganize C API tests type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 29 17:25:52 2018 From: report at bugs.python.org (Michael Fischer) Date: Sun, 29 Jul 2018 21:25:52 +0000 Subject: [New-bugs-announce] [issue34273] %f is confusingly associated with fixed point format Message-ID: <1532899552.57.0.56676864532.issue34273@psf.upfronthosting.co.za> New submission from Michael Fischer : In section "7.1.3.1. Format Specification Mini-Language" of the documentation (https://docs.python.org/2/library/string.html) both %f and %F are labelled "Fixed point". This is confusing for someone who a) transitions over from C or variants or b) knows the difference between fixed and floating point numbers. I suggest either changing the "Fixed" to "Floating" or explaining what is meant by "Fixed Point" (because I'm sure there's a reason why someone has named it like that in the first place). ---------- assignee: docs at python components: Documentation messages: 322644 nosy: MikeFoxtrot, docs at python priority: normal severity: normal status: open title: %f is confusingly associated with fixed point format type: enhancement _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 29 17:39:57 2018 From: report at bugs.python.org (Segev Finer) Date: Sun, 29 Jul 2018 21:39:57 +0000 Subject: [New-bugs-announce] [issue34274] Python launcher behavior with /usr/bin/env python shebang Message-ID: <1532900397.79.0.56676864532.issue34274@psf.upfronthosting.co.za> Change by Segev Finer : ---------- components: Windows nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Python launcher behavior with /usr/bin/env python shebang type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jul 29 22:16:41 2018 From: report at bugs.python.org (Terry J. Reedy) Date: Mon, 30 Jul 2018 02:16:41 +0000 Subject: [New-bugs-announce] [issue34275] IDLE: no calltips on MacOS with tk 8.6 Message-ID: <1532917001.14.0.56676864532.issue34275@psf.upfronthosting.co.za> New submission from Terry J. Reedy : In #34055, Raymond said "tool tips no longer display on the newest mac builds". On idledev, Walter S reported the same using 64-bit python.org "Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin" on multiple machines with 10.13.5. He also verified that the htest part of 'python3 -m idlelib.calltip_w' fails (no calltip appears when typing '('. I have doubts that this is a new problem with IDLE. calltip.py was not touched for 3.7.0. calltip_w.py was only touched to change return None to return 'break' where appropriate. This is one of 3 new Mac-specific failures reported after the release of 3.7.0. The others are #34047, scrolling problems, and #34120, freeze on some dialog closings. I have to suspect that the problem is with tkinter (_tkinter) and the new tcl/tk 8.6.8. How to debug (help appreciated with any of these): 1. Run the 3.6.6 32/64 bit binary, compiled against tk 8.5 instead of 8.6, and see if the same problems occur. Any problems that do are not 8.6 specific. 2. Find minimal failing cases with as little IDLE-specific code as possible. 3. Trace execution of the IDLE code with prints or debugger to find the point of failure. For this issue, I would start with adding print calls in the function that creates the tip window. ---------- assignee: terry.reedy components: IDLE, macOS messages: 322647 nosy: ned.deily, rhettinger, ronaldoussoren, taleinat, terry.reedy, walters priority: normal severity: normal stage: needs patch status: open title: IDLE: no calltips on MacOS with tk 8.6 type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 00:39:03 2018 From: report at bugs.python.org (Chris Jerdonek) Date: Mon, 30 Jul 2018 04:39:03 +0000 Subject: [New-bugs-announce] [issue34276] urllib.parse doesn't round-trip file URI's with multiple leading slashes Message-ID: <1532925543.25.0.56676864532.issue34276@psf.upfronthosting.co.za> New submission from Chris Jerdonek : urllib.parse doesn't seem to round-trip file URI's containing multiple leading slashes. For example, this-- import urllib.parse def round_trip(url): parsed = urllib.parse.urlsplit(url) new_url = urllib.parse.urlunsplit(parsed) print(f'{url} [{parsed}]\n{new_url}') print('ROUNDTRIP: {}\n'.format(url == new_url)) for i in range(4): round_trip('file://{}root/a'.format(i * '/')) results in-- file://root/a [SplitResult(scheme='file', netloc='root', path='/a', query='', fragment='')] file://root/a ROUNDTRIP: True file:///root/a [SplitResult(scheme='file', netloc='', path='/root/a', query='', fragment='')] file:///root/a ROUNDTRIP: True file:////root/a [SplitResult(scheme='file', netloc='', path='//root/a', query='', fragment='')] file://root/a ROUNDTRIP: False file://///root/a [SplitResult(scheme='file', netloc='', path='///root/a', query='', fragment='')] file:///root/a ROUNDTRIP: False URI's of the form file:////// occur, for example, when one wants to git-clone a UNC path on Windows: https://stackoverflow.com/a/2520121/262819 Here is where CPython defines urlunsplit(): https://github.com/python/cpython/blob/4e11c461ed39085b8495a35c9367b46d8a0d306d/Lib/urllib/parse.py#L465-L482 (The '//' special-casing seems to occur in this line here: https://github.com/python/cpython/blob/4e11c461ed39085b8495a35c9367b46d8a0d306d/Lib/urllib/parse.py#L473 ) And here is where the round-tripping is tested: https://github.com/python/cpython/blob/4e11c461ed39085b8495a35c9367b46d8a0d306d/Lib/test/test_urlparse.py#L156 (Three initial leading slashes is tested, but not the problem case of four or more.) ---------- components: Library (Lib) messages: 322652 nosy: chris.jerdonek priority: normal severity: normal status: open title: urllib.parse doesn't round-trip file URI's with multiple leading slashes type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 01:32:53 2018 From: report at bugs.python.org (Bryce Drennan) Date: Mon, 30 Jul 2018 05:32:53 +0000 Subject: [New-bugs-announce] [issue34277] EmailPolicy not followed Message-ID: <1532928773.1.0.56676864532.issue34277@psf.upfronthosting.co.za> New submission from Bryce Drennan : Starting in 3.6.4, the header flattening ignores the EmailyPolicy.utf8 attribute if a header is longer than maxlen. I believe this was introduced in https://github.com/python/cpython/pull/4693. Specifically this part: https://github.com/miss-islington/cpython/blob/8085ac188785ad0301760869a08b83c2945257a4/Lib/email/_header_value_parser.py#L2668-L2673 This causes problems as the dkim-signature header of parsed email messages gets mangled when they are flattened. It should look like this: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1532918961; bh=AwLeVe/FpXHJ9+VNy8QKwz2N5wuNF5ZkyXE3tLVBrFY=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=rSWZ7vyWIZqflUJS9ysVQvDxeoMxepEqPr/EoVkqpilCP1ryvci6/jCsFe75M2Jr5NJjzg6yJ6Xew8rpq8SMnZeNhTMmCK8jy\r\n WwSamcZ14t0LUZEt30+9Ump0KbPq+WRQK2rM9NnBVhE6pyvANfgsKMqgXlYzAmHk7P8cZ7ztJMSrtOeOr3u5RRNwvYJ+OYHZSFHiQZrPopNDKovVBcAc+6yVBI3YsI1qsgDmoQ/F5NszOLsBit2IkcvWr7z [...] but instead gets output like this: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;\r\n t=1532918961; bh=AwLeVe/FpXHJ9+VNy8QKwz2N5wuNF5ZkyXE3tLVBrFY=;\r\n h=Date:From:Reply-To:To:Subject:References:From:Subject; =?utf-8?q?b=3DrSWZ?=\r\n =?utf-8?q?7vyWIZqflUJS9ysVQvDxeoMxepEqPr/EoVkqpilCP1ryvci6/jCsFe75M2Jr5NJjz?=\r\n =?utf-8?q?g6yJ6Xew8rpq8SMnZeN [...] Attached is a test that passes in 3.6.3 and fails in 3.6.4. ---------- components: email files: test_header_folding.py messages: 322653 nosy: barry, bryced, r.david.murray priority: normal severity: normal status: open title: EmailPolicy not followed versions: Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47720/test_header_folding.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 05:02:57 2018 From: report at bugs.python.org (crzbear) Date: Mon, 30 Jul 2018 09:02:57 +0000 Subject: [New-bugs-announce] [issue34278] Documentation: os.waitid and os.WNOHANG Message-ID: <1532941377.17.0.56676864532.issue34278@psf.upfronthosting.co.za> New submission from crzbear : os.waitid states that None is returned if WNOHANG was specified and no children are in a waitable state os.WNOHANG states that the return value in this case would be (0, 0) Python 3.6.5 returns None, so the latter probably needs to be changed ---------- assignee: docs at python components: Documentation messages: 322660 nosy: crzbear, docs at python priority: normal severity: normal status: open title: Documentation: os.waitid and os.WNOHANG versions: Python 3.6 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 06:48:27 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 30 Jul 2018 10:48:27 +0000 Subject: [New-bugs-announce] [issue34279] RFC: issue a warning in regrtest when no test have been executed? Message-ID: <1532947707.98.0.56676864532.issue34279@psf.upfronthosting.co.za> New submission from STINNER Victor : Python test runner regrtest has many options to select tests: -u (resources), -m and --matchfile, -x (exclude), etc. Sometimes, I do a mistake and I run 0 test, but I still get a success. Maybe regrtest should be modified to fail with an error when no test is run? At least, it would help to understand my mistake if regrtest could emit a warning in such case. Example: --- $ ./python -W error -m test test_asyncio -m test_set_default_executor_deprecation_warnings Run tests sequentially 0:00:00 load avg: 0.27 [1/1] test_asyncio == Tests result: SUCCESS == 1 test OK. Total duration: 266 ms Tests result: SUCCESS --- Success ok, but is there a typo in the test method? Another example: --- $ ./python -W error -m test test_asyncio -m test_no_such_test -v == CPython 3.8.0a0 (heads/pr/8533:50c0499950, Jul 30 2018, 12:41:53) [GCC 8.1.1 20180712 (Red Hat 8.1.1-5)] == Linux-4.17.6-200.fc28.x86_64-x86_64-with-glibc2.26 little-endian == cwd: /home/vstinner/prog/python/master/build/test_python_5505 == CPU count: 8 == encodings: locale=UTF-8, FS=utf-8 Run tests sequentially 0:00:00 load avg: 0.31 [1/1] test_asyncio ---------------------------------------------------------------------- Ran 0 tests in 0.001s OK == Tests result: SUCCESS == 1 test OK. Total duration: 318 ms Tests result: SUCCESS --- Success but no test have been executed. It's not obvious at all without the verbose mode: --- $ ./python -W error -m test test_asyncio -m test_no_such_test Run tests sequentially 0:00:00 load avg: 0.31 [1/1] test_asyncio == Tests result: SUCCESS == 1 test OK. Total duration: 260 ms Tests result: SUCCESS --- ---------- components: Tests messages: 322667 nosy: pablogsal, serhiy.storchaka, vstinner priority: normal severity: normal status: open title: RFC: issue a warning in regrtest when no test have been executed? versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 07:56:35 2018 From: report at bugs.python.org (Jeroen Demeyer) Date: Mon, 30 Jul 2018 11:56:35 +0000 Subject: [New-bugs-announce] [issue34280] METH_NOARGS: no longer require that second arg is NULL Message-ID: <1532951795.78.0.56676864532.issue34280@psf.upfronthosting.co.za> New submission from Jeroen Demeyer : A C function with signature METH_NOARGS takes two arguments where the first is "self" and the second is guaranteed to be NULL. Given that this second argument really should never be used, I would like to drop the guarantee that the argument is NULL. Concretely, I propose to change: 1. the documentation for METH_NOARGS 2. some functions in Modules/_io/bufferedio.c which actually do use the second argument of a METH_NOARGS function. For the moment, the second argument is still NULL, but one is not supposed to rely on that. The reason for this patch is that this second argument can be re-purposed in PEP 580 (and possibly PEP 573) to pass the function object. ---------- components: Interpreter Core messages: 322670 nosy: jdemeyer priority: normal severity: normal status: open title: METH_NOARGS: no longer require that second arg is NULL type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 09:06:36 2018 From: report at bugs.python.org (Eric Martin) Date: Mon, 30 Jul 2018 13:06:36 +0000 Subject: [New-bugs-announce] [issue34281] "Go to Line" broken on OS X Message-ID: <1532955996.83.0.56676864532.issue34281@psf.upfronthosting.co.za> New submission from Eric Martin : After entering a line number, clicking OK brings to the foreground and makes active the first hidden window (in the simplest case where we have just one window for a .py file and the Shell window, the former being in the foreground, clicking OK brings the Shell window to the foreground). ---------- assignee: terry.reedy components: IDLE messages: 322673 nosy: eamartin, terry.reedy priority: normal severity: normal status: open title: "Go to Line" broken on OS X type: behavior versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 13:36:39 2018 From: report at bugs.python.org (orlnub123) Date: Mon, 30 Jul 2018 17:36:39 +0000 Subject: [New-bugs-announce] [issue34282] Enum._convert shadows members named _convert Message-ID: <1532972199.25.0.56676864532.issue34282@psf.upfronthosting.co.za> New submission from orlnub123 : If an enum has a member named _convert it gets shadowed by the _convert method as shown below. >>> import enum >>> >>> class Test(enum.Enum): ... _convert = enum.auto() ... >>> Test._convert > I've came up with a couple of solutions: 1. Add _convert to the invalid names list, next to mro 2. Rename _convert to _convert_ as sunder names are reserved 3. Move _convert to the metaclass I think the first solution would be the worst as it would break existing enums that have _convert as a member (although unusable). The problem with the second solution would be breaking external code that uses it although I think that's a moot point as it's meant for internal use. Another shortcoming would be having to update all the stdlib code that uses it. The third solution might be a bit confusing on its own if an existing enum with a _convert member suddenly removed it leaving you with a bound method instead of raising an AttributeError. ---------- components: Library (Lib) messages: 322681 nosy: ethan.furman, orlnub123 priority: normal severity: normal status: open title: Enum._convert shadows members named _convert type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 13:49:31 2018 From: report at bugs.python.org (Segev Finer) Date: Mon, 30 Jul 2018 17:49:31 +0000 Subject: [New-bugs-announce] [issue34283] Python 2 mishandles console code page after setlocale Message-ID: <1532972971.81.0.56676864532.issue34283@psf.upfronthosting.co.za> New submission from Segev Finer : Found by trying to use pip: https://github.com/pypa/pip/issues/5665. This is likely affected by the console code page. Python version: 2.7.15 64 bit OS: Windows 10.0.17134.165 x64 The console locale is set to cp872. The console font is consolas. Apparently, msvcrt does charset conversion when writing to its file descriptors based on the set locale! and it's even special cased to handle the OEM console code page (You can see this in crt/src/write.c:_write_nolock if you have MSVC 2008). When the "C" locale is set, no conversion is done. Python encodes to the OEM code page, and it passes through to the console unscathed. But once you do setlocale than the CRT expects you to use the ANSI code page, but Python will be encoding to the OEM code page which will result in this error from fwrite. file.encoding in Python 2 is also not settable directly from Python (C API only), it's only used for stdio and set internally on startup: Python/pythonrun.c:349-378. I found this describing this: Why printf can display non-ASCII characters when ?C? locale is used?. #!/usr/bin/env python2 from __future__ import print_function import locale print(u' |\u2588') # Works locale.setlocale(locale.LC_ALL, '') print(u' |\u2588') # IOError: [Errno 42] Illegal byte sequence ---------- components: Windows messages: 322683 nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Python 2 mishandles console code page after setlocale type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 16:05:01 2018 From: report at bugs.python.org (ppperry) Date: Mon, 30 Jul 2018 20:05:01 +0000 Subject: [New-bugs-announce] [issue34284] Nonsensical exception message when calling `__new__` on some sys objects Message-ID: <1532981101.24.0.56676864532.issue34284@psf.upfronthosting.co.za> New submission from ppperry : > type(sys.flags).__new__(type(sys.flags)) Traceback (most recent call last): File "", line 1, in type(sys.flags).__new__(type(sys.flags)) TypeError: tuple.__new__(sys.flags) is not safe, use sys.flags.__new__() Ignoring the confusion caused by both the type and the instance being called "sys.flags", this error doesn't make sense. I am using "sys.flags" (the type).__new__, so why is it complaining? "type(sys.flags)()" produces the standard "non-instantiable type" error. The same behavior also happens for "sys.version_info", but strangely not for any of the other sys constants. ---------- components: Interpreter Core, Library (Lib) messages: 322688 nosy: ppperry priority: normal severity: normal status: open title: Nonsensical exception message when calling `__new__` on some sys objects type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 19:57:43 2018 From: report at bugs.python.org (STINNER Victor) Date: Mon, 30 Jul 2018 23:57:43 +0000 Subject: [New-bugs-announce] [issue34285] regrtest: in case of test failure, add "always look on the bright side of life" Message-ID: <1532995063.27.0.56676864532.issue34285@psf.upfronthosting.co.za> New submission from STINNER Victor : Debugging tests failures can be depressing, especially when working on race conditions of Python buildbots. I propose to add an easter egg in regrtest for that: in case of test of failure, write "Tests failed but... always look on the bring side of life". This idea should be credited to Pablo Salgado! Would it be possible to also play the song in background? Or maybe that's too much. Maybe it should be a command line option? --always-look-on-the-bright-side-of-life, enabled by make buildbot? ---------- components: Tests messages: 322701 nosy: pablogsal, vstinner priority: normal severity: normal status: open title: regrtest: in case of test failure, add "always look on the bright side of life" versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Mon Jul 30 23:18:11 2018 From: report at bugs.python.org (Matthias Klose) Date: Tue, 31 Jul 2018 03:18:11 +0000 Subject: [New-bugs-announce] [issue34286] lib2to3 tests fail on the 3.7 branch (used to work with 3.7.0) Message-ID: <1533007091.73.0.56676864532.issue34286@psf.upfronthosting.co.za> New submission from Matthias Klose : running the lib2to3 tests from an installed location, I see the following failures on the 3.7 branch: ====================================================================== FAIL: test (lib2to3.tests.test_fixers.Test_reload) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 294, in test self.check(b, a) File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 36, in check tree = self._check(before, after) File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 32, in _check self.assertEqual(after, str(tree)) AssertionError: 'import importlib\nimportlib.reload(a)\n\n' != 'import imp\nimp.reload(a)\n\n' - import importlib ? ------ + import imp - importlib.reload(a) ? ------ + imp.reload(a) ====================================================================== FAIL: test_comment (lib2to3.tests.test_fixers.Test_reload) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 299, in test_comment self.check(b, a) File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 36, in check tree = self._check(before, after) File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 32, in _check self.assertEqual(after, str(tree)) AssertionError: 'import importlib\nimportlib.reload( a ) # comment\n\n' != 'import imp\nimp.reload( a ) # comment\n\n' - import importlib ? ------ + import imp - importlib.reload( a ) # comment ? ------ + imp.reload( a ) # comment ====================================================================== FAIL: test_space (lib2to3.tests.test_fixers.Test_reload) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 309, in test_space self.check(b, a) File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 36, in check tree = self._check(before, after) File "/usr/lib/python3.7/lib2to3/tests/test_fixers.py", line 32, in _check self.assertEqual(after, str(tree)) AssertionError: 'import importlib\nimportlib.reload( a )\n\n' != 'import imp\nimp.reload( a )\n\n' - import importlib ? ------ + import imp - importlib.reload( a ) ? ------ + imp.reload( a ) ---------------------------------------------------------------------- Ran 650 tests in 27.363s FAILED (failures=3) test test_lib2to3 failed 1 test failed again: test_lib2to3 == Tests result: FAILURE then FAILURE == 390 tests OK. 1 test failed: test_lib2to3 ---------- components: Library (Lib) keywords: 3.7regression messages: 322714 nosy: brett.cannon, doko, eric.snow, ncoghlan priority: normal severity: normal status: open title: lib2to3 tests fail on the 3.7 branch (used to work with 3.7.0) _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 03:07:43 2018 From: report at bugs.python.org (Jeroen Demeyer) Date: Tue, 31 Jul 2018 07:07:43 +0000 Subject: [New-bugs-announce] [issue34287] bufferedio.c uses unused argument of METH_NOARGS functions Message-ID: <1533020863.81.0.56676864532.issue34287@psf.upfronthosting.co.za> New submission from Jeroen Demeyer : A METH_NOARGS function has a second unused argument which is always NULL (this is guaranteed by the documentation). However, some functions in Modules/_io/bufferedio.c actually that second NULL argument. This is technically not a bug, but it looks more clear to explicitly mark that second argument as unused. ---------- components: Extension Modules messages: 322736 nosy: jdemeyer, rhettinger, scoder priority: normal severity: normal status: open title: bufferedio.c uses unused argument of METH_NOARGS functions versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 03:32:32 2018 From: report at bugs.python.org (Roy Belio) Date: Tue, 31 Jul 2018 07:32:32 +0000 Subject: [New-bugs-announce] [issue34288] Declare sethostname in socketmodule.c for SOLARIS Message-ID: <1533022352.12.0.56676864532.issue34288@psf.upfronthosting.co.za> New submission from Roy Belio : Following issue 18259 which was solved by extern sethostname I managed to build python 3.7 on solaris only after patching away the ifdef for _AIX. We need to add SOLARIS flag and check for that also in the same line of #ifdef _AIX. This error only appears in 3.7 since a new CFLAG was turned on -Werror=no-implicit-declaration. and during build time it fails on sethostname function, not build _socket. ---------- components: Build messages: 322742 nosy: rbelio priority: normal severity: normal status: open title: Declare sethostname in socketmodule.c for SOLARIS type: compile error versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 05:37:20 2018 From: report at bugs.python.org (Aleksa Bulatovic) Date: Tue, 31 Jul 2018 09:37:20 +0000 Subject: [New-bugs-announce] [issue34289] System can't find the path of Python Message-ID: <1533029840.3.0.56676864532.issue34289@psf.upfronthosting.co.za> New submission from Aleksa Bulatovic : Before you say,yes,i have python path but the system can't find it.Is it because of the installation folder (because i didn't install in the default location) or maybe other? ---------- components: Windows messages: 322748 nosy: Cross!Alex21, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: System can't find the path of Python versions: Python 3.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 06:26:27 2018 From: report at bugs.python.org (Dan Snider) Date: Tue, 31 Jul 2018 10:26:27 +0000 Subject: [New-bugs-announce] [issue34290] _ctypes PyCField_new doesn't do anything Message-ID: <1533032787.65.0.56676864532.issue34290@psf.upfronthosting.co.za> New submission from Dan Snider : The function is essentially nothing more than a prototype at the moment: static PyObject * PyCField_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { CFieldObject *obj; obj = (CFieldObject *)type->tp_alloc(type, 0); return (PyObject *)obj; } ---------- components: ctypes messages: 322754 nosy: bup priority: normal severity: normal status: open title: _ctypes PyCField_new doesn't do anything type: crash versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 06:51:35 2018 From: report at bugs.python.org (Camille) Date: Tue, 31 Jul 2018 10:51:35 +0000 Subject: [New-bugs-announce] [issue34291] UnboundLocalError raised on call to global Message-ID: <1533034295.33.0.56676864532.issue34291@psf.upfronthosting.co.za> New submission from Camille : In the following code : def g(): return 0 def f(): g = g() f() The call to g in f fails due to an UnboundLocalError, while I expected the assignment to hide the global definition of g. Note that if it is done in two subsequent calls, i.e. with : def f(): goo = g() g = 0 The first assignment still fails. ---------- messages: 322755 nosy: camshaka priority: normal severity: normal status: open title: UnboundLocalError raised on call to global type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 08:48:23 2018 From: report at bugs.python.org (Pablo Galindo Salgado) Date: Tue, 31 Jul 2018 12:48:23 +0000 Subject: [New-bugs-announce] [issue34292] test_compile is hanging im AMD Ubuntu buildbots Message-ID: <1533041303.96.0.56676864532.issue34292@psf.upfronthosting.co.za> New submission from Pablo Galindo Salgado : Test compile is hanging or failing in AMD(64) Ubuntu buildbots. For example: https://buildbot.python.org/all/#/builders/157/builds/77 https://buildbot.python.org/all/#/builders/154/builds/90 Example errors: running: test_tools (3 min 49 sec), test_compile (3 min 47 sec) Traceback (most recent call last): File "/home/buildbot/buildarea/3.7.einat-ubuntu/build/Lib/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/home/buildbot/buildarea/3.7.einat-ubuntu/build/Lib/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/buildbot/buildarea/3.7.einat-ubuntu/build/Lib/test/__main__.py", line 2, in main() File "/home/buildbot/buildarea/3.7.einat-ubuntu/build/Lib/test/libregrtest/main.py", line 584, in main Regrtest().main(tests=tests, **kwargs) File "/home/buildbot/buildarea/3.7.einat-ubuntu/build/Lib/test/libregrtest/main.py", line 531, in main self._main(tests, kwargs) File "/home/buildbot/buildarea/3.7.einat-ubuntu/build/Lib/test/libregrtest/main.py", line 566, in _main self.run_tests() File "/home/buildbot/buildarea/3.7.einat-ubuntu/build/Lib/test/libregrtest/main.py", line 486, in run_tests run_tests_multiprocess(self) File "/home/buildbot/buildarea/3.7.einat-ubuntu/build/Lib/test/libregrtest/runtest_mp.py", line 181, in run_tests_multiprocess faulthandler.dump_traceback_later(test_timeout, exit=True) RuntimeError: unable to start watchdog thread command timed out: 1200 seconds without output running [b'make', b'buildbottest', b'TESTOPTS=-j2', b'TESTPYTHONOPTS=', b'TESTTIMEOUT=900'], attempting to kill process killed by signal 9 program finished with exit code -1 elapsedTime=2780.229688 and running: test_multiprocessing_forkserver (3 min 49 sec), test_compile (5 min 16 sec) Makefile:1086: recipe for target 'buildbottest' failed Timeout (0:15:00)! Thread 0x00007ff09bab5700 (most recent call first): File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/selectors.py", line 415 in select File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/subprocess.py", line 1675 in _communicate File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/subprocess.py", line 933 in communicate File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/runtest_mp.py", line 56 in run_test_in_subprocess File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/runtest_mp.py", line 120 in _runtest File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/runtest_mp.py", line 144 in run File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/threading.py", line 917 in _bootstrap_inner File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/threading.py", line 885 in _bootstrap Thread 0x00007ff09c2b6700 (most recent call first): File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/selectors.py", line 415 in select File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/subprocess.py", line 1675 in _communicate File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/subprocess.py", line 933 in communicate File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/runtest_mp.py", line 56 in run_test_in_subprocess File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/runtest_mp.py", line 120 in _runtest File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/runtest_mp.py", line 144 in run File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/threading.py", line 917 in _bootstrap_inner File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/threading.py", line 885 in _bootstrap Thread 0x00007ff0a2ac7080 (most recent call first): File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/runtest_mp.py", line 181 in run_tests_multiprocess File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/main.py", line 486 in run_tests File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/main.py", line 566 in _main File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/main.py", line 531 in main File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/libregrtest/main.py", line 584 in main File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/test/__main__.py", line 2 in File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/runpy.py", line 85 in _run_code File "/home/buildbot/buildarea/3.x.einat-ubuntu/build/Lib/runpy.py", line 193 in _run_module_as_main make: *** [buildbottest] Error 1 program finished with exit code 2 elapsedTime=3446.164951 In subsequent runs of the buildbots test_compile emits a warning because it has ben re-ran: https://buildbot.python.org/all/#/builders/154/builds/91 https://buildbot.python.org/all/#/builders/157/builds/80 The issue could be transient, but it seems that this could point at some other issue. ---------- components: Tests messages: 322766 nosy: pablogsal priority: normal severity: normal status: open title: test_compile is hanging im AMD Ubuntu buildbots type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 09:10:13 2018 From: report at bugs.python.org (jfbu) Date: Tue, 31 Jul 2018 13:10:13 +0000 Subject: [New-bugs-announce] [issue34293] DOC: Makefile inherits a Sphinx 1.5 bug regarding PAPER envvar Message-ID: <1533042613.34.0.56676864532.issue34293@psf.upfronthosting.co.za> New submission from jfbu : There has been a bug at Sphinx since release 1.5 https://github.com/sphinx-doc/sphinx/issues/5234 about wrong handling of PAPER environment variable. The Makefile in Doc/ reproduces the error. As a result the "A4 latex" and "letter latex" sub targets of "dist" mis-behave. A bugfix will be released at Sphinx 1.7.7 or 1.8 but the CPython Doc/Makefile needs an update, because the bugfix can only solve problems for new projects created with sphinx-quickstart (whether or not using the "make-mode" small Makefile, or the "no-make-mode" bigger Makefile which was default up to Sphinx 1.5). I will send PR next. ---------- assignee: docs at python components: Documentation messages: 322770 nosy: docs at python, jfbu priority: normal severity: normal status: open title: DOC: Makefile inherits a Sphinx 1.5 bug regarding PAPER envvar type: behavior _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 09:11:05 2018 From: report at bugs.python.org (beardypig) Date: Tue, 31 Jul 2018 13:11:05 +0000 Subject: [New-bugs-announce] [issue34294] re.finditer and lookahead bug Message-ID: <1533042665.14.0.56676864532.issue34294@psf.upfronthosting.co.za> New submission from beardypig : I am experiencing and issue with the following regex when using finditer. (?=<(?P\w+)/?>(?:(?P.+?))?)", " (I know it's not the best method of dealing with HTML, and this is a simplified version) For example: [m.groupdict() for m in re.finditer(r"(?=<(?P\w+)/?>(?:(?P.+?))?)", "")] In Python 2.7, 3.5, and 3.6 it returns [{'tag': 'test', 'text': ''}, {'tag': 'foo2', 'text': None}] But starting with 3.7 it returns [{'tag': 'test', 'text': ''}, {'tag': 'foo2', 'text': ''}] The "text" group appears to be a copy of the previous "text" group. Some other examples: "Hello" => [{'tag': 'test', 'text': 'Hello'}, {'tag': 'foo', 'text': 'Hello'}] (expected: [{'tag': 'test', 'text': 'Hello'}, {'tag': 'foo', 'text': None}]) "Hello" => [{'tag': 'test', 'text': 'Hello'}, {'tag': 'foo', 'text': 'Hello'}, {'tag': 'foo', 'text': None}] (expected: [{'tag': 'test', 'text': 'Hello'}, {'tag': 'foo', 'text': None}, {'tag': 'foo', 'text': None}]) ---------- components: Regular Expressions messages: 322771 nosy: beardypig, ezio.melotti, mrabarnett priority: normal severity: normal status: open title: re.finditer and lookahead bug type: behavior versions: Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 12:44:39 2018 From: report at bugs.python.org (Seonggi Kim) Date: Tue, 31 Jul 2018 16:44:39 +0000 Subject: [New-bugs-announce] [issue34295] Avoid inefficient way to find start point in deque.index Message-ID: <1533055479.21.0.56676864532.issue34295@psf.upfronthosting.co.za> Change by Seonggi Kim : ---------- components: ctypes nosy: hacksg priority: normal severity: normal status: open title: Avoid inefficient way to find start point in deque.index 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 Jul 31 13:31:24 2018 From: report at bugs.python.org (Cyker Way) Date: Tue, 31 Jul 2018 17:31:24 +0000 Subject: [New-bugs-announce] [issue34296] Speed up python startup by pre-warming the vm Message-ID: <1533058284.7.0.56676864532.issue34296@psf.upfronthosting.co.za> New submission from Cyker Way : I'm currently writing some shell tools with python3. While python can definitely do the job succinctly, there is one problem which made me feel I might have to switch to other languages or even pure bash scripts: python startup time. Shell tools are used very often, interactively. users do feel the lag when they hit enter after their command. i did 2 implementations in both python and pure bash, python takes about 500ms to run while bash is more than 10 times faster. I'm not saying bash is better than python, but for this task bash, or even perl, is a better choice. however, i think there is an easy way to improve python as i believe the lag is mostly due to its slow startup: pre-warm its vm. I can think of 2 scenarios for python to do a better shell job: 1. Run a universal python as a daemon, which reads scripts from a socket, runs it, and returns the result to a socket. Because it's running as a daemon, the startup time is avoided each time user runs a script. 2. Warm a python zygote during system boot. Every time a python script is run, fork from the zygote instead of cold-boot the vm. this is a similar approach to android zygote. I haven't done experiments to see whether there will be obstacles in implementing these scenarios. But I think this should become a priority because it's real and tangible, and other people may face the slow startup problem as well. If there's ongoing work on these, I'd be happy to have a look. But I don't think these scenarios have already been put into released versions of python. ---------- components: Interpreter Core messages: 322800 nosy: cykerway priority: normal severity: normal status: open title: Speed up python startup by pre-warming the vm type: enhancement versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 13:40:34 2018 From: report at bugs.python.org (Francois Godin) Date: Tue, 31 Jul 2018 17:40:34 +0000 Subject: [New-bugs-announce] [issue34297] Windows py.exe launcher fail to handle quote correctly Message-ID: <1533058834.14.0.56676864532.issue34297@psf.upfronthosting.co.za> New submission from Francois Godin : Using double quote around the version argument will cause a failure. Ex (failure): "py.exe" "-3" "test.py" => run_child: about to run '3" "...\python.exe" "test.py"' => ...\python.exe: can't open file '3 test.py': [Errno 22] Invalid argument Removing the double quote give (success): "py.exe" -3 "test.py" => run_child: about to run '"...\python.exe" "test.py"' This is mainly problematic when a library or a tool want to be simpler and simply add double quotes around every parameters. This is impossible to do with the python launcher. The issue seems to come from the PC/launcher.c file. It is the following line in the function process (around line 1622): command += wcslen(p); This line is suppose to skip the -3 in the command line so that the rest can be given to python as-is. The problem is that while command come from GetCommandLineW and thus contain quote, p come from __wargv and does not contain the double quote. Thus, the 2 characters "- are skipped instead of -3. ---------- components: Demos and Tools, Distutils, Windows messages: 322802 nosy: copelnug, dstufft, eric.araujo, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows py.exe launcher fail to handle quote correctly versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 13:49:14 2018 From: report at bugs.python.org (Seonggi Kim) Date: Tue, 31 Jul 2018 17:49:14 +0000 Subject: [New-bugs-announce] [issue34298] Avoid inefficient way to find start point in deque.index Message-ID: <1533059354.59.0.56676864532.issue34298@psf.upfronthosting.co.za> Change by Seonggi Kim : ---------- components: Extension Modules nosy: hacksg priority: normal severity: normal status: open title: Avoid inefficient way to find start point in deque.index 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 Jul 31 15:24:47 2018 From: report at bugs.python.org (Phillip M. Feldman) Date: Tue, 31 Jul 2018 19:24:47 +0000 Subject: [New-bugs-announce] [issue34299] argparse description formatting Message-ID: <1533065087.6.0.56676864532.issue34299@psf.upfronthosting.co.za> New submission from Phillip M. Feldman : With `argparse`, I'm providing a triple-quoted string via the `description` argument of the constructor. When I invoke the script with the -h or --help argument, all formatting in the triple-quoted string is lost, i.e., all paragraphs are run together into one giant paragraph, and the result is rather hard to read. Phillip M. Feldman ---------- components: Library (Lib) messages: 322808 nosy: Phillip.M.Feldman at gmail.com priority: normal severity: normal status: open title: argparse description formatting type: behavior versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 15:25:15 2018 From: report at bugs.python.org (tzickel) Date: Tue, 31 Jul 2018 19:25:15 +0000 Subject: [New-bugs-announce] [issue34300] gcc 7.3 causes a warning when compiling getpath.c in python 2.7 Message-ID: <1533065115.7.0.56676864532.issue34300@psf.upfronthosting.co.za> New submission from tzickel : When compiling on ubuntu 18.04 the 2.7 branch, I get this warning: gcc -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -DPYTHONPATH='":plat-linux2:lib-tk:lib-old"' \ -DPREFIX='"/usr/local"' \ -DEXEC_PREFIX='"/usr/local"' \ -DVERSION='"2.7"' \ -DVPATH='""' \ -o Modules/getpath.o ./Modules/getpath.c In file included from /usr/include/string.h:494:0, from Include/Python.h:38, from ./Modules/getpath.c:3: In function 'strncpy', inlined from 'joinpath' at ./Modules/getpath.c:202:5, inlined from 'search_for_prefix' at ./Modules/getpath.c:265:9, inlined from 'calculate_path' at ./Modules/getpath.c:505:8: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: '__builtin_strncpy': specified size between 9223372036854779906 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); ^~---- I think it's because the compiler can't reason that Py_FatalError aborts the program, and thus not overflow strncpy. Since there are about 3-4 warnings while building, maybe we should add a manual return after Py_FatalError in joinpath ? ---------- components: Build messages: 322809 nosy: tzickel priority: normal severity: normal status: open title: gcc 7.3 causes a warning when compiling getpath.c in python 2.7 versions: Python 2.7 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 19:53:19 2018 From: report at bugs.python.org (STINNER Victor) Date: Tue, 31 Jul 2018 23:53:19 +0000 Subject: [New-bugs-announce] [issue34301] Add _PyInterpreterState_Get() helper function Message-ID: <1533081199.4.0.56676864532.issue34301@psf.upfronthosting.co.za> New submission from STINNER Victor : Add _PyInterpreterState_Get() helper function: IMHO it's more explicit to call _PyInterpreterState_Get() than having to write PyThreadState_GET()->interp or PyThreadState_Get()->interp. ---------- components: Interpreter Core messages: 322827 nosy: eric.snow, vstinner priority: normal severity: normal status: open title: Add _PyInterpreterState_Get() helper function versions: Python 3.8 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Tue Jul 31 22:31:05 2018 From: report at bugs.python.org (ksg97031) Date: Wed, 01 Aug 2018 02:31:05 +0000 Subject: [New-bugs-announce] [issue34302] Avoid inefficient way to find start point in deque.index Message-ID: <1533090665.19.0.56676864532.issue34302@psf.upfronthosting.co.za> New submission from ksg97031 : Source base : heads/master:b75d7e2435, Aug 1 2018, 10:32:28 $ cat test.py import timeit queue_setup = ''' from collections import deque q = deque() start = 10**5 stop = start + 500 for i in range(0, stop): q.append(i) ''' code = ''' index = q.index(30, 1, stop) assert index == 30 ''' code2 = ''' index = q.index((start >> 1) + 1, start >> 1, stop >> 1) assert index == (start >> 1) + 1 ''' code3 = ''' index = q.index(start + 1, start, stop) assert index == start + 1 ''' repeat = 100000 print(timeit.timeit(setup = queue_setup, stmt = code, number = repeat * 20)) print(timeit.timeit(setup = queue_setup, stmt = code2, number = repeat)) print(timeit.timeit(setup = queue_setup, stmt = code3, number = repeat)) $ ./python_cur.exe test.py 2.154346022 2.899595406 5.265440983 $ ./python_ksg.exe test.py 2.1457827320000002 0.717190736 1.9934196979999999 ---------------------- ---------- components: Library (Lib) messages: 322834 nosy: ksg97031, rhettinger priority: normal severity: normal status: open title: Avoid inefficient way to find start point in deque.index type: enhancement versions: Python 3.8 _______________________________________ Python tracker _______________________________________