PyThreadState_Swap difference in 2.3.2?

Mark Hammond mhammond at skippinet.com.au
Mon Dec 15 19:16:54 EST 2003


Paul Miller wrote:

>>The same thing stumped me too a couple of days ago (s.
>>http://groups.google.nl/groups?q=PyNew_Interpreter&hl=nl&lr=&ie=UTF-8&oe=UTF-8&selm=braiu1%243r3%241%40news4.tilbu1.nb.home.nl&rnum=1 )
>>with 2.3.3c1 (same applies 2.4a0 for that matter).
> 
> 
> Interesting. Unfortunately, there isn't a whole lot of information out
> there on what we're trying to do.
> 
> I went ahead and commented out that check, but then I came across another
> problem. In object.c, it hit an assertion:
> 
> 	assert(mro != NULL);
> 
> This was for a custom Python type I had created in C. It was assuming this
> mro field was initialized, which it wasn't. It must be something new,
> because this all used to work in 2.2
> 
> I will have to keep looking at the release notes.
> 
> I wish there was a "upgrading from 2.2 to 2.3" document for people who are
> writing custom Python extensions, and doing embedding and such.

This assertion appears in PyObject_GenericGetAttr().  What was the 
attribute being requested?  I'm guessing your extension type is doing 
something funky, as otherwise PyObject_GenericGetAttr() would not be called.

Almost all of my types upgraded without any pain.  A few of the win32com 
ones did require work to work with tp_iter, but that is only as these 
types are themselves doing funky things.

I *think* that having tp_flags as zero works OK, but as soon as you use 
Py_TPFLAGS_DEFAULT, you are expected to initialize your type 
differently.  Sorry, but I can recall any more details.

Mark.





More information about the Python-list mailing list