@@ -197,44 +197,44 @@ platform-dependent.
197
197
+--------+--------------------------+--------------------+----------------+------------+
198
198
| ``c `` | :c:type: `char ` | bytes of length 1 | 1 | |
199
199
+--------+--------------------------+--------------------+----------------+------------+
200
- | ``b `` | :c:type: `signed char ` | integer | 1 | \( 1),\( 3) |
200
+ | ``b `` | :c:type: `signed char ` | integer | 1 | \( 1), \( 2) |
201
201
+--------+--------------------------+--------------------+----------------+------------+
202
- | ``B `` | :c:type: `unsigned char ` | integer | 1 | \( 3 ) |
202
+ | ``B `` | :c:type: `unsigned char ` | integer | 1 | \( 2 ) |
203
203
+--------+--------------------------+--------------------+----------------+------------+
204
204
| ``? `` | :c:type: `_Bool ` | bool | 1 | \( 1) |
205
205
+--------+--------------------------+--------------------+----------------+------------+
206
- | ``h `` | :c:type: `short ` | integer | 2 | \( 3 ) |
206
+ | ``h `` | :c:type: `short ` | integer | 2 | \( 2 ) |
207
207
+--------+--------------------------+--------------------+----------------+------------+
208
- | ``H `` | :c:type: `unsigned short ` | integer | 2 | \( 3 ) |
208
+ | ``H `` | :c:type: `unsigned short ` | integer | 2 | \( 2 ) |
209
209
+--------+--------------------------+--------------------+----------------+------------+
210
- | ``i `` | :c:type: `int ` | integer | 4 | \( 3 ) |
210
+ | ``i `` | :c:type: `int ` | integer | 4 | \( 2 ) |
211
211
+--------+--------------------------+--------------------+----------------+------------+
212
- | ``I `` | :c:type: `unsigned int ` | integer | 4 | \( 3 ) |
212
+ | ``I `` | :c:type: `unsigned int ` | integer | 4 | \( 2 ) |
213
213
+--------+--------------------------+--------------------+----------------+------------+
214
- | ``l `` | :c:type: `long ` | integer | 4 | \( 3 ) |
214
+ | ``l `` | :c:type: `long ` | integer | 4 | \( 2 ) |
215
215
+--------+--------------------------+--------------------+----------------+------------+
216
- | ``L `` | :c:type: `unsigned long ` | integer | 4 | \( 3 ) |
216
+ | ``L `` | :c:type: `unsigned long ` | integer | 4 | \( 2 ) |
217
217
+--------+--------------------------+--------------------+----------------+------------+
218
- | ``q `` | :c:type: `long long ` | integer | 8 | \( 2), \( 3) |
218
+ | ``q `` | :c:type: `long long ` | integer | 8 | \( 2) |
219
219
+--------+--------------------------+--------------------+----------------+------------+
220
- | ``Q `` | :c:type: `unsigned long | integer | 8 | \( 2), \( 3) |
220
+ | ``Q `` | :c:type: `unsigned long | integer | 8 | \( 2) |
221
221
| | long` | | | |
222
222
+--------+--------------------------+--------------------+----------------+------------+
223
- | ``n `` | :c:type: `ssize_t ` | integer | | \( 4 ) |
223
+ | ``n `` | :c:type: `ssize_t ` | integer | | \( 3 ) |
224
224
+--------+--------------------------+--------------------+----------------+------------+
225
- | ``N `` | :c:type: `size_t ` | integer | | \( 4 ) |
225
+ | ``N `` | :c:type: `size_t ` | integer | | \( 3 ) |
226
226
+--------+--------------------------+--------------------+----------------+------------+
227
- | ``e `` | \( 7 ) | float | 2 | \( 5 ) |
227
+ | ``e `` | \( 6 ) | float | 2 | \( 4 ) |
228
228
+--------+--------------------------+--------------------+----------------+------------+
229
- | ``f `` | :c:type: `float ` | float | 4 | \( 5 ) |
229
+ | ``f `` | :c:type: `float ` | float | 4 | \( 4 ) |
230
230
+--------+--------------------------+--------------------+----------------+------------+
231
- | ``d `` | :c:type: `double ` | float | 8 | \( 5 ) |
231
+ | ``d `` | :c:type: `double ` | float | 8 | \( 4 ) |
232
232
+--------+--------------------------+--------------------+----------------+------------+
233
233
| ``s `` | :c:type: `char[] ` | bytes | | |
234
234
+--------+--------------------------+--------------------+----------------+------------+
235
235
| ``p `` | :c:type: `char[] ` | bytes | | |
236
236
+--------+--------------------------+--------------------+----------------+------------+
237
- | ``P `` | :c:type: `void \* ` | integer | | \( 6 ) |
237
+ | ``P `` | :c:type: `void \* ` | integer | | \( 5 ) |
238
238
+--------+--------------------------+--------------------+----------------+------------+
239
239
240
240
.. versionchanged :: 3.3
@@ -254,38 +254,33 @@ Notes:
254
254
standard mode, it is always represented by one byte.
255
255
256
256
(2)
257
- The ``'q' `` and ``'Q' `` conversion codes are available in native mode only if
258
- the platform C compiler supports C :c:type: `long long `, or, on Windows,
259
- :c:type: `__int64 `. They are always available in standard modes.
260
-
261
- (3)
262
257
When attempting to pack a non-integer using any of the integer conversion
263
258
codes, if the non-integer has a :meth: `__index__ ` method then that method is
264
259
called to convert the argument to an integer before packing.
265
260
266
261
.. versionchanged :: 3.2
267
262
Use of the :meth: `__index__ ` method for non-integers is new in 3.2.
268
263
269
- (4 )
264
+ (3 )
270
265
The ``'n' `` and ``'N' `` conversion codes are only available for the native
271
266
size (selected as the default or with the ``'@' `` byte order character).
272
267
For the standard size, you can use whichever of the other integer formats
273
268
fits your application.
274
269
275
- (5 )
270
+ (4 )
276
271
For the ``'f' ``, ``'d' `` and ``'e' `` conversion codes, the packed
277
272
representation uses the IEEE 754 binary32, binary64 or binary16 format (for
278
273
``'f' ``, ``'d' `` or ``'e' `` respectively), regardless of the floating-point
279
274
format used by the platform.
280
275
281
- (6 )
276
+ (5 )
282
277
The ``'P' `` format character is only available for the native byte ordering
283
278
(selected as the default or with the ``'@' `` byte order character). The byte
284
279
order character ``'=' `` chooses to use little- or big-endian ordering based
285
280
on the host system. The struct module does not interpret this as native
286
281
ordering, so the ``'P' `` format is not available.
287
282
288
- (7 )
283
+ (6 )
289
284
The IEEE 754 binary16 "half precision" type was introduced in the 2008
290
285
revision of the `IEEE 754 standard <ieee 754 standard _>`_. It has a sign
291
286
bit, a 5-bit exponent and 11-bit precision (with 10 bits explicitly stored),
0 commit comments