[ python-Bugs-980352 ] coercion results used dangerously
SourceForge.net
noreply at sourceforge.net
Sat Jun 26 13:26:18 EDT 2004
Bugs item #980352, was opened at 2004-06-26 17:26
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=980352&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Armin Rigo (arigo)
Assigned to: Nobody/Anonymous (nobody)
Summary: coercion results used dangerously
Initial Comment:
The C core uses the result of PyNumber_CoerceEx() dangerously: it gets passed to tp_compare, and most tp_compare slots assume they get two objects of the same type. This assumption is never checked, even when a user-defined __coerce__() is called:
>>> class X(object):
... def __coerce__(self, other):
... return 4, other
...
>>> slice(1,2,3) == X()
Segmentation fault
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=980352&group_id=5470
More information about the Python-bugs-list
mailing list