Skip to content
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

bpo-36722: Debug build loads libraries built in release mode #12952

Merged
merged 1 commit into from
Apr 25, 2019
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In debug build, import now also looks for C extensions compiled in release
mode and for C extensions compiled in the stable ABI.
5 changes: 3 additions & 2 deletions Python/dynload_shlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ const char *_PyImport_DynLoadFiletab[] = {
".dll",
#else /* !__CYGWIN__ */
"." SOABI ".so",
#ifndef Py_DEBUG
#ifdef ALT_SOABI
"." ALT_SOABI ".so",
#endif
".abi" PYTHON_ABI_STRING ".so",
#endif /* ! Py_DEBUG */
".so",
#endif /* __CYGWIN__ */
NULL,
Expand Down
12 changes: 12 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ THREADHEADERS
LIBPL
PY_ENABLE_SHARED
EXT_SUFFIX
ALT_SOABI
SOABI
LIBC
LIBM
Expand Down Expand Up @@ -15127,6 +15128,17 @@ SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFO
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5
$as_echo "$SOABI" >&6; }

if test "$Py_DEBUG" = 'true'; then
# Similar to SOABI but remove "d" flag from ABIFLAGS

ALT_SOABI='cpython-'`echo $VERSION | tr -d .``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}

cat >>confdefs.h <<_ACEOF
#define ALT_SOABI "${ALT_SOABI}"
_ACEOF

fi


case $ac_sys_system in
Linux*|GNU*|Darwin|VxWorks)
Expand Down
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4627,6 +4627,14 @@ AC_MSG_CHECKING(SOABI)
SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
AC_MSG_RESULT($SOABI)

if test "$Py_DEBUG" = 'true'; then
# Similar to SOABI but remove "d" flag from ABIFLAGS
AC_SUBST(ALT_SOABI)
ALT_SOABI='cpython-'`echo $VERSION | tr -d .``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
AC_DEFINE_UNQUOTED(ALT_SOABI, "${ALT_SOABI}",
[Alternative SOABI used in debug build to load C extensions built in release mode])
fi

AC_SUBST(EXT_SUFFIX)
case $ac_sys_system in
Linux*|GNU*|Darwin|VxWorks)
Expand Down
4 changes: 4 additions & 0 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
support for AIX C++ shared extension modules. */
#undef AIX_GENUINE_CPLUSPLUS

/* Alternative SOABI used in debug build to load C extensions built in release
mode */
#undef ALT_SOABI

/* The Android API level. */
#undef ANDROID_API_LEVEL

Expand Down