This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author LambertDW
Recipients LambertDW
Date 2015-08-04.20:22:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438719738.53.0.780685651956.issue24789@psf.upfronthosting.co.za>
In-reply-to
Content
doc string suggests str is a valid init argument.  The code strongly discourages this.

ctypes.create_string_buffer

def create_string_buffer(init, size=None):
    """create_string_buffer(aBytes) -> character array
    create_string_buffer(anInteger) -> character array
    create_string_buffer(aString, anInteger) -> character array
    """
    if isinstance(init, bytes):
        if size is None:
            size = len(init)+1
        buftype = c_char * size
        buf = buftype()
        buf.value = init
        return buf
    elif isinstance(init, int):
        buftype = c_char * init
        buf = buftype()
        return buf
    raise TypeError(init)
History
Date User Action Args
2015-08-04 20:22:18LambertDWsetrecipients: + LambertDW
2015-08-04 20:22:18LambertDWsetmessageid: <1438719738.53.0.780685651956.issue24789@psf.upfronthosting.co.za>
2015-08-04 20:22:18LambertDWlinkissue24789 messages
2015-08-04 20:22:18LambertDWcreate