[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pygame] I'm having problems with the pygame C api
Hi Everyone,
I'm having some problems with the pygame C api, which I'm using in my
pymousetrap module.
My code is getting a false value for PySurface_Check, though I can look at
the PyObject that I'm sending to PySurface_Check and it looks like a surface.
Here's the PyObject's ob_type field in gdb:
(gdb) p *source->ob_type
$2 = {ob_refcnt = 4, ob_type = 0x400b5520, ob_size = 0,
tp_name = 0x402272bc "Surface", tp_basicsize = 24, tp_itemsize = 0,
tp_dealloc = 0x4022647c <surface_dealloc>, tp_print = 0,
tp_getattr = 0x40226510 <surface_getattr>, tp_setattr = 0, tp_compare = 0,
tp_repr = 0x40226540 <surface_str>, tp_as_number = 0x0,
tp_as_sequence = 0x0, tp_as_mapping = 0x0, tp_hash = 0, tp_call = 0,
tp_str = 0, tp_getattro = 0, tp_setattro = 0, tp_as_buffer = 0x0,
tp_flags = 0,
tp_doc = 0x4022b5e0 "Surface objects represent a simple memory buffer of pixels.\nSurface objects can reside in system memory, or in special\nhardware memory, which can be hardware accelerated. Surfaces that\nare 8 bits per "...,
tp_traverse = 0, tp_clear = 0, tp_xxx7 = 0, tp_xxx8 = 0}
So, I decided to write the attached test program. Unfortunately, I get a
segfault when I try to use PySurface_New so I don't get far enough to
determine what's going on with PySurface_Check.
I'm really weak on macros, and the PySurface_* ones are beyond me at this
point so I am not sure what exactly is going on with them. Am I doing
something wrong?
Thank you,
-b
pysurftest.c.gz