]> granicus.if.org Git - python/commitdiff
Add _iconv_codec to Setup.dist. Use PyModule_ functions.
authorMartin v. Löwis <martin@v.loewis.de>
Sun, 26 Jan 2003 11:48:20 +0000 (11:48 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sun, 26 Jan 2003 11:48:20 +0000 (11:48 +0000)
Modules/Setup.dist
Modules/_iconv_codec.c

index 538808625a3bed9bcc3ebb57fed5e7046dd48989..bebcd08dae5622f926a46b7f0fe3f0ea0876f7a6 100644 (file)
@@ -474,6 +474,9 @@ GLHACK=-Dclear=__GLclear
 #EXPAT_DIR=/usr/local/src/expat-1.95.2
 #pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat
 
+# Wrapper for iconv(3). This requires either GNU iconv, or a native
+# iconv implementation (only Linux, Solaris, and BSD are known to work)
+#_iconv_codec _iconv_codec -I$(prefix)/include -L$(exec_prefix)/lib -liconv
 
 # Example -- included for reference only:
 # xx xxmodule.c
index 9f08102d82abc1bb93b4246584df2419c3b7c946..4a93aaa475d559cabc4ad763dc847b8056b174b2 100644 (file)
@@ -603,17 +603,12 @@ static struct PyMethodDef _iconv_codec_methods[] = {
 void
 init_iconv_codec(void)
 {
-    PyObject        *m, *d, *t;
+    PyObject *m;
 
     m = Py_InitModule("_iconv_codec", _iconv_codec_methods);
 
-    d = PyModule_GetDict(m);
-
-    t = PyString_FromString(__version__);
-    PyDict_SetItemString(d, "__version__", t);
-    Py_DECREF(t);
-
-    PyDict_SetItemString(d, "iconvcodec", (PyObject *)(&iconvcodec_Type));
+    PyModule_AddStringConstant(m, "__version__", (char*)__version__);
+    PyModule_AddObject(m, "iconvcodec", (PyObject *)(&iconvcodec_Type));
     PyModule_AddStringConstant(m, "internal_encoding", UNICODE_ENCODING);
 
     if (PyErr_Occurred())