Refactor structure and union initializer generators #136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #130.
The upcoming release of Python 3.14 brings a breaking change in the way (the order of) constants used in a function is/are determined while compiling bytecode. In previous versions of Python, the first
co_constsentry was both used to determine the presence of a docstring for a function (None if absent) and to provide the docstring. However, since the presence indicator has been replaced with a flag in theco_flagsbitfield,Noneis not necessarily the firstco_constsentry anymore in case no docstring was present.While this change would only affect generated union initializers, this PR refactors the generators for both the structure and the union initializers to overwrite tuples in the initializer function's code object based on their name instead of trying to recreate the tuples based on a static order, in an attempt to stabilize the generators against future regressions.