[Python-Dev] Convert int() to size_t in Python/C
Marcos Dione
mdione at grulic.org.ar
Fri Apr 29 10:45:04 EDT 2016
More information about the Python-Dev mailing list
Fri Apr 29 10:45:04 EDT 2016
- Previous message (by thread): [Python-Dev] Problemas con modulos
- Next message (by thread): [Python-Dev] Convert int() to size_t in Python/C
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
First of all, I'm not subbscribed to the list (too much traffic for
me), so please CC: me in any answers if possible.
I'm trying to add a new syscall to the os module:
https://bugs.python.org/issue26826
One of the few missing parts is to cenvert a parameter, which would
be a Python int object using PyArg_ParseTupleAndKeywords() to a size_t
variable. For something similar, the 'n' format exists, but that one
converts to Py_ssize_t (which is ssize_t, really), but that one is
signed.
One possible solution hat was suggested to me in the #python IRC
channel was to use that, then test if the resulting value is negative,
and adjust accordingly, but I wonder if there is a cleaner, more general
solution (for instance, what if the type was something else, like loff_t,
although for that one in particular there *is* a convertion
function/macro).
--
(Not so) Random fortune:
Premature optimization is the root of all evil.
-- Donald Knuth
- Previous message (by thread): [Python-Dev] Problemas con modulos
- Next message (by thread): [Python-Dev] Convert int() to size_t in Python/C
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list