Closed
Description
Crash Report
compiling Python modules using mypyc failed with a gcc error, where it did not using mypy 1.15
Python 3.10: https://github.com/common-workflow-language/schema_salad/actions/runs/15347015751/job/43185437282?pr=927#step:6:439
Python 3.11: https://github.com/common-workflow-language/schema_salad/actions/runs/15347015751/job/43185437303?pr=927#step:6:433
Python 3.12: https://github.com/common-workflow-language/schema_salad/actions/runs/15347015751/job/43185437295?pr=927#step:6:425
Python 3.13: https://github.com/common-workflow-language/schema_salad/actions/runs/15347015751/job/43185437315?pr=927#step:6:425
Traceback
building '5df31530eea7292b5dae__mypyc' extension
creating build/temp.linux-x86_64-cpython-39/build
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/pip-build-env-qntpj1xx/overlay/lib/python3.9/site-packages/mypyc/lib-rt -Ibuild -I/opt/_internal/cpython-3.9.22/include/python3.9 -c build/__native_5df31530eea7292b5dae.c -o build/temp.linux-x86_64-cpython-39/build/__native_5df31530eea7292b5dae.o -O3 -g0 -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
build/__native_5df31530eea7292b5dae.c:110530:32: error: ‘ref_resolver___NormDict_finalize’ undeclared here (not in a function); did you mean ‘ref_resolver___NormDict_init’?
110530 | .tp_finalize = (destructor)ref_resolver___NormDict_finalize,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ref_resolver___NormDict_init
cc1: note: unrecognized command-line option ‘-Wno-ignored-optimization-argument’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-unused-command-line-argument’ may have been intended to silence earlier diagnostics
error: command '/opt/rh/gcc-toolset-14/root/usr/bin/gcc' failed with exit code 1
error: subprocess-exited-with-error
× Building wheel for schema-salad (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
To Reproduce
- Checkout https://github.com/common-workflow-language/schema_salad/tree/dependabot/pip/mypy-mypyc--1.16.0
tox -e py39-mypy
(orpy310-mypy
, up topy313-mypy
); or make a virtualenv and activate it, andmake dev mypyc
Your Environment
- Mypy version used: 1.16
- Mypy command-line flags:
MYPYPATH=mypy-stubs SCHEMA_SALAD_USE_MYPYC=1 pip install --verbose -e .
- Mypy configuration options from
mypy.ini
(and other config files): https://github.com/common-workflow-language/schema_salad/blob/dependabot/pip/mypy-mypyc--1.16.0/mypy.ini - Python version used: 3.9 - 3.13
- Operating system and version: Ubuntu Linux 24.04.2
Activity
JukkaL commentedon May 30, 2025
Thanks for reporting the issue! The next step would be to find the root cause by bisecting mypy and mypyc commits.
JukkaL commentedon May 30, 2025
This PR looks related:
Now we need a self-contained reproducer, which we can use to check if the above PR is the root cause, or to bisect across all commits otherwise.
mr-c commentedon May 30, 2025
Thank you @JukkaL ; I have to finish other work right now, so I can't dig in further today. Here's the is Python source code for the class related to the error: https://github.com/common-workflow-language/schema_salad/blob/0f8e2e888b38bff4e07a91807da430ca2a635376/schema_salad/ref_resolver.py#L96-L119
mr-c commentedon May 30, 2025
I nerdsniped myself, here is a minimal reproducer
ref_resolver.py
JelleZijlstra commentedon May 30, 2025
You nerd-sniped me further because surely that's too complex for a minimal reproducer. This still reproduces it:
mr-c commentedon May 31, 2025
I did a
git bisect
using the following script and @JelleZijlstra 's minimal reproducerWhich found 8104d01 from #18519 matching the previous suggestion by @JelleZijlstra .
@advait-dixit can you take a look at this?
advait-dixit commentedon May 31, 2025
Yes, I can take a look at this and report back on Monday.
[mypyc] Fixing condition for handling user-defined __del__ (#19188)
[mypyc] Fixing condition for handling user-defined __del__ (#19188)