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.

Author vstinner
Recipients ethan.furman, python-dev, serhiy.storchaka, vstinner
Date 2015-04-03.08:48:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> b'%c' is still raising a TypeError.  The error message is fine ("%c requires an integer in range(256) or a single byte") but it should be an OverflowError for backwards compatibility.

I don't understand why you care so much on the exact exception. It doesn't look right to me to rely on the *exact* exception raised by "%c" % arg. It's an obvious bug in the application.

Sometimes, you may want to be extra safe and catch exception while formating a message. The logging module does this. But the logging doesn't care of the exact exception, it uses a generic "except Except:" in StreamHandler.emit():

    def emit(self, record):
            msg = self.format(record)
            stream =
        except Exception:

IMO b"%c" % int must raise ValueError, not OverflowError, if the value is not in the range 0..255.
Date User Action Args
2015-04-03 08:48:40vstinnersetrecipients: + vstinner, ethan.furman, python-dev, serhiy.storchaka
2015-04-03 08:48:40vstinnersetmessageid: <>
2015-04-03 08:48:40vstinnerlinkissue23466 messages
2015-04-03 08:48:40vstinnercreate