mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Patch 1471925 - Weak linking support for OSX
This patch causes several symbols in the socket and posix module to be weakly linked on OSX and disables usage of ftime on OSX. These changes make it possible to use a binary build on OSX 10.4 on a 10.3 system.
This commit is contained in:
parent
a1d3b1011e
commit
d06b6f28a0
3 changed files with 98 additions and 2 deletions
|
@ -13,6 +13,18 @@
|
|||
|
||||
/* See also ../Dos/dosmodule.c */
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* Step 1 of support for weak-linking a number of symbols existing on
|
||||
* OSX 10.4 and later, see the comment in the #ifdef __APPLE__ block
|
||||
* at the end of this file for more information.
|
||||
*/
|
||||
# pragma weak lchown
|
||||
# pragma weak statvfs
|
||||
# pragma weak fstatvfs
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
|
||||
#include "Python.h"
|
||||
|
@ -8266,6 +8278,45 @@ INITFUNC(void)
|
|||
PyModule_AddObject(m, "statvfs_result",
|
||||
(PyObject*) &StatVFSResultType);
|
||||
initialized = 1;
|
||||
|
||||
#ifdef __APPLE__
|
||||
/*
|
||||
* Step 2 of weak-linking support on Mac OS X.
|
||||
*
|
||||
* The code below removes functions that are not available on the
|
||||
* currently active platform.
|
||||
*
|
||||
* This block allow one to use a python binary that was build on
|
||||
* OSX 10.4 on OSX 10.3, without loosing access to new APIs on
|
||||
* OSX 10.4.
|
||||
*/
|
||||
#ifdef HAVE_FSTATVFS
|
||||
if (fstatvfs == NULL) {
|
||||
if (PyObject_DelAttrString(m, "fstatvfs") == -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_FSTATVFS */
|
||||
|
||||
#ifdef HAVE_STATVFS
|
||||
if (statvfs == NULL) {
|
||||
if (PyObject_DelAttrString(m, "statvfs") == -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_STATVFS */
|
||||
|
||||
# ifdef HAVE_LCHOWN
|
||||
if (lchown == NULL) {
|
||||
if (PyObject_DelAttrString(m, "lchown") == -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LCHOWN */
|
||||
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue