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 -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/Y4DXOFP6CFX3GKPLFP5MYTOEESRSBW7O/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to