Skip to content

Conversation

@skirpichev
Copy link
Member

@skirpichevskirpichev commented Aug 28, 2025

  • use "defining class" converter, where possible
  • convert Context._unsafe* to Argument Clinic

Use "defining class" converter, where possible.
@bedevere-appbedevere-appbot mentioned this pull request Aug 28, 2025
@skirpichevskirpichev requested review from AA-Turner and serhiy-storchaka and removed request for AA-TurnerAugust 28, 2025 11:40
@skirpichevskirpichev marked this pull request as ready for review August 28, 2025 14:23
Copy link
Member

@AA-TurnerAA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok from a desk review, barring Serhiy's comments.

A

@AA-TurnerAA-Turner changed the title gh-73487: Convert _decimal to use Argument Clinic (part 7)gh-73487: Convert _decimal to use Argument Clinic (part 7)Sep 1, 2025
Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any uses of get_module_state_by_def() left?

@skirpichev
Copy link
MemberAuthor

skirpichev commented Sep 2, 2025

Are there any uses of get_module_state_by_def() left?

Yes, a lot:

$ git grep get_module_state_by_def Modules/_decimal Modules/_decimal/_decimal.c:get_module_state_by_def(PyTypeObject *tp) Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(self)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(self)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(self)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(self)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(v)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(self)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(type); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(type); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(dec)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(dec)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(self)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(self)); \ Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(dec)); Modules/_decimal/_decimal.c: decimal_state *state = get_module_state_by_def(Py_TYPE(self)); 

I'll double check, some case could be converted to use "defining class" converter (e.g. _decimal.Decimal.as_tuple), but not all.

Edit: I think nothing left.

@skirpichev
Copy link
MemberAuthor

@serhiy-storchaka, do you think anything left to address issue?

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor question, and LGTM. 👍

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinnervstinner merged commit b0a8073 into python:mainSep 18, 2025
43 checks passed
@vstinner
Copy link
Member

Merged, thanks.

@skirpichevskirpichev deleted the ac-decimal/73487-pt7 branch September 18, 2025 14:09
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@skirpichev@vstinner@serhiy-storchaka@AA-Turner