adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Gentlemen, start your Windows!


From: Alexandre Courbot
Subject: Re: [Adonthell-devel] Gentlemen, start your Windows!
Date: 21 Apr 2002 14:52:44 +0200

I know a little more on what's wrong - not that everything is fixed, but
at least with the following patch
(http://www.gnurou.org/adonthell-stuff/wintest_patch.tgz) pytest should
now work (it works with WineX, at least - which is encouraging :))

Now on the problem: honnestly, it's weird. Open the new py_gfx_wrap.cc
and search for the "FIXED" strings. This is where I have made some
changes so it works - just replaced the commented line with the line
behind. There are two of them, one in SWIG_ConvertPtr and the other one
in the image::load_pnm wrapper function. They are both nulling
PyString_Check conditions, which both returned false while they are
supposed to succeed. Weirder even, assuming they succeed result in the
program working without any problem!

PyString_Check returns 0 if the passed Python object is not a Python
string, and a positive value otherwise. The two tests are failing, while
the objects are actually Python strings, otherwise the following code
(which heavily use Python string functions on them) would fail. You'll
notice that the fix in image_load_pnm is for the 2nd argument (which is
a string) to work. However it would fail too. There are certainly other
conditions like this one in the wrapper file, but as load_pnm is the
only function that requires a string argument I'm using, I only fixed
this one.

So, well, are they strings or not? I've inserted the following code
right before the failing test in SWIG_ConvertPtr:

      // obj is our string object that Python fails to recognize
      PyObject * tt = PyObject_Type(obj);
      if (!tt) printf("Type failed\n");
      else
      {
          PyObject * ttrepr = PyObject_Repr(tt);
          if (!ttrepr) printf("repr failed\n");
          else printf("repr: %s\n",PyString_AsString(ttrepr));
      }

I get the type of obj, and print it. This is where things are becoming
interesting.

Under WineX: repr: <type 'str'>
Under Linux: repr: <type 'string'>

So this is what I guess is wrong. Under WineX, the object is well a
Python string, but PyString_Check doesn't recognize it because it's type
name mismatch. Weird, eh? Now I really don't know why it is behaving
this way. Who should I deal that with? The Python team, or the SWIG one?

Kai, if you can, maybe it'd be worth to recompile it under native
mingw32, as you have a probably more coherent Python installation than I
have. You could then insert the above code in py_gfx_wrap.cc to check
the real string type.

In the meantime, I'll query my friend Google about this! :)

Alex.
-- 
http://www.gnurou.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]