PyNumber_Int screwing Object.

Discussion in 'Python' started by =?iso-8859-1?Q?Jos=E9_Rui_Faustino_de_Sousa?=, Oct 6, 2003.

  1. 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:/// Crawler baith. UnCaps me to reply.
    Contact information: http://homepage.esoterica.pt/~jrfsousa/contact.html
    ========================================================================
    =?iso-8859-1?Q?Jos=E9_Rui_Faustino_de_Sousa?=, Oct 6, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris

    Screwing up my HTML

    Chris, Oct 22, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    374
    Chris
    Nov 5, 2003
  2. Darrel
    Replies:
    0
    Views:
    968
    Darrel
    Dec 28, 2004
  3. Tim Peters

    RE: PyNumber_Int screwing Object.

    Tim Peters, Oct 6, 2003, in forum: Python
    Replies:
    2
    Views:
    313
    =?iso-8859-1?Q?Jos=E9_Rui_Faustino_de_Sousa?=
    Oct 6, 2003
  4. Tim Peters

    RE: PyNumber_Int screwing Object.

    Tim Peters, Oct 7, 2003, in forum: Python
    Replies:
    1
    Views:
    299
    Bengt Richter
    Oct 7, 2003
  5. Daniel Kramer

    string parsing screwing up on large files?

    Daniel Kramer, Dec 20, 2003, in forum: Python
    Replies:
    2
    Views:
    304
    Bengt Richter
    Dec 20, 2003
Loading...

Share This Page