[issue7569] ctypes doc improvement: c_char_p

2009-12-23 Thread Nikolaus Rath

New submission from Nikolaus Rath :

It would be great if the documentation of c_char_p
(http://docs.python.org/library/ctypes.html#ctypes.c_char_p) could be
reformulated as follows (would have saved me quite some time):

class ctypes.c_char_p¶
Represents the C char * datatype when it points a zero-terminated
string. For a general character pointer that may also point to binary
data, POINTER(c_char) must be used. The constructor accepts an integer
address, or a string.

--
assignee: georg.brandl
components: Documentation
messages: 96842
nosy: Nikratio, georg.brandl
severity: normal
status: open
title: ctypes doc improvement: c_char_p
type: feature request
versions: 3rd party, Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue7569] ctypes doc improvement: c_char_p

2009-12-24 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +theller
priority:  -> normal
versions:  -3rd party, Python 2.5

___
Python tracker 

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



[issue7569] ctypes doc improvement: c_char_p

2009-12-28 Thread Georg Brandl

Georg Brandl  added the comment:

Wouldn't a "general" pointer better be of type c_void_p?

--

___
Python tracker 

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



[issue7569] ctypes doc improvement: c_char_p

2009-12-28 Thread Nikolaus Rath

Nikolaus Rath  added the comment:

I don't want to judge if the best way to represent binary data in C is a
void* or char*, but there is a lot of C code out there that uses char*,
and if we want to interface with such a library we need to use
POINTER(c_char).

Note that my docpatch doesn't say anything about using void_p or not:
"For a general *character* pointer that may point to binary data,
POINTER(c_char) must be used". This refers only to char*, so if the C
code uses void* instead, we can of course also use c_void_p on the
Python side.

--

___
Python tracker 

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



[issue7569] ctypes doc improvement: c_char_p

2009-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The suggestion looks good to me.

--
nosy: +pitrou

___
Python tracker 

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



[issue7569] ctypes doc improvement: c_char_p

2009-12-29 Thread Georg Brandl

Georg Brandl  added the comment:

OK, applied in r77108.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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