Skip to content

gh-100540: Remove obsolete Modules/_ctypes/darwin/ dlfcn shim #100541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -2591,7 +2591,7 @@ MODULE_MATH_DEPS=$(srcdir)/Modules/_math.h
MODULE_PYEXPAT_DEPS=@LIBEXPAT_INTERNAL@
MODULE_UNICODEDATA_DEPS=$(srcdir)/Modules/unicodedata_db.h $(srcdir)/Modules/unicodename_db.h
MODULE__BLAKE2_DEPS=$(srcdir)/Modules/_blake2/impl/blake2-config.h $(srcdir)/Modules/_blake2/impl/blake2-impl.h $(srcdir)/Modules/_blake2/impl/blake2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2b-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2b-ref.c $(srcdir)/Modules/_blake2/impl/blake2b-round.h $(srcdir)/Modules/_blake2/impl/blake2b.c $(srcdir)/Modules/_blake2/impl/blake2s-load-sse2.h $(srcdir)/Modules/_blake2/impl/blake2s-load-sse41.h $(srcdir)/Modules/_blake2/impl/blake2s-load-xop.h $(srcdir)/Modules/_blake2/impl/blake2s-ref.c $(srcdir)/Modules/_blake2/impl/blake2s-round.h $(srcdir)/Modules/_blake2/impl/blake2s.c $(srcdir)/Modules/_blake2/blake2module.h $(srcdir)/Modules/hashlib.h
MODULE__CTYPES_DEPS=$(srcdir)/Modules/_ctypes/ctypes.h $(srcdir)/Modules/_ctypes/darwin/dlfcn.h
MODULE__CTYPES_DEPS=$(srcdir)/Modules/_ctypes/ctypes.h
MODULE__CTYPES_MALLOC_CLOSURE=@MODULE__CTYPES_MALLOC_CLOSURE@
MODULE__DECIMAL_DEPS=$(srcdir)/Modules/_decimal/docstrings.h @LIBMPDEC_INTERNAL@
MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/pyexpat.c @LIBEXPAT_INTERNAL@
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed obsolete ``dlfcn.h`` shim from the ``_ctypes`` extension module,
which has not been necessary since Mac OS X 10.2.
10 changes: 5 additions & 5 deletions Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ bytes(cdata)
#define IS_INTRESOURCE(x) (((size_t)(x) >> 16) == 0)
#endif
#else
#include "ctypes_dlfcn.h"
#include <dlfcn.h>
#endif
#include "ctypes.h"

Expand Down Expand Up @@ -768,15 +768,15 @@ CDataType_in_dll(PyObject *type, PyObject *args)
return NULL;
}
#else
address = (void *)ctypes_dlsym(handle, name);
address = (void *)dlsym(handle, name);
if (!address) {
#ifdef __CYGWIN__
/* dlerror() isn't very helpful on cygwin */
PyErr_Format(PyExc_ValueError,
"symbol '%s' not found",
name);
#else
PyErr_SetString(PyExc_ValueError, ctypes_dlerror());
PyErr_SetString(PyExc_ValueError, dlerror());
#endif
return NULL;
}
Expand Down Expand Up @@ -3560,15 +3560,15 @@ PyCFuncPtr_FromDll(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
}
#else
address = (PPROC)ctypes_dlsym(handle, name);
address = (PPROC)dlsym(handle, name);
if (!address) {
#ifdef __CYGWIN__
/* dlerror() isn't very helpful on cygwin */
PyErr_Format(PyExc_AttributeError,
"function '%s' not found",
name);
#else
PyErr_SetString(PyExc_AttributeError, ctypes_dlerror());
PyErr_SetString(PyExc_AttributeError, dlerror());
#endif
Py_DECREF(ftuple);
return NULL;
Expand Down
12 changes: 6 additions & 6 deletions Modules/_ctypes/callproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#include <windows.h>
#include <tchar.h>
#else
#include "ctypes_dlfcn.h"
#include <dlfcn.h>
#endif

#ifdef __APPLE__
Expand Down Expand Up @@ -1537,10 +1537,10 @@ static PyObject *py_dl_open(PyObject *self, PyObject *args)
if (PySys_Audit("ctypes.dlopen", "O", name) < 0) {
return NULL;
}
handle = ctypes_dlopen(name_str, mode);
handle = dlopen(name_str, mode);
Py_XDECREF(name2);
if (!handle) {
const char *errmsg = ctypes_dlerror();
const char *errmsg = dlerror();
if (!errmsg)
errmsg = "dlopen() error";
PyErr_SetString(PyExc_OSError,
Expand All @@ -1558,7 +1558,7 @@ static PyObject *py_dl_close(PyObject *self, PyObject *args)
return NULL;
if (dlclose(handle)) {
PyErr_SetString(PyExc_OSError,
ctypes_dlerror());
dlerror());
return NULL;
}
Py_RETURN_NONE;
Expand All @@ -1576,10 +1576,10 @@ static PyObject *py_dl_sym(PyObject *self, PyObject *args)
if (PySys_Audit("ctypes.dlsym/handle", "O", args) < 0) {
return NULL;
}
ptr = ctypes_dlsym((void*)handle, name);
ptr = dlsym((void*)handle, name);
if (!ptr) {
PyErr_SetString(PyExc_OSError,
ctypes_dlerror());
dlerror());
return NULL;
}
return PyLong_FromVoidPtr(ptr);
Expand Down
27 changes: 0 additions & 27 deletions Modules/_ctypes/ctypes_dlfcn.h

This file was deleted.

31 changes: 0 additions & 31 deletions Modules/_ctypes/darwin/LICENSE

This file was deleted.

95 changes: 0 additions & 95 deletions Modules/_ctypes/darwin/README

This file was deleted.

11 changes: 0 additions & 11 deletions Modules/_ctypes/darwin/README.ctypes

This file was deleted.

84 changes: 0 additions & 84 deletions Modules/_ctypes/darwin/dlfcn.h

This file was deleted.

Loading