[Patches] [ python-Patches-1591996 ] `in` for classic object causes segfault

SourceForge.net noreply at sourceforge.net
Wed Nov 8 07:28:11 CET 2006


Patches item #1591996, was opened at 2006-11-07 05:32
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1591996&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 6
Private: No
Submitted By: Hirokazu Yamamoto (ocean-city)
Assigned to: Martin v. Löwis (loewis)
Summary: `in` for classic object causes segfault

Initial Comment:
This code causes segfault.

class Foo: pass
foo = Foo()
1 in foo

E:\python-dev>py a.py
Exception exceptions.TypeError: "argument of type
'instance' is not iterable" in
 'garbage collection' ignored
Fatal Python error: unexpected exception during garbage
collection

This bug seems to be introduced by revision 45644
change for Objects/classobject.c
# -1 (error) is converted to 0 (False)

I think this can be fixed by attached patch. Thank you.

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-11-07 22:28

Message:
Logged In: YES 
user_id=33168

I fixed the problem slightly differently without casting,
but rather checking the result.  The patch also contains a
test case.

----------------------------------------------------------------------

Comment By: Georg Brandl (gbrandl)
Date: 2006-11-07 07:39

Message:
Logged In: YES 
user_id=849994

Attaching to Martin since the mentioned revision is his.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1591996&group_id=5470


More information about the Patches mailing list