Closed
Description
When specializing some Python calls, we assert that we don't have more defaults than we have arguments. This isn't always true, though:
>>> def f():
... pass
...
>>> f.__defaults__ = (None,)
>>> for _ in range(2):
... f()
...
python: Python/specialize.c:1650: specialize_py_call: Assertion `defcount <= argcount' failed.
Aborted
Linked PRs
- GH-105840: Fix assertion failures when specializing calls with too many
__defaults__
#105847 - [3.12] GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847) #105863
- [3.11] GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847) #105864