gh-103092: Isolate `_decimal` by CharlieZhao95 · Pull Request #103381 · python/cpython
- Convert
cond_mapto heap type (not recorded inglobal-to-fix, but it seems like we should handle it)I'm not sure I follow;
cond_mapis not a type.
Background
When I executed test_decimal.py after moving all variables in global-to-fix.csv into decimal_state, it raised an error:
Traceback (most recent call last): File "F:\CPython\github\cpython\Lib\test\test_decimal.py", line 5900, in <module> test_main(arith=True, verbose=True) File "F:\CPython\github\cpython\Lib\test\test_decimal.py", line 5840, in test_main init(C) File "F:\CPython\github\cpython\Lib\test\test_decimal.py", line 110, in init DefaultTestContext = m.Context( ^^^^^^^^^^ KeyError: 'invalid signal dict'
I found that the place where the error occurs is PyDict_GetItemWithError(val, cm->ex) in dict_as_flags. This seems to be caused by the static signal_map whose members are assigned to types in module state.
So I guess signal_map should be moved to decimal_state (you can view my latest commit, maybe it's not the best solution). Likewise, cond_map[i].ex will be assigned to signal_map[i].ex, so it probably needs to be moved as well.
I'm not sure if these works are necessary, please correct me if I'm wrong :)
Remove redundant code and improve some dirty code
Can you please spell this out? We cannot guess what you mean by this :)
Of course, there is currently some unclean code. For example, signal_map_init or some code with FIXME comments, they work but are ugly. I will list the code that need to be modified after I have finished thinking. :)