[issue47248] Possible slowdown of regex searching in 3.11
Dennis Sweeney added the comment: Possibly related to the new atomic grouping support from GH-31982? -- nosy: +Dennis Sweeney, serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue47248> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47009] Streamline list.append for the common case
Dennis Sweeney added the comment: Buildbots are passing, so I'm closing this. Thanks for the catch and fix! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47009> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47226] if we write a line of code like i wrote keys = pygame.key.get_pressed() is showing error
New submission from Dennis Sweeney : What error message? -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47226> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45542] Using multiple comparison operators can cause performance issues
Dennis Sweeney added the comment: For reference, chaining is about 1.18x slower in this microbenchmark on GCC: ./python -m pyperf timeit -s "x = 100" "if 10 < x < 30: print('no')" --duplicate=10 . Mean +- std dev: 21.3 ns +- 0.2 ns ./python -m pyperf timeit -s "x = 100" "if 10 < x and x < 30: print('no')" --duplicate=10 . Mean +- std dev: 18.0 ns +- 0.5 ns For a related case, in GH-30970, the bytecode generate by "a, b = a0, b0" was changed. Before: [load_a0, load_b0, swap, store_a, store_b] After: [load_a0, load_b0, store_b, store_a] However, this was only changed when the stores were STORE_FASTs. STORE_GLOBAL/STORE_NAME/STORE_DEREF cases still have the SWAP. In the STORE_GLOBAL cases, you can construct scenarios with custom __del__ methods where storing b and then a has different behavior than storing a and then b. No such cases can be constructed for STORE_FAST without resorting to frame hacking. I wonder if the same argument applies here: maybe @akuvfx's PR could be altered to use LOAD_FAST twice for each variable *only* if everything in sight is the result of a LOAD_FAST or a LOAD_CONST. My example above uses a LOAD_DEREF, so its behavior could remain unchanged. The argument that this would within the language spec is maybe a little bit more dubious than the "a, b = a0, b0" case though, since custom `__lt__` methods are a bit more well-specified than custom `__del__` methods. Thoughts? -- ___ Python tracker <https://bugs.python.org/issue45542> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45542] Using multiple comparison operators can cause performance issues
Dennis Sweeney added the comment: https://bugs.python.org/issue47221 was opened as a duplicate of this. Unless there are any new ideas for getting around the concerns here, I think this can be closed. -- status: open -> pending ___ Python tracker <https://bugs.python.org/issue45542> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47221] chained comparisons slower than using `and`
Dennis Sweeney added the comment: Feel free to comment on that issue if you have any ideas about how to address the concerns there. -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Using multiple comparison operators can cause performance issues ___ Python tracker <https://bugs.python.org/issue47221> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47221] chained comparisons slower than using `and`
Change by Dennis Sweeney : -- title: Bug or bad performance -> chained comparisons slower than using `and` ___ Python tracker <https://bugs.python.org/issue47221> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47221] Bug or bad performance
Dennis Sweeney added the comment: I believe this is a duplicate of this issue: https://bugs.python.org/issue45542 -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47221> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47214] builtin_function_or_method is also either a function or a method
Dennis Sweeney added the comment: https://docs.python.org/3/library/inspect.html#inspect.isfunction says this: """ inspect.isfunction(object) Return True if the object is a Python function, which includes functions created by a lambda expression. """ Emphasis on the "Python function", as in, something written in Python using a `def` statement or a `lambda` expression. If isfunction returns True, you can presumably access function-specific implementation details like the functions's f.__code__ attribute. If you need to check for "anything that works as a function", you can use `callable()`: >>> callable(lambda: 2) True >>> callable(abs) True >>> def f(x): return x >>> callable(f) True I'm not an expert on the inspect module, but I'm guessing it's not worth breaking backwards-compatibility to change this behavior. Would extra emphasis in the documentation have been helpful for you, or were you mostly attempting to rely on the function's name? -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47214> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47009] Streamline list.append for the common case
Change by Dennis Sweeney : -- pull_requests: +30310 pull_request: https://github.com/python/cpython/pull/32239 ___ Python tracker <https://bugs.python.org/issue47009> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47145] Improve graphlib.TopologicalSort by removing the prepare step
Dennis Sweeney added the comment: > depends on an already-yielded node I mean "creates a new not-yet-yielded dependency for an already-yielded node". -- ___ Python tracker <https://bugs.python.org/issue47145> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47145] Improve graphlib.TopologicalSort by removing the prepare step
Dennis Sweeney added the comment: Out of curiosity, what are the use cases for adding nodes after get_ready has already produced nodes? I was wondering about avoiding the need to call prepare() by having it automatically do the cycle-checking at the first get_ready() call and then raising ValueError if add() is called any time thereafter. Assuming we do want to be able to add() after a get_ready(), is there a reason that "forgetting" already-produced nodes is the correct behavior, as opposed to remembering all nodes ever added, and raising iff the addition creates a cycle among all nodes ever added or depends on an already-yielded node? -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47145> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47157] bijective invertible map
Dennis Sweeney added the comment: see also https://bugs.python.org/issue44931 -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47157> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47053] Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE
Dennis Sweeney added the comment: New changeset 788154919c2d843a0a995994bf2aed2d074761ec by Dennis Sweeney in branch 'main': bpo-47053: Refactor BINARY_OP_INPLACE_ADD_UNICODE (GH-32122) https://github.com/python/cpython/commit/788154919c2d843a0a995994bf2aed2d074761ec -- ___ Python tracker <https://bugs.python.org/issue47053> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47070] Improve performance of array_inplace_repeat
Dennis Sweeney added the comment: New changeset 850687df47b03e98c1433e6e70e71a8921eb4454 by Pieter Eendebak in branch 'main': bpo-47070: Add _PyBytes_Repeat() (GH-31999) https://github.com/python/cpython/commit/850687df47b03e98c1433e6e70e71a8921eb4454 -- ___ Python tracker <https://bugs.python.org/issue47070> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47132] Move tests from setobject.c to _testcapimodule
Change by Dennis Sweeney : -- nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue47132> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47116] Use _PyLong_FromUnsignedChar in bytearrayobject.c
Dennis Sweeney added the comment: Thanks! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47116> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47116] Use _PyLong_FromUnsignedChar in bytearrayobject.c
Dennis Sweeney added the comment: New changeset c23ddf5ec229b7302437a1cf32d366df5cc5b837 by Pieter Eendebak in branch 'main': bpo-47116: use _PyLong_FromUnsignedChar instead of PyLong_FromLong (GH-32110) https://github.com/python/cpython/commit/c23ddf5ec229b7302437a1cf32d366df5cc5b837 -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47116> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47053] Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE
Change by Dennis Sweeney : -- pull_requests: +30202 pull_request: https://github.com/python/cpython/pull/32122 ___ Python tracker <https://bugs.python.org/issue47053> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47114] random.choice and random.choices have different distributions
Dennis Sweeney added the comment: Possible duplicate of https://bugs.python.org/issue44080 -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47114> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47012] Speed up iteration of bytes and bytearray
Dennis Sweeney added the comment: New changeset bd1cf6ecee76bcdce87b4f69567b95756ecf5a4c by Kumar Aditya in branch 'main': bpo-47012: speed up iteration of bytes and bytearray (GH-31867) https://github.com/python/cpython/commit/bd1cf6ecee76bcdce87b4f69567b95756ecf5a4c -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47012> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47094] index doesn't change while looping through same elements in a list
Dennis Sweeney added the comment: The help text says this: >>> help(list.index) Help on method_descriptor: index(self, value, start=0, stop=9223372036854775807, /) Return first index of value. Raises ValueError if the value is not present. Emphasis on *first* index. Example: >>> L = [0, 10, 20, 33, 0, 10] >>> L.index(10) 1 >>> L[5] 10 >>> L.index(L[5]) # the same meaning as L.index(10) 1 In your code, when elm has the value 1, it's just the value 1; there's no extra information carried along about where that 1 came from. If elm == 1, then my_list.index(elm) means the same as my_list.index(1). I'd suggest taking any further questions to either StackOverflow or https://discuss.python.org/c/users/ Thanks for the concern, but I'm closing this as "not a bug". Changing this behavior now would be backwards-incompatible and break lots of people's code. -- nosy: +Dennis Sweeney resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47094> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47067] Add vectorcall for generica alias object
Dennis Sweeney added the comment: New changeset 1ea055bd53ccf976e88018983a3c13447c4502be by penguin_wwy in branch 'main': bpo-47067: Optimize calling GenericAlias objects (GH-31996) https://github.com/python/cpython/commit/1ea055bd53ccf976e88018983a3c13447c4502be -- ___ Python tracker <https://bugs.python.org/issue47067> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46712] Share global string identifiers in deepfreeze
Dennis Sweeney added the comment: In bpo-47067, there was concern about the addition of the makefile target from PR 31637: regen-global-objects: regen-deepfreeze After a new `&_Py_ID(__orig_class__)` is added to Objects/genericaliasobject.c, running `make regen-global-objects` starts gcc -pthread -c [snipped] -DPy_BUILD_CORE -o Objects/genericaliasobject.o Objects/genericaliasobject.c which fails with a compilation error because that identifier is not yet defined. Is there a good way to convince `make` to regenerate the global objects without this sort of circular dependency? Am I missing a step? -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46712> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47067] Add vectorcall for generica alias object
Dennis Sweeney added the comment: I profiled dict[str, int](a=1, b=2), and it looks like a decent chunk of time comes from PyUnicode_New as used by PyObject_SetAttrString. You could also try replacing PyObject_SetAttrString with PyObject_SetAttr and adding "__orig_class__" to the global strings with Tools/scripts/generate_global_objects.py, probably for a later PR. -- ___ Python tracker <https://bugs.python.org/issue47067> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47070] Improve performance of array_inplace_repeat
Dennis Sweeney added the comment: I'd bet we could add a couple of utility functions that could be used in multiple places, to keep the "trick" all in one place. Something like void _PyBytes_RepeatInPlace(char **buffer, size_t start_len, size_t end_len) { // Repeatedly double. size_t copied = start_len; while (copied < end_len) { size_t to_copy = Py_MIN(copied, end_len - copied); memcpy(buffer + copied, buffer, to_copy); copied += to_copy; } } void _PyBytes_Repeat(char *dest, size_t len_dest, const char *src, size_t len_src) { // XXX maybe handle zero lengths // XXX maybe use memset for len_src == 1 memcpy(dest, src, len_src); _PyBytes_RepeatInPlace(dest, len_src, len_dest); } ------ nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47070> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47005] Improve performance of bytes_repeat
Change by Dennis Sweeney : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47005> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47005] Improve performance of bytes_repeat
Dennis Sweeney added the comment: Thanks for the contribution -- that's a really nice speedup. -- ___ Python tracker <https://bugs.python.org/issue47005> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47005] Improve performance of bytes_repeat
Dennis Sweeney added the comment: New changeset ac8308d3eaf2526318c1bbf13d4a214fd24605d2 by Pieter Eendebak in branch 'main': bpo-47005: Improve performance of bytearray_repeat and bytearray_irepeat (GH-31856) https://github.com/python/cpython/commit/ac8308d3eaf2526318c1bbf13d4a214fd24605d2 -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47005> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47053] Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE
Change by Dennis Sweeney : -- type: security -> performance ___ Python tracker <https://bugs.python.org/issue47053> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47053] Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE
Change by Dennis Sweeney : -- keywords: +patch pull_requests: +30058 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31318 ___ Python tracker <https://bugs.python.org/issue47053> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47053] Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE
New submission from Dennis Sweeney : There was a discussion here: https://github.com/faster-cpython/ideas/discussions/269 Checking for whether the assignment target is the left-hand side, rather than just checking for the right refcount, is more stable and reduces the number of deoptimizations, and even increases performance on some benchmarks. Note that `PyUnicode_Append` is already a somewhat expensive function that already checks for the right reference counts, so it's fine to let as much code as possible get there, even if it will take the slow path -- we mostly just want to reduce allocations and avoid the quadratic string concatenation otherwise. -- components: Interpreter Core messages: 415455 nosy: Dennis Sweeney, brandtbucher priority: normal severity: normal status: open title: Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE type: security versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue47053> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47052] allow string as sep in _Py_strhex_impl ( bytearray.hex() )
Dennis Sweeney added the comment: In particular, it's one ascii character: >>> b'abracadabra'.hex('😋') ValueError: sep must be ASCII. I wouldn't be completely opposed to allowing longer strings, but since there are easy enough ways to do it already, put me at a -0. We can see if anyone else is in favor. -- components: +Interpreter Core -IO nosy: +gregory.p.smith versions: +Python 3.11 ___ Python tracker <https://bugs.python.org/issue47052> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47052] allow string as sep in _Py_strhex_impl ( bytearray.hex() )
Dennis Sweeney added the comment: Would there be substantial benefit of a new feature over using the existing feature and then calling str.replace()? >>> b = b'abracadabra' >>> "0x" + b.hex(":").replace(":", ", 0x") '0x61, 0x62, 0x72, 0x61, 0x63, 0x61, 0x64, 0x61, 0x62, 0x72, 0x61' -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47052> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47037] Build problems on Windows
Dennis Sweeney added the comment: indeed, bisected to 2cf7f865f099db11cc6903b334d9c376610313e8 is the first bad commit commit 2cf7f865f099db11cc6903b334d9c376610313e8 Author: Christian Heimes Date: Tue Mar 15 11:41:04 2022 +0200 bpo-46587: Skip tests if strftime does not support glibc extension (GH-31873) Co-authored-by: Victor Stinner -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47037> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47028] Incorrect behaviour when zipping a bunch of maps
Dennis Sweeney added the comment: https://bugs.python.org/issue45469 is similar. Thanks for the report, but I'll go ahead and close this. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47028> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47028] Incorrect behaviour when zipping a bunch of maps
Dennis Sweeney added the comment: There's an FAQ entry here: https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result -- ___ Python tracker <https://bugs.python.org/issue47028> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47028] Incorrect behaviour when zipping a bunch of maps
Dennis Sweeney added the comment: This is because i is not captured by the function definition. `lambda x: x**i` always makes the "input to the ith power" function, never the "input to the 3rd power" function, even if i happens to be 3 right now. Consider replacing `lambda x: x**i` with `lambda x, i=i: x**i` to explicitly capture the current value of i as a default. Changing the scoping rules now would be a big backwards-incompatible change. -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue47028> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47008] Add Lib/site-packages to .gitignore
Change by Dennis Sweeney : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue47008> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47009] Streamline list.append for the common case
Dennis Sweeney added the comment: The attached _PyList_AppendTakeRef.diff has the ceval.c, but this implementation: int _PyList_AppendTakeRef(PyListObject *self, PyObject *newitem) { assert(self != NULL && newitem != NULL); assert(PyList_Check(self)); Py_ssize_t len = PyList_GET_SIZE(self); Py_ssize_t allocated = self->allocated; assert((size_t)len + 1 < PY_SSIZE_T_MAX); if (allocated > len) { PyList_SET_ITEM(self, len, newitem); Py_SET_SIZE(self, len + 1); return 0; } if (list_resize(self, len + 1) < 0) { Py_DECREF(newitem); return -1; } PyList_SET_ITEM(self, len, newitem); return 0; } Results: | Benchmark | main | PR 31864 | _PyList_AppendTakeRef.diff | |-|:-:|:-:|:--:| | listcomp 100| 1.61 us | 1.33 us: 1.21x faster | 1.55 us: 1.04x faster | | append 100 | 2.11 us | 1.82 us: 1.15x faster | 2.05 us: 1.03x faster | | listcomp 1000 | 12.6 us | 9.83 us: 1.28x faster | 11.9 us: 1.06x faster | | append 1000 | 18.1 us | 15.3 us: 1.18x faster | 17.6 us: 1.03x faster | | listcomp 1 | 121 us| 93.2 us: 1.29x faster | 114 us: 1.06x faster | | append 1| 175 us| 150 us: 1.17x faster | 172 us: 1.02x faster | | listcomp 10 | 1.17 ms | 923 us: 1.26x faster | 1.15 ms: 1.02x faster | | append 10 | 1.70 ms | 1.49 ms: 1.14x faster | not significant | | Geometric mean | (ref) | 1.21x faster | 1.03x faster | -- Added file: https://bugs.python.org/file50674/_PyList_AppendTakeRef.diff ___ Python tracker <https://bugs.python.org/issue47009> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47009] Streamline list.append for the common case
Change by Dennis Sweeney : -- keywords: +patch pull_requests: +29962 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31864 ___ Python tracker <https://bugs.python.org/issue47009> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47009] Streamline list.append for the common case
New submission from Dennis Sweeney : list_resize is a long function that probably won't get inlined. But for the vast majority of cases in list.append, we just need to check whether the list is big enough (not whether it's small enough, or whether it's null or the wrong type), then insert and update the size. This can be inlined, with an actual call only taking place whenever we need to resize. We can also add a reference-consuming version of PyList_Append to elide an INCREF/DECREF pair. -- components: Interpreter Core messages: 415116 nosy: Dennis Sweeney priority: normal severity: normal status: open title: Streamline list.append for the common case type: performance versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue47009> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47008] Add Lib/site-packages to .gitignore
Dennis Sweeney added the comment: I made a copy/paste error, it should be: Lib/site-packages/* !Lib/site-packages/README.txt -- ___ Python tracker <https://bugs.python.org/issue47008> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47008] Add Lib/site-packages to .gitignore
Change by Dennis Sweeney : -- keywords: +patch pull_requests: +29960 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31862 ___ Python tracker <https://bugs.python.org/issue47008> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue47008] Add Lib/site-packages to .gitignore
New submission from Dennis Sweeney : It would be nice to add the following to .gitignore, so that I can `./python -m pip install [whatever]` without overwhelming the output of `git status`. Lib/site-packages/* !Lib/test/data/README.txt -- messages: 415114 nosy: Dennis Sweeney priority: normal severity: normal status: open title: Add Lib/site-packages to .gitignore type: enhancement versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue47008> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46961] Caching/interning of small ints sometimes fails
Change by Dennis Sweeney : -- keywords: +patch pull_requests: +29942 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31843 ___ Python tracker <https://bugs.python.org/issue46961> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46961] Caching/interning of small ints sometimes fails
Dennis Sweeney added the comment: I believe the issue is the usage of the x_divrem function. x_divrem always returns fresh ints, never cached small ints. This behavior is relied upon in the long_true_divide function, as it mutates the returned quotient at the line """x->ob_digit[0] = low & ~(2U*mask-1U);""". The other uses of x_divrem account for this when handling the *quotient*, but apparently missed checking for small ints in the *remainder*. uses of x_divrem: - long_divrem - uses maybe_small_long on quotient - doesn't check if remainder is small < oops - long_rem - throws away quotient - doesn't check if remainder is small < oops - long_true_divide - modifies the quotient - throws away remainder Possible patches to fix it: 1) Modify long_divrem and long_rem to check for small remainders, in addition to the small-quotient checks they already do. 2) Modify x_divrem to check for small remainders, but still always return fresh quotients. 3) Modify x_divrem to return cached quotients and remainders, and modify long_true_divide to make a copy before mutating. I'd lean towards #1, since that quotient check already exists. In #2, the mismatch of checking/not checking between quotient/remainder would be confusing. In #3, an extra int allocation gets added to integer true divide, which isn't ideal. -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46961> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46979] Spam
Change by Dennis Sweeney : -- components: -Build resolution: -> not a bug stage: -> resolved status: open -> closed title: Master piece -> Spam type: security -> ___ Python tracker <https://bugs.python.org/issue46979> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46896] add support for watching writes to selected dictionaries
Dennis Sweeney added the comment: A curiosity: have you considered watching dict keys rather than whole dicts? That way, changing global values would not have to de-optimize, only adding new global keys would. Indexing into dict values array wouldn't be as efficient as embedding direct jump targets in JIT-generated machine code, but as long as we're not doing that, maybe watching the keys is a happy medium? -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46896> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39829] __len__ called twice in the list() constructor
Dennis Sweeney added the comment: Related to Matt's idea is https://bugs.python.org/issue43574 -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue39829> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46952] pip progress bar display bug
Change by Dennis Sweeney : -- resolution: -> third party stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46952> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46952] pip progress bar display bug
Dennis Sweeney added the comment: pip is maintained externally at https://github.com/pypa/pip , so that is likely a better place to open an issue about pip. -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46952> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45806] Cannot Recover From StackOverflow in 3.9 Tests
Dennis Sweeney added the comment: Should this be backported to make the 3.8 Buildbots happy? -- ___ Python tracker <https://bugs.python.org/issue45806> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46903] Crash when setting attribute with string subclass as the name (--with-pydebug)
Change by Dennis Sweeney : -- pull_requests: +29833 pull_request: https://github.com/python/cpython/pull/31718 ___ Python tracker <https://bugs.python.org/issue46903> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46941] Bug or plug not removed (The operator "is")
Dennis Sweeney added the comment: In the future, please copy and paste the relevant code and errors as text. Images of code are harder for screen-readers for the visually impaired, harder to copy-and-paste to verify, and are more likely to be perceived as spam. Your code is essentially this: >>> i = 0 >>> i is 0 :1: SyntaxWarning: "is" with a literal. Did you mean "=="? True This warning isn't a "stub", it was intentionally added in GH-9642. The warning exists because comparing numbers with `is` is generally unsafe (numbers should be compared using `==` instead), and can lead to unpredictable results, especially if using a different Python implementation (e.g. PyPy or RustPython or Jython rather than CPython). -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46941> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46935] import of submodule polutes global namespace
Dennis Sweeney added the comment: This might be something that rapidfuzz can fix, rather than CPython. In whatever import process rapidfuzz uses, it populates sys.modules with a module named `Levenshtein` in addition to 'rapidfuzz.distance.Levenshtein'. You might be able to request that they change something there. Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> m1 = set(sys.modules.keys()) >>> import numpy >>> m2 = set(sys.modules.keys()) >>> import rapidfuzz >>> m3 = set(sys.modules.keys()) >>> m2 - m1 {'posixpath', 'numpy.random._pcg64', 'numpy.fft._pocketfft_internal', 'numpy.core._dtype', 'cython_runtime', 'numpy.random._sfc64', 'urllib', 'numpy.core.einsumfunc', 'sre_parse', 'numpy.polynomial.laguerre', 'numpy.fft._pocketfft', 'numpy.lib._iotools', 'numpy.core._exceptions', 'numpy.random._pickle', 'numpy.lib.twodim_base', 'numpy.polynomial._polybase', 'numpy.lib._datasource', 'copyreg', 'numpy.random._philox', '_ctypes', 'numpy.core._ufunc_config', 'platform', 'numpy.lib.histograms', 'numpy.lib.mixins', 'numpy.core._asarray', 'numpy.polynomial.legendre', 'numpy.polynomial.polyutils', 'subprocess', 'fnmatch', 'numpy.ctypeslib', 'ast', 'sre_compile', 'json.scanner', 'numpy.core.arrayprint', 'textwrap', 'numpy.core.multiarray', 'datetime', 'inspect', 'numpy.core.function_base', 'hmac', 'numpy.lib.utils', '_json', 'signal', 'numpy.core.machar', 'numpy.ma.core', 'pathlib', 'numbers', 'numpy.core._methods', 'numpy.lib.type_check', 'numpy.core.defchararray', 'numpy.core.getlimits', 'n umpy.lib.ufunclike', 'numpy.version', 'select', '_sre', 'numpy.core._dtype_ctypes', 'numpy.lib.arrayterator', 'random', '_blake2', 'numpy.fft', 'token', 'numpy.core._string_helpers', 'numpy', '_hashlib', 'opcode', 'tokenize', 'numpy.random._bounded_integers', 'numpy.random.mtrand', 'ctypes._endian', '_weakrefset', 'numpy.ma', 'numpy.lib.nanfunctions', '_random', 'numpy.lib.function_base', '_sha512', 'bisect', 'numpy.core.records', 'numpy._globals', '_compat_pickle', 'urllib.parse', 'numpy.random.bit_generator', 'numpy.linalg._umath_linalg', 'numpy.core._add_newdocs_scalars', 'numpy.polynomial.hermite', 'base64', 'numpy.linalg.linalg', 'numpy.core._multiarray_tests', '_cython_0_29_24', 'hashlib', '_struct', 'numpy.lib.arraypad', 'numpy.core', 'msvcrt', 'numpy.ma.extras', 'numpy.lib.index_tricks', '_locale', 'numpy.lib.shape_base', 'numpy.compat._inspect', 'numpy.polynomial.hermite_e', 'pickle', 'numpy._distributor_init', 'numpy.lib._version', '_datetime', 'secrets', 'numpy.lib.polyno mial', 'numpy.core.numerictypes', '_ast', 'numpy.lib.scimath', '_winapi', 'numpy.matrixlib.defmatrix', '_socket', 'numpy.core.shape_base', 'numpy.lib.format', 'dis', 'numpy.core._multiarray_umath', 'weakref', 'numpy.compat.py3k', 'json', 'numpy.core.umath', 'numpy.core.numeric', 'numpy.core.memmap', 'sre_constants', 'numpy.compat', 'numpy.core._add_newdocs', 'numpy.polynomial.chebyshev', 'math', 'numpy.random._common', 'numpy.linalg', 'numpy.random', 're', 'threading', 'numpy._pytesttester', '_bisect', 'collections.abc', 'socket', 'numpy.lib.stride_tricks', 'linecache', 'numpy.lib', 'numpy.fft.helper', 'numpy.core.fromnumeric', 'json.encoder', 'numpy.linalg.lapack_lite', 'selectors',
[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTANCE_VALUE combined opcode
Change by Dennis Sweeney : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46823> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46903] Crash when setting attribute with string subclass as the name (--with-pydebug)
Dennis Sweeney added the comment: a8b9350964f43cb648c98c179c8037fbf3ff8a7d is the first bad commit commit a8b9350964f43cb648c98c179c8037fbf3ff8a7d Author: Mark Shannon Date: Wed Oct 13 14:19:34 2021 +0100 bpo-45340: Don't create object dictionaries unless actually needed (GH-28802) * Never change types' cached keys. It could invalidate inline attribute objects. * Lazily create object dictionaries. * Update specialization of LOAD/STORE_ATTR. * Don't update shared keys version for deletion of value. * Update gdb support to handle instance values. * Rename SPLIT_KEYS opcodes to INSTANCE_VALUE. ------ nosy: +Dennis Sweeney, Mark.Shannon ___ Python tracker <https://bugs.python.org/issue46903> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46848] Use optimized string search function in mmap.find()
Dennis Sweeney added the comment: Thanks for the report! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> performance ___ Python tracker <https://bugs.python.org/issue46848> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46848] Use optimized string search function in mmap.find()
Dennis Sweeney added the comment: New changeset 6ddb09f35b922a3bbb59e408a3ca7636a6938468 by Dennis Sweeney in branch 'main': bpo-46848: Use stringlib/fastsearch in mmap (GH-31625) https://github.com/python/cpython/commit/6ddb09f35b922a3bbb59e408a3ca7636a6938468 -- ___ Python tracker <https://bugs.python.org/issue46848> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46891] Crash in ModuleType subclass with __slots__
Change by Dennis Sweeney : -- nosy: +Mark.Shannon ___ Python tracker <https://bugs.python.org/issue46891> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46891] Crash in ModuleType subclass with __slots__
Dennis Sweeney added the comment: Bisected to here: c3f52b4d707a78eb342372a2be00f3eb846a05b9 is the first bad commit commit c3f52b4d707a78eb342372a2be00f3eb846a05b9 Author: Mark Shannon Date: Wed Jun 23 10:00:43 2021 +0100 bpo-44486: Make sure that modules always have a dictionary. (GH-26847) * Make sure that modules always have a dictionary. -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46891> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46848] Use optimized string search function in mmap.find()
Dennis Sweeney added the comment: PR 31625 is an alternative proposal. It uses the Crochemore and Perrin's Two-Way algorithm that @benrg references (see Objects/stringlib/fastsearch.h and Objects/stringlib/stringlib_find_two_way_notes.txt), and is platform-independent. -- ___ Python tracker <https://bugs.python.org/issue46848> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46848] Use optimized string search function in mmap.find()
Change by Dennis Sweeney : -- nosy: +Dennis Sweeney nosy_count: 2.0 -> 3.0 pull_requests: +29749 pull_request: https://github.com/python/cpython/pull/31625 ___ Python tracker <https://bugs.python.org/issue46848> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode
Change by Dennis Sweeney : -- keywords: +patch pull_requests: +29617 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31484 ___ Python tracker <https://bugs.python.org/issue46823> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode
New submission from Dennis Sweeney : See https://github.com/faster-cpython/ideas/discussions/291 -- messages: 413692 nosy: Dennis Sweeney priority: normal severity: normal status: open title: Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode ___ Python tracker <https://bugs.python.org/issue46823> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46802] Wrong result unpacking binary data with ctypes bitfield.
Dennis Sweeney added the comment: Possible duplicate of https://bugs.python.org/issue29753 -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46802> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46730] Please consider mentioning property without setter when an attribute can't be set
Change by Dennis Sweeney : -- pull_requests: +29562 pull_request: https://github.com/python/cpython/pull/31427 ___ Python tracker <https://bugs.python.org/issue46730> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46615] Use-after-free by mutating set during set operations
Dennis Sweeney added the comment: It does look like there are some pickle situations that crash. Attached is a randomized crasher. I haven't done too much careful reasoning about it, but adding INCREFs everywhere seems to fix most of the issues. -- Added file: https://bugs.python.org/file50631/picklecrasher.py ___ Python tracker <https://bugs.python.org/issue46615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46730] Please consider mentioning property without setter when an attribute can't be set
Dennis Sweeney added the comment: New changeset 9e06d03672547041239812efe4901c06da6cbd2f by Christian Heimes in branch 'main': bpo-46730: Fix refleak and tighten NULL checks (GH-31389) https://github.com/python/cpython/commit/9e06d03672547041239812efe4901c06da6cbd2f -- ___ Python tracker <https://bugs.python.org/issue46730> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46730] Please consider mentioning property without setter when an attribute can't be set
Dennis Sweeney added the comment: Thanks for the PR! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46730> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46730] Please consider mentioning property without setter when an attribute can't be set
[issue46739] dataclasses __eq__ isn't logical
Change by Dennis Sweeney : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46739> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46747] bisect.bisect/insort don't document key parameter
Dennis Sweeney added the comment: Thanks for the report, Stefan! Thanks for the PR, Zackery! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46747> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46747] bisect.bisect/insort don't document key parameter
Dennis Sweeney added the comment: New changeset 841c77d802e9ee8845fa3152700474021efe03fd by Dennis Sweeney in branch '3.10': [3.10] bpo-46747: Add missing key parameters in the bisect docs (GH-31323) (GH-31329) https://github.com/python/cpython/commit/841c77d802e9ee8845fa3152700474021efe03fd -- ___ Python tracker <https://bugs.python.org/issue46747> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46747] bisect.bisect/insort don't document key parameter
Change by Dennis Sweeney : -- pull_requests: +29485 pull_request: https://github.com/python/cpython/pull/31329 ___ Python tracker <https://bugs.python.org/issue46747> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46747] bisect.bisect/insort don't document key parameter
Dennis Sweeney added the comment: New changeset 96084f4256d2d523b0a4d7d900322b032326e3ed by Zackery Spytz in branch 'main': bpo-46747: Add missing key parameters in the bisect docs (GH-31323) https://github.com/python/cpython/commit/96084f4256d2d523b0a4d7d900322b032326e3ed -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46747> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34890] Support functools.partial in inspect.is*function() checks
Dennis Sweeney added the comment: See https://bugs.python.org/issue46722 for a concern about this change. -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue34890> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46615] Use-after-free by mutating set during set operations
Change by Dennis Sweeney : -- pull_requests: +29473 pull_request: https://github.com/python/cpython/pull/31312 ___ Python tracker <https://bugs.python.org/issue46615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46730] Please consider mentioning property without setter when an attribute can't be set
Dennis Sweeney added the comment: Go ahead and open a PR -- it makes it easier to discuss particular changes. Regarding backwards-compatibility, error messages improvements are fair game for Python 3.11, we just shouldn't backport them to earlier versions. We can also consider including the type of the relevant object in the error messages. -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46730> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46615] Use-after-free by mutating set during set operations
Dennis Sweeney added the comment: New changeset 4a66615ba736f84eadf9456bfd5d32a94cccf117 by Dennis Sweeney in branch 'main': bpo-46615: Don't crash when set operations mutate the sets (GH-31120) https://github.com/python/cpython/commit/4a66615ba736f84eadf9456bfd5d32a94cccf117 -- ___ Python tracker <https://bugs.python.org/issue46615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44953] Add vectorcall on operator.itemgetter and attrgetter objects
Change by Dennis Sweeney : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue44953> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46717] Raising exception multiple times leaks memory
Dennis Sweeney added the comment: I reproduced as far back as Python 3.6 with this: --- import gc exc = Exception() deltas = [] for i in range(2, 15): ref1 = len(gc.get_objects()) for j in range(2**i): try: raise exc except Exception: pass ref2 = len(gc.get_objects()) deltas.append(ref2 - ref1) print(deltas) # [4, 8, 16, 9, 64, 128, 256, 512, 1024, 2048, 4072, 8192, 16384] --- Note that the memory does get freed up once the exception is deleted: --- import gc deltas = [] for i in range(2, 15): ref1 = len(gc.get_objects()) exc = Exception() for j in range(2**i): try: raise exc except Exception: pass del exc # <<<<<<<<<<<<<<<<<<<<<<<<<<< ref2 = len(gc.get_objects()) deltas.append(ref2 - ref1) print(deltas) # [0, 0, 0, 0, 0, -14, 0, 0, 0, 0, -14, 0, 0] --- -- nosy: +Dennis Sweeney, iritkatriel ___ Python tracker <https://bugs.python.org/issue46717> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44953] Add vectorcall on operator.itemgetter and attrgetter objects
Dennis Sweeney added the comment: New changeset 035414a878a772d1d293cdecdc4470bcce5e5d7a by Dennis Sweeney in branch 'main': bpo-44953: Add newline at end of NEWS entry (GH-31265) https://github.com/python/cpython/commit/035414a878a772d1d293cdecdc4470bcce5e5d7a -- ___ Python tracker <https://bugs.python.org/issue44953> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44953] Add vectorcall on operator.itemgetter and attrgetter objects
Change by Dennis Sweeney : -- pull_requests: +29431 pull_request: https://github.com/python/cpython/pull/31265 ___ Python tracker <https://bugs.python.org/issue44953> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44953] Add vectorcall on operator.itemgetter and attrgetter objects
Dennis Sweeney added the comment: New changeset 0a145069e807fdafd1fa0315b9bc22da363d2d39 by Dennis Sweeney in branch 'main': bpo-44953: Add vectorcall for itemgetter and attrgetter instances (GH-27828) https://github.com/python/cpython/commit/0a145069e807fdafd1fa0315b9bc22da363d2d39 -- ___ Python tracker <https://bugs.python.org/issue44953> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46706] AxelRacer
New submission from Dennis Sweeney : I'm closing this -- if you found a bug in Python, please be sure to describe thoroughly what bug you found, steps to reproduce the bug, and what behavior you expected. -- nosy: +Dennis Sweeney resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46706> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46705] Memory optimization for set.issubset
Change by Dennis Sweeney : -- nosy: +rhettinger, serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue46705> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46680] file calls itself
Dennis Sweeney added the comment: https://stackoverflow.com/ or https://discuss.python.org/c/users/ are better places for this question. -- nosy: +Dennis Sweeney resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46680> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46652] Use code.co_qualname to provide richer information
Dennis Sweeney added the comment: Similar changes at bpo-40679 accidentally broke Cython when it was assumed that co_qualname was non-null, which was then fixed by defaulting to co_name in that case. I don't know if Cython still produces cases like that, but we should make sure not to needlessly break such cases if it does. -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46652> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46615] Use-after-free by mutating set during set operations
Change by Dennis Sweeney : -- keywords: +patch pull_requests: +29301 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31120 ___ Python tracker <https://bugs.python.org/issue46615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46615] Use-after-free by mutating set during set operations
Dennis Sweeney added the comment: It looks like usages of the PyDict_Next API assume the resulting references are borrowed and so INCREF them. Usages of set_next do not, but should. It should hopefully be a straightforward fix of adding INCREF/DECREFs. -- ___ Python tracker <https://bugs.python.org/issue46615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46615] Use-after-free by mutating set during set operations
Dennis Sweeney added the comment: set1.isdisjoint(set2) also crashes -- ___ Python tracker <https://bugs.python.org/issue46615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46615] Use-after-free by mutating set during set operations
Change by Dennis Sweeney : -- title: Segfault in set intersection (&) and difference (-) -> Use-after-free by mutating set during set operations ___ Python tracker <https://bugs.python.org/issue46615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46615] Segfault in set intersection (&) and difference (-)
Dennis Sweeney added the comment: replacing `return True` with `return random() < 0.5` makes *all* of the operations crash, except for `|` and `|=`. -- ___ Python tracker <https://bugs.python.org/issue46615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46615] Segfault in set intersection (&) and difference (-)
New submission from Dennis Sweeney : Maybe related to https://bugs.python.org/issue8420 Somewhat obscure, but using only standard Python, and no frame- or gc-hacks, it looks like we can get a use-after-free: from random import random BADNESS = 0.0 class Bad: def __eq__(self, other): if random() < BADNESS: set1.clear() if random() < BADNESS: set2.clear() return True def __hash__(self): return 42 SIZE = 100 TRIALS = 10_000 ops = [ "|", "|=", "==", "!=", "<", "<=", ">", ">=", # "&", # crash! # "&=", # crash! "^", # "^=", # crash # "-", # crash "-=", ] for op in ops: stmt = f"set1 {op} set2" print(stmt, "...") for _ in range(TRIALS): BADNESS = 0.00 set1 = {Bad() for _ in range(SIZE)} set2 = {Bad() for _ in range(SIZE)} BADNESS = 0.02 exec(stmt) print("ok.") -- components: Interpreter Core messages: 412386 nosy: Dennis Sweeney, rhettinger priority: normal severity: normal status: open title: Segfault in set intersection (&) and difference (-) type: crash versions: Python 3.10, Python 3.11, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45885] Specialize COMPARE_OP
Change by Dennis Sweeney : -- pull_requests: +29223 pull_request: https://github.com/python/cpython/pull/31040 ___ Python tracker <https://bugs.python.org/issue45885> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46561] Descriptor resolution should own arguments passed to descriptors
Dennis Sweeney added the comment: Hi Max, My apologies -- my first message was probably too dismissive. Is there any way to make the existing code crash with pure Python, and can we then add such a test case? If not with pure Python, then perhaps with some minimal reproducible example using the C API? Also, does the change have any effect on microbenchmarks involving the modified functions? -- ___ Python tracker <https://bugs.python.org/issue46561> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46528] Simplify the VM's stack manipulations
Dennis Sweeney added the comment: Minor nit: I think swaptimize() should check the for PyMem_Malloc returning NULL here. // Create an array with elements {0, 1, 2, ..., depth - 1}: int *stack = PyMem_Malloc(depth * sizeof(int)); for (int i = 0; i < depth; i++) { stack[i] = i; } -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46528> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46561] Descriptor resolution should own arguments passed to descriptors
Dennis Sweeney added the comment: Why? Callee-borrowing-from-caller is the established norm across the C API. You mention use-after-free, but can you elaborate on how that can happen in practice? https://docs.python.org/3/extending/extending.html?highlight=borrowed#ownership-rules says: """When you pass an object reference into another function, in general, the function borrows the reference from you — if it needs to store it, it will use Py_INCREF() to become an independent owner.""" -- nosy: +Dennis Sweeney ___ Python tracker <https://bugs.python.org/issue46561> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com