@@ -229,12 +229,24 @@ There are three ways strings and buffers can be converted to C:
229229Numbers
230230-------
231231
232+ These formats allow representing Python numbers or single characters as C numbers.
233+ Formats that require :class: `int `, :class: `float ` or :class: `complex ` can
234+ also use the corresponding special methods :meth: `~object.__index__ `,
235+ :meth: `~object.__float__ ` or :meth: `~object.__complex__ ` to convert
236+ the Python object to the required type.
237+
238+ For signed integer formats, :exc: `OverflowError ` is raised if the value
239+ is out of range for the C type.
240+ For unsigned integer formats, no range checking is done --- the
241+ most significant bits are silently truncated when the receiving field is too
242+ small to receive the value.
243+
232244``b `` (:class: `int `) [unsigned char]
233- Convert a nonnegative Python integer to an unsigned tiny int , stored in a C
245+ Convert a nonnegative Python integer to an unsigned tiny integer , stored in a C
234246 :c:expr: `unsigned char `.
235247
236248``B `` (:class: `int `) [unsigned char]
237- Convert a Python integer to a tiny int without overflow checking, stored in a C
249+ Convert a Python integer to a tiny integer without overflow checking, stored in a C
238250 :c:expr: `unsigned char `.
239251
240252``h `` (:class: `int `) [short int]
@@ -344,12 +356,6 @@ Other objects
344356 in *items *. The C arguments must correspond to the individual format units in
345357 *items *. Format units for sequences may be nested.
346358
347- It is possible to pass "long" integers (integers whose value exceeds the
348- platform's :c:macro: `LONG_MAX `) however no proper range checking is done --- the
349- most significant bits are silently truncated when the receiving field is too
350- small to receive the value (actually, the semantics are inherited from downcasts
351- in C --- your mileage may vary).
352-
353359A few other characters have a meaning in a format string. These may not occur
354360inside nested parentheses. They are:
355361
0 commit comments