[Python-Dev] How to spell PyInstance_NewRaw in py3k? (original) (raw)
Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Jul 15 16:12:34 CEST 2010
- Previous message: [Python-Dev] How to spell PyInstance_NewRaw in py3k?
- Next message: [Python-Dev] versioned .so files for Python 3.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Jul 15, 2010 at 6:29 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
On Wed, 14 Jul 2010 19:24:28 -0400 Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote: ..
This means that Antoine's concern that "tomorrow [objectnew()] 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 objectnew() in 3.x.
Yes, I realized that after I hit the sent button. However, it is 2.x classic instances that are being unpickled and it won't be reasonable for 3.x objects that are expected to emulate them to do anything non-trivial. The need to be able to faithfully emulate classic instances unpickled from 2.x may be a valid constraint to future object_new() evolution.
This also means that the type cannot inherit from anything other than object and thus cannot have funny tpflags or tpalloc that does not create a usable object. Why can't it inherit from something else than object?
Because this would not be a reasonable way to forward port 2.x classic classes and expect them to interoperate with 2.x pickles. There are many ways to break unpickling of old pickles by modifying the class in the new version of code. The serious question for me is whether a valid tp_alloc can create a partially initialized object that will crash the interpreter when its method is called. I don't think this is the case because certainly you need to be able to delete the object if tp_new fails and that can call arbitrary code.
- Previous message: [Python-Dev] How to spell PyInstance_NewRaw in py3k?
- Next message: [Python-Dev] versioned .so files for Python 3.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]