[Python-Dev] Re: Proto-PEP part 4: The wonderful third option

2022年4月26日 00:01:34 -0700

Larry Hastings wrote:
> [...]
>
> Now comes the one thing that we might call a "trick". The trick: when 
> we allocate the ForwardClass instance C, we make it as big as a class 
> object can ever get. (Mark Shannon assures me this is simply "heap 
> type", and he knows far more about CPython internals than I ever will.) 
It's possible that I'm misunderstanding the allocation mechanism (and it sounds 
like you've discussed it with people that know a lot more about the internals 
than me), but if C is an instance of the metaclass then surely you have to know 
the metaclass to know this. And it looks like the metaclass can definitely be a 
C type (and thus have a C struct defining an instance). A presumably the 
metaclass could be a variable size C type (i.e. like tuple), so possibly not 
even known until the instance is made.
David
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/Y4DXOFP6CFX3GKPLFP5MYTOEESRSBW7O/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to