Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 65291:fd044cda97d8
#9418: first step of moving private string methods to _string module.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Thu, 14 Oct 2010 07:04:07 +0000 |
| parents | e3ae5b00ba15 |
| children | 453fd8182c2f |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Thu Oct 14 06:59:45 2010 +0000 +++ b/Objects/unicodeobject.c Thu Oct 14 07:04:07 2010 +0000 @@ -8968,8 +8968,6 @@ {"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__}, {"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__}, {"__format__", (PyCFunction) unicode__format__, METH_VARARGS, p_format__doc__}, - {"_formatter_field_name_split", (PyCFunction) formatter_field_name_split, METH_NOARGS}, - {"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS}, {"maketrans", (PyCFunction) unicode_maketrans, METH_VARARGS | METH_STATIC, maketrans__doc__}, {"__sizeof__", (PyCFunction) unicode__sizeof__, METH_NOARGS, sizeof__doc__}, @@ -10170,6 +10168,36 @@ return copy; } +/* A _string module, to export formatter_parser and formatter_field_name_split + to the string.Formatter class implemented in Python. */ + +static PyMethodDef _string_methods[] = { + {"formatter_field_name_split", (PyCFunction) formatter_field_name_split, + METH_O, PyDoc_STR("split the argument as a field name")}, + {"formatter_parser", (PyCFunction) formatter_parser, + METH_O, PyDoc_STR("parse the argument as a format string")}, + {NULL, NULL} +}; + +static struct PyModuleDef _string_module = { + PyModuleDef_HEAD_INIT, + "_string", + PyDoc_STR("string helper module"), + 0, + _string_methods, + NULL, + NULL, + NULL, + NULL +}; + +PyMODINIT_FUNC +PyInit__string(void) +{ + return PyModule_Create(&_string_module); +} + + #ifdef __cplusplus } #endif
