Skip to content

Conversation

@MrYoranimo
Copy link
Contributor

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_consts entry 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 the co_flags bitfield, None is not necessarily the first co_consts entry 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.

@codecov
Copy link

codecov bot commented Jul 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.73%. Comparing base (a7ec0a3) to head (aef481a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #136      +/-   ##
==========================================
+ Coverage   92.21%   92.73%   +0.52%     
==========================================
  Files          21       21              
  Lines        2517     2381     -136     
==========================================
- Hits         2321     2208     -113     
+ Misses        196      173      -23     
Flag Coverage Δ
unittests 92.73% <100.00%> (+0.52%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Schamper
Copy link
Member

Made some slight changes to deal with non-hashable type lookups (in case they sneak in somewhere) and let Copilot generate some docstrings.

@Schamper Schamper merged commit df4b134 into fox-it:main Jul 28, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible regression on Python 3.14

2 participants