python / python/cpython

Always check for `__dictrefoffset__` and `__weakoffset__` in `dataclasses` with slots

Offen
#118,829 0 Kommentare 1 Reaktion 1 zugewiesene Person Auf GitHub ansehen

@sobolevn arbeitet bereits daran.

Seit 09.5.2024.

stdlib type-bug
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
36k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

Bug report

See https://github.com/python/cpython/pull/118099#discussion_r1575244611 and https://github.com/python/cpython/issues/118033

We now correctly check for __dictoffset__ and __weakoffset__ on C types without __slots__ defined: https://github.com/python/cpython/blob/c68acb1384a51eb745f572687eaf677371b9e765/Lib/dataclasses.py#L1201-L1212

But, not in this case: https://github.com/python/cpython/blob/c68acb1384a51eb745f572687eaf677371b9e765/Lib/dataclasses.py#L1213-L1218

So, in theory there might be C types with __slots__ and __dictoffset__ and __weakoffset__.

I will investigate!

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

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