STINNER Victor added the comment: I created https://github.com/python/cpython/pull/845 to change struct.Struct.format type to str (Unicode).
struct.Struct() accepts bytes and str format strings, so it's not really a backward incompatible change. It's just a minor enhancement to help development: $ ./python Python 3.7.0a0 (heads/master-dirty:b8a7daf, Mar 27 2017, 13:02:20) >>> print(struct.Struct('hi').format) hi Without the patch: haypo@selma$ python3 Python 3.5.2 (default, Sep 14 2016, 11:28:32) [GCC 6.2.1 20160901 (Red Hat 6.2.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import struct >>> print(struct.Struct('hi').format) b'hi' haypo@selma$ python3 -bb Python 3.5.2 (default, Sep 14 2016, 11:28:32) >>> import struct >>> print(struct.Struct('hi').format) Traceback (most recent call last): ... BytesWarning: str() on a bytes instance ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21071> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com