mirror of
https://github.com/python/cpython.git
synced 2025-10-03 05:35:59 +00:00
bpo-37571: Add 'b' to prevent the TypeError exception. (GH-14721)
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
This commit is contained in:
parent
8efade91b1
commit
6b929580eb
1 changed files with 8 additions and 3 deletions
|
@ -1178,12 +1178,17 @@ the root-object's underlying buffer.
|
||||||
Another example that may behave different from what one would expect is this::
|
Another example that may behave different from what one would expect is this::
|
||||||
|
|
||||||
>>> s = c_char_p()
|
>>> s = c_char_p()
|
||||||
>>> s.value = "abc def ghi"
|
>>> s.value = b"abc def ghi"
|
||||||
>>> s.value
|
>>> s.value
|
||||||
'abc def ghi'
|
b'abc def ghi'
|
||||||
>>> s.value is s.value
|
>>> s.value is s.value
|
||||||
False
|
False
|
||||||
>>>
|
>>>
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Objects instantiated from :class:`c_char_p` can only have their value set to bytes
|
||||||
|
or integers.
|
||||||
|
|
||||||
Why is it printing ``False``? ctypes instances are objects containing a memory
|
Why is it printing ``False``? ctypes instances are objects containing a memory
|
||||||
block plus some :term:`descriptor`\s accessing the contents of the memory.
|
block plus some :term:`descriptor`\s accessing the contents of the memory.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue