diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-01-26 11:48:20 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-01-26 11:48:20 +0000 |
commit | 727fe66f27cd467fe67ce95f26bdc6584b873fdc (patch) | |
tree | a0dd409590d49ddd25880530cc5fb8215e62553e /Modules | |
parent | 692d292c635daaadd68e568020d647208db1cffe (diff) | |
download | cpython-git-727fe66f27cd467fe67ce95f26bdc6584b873fdc.tar.gz |
Add _iconv_codec to Setup.dist. Use PyModule_ functions.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Setup.dist | 3 | ||||
-rw-r--r-- | Modules/_iconv_codec.c | 11 |
2 files changed, 6 insertions, 8 deletions
diff --git a/Modules/Setup.dist b/Modules/Setup.dist index 538808625a..bebcd08dae 100644 --- a/Modules/Setup.dist +++ b/Modules/Setup.dist @@ -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 diff --git a/Modules/_iconv_codec.c b/Modules/_iconv_codec.c index 9f08102d82..4a93aaa475 100644 --- a/Modules/_iconv_codec.c +++ b/Modules/_iconv_codec.c @@ -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()) |