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 lemburg
Recipients lemburg, ncoghlan
Date 2016-10-10.07:17:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1476083854.55.0.140774997651.issue28403@psf.upfronthosting.co.za>
In-reply-to
Content
Nick, I think you've missed the "undefined" encoding that we've had for this ever since Unicode was added to Python.

You put the needed code into your sitecustomize.py file and Python2 will then behave just like Python3, i.e. raise an exception instead of coercing to Unicode:

sitecustomize.py:
import sys
sys.setdefaultencoding('undefined')

There's no need to hack this into site.py or to make sys.setdefaultencoding() available outside sitecustomize.py.

If you want an OS environ switch, you can put the necessary logic into sitecustomize.py as well.
History
Date User Action Args
2016-10-10 07:17:34lemburgsetrecipients: + lemburg, ncoghlan
2016-10-10 07:17:34lemburgsetmessageid: <1476083854.55.0.140774997651.issue28403@psf.upfronthosting.co.za>
2016-10-10 07:17:34lemburglinkissue28403 messages
2016-10-10 07:17:34lemburgcreate