Link the core with CoreServices, not with Carbon, and don't use any Carbon

routines. As of 10.1 using Carbon will crash Python if no window server is
available (ssh connection, console mode, MacOSX Server). This fixes bug
#466907.

A result of this mod is that the default 8bit encoding on OSX is now ASCII,
for the time being. Also, the extension modules that need the Carbon
framework now explicitly include it in setup.py.
This commit is contained in:
Jack Jansen 2001-10-31 12:11:48 +00:00
parent d17f4bd6c8
commit 666b1e7e2f
4 changed files with 137 additions and 31 deletions

View File

@ -37,6 +37,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
char *PyMac_getscript()
{
#if TARGET_API_MAC_OSX
/* We cannot use GetSysFont because it requires the window manager
** There are other APIs to query the default 8 bit encoding, but
** I don't know about them (yet).
*/
return "ascii";
#else
int font, script, lang;
font = 0;
font = GetSysFont();
@ -65,6 +72,7 @@ char *PyMac_getscript()
default:
return "ascii"; /* better than nothing */
}
#endif /* TARGET_API_MAC_OSX */
}
/* Like strerror() but for Mac OS error numbers */

88
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# From configure.in Revision: 1.276
# From configure.in Revision: 1.278
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
@ -3027,7 +3027,7 @@ then
fi
case "$enable_toolbox_glue" in
yes)
extra_frameworks="-framework Carbon -framework Foundation"
extra_frameworks="-framework CoreServices -framework Foundation"
extra_machdep_objs="Python/mactoolboxglue.o"
extra_undefs="-u __dummy -u _PyMac_Error"
cat >> confdefs.h <<\EOF
@ -7379,6 +7379,84 @@ EOF
fi
# On HP/UX 11.0, mvwdelch is a block with a return statement
echo $ac_n "checking whether mvwdelch is an expression""... $ac_c" 1>&6
echo "configure:7385: checking whether mvwdelch is an expression" >&5
if eval "test \"`echo '$''{'ac_cv_mvwdelch_is_expression'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7390 "configure"
#include "confdefs.h"
#include <curses.h>
int main() {
int rtn;
rtn = mvwdelch(0,0,0);
; return 0; }
EOF
if { (eval echo configure:7400: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mvwdelch_is_expression=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_mvwdelch_is_expression=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_mvwdelch_is_expression" 1>&6
if test "$ac_cv_mvwdelch_is_expression" = yes
then
cat >> confdefs.h <<\EOF
#define MVWDELCH_IS_EXPRESSION 1
EOF
fi
echo $ac_n "checking whether WINDOW has _flags""... $ac_c" 1>&6
echo "configure:7423: checking whether WINDOW has _flags" >&5
if eval "test \"`echo '$''{'ac_cv_window_has_flags'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7428 "configure"
#include "confdefs.h"
#include <curses.h>
int main() {
WINDOW *w;
w->_flags = 0;
; return 0; }
EOF
if { (eval echo configure:7438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_window_has_flags=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_window_has_flags=no
fi
rm -f conftest*
fi
echo "$ac_t""$ac_cv_window_has_flags" 1>&6
if test "$ac_cv_window_has_flags" = yes
then
cat >> confdefs.h <<\EOF
#define WINDOW_HAS_FLAGS 1
EOF
fi
# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
# Add sys/socket.h to confdefs.h
cat >> confdefs.h <<\EOF
@ -7387,12 +7465,12 @@ cat >> confdefs.h <<\EOF
#endif
EOF
echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
echo "configure:7391: checking for socklen_t" >&5
echo "configure:7469: checking for socklen_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 7396 "configure"
#line 7474 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -7441,7 +7519,7 @@ done
SRCDIRS="Parser Grammar Objects Python Modules"
echo $ac_n "checking for build directories""... $ac_c" 1>&6
echo "configure:7445: checking for build directories" >&5
echo "configure:7523: checking for build directories" >&5
for dir in $SRCDIRS; do
if test ! -d $dir; then
mkdir $dir

View File

@ -655,7 +655,7 @@ then
fi
case "$enable_toolbox_glue" in
yes)
extra_frameworks="-framework Carbon -framework Foundation"
extra_frameworks="-framework CoreServices -framework Foundation"
extra_machdep_objs="Python/mactoolboxglue.o"
extra_undefs="-u __dummy -u _PyMac_Error"
AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)

View File

@ -565,35 +565,55 @@ class PyBuildExt(build_ext):
# procedure triggers on.
frameworkdir = sysconfig.get_config_var('PYTHONFRAMEWORKDIR')
exts.append( Extension('gestalt', ['gestaltmodule.c']) )
exts.append( Extension('MacOS', ['macosmodule.c']) )
exts.append( Extension('icglue', ['icgluemodule.c']) )
exts.append( Extension('macfs', ['macfsmodule.c', '../Python/getapplbycreator.c']) )
exts.append( Extension('_CF', ['cf/_CFmodule.c'],
extra_link_args=['-framework', 'CoreFoundation']) )
exts.append( Extension('_Res', ['res/_Resmodule.c'] ) )
exts.append( Extension('_Snd', ['snd/_Sndmodule.c']) )
exts.append( Extension('MacOS', ['macosmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('icglue', ['icgluemodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('macfs', ['macfsmodule.c', '../Python/getapplbycreator.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_CF', ['cf/_CFmodule.c']) )
exts.append( Extension('_Res', ['res/_Resmodule.c']) )
exts.append( Extension('_Snd', ['snd/_Sndmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
if frameworkdir:
exts.append( Extension('Nav', ['Nav.c']) )
exts.append( Extension('_AE', ['ae/_AEmodule.c']) )
exts.append( Extension('_App', ['app/_Appmodule.c']) )
exts.append( Extension('_Cm', ['cm/_Cmmodule.c']) )
exts.append( Extension('_Ctl', ['ctl/_Ctlmodule.c']) )
exts.append( Extension('_Dlg', ['dlg/_Dlgmodule.c']) )
exts.append( Extension('_Drag', ['drag/_Dragmodule.c']) )
exts.append( Extension('_Evt', ['evt/_Evtmodule.c']) )
exts.append( Extension('_Fm', ['fm/_Fmmodule.c']) )
exts.append( Extension('_Icn', ['icn/_Icnmodule.c']) )
exts.append( Extension('_List', ['list/_Listmodule.c']) )
exts.append( Extension('_Menu', ['menu/_Menumodule.c']) )
exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c']) )
exts.append( Extension('_Qd', ['qd/_Qdmodule.c']) )
exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c']) )
exts.append( Extension('Nav', ['Nav.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_AE', ['ae/_AEmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_App', ['app/_Appmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Cm', ['cm/_Cmmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Ctl', ['ctl/_Ctlmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Dlg', ['dlg/_Dlgmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Drag', ['drag/_Dragmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Evt', ['evt/_Evtmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Fm', ['fm/_Fmmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Icn', ['icn/_Icnmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_List', ['list/_Listmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Menu', ['menu/_Menumodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Qd', ['qd/_Qdmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Qdoffs', ['qdoffs/_Qdoffsmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
exts.append( Extension('_Qt', ['qt/_Qtmodule.c'],
extra_link_args=['-framework', 'QuickTime']) )
extra_link_args=['-framework', 'QuickTime', '-framework', 'Carbon']) )
## exts.append( Extension('_Scrap', ['scrap/_Scrapmodule.c']) )
exts.append( Extension('_TE', ['te/_TEmodule.c']) )
exts.append( Extension('_TE', ['te/_TEmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
## exts.append( Extension('waste', ['waste/wastemodule.c']) )
exts.append( Extension('_Win', ['win/_Winmodule.c']) )
exts.append( Extension('_Win', ['win/_Winmodule.c'],
extra_link_args=['-framework', 'Carbon']) )
self.extensions.extend(exts)