[issue32979] dict get() function equivalent for lists.
New submission from Felix : Hi there! I hope this wasn't suggested before. I couldn't find any issues related to it. The `get()` function on the dictionary object is such a convenient way for retrieving items from a dict that might not exists. I always wondered why the list object does not have an equivalent? I constantly run into something like this: myval = mylist[1] if len(mylist) > 1 else None or worse like this: try: myval = mylist[1] except IndexError: myval = None While I think it would be nice to do it like this: myval = mylist.get(1) Any love for this? Cheers! :) -- messages: 313099 nosy: feluxe priority: normal severity: normal status: open title: dict get() function equivalent for lists. type: enhancement ___ Python tracker <https://bugs.python.org/issue32979> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32979] dict get() function equivalent for lists.
Felix added the comment: Thanks for the link! Interesting read. I have to disagree with the statement that this is something that happens very rarely. Just have a look at the mess on stackoverflow alone (these are only the top results I got after a minute of googling): https://stackoverflow.com/questions/5125619/why-doesnt-list-have-safe-get-method-like-dictionary https://stackoverflow.com/questions/2492087/how-to-get-the-nth-element-of-a-python-list-or-a-default-if-not-available https://stackoverflow.com/questions/2574636/getting-a-default-value-on-index-out-of-range-in-python https://stackoverflow.com/questions/12186388/get-value-at-list-array-index-or-none-if-out-of-range-in-python https://stackoverflow.com/questions/17721748/default-value-for-out-of-bounds-list-index -- ___ Python tracker <https://bugs.python.org/issue32979> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified crashes
New submission from Felix Fontein : When argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS and help is specified, trying to display --help results in a crash. Reproducer: import argparse parser = argparse.ArgumentParser() parser.add_argument('--test', action=argparse.BooleanOptionalAction, default=argparse.SUPPRESS, help='Foo') parser.parse_args() Result when running 'python t.py --help': Traceback (most recent call last): File "/path/to/t.py", line 4, in parser.parse_args() File "/usr/lib/python3.10/argparse.py", line 1821, in parse_args args, argv = self.parse_known_args(args, namespace) File "/usr/lib/python3.10/argparse.py", line 1854, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/usr/lib/python3.10/argparse.py", line 2063, in _parse_known_args start_index = consume_optional(start_index) File "/usr/lib/python3.10/argparse.py", line 2003, in consume_optional take_action(action, args, option_string) File "/usr/lib/python3.10/argparse.py", line 1931, in take_action action(self, namespace, argument_values, option_string) File "/usr/lib/python3.10/argparse.py", line 1095, in __call__ parser.print_help() File "/usr/lib/python3.10/argparse.py", line 2551, in print_help self._print_message(self.format_help(), file) File "/usr/lib/python3.10/argparse.py", line 2535, in format_help return formatter.format_help() File "/usr/lib/python3.10/argparse.py", line 283, in format_help help = self._root_section.format_help() File "/usr/lib/python3.10/argparse.py", line 214, in format_help item_help = join([func(*args) for func, args in self.items]) File "/usr/lib/python3.10/argparse.py", line 214, in item_help = join([func(*args) for func, args in self.items]) File "/usr/lib/python3.10/argparse.py", line 214, in format_help item_help = join([func(*args) for func, args in self.items]) File "/usr/lib/python3.10/argparse.py", line 214, in item_help = join([func(*args) for func, args in self.items]) File "/usr/lib/python3.10/argparse.py", line 530, in _format_action help_text = self._expand_help(action) File "/usr/lib/python3.10/argparse.py", line 627, in _expand_help return self._get_help_string(action) % params KeyError: 'default' The problem is that in https://github.com/python/cpython/blob/f54fee7f37563fbd569596cf94aad023ac6c3179/Lib/argparse.py#L879, default isn't tested for SUPPRESS as well. I've prepared a patch to fix that and will push it to GitHub soon. (I've experienced the crash with Python 3.9 and 3.10; the test I've created also crashes for the current main branch, so I guess that means that Python 3.11 is also affected. I haven't tested older Python versions before 3.9.) -- components: Library (Lib) messages: 408586 nosy: felixfontein priority: normal severity: normal status: open title: argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified crashes versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified crashes
Change by Felix Fontein : -- keywords: +patch pull_requests: +28333 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30111 ___ Python tracker <https://bugs.python.org/issue46080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified crashes
Change by Felix Fontein : -- type: -> crash ___ Python tracker <https://bugs.python.org/issue46080> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13422] Subprocess: children hang due to open pipes
New submission from Felix Steffenhagen : subprocess.Popen.communicate() hangs for daemonized subprocesses that leave a pipe open. The python caller, invoking the daemon subprocess, runs as long as the daemon process. This happens on POSIX platforms with python 2.7 as well as 3.2. Please find attached a simple python daemon, which leaves stderr pipe open. It runs for 10 sec and then exits. To reproduce the problem run the following start script: ## # startpydaemon.py import subprocess cmd = 'python pydaemon.py' print("Starting daemon that runs for 10 sec") daemon = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) stdout, stderr = daemon.communicate() print("Stdout:") print(stdout) print("Stderr:") print(stderr) ## Expected Behavior: -- Daemon starter should exit immediately after the daemon process is initialized. Actual Behavior: Daemon starter waits for daemon process to be finished due to left open error pipe. Workaround: --- One workaround is to not capture output from the left-open pipe. This way. -- components: Library (Lib) files: pydaemon.py messages: 147820 nosy: fsteffenhagen priority: normal severity: normal status: open title: Subprocess: children hang due to open pipes versions: Python 2.6, Python 3.2 Added file: http://bugs.python.org/file23719/pydaemon.py ___ Python tracker <http://bugs.python.org/issue13422> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13422] Subprocess: children hang due to open pipes
Changes by Felix Steffenhagen : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue13422> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13422] Subprocess: children hang due to open pipes
Felix Steffenhagen added the comment: The behavior that the daemon is not closing stderr is intentional to reproduce the issue. This problem occured to me when I was invoking the samba init script on a Gentoo system. Invoked from a bash, the initscript was terminating fine. But when I invoked it using the subprocess module, my python script hang. -- ___ Python tracker <http://bugs.python.org/issue13422> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13422] Subprocess: children hang due to open pipes
Felix Steffenhagen added the comment: The problem I have with the solution that is currently implemented is that subprocess is waiting for the spawned child although the child is not running anymore. In my case this issue occured when invoking samba or the small sample daemon (see attached file above). For example, invoking the daemon from a bash, the daemon program exits immediately and its spawned child is running in the background. The point is that the bash is accessible right after starting the daemon. It is not waiting for the daemon process in the background to close the open pipe. What do you think of using a waitpid for this scenario? subprocess.Popen could wait for the pid of the daemon starter and gets back control once the pid of the daemon starter is gone. This way, subprocess.Popen does not need to wait for EOF on left-open pipes. -- ___ Python tracker <http://bugs.python.org/issue13422> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11671] Potential misuse of wsgiref.headers.Headers
New submission from Felix Gröbert : As noted by secur...@python.org's response I'm filing this bug here. In wsgiref.headers.Headers it is possible to include headers which contain a newline (i.e. \n or \r) either through add_header or __init__. It is not uncommon that developers provide web applications to the public in which the HTTP response headers are not filtered for newlines but are controlled by the user. In such scenarios a malicious user can use a newline to inject another header or even initiate a HTTP response body. The impact would be at least equivalent to XSS. Therefore, I suggest to filter/warn/except header tuples which contain the above characters upon assignment in wsgiref.headers. -- components: Library (Lib) messages: 132080 nosy: Felix.Gröbert priority: normal severity: normal status: open title: Potential misuse of wsgiref.headers.Headers type: security versions: Python 3.3 ___ Python tracker <http://bugs.python.org/issue11671> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11671] Security hole in wsgiref.headers.Headers
Felix Gröbert added the comment: If the spec forbids control characters in headers, the module should enforce that. The most frequent example of header injection is the redirect-case: an application is forwarding using the Location header to a user-supplied URL. http://google.com/codesearch?as_q=self.redirect%5C%28self.request.get Other examples are proxies, setting user-agent, or, as you mention, custom set-cookies headers. -- ___ Python tracker <http://bugs.python.org/issue11671> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2504] Add gettext.pgettext() and variants support
Changes by Felix Schwarz : -- nosy: +Felix Schwarz ___ Python tracker <http://bugs.python.org/issue2504> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue770280] PyMarshal_ReadLastObjectFromFile
Paul Felix added the comment: Maybe not. With the addition of thread.stack_size([size]), it's fairly easy to get around the problem by bumping up the stack size. It would be nice if PyMarshal_ReadLastObjectFromFile didn't allocate a small file buffer on the stack (think of the impact when *recursively* importing many .pyc files). Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue770280> ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4522] Module wsgiref is not python3000 ready (unicode issues)
New submission from Felix Benner <[EMAIL PROTECTED]>: wsgiref.handlers.py tries to send strings where bytes is necessary in accordance with PEP333 the attached patch encodes everything with ISO-8859-1. Additionally the patch from Issue 3348 has to be applied. -- components: Library (Lib) files: handlers.diff keywords: patch messages: 76879 nosy: tordmor severity: normal status: open title: Module wsgiref is not python3000 ready (unicode issues) versions: Python 3.0 Added file: http://bugs.python.org/file12216/handlers.diff ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4522> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4522] Module wsgiref is not python3000 ready (unicode issues)
Felix Benner <[EMAIL PROTECTED]> added the comment: The test uses StringIO. I don't understand the test enough to change that. If I understand the WSGI spec correctly then it would be the test that's wrong. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4522> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4142] smtplib doesn't clear helo/ehlo flags on quit
Felix Schwarz added the comment: I can confirm that this issue is still present in Python 2.5.2, 2.6.1 and 3.0.1. The current behavior of smtplib is a clear violation of the SMTP specification. The problem can be reproduced with code like that (stub, pseudo code-like): smtp = smtplib.SMTP() smtp.sendmail('f...@example.com', 'f...@example.com', msg) smtp.quit() smtp.connect() # This command does not send EHLO/HELO again, violating the spec! smtp.sendmail('f...@example.com', 'f...@example.com', msg) Real world bug reports due to this behavior were mostly visible with Exim because this MTA rejects the 'MAIL FROM' if SMTP extension verbs are used without EHLO: * http://groups.google.com/group/turbomail-devel/browse_thread/thread/a25c89a94b42724f * http://www.google.com/search?q=exim+python+%22malformed+address%22+size -- nosy: +Felix Schwarz ___ Python tracker <http://bugs.python.org/issue4142> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4142] smtplib doesn't clear helo/ehlo flags on quit
Changes by Felix Schwarz : -- keywords: +patch Added file: http://bugs.python.org/file13100/helo.patch ___ Python tracker <http://bugs.python.org/issue4142> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4142] smtplib doesn't clear helo/ehlo flags on quit
Changes by Felix Schwarz : -- versions: +Python 2.5, Python 2.6, Python 2.7, Python 3.0 ___ Python tracker <http://bugs.python.org/issue4142> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43139] test_ttk test_compound and test_tk test_type fails with Tk 8.6.11.1
New submission from Felix Yan : == FAIL: test_compound (tkinter.test.test_ttk.test_widgets.ButtonTest) -- Traceback (most recent call last): File "/build/python/src/Python-3.9.1/Lib/tkinter/test/test_ttk/test_widgets.py", line 173, in test_compound self.checkEnumParam(widget, 'compound', File "/build/python/src/Python-3.9.1/Lib/tkinter/test/widget_tests.py", line 152, in checkEnumParam self.checkInvalidParam(widget, name, '', File "/build/python/src/Python-3.9.1/Lib/tkinter/test/widget_tests.py", line 75, in checkInvalidParam widget[name] = value AssertionError: TclError not raised = FAIL: test_type (tkinter.test.test_tkinter.test_widgets.MenuTest) -- Traceback (most recent call last): File "/build/python/src/Python-3.9.1/Lib/tkinter/test/test_tkinter/test_widgets.py", line 1245, in test_type self.checkEnumParam(widget, 'type', File "/build/python/src/Python-3.9.1/Lib/tkinter/test/widget_tests.py", line 152, in checkEnumParam self.checkInvalidParam(widget, name, '', File "/build/python/src/Python-3.9.1/Lib/tkinter/test/widget_tests.py", line 75, in checkInvalidParam widget[name] = value AssertionError: TclError not raised -- -- components: Tests messages: 386538 nosy: felixonmars priority: normal severity: normal status: open title: test_ttk test_compound and test_tk test_type fails with Tk 8.6.11.1 type: behavior versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43139> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43139] test_ttk test_compound and test_tk test_type fails with Tk 8.6.11.1
Felix Yan added the comment: It's Arch Linux x86_64 with system tcl/tk. It's build in a clean chroot for packaging and always reproducible. -- ___ Python tracker <https://bugs.python.org/issue43139> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41302] _decimal failed to build with system libmpdec 2.5
New submission from Felix Yan : In bpo-40874, mpdecimal.h in the vendored libmpdec has defines of UNUSED while the standalone released version of mpdecimal 2.5.0 doesn't. This breaks _decimal module build with system libmpdec due to UNUSED is undefined. Errors are like: cpython/Modules/_decimal/_decimal.c:277:36: error: expected ‘;’, ‘,’ or ‘)’ before ‘UNUSED’ 277 | dec_traphandler(mpd_context_t *ctx UNUSED) /* GCOV_NOT_REACHED */ |^~ Reproducible in both 3.8 branch and master (didn't test 3.9, but should be affected too). -- components: Extension Modules messages: 373676 nosy: felixonmars, skrah priority: normal severity: normal status: open title: _decimal failed to build with system libmpdec 2.5 type: compile error versions: Python 3.10, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue41302> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41302] _decimal failed to build with system libmpdec 2.5
Change by Felix Yan : -- keywords: +patch pull_requests: +20624 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/21481 ___ Python tracker <https://bugs.python.org/issue41302> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41302] _decimal failed to build with system libmpdec 2.5
Felix Yan added the comment: Yes, I am currently defining it manually as a workaround for building 3.8.4 in Arch. Also opened GH-21481 for this :) -- ___ Python tracker <https://bugs.python.org/issue41302> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41302] _decimal failed to build with system libmpdec 2.5
Change by Felix Yan : -- pull_requests: +20631 status: pending -> open pull_request: https://github.com/python/cpython/pull/21488 ___ Python tracker <https://bugs.python.org/issue41302> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41306] test_tk failure on Arch Linux
New submission from Felix Yan : test_from (tkinter.test.test_tkinter.test_widgets.ScaleTest) is currently failing on Arch Linux, and at least another place: https://python-build-standalone.readthedocs.io/en/latest/status.html The error looks like: == FAIL: test_from (tkinter.test.test_tkinter.test_widgets.ScaleTest) -- Traceback (most recent call last): File "/usr/lib/python3.8/tkinter/test/test_tkinter/test_widgets.py", line 939, in test_from self.checkFloatParam(widget, 'from', 100, 14.9, 15.1, conv=float_round) File "/usr/lib/python3.8/tkinter/test/widget_tests.py", line 106, in checkFloatParam self.checkParam(widget, name, value, conv=conv, **kwargs) File "/usr/lib/python3.8/tkinter/test/widget_tests.py", line 64, in checkParam self.assertEqual2(widget.cget(name), expected, eq=eq) File "/usr/lib/python3.8/tkinter/test/widget_tests.py", line 47, in assertEqual2 self.assertEqual(actual, expected, msg) AssertionError: 14.9 != 15.0 It's the only failure in the current Python 3.8.4 release's test suite here. Also adding Python 3.9 and 3.10 as I am able to reproduce it on master too. -- components: Tests messages: 373710 nosy: felixonmars priority: normal severity: normal status: open title: test_tk failure on Arch Linux versions: Python 3.10, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue41306> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41306] test_tk failure on Arch Linux
Felix Yan added the comment: tkinter.TCL_VERSION: 8.6 tkinter.TK_VERSION: 8.6 tkinter.info_patchlevel: 8.6.10 It's always reproducible in either a real desktop or Xvfb with arbitrary resolution etc as far as I have tested. -- ___ Python tracker <https://bugs.python.org/issue41306> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41346] test_thousand and compileall hangs on riscv64
New submission from Felix Yan : In my riscv64 build, test_thousand (test.test_multiprocessing_forkserver.WithProcessesTestBarrier) always hangs on some locking thing, and the compileall part during installation hangs the same way. I am not sure if it's toolchain related or something else, though. Some relevant versions: Linux riscv64-unknown-linux-gnu Python 3.8.4 glibc 2.31 gcc 10.1.0 configure switches: ./configure --prefix=/usr \ --enable-shared \ --with-computed-gotos \ --enable-optimizations \ --with-lto \ --enable-ipv6 \ --with-system-expat \ --with-dbmliborder=gdbm:ndbm \ --with-system-ffi \ --with-system-libmpdec \ --enable-loadable-sqlite-extensions \ --without-ensurepip When Ctrl-C: test_thousand (test.test_multiprocessing_forkserver.WithProcessesTestBarrier) ... ^CProcess Process-1305: Traceback (most recent call last): File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/build/python/src/Python-3.8.4/Lib/test/_test_multiprocessing.py", line 1970, in _test_thousand_f barrier.wait() File "/build/python/src/Python-3.8.4/Lib/threading.py", line 610, in wait self._enter() # Block while the barrier drains. File "/build/python/src/Python-3.8.4/Lib/threading.py", line 631, in _enter self._cond.wait() File "/build/python/src/Python-3.8.4/Lib/multiprocessing/synchronize.py", line 261, in wait return self._wait_semaphore.acquire(True, timeout) KeyboardInterrupt Process Process-1304: Traceback (most recent call last): File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/build/python/src/Python-3.8.4/Lib/test/_test_multiprocessing.py", line 1970, in _test_thousand_f barrier.wait() File "/build/python/src/Python-3.8.4/Lib/threading.py", line 610, in wait self._enter() # Block while the barrier drains. File "/build/python/src/Python-3.8.4/Lib/threading.py", line 631, in _enter self._cond.wait() File "/build/python/src/Python-3.8.4/Lib/multiprocessing/synchronize.py", line 261, in wait return self._wait_semaphore.acquire(True, timeout) KeyboardInterrupt Process Process-1306: Traceback (most recent call last): File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/build/python/src/Python-3.8.4/Lib/test/_test_multiprocessing.py", line 1970, in _test_thousand_f barrier.wait() File "/build/python/src/Python-3.8.4/Lib/threading.py", line 610, in wait self._enter() # Block while the barrier drains. File "/build/python/src/Python-3.8.4/Lib/threading.py", line 631, in _enter self._cond.wait() File "/build/python/src/Python-3.8.4/Lib/multiprocessing/synchronize.py", line 261, in wait return self._wait_semaphore.acquire(True, timeout) KeyboardInterrupt Process Process-1302: Traceback (most recent call last): File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/build/python/src/Python-3.8.4/Lib/test/_test_multiprocessing.py", line 1970, in _test_thousand_f barrier.wait() File "/build/python/src/Python-3.8.4/Lib/threading.py", line 610, in wait self._enter() # Block while the barrier drains. File "/build/python/src/Python-3.8.4/Lib/threading.py", line 631, in _enter self._cond.wait() File "/build/python/src/Python-3.8.4/Lib/multiprocessing/synchronize.py", line 261, in wait return self._wait_semaphore.acquire(True, timeout) KeyboardInterrupt Process Process-1303: Traceback (most recent call last): File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/build/python/src/Python-3.8.4/Lib/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/build/python/src/Python-3.8.4/Lib/test/_test_multiprocessing.py", line 1970, in _test_thousand_f barrier.wait() File "/build/python
[issue41970] test_lib2to3 fails since Python 3.9
New submission from Felix Yan : I am packaging Python for Arch and the tests suite of Python 3.8.6 pass here without this: ``` 0:09:06 load avg: 0.87 [205/424] test_lib2to3 test test_lib2to3 crashed -- Traceback (most recent call last): File "/build/python/src/Python-3.9.0/Lib/test/libregrtest/runtest.py", line 270, in _runtest_inner refleak = _runtest_inner2(ns, test_name) File "/build/python/src/Python-3.9.0/Lib/test/libregrtest/runtest.py", line 221, in _runtest_inner2 the_module = importlib.import_module(abstest) File "/build/python/src/Python-3.9.0/Lib/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "/build/python/src/Python-3.9.0/Lib/test/test_lib2to3.py", line 5, in from lib2to3.tests import load_tests
[issue41971] multiple tests in test_tools fail since Python 3.9
New submission from Felix Yan : I am packaging Python for Arch and the test suite of Python 3.8.6 passes here without these: == FAIL: test_multiple_roots (test.test_tools.test_c_analyzer.test_common.test_files.IterFilesTests) -- Traceback (most recent call last): File "/build/python/src/Python-3.9.0/Lib/test/test_tools/test_c_analyzer/test_common/test_files.py", line 118, in test_multiple_roots self.assertEqual(self.calls, [ AssertionError: Lists differ: [('_w[26 chars]tion walk at 0x7ff2eb562f70>)), ('_walk', ('eg[42 chars]0>))] != [('_w[26 chars]tion _walk_tree at 0x7ff2e5babdc0>)), ('_walk'[54 chars]0>))] First differing element 0: ('_walk', ('spam', '.c', )) ('_walk', ('spam', '.c', )) - [('_walk', ('spam', '.c', )), ? ^ + [('_walk', ('spam', '.c', )), ? ++ + - ('_walk', ('eggs', '.c', ))] ? ^ + ('_walk', ('eggs', '.c', ))] ? ++ + == FAIL: test_multiple_suffixes (test.test_tools.test_c_analyzer.test_common.test_files.IterFilesTests) -- Traceback (most recent call last): File "/build/python/src/Python-3.9.0/Lib/test/test_tools/test_c_analyzer/test_common/test_files.py", line 189, in test_multiple_suffixes self.assertEqual(self.calls, [ AssertionError: Lists differ: [('_walk', ('spam', None, ))] != [('_walk', ('spam', None, ))] First differing element 0: ('_walk', ('spam', None, )) ('_walk', ('spam', None, )) - [('_walk', ('spam', None, ))] ? ^ + [('_walk', ('spam', None, ))] ? ++ + == FAIL: test_no_suffix (test.test_tools.test_c_analyzer.test_common.test_files.IterFilesTests) [None] -- Traceback (most recent call last): File "/build/python/src/Python-3.9.0/Lib/test/test_tools/test_c_analyzer/test_common/test_files.py", line 209, in test_no_suffix self.assertEqual(self.calls, [ AssertionError: Lists differ: [('_walk', ('spam', None, ))] != [('_walk', ('spam', None, ))] First differing element 0: ('_walk', ('spam', None, )) ('_walk', ('spam', None, )) - [('_walk', ('spam', None, ))] ? ^ + [('_walk', ('spam', None, ))] ? ++ + == FAIL: test_no_suffix (test.test_tools.test_c_analyzer.test_common.test_files.IterFilesTests) [] -- Traceback (most recent call last): File "/build/python/src/Python-3.9.0/Lib/test/test_tools/test_c_analyzer/test_common/test_files.py", line 209, in test_no_suffix self.assertEqual(self.calls, [ AssertionError: Lists differ: [('_walk', ('spam', '', ))] != [('_walk', ('spam', '', ))] First differing element 0: ('_walk', ('spam', '', )) ('_walk', ('spam', '', )) - [('_walk', ('spam', '', ))] ? ^ + [('_walk', ('spam', '', ))] ? ++ + == FAIL: test_no_suffix (test.test_tools.test_c_analyzer.test_common.test_files.IterFilesTests) [()] -- Traceback (most recent call last): File "/build/python/src/Python-3.9.0/Lib/test/test_tools/test_c_analyzer/test_common/test_files.py", line 209, in test_no_suffix self.assertEqual(self.calls, [ AssertionError: Lists differ: [('_walk', ('spam', (), ))] != [('_walk', ('spam', (), ))] First differing element 0: ('_walk'
[issue41970] test_lib2to3 fails since Python 3.9
Felix Yan added the comment: I use this in Arch's packaging: LC_CTYPE=en_US.UTF-8 xvfb-run -s "-screen 0 1920x1080x16 -ac +extension GLX" -a -n "$servernum" \ "${srcdir}/Python-${pkgver}/python" -m test.regrtest -v -uall -x test_tk (test_tk is currently skipped due to https://bugs.python.org/issue41306) -- ___ Python tracker <https://bugs.python.org/issue41970> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34144] venv activate.bat reset codepage fails on windows 10
Change by Felix Vollmer : -- nosy: +Felix Vollmer ___ Python tracker <https://bugs.python.org/issue34144> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18680] JSONDecoder should document that it raises a ValueError for malformed data
Felix Crux added the comment: Working with wolever on the process, generated the attached patch. -- keywords: +patch nosy: +felixc, wolever Added file: http://bugs.python.org/file31263/18680.patch ___ Python tracker <http://bugs.python.org/issue18680> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20700] Docs sidebar scrolls strangely in 3.4 docs
New submission from David Felix: On longer documentation pages, the sidebar is scrolling out of view and in an unexpected manner when the main page is scrolled. Seems to only affect 3.4 docs, but I'm not positive. http://docs.python.org/3.4/whatsnew/3.4.html is a good example. Using Firefox 27.0.1 I view this page and scroll down. When I scroll down in the main area (the page is moving upwards in my view) past the summary section, the left side bar/navigation begins scrolling in the opposite direction, presumably to keep up with my scrolling. Its movement is not proportional to my downward scrolling and it is quickly lost "below" the view. -- assignee: docs@python components: Documentation messages: 211729 nosy: David.Felix, docs@python priority: normal severity: normal status: open title: Docs sidebar scrolls strangely in 3.4 docs versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue20700> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27650] Implement `__repr__` methods for logging.Logger and others
Changes by Felix Yan : -- nosy: +felixonmars ___ Python tracker <http://bugs.python.org/issue27650> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17455] ImportError (xml.dom.minidom) in /usr/lib/python2.7/dist-packages/apport/report.py
New submission from Felix Matenaar: We're getting the following exception in a custom testing framework using sqlalchemy. Our process is running several days and the exception seems to occurs unproducably during runtime, sometimes after a day and sometimes after a couple of hours. The same code is executed many times before. To me it looks like SQLAlchemy crashed which then leads to the import error. Maybe I'll have to issue a bug for this specific project but first wanted to ask you guys. File "/home/test/research/testing/db.py", line 101, in addException self.testrun.exceptions.append(exc) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 168, in _get_ return self.impl.get(instance_state(instance),dict_) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 453, in get value = self.callable_(state, passive) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/strategies.py", line 563, in _load_for_state result = q.all() File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 1947, in all return list(self) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2057, in _iter_ return self._execute_and_instances(context) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2070, in _execute_and_instances close_with_result=True) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2061, in _connection_from_session **kw) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 719, in connection close_with_result=close_with_result) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 723, in _connection_for_bind return self.transaction._connection_for_bind(engine) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 266, in _connection_for_bind conn = bind.contextual_connect() File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2340, in contextual_connect self.pool.connect(), File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 210, in connect return _ConnectionFairy(self).checkout() File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 371, in _init_ rec = self._connection_record = pool._do_get() File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 758, in _do_get return self._create_connection() File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 174, in _create_connection return _ConnectionRecord(self) File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 256, in _init_ self.connection = self.__connect() File "/usr/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 316, in __connect connection = self.__pool._creator() File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 80, in connect return dialect.connect(*cargs, **cparams) File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 280, in connect return self.dbapi.connect(*cargs, **cparams) sqlalchemy.exc.OperationalError: (OperationalError) unable to open database file None None Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python2.7/dist-packages/apport/_init_.py", line 1, in from apport.report import Report File "/usr/lib/python2.7/dist-packages/apport/report.py", line 15, in import xml.dom, xml.dom.minidom ImportError: No module named minidom Original exception was: Traceback (most recent call last): File "./test", line 72, in prog.run() File "./test", line 67, in run ts.run(self._getStorageBackend()) File "/home/test/research/testing/testsets.py", line 104, in run storage.addException(exc) File "/home/test/research/testing/db.py", line 101, in addException self.testrun.exceptions.append(exc) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 168, in _get_ return self.impl.get(instance_state(instance),dict_) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 453, in get value = self.callable_(state, passive) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/strategies.py", line 563, in _load_for_state result = q.all() File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 1947, in all return list(self) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2057, in _iter_ return self._execute_and_instances(context) File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2070, in _execute_and_instances clo
[issue24902] http.server: on startup, show host/port as URL
New submission from Felix Kaiser: http.server: on startup, show host/port as URL Old: % python3 -m http.server Serving HTTP on 0.0.0.0 port 8000 ... New: % ./python -m http.server Serving http://0.0.0.0:8000/ ... This is useful because (modern) terminals will auto-detect URLs and make them clickable, so printing an URL makes it easier to navigate the browser there. -- components: Library (Lib) files: http_server__on_startup_show_host_and_port_as_url.patch keywords: patch messages: 248882 nosy: fxkr priority: normal severity: normal status: open title: http.server: on startup, show host/port as URL type: enhancement Added file: http://bugs.python.org/file40214/http_server__on_startup_show_host_and_port_as_url.patch ___ Python tracker <http://bugs.python.org/issue24902> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24902] http.server: on startup, show host/port as URL
Felix Kaiser added the comment: I'm not sure - that'd be redundant, and I find it harder to read. It also breaks for badly configured terminals where "("/")" are part of the select-by-word character set (but thats a very minor issue -- users with parentheses in the set will probably be used to broken links). Here's a new patch though. Your choice :-) As for breaking programs: that message is clearly intended for human consumption. My opinion is that if someone parses that, they deserve the opportunity to fix their code. However, out of curiosity, I did search for code containing "Serving HTTP on" before opening the issue and couldn't find anything that's parsing that message. -- Added file: http://bugs.python.org/file40215/http_server__on_startup_show_host_and_port_as_url.patch ___ Python tracker <http://bugs.python.org/issue24902> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24950] FAIL: test_expanduser when $HOME=/
New submission from Felix Yan: test_expanduser in test.test_posixpath.PosixPathTest fails when the users $HOME being exactly "/", after the patch in issue17809 was introduced. test test_posixpath failed -- Traceback (most recent call last): File "/build/python/src/Python-3.5.0rc2/Lib/test/test_posixpath.py", line 249, in test_expanduser self.assertEqual(posixpath.expanduser("~"), home.rstrip("/")) AssertionError: '/' != '' - / + Would it be appropriate to apply the rstrip() also to the left part of the equation? -- components: Tests messages: 249273 nosy: felixonmars priority: normal severity: normal status: open title: FAIL: test_expanduser when $HOME=/ type: behavior versions: Python 3.3, Python 3.4, Python 3.5 ___ Python tracker <http://bugs.python.org/issue24950> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24950] FAIL: test_posixpath when $HOME=/
Changes by Felix Yan : -- title: FAIL: test_expanduser when $HOME=/ -> FAIL: test_posixpath when $HOME=/ ___ Python tracker <http://bugs.python.org/issue24950> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24950] FAIL: test_expanduser when $HOME=/
Changes by Felix Yan : -- title: FAIL: test_posixpath when $HOME=/ -> FAIL: test_expanduser when $HOME=/ ___ Python tracker <http://bugs.python.org/issue24950> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24950] FAIL: test_expanduser when $HOME=/
Felix Yan added the comment: btw, there seems to be a relevant failure in test_pathlib as well: test test_pathlib failed -- Traceback (most recent call last): File "/build/python/src/Python-3.5.0rc2/Lib/test/test_pathlib.py", line 2015, in test_expanduser self.assertEqual(p1.expanduser(), P(userhome) / 'Documents') AssertionError: PosixPath('/Documents') != PosixPath('Documents') (not sure if they are really relevant, though) -- ___ Python tracker <http://bugs.python.org/issue24950> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24902] http.server: on startup, show host/port as URL
Felix Kaiser added the comment: So do I, but I can live with either way. Can one of you merge one of these patches? -- ___ Python tracker <http://bugs.python.org/issue24902> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25096] test_gdb failed to read version for gdb >= 7.10
New submission from Felix Yan: The regex in test_gdb reads only one digit of gdb's minor version, which would fail for gdb >= 7.10, and skip the test as 7.1 < 7.4. Original commit: https://hg.python.org/cpython/rev/b71cda2f48c6#l1.9 Patch attached. -- components: Tests files: test_gdb-version-fix.patch keywords: patch messages: 250608 nosy: felixonmars priority: normal severity: normal status: open title: test_gdb failed to read version for gdb >= 7.10 type: behavior versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file40453/test_gdb-version-fix.patch ___ Python tracker <http://bugs.python.org/issue25096> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25195] mock.ANY doesn't match mock.MagicMock() object
Changes by Felix Yan : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue25195> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25195] mock.ANY doesn't match mock.MagicMock() object
New submission from Felix Yan: Since Python 3.5.0 mock.MagicMock() object seems not matched by mock.ANY. This behavior looks weird and breaks tests of boto. Minimized example: In Python 3.4.3: >>> from unittest import mock >>> m = mock.MagicMock() >>> m(mock.MagicMock()) >>> m.assert_called_with(mock.ANY) >>> In Python 3.5.0: >>> from unittest import mock >>> m = mock.MagicMock() >>> m(mock.MagicMock()) >>> m.assert_called_with(mock.ANY) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.5/unittest/mock.py", line 792, in assert_called_with raise AssertionError(_error_message()) from cause AssertionError: Expected call: mock() Actual call: mock() -- components: Library (Lib) messages: 251162 nosy: felixonmars priority: normal severity: normal status: open title: mock.ANY doesn't match mock.MagicMock() object versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue25195> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Change by Felix C. Stegerman : -- nosy: +obfusk ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Change by Felix C. Stegerman : -- keywords: +patch pull_requests: +23737 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24979 ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Felix C. Stegerman added the comment: I've created a draft PR; RFC :) Also: * setting the date to (1980,0,0,0,0,0) already works; * the main issue seems to be that external_attr cannot be 0 atm. -- ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Felix C. Stegerman added the comment: I've closed the PR for now. Using a carefully crafted ZipInfo object doesn't work because ZipFile modifies its .external_attr when set to 0. Using something like this quickly hacked together ZipInfo subclass does work: class ZeroedZipInfo(zipfile.ZipInfo): def __init__(self, zinfo): for k in self.__slots__: setattr(self, k, getattr(zinfo, k)) def __getattribute__(self, name): if name == "date_time": return (1980,0,0,0,0,0) if name == "external_attr": return 0 return object.__getattribute__(self, name) ... myzipfile.writestr(ZeroedZipInfo(info), data) -- components: +IO type: enhancement -> versions: +Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Change by Felix C. Stegerman : -- components: -IO, Library (Lib) versions: -Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Change by Felix C. Stegerman : -- components: +Library (Lib) ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Change by Felix C. Stegerman : -- type: -> enhancement ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Felix C. Stegerman added the comment: > external_attr == 0 may cause issues with permissions. That may be true in some scenarios, but not being able to set it to 0 means you can't create identical files to those produced by other tools -- like those used to generate APKs -- which do in fact set it to 0. -- ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Felix C. Stegerman added the comment: > The __getattr__ hack is not needed. You can reset the flags in a different, > more straight forward way As mentioned, ZipFile._open_to_write() will modify the ZipInfo's .external_attr when it is set to 0. > I just found another specific example in _open_to_write(). 0 is a valid > value for zinfo.external_attr. But this code always forces 0 to something > else: > > if not zinfo.external_attr: > zinfo.external_attr = 0o600 << 16 # permissions: ?rw--- Your alternative doesn't seem to take that subsequent modification into account. -- ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2824] zipfile to handle duplicate files in archive
Change by Felix C. Stegerman : -- nosy: +obfusk ___ Python tracker <https://bugs.python.org/issue2824> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29708] support reproducible Python builds
Change by Felix C. Stegerman : -- nosy: +obfusk ___ Python tracker <https://bugs.python.org/issue29708> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29708] support reproducible Python builds
Felix C. Stegerman added the comment: Hi! I've been working on reproducible builds for python-for-android [1,2,3]. Current issues with .pyc files are: * .pyc files differ depending on whether Python was compiled w/ liblzma-dev installed or not; * many .pyc files include build paths; * some .pyc files include paths to system utilities, like `/bin/mkdir` or `/usr/bin/install`, which can differ between systems (e.g. on Debian w/ merged /usr). [1] https://github.com/kivy/python-for-android/pull/2390 [2] https://lists.reproducible-builds.org/pipermail/rb-general/2021-January/002132.html [3] https://lists.reproducible-builds.org/pipermail/rb-general/2021-March/002207.html -- ___ Python tracker <https://bugs.python.org/issue29708> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43547] support ZIP files with zeroed out fields (e.g. for reproducible builds)
Felix C. Stegerman added the comment: https://github.com/obfusk/apksigcopier currently produces reproducible ZIP files identical to those produced by apksigner using this code: DATETIMEZERO = (1980, 0, 0, 0, 0, 0) class ReproducibleZipInfo(zipfile.ZipInfo): """Reproducible ZipInfo hack.""" _override = {} # type: Dict[str, Any] def __init__(self, zinfo, **override): if override: self._override = {**self._override, **override} for k in self.__slots__: if hasattr(zinfo, k): setattr(self, k, getattr(zinfo, k)) def __getattribute__(self, name): if name != "_override": try: return self._override[name] except KeyError: pass return object.__getattribute__(self, name) class APKZipInfo(ReproducibleZipInfo): """Reproducible ZipInfo for APK files.""" _override = dict( compress_type=8, create_system=0, create_version=20, date_time=DATETIMEZERO, external_attr=0, extract_version=20, flag_bits=0x800, ) def patch_meta(...): ... with zipfile.ZipFile(output_apk, "a") as zf_out: info_data = [(APKZipInfo(info, date_time=date_time), data) for info, data in extracted_meta] _write_to_zip(info_data, zf_out) if sys.version_info >= (3, 7): def _write_to_zip(info_data, zf_out): for info, data in info_data: zf_out.writestr(info, data, compresslevel=9) else: def _write_to_zip(info_data, zf_out): old = zipfile._get_compressor zipfile._get_compressor = lambda _: zlib.compressobj(9, 8, -15) try: for info, data in info_data: zf_out.writestr(info, data) finally: zipfile._get_compressor = old -- ___ Python tracker <https://bugs.python.org/issue43547> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order
Change by Felix C. Stegerman : -- nosy: +obfusk ___ Python tracker <https://bugs.python.org/issue37596> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42151] Pure Python xml.etree.ElementTree is missing default attribute values
New submission from Felix C. Stegerman : I originally reported this as a bug in PyPy, but it turns out that CPython's C implementation (_elementtree) behaves differently than the pure Python version (b/c it sets specified_attributes = 1). PyPy issue with example code: https://foss.heptapod.net/pypy/pypy/-/issues/ -- components: Library (Lib) messages: 379637 nosy: obfusk priority: normal severity: normal status: open title: Pure Python xml.etree.ElementTree is missing default attribute values type: behavior versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue42151> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42151] Pure Python xml.etree.ElementTree is missing default attribute values
Change by Felix C. Stegerman : -- keywords: +patch pull_requests: +21901 stage: -> patch review pull_request: https://github.com/python/cpython/pull/22987 ___ Python tracker <https://bugs.python.org/issue42151> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42151] Pure Python xml.etree.ElementTree is missing default attribute values
Felix C. Stegerman added the comment: > specified_attributes = True is also set in xml.dom.expatbuilder. That's good to know and should perhaps be addressed as well. > Should not it be set to true in the C implementation of ElementTree? That would break existing code. Including mine. I also think the current behaviour of the C implementation makes a lot more sense, especially as there is currently no way to request the alternative. I think using specified_attributes=False as the default behaviour for both implementations is the best solution. But I certainly would not oppose adding e.g. a keyword argument to override the default behaviour for those who would prefer the alternative. -- ___ Python tracker <https://bugs.python.org/issue42151> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10387] ConfigParser's getboolean method is broken
New submission from Felix Laurie von Massenbach : If the config file has a boolean formatted as either True or False, python raises an attribute error when doing str.lower() on it. In my code I've worked around this in the following way: class MyConfigParser(ConfigParser.RawConfigParser): def getboolean(self, section, option): result = self.get(section, option) try: trues = ["1", "yes", "true", "on"] falses = ["0", "no", "false", "off"] if result in trues: return True if result in falses: return False except AttributeError as err: if str(err) == "\'bool\' object has no attribute \'lower\'": return result raise err Felix (p.s. first bug report, sorry if it's a bit of a mess...) -- components: Extension Modules messages: 120943 nosy: Felix.Laurie.von.Massenbach priority: normal severity: normal status: open title: ConfigParser's getboolean method is broken type: crash versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue10387> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10387] ConfigParser's getboolean method is broken
Felix Laurie von Massenbach added the comment: Oops, that was the broken first version. Let's try again: class MyConfigParser(ConfigParser.RawConfigParser): def getboolean(self, section, option): result = self.get(section, option) try: trues = ["1", "yes", "true", "on"] falses = ["0", "no", "false", "off"] if result.lower() in trues: return True if result.lower() in falses: return False except AttributeError as err: if str(err) == "\'bool\' object has no attribute \'lower\'": return result raise err Felix -- ___ Python tracker <http://bugs.python.org/issue10387> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10387] ConfigParser's getboolean method is broken
Felix Laurie von Massenbach added the comment: Perhaps I don't understand fully, but I am reading, for example, "option = True" from a config file. When doing this getboolean raises: AttributeError: 'bool' object has no attribute 'lower' Is it intended that you cannot store "True" and "False" as values in the config file? Apologies if I'm being dense. Felix -- ___ Python tracker <http://bugs.python.org/issue10387> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10387] ConfigParser's getboolean method is broken
Felix Laurie von Massenbach added the comment: Ok, so I understand the issue, but why doesn't the set method simply convert to a string? >>> from ConfigParser import RawConfigParser >>> from StringIO import StringIO >>> parser = RawConfigParser() >>> config = """ [section] test = True """ >>> parser.readfp(StringIO(config)) >>> parser.get("section", "test") 'True' >>> parser.getboolean("section", "test") True >>> parser.set("section", "test", True) >>> parser.get("section", "test") True >>> parser.getboolean("section", "test") Traceback (most recent call last): File "", line 1, in parser.getboolean("section", "test") File "C:\Python27\lib\ConfigParser.py", line 361, in getboolean if v.lower() not in self._boolean_states: AttributeError: 'bool' object has no attribute 'lower' -- ___ Python tracker <http://bugs.python.org/issue10387> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com