Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-106078: Move static objects related to CONTEXTVAR to the decimal module global state#106395
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
CharlieZhao95 commented Jul 4, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Fix build error with flag `--without-decimal-contextvar`
CONTEXTVAR to decimal module global stateCONTEXTVAR to the decimal module global stateCharlieZhao95 commented Jul 4, 2023
I executed the build and unit tests locally as follows. The result looks good. # build ./configure --without-decimal-contextvar make # unittest ./python -m test test_decimal cd ./Modules/_decimal/tests ./runall-memorydebugger.shBTW, do we have a CI pipeline that tests build with different compile options, such as |
CharlieZhao95 commented Jul 4, 2023
erlend-aasland left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of moving the entire struct, you can use forward declarations for the needed types.
bedevere-bot commented Jul 4, 2023
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
CharlieZhao95 commented Jul 4, 2023
This is an alias for an anonymous struct. We cannot forward declare anonymous structs or typedefs :( A solution is to name these structs. For example: structPyDecContextObject; typedefstruct{... structPyDecContextObject*cached_context; ... } decimal_state; typedefstructPyDecContextObject{PyObject_HEADmpd_context_tctx; PyObject*traps; PyObject*flags; intcapitals; PyThreadState*tstate} PyDecContextObject;There is no harm and now you can forward declare it. |
erlend-aasland commented Jul 4, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
It's no hinder that the structs are anonymous. C has solutions for that as well. Let me know if you need a hint. Alternatively, add a name to them. There is no harm in that, and it is quite normal throughout the code base. Examples:
|
CharlieZhao95 commented Jul 4, 2023
I don't know if your solution is to move the
Thanks! I prefer to add names to these structures :) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
erlend-aasland left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally with ./configure --without-decimal-contextvar. LGTM.
Move following objects related to the
CONTEXTVARto decimal module global state._decimalextension module #106078