New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:
The repr of the ctypes.CArgObject instance will fail when the value is a non-ascii character. The code is: sprintf(buffer, "<cparam '%c' (%c)>", self->tag, self->value.c); ... return PyUnicode_FromString(buffer); If self->value.c is out of range 0-127, buffer will contain a string not decodable with UTF-8. There is a similar problem with non-ascii self->tag. The following PR is purposed to fix this, but I don't know how to test it. Current tests only create CArgObject instances with tag='P' (in byref()). ---------- components: Extension Modules, ctypes messages: 330931 nosy: amaury.forgeotdarc, belopolsky, meador.inge, serhiy.storchaka priority: normal severity: normal status: open title: The repr of ctypes.CArgObject fails for non-ascii character type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35384> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com