[Python-Dev] How to spell PyInstance_NewRaw in py3k?

Antoine Pitrou solipsis at pitrou.net
Thu Jul 15 12:29:12 CEST 2010


On Wed, 14 Jul 2010 19:24:28 -0400
Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote:
> I am reposting the same question again because it seems to have gone
> unnoticed.  Antoine Pitrou and I had a brief discussion on the
> tracker, but did not reach an agreement on whether a more elaborate
> code is needed to replace PyInstance_NewRaw than a simple
> type->tp_alloc() call.
> 
> I have reviewed the patch again and I am convinced that this issue
> comes into play only when 3.x loads 2.x pickles that contain instances
> of classic classes.   (Specifically, this code is used to process INST
> and OBJ pickle opcodes that are not produced by 3.x.)  This means that
> Antoine's concern that "tomorrow [object_new()] may entail additional
> operations" is not valid  - there is no tomorrow for 2.x. :-)

But there *is* a tomorrow in 3.x and that's what we are talking about.
Your code is meant to emulate object_new() in 3.x.

> This
> also means that the type cannot inherit from anything other than
> object and thus cannot have funny tp_flags or tp_alloc that does not
> create a usable object.

Why can't it inherit from something else than object?





More information about the Python-Dev mailing list