[issue6717] Some problem with recursion handling
Dino Viehland added the comment: I ran into a similar issue and believe I have a simpler repro. I think the issue here might be that when you take a stack overflow inside of a sys.settrace handler that you can then later violate the stack depth. The attached test.py has no dependencies and crashes 3.x but works on 2.x. -- nosy: +dino.viehland Added file: http://bugs.python.org/file22365/test.py ___ Python tracker <http://bugs.python.org/issue6717> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9737] Del on memoryview crashes CPython
New submission from Dino Viehland : x = bytearray(b'abc') y = memoryview(x) del y[0:1] This crashes CPython 3.1.1 and 2.7. -- components: Interpreter Core messages: 115333 nosy: dino.viehland priority: normal severity: normal status: open title: Del on memoryview crashes CPython type: crash versions: Python 2.7, Python 3.1 ___ Python tracker <http://bugs.python.org/issue9737> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9814] subprocess isn't friendly to other Python implementations with different GCs
New submission from Dino Viehland : subprocess isn't very friendly to implementations with different GCs then CPython and in general relies on behavior that's not going to be very stable. I noticed the following issues but was able to work around all of them. First Popen is a finalizable object which holds onto another finalizable object (the process handle). In __del__ Popen calls internal poll which attempts to wait on the handle. But because both the handle and the POpen object can go out of scope at the same time the handle can be finalized first. The end result is that you cannot get the return code and therefore the Popen class will resurrect it's self. That will at the very least leak the Popen object and when running the subprocess tests will eventually start failing all of the tests. For me this was happening because test_cwd doesn't call wait and therefore never explicitly gets the exit code. Resurrecting finalizable objects seems like a pretty bad idea and seems to be there only for test purposes - after all who cares if you collect the exit code after no one refers to the object. Unless _active is supposed to be publicly exposed? Another issue is relying on CPython's reference counting garbage collcetion. In particular _get_handles on Windows does "p2cread = self._make_inheritable(p2cread)" where stdin == PIPE. On CPython this is going to remove the 1 reference to the previous p2cread and close it immediately. With other GCs this reference will linger around only to be closed at some point. Usually that's not a problem but because this handle remains in the parent process the pipe does not get closed when it should resulting in hangs. This is effectively a duplicated handle of the handle _execute_child closes after the child is launched. -- components: Library (Lib) messages: 115979 nosy: dino.viehland priority: low severity: normal status: open title: subprocess isn't friendly to other Python implementations with different GCs type: behavior ___ Python tracker <http://bugs.python.org/issue9814> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
New submission from Dino Viehland : This adds new test cases for bugs reported by Thomas Heller against IronPython for ctypes and winreg: ctypes: the variant bool type isn't supported winreg: errno is not correctly set when QueryValue fails -- assignee: theller components: Windows, ctypes files: patch.diff keywords: patch messages: 98844 nosy: DinoV, theller severity: normal status: open title: Add test cases for ctypes/winreg for issues found in IronPython versions: Python 2.7 Added file: http://bugs.python.org/file16131/patch.diff ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
Changes by Dino Viehland : -- type: -> behavior versions: +Python 3.2 Added file: http://bugs.python.org/file16132/patch30.diff ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
Dino Viehland added the comment: The problem with assertRaises is I need to actually check the errno on the exception and assertRaises doesn't let me do that. -- ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
Dino Viehland added the comment: I'll switch to the context manager form in the 3.x branch - it looks like that's not available in the 2.x branch. -- ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
Changes by Dino Viehland : Added file: http://bugs.python.org/file16133/patch30.diff ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
Dino Viehland added the comment: Ezio: I'm going to stick w/ assertEqual here as Michael points out these are different. In particular I want to make sure that you can assign any true value to the ctypes field but when you read it back you get True or False regardless of the value assigned. -- ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
Changes by Dino Viehland : Added file: http://bugs.python.org/file16134/patch.diff ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
Changes by Dino Viehland : Added file: http://bugs.python.org/file16135/patch30.diff ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
Dino Viehland added the comment: Ahh, so it is in 2.7, apparently I was in a 2.6 enlistment. I've updated the 2.x patch to use the context manager as well. I've also switched to using assertTrue(x is True) and assertTrue(x is False) so that it's not checking precisely for the bool value based upon Ezio's feedback. -- ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7855] Add test cases for ctypes/winreg for issues found in IronPython
Dino Viehland added the comment: Brett Cannon was going to try and look at it and commit it. If you think it looks good you can commit it :) I do not yet have commit privledges simply because I need to gen my SSH key and send that off to Brett. I'm also hoping to get a little hand holding on the 1st few check-ins. -- ___ Python tracker <http://bugs.python.org/issue7855> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4348] bytearray methods returning self
New submission from Dino Viehland <[EMAIL PROTECTED]>: In 2.6 but not in 3.0 RC2: x = bytearray(b'abc') y = x.replace(b'abc', b'bar', 0) id(x) == id(y) In 2.6 and in 3.0 RC2: t = bytearray() for i in range(256): t.append(i) x = bytearray(b'') y = x.translate(t) id(x) == id(y) -- messages: 76012 nosy: DinoV severity: normal status: open title: bytearray methods returning self type: behavior versions: Python 2.6, Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4348> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4482] 10e667.__format__('+') should return 'inf'
New submission from Dino Viehland <[EMAIL PROTECTED]>: 10e667.__format__('+') returns '+1.0#INF' vs: 10e667.__format__('') which returns 'inf' The docs say 'inf' is right. -- messages: 76703 nosy: DinoV severity: normal status: open title: 10e667.__format__('+') should return 'inf' versions: Python 2.6, Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4482> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4482] 10e667.__format__('+') should return 'inf'
Changes by Dino Viehland <[EMAIL PROTECTED]>: -- components: +Interpreter Core type: -> behavior ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4482> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46965] Enable informing callee it's awaited via vector call flag
New submission from Dino Viehland : The idea here is to add a new flag to the vectorcall nargs that indicates the call is being awaited: _Py_AWAITED_CALL_MARKER. This flag will allow the callee to know that it's being eagerly evaluated. When the call is eagerly evaluated the callee can potentially avoid various amounts of overhead. For a coroutine the function can avoid creating the coroutine object and instead returns a singleton instance of a wait handle indicating eager execution has occurred: https://github.com/facebookincubator/cinder/blob/cinder/3.8/Python/ceval.c#L6617 This gives a small win by reducing the overhead of allocating the co-routine object. For something like gather much more significant wins can be achieved. If all of the inputs have already been computed the creation of tasks and scheduling of them to the event loop can be elided. An example implementation of this is available in Cinder: https://github.com/facebookincubator/cinder/blob/cinder/3.8/Modules/_asynciomodule.c#L7103 Again the gather implementation uses the singleton wait handle object to return the value indicating the computation completed synchronously. We've used this elsewhere in Cinder as well - for example if we have an "AsyncLazyValue" which lazily performs a one-time computation of a value and caches it. Therefore the common case becomes that the value is already available, and the await can be performed without allocating any intermediate values. -- assignee: dino.viehland messages: 414782 nosy: Mark.Shannon, carljm, dino.viehland, gvanrossum, itamaro priority: normal severity: normal stage: needs patch status: open title: Enable informing callee it's awaited via vector call flag type: performance versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue46965> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46965] Enable informing callee it's awaited via vector call flag
Dino Viehland added the comment: Doh, sorry about that link, this one goes to a specific commit: https://github.com/facebookincubator/cinder/blob/6863212ada4b569c15cd95c4e7a838f254c8ccfb/Python/ceval.c#L6642 I do think a new opcode is a good way to go, and that could just be emitted by the compiler when it recognizes the pattern. I think we mainly avoided that because we had some issues around performance testing when we updated the byte code version and the peek was negligible, but with improved call performance in 3.11 that may not be the case anymore. It's probably possible to keep most of gather in Python if necessary, there'd still need to be a C wrapper which could flow the wrapper in and the wait handle creation would need to be possible from Python (which slightly scares me). There's probably also a perf win from the C implementation - I'll see if @v2m has any data on that. -- ___ Python tracker <https://bugs.python.org/issue46965> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26185] zipfile.ZipInfo slots can raise unexpected AttributeError
Dino Viehland added the comment: New changeset 992347d7376765fe3f4fc958fb1be193ba21f6c3 by Dino Viehland (Mickaƫl Schoentgen) in branch 'master': bpo-26185: Fix repr() on empty ZipInfo object (#13441) https://github.com/python/cpython/commit/992347d7376765fe3f4fc958fb1be193ba21f6c3 -- nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue26185> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38069] Make _posixsubprocess PEP-384 compatible
Change by Dino Viehland : -- assignee: dino.viehland components: Extension Modules nosy: dino.viehland, eric.snow priority: normal severity: normal status: open title: Make _posixsubprocess PEP-384 compatible versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38069> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38069] Make _posixsubprocess PEP-384 compatible
Change by Dino Viehland : -- keywords: +patch pull_requests: +15433 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15780 ___ Python tracker <https://bugs.python.org/issue38069> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38071] Make termios PEP-384 compatible
Change by Dino Viehland : -- components: Extension Modules nosy: dino.viehland, eric.snow priority: normal severity: normal status: open title: Make termios PEP-384 compatible type: enhancement versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38071> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38071] Make termios PEP-384 compatible
Change by Dino Viehland : -- keywords: +patch pull_requests: +15438 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15785 ___ Python tracker <https://bugs.python.org/issue38071> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38072] Make grp module PEP-384 compatible
Change by Dino Viehland : -- assignee: dino.viehland components: Extension Modules nosy: dino.viehland, eric.snow priority: normal severity: normal status: open title: Make grp module PEP-384 compatible versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38072> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38072] Make grp module PEP-384 compatible
Change by Dino Viehland : -- keywords: +patch pull_requests: +15441 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15788 ___ Python tracker <https://bugs.python.org/issue38072> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38073] Make pwd module PEP-384 compatible
Change by Dino Viehland : -- keywords: +patch pull_requests: +15443 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15790 ___ Python tracker <https://bugs.python.org/issue38073> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38073] Make pwd module PEP-384 compatible
New submission from Dino Viehland : Make the pwd module PEP-384 compatible -- assignee: dino.viehland components: Extension Modules messages: 351495 nosy: dino.viehland, eric.snow priority: normal severity: normal status: open title: Make pwd module PEP-384 compatible versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38073> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38074] Make zlib PEP-384 compatible
New submission from Dino Viehland : Make zlib PEP-384 compatible -- components: Extension Modules messages: 351501 nosy: dino.viehland, eric.snow priority: normal severity: normal status: open title: Make zlib PEP-384 compatible versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38074> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38074] Make zlib PEP-384 compatible
Change by Dino Viehland : -- keywords: +patch pull_requests: +15445 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15792 ___ Python tracker <https://bugs.python.org/issue38074> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38075] Make random module PEP-384 compatible
New submission from Dino Viehland : Make random module PEP-384 compatible -- assignee: dino.viehland components: Extension Modules messages: 351509 nosy: dino.viehland, eric.snow priority: normal severity: normal status: open title: Make random module PEP-384 compatible versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38075> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38075] Make random module PEP-384 compatible
Change by Dino Viehland : -- keywords: +patch pull_requests: +15450 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15798 ___ Python tracker <https://bugs.python.org/issue38075> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
New submission from Dino Viehland : Make struct module PEP-384 compatible -- assignee: dino.viehland components: Extension Modules messages: 351524 nosy: dino.viehland, eric.snow priority: normal severity: normal status: open title: Make struct module PEP-384 compatible versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
Change by Dino Viehland : -- keywords: +patch pull_requests: +15456 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15805 ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37725] "make clean" should remove PGO task data
Dino Viehland added the comment: New changeset c6bbcd258302b4b9b3d4f3c39bb5f7ff0120ec67 by Dino Viehland (Neil Schemenauer) in branch 'master': bpo-37725: have "make clean" remove PGO task data (#15033) https://github.com/python/cpython/commit/c6bbcd258302b4b9b3d4f3c39bb5f7ff0120ec67 -- nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue37725> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36971] Add subsections in C API "Common Object Structures" page
Dino Viehland added the comment: New changeset 9669931e5e76cf4b6ae6d3d66e699b5fd6ffe931 by Dino Viehland (Jeroen Demeyer) in branch 'master': bpo-36971: add subsections in C API "Common Object Structures" page (#13446) https://github.com/python/cpython/commit/9669931e5e76cf4b6ae6d3d66e699b5fd6ffe931 -- nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue36971> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38075] Make random module PEP-384 compatible
Dino Viehland added the comment: There's several different reasons why these changes are beneficial. It'll help make the modules more compatible with PEP 554 in the future, enable more code re-use across Python VMs, reduce code maintenance going forward, and may also help with performance oriented changes in the future. On the PEP 554 front it is necessary to remove the static state that is used in the modules as we can't have sharing across the interpreters. The modules that are loaded into the different interpreter will need to not share any state on so all of their state needs to be per-instance state (there's also just an argument that static global state is just kind of ugly). On the re-use across VMs front it'll mean that alternative VMs will only need to stick to the stable API and well be able to use these modules as-is without having to re-implement them. It may not even be strictly necessary that these modules stick to 100% of the stable API if the places where they go outside dramatically help the implementation (for example PR 15805 uses _PyBytesWriter still). Sticking to the stable API will also naturally make it somewhat easier to make changes that impact the non-stable API. By it's very nature the stable API is going to change less (theoretically never) and therefore these modules will be less impacted by updates which are attempting to improve performance on the core. One example of that is the recent vector call support where many of the types needed to be updated (although trivially). So the final, and probably most speculative area, is the possibility of unlocking performance in the core runtime per Victor's stable API work: https://pythoncapi.readthedocs.io/. By having less dependencies on the core implementation details it should be easier to evolve those going forward an making it easier to unlock future performance gains in the core. -- ___ Python tracker <https://bugs.python.org/issue38075> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36781] Optimize sum() for bools
Dino Viehland added the comment: New changeset 88bdb9280b251d753f1b1c8d9183de0fff003622 by Dino Viehland (Serhiy Storchaka) in branch 'master': bpo-36781: Optimize sum() for bools. (#13074) https://github.com/python/cpython/commit/88bdb9280b251d753f1b1c8d9183de0fff003622 -- nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue36781> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36781] Optimize sum() for bools
Dino Viehland added the comment: Sorry, it seemed like a perfectly reasonable change when I was looking at the PR! -- ___ Python tracker <https://bugs.python.org/issue36781> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38113] Make ast module PEP-384 compatible
New submission from Dino Viehland : Remove various static state from the ast module and make it PEP-384 compatible. This will help make it be more compatible w/ subinterpreters and make it re-usable by 3rd party implementations. -- assignee: dino.viehland components: Extension Modules messages: 351888 nosy: dino.viehland priority: normal severity: normal status: open title: Make ast module PEP-384 compatible versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38113> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38113] Make ast module PEP-384 compatible
Change by Dino Viehland : -- keywords: +patch pull_requests: +15592 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15957 ___ Python tracker <https://bugs.python.org/issue38113> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38113] Make ast module PEP-384 compatible
Change by Dino Viehland : -- nosy: +eric.snow ___ Python tracker <https://bugs.python.org/issue38113> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38116] Make select module PEP-384 compatible
New submission from Dino Viehland : Remove static PyTypeObject* definitions and move static data to _selectstate to help improve compatibility w/ subinterpreters and re-use by alternate implementations. -- assignee: dino.viehland components: Extension Modules messages: 351913 nosy: dino.viehland, eric.snow priority: normal severity: normal status: open title: Make select module PEP-384 compatible versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38116> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38116] Make select module PEP-384 compatible
Change by Dino Viehland : -- keywords: +patch pull_requests: +15604 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15971 ___ Python tracker <https://bugs.python.org/issue38116> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38113] Remove statics from ast.c
Dino Viehland added the comment: Remove statics to make more compatible with subinterpreters. -- components: +Interpreter Core -Extension Modules title: Make ast module PEP-384 compatible -> Remove statics from ast.c ___ Python tracker <https://bugs.python.org/issue38113> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38113] Remove statics from ast.c
Change by Dino Viehland : -- pull_requests: +15608 pull_request: https://github.com/python/cpython/pull/15975 ___ Python tracker <https://bugs.python.org/issue38113> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38140] Py_tp_dictoffset / Py_tp_finalize are unsettable in stable API
New submission from Dino Viehland : This makes it impossible to port certain types to the stable ABI and remove statics from the interpreter. -- assignee: dino.viehland components: Interpreter Core messages: 352167 nosy: dino.viehland, eric.snow priority: normal severity: normal status: open title: Py_tp_dictoffset / Py_tp_finalize are unsettable in stable API versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue38140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38138] test_importleak is leaking references
Change by Dino Viehland : -- assignee: -> dino.viehland ___ Python tracker <https://bugs.python.org/issue38138> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38138] test_importleak is leaking references
Change by Dino Viehland : -- keywords: +patch pull_requests: +15676 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16053 ___ Python tracker <https://bugs.python.org/issue38138> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38152] AST change introduced tons of reference leaks
Change by Dino Viehland : -- assignee: -> dino.viehland nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue38152> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38140] Py_tp_dictoffset / Py_tp_finalize are unsettable in stable API
Change by Dino Viehland : -- nosy: +petr.viktorin ___ Python tracker <https://bugs.python.org/issue38140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38116] Make select module PEP-384 compatible
Dino Viehland added the comment: New changeset f919054e539a5c1afde1b31c9fd7a8f5b2313311 by Dino Viehland in branch 'master': bpo-38116: Convert select module to PEP-384 (#15971) https://github.com/python/cpython/commit/f919054e539a5c1afde1b31c9fd7a8f5b2313311 -- ___ Python tracker <https://bugs.python.org/issue38116> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38176] test_threading leaked [1, 1, 1] references: test_threads_join
Change by Dino Viehland : -- assignee: -> dino.viehland nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue38176> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38176] test_threading leaked [1, 1, 1] references: test_threads_join
Change by Dino Viehland : -- keywords: +patch pull_requests: +15768 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16158 ___ Python tracker <https://bugs.python.org/issue38176> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38176] test_threading leaked [1, 1, 1] references: test_threads_join
Change by Dino Viehland : -- stage: patch review -> resolved ___ Python tracker <https://bugs.python.org/issue38176> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38176] test_threading leaked [1, 1, 1] references: test_threads_join
Change by Dino Viehland : -- resolution: -> fixed status: open -> closed ___ Python tracker <https://bugs.python.org/issue38176> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38140] Py_tp_dictoffset / Py_tp_finalize are unsettable in stable API
Dino Viehland added the comment: New changeset 3368f3c6ae4140a0883e19350e672fd09c9db616 by Dino Viehland (Eddie Elizondo) in branch 'master': bpo-38140: Make dict and weakref offsets opaque for C heap types (#16076) https://github.com/python/cpython/commit/3368f3c6ae4140a0883e19350e672fd09c9db616 -- ___ Python tracker <https://bugs.python.org/issue38140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38140] Py_tp_dictoffset / Py_tp_finalize are unsettable in stable API
Change by Dino Viehland : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue38140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36971] Add subsections in C API "Common Object Structures" page
Dino Viehland added the comment: @BTaskaya Seems done, I'll go ahead and close it -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue36971> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals
Dino Viehland added the comment: Adding the getter/setters seems perfectly reasonable to me, and I agree they should be underscore prefixed as well. -- ___ Python tracker <https://bugs.python.org/issue38500> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43452] Microoptimize PyType_Lookup for cache hits
Dino Viehland added the comment: Setup a micro-benchmark, foo.c: #define PY_SSIZE_T_CLEAN #include #include #include int main(int argc, char *argv[]) { wchar_t *program = Py_DecodeLocale(argv[0], NULL); if (program == NULL) { fprintf(stderr, "Fatal error: cannot decode argv[0]\n"); exit(1); } Py_SetProgramName(program); /* optional but recommended */ Py_Initialize(); PyObject *pName = PyUnicode_DecodeFSDefault("foo"); if (pName == NULL) { printf("no foo\n"); PyErr_Print(); } PyObject *pModule = PyImport_Import(pName); if (pModule == NULL) { printf("no mod\n"); PyErr_Print(); return 0; } PyObject *cls = PyObject_GetAttrString(pModule, "C"); if (cls == NULL) { printf("no cls\n"); } PyObject *fs[20]; for(int i = 0; i<20; i++) { char buf[4]; sprintf(buf, "f%d", i); fs[i] = PyUnicode_DecodeFSDefault(buf); } for(int i = 0; i<1; i++) { for(int j = 0; j<20; j++) { if(_PyType_Lookup(cls, fs[j])==NULL) { printf("Uh oh\n"); } } } if (Py_FinalizeEx() < 0) { exit(120); } PyMem_RawFree(program); return 0; } Lib/foo.py: import time class C: pass for i in range(20): setattr(C, f"f{i}", lambda self: None) obj hash: 0m6.222s str hash: 0m6.327s baseline: 0m6.784s -- ___ Python tracker <https://bugs.python.org/issue43452> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43636] test_descr fails randomly when executed with -R :
Dino Viehland added the comment: Looking! -- ___ Python tracker <https://bugs.python.org/issue43636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43636] test_descr fails randomly when executed with -R :
Dino Viehland added the comment: It's probably worth having an assert that the version tag is valid, that'll make it easier to see what's going wrong in the cache hit case. We should have the version tag being 0 now when it's not valid. I may not be able to debug it anymore tonight, but if no will look tomorrow. -- ___ Python tracker <https://bugs.python.org/issue43636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43636] test_descr fails randomly when executed with -R :
Dino Viehland added the comment: And it looks like we have an entry with a 0 version, but with a valid name: (type_cache_entry) $3 = { version = 0 name = 0x000100ec44f0 value = NULL } -- ___ Python tracker <https://bugs.python.org/issue43636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43636] test_descr fails randomly when executed with -R :
Dino Viehland added the comment: I think the issue here is that in assign_version_tag there's this code: if (type->tp_version_tag == 0) { // Wrap-around or just starting Python - clear the whole cache type_cache_clear(cache, 1); return 1; } the return 1 is incorrect, it should be return 0 as a valid version tag hasn't been assigned. -- ___ Python tracker <https://bugs.python.org/issue43636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43636] test_descr fails randomly when executed with -R :
Dino Viehland added the comment: @vstinner - The fix doesn't change the behavior of _PyType_Lookup and instead just fixes a previous unrelated bug. The condition will typically ever be hit once (at startup) as it's very unlikely that versions will wrap, so there should be no performance difference after the fix. -- resolution: fixed -> stage: resolved -> status: closed -> open ___ Python tracker <https://bugs.python.org/issue43636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30533] missing feature in inspect module: getmembers_static
Dino Viehland added the comment: New changeset af8c8caaf5e07c02202d736a31f6a2f7e27819b8 by Weipeng Hong in branch 'main': bpo-30533:Add function inspect.getmembers_static that does not call properties or dynamic properties. (#20911) https://github.com/python/cpython/commit/af8c8caaf5e07c02202d736a31f6a2f7e27819b8 -- nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue30533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30533] missing feature in inspect module: getmembers_static
Change by Dino Viehland : -- stage: patch review -> resolved status: open -> closed versions: +Python 3.11 -Python 3.9 ___ Python tracker <https://bugs.python.org/issue30533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30533] missing feature in inspect module: getmembers_static
Dino Viehland added the comment: New changeset c2bb29ce9ae4adb6a8123285ad3585907cd4cc73 by Weipeng Hong in branch 'main': bpo-30533: Add docs for `inspect.getmembers_static` (#29874) https://github.com/python/cpython/commit/c2bb29ce9ae4adb6a8123285ad3585907cd4cc73 -- ___ Python tracker <https://bugs.python.org/issue30533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30533] missing feature in inspect module: getmembers_static
Change by Dino Viehland : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue30533> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39336] Immutable module type can't be used as package in custom loader
New submission from Dino Viehland : I'm trying to create a custom module type for a custom loader where the returned modules are immutable. But I'm running into an issue where the immutable module type can't be used as a module for a package. That's because the import machinery calls setattr to set the module as an attribute on it's parent in _boostrap.py # Set the module as an attribute on its parent. parent_module = sys.modules[parent] setattr(parent_module, name.rpartition('.')[2], module) I'd be okay if for these immutable module types they simply didn't have their children packages published on them. A simple simulation of this is a package which replaces its self with an object which doesn't support adding arbitrary attributes: x/__init__.py: import sys class MyMod(object): __slots__ = ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__'] def __init__(self): for attr in self.__slots__: setattr(self, attr, globals()[attr]) sys.modules['x'] = MyMod() x/y.py: # Empty file >>> from x import y Traceback (most recent call last): File "", line 1, in File "", line 983, in _find_and_load File "", line 971, in _find_and_load_unlocked AttributeError: 'MyMod' object has no attribute 'y' There's a few different options I could see on how this could be supported: 1) Simply handle the attribute error and allow things to continue 2) Add ability for the modules loader to perform the set, and fallback to setattr if one isn't available. Such as: getattr(parent_module, 'add_child_module', setattr)(parent_module, name.rpartition('.')[2], module) 3) Add the ability for the module type to handle the setattr: getattr(type(parent_module), 'add_child_module', fallback)(parent_module, , name.rpartition('.')[2], module) -- assignee: dino.viehland components: Interpreter Core messages: 36 nosy: dino.viehland priority: normal severity: normal stage: needs patch status: open title: Immutable module type can't be used as package in custom loader type: behavior ___ Python tracker <https://bugs.python.org/issue39336> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39336] Immutable module type can't be used as package in custom loader
Change by Dino Viehland : -- nosy: +brett.cannon ___ Python tracker <https://bugs.python.org/issue39336> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39336] Immutable module type can't be used as package in custom loader
Change by Dino Viehland : -- keywords: +patch pull_requests: +17406 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/18006 ___ Python tracker <https://bugs.python.org/issue39336> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39336] Immutable module type can't be used as package in custom loader
Dino Viehland added the comment: I think the warning shouldn't be too bad. It looks like ImportWarnings are filtered by default already, and the extra overhead of raising a warning in this case probably is nothing compared to the actual work in loading the module. -- ___ Python tracker <https://bugs.python.org/issue39336> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
Change by Dino Viehland : -- nosy: +eelizondo -dino.viehland ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
Dino Viehland added the comment: It seems problematic that_PyInterpreterState_ClearModules runs before all instances from a module have been cleared. If PyState_FindModule is no longer able to return module state then there's no way for a module to reliably work at shutdown other than having all instances hold onto the module (or module state) directly from all of their insatances. Certainly that would mimic more closely what happens w/ pure Python instances and modules - the type will hold onto the functions which will hold onto the module global state. -- nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
Dino Viehland added the comment: This is a relatively simple repro of the underlying problem: import _struct s = _struct.Struct('i') class C: def __del__(self): s.pack(42, 100) _struct.x = C() It's a little bit different in that it is actually causing the module to attempt to throw an exception instead of do a type check. -- ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
Dino Viehland added the comment: And here's a variation which doesn't involve any instances from the module: import _struct class C: def __init__(self): self.pack = _struct.pack def __del__(self): self.pack('I', -42) _struct.x = C() -- ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
Change by Dino Viehland : -- pull_requests: +17437 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/18038 ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
Dino Viehland added the comment: https://github.com/python/cpython/pull/18038 is a partial fix for this. I think it fixes the crash at shutdown, although I'm still seeing a hang on master on Linux which is different then earlier versions of Python. I seem to have a really bogus stack trace when I attach to it so I'm not quite certain what's going on there. -- ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
Dino Viehland added the comment: With either fix, or with both, on Linux I still see this hang at shutdown. Victor mentioned the fact that he had to hit Ctrl-C on Linux to see this, and I have to do the same thing. Then with the fixes in place the original test case still hangs on shutdown. On Python 3.7 (I don't readily have 3.8 available) at least this just runs and completes with no ctrl-C and no crashes. So while either of the fixes may be good to prevent the crashes, there's still probably some underlying issue in multiprocessing. I haven't tested on Mac OS/X. It looks like the clearing was originally introduced here: https://bugs.python.org/issue10241 Interestingly there was a similar issue w/ _tkinter, which also used PyType_FromSpec (although it sounds like it was just a ref count issue on the type). Unfortunately there's no associated test cases added to verify the behavior. Antoine and Neil are both now on the PR which removes the collection behavior so hopefully they can chime in on the safety of that fix. -- ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39336] Immutable module type can't be used as package in custom loader
Dino Viehland added the comment: New changeset 9b6fec46513006d7b06fcb645cca6e4f5bf7c7b8 by Dino Viehland in branch 'master': bpo-39336: Allow packages to not let their child modules be set on them (#18006) https://github.com/python/cpython/commit/9b6fec46513006d7b06fcb645cca6e4f5bf7c7b8 -- ___ Python tracker <https://bugs.python.org/issue39336> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39336] Immutable module type can't be used as package in custom loader
Change by Dino Viehland : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue39336> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38076] Make struct module PEP-384 compatible
Dino Viehland added the comment: One more data point: Backporting this change to Python 3.6 (I just happened to have it applied there already, so I haven't tried it on 3.7 or 3.8) has no crash and no hangs in multiprocessing on Linux. So something definitely changed in multiproessing which is causing the hang on shutdown, and forces us into this code path where we crash as well. -- ___ Python tracker <https://bugs.python.org/issue38076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39459] test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x
Dino Viehland added the comment: The curious thing about this is other tests in CircularImportTests are importing packages from test.test_import.data in the exact same way. -- ___ Python tracker <https://bugs.python.org/issue39459> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39459] test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x
Dino Viehland added the comment: Ahh, that's probably it Brett, I didn't know that was there, thanks! -- ___ Python tracker <https://bugs.python.org/issue39459> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39459] test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x
Change by Dino Viehland : -- pull_requests: +17590 pull_request: https://github.com/python/cpython/pull/18211 ___ Python tracker <https://bugs.python.org/issue39459> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39459] test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x
Dino Viehland added the comment: I've added the files to the makefile and AMD64 Fedora Stable Clang Installed 3.x was passing. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue39459> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39459] test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x
Change by Dino Viehland : -- pull_requests: +17621 pull_request: https://github.com/python/cpython/pull/18241 ___ Python tracker <https://bugs.python.org/issue39459> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39459] test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x
Dino Viehland added the comment: Nope, thank you for pointing that out. I've updated them now with PR 18241 -- ___ Python tracker <https://bugs.python.org/issue39459> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39459] test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x
Dino Viehland added the comment: New changeset 0cd5bff6b7da3118d0c5a88fc2b80f80eb7c3059 by Dino Viehland in branch 'master': bpo-39459: include missing test files in windows installer https://github.com/python/cpython/commit/0cd5bff6b7da3118d0c5a88fc2b80f80eb7c3059 -- ___ Python tracker <https://bugs.python.org/issue39459> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39459] test_import: test_unwritable_module() fails on AMD64 Fedora Stable Clang Installed 3.x
Dino Viehland added the comment: I guess the update to lib.pyproj probably just makes the files show up when opening the solution in Visual Studio then. -- ___ Python tracker <https://bugs.python.org/issue39459> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules
New submission from Dino Viehland : The fix for bpo-17636 added support for falling back to sys.modules when a module isn't directly present on the module. But mock doesn't have the same behavior - it'll try the import, and then try to get the value off the object. If it's not there it just errors out. Instead it should also consult sys.modules to be consistent with import semantics. -- assignee: dino.viehland components: Tests messages: 361366 nosy: dino.viehland priority: normal severity: normal stage: needs patch status: open title: mock patch should match behavior of import from when module isn't present in sys.modules type: behavior versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue39551> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules
Change by Dino Viehland : -- keywords: +patch pull_requests: +17721 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/18347 ___ Python tracker <https://bugs.python.org/issue39551> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17636] Modify IMPORT_FROM to fallback on sys.modules
Change by Dino Viehland : -- pull_requests: +17722 pull_request: https://github.com/python/cpython/pull/18347 ___ Python tracker <https://bugs.python.org/issue17636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules
Dino Viehland added the comment: It's related to bpo-39336. If you have an immutable package which doesn't allow it's children to be published on it when following the chain of packages it ends up not arriving at the final module. But you can also hit it if you end up doing the patch during a relative import, although that seems much less likely. But it generally seems matching the behavior of imports would be good to me. -- stage: patch review -> needs patch ___ Python tracker <https://bugs.python.org/issue39551> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules
Dino Viehland added the comment: My actual scenario involves a custom module loader where the modules are published are completely immutable (it ends up publishing an object which isn't a subtype of module). It can still have normal Python modules as a child which aren't immutable, so they could still be patched by Mock (or it could have immutable sub-packages which Mock wouldn't be able to patch). So imagine something like this: immutable_package\__init__.py __immutable__ = True x = 2 immutable_package\x.py y = 2 Doing a "from immutable_package import x" would normally publish "x" as a child onto the package. But because the package is immutable, this is impossible, and the assignment is ignored with a warning. When Mock gets a call to patch on something like "immutable_package.x.y", it's not going to find x, even though if I were to write "from immutable_package.x import y" or "from immutable_package import x" it would succeed. Cases can be contrived without all of this though where the child isn't published on it's parent, but it requires x/__init__.py from x.pkg import child x/pkg/__init__.py: x = 1 x/pkg/child.py: from unittest.mock import patch y = 42 @patch('x.pkg.child.y', 100) def f(): print(y) f() "python -m x" will fail without the patch but succeed with it. -- ___ Python tracker <https://bugs.python.org/issue39551> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules
Dino Viehland added the comment: Sorry, publish may not necessarily be the best term. When you do "from foo import bar" and foo is a package Python will set the bar module onto the foo module. That leads to the common mistake of doing "import foo" and then "foo.bar.baz" and later removing the thing that do "from foo import bar" and having things blow up later. Without additional support there's no way to patch the immutable module. We can provide a mode where we enable the patching for testing and disable it in a production environment though. That basically just involves passing a proxy object down to Mock. And monkey patching the mutable module is perfectly fine. The thing that's doing the ignoring of the assignment is the import system. So it's now okay if the package raises an AttributeError. There's not really a great way to work around this other than just bypassing mock's resolution of the object here - i.e. replacing mock.patch along with _get_target, _importer, and _dot_lookup and calling mock._patch directly, which isn't very nice (but is do-able). And while this is a strange way to arrive at a module existing in sys.modules but not being on the package it is something that can happen in the normal course of imports, hence the reason why the import system handles this by checking sys.modules today. It's also just turning what is currently an error while mocking into a success case with a simple few line change. -- stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issue39551> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39551] mock patch should match behavior of import from when module isn't present in sys.modules
Dino Viehland added the comment: I like that idea, let me see if I can find a way to do that. This is a little bit different in that it's implicitly trying to find a module, and supports dotting through non-packages as well, but maybe there's a way to leverage importlib and still keep the existing behavior. -- ___ Python tracker <https://bugs.python.org/issue39551> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26067] test_shutil fails when gid name is missing
Dino Viehland added the comment: New changeset 52268941f37e3e27bd01792b081877ec3bc9ce12 by Matthias Braun in branch 'master': bpo-26067: Do not fail test_shutil / chown when gid/uid cannot be resolved (#19032) https://github.com/python/cpython/commit/52268941f37e3e27bd01792b081877ec3bc9ce12 -- nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue26067> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40255] Fixing Copy on Writes from reference counting
Dino Viehland added the comment: I think there's other cases of performance related features being hidden under an ifdef. Computed gotos show up that way, although probably more because it's a compiler extension that's not supported everywhere. Pymalloc is also very similar in that it implies an ABI change as well. I wonder if it would be worth it to introduce an ABI flag for this as well? On the one hand is it a slightly different contract, on the other hand using extensions that don't support the immortalization actually work just fine. -- nosy: +dino.viehland ___ Python tracker <https://bugs.python.org/issue40255> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com