[Python-3000] C API for ints and strings (original) (raw)
Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sun Sep 9 15:12:23 CEST 2007
- Previous message: [Python-3000] C API for ints and strings
- Next message: [Python-3000] C API for ints and strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Since PyString_Format is deprecated, is there a better way to convert a Python3 int which doesn't fit in a C long to a hex representation in a C string, than PyUnicode_Format and iterating over characters, casting them from Unicode to bytes?
I actually need to convert it to mpz_t, which is best done via text in a C string in a base which is a power of 2. Since PyUnicode_Format for Python3 int creates a byte string first, it's quite silly to let a byte string be converted to a Unicode string and then back.
-- _("< Marcin Kowalczyk _/ qrczak at knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/
- Previous message: [Python-3000] C API for ints and strings
- Next message: [Python-3000] C API for ints and strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]