[Python-3000-checkins] r57329 - python/branches/py3k/Modules/_localemodule.c

neal.norwitz python-3000-checkins at python.org
Thu Aug 23 20:08:12 CEST 2007


Author: neal.norwitz
Date: Thu Aug 23 20:08:11 2007
New Revision: 57329

Modified:
   python/branches/py3k/Modules/_localemodule.c
Log:
Use a newer API for creating the module so we don't have to create
the docstring manually.  Saves code and a call to PyString_FromString.

(There are still more calls to PyString_FromString.)


Modified: python/branches/py3k/Modules/_localemodule.c
==============================================================================
--- python/branches/py3k/Modules/_localemodule.c	(original)
+++ python/branches/py3k/Modules/_localemodule.c	Thu Aug 23 20:08:11 2007
@@ -645,7 +645,7 @@
     int i;
 #endif
 
-    m = Py_InitModule("_locale", PyLocale_Methods);
+    m = Py_InitModule3("_locale", PyLocale_Methods, locale__doc__);
     if (m == NULL)
     	return;
 
@@ -688,10 +688,6 @@
     Error = PyErr_NewException("locale.Error", NULL, NULL);
     PyDict_SetItemString(d, "Error", Error);
 
-    x = PyString_FromString(locale__doc__);
-    PyDict_SetItemString(d, "__doc__", x);
-    Py_XDECREF(x);
-
 #ifdef HAVE_LANGINFO_H
     for (i = 0; langinfo_constants[i].name; i++) {
 	    PyModule_AddIntConstant(m, langinfo_constants[i].name,


More information about the Python-3000-checkins mailing list