[Python-bugs-list] [ python-Bugs-615506 ] No __mod__ on str subclass

noreply@sourceforge.net noreply@sourceforge.net
Sun, 17 Nov 2002 12:34:00 -0800


Bugs item #615506, was opened at 2002-09-27 10:35
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=615506&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
>Resolution: Accepted
Priority: 5
Submitted By: Neil Schemenauer (nascheme)
>Assigned to: Neil Schemenauer (nascheme)
Summary: No __mod__ on str subclass

Initial Comment:
PyNumber_Remainder does not use __mod__ on str and unicode
subclasses.  I guess the fix would be to check for
nb_remainder first
and then fallback to PyString_Format or PyUnicode_Format.

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-11-17 15:34

Message:
Logged In: YES 
user_id=6380

Looks good to me.

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

Comment By: Neil Schemenauer (nascheme)
Date: 2002-11-17 13:35

Message:
Logged In: YES 
user_id=35752

The attached  patch adds __mod__ to the 'str' and 'unicode'
types.  The side effect of this is that PyNumber_Check returns
true for these types.  This is not a huge loss since
PyNumber_Check is already pretty useless.  selectmodule.c
was affected by this and was fixed by improving the error
message returned by PyFloat_AsDouble (matching what
PyInt_AsLong does) and using it to convert the timeout
argument to a float.


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

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