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 Arfrever, dholth, jwilk, martin.panter, pitrou, r.david.murray, serhiy.storchaka, vstinner
Date 2016-05-27.13:02:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464354122.15.0.884180309304.issue18373@psf.upfronthosting.co.za>
In-reply-to
Content
strbytes.patch of #27134: adding calls to PyThreadState_GetDict()+PyDict_GetItemString() seems inefficient for a rare use case

I would prefer to modify the existing Py_BytesWarningFlag flag.

The flag is process-wide. If it's an issue, we can use a thread-local storage (TLS) for the flag in C.

FYI get_exec_path() uses the following code to temporarely ignore the warning:

    # {b'PATH': ...}.get('PATH') and {'PATH': ...}.get(b'PATH') emit a
    # BytesWarning when using python -b or python -bb: ignore the warning
    with warnings.catch_warnings():
        warnings.simplefilter("ignore", BytesWarning)
        ...
History
Date User Action Args
2016-05-27 13:02:02vstinnersetrecipients: + vstinner, pitrou, jwilk, Arfrever, r.david.murray, dholth, martin.panter, serhiy.storchaka
2016-05-27 13:02:02vstinnersetmessageid: <1464354122.15.0.884180309304.issue18373@psf.upfronthosting.co.za>
2016-05-27 13:02:02vstinnerlinkissue18373 messages
2016-05-27 13:02:01vstinnercreate