Message311462
ctypes Structure fields of type c_char_p or c_wchar_p used to accept strings with embedded null characters. I noticed that Python 3.6.4 does refuse them. It seems this has been changed in recent version(s).
There ARE use-cases for this: The Windows-API OPENFILENAME structure is one example. The Microsoft docs for the lpstrFilter field:
"""
lpstrFilter
Type: LPCTSTR
A buffer containing pairs of null-terminated filter strings. The last string in the buffer must be terminated by two NULL characters.
"""
I have attached a simple script which demonstrates this new behaviour; the output with Python 3.6.4 is this:
Traceback (most recent call last):
File "nullchars.py", line 8, in <module>
t.unicode = u"foo\0bar"
ValueError: embedded null character |
|
Date |
User |
Action |
Args |
2018-02-01 19:54:50 | theller | set | recipients:
+ theller |
2018-02-01 19:54:50 | theller | set | messageid: <1517514890.15.0.467229070634.issue32745@psf.upfronthosting.co.za> |
2018-02-01 19:54:50 | theller | link | issue32745 messages |
2018-02-01 19:54:49 | theller | create | |
|