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

Abort from GenericAlias.__sizeof__: ob->ob_type != &PyLong_Type #127603

Closed
devdanzin opened this issue Dec 4, 2024 · 2 comments
Closed

Abort from GenericAlias.__sizeof__: ob->ob_type != &PyLong_Type #127603

devdanzin opened this issue Dec 4, 2024 · 2 comments
Labels
3.12 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@devdanzin
Copy link
Contributor

devdanzin commented Dec 4, 2024

Crash report

What happened?

It's possible to abort the interpreter in 3.12 by calling __sizeof__ of a GenericAlias instance:

from types import GenericAlias

g = GenericAlias(BaseException, Exception)
g.__sizeof__(1)

Abort message:

python: ./Include/object.h:231: Py_SIZE: Assertion `ob->ob_type != &PyLong_Type' failed.
Aborted

Found using fusil by @vstinner.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.12.8+ (heads/3.12:8e3c2d2, Dec 4 2024, 10:58:33) [GCC 11.4.0]

@devdanzin devdanzin added the type-crash A hard crash of the interpreter, possibly with a core dump label Dec 4, 2024
@vstinner
Copy link
Member

vstinner commented Dec 4, 2024

I created #127605 backport to fix the issue.

@picnixz picnixz added topic-typing interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.12 bugs and security fixes and removed topic-typing labels Dec 5, 2024
@vstinner
Copy link
Member

vstinner commented Dec 11, 2024

Fixed by commit 0964f9f. Thanks for your bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

3 participants