On Mon, Jun 1, 2009 at 11:58 PM, David Cournapeau < [email protected]> wrote:
> Charles R Harris wrote: > > > > > > On Mon, Jun 1, 2009 at 11:08 PM, David Cournapeau > > <[email protected] <mailto:[email protected]>> > > wrote: > > > > Hi, > > > > I have a question related to #1121 > > (http://projects.scipy.org/numpy/ticket/1121). With python 2.6, > > PyInt_Check(a) if a is an instance of numpy.int32 does not work > > anymore. > > It think this is related to the python issue 2263 > > > > > > (http://bugs.python.org/issue2263), where the tp_flags has been > > changed > > for the python int object, change which influences PyInt_Check > > behavior. > > > > > > It would be nice if the python folks would document > > Py_TPFLAGS_INT_SUBCLASS so we knew what it did. I also wonder if the > > problem with struct and the related bug with timeseries aren't python > > bugs. Shouldn't python be checking for conversion calls rather than an > > integer subclass? > > I found this while walking through the python hg log: > > http://www.mail-archive.com/[email protected]/msg18140.html > Hmm, makes me think even more that the python code is the buggy one here. Why should it depend on inheritance from the int type? I mean, isn't that kind of limiting? All they need to know is that it can be *converted* to a python integer. It's like duck typing is being replaced by strict typing. Because it's faster to interpret (duh). Of course, I may have no idea what I'm talking about. > > As I understand it, that's basically an optimization for fast subclass > testing, and is indeed not documented. But instead of hard-coding the > additional flag for types which support this in numpy, I think it would > be better to have something which will not break again when another flag > is added to some types. There speaks the build guy ;) > Specially since related bugs are quite hard to > track. I don't know how to do it, though, as the python doc says that > inheriting tp_flags is tricky... > Chuck
_______________________________________________ Numpy-discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
