PyThreadState_Swap difference in 2.3.2?

Paul Miller paul at fxtech.com
Tue Dec 16 11:15:39 EST 2003


>> 	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

>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.

I am using GenericGetAttr() so my tp_getset list will work. This used to
work in 2.2. 

>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.

Nope, that didn't help. Since I am using new-style types, I had to have
most of those flags set anyway. 

It seems to me that GenericGetAttr() should not assume mro to be
initialized. I haven't come across any sample custom types that initialize
it, and for whatever reason, it is not getting set up automatically.






More information about the Python-list mailing list