Skip to content

gh-64660: Do not hardcode the name of the returned variable - #155268

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:clinic-retval
Aug 13, 2026
Merged

gh-64660: Do not hardcode the name of the returned variable#155268
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:clinic-retval

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 6, 2026

Copy link
Copy Markdown
Member

data.return_value keeps its meaning -- the variable which receives the value returned by the impl, which declare() and custom return converters repoint. The name of the variable returned by the parsing function is now available as data.parser_retval, so that return converters no longer need to hardcode it.

The return converters in PC/msvcrtmodule.c are updated as well; wchar_t_return_converter hardcoded both names.

The generated code is not changed.

Return converters had to hardcode "return_value", because declare() sets
data.return_value to the variable which receives the value returned by
the impl.  The name of the variable returned by the parsing function is
now available as data.parser_retval.
@serhiy-storchaka
serhiy-storchaka merged commit 99b8847 into python:main Aug 13, 2026
64 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the clinic-retval branch August 13, 2026 09:57
mbeijen pushed a commit to mbeijen/cpython that referenced this pull request Aug 14, 2026
…thonGH-155268)

Return converters had to hardcode "return_value", because declare() sets
data.return_value to the variable which receives the value returned by
the impl.  The name of the variable returned by the parsing function is
now available as data.parser_retval.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant