Index: configure =================================================================== --- configure (revision 66202) +++ configure (working copy) @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 65857 . +# From configure.in Revision: 66187 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 3.0. # @@ -24380,8 +24380,70 @@ fi +{ echo "$as_me:$LINENO: checking for broken wcschr" >&5 +echo $ECHO_N "checking for broken wcschr... $ECHO_C" >&6; } +if test "$cross_compiling" = yes; then + ac_cv_broken_wcschr=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int main() { + return (wcschr(L"test", L'\0') == NULL); +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_broken_wcschr=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_broken_wcschr=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +{ echo "$as_me:$LINENO: result: $ac_cv_broken_wcschr" >&5 +echo "${ECHO_T}$ac_cv_broken_wcschr" >&6; } +if test "$ac_cv_broken_wcschr" = yes +then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BROKEN_WCSCHR 1 +_ACEOF + +fi + + + for h in `(cd $srcdir;echo Python/thread_*.h)` do THREADHEADERS="$THREADHEADERS \$(srcdir)/$h" Index: Python/sysmodule.c =================================================================== --- Python/sysmodule.c (revision 66202) +++ Python/sysmodule.c (working copy) @@ -1367,8 +1367,13 @@ return NULL; for (i = 0; ; i++) { p = wcschr(path, delim); - if (p == NULL) + if (p == NULL) { +#ifdef HAVE_BROKEN_WCSCHR + p = path + wcslen(path); /* End of string */ +#else p = wcschr(path, L'\0'); /* End of string */ +#endif /* HAVE_BROKEN_WCSCHR */ + } w = PyUnicode_FromWideChar(path, (Py_ssize_t)(p - path)); if (w == NULL) { Py_DECREF(v); Index: configure.in =================================================================== --- configure.in (revision 66202) +++ configure.in (working copy) @@ -3592,6 +3592,24 @@ wide chars that would be converted.]) fi +AC_MSG_CHECKING(for broken wcschr) +AC_TRY_RUN([ +#include +int main() { + return (wcschr(L"test", L'\0') == NULL); +} +], +ac_cv_broken_wcschr=no, +ac_cv_broken_wcschr=yes, +ac_cv_broken_wcschr=no) +AC_MSG_RESULT($ac_cv_broken_wcschr) +if test "$ac_cv_broken_wcschr" = yes +then + AC_DEFINE(HAVE_BROKEN_WCSCHR, 1, + [Define if wcschr(L"text", L'\0') returns NULL instead of a + pointer to the first L'\0'.]) +fi + AC_SUBST(THREADHEADERS) for h in `(cd $srcdir;echo Python/thread_*.h)` Index: PC/getpathp.c =================================================================== --- PC/getpathp.c (revision 66202) +++ PC/getpathp.c (working copy) @@ -539,7 +539,11 @@ if (envpath) { wcscpy(buf, envpath); +#ifdef HAVE_BROKEN_WCSCHR + buf = buf + wcslen(buf); /* End of string */ +#else buf = wcschr(buf, L'\0'); +#endif /* HAVE_BROKEN_WCSCHR */ *buf++ = DELIM; } #ifdef MS_WINDOWS @@ -569,7 +573,11 @@ #else if (pythonhome == NULL) { wcscpy(buf, PYTHONPATH); +#ifdef HAVE_BROKEN_WCSCHR + buf = buf + wcslen(buf); /* End of string */ +#else buf = wcschr(buf, L'\0'); +#endif /* HAVE_BROKEN_WCSCHR */ } #endif /* MS_WINDOWS */ else { @@ -599,7 +607,11 @@ if (argv0_path) { *buf++ = DELIM; wcscpy(buf, argv0_path); +#ifdef HAVE_BROKEN_WCSCHR + buf = buf + wcslen(buf); /* End of string */ +#else buf = wcschr(buf, L'\0'); +#endif /* HAVE_BROKEN_WCSCHR */ } *buf = L'\0'; /* Now to pull one last hack/trick. If sys.prefix is Index: pyconfig.h.in =================================================================== --- pyconfig.h.in (revision 66202) +++ pyconfig.h.in (working copy) @@ -58,6 +58,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_BLUETOOTH_H +/* Define if mbstowcs(NULL, "text", 0) does not return the number of wide + chars that would be converted. */ +#undef HAVE_BROKEN_MBSTOWCS + /* Define if nice() returns success/failure instead of the new priority. */ #undef HAVE_BROKEN_NICE @@ -70,6 +74,10 @@ /* Define if pthread_sigmask() does not work on your system. */ #undef HAVE_BROKEN_PTHREAD_SIGMASK +/* Define if wcschr(L"text", L'\0') returns NULL instead of a pointer to the + first L'\0'. */ +#undef HAVE_BROKEN_WCSCHR + /* Define this if you have the type _Bool. */ #undef HAVE_C99_BOOL @@ -803,10 +811,6 @@ /* Define to 1 if you have the `wcsxfrm' function. */ #undef HAVE_WCSXFRM -/* Define if mbstowcs(NULL, "text", 0) does not return the number of - wide chars that would be converted */ -#undef HAVE_BROKEN_MBSTOWCS - /* Define if tzset() actually switches the local timezone in a meaningful way. */ #undef HAVE_WORKING_TZSET