summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-01-01 20:18:30 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-01-01 20:18:30 (GMT)
commit93227275dcf18196c1b81a3c884dbd2e78c8f440 (patch)
tree38fac8a0362ab5455ca290de83ab65b59fb9a06c
parent7198a525f3e926899ba238f6e6a2e6e9349b7de4 (diff)
downloadcpython-93227275dcf18196c1b81a3c884dbd2e78c8f440.zip
cpython-93227275dcf18196c1b81a3c884dbd2e78c8f440.tar.gz
cpython-93227275dcf18196c1b81a3c884dbd2e78c8f440.tar.bz2
Patch #497126: Always compile dl.
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS4
-rw-r--r--Modules/dlmodule.c14
-rw-r--r--setup.py5
4 files changed, 17 insertions, 7 deletions
diff --git a/Misc/ACKS b/Misc/ACKS
index ead7ec8..861e226 100644
--- 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
diff --git a/Misc/NEWS b/Misc/NEWS
index a0e3572..abdf400 100644
--- 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
diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c
index 18b97d8..46ae926 100644
--- a/Modules/dlmodule.c
+++ b/Modules/dlmodule.c
@@ -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;
diff --git a/setup.py b/setup.py
index 28a1a7c..8af8bde 100644
--- 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