Skip to content

Clean up the calling interface of the Optintepreter#15966

Open
dcbaker wants to merge 2 commits into
mesonbuild:masterfrom
dcbaker:submit/optinterpreter-stricter-typing
Open

Clean up the calling interface of the Optintepreter#15966
dcbaker wants to merge 2 commits into
mesonbuild:masterfrom
dcbaker:submit/optinterpreter-stricter-typing

Conversation

@dcbaker

@dcbaker dcbaker commented Jun 30, 2026

Copy link
Copy Markdown
Member

The OptInterperter *_parser methods have a unique signature to them, passing some arguments in the args: list[TYPE_var] parameter common to most calling interfaces, while also passing two string parameters separately. In the midst of cleaning that up, I noticed that there's several uses of Any that could be removed to make the typing tighter and thus mypy more helpful.

This is peeled off of a larger body of work aimed at reworking our interpreter calling convention and state tracking.

@dcbaker dcbaker requested a review from jpakkane as a code owner June 30, 2026 18:09
@dcbaker dcbaker added the typing label Jun 30, 2026
@dcbaker dcbaker force-pushed the submit/optinterpreter-stricter-typing branch 2 times, most recently from 0ebdae2 to c00b72c Compare June 30, 2026 18:37
This reduces the amount of Any used, which allows mypy to provide better
type checking.
@dcbaker dcbaker force-pushed the submit/optinterpreter-stricter-typing branch from c00b72c to 6255003 Compare June 30, 2026 18:46
Comment thread mesonbuild/interpreterbase/decorators.py
By putting the name and description parameters in the args tuple, we end
up with a signature of `(self, args: list[TYPE_var], TYPE_dict)`, this
matches up quite closely with other interfaces, and will make the future
work of having a single calling convention much simpler.
@dcbaker dcbaker force-pushed the submit/optinterpreter-stricter-typing branch from 6255003 to 8ea09d7 Compare June 30, 2026 19:48
@bonzini bonzini added this to the 1.13 milestone Jul 1, 2026
Sign up for free to 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.

3 participants