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

[BUG]: Cannot build with Python 3.11.2 since enum has no _singles_mask_ attribute. #726

Closed
hpkfft opened this issue Sep 19, 2024 · 3 comments

Comments

@hpkfft
Copy link
Contributor

hpkfft commented Sep 19, 2024

Problem description

Using the master branch of nanobind on a Debian 12.7 (bookworm) system, I get:

FAILED: tests/test_enum_ext.pyi
terminate called after throwing an instance of 'nanobind::python_error'
  what():  Traceback (most recent call last):
  File "/home/paul/master/nanobind/src/stubgen.py", line 1422, in <module>
  File "/home/paul/master/nanobind/src/stubgen.py", line 1355, in main
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 676, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 573, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1233, in create_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.11/enum.py", line 789, in __getattr__
AttributeError: _singles_mask_

Note that the attribute appears to be missing:

$ grep singles /usr/lib/python3.11/enum.py
$

Reproducible example code

CXX=clang++-16 cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cd build
ninja

Note: The use of ninja above is not relevant.   Same issue occurs using the default, `make`.
@wjakob
Copy link
Owner

wjakob commented Sep 19, 2024

cc @nicholasjng

@nicholasjng
Copy link
Contributor

Looks like the _singles_mask_ attribute was added in commit python/cpython@804a973 ,which was not released until 3.11.4. I'll prepare a fix.

@wjakob
Copy link
Owner

wjakob commented Sep 20, 2024

Closed via #727.

@wjakob wjakob closed this as completed Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants