Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20195

why does subtype_dict() and getset_get() makes infinite loop ?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <umedoblock@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'debug': 0.03; 'infinite': 0.07; 'python': 0.08; 'dict': 0.09; 'loop.': 0.09; '*result': 0.16; '[gcc': 0.16; 'core.': 0.16; 'linux2': 0.16; 'pyobject': 0.16; 'received:192.168.11': 0.16; 'subject:() ': 0.16; 'extension': 0.17; '>>>': 0.18; 'jan': 0.19; '(which': 0.19; 'checked': 0.21; 'wrote': 0.21; 'received:209.85.210.174': 0.21; 'received:mail-iy0-f174.google.com': 0.21; 'stack': 0.24; 'static': 0.24; 'subject: ?': 0.24; 'suspect': 0.24; 'code.': 0.26; 'skip:_ 20': 0.26; "i'm": 0.28; 'pass': 0.29; 'class': 0.29; 'skip:b 20': 0.29; 'null;': 0.30; 'skip:b 30': 0.31; 'message- id:@gmail.com': 0.31; 'header:User-Agent:1': 0.33; 'hi,': 0.34; 'to:addr:python-list': 0.35; 'everyone.': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:192': 0.38; 'skip:o 20': 0.38; 'received:209': 0.39; 'cannot': 0.39; 'point': 0.40; 'to:addr:python.org': 0.40; 'below': 0.62; 'show': 0.66; 'charset:iso-2022-jp': 0.74; '2012,': 0.84; 'content-type:application/zip': 0.84; 'filename:fname piece:zip': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=qmVbzLeojyIrbw61b3VKFxbvnSLKlpavOXAimGucoDg=; b=rwjGldUizZ2TKOW0kg8Ci5PugiGG17znW27HT2m5bZ00iisLQJZueTxIC8AqPrpyg7 5uLc8okT8JNWcttvGLhgqu6ceCZvn2lDqQOGKbgupVa3qOIqcybBwtcVEGX143Izs7mQ 5G7NzwbAM6LRF7oZhMJ4h9pNOriJ6pLuVWZTM=
Date Sat, 11 Feb 2012 07:06:22 +0900
From umedoblock <umedoblock@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111229 Thunderbird/9.0
MIME-Version 1.0
To python-list@python.org
Subject why does subtype_dict() and getset_get() makes infinite loop ?
Content-Type multipart/mixed; boundary="------------050800090401050400080004"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5682.1328911614.27778.python-list@python.org> (permalink)
Lines 142
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328911614 news.xs4all.nl 6937 [2001:888:2000:d::a6]:58084
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20195

Show key headers only | View raw


[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


Thread

why does subtype_dict() and getset_get() makes infinite loop ? umedoblock <umedoblock@gmail.com> - 2012-02-11 07:06 +0900

csiph-web