gh-78724: raise RuntimeError's when calling methods on non-ready Struct()'s#143643
gh-78724: raise RuntimeError's when calling methods on non-ready Struct()'s#143643serhiy-storchaka merged 14 commits into
Conversation
… by dunder methods
Now modification of the Struct() while packing trigger a RuntimeError
…y Struct()'s Calling the ``Struct.__new__()`` dunder without required argument now is deprecated. Calling the ``Struct.__init__()`` dunder method on initialized object now also is deprecated.
This comment was marked as outdated.
This comment was marked as outdated.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
This issue is relatively independed from the concurrent packing issue, so I suggest fir it separately. We should not add deprecation in maintained versions, so I suggest to only leave checks that Struct was initialized, and add the deprecation in a separate PR.
prepare_s() should be rewritten so it only sets s_codes and other fields when it is successful.
Sorry, something went wrong.
I think it's already the case. We can move a bit s_size/s_len assignments, but as far as we interested only in s_codes - I'm not sure if it's worth. There should be no failures after |
Sorry, something went wrong.
|
Well, it does not matter. It would reduce the chance of race condition, but nobody should run |
Sorry, something went wrong.
I guess this belongs to the #143382 pr thread. |
Sorry, something went wrong.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
LGTM. 👍
Sorry, something went wrong.
515ae40
into
python:main
Jan 11, 2026
|
Thanks @skirpichev for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
Sorry, something went wrong.
…y Struct()'s (pythonGH-143643) (cherry picked from commit 515ae40) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
Sorry, @skirpichev and @serhiy-storchaka, I could not cleanly backport this to |
Sorry, something went wrong.
edited
LoadingUh oh!
There was an error while loading. Please reload this page.
Copy link Copy MarkdownSorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.