Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9322727

Browse files
committed
Patch #497126: Always compile dl.
1 parent 7198a52 commit 9322727

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ Fredrik Nehr
312312
Chad Netzer
313313
Max Neunh�ffer
314314
George Neville-Neil
315+
Gustavo Niemeyer
315316
Oscar Nierstrasz
316317
Hrvoje Niksic
317318
Bill Noon

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Core and builtins
1212

1313
Extension modules
1414

15+
- dl is now build on every system that has dlfcn.h. Failure in case
16+
of sizeof(int)!=sizeof(long)!=sizeof(void*) is delayed until dl.open
17+
is called.
18+
1519
Library
1620

1721
- ftplib: to safeguard the user's privacy, anonymous login will use

Modules/dlmodule.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ dl_open(PyObject *self, PyObject *args)
158158
char *name;
159159
int mode;
160160
PyUnivPtr *handle;
161+
if (sizeof(int) != sizeof(long) ||
162+
sizeof(long) != sizeof(char *)) {
163+
PyErr_SetString(PyExc_SystemError,
164+
"module dl requires sizeof(int) == sizeof(long) == sizeof(char*)");
165+
return NULL;
166+
}
167+
161168
if (PyArg_Parse(args, "z", &name))
162169
mode = RTLD_LAZY;
163170
else {
@@ -204,13 +211,6 @@ initdl(void)
204211
{
205212
PyObject *m, *d, *x;
206213

207-
if (sizeof(int) != sizeof(long) ||
208-
sizeof(long) != sizeof(char *)) {
209-
PyErr_SetString(PyExc_SystemError,
210-
"module dl requires sizeof(int) == sizeof(long) == sizeof(char*)");
211-
return;
212-
}
213-
214214
/* Initialize object type */
215215
Dltype.ob_type = &PyType_Type;
216216

setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,11 @@ def detect_modules(self):
567567
define_macros = expat_defs,
568568
libraries = ['expat']) )
569569

570+
# Dynamic loading module
571+
dl_inc = find_file('dlfcn.h', [], inc_dirs)
572+
if dl_inc is not None:
573+
exts.append( Extension('dl', ['dlmodule.c']) )
574+
570575
# Platform-specific libraries
571576
if platform == 'linux2':
572577
# Linux-specific modules

0 commit comments

Comments
 (0)