Issue 32041: Cannot cast '\0' to c_void_p (original) (raw)

Issue32041

Created on 2017-11-15 21:01 by Ilya.Kulakov, last changed 2022-04-11 14:58 by admin.

Messages (3)
msg306307 - (view) Author: Ilya Kulakov (Ilya.Kulakov) * Date: 2017-11-15 21:01
Happens on 3.6.3 only: >>> import ctypes >>> ctypes.cast('\0', ctypes.c_void_p) ctypes.ArgumentError: argument 1: <class 'ValueError'>: embedded null character
msg306323 - (view) Author: Ilya Kulakov (Ilya.Kulakov) * Date: 2017-11-16 00:15
That's the change that introduced the bug: https://github.com/python/cpython/pull/2285
msg306325 - (view) Author: Ilya Kulakov (Ilya.Kulakov) * Date: 2017-11-16 01:38
I have fixed that problem by ensuring that ctypes-facing code passes bytes, not strings.
History
Date User Action Args
2022-04-11 14:58:54 admin set github: 76222
2017-11-16 01:38:43 Ilya.Kulakov set messages: +
2017-11-16 00:15:40 Ilya.Kulakov set messages: +
2017-11-15 21:01:06 Ilya.Kulakov create