-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
maximum recursion depth in deepcopy regression #126817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Interesting. I did not foresee such use case. In general, such code worked by accident, because the code in the The question is how to support that use case -- copying an object ignoring the special methods in the current class. Should we use |
sounds like we should find another way downstream no matter which way CPython goes on this question? |
Another example from Matplotlib that I suspect is coming from the same cause (but have not actually bisected) is
That is now failing with
It seems right to be to be able to access "copy/deepcopy this as if the object were its parent class" via I'm indifferent on if pickling |
See python/cpython#126817 for upstream discussion. This works around the change by using (private) methods from the copy module to re-implement the path though copy/deepcopy that we would like to use but avoid the special-casing for `super()` objects that is breaking us. We could vendor the current versions of `_keep_alive` (weakref work to manage lifecycles) and `_reconstruct` (where the recursion happens) to superficially avoid using private functions from CPython. However, if these functions do change significantly I worry that our copies would not inter-operate anyway. Closes matplotlib#29157
matplotlib/matplotlib#29393 is a hacky work-around to this change. |
See python/cpython#126817 for upstream discussion. This works around the change by using (private) methods from the copy module to re-implement the path though copy/deepcopy that we would like to use but avoid the special-casing for `super()` objects that is breaking us. We could vendor the current versions of `_keep_alive` (weakref work to manage lifecycles) and `_reconstruct` (where the recursion happens) to superficially avoid using private functions from CPython. However, if these functions do change significantly I worry that our copies would not inter-operate anyway. Closes matplotlib#29157
See python/cpython#126817 for upstream discussion. This works around the change by using (private) methods from the copy module to re-implement the path though copy/deepcopy that we would like to use but avoid the special-casing for `super()` objects that is breaking us. We could vendor the current versions of `_keep_alive` (weakref work to manage lifecycles) and `_reconstruct` (where the recursion happens) to superficially avoid using private functions from CPython. However, if these functions do change significantly I worry that our copies would not inter-operate anyway. Closes matplotlib#29157
@serhiy-storchaka Can this be labeled so it is resolved one way or the other by 3.14.0b1? |
See python/cpython#126817 for upstream discussion. This works around the change by using (private) methods from the copy module to re-implement the path though copy/deepcopy that we would like to use but avoid the special-casing for `super()` objects that is breaking us. We could vendor the current versions of `_keep_alive` (weakref work to manage lifecycles) and `_reconstruct` (where the recursion happens) to superficially avoid using private functions from CPython. However, if these functions do change significantly I worry that our copies would not inter-operate anyway. Closes matplotlib#29157
@serhiy-storchaka At this point should I assume that this will be the state in 3.14 and start to address the change downstream? |
See python/cpython#126817 for upstream discussion. This works around the change by using (private) methods from the copy module to re-implement the path though copy/deepcopy that we would like to use but avoid the special-casing for `super()` objects that is breaking us. We could vendor the current versions of `_keep_alive` (weakref work to manage lifecycles) and `_reconstruct` (where the recursion happens) to superficially avoid using private functions from CPython. However, if these functions do change significantly I worry that our copies would not inter-operate anyway. Closes matplotlib#29157
We should probably determine whether we can/should fix or add a note to WHATSNEW. |
See python/cpython#126817 for upstream discussion. This works around the change by using (private) methods from the copy module to re-implement the path though copy/deepcopy that we would like to use but avoid the special-casing for `super()` objects that is breaking us. We could vendor the current versions of `_keep_alive` (weakref work to manage lifecycles) and `_reconstruct` (where the recursion happens) to superficially avoid using private functions from CPython. However, if these functions do change significantly I worry that our copies would not inter-operate anyway. Closes matplotlib#29157
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
The following code works on py313 and below (this is a very cut-down version of some code in Matplotilb (
matplotlib.path.Path
)) but hit the maximum recursion depth on main.I bisected this to #125781 and suspect the problem is that because it is returning a new object it is escaping the memoization and looping.
I'm happy to be told we should not be doing this fix it on the Matplotlib side, but I would like to be sure that this was an expected consequence of the change.
attn @serhiy-storchaka
CPython versions tested on:
3.14, CPython main branch
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: