Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failure when specializing functions with too many __defaults__ #105840

Closed
brandtbucher opened this issue Jun 15, 2023 · 0 comments
Closed
Assignees
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) triaged The issue has been accepted as valid by a triager. type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@brandtbucher
Copy link
Member

brandtbucher commented Jun 15, 2023

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

@brandtbucher brandtbucher added interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.11 only security fixes type-crash A hard crash of the interpreter, possibly with a core dump 3.12 bugs and security fixes triaged The issue has been accepted as valid by a triager. 3.13 new features, bugs and security fixes labels Jun 15, 2023
@brandtbucher brandtbucher self-assigned this Jun 15, 2023
@brandtbucher brandtbucher changed the title Assertion failure when specializing function with too many __defaults__ Assertion failure when specializing functions with too many __defaults__ Jun 16, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 16, 2023
…too many __defaults__ (pythonGH-105847)

(cherry picked from commit 2beab5b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 16, 2023
…too many __defaults__ (pythonGH-105847)

(cherry picked from commit 2beab5b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
brandtbucher added a commit that referenced this issue Jun 16, 2023
… too many __defaults__ (GH-105863)

GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847)
(cherry picked from commit 2beab5b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
brandtbucher added a commit that referenced this issue Jun 16, 2023
… too many __defaults__ (GH-105864)

GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847)
(cherry picked from commit 2beab5b)

Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
gvanrossum pushed a commit to gvanrossum/cpython that referenced this issue Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) triaged The issue has been accepted as valid by a triager. type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

1 participant