PyNumber_Int screwing Object.

José Rui Faustino de Sousa jrfsousaAAXDQB at esoterica.pt
Sun Oct 5 21:14:55 EDT 2003


 Hi!

This code snippet is broken in the case that the argument passed is a
complex number

PyObject* tmp = Py_None;

tmp=PyNumber_Int(object);
tmp=PyObject_GetAttrString(object,"real");

it wreaks havoc on Python making it fail in weird ways.

If I insert the line between the other two

if(!tmp) PyErr_Clear();

things seem to work.

I have googled around and it does not seem to be a common practice...

Anyone can lend an hand?

Thank you very much.

Best regards
José Rui

P.S.- I include a more complete example.

-- 
========================================================================
"Every sentence I utter must be understood not as an affirmation, but as
a question." Niels Bohr
========================================================================
mailto://jrfsousaAAXDQB@esoterica.pt/ Crawler baith. UnCaps me to reply.
Contact information: http://homepage.esoterica.pt/~jrfsousa/contact.html
========================================================================
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: keywdarg.c
URL: <http://mail.python.org/pipermail/python-list/attachments/20031006/37736968/attachment.c>


More information about the Python-list mailing list