New submission from Daniel Holth:

This patch lets the user get/set the byteswarningflag() to control whether 
warnings are emitted at runtime (pursuant to the configuration of the warnings 
module, of course).

The idea is that a user who is concerned with interacting with bytes correctly 
would use a context manager to set str(bytes) to raise exceptions during a 
critical serialization.

TODO the hypothetical context manager would also have to push/pop the warnings 
state to work correctly. Maybe str(bytes) can raise a regular exception if 
byteswarningflag() is high enough?

TODO don't know if this plays nicely when there are no threads

----------
files: byteswarningflag.patch
keywords: patch
messages: 192372
nosy: dholth
priority: normal
severity: normal
status: open
title: implement sys.get/setbyteswarningflag()
versions: Python 3.4
Added file: http://bugs.python.org/file30787/byteswarningflag.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18373>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to