[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread miss-islington


miss-islington  added the comment:


New changeset 13c89f3c876363c44d35ec5f8dc374aecbca62a1 by Miss Islington (bot) 
in branch '3.7':
bpo-37571: Remove extra space in ctypes docs (GH14764)
https://github.com/python/cpython/commit/13c89f3c876363c44d35ec5f8dc374aecbca62a1


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread miss-islington


miss-islington  added the comment:


New changeset 4f733f48b48735231b79cd0f6605d3d0a2d5b511 by Miss Islington (bot) 
in branch '3.8':
bpo-37571: Remove extra space in ctypes docs (GH14764)
https://github.com/python/cpython/commit/4f733f48b48735231b79cd0f6605d3d0a2d5b511


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread Steve Dower


Steve Dower  added the comment:

Thanks for the patch!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread Steve Dower


Steve Dower  added the comment:


New changeset 68c74d05c1fdaf59d8711431884af975ac2ac5f8 by Steve Dower in branch 
'master':
bpo-37571: Remove extra space in ctypes docs (GH14764)
https://github.com/python/cpython/commit/68c74d05c1fdaf59d8711431884af975ac2ac5f8


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14562
pull_request: https://github.com/python/cpython/pull/14767

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14561
pull_request: https://github.com/python/cpython/pull/14766

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread miss-islington


miss-islington  added the comment:


New changeset d7caf75c73626d7df4c0628c63761738b7063463 by Miss Islington (bot) 
in branch '3.7':
bpo-37571: Add 'b' to prevent the TypeError exception. (GH-14721)
https://github.com/python/cpython/commit/d7caf75c73626d7df4c0628c63761738b7063463


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread miss-islington


miss-islington  added the comment:


New changeset e7c114df38eaef0cec3457f55835a2276eccbff6 by Miss Islington (bot) 
in branch '3.8':
bpo-37571: Add 'b' to prevent the TypeError exception. (GH-14721)
https://github.com/python/cpython/commit/e7c114df38eaef0cec3457f55835a2276eccbff6


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +14559
pull_request: https://github.com/python/cpython/pull/14764

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14558
pull_request: https://github.com/python/cpython/pull/14763

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14557
pull_request: https://github.com/python/cpython/pull/14762

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-14 Thread Steve Dower


Steve Dower  added the comment:


New changeset 6b929580eb018cfef386db7f7f66b3a58532eada by Steve Dower (Michele 
Angrisano) in branch 'master':
bpo-37571: Add 'b' to prevent the TypeError exception. (GH-14721)
https://github.com/python/cpython/commit/6b929580eb018cfef386db7f7f66b3a58532eada


--
nosy: +steve.dower

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-12 Thread Michele Angrisano


Change by Michele Angrisano :


--
keywords: +patch
pull_requests: +14518
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14721

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-12 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. Looks like a valid issue to me. Would you like to create 
a PR?

--
components: +ctypes
nosy: +amaury.forgeotdarc, belopolsky, meador.inge, xtreak
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue37571] Incorrect use of c_char_p in example code

2019-07-12 Thread Reuben Thomas


New submission from Reuben Thomas :

The CTypes documentation has this example:

>>> s = c_char_p()
>>> s.value = "abc def ghi"
>>> s.value
'abc def ghi'
>>> s.value is s.value
False
>>>

It appears not to have been updated since Python 2: in Python 3, you can't 
assign a str to a c_char_p. If one tries the example code above, one gets:

>>> s = c_char_p()
>>> s.value = "abc def ghi"
Traceback (most recent call last):
  File "", line 1, in 
TypeError: bytes or integer address expected instead of str instance

Using a bytes works:

>>> s = c_char_p()
>>> s.value = b"abc def ghi"
>>> s.value
b'abc def ghi'
>>> s.value is s.value
False
>>>

Hence adding the two "b"s is an obvious fix.

Note that the similar example with c_wchar_p does work fine with str.

--
assignee: docs@python
components: Documentation
messages: 347725
nosy: docs@python, rrt
priority: normal
severity: normal
status: open
title: Incorrect use of c_char_p in example code
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com