Repository navigation
Remove unused _PyArg_VaParseTupleAndKeywordsFast() #107196
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jul 24, 2023 PR #107197 is the easy part: remove the unused private
_PyArg_VaParseTupleAndKeywordsFast()function.Argument Clinic currently unrolls parsing functions, generating a sequence of converter calls for individual parameters. But it does not support all cases, and when it fail to generate parsing code for all parameters, it falls back to traditional method, calling
_PyArg_ParseTupleAndKeywordsFastor_PyArg_ParseStackAndKeywords. The former is used for__new__and init`, the latter for other methods.So it happened that
_PyArg_ParseTupleAndKeywordsFastis not used in currently generated code. But it will be used if we convert to Argument Clinic some classes with constructors which need it._PyArg_VaParseTupleAndKeywordsFastis not used and AFAIK never was used. It was added for symmetry, for the case if we make this interface public.You can remove
_PyArg_VaParseTupleAndKeywordsFast, but itself it will not save much code. You can defer this until we remove also_PyArg_ParseTupleAndKeywordsFast(and possible_PyArg_ParseStackAndKeywords) by ensuring that Argument Clinic no longer needs such fallback. Or until we add them (reworked) to the public API, so they could be used without Argument Clinic.- changed the title
[-]Argument Clinic: is _PyArg_ParseTupleAndKeywordsFast() still used or not?[/-][+]Remove unused _PyArg_ParseTupleAndKeywordsFast()[/+]on Jul 27, 2023 - changed the title
[-]Remove unused _PyArg_ParseTupleAndKeywordsFast()[/-][+]Remove unused _PyArg_VaParseTupleAndKeywordsFast()[/+]on Jul 27, 2023 Let's keep _PyArg_ParseStackAndKeywords() for now. PR #110966 moves it to the internal C API, so it will be easier to remove it later if needed.
It seems like the
_PyArg_VaParseTupleAndKeywordsFast()function is no longer used in the Python code base.Moreover, Argument Clinic (
Tools/clinic/clinic.py) can produce code calling the_PyArg_ParseTupleAndKeywordsFast()function, but it is not the case currently:_PyArg_ParseStackAndKeywords()is used instead.What's the status of these two functions,
_PyArg_ParseStackAndKeywords()and_PyArg_VaParseTupleAndKeywordsFast()?cc @erlend-aasland @serhiy-storchaka
Linked PRs