[issue21071] struct.Struct.format is bytes, but should be str

Martin Panter added the comment: Hi Victor, I’m not sure about changing the data type. As Python 3 grows older, there is potentially more code being written that you break by fixing a bug like this. It is incompatible if you used to write
print(struct.Struct('hi').format.decode()) hi
I have used this decode() trick in the past to build composite format strings; e.g.: <https://bugs.python.org/issue16349#msg174083>. If you change the data type this code will raise AttributeError. At a minimum you should acknowledge it in the “porting” section of What’s New. Also, if you make this change, maybe update the module doc string. See the end of format-str.patch. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue21071> _______________________________________

STINNER Victor added the comment: Ok, I opened a thread on python-dev: https://mail.python.org/pipermail/python-dev/2017-March/147688.html Martin: "At a minimum you should acknowledge it in the “porting” section of What’s New." I wasn't sure if the change was worth it to be mentionned in What's New in Python 3.7. Ok, will do for the next round (I'm now waiting for more feedback on my python-dev thread and this issue.) ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue21071> _______________________________________
participants (2)
-
Martin Panter
-
STINNER Victor