Visitar URL original
Assertion failure when specializing functions with too many `__defaults__` · Issue #105840 · python/cpython · GitHub
Skip to content

Assertion failure when specializing functions with too many __defaults__ #105840

Closed

Description

@brandtbucher

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

Activity

  1. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    3.11only security fixes
    type-crashA hard crash of the interpreter, possibly with a core dump
    3.12only security fixes
    triagedThe issue has been accepted as valid by a triager.
    3.13only security fixes
    on Jun 15, 2023
  2. self-assigned this
    on Jun 15, 2023
  3. changed the title [-]Assertion failure when specializing function with too many `__defaults__`[/-] [+]Assertion failure when specializing functions with too many `__defaults__`[/+] on Jun 16, 2023
  4. added a commit that references this issue on Jun 16, 2023
  5. added 2 commits that reference this issue on Jun 16, 2023
  6. added 2 commits that reference this issue on Jun 16, 2023
  7. added a commit that references this issue on Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixes3.13only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)triagedThe issue has been accepted as valid by a triager.type-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions