Skip to content

fix: retain Python native callback parameter names until registration - #1333

Open
rksharma-owg wants to merge 1 commit into
google:masterfrom
rksharma-owg:codex/fix-native-callback-parameters
Open

fix: retain Python native callback parameter names until registration#1333
rksharma-owg wants to merge 1 commit into
google:masterfrom
rksharma-owg:codex/fix-native-callback-parameters

Conversation

@rksharma-owg

Copy link
Copy Markdown

Fixes #1321.

Keep each Python callback parameter's UTF-8 storage alive until jsonnet_native_callback has copied the names. With the pre-3.10 limited API, releasing each temporary bytes object inside the conversion loop leaves dangling pointers: later names can overwrite earlier ones, producing duplicate-binding errors even for distinct parameters.

The regression covers two and three multicharacter parameters and out-of-order named arguments. It fails in all three cases on the unchanged source with a CPython 3.9 build targeting the Python 3.8 stable ABI. After the fix, all 11 Python binding tests pass on both Python 3.9 and Python 3.13 using that same stable-ABI extension. git diff --check also passes.

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.

Python native callbacks with 2+ parameters fail with 'binding parameter a second time' in 0.22.0

1 participant