> Perhaps it would be useful to provide generic support for integer types
> that might have different widths on different platforms?  e.g.:
> 
> uid_t uid = PyNumber_AS_INT_BY_SIZE(number_ob, uid_t);
> 
> That way, the core does not need to know about every blah_t type used by
> POSIX and extension modules, while offering convenient conversion
> functions nonetheless.

I don't think that this would be that useful. What might help is support
for parsing arbitrary-sized integers in PyArg_ParseTuple, as this should
typically be the path through which you get the valud into the (say) uid
variable.

However, it's still then fairly tricky: is uid_t a signed type or an
unsigned type; if unsigned, can I still have negative values (which, for
uid_t, I often can), does the platform have uid_t in the first place,
and, if not, what other type should I use? and so on.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to