From 200788ce4594bb4ddf47b319f45d99c8206dc0ec Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Tue, 13 Aug 2002 22:20:41 +0000 Subject: [PATCH] Allow more docstrings to be removed during compilation in some modules --- Modules/cPickle.c | 31 ++++++++++++++++--------------- Modules/operator.c | 4 ++-- Modules/parsermodule.c | 40 ++++++++++++++++++++-------------------- Modules/symtablemodule.c | 3 ++- 4 files changed, 40 insertions(+), 38 deletions(-) diff --git a/Modules/cPickle.c b/Modules/cPickle.c index b7b32c8289..d1f7867f8a 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -2295,12 +2295,12 @@ Pickler_dump(Picklerobject *self, PyObject *args) static struct PyMethodDef Pickler_methods[] = { {"dump", (PyCFunction)Pickler_dump, METH_VARARGS, - "dump(object) --" - "Write an object in pickle format to the object's pickle stream"}, + PyDoc_STR("dump(object) -- " + "Write an object in pickle format to the object's pickle stream")}, {"clear_memo", (PyCFunction)Pickle_clear_memo, METH_NOARGS, - "clear_memo() -- Clear the picklers memo"}, + PyDoc_STR("clear_memo() -- Clear the picklers memo")}, {"getvalue", (PyCFunction)Pickle_getvalue, METH_VARARGS, - "getvalue() -- Finish picking a list-based pickle"}, + PyDoc_STR("getvalue() -- Finish picking a list-based pickle")}, {NULL, NULL} /* sentinel */ }; @@ -4301,15 +4301,16 @@ Unpickler_noload(Unpicklerobject *self, PyObject *args) static struct PyMethodDef Unpickler_methods[] = { {"load", (PyCFunction)Unpickler_load, METH_VARARGS, - "load() -- Load a pickle" + PyDoc_STR("load() -- Load a pickle") }, {"noload", (PyCFunction)Unpickler_noload, METH_VARARGS, + PyDoc_STR( "noload() -- not load a pickle, but go through most of the motions\n" "\n" "This function can be used to read past a pickle without instantiating\n" "any objects or importing any modules. It can also be used to find all\n" "persistent references without instantiating any objects or importing\n" - "any modules.\n" + "any modules.\n") }, {NULL, NULL} /* sentinel */ }; @@ -4648,34 +4649,34 @@ static PyTypeObject Unpicklertype = { static struct PyMethodDef cPickle_methods[] = { {"dump", (PyCFunction)cpm_dump, METH_VARARGS, - "dump(object, file, [binary]) --" + PyDoc_STR("dump(object, file, [binary]) --" "Write an object in pickle format to the given file\n" "\n" "If the optional argument, binary, is provided and is true, then the\n" "pickle will be written in binary format, which is more space and\n" - "computationally efficient. \n" + "computationally efficient. \n") }, {"dumps", (PyCFunction)cpm_dumps, METH_VARARGS, - "dumps(object, [binary]) --" + PyDoc_STR("dumps(object, [binary]) --" "Return a string containing an object in pickle format\n" "\n" "If the optional argument, binary, is provided and is true, then the\n" "pickle will be written in binary format, which is more space and\n" - "computationally efficient. \n" + "computationally efficient. \n") }, {"load", (PyCFunction)cpm_load, METH_VARARGS, - "load(file) -- Load a pickle from the given file"}, + PyDoc_STR("load(file) -- Load a pickle from the given file")}, {"loads", (PyCFunction)cpm_loads, METH_VARARGS, - "loads(string) -- Load a pickle from the given string"}, + PyDoc_STR("loads(string) -- Load a pickle from the given string")}, {"Pickler", (PyCFunction)get_Pickler, METH_VARARGS, - "Pickler(file, [binary]) -- Create a pickler\n" + PyDoc_STR("Pickler(file, [binary]) -- Create a pickler\n" "\n" "If the optional argument, binary, is provided and is true, then\n" "pickles will be written in binary format, which is more space and\n" - "computationally efficient. \n" + "computationally efficient. \n") }, {"Unpickler", (PyCFunction)get_Unpickler, METH_VARARGS, - "Unpickler(file) -- Create an unpickler"}, + PyDoc_STR("Unpickler(file) -- Create an unpickler")}, { NULL, NULL } }; diff --git a/Modules/operator.c b/Modules/operator.c index c1bf468955..229fbac101 100644 --- a/Modules/operator.c +++ b/Modules/operator.c @@ -146,9 +146,9 @@ op_delslice(PyObject *s, PyObject *a) #undef spam1 #undef spam2 -#define spam1(OP,DOC) {#OP, OP, METH_VARARGS, DOC}, +#define spam1(OP,DOC) {#OP, OP, METH_VARARGS, PyDoc_STR(DOC)}, #define spam2(OP,ALTOP,DOC) {#OP, op_##OP, METH_VARARGS, DOC}, \ - {#ALTOP, op_##OP, METH_VARARGS, DOC}, + {#ALTOP, op_##OP, METH_VARARGS, PyDoc_STR(DOC)}, static struct PyMethodDef operator_methods[] = { diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c index c48c36851c..203786eb19 100644 --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -442,15 +442,15 @@ parser_issuite(PyST_Object *self, PyObject *args, PyObject *kw) static PyMethodDef parser_methods[] = { {"compile", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, - "Compile this ST object into a code object."}, + PyDoc_STR("Compile this ST object into a code object.")}, {"isexpr", (PyCFunction)parser_isexpr, PUBLIC_METHOD_TYPE, - "Determines if this ST object was created from an expression."}, + PyDoc_STR("Determines if this ST object was created from an expression.")}, {"issuite", (PyCFunction)parser_issuite, PUBLIC_METHOD_TYPE, - "Determines if this ST object was created from a suite."}, + PyDoc_STR("Determines if this ST object was created from a suite.")}, {"tolist", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, - "Creates a list-tree representation of this ST."}, + PyDoc_STR("Creates a list-tree representation of this ST.")}, {"totuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, - "Creates a tuple-tree representation of this ST."}, + PyDoc_STR("Creates a tuple-tree representation of this ST.")}, {NULL, NULL, 0, NULL} }; @@ -2816,37 +2816,37 @@ parser__pickler(PyObject *self, PyObject *args) */ static PyMethodDef parser_functions[] = { {"ast2tuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, - "Creates a tuple-tree representation of an ST."}, + PyDoc_STR("Creates a tuple-tree representation of an ST.")}, {"ast2list", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, - "Creates a list-tree representation of an ST."}, + PyDoc_STR("Creates a list-tree representation of an ST.")}, {"compileast", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, - "Compiles an ST object into a code object."}, + PyDoc_STR("Compiles an ST object into a code object.")}, {"compilest", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, - "Compiles an ST object into a code object."}, + PyDoc_STR("Compiles an ST object into a code object.")}, {"expr", (PyCFunction)parser_expr, PUBLIC_METHOD_TYPE, - "Creates an ST object from an expression."}, + PyDoc_STR("Creates an ST object from an expression.")}, {"isexpr", (PyCFunction)parser_isexpr, PUBLIC_METHOD_TYPE, - "Determines if an ST object was created from an expression."}, + PyDoc_STR("Determines if an ST object was created from an expression.")}, {"issuite", (PyCFunction)parser_issuite, PUBLIC_METHOD_TYPE, - "Determines if an ST object was created from a suite."}, + PyDoc_STR("Determines if an ST object was created from a suite.")}, {"suite", (PyCFunction)parser_suite, PUBLIC_METHOD_TYPE, - "Creates an ST object from a suite."}, + PyDoc_STR("Creates an ST object from a suite.")}, {"sequence2ast", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, - "Creates an ST object from a tree representation."}, + PyDoc_STR("Creates an ST object from a tree representation.")}, {"sequence2st", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, - "Creates an ST object from a tree representation."}, + PyDoc_STR("Creates an ST object from a tree representation.")}, {"st2tuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, - "Creates a tuple-tree representation of an ST."}, + PyDoc_STR("Creates a tuple-tree representation of an ST.")}, {"st2list", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, - "Creates a list-tree representation of an ST."}, + PyDoc_STR("Creates a list-tree representation of an ST.")}, {"tuple2ast", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, - "Creates an ST object from a tree representation."}, + PyDoc_STR("Creates an ST object from a tree representation.")}, {"tuple2st", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, - "Creates an ST object from a tree representation."}, + PyDoc_STR("Creates an ST object from a tree representation.")}, /* private stuff: support pickle module */ {"_pickler", (PyCFunction)parser__pickler, METH_VARARGS, - "Returns the pickle magic to allow ST objects to be pickled."}, + PyDoc_STR("Returns the pickle magic to allow ST objects to be pickled.")}, {NULL, NULL, 0, NULL} }; diff --git a/Modules/symtablemodule.c b/Modules/symtablemodule.c index 9854a1cf6c..f605c2276c 100644 --- a/Modules/symtablemodule.c +++ b/Modules/symtablemodule.c @@ -39,7 +39,8 @@ symtable_symtable(PyObject *self, PyObject *args) static PyMethodDef symtable_methods[] = { {"symtable", symtable_symtable, METH_VARARGS, - "Return symbol and scope dictionaries used internally by compiler."}, + PyDoc_STR("Return symbol and scope dictionaries" + " used internally by compiler.")}, {NULL, NULL} /* sentinel */ }; -- 2.40.0