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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-10-20.10:40:01.685>created_at=<Date2021-10-19.15:43:58.181>labels= []
title='PyType_Spec basicsize/itemsize should allow -1 for "inherit"'updated_at=<Date2021-10-20.10:40:01.683>user='https://github.com/encukou'
For cases where you aren't adding new C-level state, especially if don't have the superclass' struct available, it would be good to allow inheriting basicsize/itemsize from the superclass.
(SuperType->tp_size is not easily usable for the same reason PyType_FromSpecWithBases exists: on MSVC, if SuperType comes from a different DLL, it is not a constant expression.)
Hm, after sleeping on it, I think I filed this too soon.
If you don't have the superclass's C memory layout (and you can't add new C-level state), it's not likely that you want to define a class in C.
I can construct theoretical cases where it might be useful, but IMO it should wait for an *actual* motivating use case. (The one I had was making a specific C-API test a bit easier to write, which is very weak.)
No need to have this sit on CPython's TODO list. I'll close this and let someone reopen (or file a new issue) if they actually need it.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: