summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-10-08 15:54:10 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-10-08 15:54:10 (GMT)
commit3d830828defeabafe50ae5b8ba2298b7cf486b4f (patch)
treec93668a2bc94de5a8a1882629d0834f79b4b9216
parenta5b642c9332333f78876f8ae5ccde8d055fda5ea (diff)
downloadcpython-3d830828defeabafe50ae5b8ba2298b7cf486b4f.zip
cpython-3d830828defeabafe50ae5b8ba2298b7cf486b4f.tar.gz
cpython-3d830828defeabafe50ae5b8ba2298b7cf486b4f.tar.bz2
Issue #7078: _struct.__doc__ was being ignored. Import it into struct.
Also add description of '?' struct format character. Thanks Gabriel Genellina for the patch.
-rw-r--r--Lib/struct.py1
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/_struct.c18
3 files changed, 13 insertions, 8 deletions
diff --git a/Lib/struct.py b/Lib/struct.py
index 3784c05..b022355 100644
--- a/Lib/struct.py
+++ b/Lib/struct.py
@@ -1,2 +1,3 @@
from _struct import *
from _struct import _clearcache
+from _struct import __doc__
diff --git a/Misc/NEWS b/Misc/NEWS
index cbd3040..f1fad86 100644
--- 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
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 8c1549d..27f8881 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -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\