This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: No __mod__ on str subclass
Type: Stage:
Components: Interpreter Core Versions:
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: nascheme Nosy List: gvanrossum, nascheme
Priority: normal Keywords:

Created on 2002-09-27 14:35 by nascheme, last changed 2022-04-10 16:05 by admin. This issue is now closed.

File name Uploaded Description Edit
str_mod.diff nascheme, 2002-11-17 18:35
Messages (3)
msg12520 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2002-09-27 14:35
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.
msg12521 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2002-11-17 18:35
Logged In: YES 

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.
msg12522 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-11-17 20:34
Logged In: YES 

Looks good to me.
Date User Action Args
2022-04-10 16:05:42adminsetgithub: 37231
2002-09-27 14:35:28naschemecreate