[New-bugs-announce] [issue18373] implement sys.get/setbyteswarningflag()

Daniel Holth report at bugs.python.org
Sat Jul 6 00:58:44 CEST 2013


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 <report at bugs.python.org>
<http://bugs.python.org/issue18373>
_______________________________________


More information about the New-bugs-announce mailing list