[Patches] [ python-Patches-1538956 ] Replace unicode.__eq__ exceptions with a warning

SourceForge.net noreply at sourceforge.net
Sat Aug 12 12:50:11 CEST 2006


Patches item #1538956, was opened at 2006-08-11 21:09
Message generated for change (Comment added) made by arigo
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1538956&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: 9
Submitted By: M.-A. Lemburg (lemburg)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Replace unicode.__eq__ exceptions with a warning

Initial Comment:
The attached patch is a first version of the change
discussed on python-dev this and last week:

It replaces UnicodeDecodeErrors raised during == and !=
compares of Unicode and other objects with a new
UnicodeWarning.

All other comparisons continue to raise exceptions.
Exceptions other than UnicodeDecodeErrors are also left
untouched.

The documentation part of the patch is still
incomplete. Suggestions are welcome.

Due to the change to only the == and != comparison
operators, Unicode objects had to grow an
implementation for rich comparisons (which now replaces
the old tp_compare slot).

Tests all pass.

Aside:

During testing I found that the warning registry
defaults to only issueing warnings once per module and
line number. I suppose this is enough for debugging
code, but it feels weird when trying things in the
interactive session, as you only get the warnings once
in that context (and for the whole session), regardless
of the fact that you're entereing new lines of code all
the time.

Maybe something to change for Python 2.6.


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

>Comment By: Armin Rigo (arigo)
Date: 2006-08-12 10:50

Message:
Logged In: YES 
user_id=4771

Getting rid of the special case for unicodes in
default_3way_compare() - this alone would give the
whole patch a +1 from me :-)  Looks good to me.

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

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


More information about the Patches mailing list