You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Class attributes created with IntEnum are not created properly
To Reproduce
minimax.py
from __future__ importannotationsfromenumimportIntEnum, autoclassPlayer(IntEnum):
"""Enum for player status."""MIN=auto()
MAX=auto()
print(f'{Player.MAX=}')
mypyc minimax.py
Expected Behavior
No issues compiling
Actual Behavior
running build_ext
building 'minimax' extension
x86_64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/home/<my username>/.local/lib/python3.12/site-packages/mypyc/lib-rt -I/usr/include/python3.12 -c build/__native.c -o build/temp.linux-x86_64-cpython-312/build/__native.o -O3 -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
build/__native.c: In function ‘CPyDef___top_level__’:
build/__native.c:415:17: error: ‘CPyStatic_Player___MAX’ undeclared (first use in this function)
415 | cpy_r_r94 = CPyStatic_Player___MAX;
| ^~~~~~~~~~~~~~~~~~~~~~
build/__native.c:415:17: note: each undeclared identifier is reported only once for each function it appears in
At top level:
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 '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
Your Environment
Mypy version used: mypy 1.11.2 (compiled: yes)
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): None
Python version used: Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
GCC version used: gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
The text was updated successfully, but these errors were encountered:
build/__native_2650c38b35f4f94cf2d8.c: In function ‘CPyDef_development___pre_commit’:
build/__native_2650c38b35f4f94cf2d8.c:10461:17: error: ‘CPyStatic_development___PreCommitMode___changed’ undeclared (first use in this function); did you mean ‘CPyType_development___PreCommitMode’?
10461 | cpy_r_r45 = CPyStatic_development___PreCommitMode___changed;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| CPyType_development___PreCommitMode
build/__native_2650c38b35f4f94cf2d8.c:10461:17: note: each undeclared identifier is reported only once for each function it appears in
build/__native_2650c38b35f4f94cf2d8.c:10477:17: error: ‘CPyStatic_development___PreCommitMode___staged’ undeclared (first use in this function); did you mean ‘CPyType_development___PreCommitMode’?
10477 | cpy_r_r48 = CPyStatic_development___PreCommitMode___staged;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| CPyType_development___PreCommitMode
The first snippet works fine in mypyc == 1.14.0 and newer, the second since 1.15.0 - these seem to be different issues, but both are fixed now. (#18426 and #18178)
Bug Report
Class attributes created with
IntEnum
are not created properlyTo Reproduce
minimax.py
mypyc minimax.py
Expected Behavior
No issues compiling
Actual Behavior
Your Environment
mypy 1.11.2 (compiled: yes)
mypy.ini
(and other config files): NonePython 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
The text was updated successfully, but these errors were encountered: