comparison Python/pystate.c @ 18689:064de84385ca legacy-trunk

Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags. Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
author Martin v. Löwis <martin@v.loewis.de>
date Wed, 18 Jul 2001 16:17:16 +0000
parents 3b295ce2705f
children b0329649b8cf
comparison
equal deleted inserted replaced
18688:4c59e934e765 18689:064de84385ca
1 1
2 /* Thread and interpreter state structures and their interfaces */ 2 /* Thread and interpreter state structures and their interfaces */
3 3
4 #include "Python.h" 4 #include "Python.h"
5
6 #ifdef HAVE_DLOPEN
7 #ifdef HAVE_DLFCN_H
8 #include <dlfcn.h>
9 #endif
10 #ifndef RTLD_LAZY
11 #define RTLD_LAZY 1
12 #endif
13 #endif
14
5 15
6 #define ZAP(x) { \ 16 #define ZAP(x) { \
7 PyObject *tmp = (PyObject *)(x); \ 17 PyObject *tmp = (PyObject *)(x); \
8 (x) = NULL; \ 18 (x) = NULL; \
9 Py_XDECREF(tmp); \ 19 Py_XDECREF(tmp); \
37 interp->modules = NULL; 47 interp->modules = NULL;
38 interp->sysdict = NULL; 48 interp->sysdict = NULL;
39 interp->builtins = NULL; 49 interp->builtins = NULL;
40 interp->checkinterval = 10; 50 interp->checkinterval = 10;
41 interp->tstate_head = NULL; 51 interp->tstate_head = NULL;
52 #ifdef HAVE_DLOPEN
53 #ifdef RTLD_NOW
54 interp->dlopenflags = RTLD_NOW;
55 #else
56 interp->dlopenflags = RTLD_LAZY;
57 #endif
58 #endif
42 59
43 HEAD_LOCK(); 60 HEAD_LOCK();
44 interp->next = interp_head; 61 interp->next = interp_head;
45 interp_head = interp; 62 interp_head = interp;
46 HEAD_UNLOCK(); 63 HEAD_UNLOCK();