[BUG]: Can't use PYBIND11_NUMPY_DTYPE with subinterpreters

Offen
#5,781 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
cpp, numpy, python

Rechercherichtung

Start with the PYBIND11_NUMPY_DTYPE(weighted_sum, value, variance) example and reproduce it across subinterpreters. Investigate whether the failure comes from pybind11's dtype registration or NumPy's subinterpreter support; done requires a confirmed safe behavior or a documented blocker.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

triage
Required prerequisites
What version (or hash if on master) of pybind11 are you using?

3.0.0

Problem description

Registering a DTYPE fails in subinterpreters because the DTYPE is already registered. Any thoughts on how to make this subinterpreter safe?

ImportError: NumPy: dtype is already registered

Edit: I think numpy may not work in subinterpreters; if I suppress this error when it's already loaded, then it looks like numpy throws an error when importing. So it might not be very important to solve until numpy supports subinterpreters.

Reproducible example code
PYBIND11_NUMPY_DTYPE(weighted_sum, value, variance);
Is this a regression? Put the last known working version here if it is.

Not a regression

Vorherrschende Sprache
C++
Sterne
18k
Forks
2.3k
Ø Merge
5 T. 7 Std.
Gemergte PRs (30 T.)
53

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus pybind/pybind11

Alle Issues in pybind/pybind11

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.