[Pyrex] Tiny bug with obj.__name__s
Paul Prescod
paul at prescod.net
Sat Jan 17 13:00:26 CET 2004
It's tiny but I thought I'd report it in case Greg wants to add it to
his list...
class foo:
pass
cdef class bar:
pass
print repr(foo)
print repr(bar)
When you import this module as "test" you get a print-out of:
<class __main__.foo at 0x4c1270>
<type 'test.bar'>
Here's the outline of a fix. Pyrex needs to generate a few more lines of
boilerplate before and after it calls PyClass_New.
PyObject *__pyx_mod_name = PyString_FromString("test");
PyDict_SetItemString(__pyx_1, "__module__", __pyx_mod_name);
__pyx_4 = PyClass_New(__pyx_3, __pyx_1, __pyx_2); if (!__pyx_4)
{__pyx_filenam
e = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
Py_DECREF(__pyx_mod_name); __pyx_mod_name = 0;
Paul Prescod
More information about the Pyrex
mailing list