Skip to content

Commit 87cd20a

Browse files
authored
gh-115026: Argument Clinic: handle PyBuffer_FillInfo errors in generated code (#115027)
1 parent f71bdd3 commit 87cd20a

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

Modules/_sqlite/clinic/connection.c.h

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_codecsmodule.c.h

Lines changed: 13 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/clinic/_ssl.c.h

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/clinic/clinic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4368,7 +4368,9 @@ def parse_arg(self, argname: str, displayname: str, *, limited_capi: bool) -> st
43684368
if (ptr == NULL) {{{{
43694369
goto exit;
43704370
}}}}
4371-
PyBuffer_FillInfo(&{paramname}, {argname}, (void *)ptr, len, 1, 0);
4371+
if (PyBuffer_FillInfo(&{paramname}, {argname}, (void *)ptr, len, 1, PyBUF_SIMPLE) < 0) {{{{
4372+
goto exit;
4373+
}}}}
43724374
}}}}
43734375
else {{{{ /* any bytes-like object */
43744376
if (PyObject_GetBuffer({argname}, &{paramname}, PyBUF_SIMPLE) != 0) {{{{

0 commit comments

Comments
 (0)