Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20195
| Date | 2012-02-11 07:06 +0900 |
|---|---|
| From | umedoblock <umedoblock@gmail.com> |
| Subject | why does subtype_dict() and getset_get() makes infinite loop ? |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5682.1328911614.27778.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Hi, everyone.
I'm umedoblock.
now, I wrote a below sentence.
But I cannot debug below infinite loop.
Do I mistake when I write a c exetension ?
I attached sample code.
Please help me.
==========================================
Python 3.2.2 (default, Jan 27 2012, 03:19:53)
[GCC 4.6.1] on linux2
class Bar_abstract(metaclass=ABCMeta):
pass
# c extension
# class Bar_base(Bar_abstract):
# pass
class Bar(Bar_base):
pass
==========================================
but do this
bar = Bar()
dir(bar)
then python3.2.2 generates a core.
Because subtype_dict() and getset_get() makes infinite loop.
I checked stack with GDB.
==================================================================
#130948 0x0817670a in getset_get (descr=0xb73ae034, obj=0xb73e7e44,
type=0x88ba4cc) at ../Objects/descrobject.c:148
#130949 0x080719f5 in subtype_dict (obj=0xb73e7e44, context=0x0)
at ../Objects/typeobject.c:1756
#130950 0x0817670a in getset_get (descr=0xb73ae034, obj=0xb73e7e44,
type=0x88ba4cc) at ../Objects/descrobject.c:148
#130951 0x080719f5 in subtype_dict (obj=0xb73e7e44, context=0x0)
at ../Objects/typeobject.c:1756
#130952 0x0817670a in getset_get (descr=0xb73ae034, obj=0xb73e7e44,
type=0x88ba4cc) at ../Objects/descrobject.c:148
#130953 0x080719f5 in subtype_dict (obj=0xb73e7e44, context=0x0)
at ../Objects/typeobject.c:1756
==================================================================
GDB show me above code.
Now, I suspect below point PyObject_GetAttrString().
But I cannot debug this infinite loop.
Do I mistake when I write a c exetension ?
I attached sample code.
Please help me.
ojects/object.c:1325
static PyObject *
_generic_dir(PyObject *obj)
{
PyObject *result = NULL;
PyObject *dict = NULL;
PyObject *itsclass = NULL;
/* Get __dict__ (which may or may not be a real dict...) */
>>> dict = PyObject_GetAttrString(obj, "__dict__");
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
why does subtype_dict() and getset_get() makes infinite loop ? umedoblock <umedoblock@gmail.com> - 2012-02-11 07:06 +0900
csiph-web