Skip to content

Commit

Permalink
pythongh-85283: Fix Argument Clinic for md5 extension (python#110976)
Browse files Browse the repository at this point in the history
Limited C API supports the defining class under some conditions.
  • Loading branch information
vstinner authored and Glyphack committed Jan 27, 2024
1 parent fce1c1c commit c54f498
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Modules/clinic/md5module.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ def parser_body(

fastcall = not new_or_init
limited_capi = clinic.limited_capi
if limited_capi and (requires_defining_class or pseudo_args or
if limited_capi and (pseudo_args or
(any(p.is_optional() for p in parameters) and
any(p.is_keyword_only() and not p.is_optional() for p in parameters)) or
any(c.broken_limited_capi for c in converters)):
Expand Down Expand Up @@ -1642,12 +1642,11 @@ def parser_body(
declarations=declarations)


methoddef_cast_end = ""
if flags in ('METH_NOARGS', 'METH_O', 'METH_VARARGS'):
methoddef_cast = "(PyCFunction)"
methoddef_cast_end = ""
elif limited_capi:
methoddef_cast = "(PyCFunction)(void(*)(void))"
methoddef_cast_end = ""
else:
methoddef_cast = "_PyCFunction_CAST("
methoddef_cast_end = ")"
Expand Down

0 comments on commit c54f498

Please sign in to comment.