]> granicus.if.org Git - python/commitdiff
Patch #497126: Always compile dl.
authorMartin v. Löwis <martin@v.loewis.de>
Tue, 1 Jan 2002 20:18:30 +0000 (20:18 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Tue, 1 Jan 2002 20:18:30 +0000 (20:18 +0000)
Misc/ACKS
Misc/NEWS
Modules/dlmodule.c
setup.py

index ead7ec8a9775bd6c611d55082cf38ff7a56c8734..861e226851e12c892523cdf0b48cc94777fdba53 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -312,6 +312,7 @@ Fredrik Nehr
 Chad Netzer
 Max Neunhöffer
 George Neville-Neil
+Gustavo Niemeyer
 Oscar Nierstrasz
 Hrvoje Niksic
 Bill Noon
index a0e35720057442ac6be41fc1ce3bcd9a0529082a..abdf40089f072c9f7c9e2dd6358c11e2881287fa 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,10 @@ Core and builtins
 
 Extension modules
 
+- dl is now build on every system that has dlfcn.h. Failure in case
+  of sizeof(int)!=sizeof(long)!=sizeof(void*) is delayed until dl.open
+  is called.
+
 Library
 
 - ftplib: to safeguard the user's privacy, anonymous login will use
index 18b97d8584e3231b2b39c5916a1a15267d82ff74..46ae926a3a0342545b1d95aa3f0b93316f2bc3bc 100644 (file)
@@ -158,6 +158,13 @@ dl_open(PyObject *self, PyObject *args)
        char *name;
        int mode;
        PyUnivPtr *handle;
+       if (sizeof(int) != sizeof(long) ||
+           sizeof(long) != sizeof(char *)) {
+               PyErr_SetString(PyExc_SystemError,
+ "module dl requires sizeof(int) == sizeof(long) == sizeof(char*)");
+               return NULL;
+       }
+
        if (PyArg_Parse(args, "z", &name))
                mode = RTLD_LAZY;
        else {
@@ -204,13 +211,6 @@ initdl(void)
 {
        PyObject *m, *d, *x;
 
-       if (sizeof(int) != sizeof(long) ||
-           sizeof(long) != sizeof(char *)) {
-               PyErr_SetString(PyExc_SystemError,
- "module dl requires sizeof(int) == sizeof(long) == sizeof(char*)");
-               return;
-       }
-
        /* Initialize object type */
        Dltype.ob_type = &PyType_Type;
 
index 28a1a7c183f8647b55b025196d35d00a453538b9..8af8bde3ee4f341c9f1c47d7da9272c52130fd4a 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -567,6 +567,11 @@ class PyBuildExt(build_ext):
                                    define_macros = expat_defs,
                                    libraries = ['expat']) )
 
+       # Dynamic loading module
+        dl_inc = find_file('dlfcn.h', [], inc_dirs)
+        if dl_inc is not None:
+               exts.append( Extension('dl', ['dlmodule.c']) )
+               
         # Platform-specific libraries
         if platform == 'linux2':
             # Linux-specific modules