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 in Objects/call.c:342: !_PyErr_Occurred(tstate) failed #112388

Closed
bradlarsen opened this issue Nov 25, 2023 · 4 comments
Closed
Labels
type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@bradlarsen
Copy link
Contributor

bradlarsen commented Nov 25, 2023

Crash report

What happened?

I found some crashes when adding an additional fuzz target in #111721.

# This script fails with a C assertion failure when assertions are enabled.
#
# I ran this through Python built from source with assertions enabled:
#
#     ./configure --with-assertions --prefix "$PWD/debugbuild"
#     make -j12 altinstall
#     ./debugbuild/bin/python/crash2.py
#
# I ran this on ARM64 macOS:
#
#     Darwin dialectic.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64

# Input found via the fuzz target added in https://github.com/python/cpython/pull/111721, then manually minimized
s = b"with(0,,):\n\x01"

# This line fails with a C assertion failure:
#
#     fuzz_pycompile: Objects/call.c:342: PyObject *_PyObject_Call(PyThreadState *, PyObject *, PyObject *, PyObject *): Assertion `!_PyErr_Occurred(tstate)' failed.
#
compile(s, 's', 'exec')

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

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

Python 3.13.0a1+ (heads/main:3701f3bc10, Nov 24 2023, 23:05:42) [Clang 15.0.0 (clang-1500.0.40.1)]

Linked PRs

@bradlarsen bradlarsen added the type-crash A hard crash of the interpreter, possibly with a core dump label Nov 25, 2023
@bradlarsen
Copy link
Contributor Author

See also #112387

@carsonRadtke
Copy link
Contributor

$ git bisect determined the issue was introduced in 81f4e11.

It appears the "invalid non-printable character" error was identified, but not promptly emitted to the user. Then when the "expected an indented block" error comes around, we see we are about to overwrite an error and we abort.

@hugovk
Copy link
Member

hugovk commented Nov 25, 2023

Thanks for the report and bisecting.

cc @pablogsal

pablogsal added a commit to pablogsal/cpython that referenced this issue Nov 25, 2023
pablogsal added a commit to pablogsal/cpython that referenced this issue Nov 25, 2023
…verwrite tokenizer errors

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
pablogsal added a commit that referenced this issue Nov 27, 2023
…te tokenizer errors (#112410)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 27, 2023
…verwrite tokenizer errors (pythonGH-112410)

(cherry picked from commit 2c8b191)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 27, 2023
…verwrite tokenizer errors (pythonGH-112410)

(cherry picked from commit 2c8b191)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
@pablogsal
Copy link
Member

Thanks for the report!

pablogsal added a commit that referenced this issue Nov 27, 2023
…overwrite tokenizer errors (GH-112410) (#112467)

gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors (GH-112410)
(cherry picked from commit 2c8b191)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
pablogsal added a commit that referenced this issue Nov 27, 2023
…overwrite tokenizer errors (GH-112410) (#112466)

gh-112388: Fix an error that was causing the parser to try to overwrite tokenizer errors (GH-112410)
(cherry picked from commit 2c8b191)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…verwrite tokenizer errors (python#112410)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

4 participants