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
{{ message }}
Repository navigation
PyNumber protocol does not check for implementations in base classes #5726
@youknowone I'm curious as to how I could attempt a fix for this. It seems as though PyNumber has been defined slightly differently than the other protocols, and I think this is intentional.
It's been so long time ago I worked on slots. I forgot the most of details.
CPython basically inherits slots not to require subtypes to crawl up the entire mro. But we don't have it.
We check base classes to avoid this limitation. About PyNumber, checking base classes made another problem like referencing PyBaseObject's PyNumber, which shouldn't happen.
If PyNumber slots are fairly well isolated from others, we will be able to implement slot inheritance only for PyNumber
Activity
arihant2math commentedon Jun 28, 2025
@youknowone I'm curious as to how I could attempt a fix for this. It seems as though PyNumber has been defined slightly differently than the other protocols, and I think this is intentional.
youknowone commentedon Jun 29, 2025
It's been so long time ago I worked on slots. I forgot the most of details.
CPython basically inherits slots not to require subtypes to crawl up the entire mro. But we don't have it.
We check base classes to avoid this limitation. About PyNumber, checking base classes made another problem like referencing PyBaseObject's PyNumber, which shouldn't happen.
If PyNumber slots are fairly well isolated from others, we will be able to implement slot inheritance only for PyNumber
youknowone commentedon Jan 2, 2026
Long rally including #6622 solved hopefully all the slot inheritance issues