[Patches] [ python-Patches-1497053 ] Let dicts propagate the exceptions in user __eq__

SourceForge.net noreply at sourceforge.net
Mon May 29 18:54:43 CEST 2006


Patches item #1497053, was opened at 2006-05-29 16:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1497053&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: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Armin Rigo (arigo)
Assigned to: Nobody/Anonymous (nobody)
Summary: Let dicts propagate the exceptions in user __eq__

Initial Comment:
Patch for bug #1275608.

Exceptions occurring when the dict lookup code calls a
user-defined __eq__() are silently eaten.  This has
caused me several hours-long debugging session so far,
so I thought that it was time to fix that.

The proposed patch takes an easy route: it doesn't try
to change PyDict_GetItem(), which still has no way to
report exceptions and just eats them.  Instead, it moves
the exception-eating logic into PyDict_GetItem().  So 
all other ways in which dicts are accessed now correctly
report exceptions.  Most importantly, this includes all
operators and methods accessible from Python code,
including the 'x=d[key]' syntax.

The only incompatibility I could imagine from this would
be from code that relies on the fact that dicts were
previouly tolerant about exceptions: an __eq__ could
fail in any way, and the lookup would consider it as a
"not equal" signal and proceed.  I'd say "fix that". 
However it means that the 2.4 patch attached here should
probably not be applied, sadly.  I'd vote to check in
the 2.5 patch as soon as possible.

Note that these patches sneak in another bugfix patch
too (#1456209) because I couldn't be bothered to
maintain two mutually-conflicting patches.

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

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


More information about the Patches mailing list