While dealing with my pragma code I encountered this issue which I want 
to note down (I need to know how to deal with it for pragmas):

cimport python_int as a
a.PyInt_Check(3)
cimport python_dict as a
a.PyInt_Check(3)
a.PyDict_New()

Apparently, only the first cimport is considered, so that PyDict_New is 
turned into a module dict lookup and PyInt_Check is a native C call also 
the second time. If the order of the cimports are reversed, the opposite 
happen.

It wouldn't take long to raise a compiler error on the second cimport as 
a fix for now ("name a already taken by a cimport"), but since it would 
break backwards compatability to some degree (of already broken code, I 
suppose) I wanted to check with you first.

Long term I suppose having the second PyInt_Check above turn into a 
dictionary lookup above is the wanted behaviour, but given that we give 
a compiler error now then such behaviour will be backwards compatible.

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to