Repository navigation
gh-162098: add initialization for '_length' variable to Argument Clinic - #162100
Open
samitistfobos-dev wants to merge 2 commits into
Open
samitistfobos-dev wants to merge 2 commits into
samitistfobos-dev wants to merge 2 commits into
Conversation
samitistfobos-dev
requested review from
AA-Turner and
erlend-aasland
as code owners
November 16, 2026 10:19
Problem:
Argument Clinic rendered the adjacent "length" variable of an optional
length-bearing string parameter ("s#", "y#", "z#", "u#", "Z#") without an
initializer. The parser only writes *<name>_length when the argument is
actually passed, so an omitted argument left the variable undefined and the
impl function received an arbitrary buffer size
(Modules/clinic/_testclinic.c.h:1531, c_length).
Solution: Initialize the length variable from the parameter's default value in
Tools/clinic/libclinic/converter.py: a new CConverter.length_c_default() hook,
UTF-8 byte length for str defaults, 0 for None/NULL; regenerate the affected
clinic files and add regression tests for calls with omitted arguments.
Signed-off-by: a.burlakov ([email protected])
samitistfobos-dev
force-pushed
the
main
branch
from
November 16, 2026 10:31
001a16e to
e13019b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
Argument Clinic rendered the adjacent "length" variable of an optional length-bearing string parameter ("s#", "y#", "z#", "u#", "Z#") without an initializer. The parser only writes *_length when the argument is actually passed, so an omitted argument left the variable undefined and the impl function received an arbitrary buffer size
(Modules/clinic/_testclinic.c.h:1531, c_length).
Solution: Initialize the length variable from the parameter's default value in Tools/clinic/libclinic/converter.py: a new CConverter.length_c_default() hook, UTF-8 byte length for str defaults, 0 for None/NULL; regenerate the affected clinic files and add regression tests for calls with omitted arguments.
Signed-off-by: a.burlakov ([email protected])