diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2000-09-13 16:26:10 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2000-09-13 16:26:10 (GMT) |
commit | df23f33f9bea953d980d558c249e50bb020e3cff (patch) | |
tree | 2b0dd83da9b5f1e602ad774b47985c55df792128 | |
parent | ddef8887db91c4fc0e9c8b2fd0982ff5135447d6 (diff) | |
download | cpython-df23f33f9bea953d980d558c249e50bb020e3cff.zip cpython-df23f33f9bea953d980d558c249e50bb020e3cff.tar.gz cpython-df23f33f9bea953d980d558c249e50bb020e3cff.tar.bz2 |
Add several dl.RTLD_ constants. Closes bug 110842.
-rw-r--r-- | Modules/dlmodule.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c index b094be7..971b06f 100644 --- a/Modules/dlmodule.c +++ b/Modules/dlmodule.c @@ -181,6 +181,21 @@ static PyMethodDef dl_methods[] = { {NULL, NULL} /* sentinel */ }; +/* From socketmodule.c + * Convenience routine to export an integer value. + * + * Errors are silently ignored, for better or for worse... + */ +static void +insint(PyObject *d, char *name, int value) +{ + PyObject *v = PyInt_FromLong((long) value); + if (!v || PyDict_SetItemString(d, name, v)) + PyErr_Clear(); + + Py_XDECREF(v); +} + void initdl(void) { @@ -202,8 +217,29 @@ initdl(void) PyDict_SetItemString(d, "error", x); x = PyInt_FromLong((long)RTLD_LAZY); PyDict_SetItemString(d, "RTLD_LAZY", x); +#define INSINT(X) insint(d,#X,X) #ifdef RTLD_NOW - x = PyInt_FromLong((long)RTLD_NOW); - PyDict_SetItemString(d, "RTLD_NOW", x); + INSINT(RTLD_NOW); +#endif +#ifdef RTLD_NOLOAD + INSINT(RTLD_NOLOAD); +#endif +#ifdef RTLD_GLOBAL + INSINT(RTLD_GLOBAL); +#endif +#ifdef RTLD_LOCAL + INSINT(RTLD_LOCAL); +#endif +#ifdef RTLD_PARENT + INSINT(RTLD_PARENT); +#endif +#ifdef RTLD_GROUP + INSINT(RTLD_GROUP); +#endif +#ifdef RTLD_WORLD + INSINT(RTLD_WORLD); +#endif +#ifdef RTLD_NODELETE + INSINT(RTLD_NODELETE); #endif } |