]> granicus.if.org Git - python/commitdiff
Issue #7078: _struct.__doc__ was being ignored. Import it into struct.
authorMark Dickinson <dickinsm@gmail.com>
Thu, 8 Oct 2009 15:54:10 +0000 (15:54 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Thu, 8 Oct 2009 15:54:10 +0000 (15:54 +0000)
Also add description of '?' struct format character.  Thanks Gabriel
Genellina for the patch.

Lib/struct.py
Misc/NEWS
Modules/_struct.c

index 3784c055be96b940871cf79fd94886753a0d7a20..b022355c180d19d5417ef9e938ca5cb5934977bd 100644 (file)
@@ -1,2 +1,3 @@
 from _struct import *
 from _struct import _clearcache
+from _struct import __doc__
index cbd3040126e71f7ab80485dd5bd85c3dd6c34956..f1fad86057b42a37894e87a67ea6f4685d406ef6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1370,6 +1370,8 @@ C-API
 Extension Modules
 -----------------
 
+- Issue #7078: Set struct.__doc__ from _struct.__doc__.
+
 - Issue #3366: Add gamma function to math module.
 
 - Issue #6823: Allow time.strftime() to accept a tuple with a isdst field
index 8c1549d2b0d4ce43e0b2f6878fe24430998ac3b7..27f8881fc0cd385dc92562f13be2f1adea556cd7 100644 (file)
@@ -1868,20 +1868,22 @@ static struct PyMethodDef module_functions[] = {
 /* Module initialization */
 
 PyDoc_STRVAR(module_doc,
-"Functions to convert between Python values and C structs.\n\
-Python strings are used to hold the data representing the C struct\n\
-and also as format strings to describe the layout of data in the C struct.\n\
+"Functions to convert between Python values and C structs represented\n\
+as Python strings. It uses format strings (explained below) as compact\n\
+descriptions of the lay-out of the C structs and the intended conversion\n\
+to/from Python values.\n\
 \n\
 The optional first format char indicates byte order, size and alignment:\n\
- @: native order, size & alignment (default)\n\
- =: native order, std. size & alignment\n\
- <: little-endian, std. size & alignment\n\
- >: big-endian, std. size & alignment\n\
- !: same as >\n\
 @: native order, size & alignment (default)\n\
 =: native order, std. size & alignment\n\
 <: little-endian, std. size & alignment\n\
 >: big-endian, std. size & alignment\n\
 !: same as >\n\
 \n\
 The remaining chars indicate types of args and must match exactly;\n\
 these can be preceded by a decimal repeat count:\n\
   x: pad byte (no data); c:char; b:signed byte; B:unsigned byte;\n\
+  ?: _Bool (requires C99; if not available, char is used instead)\n\
   h:short; H:unsigned short; i:int; I:unsigned int;\n\
   l:long; L:unsigned long; f:float; d:double.\n\
 Special cases (preceding decimal count indicates length):\n\