Issue 615506: No mod on str subclass (original) (raw)

Issue615506

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.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/37231

classification

Title: No __mod__ on str subclass
Type: Stage:
Components: Interpreter Core Versions:

process

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.

Files
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 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.
msg12522 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-11-17 20:34
Logged In: YES user_id=6380 Looks good to me.
History
Date User Action Args
2022-04-10 16:05:42 admin set github: 37231
2002-09-27 14:35:28 nascheme create

Supported by The Python Software Foundation,
Powered by Roundup

Copyright © 1990-2022, Python Software Foundation
Legal Statements