You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think next we can move the remaining static global PyObject to global_state:
DecimalException
basic_context_template
current_context_var
default_context_template
extended_context_template
round_map
Rational
SignalTuple
External C-API functions
This shouldn't be too complicated. The only question is whether we should move these external-API functions, which simply hold function pointers used by numeric types, such as nb_multiply, nb_floor_divide and so on. They will not change during the lifecycle of the program.
The second stage has been completed. All documented static variables are moved to the global state. Thanks for review! @erlend-aasland@kumaraditya303
Based on the experience of the original PR, we should also move the signal_map into the module state before converting the global state. This array of structures contains potentially global variables(ex).
typedefstruct {
constchar*name; /* condition or signal name */constchar*fqname; /* fully qualified name */uint32_tflag; /* libmpdec flag */PyObject*ex; /* corresponding exception */
} DecCondMap;
staticDecCondMapsignal_map[] = {
...
}
IMO, the next stage should be:
Move signal_map to global state
Convert the global module state to true module state
How about opening a draft PR (convert the global module) first? This will allow us to see failed test cases raised by signal_map more clearly. Or do I just start moving signal_map into global state?
How about opening a draft PR (convert the global module) first? This will allow us to see failed test cases raised by signal_map more clearly. Or do I just start moving signal_map into global state?
FTR, I often open PRs on my own fork to check CI issues, so that I won't pollute the CPython PR list too much.
Also: I'll be away for the rest of summer, so my response time will probably be slower than usual, just so you know :)
Activity
gh-106078: Convert `_decimal` types to heap types (#106079)
erlend-aasland commentedon Jun 29, 2023
What is your next step, @CharlieZhao95?
CharlieZhao95 commentedon Jun 29, 2023
I think next we can move the remaining static global PyObject to
global_state:This shouldn't be too complicated. The only question is whether we should move these external-API functions, which simply hold function pointers used by numeric types, such as
nb_multiply,nb_floor_divideand so on. They will not change during the lifecycle of the program.erlend-aasland commentedon Jun 29, 2023
Pick the low-hanging fruit first. It is better with multiple small PRs than one big.
CharlieZhao95 commentedon Jun 29, 2023
Okay! let's go step by step. I will put the objects listed above into multiple small PRs.
gh-106078: Move DecimalException to _decimal state (#106301)
Merge branch 'main' into modulelocals
gh-106078: Move `context template` to decimal module global state (#1…
gh-106078: Move static objects related to `CONTEXTVAR` to the decimal…
gh-106078: Move static variables initialized once to decimal module g…
gh-106078: Move external C-API functions to decimal module global sta…
CharlieZhao95 commentedon Jul 11, 2023
The second stage has been completed. All documented static variables are moved to the global state. Thanks for review! @erlend-aasland @kumaraditya303
Based on the experience of the original PR, we should also move the
signal_mapinto the module state before converting the global state. This array of structures contains potentially global variables(ex).IMO, the next stage should be:
signal_mapto global stateHow about opening a draft PR (convert the global module) first? This will allow us to see failed test cases raised by
signal_mapmore clearly. Or do I just start movingsignal_mapinto global state?erlend-aasland commentedon Jul 11, 2023
FTR, I often open PRs on my own fork to check CI issues, so that I won't pollute the CPython PR list too much.
Also: I'll be away for the rest of summer, so my response time will probably be slower than usual, just so you know :)
CharlieZhao95 commentedon Jul 14, 2023
gh-106078: Prepare to isolate decimal module (#106880)
gh-106078: Isolate `decimal` module (#107287)
erlend-aasland commentedon Jul 28, 2023
Great work, @CharlieZhao95 and @kumaraditya303!
gh-106078: Suppress the warning caused by multi-phase initialization …
pythongh-106078: Suppress the warning caused by multi-phase initializ…
Require Python 3.14+ for OWN_GIL mode