Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
See #118099 (comment) and #118033
We now correctly check for __dictoffset__ and __weakoffset__ on C types without __slots__ defined:
Lines 1201 to 1212 in c68acb1
| matchcls.__dict__.get('__slots__'): | |
| # `__dictoffset__` and `__weakrefoffset__` can tell us whether | |
| # the base type has dict/weakref slots, in a way that works correctly | |
| # for both Python classes and C extension types. Extension types | |
| # don't use `__slots__` for slot creation | |
| caseNone: | |
| slots= [] | |
| ifgetattr(cls, '__weakrefoffset__', -1) !=0: | |
| slots.append('__weakref__') | |
| ifgetattr(cls, '__dictrefoffset__', -1) !=0: | |
| slots.append('__dict__') | |
| yieldfromslots |
But, not in this case:
Lines 1213 to 1218 in c68acb1
| casestr(slot): | |
| yieldslot | |
| # Slots may be any iterable, but we cannot handle an iterator | |
| # because it will already be (partially) consumed. | |
| caseiterableifnothasattr(iterable, '__next__'): | |
| yieldfromiterable |
So, in theory there might be C types with __slots__ and __dictoffset__ and __weakoffset__.
I will investigate!
carljm
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error