[issue18373] implement sys.get/setbyteswarningflag()

2016-05-27 Thread Daniel Holth
Changes by Daniel Holth : Removed file: http://bugs.python.org/file30787/byteswarningflag.patch ___ Python tracker ___

[issue18373] implement sys.get/setbyteswarningflag()

2016-05-26 Thread Daniel Holth
Daniel Holth added the comment: Superceded by http://bugs.python.org/issue27134 , a simpler solution providing a with StrBytesRaises(): context manager. -- ___ Python tracker

[issue18373] implement sys.get/setbyteswarningflag()

2014-12-12 Thread Martin Panter
Changes by Martin Panter vadmium...@gmail.com: -- nosy: +vadmium ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18373 ___ ___ Python-bugs-list

[issue18373] implement sys.get/setbyteswarningflag()

2014-06-02 Thread Daniel Holth
Daniel Holth added the comment: As an aside, why wouldn't I run my program with -bb? One reason is that the following code won't work on Linux: #!/usr/bin/env python -bb Instead of passing -bb to Python, it will look for an executable called python -bb, and it's not likely to find it. The

[issue18373] implement sys.get/setbyteswarningflag()

2014-01-15 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18373 ___

[issue18373] implement sys.get/setbyteswarningflag()

2014-01-15 Thread Jakub Wilk
Changes by Jakub Wilk jw...@jwilk.net: -- nosy: +jwilk ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18373 ___ ___ Python-bugs-list mailing list

[issue18373] implement sys.get/setbyteswarningflag()

2014-01-14 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- components: +Interpreter Core stage: - patch review type: - enhancement versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18373

[issue18373] implement sys.get/setbyteswarningflag()

2014-01-14 Thread Daniel Holth
Daniel Holth added the comment: Just mitigating the bug that -bb is not the default... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18373 ___

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Antoine Pitrou
Antoine Pitrou added the comment: if (perhaps someone is calling your library and passing it the wrong type) they would be guarded against this common error. OTOH, if your library is concerned about unwanted bytes objects, you can add an explicit type check. That said, I don't see any

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't know why your patch is putting this in the thread state, though... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18373 ___

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Daniel Holth
Daniel Holth added the comment: On Thu, Jul 18, 2013, at 04:22 AM, Antoine Pitrou wrote: Antoine Pitrou added the comment: I don't know why your patch is putting this in the thread state, though... If you have multiple threads one thread might want exceptions when str(bytes), and the

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't know why your patch is putting this in the thread state, though... If you have multiple threads one thread might want exceptions when str(bytes), and the other might not. That sounds too much of a special case to me. You can still catch

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread R. David Murray
R. David Murray added the comment: I presume you mean you are motivated to turn it on (to catch the bugs). I still think that also fixing the bugs in the other places str(bytes) is used would be better. Are they occurring in third party libraries? How often do you run into it? --

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread Daniel Holth
Daniel Holth added the comment: Python 3 is supposed to make it easier to do Unicode correctly. str(bytes) does not. I felt strongly enough about that to write this patch. With this feature my library can have control in a way that is much more practical than ensuring a particular flag has

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-18 Thread STINNER Victor
STINNER Victor added the comment: Python 3 is supposed to make it easier to do Unicode correctly. str(bytes) does not. str(bytes) does not make sense, that's why an exception is raised when the -bb command line option is used ;-) -- ___ Python

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-12 Thread STINNER Victor
STINNER Victor added the comment: When I added os.environb, I had issues with the ByteWarning, in os.get_exec_path() if I remember correctly. I had to play with warmings.catch_warning(). A thread variable would simplify the code. -- nosy: +haypo

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Read only access to bytes warning flag already implemented as sys.flags.bytes_warning. How new functions are related to it? And I concur with David. Why not just run your program with -b or -bb? Besides the testing purpose. -- nosy:

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-06 Thread Daniel Holth
Daniel Holth added the comment: You would just enable this during your serialization code, and if (perhaps someone is calling your library and passing it the wrong type) they would be guarded against this common error. On Sat, Jul 6, 2013, at 12:15 AM, R. David Murray wrote: R. David Murray

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-05 Thread Daniel Holth
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

[issue18373] implement sys.get/setbyteswarningflag()

2013-07-05 Thread R. David Murray
R. David Murray added the comment: Why wouldn't you just enable bytes warning and fix all the code to work correctly? -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18373