[New-bugs-announce] [issue34810] Maximum and minimum value of C types integers from Python

Sébastien Celles report at bugs.python.org
Wed Sep 26 10:32:06 EDT 2018


New submission from Sébastien Celles <s.celles at gmail.com>:

Hello,

I'm looking for a way to get (using Python) the maximum and minimum values of C types integers (ie  uint8, int8, uint16, int16, uint32, int32, uint64, int64...) from Python.

I asked this question on StackOverflow and get a nice answer https://stackoverflow.com/questions/52475749/maximum-and-minimum-value-of-c-types-integers-from-python

but I wonder if this kind of feature couldn't be add directly in `ctypes.c_` as property.

Maybe we could have the following properties:
- `issigned`
- `max`
- `min`

Moreover being able to convert a number into a C type integer raising exception when input data is out of range could also be considered
Maybe using code like https://pastebin.com/cvm95m1x
(instead of silently overflow)

Kind regards

----------
messages: 326467
nosy: scls
priority: normal
severity: normal
status: open
title: Maximum and minimum value of C types integers from Python

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34810>
_______________________________________


More information about the New-bugs-announce mailing list