python / python/mypy

`_PyType_Lookup: Assertion `!PyErr_Occurred()' failed.` in two `mypyc/test/test_run.py` tests

Open
#16,043 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

crash good-second-issue topic-mypyc
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Crash Report

When running the mypy test suite while CPython is built --with-assertions, the two following tests fail due to crashes inside the tests.

Traceback

============================================================== FAILURES ===============================================================
__________________________________________________ testI64GlueMethodsAndInheritance ___________________________________________________
[gw4] linux -- Python 3.11.5 /tmp/mypy/.tox/py311/bin/python
data: /tmp/mypy/mypyc/test-data/run-i64.test:1340:
Failed: Invalid output (/tmp/mypy/mypyc/test-data/run-i64.test, line 1340)
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------

*** Exit status: -6
-------------------------------------------------------- Captured stderr call ---------------------------------------------------------
Expected:
Actual:
  python: Objects/typeobject.c:3823: _PyType_Lookup: Assertion `!PyErr_Occurred()' failed. (diff)

---------------------------------------------------------- Captured log call ----------------------------------------------------------
INFO     root:dist.py:985 running build_ext
INFO     root:build_ext.py:521 building 'native' extension
INFO     root:dir_util.py:71 creating build/temp.linux-x86_64-cpython-311
INFO     root:dir_util.py:71 creating build/temp.linux-x86_64-cpython-311/build
INFO     root:spawn.py:38 x86_64-pc-linux-gnu-gcc -Wsign-compare -fPIC -I/tmp/mypy/mypyc/lib-rt -I/tmp/mypy/.tox/py311/include -I/usr/include/python3.11 -c build/__native.c -o build/temp.linux-x86_64-cpython-311/build/__native.o -O0 -g1 -Werror -Wno-unused-function -Wno-unused-label -Wno-unreachable-code -Wno-unused-variable -Wno-unused-command-line-argument -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-ignored-optimization-argument -Wno-cpp
INFO     root:dir_util.py:71 creating build/lib.linux-x86_64-cpython-311
INFO     root:spawn.py:38 x86_64-pc-linux-gnu-gcc -shared build/temp.linux-x86_64-cpython-311/build/__native.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-311/native.cpython-311-x86_64-linux-gnu.so
INFO     root:file_util.py:137 copying build/lib.linux-x86_64-cpython-311/native.cpython-311-x86_64-linux-gnu.so ->
____________________________________________________________ testFloatOps _____________________________________________________________
[gw4] linux -- Python 3.11.5 /tmp/mypy/.tox/py311/bin/python
data: /tmp/mypy/mypyc/test-data/run-floats.test:3:
Failed: Invalid output (/tmp/mypy/mypyc/test-data/run-floats.test, line 3)
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------

*** Exit status: -6
-------------------------------------------------------- Captured stderr call ---------------------------------------------------------
Expected:
Actual:
  python: Objects/typeobject.c:3823: _PyType_Lookup: Assertion `!PyErr_Occurred()' failed. (diff)

---------------------------------------------------------- Captured log call ----------------------------------------------------------
INFO     root:dist.py:985 running build_ext
INFO     root:build_ext.py:521 building 'native' extension
INFO     root:dir_util.py:71 creating build/temp.linux-x86_64-cpython-311
INFO     root:dir_util.py:71 creating build/temp.linux-x86_64-cpython-311/build
INFO     root:spawn.py:38 x86_64-pc-linux-gnu-gcc -Wsign-compare -fPIC -I/tmp/mypy/mypyc/lib-rt -I/tmp/mypy/.tox/py311/include -I/usr/include/python3.11 -c build/__native.c -o build/temp.linux-x86_64-cpython-311/build/__native.o -O0 -g1 -Werror -Wno-unused-function -Wno-unused-label -Wno-unreachable-code -Wno-unused-variable -Wno-unused-command-line-argument -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-ignored-optimization-argument -Wno-cpp
INFO     root:dir_util.py:71 creating build/lib.linux-x86_64-cpython-311
INFO     root:spawn.py:38 x86_64-pc-linux-gnu-gcc -shared build/temp.linux-x86_64-cpython-311/build/__native.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-311/native.cpython-311-x86_64-linux-gnu.so
INFO     root:file_util.py:137 copying build/lib.linux-x86_64-cpython-311/native.cpython-311-x86_64-linux-gnu.so ->
======================================================= short test summary info =======================================================
FAILED mypyc/test/test_run.py::TestRun::run-i64.test::testI64GlueMethodsAndInheritance
FAILED mypyc/test/test_run.py::TestRun::run-floats.test::testFloatOps
======================================== 2 failed, 376 passed, 2 xfailed in 164.00s (0:02:44) =========================================

To Reproduce

Build CPython with --with-assertions. Then run the test suite, e.g. via tox:

tox -e py311 -- mypyc/test/test_run.py

Your Environment

  • Mypy version used: 1.5.1; also reproduced with 4496a005a84f7daedc1ef2e801583127f5995f75
  • Python version used: 3.11.5; also reproduced with 3.10.13 and 3.12.0rc1
  • Operating system and version: Gentoo Linux amd64

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mypyc/test/test_run.py and the failing cases in mypyc/test-data/run-i64.test and run-floats.test. Reproduce with CPython built using --with-assertions by running tox -e py311 -- mypyc/test/test_run.py, then trace the generated native extension involved in the crashes. Done means both tests pass without the _PyType_Lookup assertion failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
compilers, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.