From buildbot at python.org Sun Oct 1 00:17:53 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 30 Sep 2006 22:17:53 +0000 Subject: [Python-checkins] buildbot warnings in sparc Ubuntu dapper 2.4 Message-ID: <20060930221753.306371E4002@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu dapper 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520Ubuntu%2520dapper%25202.4/builds/144 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 1 00:41:54 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 30 Sep 2006 22:41:54 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian 2.4 Message-ID: <20060930224154.779931E4002@bag.python.org> The Buildbot has detected a new failure of MIPS Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%25202.4/builds/90 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 1 01:30:30 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 30 Sep 2006 23:30:30 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian trunk Message-ID: <20060930233030.C29721E4002@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/580 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Sun Oct 1 23:16:45 2006 From: python-checkins at python.org (kurt.kaiser) Date: Sun, 1 Oct 2006 23:16:45 +0200 (CEST) Subject: [Python-checkins] r52083 - python/trunk/Lib/idlelib/NEWS.txt python/trunk/Lib/idlelib/ScriptBinding.py Message-ID: <20061001211645.B8A931E4002@bag.python.org> Author: kurt.kaiser Date: Sun Oct 1 23:16:45 2006 New Revision: 52083 Modified: python/trunk/Lib/idlelib/NEWS.txt python/trunk/Lib/idlelib/ScriptBinding.py Log: Some syntax errors were being caught by tokenize during the tabnanny check, resulting in obscure error messages. Do the syntax check first. Bug 1562716, 1562719 Modified: python/trunk/Lib/idlelib/NEWS.txt ============================================================================== --- python/trunk/Lib/idlelib/NEWS.txt (original) +++ python/trunk/Lib/idlelib/NEWS.txt Sun Oct 1 23:16:45 2006 @@ -3,6 +3,10 @@ *Release date: XX-XXX-200X* +- Some syntax errors were being caught by tokenize during the tabnanny + check, resulting in obscure error messages. Do the syntax check + first. Bug 1562716, 1562719 + - IDLE's version number takes a big jump to match the version number of the Python release of which it's a part. Modified: python/trunk/Lib/idlelib/ScriptBinding.py ============================================================================== --- python/trunk/Lib/idlelib/ScriptBinding.py (original) +++ python/trunk/Lib/idlelib/ScriptBinding.py Sun Oct 1 23:16:45 2006 @@ -57,9 +57,10 @@ filename = self.getfilename() if not filename: return + if not self.checksyntax(filename): + return if not self.tabnanny(filename): return - self.checksyntax(filename) def tabnanny(self, filename): f = open(filename, 'r') @@ -76,9 +77,6 @@ self.editwin.gotoline(nag.get_lineno()) self.errorbox("Tab/space error", indent_message) return False - except IndentationError: - # From tokenize(), let compile() in checksyntax find it again. - pass return True def checksyntax(self, filename): @@ -139,11 +137,11 @@ filename = self.getfilename() if not filename: return - if not self.tabnanny(filename): - return code = self.checksyntax(filename) if not code: return + if not self.tabnanny(filename): + return shell = self.shell interp = shell.interp if PyShell.use_subprocess: From buildbot at python.org Sun Oct 1 23:22:18 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Oct 2006 21:22:18 +0000 Subject: [Python-checkins] buildbot failure in x86 Ubuntu dapper (icc) trunk Message-ID: <20061001212218.8CCB11E4002@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu dapper (icc) trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520dapper%2520%2528icc%2529%2520trunk/builds/975 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: kurt.kaiser BUILD FAILED: failed configure sincerely, -The Buildbot From python-checkins at python.org Sun Oct 1 23:54:38 2006 From: python-checkins at python.org (kurt.kaiser) Date: Sun, 1 Oct 2006 23:54:38 +0200 (CEST) Subject: [Python-checkins] r52084 - python/trunk/Lib/idlelib/PyShell.py Message-ID: <20061001215438.127961E4002@bag.python.org> Author: kurt.kaiser Date: Sun Oct 1 23:54:37 2006 New Revision: 52084 Modified: python/trunk/Lib/idlelib/PyShell.py Log: Add comment explaining that error msgs may be due to user code when running w/o subprocess. Modified: python/trunk/Lib/idlelib/PyShell.py ============================================================================== --- python/trunk/Lib/idlelib/PyShell.py (original) +++ python/trunk/Lib/idlelib/PyShell.py Sun Oct 1 23:54:37 2006 @@ -726,6 +726,8 @@ raise except: if use_subprocess: + # When run w/o subprocess, both user and IDLE errors + # are printed here; skip message in that case. print >> self.tkconsole.stderr, \ "IDLE internal error in runcode()" self.showtraceback() From buildbot at python.org Mon Oct 2 01:01:23 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Oct 2006 23:01:23 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061001230124.080D31E4003@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%2520trunk/builds/1189 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: kurt.kaiser Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Mon Oct 2 16:55:53 2006 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 2 Oct 2006 16:55:53 +0200 (CEST) Subject: [Python-checkins] r52086 - in python/trunk: Misc/NEWS configure configure.in pyconfig.h.in Message-ID: <20061002145553.138A31E400D@bag.python.org> Author: martin.v.loewis Date: Mon Oct 2 16:55:51 2006 New Revision: 52086 Modified: python/trunk/Misc/NEWS python/trunk/configure python/trunk/configure.in python/trunk/pyconfig.h.in Log: Fix test for uintptr_t. Fixes #1568842. Will backport. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Oct 2 16:55:51 2006 @@ -170,6 +170,8 @@ Build ----- +- Bug #1568842: Fix test for uintptr_t. + - Patch #1540470, for OpenBSD 4.0. Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Mon Oct 2 16:55:51 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 51727 . +# From configure.in Revision: 51971 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.6. # @@ -10073,20 +10073,26 @@ fi -echo "$as_me:$LINENO: checking for uintptr_t support" >&5 -echo $ECHO_N "checking for uintptr_t support... $ECHO_C" >&6 -have_uintptr_t=no -cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 +if test "${ac_cv_type_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +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 () { -uintptr_t x; x = (uintptr_t)0; +if ((uintptr_t *) 0) + return 0; +if (sizeof (uintptr_t)) + return 0; ; return 0; } @@ -10113,23 +10119,23 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF - - have_uintptr_t=yes - + ac_cv_type_uintptr_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_uintptr_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $have_uintptr_t" >&5 -echo "${ECHO_T}$have_uintptr_t" >&6 -if test "$have_uintptr_t" = yes ; then +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 +if test $ac_cv_type_uintptr_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINTPTR_T 1 +_ACEOF + echo "$as_me:$LINENO: checking for uintptr_t" >&5 echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 if test "${ac_cv_type_uintptr_t+set}" = set; then @@ -10546,6 +10552,8 @@ fi + + # Hmph. AC_CHECK_SIZEOF() doesn't include . echo "$as_me:$LINENO: checking size of off_t" >&5 echo $ECHO_N "checking size of off_t... $ECHO_C" >&6 Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Mon Oct 2 16:55:51 2006 @@ -1197,16 +1197,10 @@ AC_CHECK_SIZEOF(long long, 8) fi -AC_MSG_CHECKING(for uintptr_t support) -have_uintptr_t=no -AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [ - AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.]) - have_uintptr_t=yes -]) -AC_MSG_RESULT($have_uintptr_t) -if test "$have_uintptr_t" = yes ; then -AC_CHECK_SIZEOF(uintptr_t, 4) -fi +AC_CHECK_TYPES(uintptr_t, + [AC_CHECK_SIZEOF(uintptr_t, 4)], + [], [#include ]) + # Hmph. AC_CHECK_SIZEOF() doesn't include . AC_MSG_CHECKING(size of off_t) Modified: python/trunk/pyconfig.h.in ============================================================================== --- python/trunk/pyconfig.h.in (original) +++ python/trunk/pyconfig.h.in Mon Oct 2 16:55:51 2006 @@ -677,7 +677,7 @@ /* Define this if you have tcl and TCL_UTF_MAX==6 */ #undef HAVE_UCS4_TCL -/* Define this if you have the type uintptr_t. */ +/* Define to 1 if the system has the type `uintptr_t'. */ #undef HAVE_UINTPTR_T /* Define to 1 if you have the `uname' function. */ From python-checkins at python.org Mon Oct 2 16:56:17 2006 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 2 Oct 2006 16:56:17 +0200 (CEST) Subject: [Python-checkins] r52087 - in python/branches/release25-maint: Misc/NEWS configure configure.in pyconfig.h.in Message-ID: <20061002145617.2B1791E401A@bag.python.org> Author: martin.v.loewis Date: Mon Oct 2 16:56:15 2006 New Revision: 52087 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/configure python/branches/release25-maint/configure.in python/branches/release25-maint/pyconfig.h.in Log: Fix test for uintptr_t. Fixes #1568842. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Oct 2 16:56:15 2006 @@ -183,6 +183,8 @@ Build ----- +- Bug #1568842: Fix test for uintptr_t. + - Patch #1540470, for OpenBSD 4.0. - Patch #1545507: Exclude ctypes package in Win64 MSI file. Modified: python/branches/release25-maint/configure ============================================================================== --- python/branches/release25-maint/configure (original) +++ python/branches/release25-maint/configure Mon Oct 2 16:56:15 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 51727 . +# From configure.in Revision: 51998 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.5. # @@ -10073,20 +10073,26 @@ fi -echo "$as_me:$LINENO: checking for uintptr_t support" >&5 -echo $ECHO_N "checking for uintptr_t support... $ECHO_C" >&6 -have_uintptr_t=no -cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 +if test "${ac_cv_type_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +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 () { -uintptr_t x; x = (uintptr_t)0; +if ((uintptr_t *) 0) + return 0; +if (sizeof (uintptr_t)) + return 0; ; return 0; } @@ -10113,23 +10119,23 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF - - have_uintptr_t=yes - + ac_cv_type_uintptr_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_uintptr_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $have_uintptr_t" >&5 -echo "${ECHO_T}$have_uintptr_t" >&6 -if test "$have_uintptr_t" = yes ; then +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 +if test $ac_cv_type_uintptr_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINTPTR_T 1 +_ACEOF + echo "$as_me:$LINENO: checking for uintptr_t" >&5 echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 if test "${ac_cv_type_uintptr_t+set}" = set; then @@ -10546,6 +10552,8 @@ fi + + # Hmph. AC_CHECK_SIZEOF() doesn't include . echo "$as_me:$LINENO: checking size of off_t" >&5 echo $ECHO_N "checking size of off_t... $ECHO_C" >&6 Modified: python/branches/release25-maint/configure.in ============================================================================== --- python/branches/release25-maint/configure.in (original) +++ python/branches/release25-maint/configure.in Mon Oct 2 16:56:15 2006 @@ -1197,16 +1197,10 @@ AC_CHECK_SIZEOF(long long, 8) fi -AC_MSG_CHECKING(for uintptr_t support) -have_uintptr_t=no -AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [ - AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.]) - have_uintptr_t=yes -]) -AC_MSG_RESULT($have_uintptr_t) -if test "$have_uintptr_t" = yes ; then -AC_CHECK_SIZEOF(uintptr_t, 4) -fi +AC_CHECK_TYPES(uintptr_t, + [AC_CHECK_SIZEOF(uintptr_t, 4)], + [], [#include ]) + # Hmph. AC_CHECK_SIZEOF() doesn't include . AC_MSG_CHECKING(size of off_t) Modified: python/branches/release25-maint/pyconfig.h.in ============================================================================== --- python/branches/release25-maint/pyconfig.h.in (original) +++ python/branches/release25-maint/pyconfig.h.in Mon Oct 2 16:56:15 2006 @@ -677,7 +677,7 @@ /* Define this if you have tcl and TCL_UTF_MAX==6 */ #undef HAVE_UCS4_TCL -/* Define this if you have the type uintptr_t. */ +/* Define to 1 if the system has the type `uintptr_t'. */ #undef HAVE_UINTPTR_T /* Define to 1 if you have the `uname' function. */ From python-checkins at python.org Mon Oct 2 16:56:32 2006 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 2 Oct 2006 16:56:32 +0200 (CEST) Subject: [Python-checkins] r52088 - in python/branches/release24-maint: Misc/NEWS configure configure.in pyconfig.h.in Message-ID: <20061002145632.37B051E4005@bag.python.org> Author: martin.v.loewis Date: Mon Oct 2 16:56:30 2006 New Revision: 52088 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/configure python/branches/release24-maint/configure.in python/branches/release24-maint/pyconfig.h.in Log: Fix test for uintptr_t. Fixes #1568842. Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Mon Oct 2 16:56:30 2006 @@ -210,6 +210,8 @@ Build ----- +- Bug #1568842: Fix test for uintptr_t. + - Bug #1439538: Drop usage of test -e in configure as it is not portable. - Bug #1502728: Correctly link against librt library on HP-UX. Modified: python/branches/release24-maint/configure ============================================================================== --- python/branches/release24-maint/configure (original) +++ python/branches/release24-maint/configure Mon Oct 2 16:56:30 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 46609 . +# From configure.in Revision: 52044 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.4. # @@ -1514,7 +1514,7 @@ # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE # disables platform specific features beyond repair. # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # has no effect, don't bother defineing them + # has no effect, don't bother defining them Darwin/[78].*) define_xopen_source=no ;; @@ -9457,20 +9457,26 @@ fi -echo "$as_me:$LINENO: checking for uintptr_t support" >&5 -echo $ECHO_N "checking for uintptr_t support... $ECHO_C" >&6 -have_uintptr_t=no -cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 +if test "${ac_cv_type_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +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 () { -uintptr_t x; x = (uintptr_t)0; +if ((uintptr_t *) 0) + return 0; +if (sizeof (uintptr_t)) + return 0; ; return 0; } @@ -9497,23 +9503,23 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF - - have_uintptr_t=yes - + ac_cv_type_uintptr_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_uintptr_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $have_uintptr_t" >&5 -echo "${ECHO_T}$have_uintptr_t" >&6 -if test "$have_uintptr_t" = yes ; then +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 +if test $ac_cv_type_uintptr_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINTPTR_T 1 +_ACEOF + echo "$as_me:$LINENO: checking for uintptr_t" >&5 echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 if test "${ac_cv_type_uintptr_t+set}" = set; then @@ -9930,6 +9936,8 @@ fi + + # Hmph. AC_CHECK_SIZEOF() doesn't include . echo "$as_me:$LINENO: checking size of off_t" >&5 echo $ECHO_N "checking size of off_t... $ECHO_C" >&6 Modified: python/branches/release24-maint/configure.in ============================================================================== --- python/branches/release24-maint/configure.in (original) +++ python/branches/release24-maint/configure.in Mon Oct 2 16:56:30 2006 @@ -1100,16 +1100,10 @@ AC_CHECK_SIZEOF(long long, 8) fi -AC_MSG_CHECKING(for uintptr_t support) -have_uintptr_t=no -AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [ - AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.]) - have_uintptr_t=yes -]) -AC_MSG_RESULT($have_uintptr_t) -if test "$have_uintptr_t" = yes ; then -AC_CHECK_SIZEOF(uintptr_t, 4) -fi +AC_CHECK_TYPES(uintptr_t, + [AC_CHECK_SIZEOF(uintptr_t, 4)], + [], [#include ]) + # Hmph. AC_CHECK_SIZEOF() doesn't include . AC_MSG_CHECKING(size of off_t) Modified: python/branches/release24-maint/pyconfig.h.in ============================================================================== --- python/branches/release24-maint/pyconfig.h.in (original) +++ python/branches/release24-maint/pyconfig.h.in Mon Oct 2 16:56:30 2006 @@ -614,7 +614,7 @@ /* Define this if you have tcl and TCL_UTF_MAX==6 */ #undef HAVE_UCS4_TCL -/* Define this if you have the type uintptr_t. */ +/* Define to 1 if the system has the type `uintptr_t'. */ #undef HAVE_UINTPTR_T /* Define to 1 if you have the `uname' function. */ From buildbot at python.org Mon Oct 2 17:01:25 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:01:25 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20061002150126.01A211E4003@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/1632 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:01:37 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:01:37 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20061002150137.E29C61E4003@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/1546 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:01:48 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:01:48 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk trunk Message-ID: <20061002150148.F2D3E1E4003@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/129 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:01:57 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:01:57 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 2.5 Message-ID: <20061002150157.B2BC61E4003@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%25202.5/builds/56 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:02:20 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:02:20 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 2.5 Message-ID: <20061002150220.C24651E4003@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%25202.5/builds/56 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:02:25 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:02:25 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 2.4 Message-ID: <20061002150225.DEACC1E4003@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%25202.4/builds/235 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:02:43 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:02:43 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk 2.5 Message-ID: <20061002150244.2723E1E4005@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%25202.5/builds/51 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:02:57 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:02:57 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian trunk Message-ID: <20061002150257.963F41E4003@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%2520trunk/builds/413 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:02:58 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:02:58 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 2.4 Message-ID: <20061002150258.817ED1E400D@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%25202.4/builds/236 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:03:34 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:03:34 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk 2.4 Message-ID: <20061002150334.5B35E1E402C@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%25202.4/builds/25 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:03:45 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:03:45 +0000 Subject: [Python-checkins] buildbot failure in hppa Ubuntu dapper trunk Message-ID: <20061002150345.767411E400A@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/118 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:04:14 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:04:14 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu dapper trunk Message-ID: <20061002150414.551BA1E4003@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520Ubuntu%2520dapper%2520trunk/builds/721 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:04:59 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:04:59 +0000 Subject: [Python-checkins] buildbot failure in alpha Debian 2.5 Message-ID: <20061002150459.39A9D1E4003@bag.python.org> The Buildbot has detected a new failure of alpha Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%25202.5/builds/45 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:05:15 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:05:15 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 2.5 Message-ID: <20061002150515.8FCEE1E40BA@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%25202.5/builds/43 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:05:30 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:05:30 +0000 Subject: [Python-checkins] buildbot failure in MIPS Debian trunk Message-ID: <20061002150531.153E61E41AF@bag.python.org> The Buildbot has detected a new failure of MIPS Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%2520trunk/builds/425 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:06:28 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:06:28 +0000 Subject: [Python-checkins] buildbot failure in hppa Ubuntu dapper 2.5 Message-ID: <20061002150628.98C751E4003@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.5/builds/45 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:07:13 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:07:13 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 2.4 Message-ID: <20061002150713.AFC931E4003@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%25202.4/builds/71 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:07:28 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:07:28 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu dapper 2.5 Message-ID: <20061002150728.EF33A1E4003@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu dapper 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520Ubuntu%2520dapper%25202.5/builds/41 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:08:37 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:08:37 +0000 Subject: [Python-checkins] buildbot failure in alpha Debian trunk Message-ID: <20061002150837.634661E400C@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/583 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:08:57 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:08:57 +0000 Subject: [Python-checkins] buildbot failure in hppa Ubuntu dapper 2.4 Message-ID: <20061002150857.69F541E401A@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.4/builds/23 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:10:25 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:10:25 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu dapper 2.4 Message-ID: <20061002151025.70C5E1E4011@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu dapper 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520Ubuntu%2520dapper%25202.4/builds/146 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:10:29 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:10:29 +0000 Subject: [Python-checkins] buildbot failure in MIPS Debian 2.5 Message-ID: <20061002151029.9C9DE1E401E@bag.python.org> The Buildbot has detected a new failure of MIPS Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%25202.5/builds/24 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:12:09 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:12:09 +0000 Subject: [Python-checkins] buildbot failure in alpha Debian 2.4 Message-ID: <20061002151209.A83031E4003@bag.python.org> The Buildbot has detected a new failure of alpha Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%25202.4/builds/31 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 17:14:57 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 15:14:57 +0000 Subject: [Python-checkins] buildbot failure in MIPS Debian 2.4 Message-ID: <20061002151457.79C321E4013@bag.python.org> The Buildbot has detected a new failure of MIPS Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%2520Debian%25202.4/builds/92 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Mon Oct 2 17:20:38 2006 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 2 Oct 2006 17:20:38 +0200 (CEST) Subject: [Python-checkins] r52089 - in python/trunk: Include/pyport.h configure configure.in Message-ID: <20061002152038.768F71E4015@bag.python.org> Author: martin.v.loewis Date: Mon Oct 2 17:20:37 2006 New Revision: 52089 Modified: python/trunk/Include/pyport.h python/trunk/configure python/trunk/configure.in Log: Guard uintptr_t test with HAVE_STDINT_H, test for stdint.h. Will backport. Modified: python/trunk/Include/pyport.h ============================================================================== --- python/trunk/Include/pyport.h (original) +++ python/trunk/Include/pyport.h Mon Oct 2 17:20:37 2006 @@ -3,6 +3,10 @@ #include "pyconfig.h" /* include for defines */ +#ifdef HAVE_STDINT_H +#include +#endif + /************************************************************************** Symbols and macros to supply platform-independent interfaces to basic C language & library operations whose spellings vary across platforms. Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Mon Oct 2 17:20:37 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 51971 . +# From configure.in Revision: 52086 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.6. # @@ -4631,10 +4631,11 @@ + for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ -shadow.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ -signal.h stropts.h termios.h thread.h \ +io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ +shadow.h signal.h stdint.h stropts.h termios.h thread.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \ sys/modem.h \ @@ -10084,7 +10085,9 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#ifdef HAVE_STDINT_H + #include + #endif int main () Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Mon Oct 2 17:20:37 2006 @@ -1068,8 +1068,8 @@ AC_HEADER_STDC AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ -shadow.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ -signal.h stropts.h termios.h thread.h \ +io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ +shadow.h signal.h stdint.h stropts.h termios.h thread.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \ sys/modem.h \ @@ -1199,7 +1199,9 @@ AC_CHECK_TYPES(uintptr_t, [AC_CHECK_SIZEOF(uintptr_t, 4)], - [], [#include ]) + [], [#ifdef HAVE_STDINT_H + #include + #endif]) # Hmph. AC_CHECK_SIZEOF() doesn't include . From python-checkins at python.org Mon Oct 2 17:24:02 2006 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 2 Oct 2006 17:24:02 +0200 (CEST) Subject: [Python-checkins] r52090 - in python/branches/release25-maint: Include/pyport.h configure configure.in Message-ID: <20061002152402.C84A41E400D@bag.python.org> Author: martin.v.loewis Date: Mon Oct 2 17:24:01 2006 New Revision: 52090 Modified: python/branches/release25-maint/Include/pyport.h python/branches/release25-maint/configure python/branches/release25-maint/configure.in Log: Guard uintptr_t test with HAVE_STDINT_H, test for stdint.h. Modified: python/branches/release25-maint/Include/pyport.h ============================================================================== --- python/branches/release25-maint/Include/pyport.h (original) +++ python/branches/release25-maint/Include/pyport.h Mon Oct 2 17:24:01 2006 @@ -3,6 +3,10 @@ #include "pyconfig.h" /* include for defines */ +#ifdef HAVE_STDINT_H +#include +#endif + /************************************************************************** Symbols and macros to supply platform-independent interfaces to basic C language & library operations whose spellings vary across platforms. Modified: python/branches/release25-maint/configure ============================================================================== --- python/branches/release25-maint/configure (original) +++ python/branches/release25-maint/configure Mon Oct 2 17:24:01 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 51998 . +# From configure.in Revision: 52087 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.5. # @@ -4631,10 +4631,11 @@ + for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ -shadow.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ -signal.h stropts.h termios.h thread.h \ +io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ +shadow.h signal.h stdint.h stropts.h termios.h thread.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \ sys/modem.h \ @@ -10084,7 +10085,9 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#ifdef HAVE_STDINT_H + #include + #endif int main () Modified: python/branches/release25-maint/configure.in ============================================================================== --- python/branches/release25-maint/configure.in (original) +++ python/branches/release25-maint/configure.in Mon Oct 2 17:24:01 2006 @@ -1068,8 +1068,8 @@ AC_HEADER_STDC AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ -shadow.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ -signal.h stropts.h termios.h thread.h \ +io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ +shadow.h signal.h stdint.h stropts.h termios.h thread.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \ sys/modem.h \ @@ -1199,7 +1199,9 @@ AC_CHECK_TYPES(uintptr_t, [AC_CHECK_SIZEOF(uintptr_t, 4)], - [], [#include ]) + [], [#ifdef HAVE_STDINT_H + #include + #endif]) # Hmph. AC_CHECK_SIZEOF() doesn't include . From python-checkins at python.org Mon Oct 2 17:24:16 2006 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 2 Oct 2006 17:24:16 +0200 (CEST) Subject: [Python-checkins] r52091 - in python/branches/release24-maint: Include/pyport.h configure configure.in Message-ID: <20061002152416.6CB711E4019@bag.python.org> Author: martin.v.loewis Date: Mon Oct 2 17:24:15 2006 New Revision: 52091 Modified: python/branches/release24-maint/Include/pyport.h python/branches/release24-maint/configure python/branches/release24-maint/configure.in Log: Guard uintptr_t test with HAVE_STDINT_H, test for stdint.h. Modified: python/branches/release24-maint/Include/pyport.h ============================================================================== --- python/branches/release24-maint/Include/pyport.h (original) +++ python/branches/release24-maint/Include/pyport.h Mon Oct 2 17:24:15 2006 @@ -3,6 +3,10 @@ #include "pyconfig.h" /* include for defines */ +#ifdef HAVE_STDINT_H +#include +#endif + /************************************************************************** Symbols and macros to supply platform-independent interfaces to basic C language & library operations whose spellings vary across platforms. Modified: python/branches/release24-maint/configure ============================================================================== --- python/branches/release24-maint/configure (original) +++ python/branches/release24-maint/configure Mon Oct 2 17:24:15 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52044 . +# From configure.in Revision: 52088 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.4. # @@ -4565,9 +4565,10 @@ + for ac_header in curses.h dlfcn.h fcntl.h grp.h langinfo.h \ libintl.h ncurses.h poll.h pthread.h \ -stropts.h termios.h thread.h \ +stdint.h stropts.h termios.h thread.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \ sys/modem.h \ @@ -9468,7 +9469,9 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#ifdef HAVE_STDINT_H + #include + #endif int main () Modified: python/branches/release24-maint/configure.in ============================================================================== --- python/branches/release24-maint/configure.in (original) +++ python/branches/release24-maint/configure.in Mon Oct 2 17:24:15 2006 @@ -986,7 +986,7 @@ AC_HEADER_STDC AC_CHECK_HEADERS(curses.h dlfcn.h fcntl.h grp.h langinfo.h \ libintl.h ncurses.h poll.h pthread.h \ -stropts.h termios.h thread.h \ +stdint.h stropts.h termios.h thread.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \ sys/modem.h \ @@ -1102,7 +1102,9 @@ AC_CHECK_TYPES(uintptr_t, [AC_CHECK_SIZEOF(uintptr_t, 4)], - [], [#include ]) + [], [#ifdef HAVE_STDINT_H + #include + #endif]) # Hmph. AC_CHECK_SIZEOF() doesn't include . From buildbot at python.org Mon Oct 2 18:16:37 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 16:16:37 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian trunk Message-ID: <20061002161637.953891E4018@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/584 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 18:41:31 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 16:41:31 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20061002164131.509B91E4003@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.5/builds/46 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 19:36:56 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 17:36:56 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk 2.4 Message-ID: <20061002173656.E1DB61E4005@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%25202.4/builds/26 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Mon Oct 2 19:53:16 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 17:53:16 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian 2.4 Message-ID: <20061002175316.9A8DA1E4003@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%25202.4/builds/72 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Mon Oct 2 21:43:23 2006 From: python-checkins at python.org (brett.cannon) Date: Mon, 2 Oct 2006 21:43:23 +0200 (CEST) Subject: [Python-checkins] r52092 - python/branches/pep302_phase2 Message-ID: <20061002194323.AEC4C1E4003@bag.python.org> Author: brett.cannon Date: Mon Oct 2 21:43:22 2006 New Revision: 52092 Added: python/branches/pep302_phase2/ - copied from r52091, python/trunk/ Log: Contain work to refactor built-in import machinery to use sys.path_hooks and sys.meta_path as introduced by PEP 302. From python-checkins at python.org Mon Oct 2 21:53:19 2006 From: python-checkins at python.org (brett.cannon) Date: Mon, 2 Oct 2006 21:53:19 +0200 (CEST) Subject: [Python-checkins] r52093 - python/branches/pep302_phase2 Message-ID: <20061002195319.4E9A01E4003@bag.python.org> Author: brett.cannon Date: Mon Oct 2 21:53:18 2006 New Revision: 52093 Modified: python/branches/pep302_phase2/ (props changed) Log: Initialized merge tracking via "svnmerge" with revisions "1-52091" from svn+ssh://pythondev at svn.python.org/python/trunk From steven.bethard at gmail.com Mon Oct 2 21:59:42 2006 From: steven.bethard at gmail.com (Steven Bethard) Date: Mon, 2 Oct 2006 13:59:42 -0600 Subject: [Python-checkins] PEP topic filter Message-ID: Would it be possible to update the PEP topic filter to something like "peps/trunk" instead of just "PEP"? The current setup means those of us just subscribed to the PEP topic filter are going to get every one of Brett's python/branches/pep302_phase2 checkins. Steven Bethard -- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy From buildbot at python.org Mon Oct 2 22:07:10 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Oct 2006 20:07:10 +0000 Subject: [Python-checkins] buildbot failure in x86 Ubuntu dapper (icc) 2.5 Message-ID: <20061002200710.699681E4003@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu dapper (icc) 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520dapper%2520%2528icc%2529%25202.5/builds/42 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed configure sincerely, -The Buildbot From martin at v.loewis.de Mon Oct 2 22:13:16 2006 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Mon, 02 Oct 2006 22:13:16 +0200 Subject: [Python-checkins] PEP topic filter In-Reply-To: References: Message-ID: <452172DC.2030706@v.loewis.de> Steven Bethard schrieb: > Would it be possible to update the PEP topic filter to something like > "peps/trunk" instead of just "PEP"? The current setup means those of > us just subscribed to the PEP topic filter are going to get every one > of Brett's python/branches/pep302_phase2 checkins. If you tell me what the "PEP topic filter" is, I can try to modify it. Regards, Martin From steven.bethard at gmail.com Mon Oct 2 22:39:05 2006 From: steven.bethard at gmail.com (Steven Bethard) Date: Mon, 2 Oct 2006 14:39:05 -0600 Subject: [Python-checkins] PEP topic filter In-Reply-To: <452172DC.2030706@v.loewis.de> References: <452172DC.2030706@v.loewis.de> Message-ID: On 10/2/06, "Martin v. L?wis" wrote: > Steven Bethard schrieb: > > Would it be possible to update the PEP topic filter to something like > > "peps/trunk" instead of just "PEP"? The current setup means those of > > us just subscribed to the PEP topic filter are going to get every one > > of Brett's python/branches/pep302_phase2 checkins. > > If you tell me what the "PEP topic filter" is, I can try to modify it. I believe it was introduced by Barry Warsaw in January 2005: http://mail.python.org/pipermail/python-dev/2005-January/050747.html I'm not exactly sure how to modify it, but if I look at: http://mail.python.org/mailman/listinfo/python-checkins then go to the bottom, type in my email address and click "Unsubscribe or edit options", I can see my status page. Under "Which topic categories would you like to subscribe to?" I see one possible selection, "peps", which for me is checked. I can click on "details" beside it to see the regexp that it's matching, but AFAICT, I can't modify the topic filter. Thanks for looking into this. Steven Bethard -- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy From python-checkins at python.org Mon Oct 2 23:03:24 2006 From: python-checkins at python.org (brett.cannon) Date: Mon, 2 Oct 2006 23:03:24 +0200 (CEST) Subject: [Python-checkins] r52094 - python/branches/pep302_phase2/BRANCH_PLANS Message-ID: <20061002210324.A6B001E4003@bag.python.org> Author: brett.cannon Date: Mon Oct 2 23:03:24 2006 New Revision: 52094 Added: python/branches/pep302_phase2/BRANCH_PLANS (contents, props changed) Log: Initial outline of the what/why/how for this branch (including open issues). Added: python/branches/pep302_phase2/BRANCH_PLANS ============================================================================== --- (empty file) +++ python/branches/pep302_phase2/BRANCH_PLANS Mon Oct 2 23:03:24 2006 @@ -0,0 +1,93 @@ +WHAT +============================= + +Implement phase 2 of `PEP 302`_. This entails refactoring the built-in import +machinery for built-in, frozen, py, pyc, and extension modules and packages to +use the abilities introduced by PEP 302. + +.. _PEP 302: http://www.python.org/dev/peps/pep-0302/ + + +WHY +============================= + +As it stands now in Python 2.5, the built-in import machinery is an +all-or-nothing proposition. Either you support all six different types of +imports or you support none. By factoring these different types of imports +into individual objects it allows much more control over what imports are to be +allowed. + +This provides several benefits. One is for security. One will have the +ability to remove support for specific types of modules from being imported, +allowing for fine-grained control over the abilities of an interpreter. + +It also allows for more customized imports. For instance, it should help +simplify writing more caching support into importers to help in situations +where reading and writing to the filesystem is expensive. It should also help +in situations where a file requires some pre-processing before being imported. + + +HOW +============================= + +PEP 302 introduces two lists to the 'sys' module that have different uses: +sys.meta_path and sys.path_hooks. The former is meant for importers that have +no need for a specific token (e.g., file path, etc.) to work. The latter is +for factory functions that do require some context to specify how they should +work. + +For the imports that require the filesystem, they will be factored out into +data handlers. These handlers will then be used with a filesystem importer to +handle importation of files. This allows for easy ordering of import +preference in terms of file type. It also allows a directory listed on +sys.path to work with multiple types of imports instead of just one. + +* .py + Data handler to be used by the filesystem importer. + +* .pyc/.pyo + Data handler to be used by the filesystem importer. + +* extension + Data handler to be used by the filesystem importer. + +* built-in + meta_path importer. + +* frozen + meta_path importer. + +* package + Data handler to be used by the filesystem importer. + + +ISSUES +------------------- + +* API for data handlers. + + Support associating data type with handler. + - Use 'imp' constants? + - Use reasonable string names (e.g., '.py', '.so', etc.)? + - Worry about supporting third-party types (e.g., .ptl)? + + Actual importing + - handle_path() function. + * Pass in module, or have handler deal with module creation itself? + * Bother with supporting more than just giving file path to data + handler? + * Need import name if giving module to populate? + * Need package name if giving module to populate? + - handle_data() function. + * Totally optional/random idea. + * Allow for working off of string. + - handle_file() function. + * Totally optional/random idea. + * Allow for working off of file object. +* How does any of this affect zipimport? +* Best way to handle packages + + As a data handler for the filesystem importer? + + As part of the filesystem importer itself? +* Writing out .pyc files optional for .py importer? + + +What's New in this Branch? +========================== From python-checkins at python.org Mon Oct 2 23:05:01 2006 From: python-checkins at python.org (brett.cannon) Date: Mon, 2 Oct 2006 23:05:01 +0200 (CEST) Subject: [Python-checkins] r52095 - python/branches/pep302_phase2/BRANCH_PLANS Message-ID: <20061002210501.5489F1E4003@bag.python.org> Author: brett.cannon Date: Mon Oct 2 23:05:01 2006 New Revision: 52095 Modified: python/branches/pep302_phase2/BRANCH_PLANS Log: Add issue about what to do with None values in sys.path_importer_cache . Modified: python/branches/pep302_phase2/BRANCH_PLANS ============================================================================== --- python/branches/pep302_phase2/BRANCH_PLANS (original) +++ python/branches/pep302_phase2/BRANCH_PLANS Mon Oct 2 23:05:01 2006 @@ -87,6 +87,11 @@ + As a data handler for the filesystem importer? + As part of the filesystem importer itself? * Writing out .pyc files optional for .py importer? +* What about use of None as a value in sys.path_importer_cache? + + Shouldn't be needed after this. + + Make it a no-op? + + Add an entry in 'sys' for a default factory function that gets called for + None entries? What's New in this Branch? From martin at v.loewis.de Tue Oct 3 08:26:53 2006 From: martin at v.loewis.de (=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=) Date: Tue, 03 Oct 2006 08:26:53 +0200 Subject: [Python-checkins] PEP topic filter In-Reply-To: References: <452172DC.2030706@v.loewis.de> Message-ID: <452202AD.3080207@v.loewis.de> Steven Bethard schrieb: > I believe it was introduced by Barry Warsaw in January 2005: > http://mail.python.org/pipermail/python-dev/2005-January/050747.html Ah, it's on the mailing list, not on generating these messages. Then I can't do anything about it. Regards, Martin From anthony at interlink.com.au Tue Oct 3 11:29:44 2006 From: anthony at interlink.com.au (Anthony Baxter) Date: Tue, 3 Oct 2006 19:29:44 +1000 Subject: [Python-checkins] PEP topic filter In-Reply-To: <452202AD.3080207@v.loewis.de> References: <452202AD.3080207@v.loewis.de> Message-ID: <200610031929.46789.anthony@interlink.com.au> On Tuesday 03 October 2006 16:26, Martin v. L?wis wrote: > Steven Bethard schrieb: > > I believe it was introduced by Barry Warsaw in January 2005: > > http://mail.python.org/pipermail/python-dev/2005-January/050747.html > > Ah, it's on the mailing list, not on generating these messages. > Then I can't do anything about it. Probably dropping a note to postmaster is the appropriate thing to do here. Barry or Brad would know how to change it. Anthony From sjoerd at acm.org Tue Oct 3 11:44:52 2006 From: sjoerd at acm.org (Sjoerd Mullender) Date: Tue, 03 Oct 2006 11:44:52 +0200 Subject: [Python-checkins] PEP topic filter In-Reply-To: <200610031929.46789.anthony@interlink.com.au> References: <452202AD.3080207@v.loewis.de> <200610031929.46789.anthony@interlink.com.au> Message-ID: <45223114.9050309@acm.org> On 2006-10-03 11:29, Anthony Baxter wrote: > On Tuesday 03 October 2006 16:26, Martin v. L?wis wrote: >> Steven Bethard schrieb: >>> I believe it was introduced by Barry Warsaw in January 2005: >>> http://mail.python.org/pipermail/python-dev/2005-January/050747.html >> Ah, it's on the mailing list, not on generating these messages. >> Then I can't do anything about it. > > Probably dropping a note to postmaster is the appropriate thing to do here. > Barry or Brad would know how to change it. Better: the mailing list maintainer python-checkins-owner at python.org (Barry and Fred). -- Sjoerd Mullender -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 370 bytes Desc: OpenPGP digital signature Url : http://mail.python.org/pipermail/python-checkins/attachments/20061003/0559aa0e/attachment.pgp From barry at python.org Tue Oct 3 13:36:09 2006 From: barry at python.org (Barry Warsaw) Date: Tue, 3 Oct 2006 07:36:09 -0400 Subject: [Python-checkins] PEP topic filter In-Reply-To: References: Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Oct 2, 2006, at 3:59 PM, Steven Bethard wrote: > Would it be possible to update the PEP topic filter to something like > "peps/trunk" instead of just "PEP"? The current setup means those of > us just subscribed to the PEP topic filter are going to get every one > of Brett's python/branches/pep302_phase2 checkins. Good idea. I've updated the regexp to "peps/trunk" as suggested (sans quotes). Can someone make an innocent checkin to that directory to see if that does the trick? - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iQCVAwUBRSJLL3EjvBPtnXfVAQK3fwQAoifWkHbHh19PYtt7yKL1t7QNBlAgK4DA OeB7RqdPvVrC8mIRMuLL9e9tdEs+J2DFxYBvfGYIb/ABjpzWqNpFOyqdFWoolkiK trG3md0VL82gzuZnQSmGXjkSzd2R2Kx3CW2mt+vK1vlOXW+INyE2UQesThca0vS2 fa3rHrhUd9I= =fpcy -----END PGP SIGNATURE----- From python-checkins at python.org Tue Oct 3 14:58:53 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 14:58:53 +0200 (CEST) Subject: [Python-checkins] r52096 - in python/branches/release24-maint: Misc/NEWS Objects/cellobject.c Message-ID: <20061003125853.858761E4003@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 14:58:52 2006 New Revision: 52096 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/cellobject.c Log: [Backport rev. 47171 by neal.norwitz] Another problem reported by Coverity. Backport candidate. Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Oct 3 14:58:52 2006 @@ -25,7 +25,7 @@ - Overflow checking code in integer division ran afoul of new gcc optimizations. Changed to be more standard-conforming. -- Fix warnings reported by Klocwork's static analysis tool. +- Fix warnings reported by the Coverity and Klocwork static analysis tools. - Patch #1541585: fix buffer overrun when performing repr() on a unicode string in a build with wide unicode (UCS-4) support. Modified: python/branches/release24-maint/Objects/cellobject.c ============================================================================== --- python/branches/release24-maint/Objects/cellobject.c (original) +++ python/branches/release24-maint/Objects/cellobject.c Tue Oct 3 14:58:52 2006 @@ -8,6 +8,8 @@ PyCellObject *op; op = (PyCellObject *)PyObject_GC_New(PyCellObject, &PyCell_Type); + if (op == NULL) + return NULL; op->ob_ref = obj; Py_XINCREF(obj); From python-checkins at python.org Tue Oct 3 15:04:30 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 15:04:30 +0200 (CEST) Subject: [Python-checkins] r52097 - in python/branches/release24-maint: Misc/NEWS Objects/fileobject.c Message-ID: <20061003130430.CEB6C1E4003@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 15:04:29 2006 New Revision: 52097 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/fileobject.c Log: [Backport rev. 51669 by brett.cannon] Make sure memory is properly cleaned up in file_init. Backport candidate. Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Oct 3 15:04:29 2006 @@ -21,6 +21,8 @@ - Bug #1365916: Fix an int/long mismatch in the sorted() built-in. - Fix memory leak of coding spec in Parser/tokenizer.c. + +- Fix memory leak in file_init. - Overflow checking code in integer division ran afoul of new gcc optimizations. Changed to be more standard-conforming. @@ -54,7 +56,7 @@ - Patch #1488312, Fix memory alignment problem on SPARC in unicode -- Fixed a few bugs on cjkcodecs: +- Fixed a few bugs in cjkcodecs: - gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly. - iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312 codepoints to conform the standard. Modified: python/branches/release24-maint/Objects/fileobject.c ============================================================================== --- python/branches/release24-maint/Objects/fileobject.c (original) +++ python/branches/release24-maint/Objects/fileobject.c Tue Oct 3 15:04:29 2006 @@ -1878,7 +1878,7 @@ /* We parse again to get the name as a PyObject */ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:file", kwlist, &o_name, &mode, &bufsize)) - return -1; + goto Error; if (fill_file_fields(foself, NULL, o_name, mode, fclose) == NULL) From python-checkins at python.org Tue Oct 3 15:08:59 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 15:08:59 +0200 (CEST) Subject: [Python-checkins] r52098 - in python/branches/release24-maint: Lib/test/test_fcntl.py Lib/test/test_tempfile.py Misc/NEWS configure configure.in Message-ID: <20061003130859.09CEC1E4003@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 15:08:57 2006 New Revision: 52098 Modified: python/branches/release24-maint/Lib/test/test_fcntl.py python/branches/release24-maint/Lib/test/test_tempfile.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/configure python/branches/release24-maint/configure.in Log: [Backport rev. 51728 by neal.norwitz] Patch #1540470, for OpenBSD 4.0. Backport candidate for 2.[34]. Modified: python/branches/release24-maint/Lib/test/test_fcntl.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_fcntl.py (original) +++ python/branches/release24-maint/Lib/test/test_fcntl.py Tue Oct 3 15:08:57 2006 @@ -23,7 +23,7 @@ if sys.platform in ('netbsd1', 'netbsd2', 'Darwin1.2', 'darwin', 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', 'freebsd6', 'bsdos2', 'bsdos3', 'bsdos4', - 'openbsd', 'openbsd2', 'openbsd3'): + 'openbsd', 'openbsd2', 'openbsd3', 'openbsd4'): if struct.calcsize('l') == 8: off_t = 'l' pid_t = 'i' Modified: python/branches/release24-maint/Lib/test/test_tempfile.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_tempfile.py (original) +++ python/branches/release24-maint/Lib/test/test_tempfile.py Tue Oct 3 15:08:57 2006 @@ -27,7 +27,7 @@ # number of files that can be opened at one time (see ulimit -n) if sys.platform == 'mac': TEST_FILES = 32 -elif sys.platform == 'openbsd3': +elif sys.platform in ('openbsd3', 'openbsd4'): TEST_FILES = 48 else: TEST_FILES = 100 Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Oct 3 15:08:57 2006 @@ -218,7 +218,7 @@ - Bug #1502728: Correctly link against librt library on HP-UX. -- OpenBSD 3.9 is now supported. +- OpenBSD 3.9 and 4.0 are now supported. - Test for sys/statvfs.h before including it, as statvfs is present on some OSX installation, but its header file is not. Modified: python/branches/release24-maint/configure ============================================================================== --- python/branches/release24-maint/configure (original) +++ python/branches/release24-maint/configure Tue Oct 3 15:08:57 2006 @@ -1480,7 +1480,7 @@ # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. - OpenBSD/2.* | OpenBSD/3.[0123456789]) + OpenBSD/2.* | OpenBSD/3.[0123456789] | OpenBSD/4.[0]) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. Modified: python/branches/release24-maint/configure.in ============================================================================== --- python/branches/release24-maint/configure.in (original) +++ python/branches/release24-maint/configure.in Tue Oct 3 15:08:57 2006 @@ -140,7 +140,7 @@ # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. - OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@) + OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0@:>@) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. From buildbot at python.org Tue Oct 3 15:31:08 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 13:31:08 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4 Message-ID: <20061003133109.09AFE1E4005@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.4/builds/178 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 3 16:07:54 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 16:07:54 +0200 (CEST) Subject: [Python-checkins] r52099 - python/branches/release24-maint/Modules/_bsddb.c Message-ID: <20061003140754.0867B1E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 16:07:53 2006 New Revision: 52099 Modified: python/branches/release24-maint/Modules/_bsddb.c Log: [Backport rev. 47010 by neal.norwitz] Fix memory leak reported by valgrind while running test_subprocess Modified: python/branches/release24-maint/Modules/_bsddb.c ============================================================================== --- python/branches/release24-maint/Modules/_bsddb.c (original) +++ python/branches/release24-maint/Modules/_bsddb.c Tue Oct 3 16:07:53 2006 @@ -2477,6 +2477,8 @@ */ if (size == 0 && (flags & DB_FAST_STAT)) { flags = 0; + if (!err) + free(sp); goto redo_stat_for_length; } From buildbot at python.org Tue Oct 3 17:01:03 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 15:01:03 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.4 Message-ID: <20061003150103.903451E4003@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.4/builds/184 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Tue Oct 3 17:25:10 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 15:25:10 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian 2.4 Message-ID: <20061003152511.194F21E400A@bag.python.org> The Buildbot has detected a new failure of alpha Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%25202.4/builds/33 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Tue Oct 3 20:02:38 2006 From: python-checkins at python.org (vinay.sajip) Date: Tue, 3 Oct 2006 20:02:38 +0200 (CEST) Subject: [Python-checkins] r52100 - python/trunk/Doc/lib/liblogging.tex Message-ID: <20061003180238.1A2351E4003@bag.python.org> Author: vinay.sajip Date: Tue Oct 3 20:02:37 2006 New Revision: 52100 Modified: python/trunk/Doc/lib/liblogging.tex Log: Documentation omitted the additional parameter to LogRecord.__init__ which was added in 2.5. (See SF #1569622). Modified: python/trunk/Doc/lib/liblogging.tex ============================================================================== --- python/trunk/Doc/lib/liblogging.tex (original) +++ python/trunk/Doc/lib/liblogging.tex Tue Oct 3 20:02:37 2006 @@ -1479,7 +1479,7 @@ information to be logged. \begin{classdesc}{LogRecord}{name, lvl, pathname, lineno, msg, args, - exc_info} + exc_info, func} Returns an instance of \class{LogRecord} initialized with interesting information. The \var{name} is the logger name; \var{lvl} is the numeric level; \var{pathname} is the absolute pathname of the source @@ -1489,7 +1489,9 @@ which, together with \var{msg}, makes up the user message; and \var{exc_info} is the exception tuple obtained by calling \function{sys.exc_info() }(or \constant{None}, if no exception information -is available). +is available). The \var{func} is the name of the function from which the +logging call was made. +\versionchanged[\var{func} was added]{2.5} \end{classdesc} \begin{methoddesc}{getMessage}{} From python-checkins at python.org Tue Oct 3 20:20:26 2006 From: python-checkins at python.org (vinay.sajip) Date: Tue, 3 Oct 2006 20:20:26 +0200 (CEST) Subject: [Python-checkins] r52101 - python/trunk/Doc/lib/liblogging.tex Message-ID: <20061003182026.7D50D1E4013@bag.python.org> Author: vinay.sajip Date: Tue Oct 3 20:20:26 2006 New Revision: 52101 Modified: python/trunk/Doc/lib/liblogging.tex Log: Documentation clarified to mention optional parameters. Modified: python/trunk/Doc/lib/liblogging.tex ============================================================================== --- python/trunk/Doc/lib/liblogging.tex (original) +++ python/trunk/Doc/lib/liblogging.tex Tue Oct 3 20:20:26 2006 @@ -528,8 +528,8 @@ \method{filter()}. \end{methoddesc} -\begin{methoddesc}{makeRecord}{name, lvl, fn, lno, msg, args, exc_info, - func, extra} +\begin{methoddesc}{makeRecord}{name, lvl, fn, lno, msg, args, exc_info + \optional{, func, extra}} This is a factory method which can be overridden in subclasses to create specialized \class{LogRecord} instances. \versionchanged[\var{func} and \var{extra} were added]{2.5} @@ -1479,7 +1479,7 @@ information to be logged. \begin{classdesc}{LogRecord}{name, lvl, pathname, lineno, msg, args, - exc_info, func} + exc_info \optional{, func}} Returns an instance of \class{LogRecord} initialized with interesting information. The \var{name} is the logger name; \var{lvl} is the numeric level; \var{pathname} is the absolute pathname of the source @@ -1490,7 +1490,7 @@ \var{exc_info} is the exception tuple obtained by calling \function{sys.exc_info() }(or \constant{None}, if no exception information is available). The \var{func} is the name of the function from which the -logging call was made. +logging call was made. If not specified, it defaults to \var{None}. \versionchanged[\var{func} was added]{2.5} \end{classdesc} From python-checkins at python.org Tue Oct 3 20:21:56 2006 From: python-checkins at python.org (vinay.sajip) Date: Tue, 3 Oct 2006 20:21:56 +0200 (CEST) Subject: [Python-checkins] r52102 - python/trunk/Lib/logging/__init__.py Message-ID: <20061003182156.868461E400C@bag.python.org> Author: vinay.sajip Date: Tue Oct 3 20:21:56 2006 New Revision: 52102 Modified: python/trunk/Lib/logging/__init__.py Log: Modified LogRecord.__init__ to make the func parameter optional. (See SF #1569622). Modified: python/trunk/Lib/logging/__init__.py ============================================================================== --- python/trunk/Lib/logging/__init__.py (original) +++ python/trunk/Lib/logging/__init__.py Tue Oct 3 20:21:56 2006 @@ -214,7 +214,7 @@ information to be logged. """ def __init__(self, name, level, pathname, lineno, - msg, args, exc_info, func): + msg, args, exc_info, func=None): """ Initialize a logging record with interesting information. """ From python-checkins at python.org Tue Oct 3 20:25:20 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 20:25:20 +0200 (CEST) Subject: [Python-checkins] r52103 - in python/branches/release24-maint: Misc/NEWS Objects/funcobject.c Message-ID: <20061003182520.6D3511E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 20:25:19 2006 New Revision: 52103 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/funcobject.c Log: [Backport rev. 42545 by georg.brandl] Make staticmethod and classmethod complain about keyword args. Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Oct 3 20:25:19 2006 @@ -16,6 +16,9 @@ keyword arguments any more (previously they accepted them, but didn't use them). +- staticmethod() and classmethod() also now complain about keyword args + instead of silently ignoring them. + - Bug #1331062: Fix error in UTF-7 codec. - Bug #1365916: Fix an int/long mismatch in the sorted() built-in. Modified: python/branches/release24-maint/Objects/funcobject.c ============================================================================== --- python/branches/release24-maint/Objects/funcobject.c (original) +++ python/branches/release24-maint/Objects/funcobject.c Tue Oct 3 20:25:19 2006 @@ -684,6 +684,8 @@ if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable)) return -1; + if (!_PyArg_NoKeywords("classmethod", kwds)) + return -1; if (!PyCallable_Check(callable)) { PyErr_Format(PyExc_TypeError, "'%s' object is not callable", callable->ob_type->tp_name); @@ -840,6 +842,8 @@ if (!PyArg_UnpackTuple(args, "staticmethod", 1, 1, &callable)) return -1; + if (!_PyArg_NoKeywords("staticmethod", kwds)) + return -1; Py_INCREF(callable); sm->sm_callable = callable; return 0; From python-checkins at python.org Tue Oct 3 20:29:35 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 20:29:35 +0200 (CEST) Subject: [Python-checkins] r52104 - python/branches/release24-maint/Modules/readline.c Message-ID: <20061003182935.9495F1E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 20:29:35 2006 New Revision: 52104 Modified: python/branches/release24-maint/Modules/readline.c Log: [Backport r50677 | neal.norwitz] Fix memory leaks in some conditions. Reported by Klocwork #152. Modified: python/branches/release24-maint/Modules/readline.c ============================================================================== --- python/branches/release24-maint/Modules/readline.c (original) +++ python/branches/release24-maint/Modules/readline.c Tue Oct 3 20:29:35 2006 @@ -22,6 +22,12 @@ #include #endif +#ifdef SAVE_LOCALE +# define RESTORE_LOCALE(sl) { setlocale(LC_CTYPE, sl); free(sl); } +#else +# define RESTORE_LOCALE(sl) +#endif + /* GNU readline definitions */ #undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */ #include @@ -725,10 +731,7 @@ */ rl_initialize(); -#ifdef SAVE_LOCALE - setlocale(LC_CTYPE, saved_locale); /* Restore locale */ - free(saved_locale); -#endif + RESTORE_LOCALE(saved_locale) } /* Wrapper around GNU readline that handles signals differently. */ @@ -866,7 +869,8 @@ p = readline_until_enter_or_signal(prompt, &signal); /* we got an interrupt signal */ - if(signal) { + if (signal) { + RESTORE_LOCALE(saved_locale) return NULL; } @@ -875,6 +879,7 @@ p = PyMem_Malloc(1); if (p != NULL) *p = '\0'; + RESTORE_LOCALE(saved_locale) return p; } @@ -907,10 +912,7 @@ p[n+1] = '\0'; } free(q); -#ifdef SAVE_LOCALE - setlocale(LC_CTYPE, saved_locale); /* Restore locale */ - free(saved_locale); -#endif + RESTORE_LOCALE(saved_locale) return p; } From python-checkins at python.org Tue Oct 3 20:32:26 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 20:32:26 +0200 (CEST) Subject: [Python-checkins] r52105 - python/branches/release24-maint/Python/import.c Message-ID: <20061003183226.416331E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 20:32:25 2006 New Revision: 52105 Modified: python/branches/release24-maint/Python/import.c Log: [Backport r50678 | neal.norwitz] Fix memory leak under some conditions. Reported by Klocwork, #98. Modified: python/branches/release24-maint/Python/import.c ============================================================================== --- python/branches/release24-maint/Python/import.c (original) +++ python/branches/release24-maint/Python/import.c Tue Oct 3 20:32:25 2006 @@ -1847,11 +1847,10 @@ if (co == NULL) return -1; if (!PyCode_Check(co)) { - Py_DECREF(co); PyErr_Format(PyExc_TypeError, "frozen object %.200s is not a code object", name); - return -1; + goto err_return; } if (ispackage) { /* Set __path__ to the package name */ @@ -1859,22 +1858,25 @@ int err; m = PyImport_AddModule(name); if (m == NULL) - return -1; + goto err_return; d = PyModule_GetDict(m); s = PyString_InternFromString(name); if (s == NULL) - return -1; + goto err_return; err = PyDict_SetItemString(d, "__path__", s); Py_DECREF(s); if (err != 0) - return err; + goto err_return; } m = PyImport_ExecCodeModuleEx(name, co, ""); - Py_DECREF(co); if (m == NULL) - return -1; + goto err_return; + Py_DECREF(co); Py_DECREF(m); return 1; +err_return: + Py_DECREF(co); + return -1; } From python-checkins at python.org Tue Oct 3 20:34:29 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 20:34:29 +0200 (CEST) Subject: [Python-checkins] r52106 - python/branches/release24-maint/Parser/grammar.c Message-ID: <20061003183429.F17131E4019@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 20:34:29 2006 New Revision: 52106 Modified: python/branches/release24-maint/Parser/grammar.c Log: [Backport r51256 | neal.norwitz] Handle malloc failure. Klocwork 281 Modified: python/branches/release24-maint/Parser/grammar.c ============================================================================== --- python/branches/release24-maint/Parser/grammar.c (original) +++ python/branches/release24-maint/Parser/grammar.c Tue Oct 3 20:34:29 2006 @@ -195,6 +195,10 @@ else name_len = strlen(src); dest = malloc(name_len + 1); + if (!dest) { + printf("Can't alloc dest '%s'\n", src); + return; + } strncpy(dest, src, name_len); dest[name_len] = '\0'; free(lb->lb_str); From python-checkins at python.org Tue Oct 3 20:40:24 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 20:40:24 +0200 (CEST) Subject: [Python-checkins] r52107 - python/branches/release24-maint/Objects/fileobject.c Message-ID: <20061003184024.1B3B21E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 20:40:23 2006 New Revision: 52107 Modified: python/branches/release24-maint/Objects/fileobject.c Log: [Backport r50680 | neal.norwitz] Handle a NULL name properly. Modified: python/branches/release24-maint/Objects/fileobject.c ============================================================================== --- python/branches/release24-maint/Objects/fileobject.c (original) +++ python/branches/release24-maint/Objects/fileobject.c Tue Oct 3 20:40:23 2006 @@ -328,11 +328,11 @@ if (PyUnicode_Check(f->f_name)) { #ifdef Py_USING_UNICODE PyObject *ret = NULL; - PyObject *name; - name = PyUnicode_AsUnicodeEscapeString(f->f_name); + PyObject *name = PyUnicode_AsUnicodeEscapeString(f->f_name); + const char *name_str = name ? PyString_AsString(name) : "?"; ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", - PyString_AsString(name), + name_str, PyString_AsString(f->f_mode), f); Py_XDECREF(name); From python-checkins at python.org Tue Oct 3 20:43:28 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 20:43:28 +0200 (CEST) Subject: [Python-checkins] r52108 - python/branches/release24-maint/Objects/fileobject.c Message-ID: <20061003184328.99F681E400A@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 20:43:28 2006 New Revision: 52108 Modified: python/branches/release24-maint/Objects/fileobject.c Log: [Backport r50683 | neal.norwitz] Stop INCREFing name, then checking if it's NULL. name (f_name) should never be NULL so assert it. Fix one place where we could have passed NULL. Reported by Klocwork #66. Modified: python/branches/release24-maint/Objects/fileobject.c ============================================================================== --- python/branches/release24-maint/Objects/fileobject.c (original) +++ python/branches/release24-maint/Objects/fileobject.c Tue Oct 3 20:43:28 2006 @@ -98,6 +98,7 @@ fill_file_fields(PyFileObject *f, FILE *fp, PyObject *name, char *mode, int (*close)(FILE *)) { + assert(name != NULL); assert(f != NULL); assert(PyFile_Check(f)); assert(f->f_fp == NULL); @@ -106,7 +107,7 @@ Py_DECREF(f->f_mode); Py_DECREF(f->f_encoding); - Py_INCREF (name); + Py_INCREF(name); f->f_name = name; f->f_mode = PyString_FromString(mode); @@ -121,7 +122,7 @@ Py_INCREF(Py_None); f->f_encoding = Py_None; - if (f->f_name == NULL || f->f_mode == NULL) + if (f->f_mode == NULL) return NULL; f->f_fp = fp; f = dircheck(f); @@ -207,7 +208,9 @@ PyFileObject *f = (PyFileObject *)PyFile_Type.tp_new(&PyFile_Type, NULL, NULL); if (f != NULL) { - PyObject *o_name = PyString_FromString(name); + PyObject *o_name = PyString_FromString(name); + if (o_name == NULL) + return NULL; if (fill_file_fields(f, fp, o_name, mode, close) == NULL) { Py_DECREF(f); f = NULL; From python-checkins at python.org Tue Oct 3 20:52:08 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 20:52:08 +0200 (CEST) Subject: [Python-checkins] r52109 - python/branches/release24-maint/Objects/longobject.c Message-ID: <20061003185208.B01D91E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 20:52:07 2006 New Revision: 52109 Modified: python/branches/release24-maint/Objects/longobject.c Log: [Backport r50779 | neal.norwitz] Move the initialization of size_a down below the check for a being NULL. Reported by Klocwork #106. [Slight change required: in 2.5 Py_ssize_t is used, but 2.4 uses int.] Modified: python/branches/release24-maint/Objects/longobject.c ============================================================================== --- python/branches/release24-maint/Objects/longobject.c (original) +++ python/branches/release24-maint/Objects/longobject.c Tue Oct 3 20:52:07 2006 @@ -1043,7 +1043,7 @@ register PyLongObject *a = (PyLongObject *)aa; PyStringObject *str; int i; - const int size_a = ABS(a->ob_size); + int size_a; char *p; int bits; char sign = '\0'; @@ -1053,6 +1053,7 @@ return NULL; } assert(base >= 2 && base <= 36); + size_a = ABS(a->ob_size); /* Compute a rough upper bound for the length of the string */ i = base; From python-checkins at python.org Tue Oct 3 20:55:07 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 20:55:07 +0200 (CEST) Subject: [Python-checkins] r52110 - python/branches/release24-maint/Modules/cPickle.c Message-ID: <20061003185507.22F871E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 20:55:06 2006 New Revision: 52110 Modified: python/branches/release24-maint/Modules/cPickle.c Log: [Backport r50781 | neal.norwitz] Fix memory leaks spotted by Klocwork #37. Modified: python/branches/release24-maint/Modules/cPickle.c ============================================================================== --- python/branches/release24-maint/Modules/cPickle.c (original) +++ python/branches/release24-maint/Modules/cPickle.c Tue Oct 3 20:55:06 2006 @@ -2620,7 +2620,7 @@ if (ik >= lm || ik == 0) { PyErr_SetString(PicklingError, "Invalid get data"); - return NULL; + goto err; } if (have_get[ik]) /* with matching get */ rsize += ik < 256 ? 2 : 5; @@ -2632,7 +2632,7 @@ ) { PyErr_SetString(PicklingError, "Unexpected data in internal list"); - return NULL; + goto err; } else { /* put */ From python-checkins at python.org Tue Oct 3 21:02:58 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:02:58 +0200 (CEST) Subject: [Python-checkins] r52111 - python/branches/release24-maint/Modules/_tkinter.c Message-ID: <20061003190258.881171E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:02:58 2006 New Revision: 52111 Modified: python/branches/release24-maint/Modules/_tkinter.c Log: [Backport r51229 | neal.norwitz] Don't deref v if it's NULL. Klocwork #214 Modified: python/branches/release24-maint/Modules/_tkinter.c ============================================================================== --- python/branches/release24-maint/Modules/_tkinter.c (original) +++ python/branches/release24-maint/Modules/_tkinter.c Tue Oct 3 21:02:58 2006 @@ -2482,8 +2482,10 @@ } v = Tktt_New(func); - v->token = Tcl_CreateTimerHandler(milliseconds, TimerHandler, - (ClientData)v); + if (v) { + v->token = Tcl_CreateTimerHandler(milliseconds, TimerHandler, + (ClientData)v); + } return (PyObject *) v; } From python-checkins at python.org Tue Oct 3 21:07:06 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:07:06 +0200 (CEST) Subject: [Python-checkins] r52112 - python/branches/release24-maint/Objects/listobject.c Message-ID: <20061003190706.7710B1E400C@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:07:06 2006 New Revision: 52112 Modified: python/branches/release24-maint/Objects/listobject.c Log: [Backport r51230 | neal.norwitz] Check return of PyMem_MALLOC (garbage) is non-NULL. Check seq in both portions of if/else. Klocwork #289-290. Modified: python/branches/release24-maint/Objects/listobject.c ============================================================================== --- python/branches/release24-maint/Objects/listobject.c (original) +++ python/branches/release24-maint/Objects/listobject.c Tue Oct 3 21:07:06 2006 @@ -2550,6 +2550,10 @@ garbage = (PyObject**) PyMem_MALLOC(slicelength*sizeof(PyObject*)); + if (!garbage) { + PyErr_NoMemory(); + return -1; + } /* drawing pictures might help understand these for loops */ @@ -2598,9 +2602,9 @@ else { seq = PySequence_Fast(value, "must assign iterable to extended slice"); - if (!seq) - return -1; } + if (!seq) + return -1; if (PySequence_Fast_GET_SIZE(seq) != slicelength) { PyErr_Format(PyExc_ValueError, From python-checkins at python.org Tue Oct 3 21:08:48 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:08:48 +0200 (CEST) Subject: [Python-checkins] r52113 - python/branches/release24-maint/Python/pythonrun.c Message-ID: <20061003190848.7852D1E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:08:48 2006 New Revision: 52113 Modified: python/branches/release24-maint/Python/pythonrun.c Log: [Backport r51231 | neal.norwitz] PyModule_GetDict() can fail, produce fatal errors if this happens on startup. Klocwork #298-299. Modified: python/branches/release24-maint/Python/pythonrun.c ============================================================================== --- python/branches/release24-maint/Python/pythonrun.c (original) +++ python/branches/release24-maint/Python/pythonrun.c Tue Oct 3 21:08:48 2006 @@ -185,12 +185,16 @@ if (bimod == NULL) Py_FatalError("Py_Initialize: can't initialize __builtin__"); interp->builtins = PyModule_GetDict(bimod); + if (interp->builtins == NULL) + Py_FatalError("Py_Initialize: can't initialize builtins dict"); Py_INCREF(interp->builtins); sysmod = _PySys_Init(); if (sysmod == NULL) Py_FatalError("Py_Initialize: can't initialize sys"); interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + Py_FatalError("Py_Initialize: can't initialize sys dict"); Py_INCREF(interp->sysdict); _PyImport_FixupExtension("sys", "sys"); PySys_SetPath(Py_GetPath()); From python-checkins at python.org Tue Oct 3 21:11:32 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:11:32 +0200 (CEST) Subject: [Python-checkins] r52114 - python/branches/release24-maint/Python/pythonrun.c Message-ID: <20061003191132.A88A81E4011@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:11:32 2006 New Revision: 52114 Modified: python/branches/release24-maint/Python/pythonrun.c Log: [Backport r51443 | neal.norwitz] Handle a few more error conditions. Klocwork 301 and 302. Will backport. Modified: python/branches/release24-maint/Python/pythonrun.c ============================================================================== --- python/branches/release24-maint/Python/pythonrun.c (original) +++ python/branches/release24-maint/Python/pythonrun.c Tue Oct 3 21:11:32 2006 @@ -497,11 +497,15 @@ bimod = _PyImport_FindExtension("__builtin__", "__builtin__"); if (bimod != NULL) { interp->builtins = PyModule_GetDict(bimod); + if (interp->builtins == NULL) + goto handle_error; Py_INCREF(interp->builtins); } sysmod = _PyImport_FindExtension("sys", "sys"); if (bimod != NULL && sysmod != NULL) { interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + goto handle_error; Py_INCREF(interp->sysdict); PySys_SetPath(Py_GetPath()); PyDict_SetItemString(interp->sysdict, "modules", @@ -515,6 +519,7 @@ if (!PyErr_Occurred()) return tstate; +handle_error: /* Oops, it didn't work. Undo it all. */ PyErr_Print(); From buildbot at python.org Tue Oct 3 21:16:07 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 19:16:07 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061003191608.08B891E4014@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%2520trunk/builds/1192 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: vinay.sajip Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 3 21:18:33 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:18:33 +0200 (CEST) Subject: [Python-checkins] r52115 - python/branches/release24-maint/Python/future.c Message-ID: <20061003191833.8940A1E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:18:33 2006 New Revision: 52115 Modified: python/branches/release24-maint/Python/future.c Log: [Partial backport of r50777 | neal.norwitz] Handle more mem alloc issues found with failmalloc [The other half of this patch affected Python/symtable.c, and wasn't relevant for the 2.4 branch. --amk] Modified: python/branches/release24-maint/Python/future.c ============================================================================== --- python/branches/release24-maint/Python/future.c (original) +++ python/branches/release24-maint/Python/future.c Tue Oct 3 21:18:33 2006 @@ -246,8 +246,10 @@ PyFutureFeatures *ff; ff = (PyFutureFeatures *)PyMem_Malloc(sizeof(PyFutureFeatures)); - if (ff == NULL) + if (ff == NULL) { + PyErr_NoMemory(); return NULL; + } ff->ff_found_docstring = 0; ff->ff_last_lineno = -1; ff->ff_features = 0; From buildbot at python.org Tue Oct 3 21:20:14 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 19:20:14 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061003192014.459731E401A@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/120 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: vinay.sajip Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 3 21:22:31 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:22:31 +0200 (CEST) Subject: [Python-checkins] r52116 - python/branches/release24-maint/Modules/itertoolsmodule.c Message-ID: <20061003192231.2041B1E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:22:30 2006 New Revision: 52116 Modified: python/branches/release24-maint/Modules/itertoolsmodule.c Log: [Backport r50782 | neal.norwitz] nextlink can be NULL if teedataobject_new fails, so use XINCREF. Ensure that dataobj is never NULL. Reported by Klocwork #102 Modified: python/branches/release24-maint/Modules/itertoolsmodule.c ============================================================================== --- python/branches/release24-maint/Modules/itertoolsmodule.c (original) +++ python/branches/release24-maint/Modules/itertoolsmodule.c Tue Oct 3 21:22:30 2006 @@ -356,7 +356,7 @@ { if (tdo->nextlink == NULL) tdo->nextlink = teedataobject_new(tdo->it); - Py_INCREF(tdo->nextlink); + Py_XINCREF(tdo->nextlink); return tdo->nextlink; } @@ -432,7 +432,7 @@ if (to->index >= LINKCELLS) { link = teedataobject_jumplink(to->dataobj); - Py_XDECREF(to->dataobj); + Py_DECREF(to->dataobj); to->dataobj = (teedataobject *)link; to->index = 0; } @@ -478,6 +478,12 @@ if (to == NULL) goto done; to->dataobj = (teedataobject *)teedataobject_new(it); + if (!to->dataobj) { + PyObject_GC_Del(to); + to = NULL; + goto done; + } + to->index = 0; to->weakreflist = NULL; done: From python-checkins at python.org Tue Oct 3 21:27:00 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:27:00 +0200 (CEST) Subject: [Python-checkins] r52117 - python/branches/release24-maint/Modules/unicodedata.c Message-ID: <20061003192700.6E1BC1E400F@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:27:00 2006 New Revision: 52117 Modified: python/branches/release24-maint/Modules/unicodedata.c Log: [Backport r50858 | neal.norwitz] No functional change. Add comment and assert to describe why there cannot be overflow which was reported by Klocwork. Discussed on python-dev. Modified: python/branches/release24-maint/Modules/unicodedata.c ============================================================================== --- python/branches/release24-maint/Modules/unicodedata.c (original) +++ python/branches/release24-maint/Modules/unicodedata.c Tue Oct 3 21:27:00 2006 @@ -230,6 +230,7 @@ PyUnicodeObject *v; char decomp[256]; int code, index, count, i; + unsigned int prefix_index; if (!PyArg_ParseTuple(args, "O!:decomposition", &PyUnicode_Type, &v)) @@ -257,9 +258,15 @@ /* XXX: could allocate the PyString up front instead (strlen(prefix) + 5 * count + 1 bytes) */ + /* Based on how index is calculated above and decomp_data is generated + from Tools/unicode/makeunicodedata.py, it should not be possible + to overflow decomp_prefix. */ + prefix_index = decomp_data[index] & 255; + assert(prefix_index < (sizeof(decomp_prefix)/sizeof(*decomp_prefix))); + /* copy prefix */ - i = strlen(decomp_prefix[decomp_data[index] & 255]); - memcpy(decomp, decomp_prefix[decomp_data[index] & 255], i); + i = strlen(decomp_prefix[prefix_index]); + memcpy(decomp, decomp_prefix[prefix_index], i); while (count-- > 0) { if (i) From buildbot at python.org Tue Oct 3 21:29:04 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 19:29:04 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo 2.4 Message-ID: <20061003192904.4AB4D1E4005@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%25202.4/builds/242 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 3 21:30:05 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:30:05 +0200 (CEST) Subject: [Python-checkins] r52118 - python/branches/release24-maint/Modules/cPickle.c Message-ID: <20061003193005.0FEA41E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:30:04 2006 New Revision: 52118 Modified: python/branches/release24-maint/Modules/cPickle.c Log: [Backport r51033 | neal.norwitz] Prevent memory leak on error. Reported by Klocwork #36 Modified: python/branches/release24-maint/Modules/cPickle.c ============================================================================== --- python/branches/release24-maint/Modules/cPickle.c (original) +++ python/branches/release24-maint/Modules/cPickle.c Tue Oct 3 21:30:04 2006 @@ -3394,11 +3394,11 @@ /********************************************/ str = PyString_DecodeEscape(p, len, NULL, 0, NULL); + free(s); if (str) { PDATA_PUSH(self->stack, str, -1); res = 0; } - free(s); return res; insecure: From python-checkins at python.org Tue Oct 3 21:33:56 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:33:56 +0200 (CEST) Subject: [Python-checkins] r52119 - python/branches/release24-maint/Modules/expat/xmlparse.c Message-ID: <20061003193356.F08CF1E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:33:56 2006 New Revision: 52119 Modified: python/branches/release24-maint/Modules/expat/xmlparse.c Log: [backport r51253 | neal.norwitz] Handle failures from lookup. Klocwork 341-342 Modified: python/branches/release24-maint/Modules/expat/xmlparse.c ============================================================================== --- python/branches/release24-maint/Modules/expat/xmlparse.c (original) +++ python/branches/release24-maint/Modules/expat/xmlparse.c Tue Oct 3 21:33:56 2006 @@ -2784,6 +2784,8 @@ unsigned long uriHash = 0; ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(&dtd->attributeIds, s, 0); + if (!id) + return XML_ERROR_NO_MEMORY; b = id->prefix->binding; if (!b) return XML_ERROR_UNBOUND_PREFIX; @@ -5259,6 +5261,8 @@ return NULL; id->prefix = (PREFIX *)lookup(&dtd->prefixes, poolStart(&dtd->pool), sizeof(PREFIX)); + if (!id->prefix) + return NULL; if (id->prefix->name == poolStart(&dtd->pool)) poolFinish(&dtd->pool); else From python-checkins at python.org Tue Oct 3 21:39:54 2006 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 3 Oct 2006 21:39:54 +0200 (CEST) Subject: [Python-checkins] r52120 - python/branches/release24-maint/Modules/zipimport.c Message-ID: <20061003193954.718C11E4005@bag.python.org> Author: andrew.kuchling Date: Tue Oct 3 21:39:54 2006 New Revision: 52120 Modified: python/branches/release24-maint/Modules/zipimport.c Log: [Backport r51252 | neal.norwitz] It's very unlikely, though possible that source is not a string. Verify that PyString_AsString() returns a valid pointer. (The problem can arise when zlib.decompress doesn't return a string.) Klocwork 346 Modified: python/branches/release24-maint/Modules/zipimport.c ============================================================================== --- python/branches/release24-maint/Modules/zipimport.c (original) +++ python/branches/release24-maint/Modules/zipimport.c Tue Oct 3 21:39:54 2006 @@ -955,6 +955,9 @@ char *buf, *q, *p = PyString_AsString(source); PyObject *fixed_source; + if (!p) + return NULL; + /* one char extra for trailing \n and one for terminating \0 */ buf = PyMem_Malloc(PyString_Size(source) + 2); if (buf == NULL) { From buildbot at python.org Tue Oct 3 22:11:22 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 20:11:22 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4 Message-ID: <20061003201122.3105D1E400B@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.4/builds/185 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Tue Oct 3 22:29:15 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 20:29:15 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20061003202915.E109A1E4005@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/131 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: vinay.sajip Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 3 23:58:56 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 3 Oct 2006 23:58:56 +0200 (CEST) Subject: [Python-checkins] r52121 - python/trunk/Python/import.c Message-ID: <20061003215856.6EFCF1E4005@bag.python.org> Author: brett.cannon Date: Tue Oct 3 23:58:55 2006 New Revision: 52121 Modified: python/trunk/Python/import.c Log: Fix minor typo in a comment. Modified: python/trunk/Python/import.c ============================================================================== --- python/trunk/Python/import.c (original) +++ python/trunk/Python/import.c Tue Oct 3 23:58:55 2006 @@ -1801,7 +1801,7 @@ /* Initialize a built-in module. - Return 1 for succes, 0 if the module is not found, and -1 with + Return 1 for success, 0 if the module is not found, and -1 with an exception set if the initialization failed. */ static int From python-checkins at python.org Wed Oct 4 00:05:26 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 4 Oct 2006 00:05:26 +0200 (CEST) Subject: [Python-checkins] r52122 - python/branches/pep302_phase2/BRANCH_PLANS Message-ID: <20061003220526.0A2371E4014@bag.python.org> Author: brett.cannon Date: Wed Oct 4 00:05:25 2006 New Revision: 52122 Modified: python/branches/pep302_phase2/BRANCH_PLANS Log: Initial notes on making built-in module meta path class. Modified: python/branches/pep302_phase2/BRANCH_PLANS ============================================================================== --- python/branches/pep302_phase2/BRANCH_PLANS (original) +++ python/branches/pep302_phase2/BRANCH_PLANS Wed Oct 4 00:05:25 2006 @@ -94,5 +94,27 @@ None entries? +Built-in Meta Path Importer +--------------------------- + +Key data structures and functions: + +* Modules/config.c + + _PyImport_Inttab[] + Array of built-in modules. + +* Python/import.c + + is_builtin() + Function that tells you if a module is a built-in. + + init_builtin() + Initialize a specified built-in. + + +There will be a new class, BuiltinImporter, that will be the importer/loader +for built-in modules. Can either have the class return instances or bind a +single instance to the imp module. Can also have methods be staticmethods or +regular instance methods. + + What's New in this Branch? ========================== From buildbot at python.org Wed Oct 4 00:25:46 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 22:25:46 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian trunk Message-ID: <20061003222546.3F2DE1E4019@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/586 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Wed Oct 4 00:41:14 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 22:41:14 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk 2.4 Message-ID: <20061003224114.F1F051E4005@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%25202.4/builds/30 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 01:23:15 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 4 Oct 2006 01:23:15 +0200 (CEST) Subject: [Python-checkins] r52123 - in python/trunk: Lib/test/test_imp.py Misc/NEWS Message-ID: <20061003232315.786D51E4005@bag.python.org> Author: brett.cannon Date: Wed Oct 4 01:23:14 2006 New Revision: 52123 Modified: python/trunk/Lib/test/test_imp.py python/trunk/Misc/NEWS Log: Convert test_imp over to unittest. Modified: python/trunk/Lib/test/test_imp.py ============================================================================== --- python/trunk/Lib/test/test_imp.py (original) +++ python/trunk/Lib/test/test_imp.py Wed Oct 4 01:23:14 2006 @@ -1,43 +1,47 @@ import imp -from test.test_support import TestFailed, TestSkipped -try: - import thread -except ImportError: - raise TestSkipped("test only valid when thread support is available") - -def verify_lock_state(expected): - if imp.lock_held() != expected: - raise TestFailed("expected imp.lock_held() to be %r" % expected) - -def testLock(): - LOOPS = 50 - - # The import lock may already be held, e.g. if the test suite is run - # via "import test.autotest". - lock_held_at_start = imp.lock_held() - verify_lock_state(lock_held_at_start) - - for i in range(LOOPS): - imp.acquire_lock() - verify_lock_state(True) +import thread +import unittest +from test import test_support - for i in range(LOOPS): - imp.release_lock() - # The original state should be restored now. - verify_lock_state(lock_held_at_start) +class LockTests(unittest.TestCase): - if not lock_held_at_start: - try: + """Very basic test of import lock functions.""" + + def verify_lock_state(self, expected): + self.failUnlessEqual(imp.lock_held(), expected, + "expected imp.lock_held() to be %r" % expected) + def testLock(self): + LOOPS = 50 + + # The import lock may already be held, e.g. if the test suite is run + # via "import test.autotest". + lock_held_at_start = imp.lock_held() + self.verify_lock_state(lock_held_at_start) + + for i in range(LOOPS): + imp.acquire_lock() + self.verify_lock_state(True) + + for i in range(LOOPS): imp.release_lock() - except RuntimeError: - pass - else: - raise TestFailed("release_lock() without lock should raise " - "RuntimeError") + + # The original state should be restored now. + self.verify_lock_state(lock_held_at_start) + + if not lock_held_at_start: + try: + imp.release_lock() + except RuntimeError: + pass + else: + self.fail("release_lock() without lock should raise " + "RuntimeError") def test_main(): - testLock() + test_support.run_unittest( + LockTests, + ) if __name__ == "__main__": test_main() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Oct 4 01:23:14 2006 @@ -139,6 +139,8 @@ Tests ----- +- Converted test_imp to use unittest. + - Fix bsddb test_basics.test06_Transactions to check the version number properly. From python-checkins at python.org Wed Oct 4 01:24:05 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 4 Oct 2006 01:24:05 +0200 (CEST) Subject: [Python-checkins] r52124 - python/branches/pep302_phase2/BRANCH_PLANS Message-ID: <20061003232405.EB4171E4005@bag.python.org> Author: brett.cannon Date: Wed Oct 4 01:24:05 2006 New Revision: 52124 Modified: python/branches/pep302_phase2/BRANCH_PLANS Log: Add some notes about built-in module importer. Modified: python/branches/pep302_phase2/BRANCH_PLANS ============================================================================== --- python/branches/pep302_phase2/BRANCH_PLANS (original) +++ python/branches/pep302_phase2/BRANCH_PLANS Wed Oct 4 01:24:05 2006 @@ -92,6 +92,8 @@ + Make it a no-op? + Add an entry in 'sys' for a default factory function that gets called for None entries? +* What to do with Python/import.c:PyWin_FindRegisteredModule()? + + Make meta_path importer? Built-in Meta Path Importer @@ -108,12 +110,24 @@ Function that tells you if a module is a built-in. + init_builtin() Initialize a specified built-in. + + find_module() + Function that handles finding modules (calls is_builtin()). + + load_module() + Handles loading of modules (calls init_builtin() along with some sanity + checking and a Py_INCREF on the returned module). There will be a new class, BuiltinImporter, that will be the importer/loader -for built-in modules. Can either have the class return instances or bind a -single instance to the imp module. Can also have methods be staticmethods or -regular instance methods. +for built-in modules. Seems reasonable to have the class have staticmethods so +as to skip need to create an instance of the class. + +Can short-circuit checking whether the meta path importer should handle an +import by noting that if a value other than None is passed for the second +argument to find_module() it is definitely not a built-in module. + +Need to make sure that this gets registered in sys.meta_path during new +interpreter initialization when the sys data dict is created. Is there going +to be a bootstrap problem of people trying to import before then in C code? What's New in this Branch? From python-checkins at python.org Wed Oct 4 01:24:41 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 4 Oct 2006 01:24:41 +0200 (CEST) Subject: [Python-checkins] r52125 - python/branches/pep302_phase2/Python/import.c Message-ID: <20061003232441.D9B5F1E4005@bag.python.org> Author: brett.cannon Date: Wed Oct 4 01:24:41 2006 New Revision: 52125 Modified: python/branches/pep302_phase2/Python/import.c Log: Beginnings of built-in module importer. Tests will come after next svnmerge thanks to rewriting test_imp to use unittest. Modified: python/branches/pep302_phase2/Python/import.c ============================================================================== --- python/branches/pep302_phase2/Python/import.c (original) +++ python/branches/pep302_phase2/Python/import.c Wed Oct 4 01:24:41 2006 @@ -3037,6 +3037,59 @@ PyType_GenericNew /* tp_new */ }; +typedef struct { + PyObject_HEAD +} BuiltinImporterObject; + + +static PyMethodDef builtinimporter_methods[] = { + {NULL} +}; + +static PyTypeObject BuiltinImporterType = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "imp.BuiltinImporter", /* tp_name */ + sizeof(BuiltinImporterObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | + Py_TPFLAGS_BASETYPE, /* tp_flags */ + "Importer for built-in modules.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + builtinimporter_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ +}; PyMODINIT_FUNC initimp(void) @@ -3065,6 +3118,13 @@ if (setint(d, "PY_CODERESOURCE", PY_CODERESOURCE) < 0) goto failure; if (setint(d, "IMP_HOOK", IMP_HOOK) < 0) goto failure; + if (PyType_Ready(&BuiltinImporterType) < 0) + goto failure; + Py_INCREF(&BuiltinImporterType); + if (PyModule_AddObject(m, "BuiltinImporter", + (PyObject *)&BuiltinImporterType) < 0) + goto failure; + Py_INCREF(&NullImporterType); PyModule_AddObject(m, "NullImporter", (PyObject *)&NullImporterType); failure: From buildbot at python.org Wed Oct 4 01:47:55 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Oct 2006 23:47:55 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-2 2.4 Message-ID: <20061003234755.450231E4018@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%25202.4/builds/171 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling,georg.brandl,gregory.p.smith,martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 03:28:44 2006 From: python-checkins at python.org (barry.warsaw) Date: Wed, 4 Oct 2006 03:28:44 +0200 (CEST) Subject: [Python-checkins] r52126 - python/branches/release25-maint/Lib/email/utils.py Message-ID: <20061004012844.C127B1E4005@bag.python.org> Author: barry.warsaw Date: Wed Oct 4 03:28:43 2006 New Revision: 52126 Modified: python/branches/release25-maint/Lib/email/utils.py Log: decode_rfc2231(): As Christian Robottom Reis points out, it makes no sense to test for parts > 3 when we use .split(..., 2). Modified: python/branches/release25-maint/Lib/email/utils.py ============================================================================== --- python/branches/release25-maint/Lib/email/utils.py (original) +++ python/branches/release25-maint/Lib/email/utils.py Wed Oct 4 03:28:43 2006 @@ -235,10 +235,6 @@ parts = s.split(TICK, 2) if len(parts) <= 2: return None, None, s - if len(parts) > 3: - charset, language = parts[:2] - s = TICK.join(parts[2:]) - return charset, language, s return parts From python-checkins at python.org Wed Oct 4 04:05:17 2006 From: python-checkins at python.org (barry.warsaw) Date: Wed, 4 Oct 2006 04:05:17 +0200 (CEST) Subject: [Python-checkins] r52127 - python/branches/release24-maint/Lib/email/Utils.py Message-ID: <20061004020517.3DEFF1E400A@bag.python.org> Author: barry.warsaw Date: Wed Oct 4 04:05:15 2006 New Revision: 52127 Modified: python/branches/release24-maint/Lib/email/Utils.py Log: decode_rfc2231(): As Christian Robottom Reis points out, it makes no sense to test for parts > 3 when we use .split(..., 2). Modified: python/branches/release24-maint/Lib/email/Utils.py ============================================================================== --- python/branches/release24-maint/Lib/email/Utils.py (original) +++ python/branches/release24-maint/Lib/email/Utils.py Wed Oct 4 04:05:15 2006 @@ -220,10 +220,6 @@ parts = s.split(TICK, 2) if len(parts) <= 2: return None, None, urllib.unquote(s) - if len(parts) > 3: - charset, language = pars[:2] - s = TICK.join(parts[2:]) - return charset, language, s return parts From python-checkins at python.org Wed Oct 4 04:06:36 2006 From: python-checkins at python.org (barry.warsaw) Date: Wed, 4 Oct 2006 04:06:36 +0200 (CEST) Subject: [Python-checkins] r52128 - python/trunk/Lib/email/utils.py Message-ID: <20061004020636.9880E1E4005@bag.python.org> Author: barry.warsaw Date: Wed Oct 4 04:06:36 2006 New Revision: 52128 Modified: python/trunk/Lib/email/utils.py Log: decode_rfc2231(): As Christian Robottom Reis points out, it makes no sense to test for parts > 3 when we use .split(..., 2). Modified: python/trunk/Lib/email/utils.py ============================================================================== --- python/trunk/Lib/email/utils.py (original) +++ python/trunk/Lib/email/utils.py Wed Oct 4 04:06:36 2006 @@ -235,10 +235,6 @@ parts = s.split(TICK, 2) if len(parts) <= 2: return None, None, s - if len(parts) > 3: - charset, language = parts[:2] - s = TICK.join(parts[2:]) - return charset, language, s return parts From buildbot at python.org Wed Oct 4 04:21:07 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 02:21:07 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20061004022107.9D1A81E4005@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/49 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: barry.warsaw Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 04:24:53 2006 From: python-checkins at python.org (jeremy.hylton) Date: Wed, 4 Oct 2006 04:24:53 +0200 (CEST) Subject: [Python-checkins] r52129 - in python/trunk: Lib/test/test_syntax.py Python/compile.c Message-ID: <20061004022453.797C61E4005@bag.python.org> Author: jeremy.hylton Date: Wed Oct 4 04:24:52 2006 New Revision: 52129 Modified: python/trunk/Lib/test/test_syntax.py python/trunk/Python/compile.c Log: Fix for SF bug 1569998: break permitted inside try. The compiler was checking that there was something on the fblock stack, but not that there was a loop on the stack. Fixed that and added a test for the specific syntax error. Bug fix candidate. Modified: python/trunk/Lib/test/test_syntax.py ============================================================================== --- python/trunk/Lib/test/test_syntax.py (original) +++ python/trunk/Lib/test/test_syntax.py Wed Oct 4 04:24:52 2006 @@ -322,6 +322,20 @@ ... SyntaxError: 'continue' not supported inside 'finally' clause (, line 8) +There is one test for a break that is not in a loop. The compiler +uses a single data structure to keep track of try-finally and loops, +so we need to be sure that a break is actually inside a loop. If it +isn't, there should be a syntax error. + + >>> try: + ... print 1 + ... break + ... print 2 + ... finally: + ... print 3 + Traceback (most recent call last): + ... + SyntaxError: 'break' outside loop (, line 3) """ import re Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Wed Oct 4 04:24:52 2006 @@ -187,6 +187,8 @@ basicblock *); static void compiler_pop_fblock(struct compiler *, enum fblocktype, basicblock *); +/* Returns true if there is a loop on the fblock stack. */ +static int compiler_in_loop(struct compiler *); static int inplace_binop(struct compiler *, operator_ty); static int expr_constant(expr_ty e); @@ -2157,7 +2159,7 @@ case Pass_kind: break; case Break_kind: - if (!c->u->u_nfblocks) + if (!compiler_in_loop(c)) return compiler_error(c, "'break' outside loop"); ADDOP(c, BREAK_LOOP); break; @@ -3147,6 +3149,16 @@ assert(u->u_fblock[u->u_nfblocks].fb_block == b); } +static int +compiler_in_loop(struct compiler *c) { + int i; + struct compiler_unit *u = c->u; + for (i = 0; i < u->u_nfblocks; ++i) { + if (u->u_fblock[i].fb_type == LOOP) + return 1; + } + return 0; +} /* Raises a SyntaxError and returns 0. If something goes wrong, a different exception may be raised. */ From buildbot at python.org Wed Oct 4 04:34:03 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 02:34:03 +0000 Subject: [Python-checkins] buildbot warnings in ppc Debian unstable 2.4 Message-ID: <20061004023403.474361E4005@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%2520Debian%2520unstable%25202.4/builds/161 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: barry.warsaw Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Wed Oct 4 04:34:32 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 02:34:32 +0000 Subject: [Python-checkins] buildbot warnings in PPC64 Debian 2.4 Message-ID: <20061004023433.08D4E1E4005@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%2520Debian%25202.4/builds/80 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: barry.warsaw Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Wed Oct 4 05:22:42 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 03:22:42 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian 2.5 Message-ID: <20061004032242.E2BB41E4005@bag.python.org> The Buildbot has detected a new failure of alpha Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%25202.5/builds/47 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: barry.warsaw Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Wed Oct 4 06:41:21 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 04:41:21 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061004044121.B1E6D1E4005@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/123 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: barry.warsaw Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 07:47:34 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 07:47:34 +0200 (CEST) Subject: [Python-checkins] r52130 - in python/trunk: Lib/test/test_builtin.py Misc/NEWS Objects/intobject.c Message-ID: <20061004054734.EF63B1E4007@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 07:47:34 2006 New Revision: 52130 Modified: python/trunk/Lib/test/test_builtin.py python/trunk/Misc/NEWS python/trunk/Objects/intobject.c Log: Fix integer negation and absolute value to not rely on undefined behaviour of the C compiler anymore. Will backport to 2.5 and 2.4. Modified: python/trunk/Lib/test/test_builtin.py ============================================================================== --- python/trunk/Lib/test/test_builtin.py (original) +++ python/trunk/Lib/test/test_builtin.py Wed Oct 4 07:47:34 2006 @@ -116,6 +116,7 @@ self.assertEqual(abs(0), 0) self.assertEqual(abs(1234), 1234) self.assertEqual(abs(-1234), 1234) + self.assertTrue(abs(-sys.maxint-1) > 0) # float self.assertEqual(abs(0.0), 0.0) self.assertEqual(abs(3.14), 3.14) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Oct 4 07:47:34 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Integer negation and absolute value were fixed to not rely + on undefined behaviour of the C compiler anymore. + - Bug #1566800: make sure that EnvironmentError can be called with any number of arguments, as was the case in Python 2.4. Modified: python/trunk/Objects/intobject.c ============================================================================== --- python/trunk/Objects/intobject.c (original) +++ python/trunk/Objects/intobject.c Wed Oct 4 07:47:34 2006 @@ -754,10 +754,9 @@ static PyObject * int_neg(PyIntObject *v) { - register long a, x; + register long a; a = v->ob_ival; - x = -a; - if (a < 0 && x < 0) { + if (a < 0 && (unsigned long)a == 0-(unsigned long)a) { PyObject *o = PyLong_FromLong(a); if (o != NULL) { PyObject *result = PyNumber_Negative(o); @@ -766,7 +765,7 @@ } return NULL; } - return PyInt_FromLong(x); + return PyInt_FromLong(-a); } static PyObject * From python-checkins at python.org Wed Oct 4 07:47:48 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 07:47:48 +0200 (CEST) Subject: [Python-checkins] r52131 - in python/branches/release25-maint: Lib/test/test_builtin.py Misc/NEWS Objects/intobject.c Message-ID: <20061004054748.30F861E4007@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 07:47:47 2006 New Revision: 52131 Modified: python/branches/release25-maint/Lib/test/test_builtin.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Objects/intobject.c Log: Fix integer negation and absolute value to not rely on undefined behaviour of the C compiler anymore. Modified: python/branches/release25-maint/Lib/test/test_builtin.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_builtin.py (original) +++ python/branches/release25-maint/Lib/test/test_builtin.py Wed Oct 4 07:47:47 2006 @@ -116,6 +116,7 @@ self.assertEqual(abs(0), 0) self.assertEqual(abs(1234), 1234) self.assertEqual(abs(-1234), 1234) + self.assertTrue(abs(-sys.maxint-1) > 0) # float self.assertEqual(abs(0.0), 0.0) self.assertEqual(abs(3.14), 3.14) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Wed Oct 4 07:47:47 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Integer negation and absolute value were fixed to not rely + on undefined behaviour of the C compiler anymore. + - Bug #1566800: make sure that EnvironmentError can be called with any number of arguments, as was the case in Python 2.4. Modified: python/branches/release25-maint/Objects/intobject.c ============================================================================== --- python/branches/release25-maint/Objects/intobject.c (original) +++ python/branches/release25-maint/Objects/intobject.c Wed Oct 4 07:47:47 2006 @@ -760,10 +760,9 @@ static PyObject * int_neg(PyIntObject *v) { - register long a, x; + register long a; a = v->ob_ival; - x = -a; - if (a < 0 && x < 0) { + if (a < 0 && (unsigned long)a == 0-(unsigned long)a) { PyObject *o = PyLong_FromLong(a); if (o != NULL) { PyObject *result = PyNumber_Negative(o); @@ -772,7 +771,7 @@ } return NULL; } - return PyInt_FromLong(x); + return PyInt_FromLong(-a); } static PyObject * From python-checkins at python.org Wed Oct 4 07:48:06 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 07:48:06 +0200 (CEST) Subject: [Python-checkins] r52132 - in python/branches/release24-maint: Lib/test/test_builtin.py Misc/NEWS Objects/intobject.c Message-ID: <20061004054806.74BAB1E4005@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 07:48:05 2006 New Revision: 52132 Modified: python/branches/release24-maint/Lib/test/test_builtin.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/intobject.c Log: Fix integer negation and absolute value to not rely on undefined behaviour of the C compiler anymore. Modified: python/branches/release24-maint/Lib/test/test_builtin.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_builtin.py (original) +++ python/branches/release24-maint/Lib/test/test_builtin.py Wed Oct 4 07:48:05 2006 @@ -101,6 +101,7 @@ self.assertEqual(abs(0), 0) self.assertEqual(abs(1234), 1234) self.assertEqual(abs(-1234), 1234) + self.assertTrue(abs(-sys.maxint-1) > 0) # float self.assertEqual(abs(0.0), 0.0) self.assertEqual(abs(3.14), 3.14) Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Wed Oct 4 07:48:05 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Integer negation and absolute value were fixed to not rely + on undefined behaviour of the C compiler anymore. + - Patch #1567691: super() and new.instancemethod() now don't accept keyword arguments any more (previously they accepted them, but didn't use them). Modified: python/branches/release24-maint/Objects/intobject.c ============================================================================== --- python/branches/release24-maint/Objects/intobject.c (original) +++ python/branches/release24-maint/Objects/intobject.c Wed Oct 4 07:48:05 2006 @@ -674,10 +674,9 @@ static PyObject * int_neg(PyIntObject *v) { - register long a, x; + register long a; a = v->ob_ival; - x = -a; - if (a < 0 && x < 0) { + if (a < 0 && (unsigned long)a == 0-(unsigned long)a) { PyObject *o = PyLong_FromLong(a); if (o != NULL) { PyObject *result = PyNumber_Negative(o); @@ -686,7 +685,7 @@ } return NULL; } - return PyInt_FromLong(x); + return PyInt_FromLong(-a); } static PyObject * From buildbot at python.org Wed Oct 4 09:30:08 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 07:30:08 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk 2.4 Message-ID: <20061004073008.7CB7D1E4007@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%25202.4/builds/32 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: barry.warsaw Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Wed Oct 4 11:10:42 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 09:10:42 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20061004091043.0CF2F1E4012@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/134 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: barry.warsaw,jeremy.hylton Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 11:12:41 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 11:12:41 +0200 (CEST) Subject: [Python-checkins] r52133 - python/branches/release24-maint/PC/msvcrtmodule.c python/branches/release24-maint/PC/winsound.c Message-ID: <20061004091241.310241E4007@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 11:12:40 2006 New Revision: 52133 Modified: python/branches/release24-maint/PC/msvcrtmodule.c python/branches/release24-maint/PC/winsound.c Log: Patch #1570253: Fix build problems caused by backports. Modified: python/branches/release24-maint/PC/msvcrtmodule.c ============================================================================== --- python/branches/release24-maint/PC/msvcrtmodule.c (original) +++ python/branches/release24-maint/PC/msvcrtmodule.c Wed Oct 4 11:12:40 2006 @@ -220,10 +220,11 @@ PyMODINIT_FUNC initmsvcrt(void) { + PyObject *d; PyObject *m = Py_InitModule("msvcrt", msvcrt_functions); if (m == NULL) return; - PyObject *d = PyModule_GetDict(m); + d = PyModule_GetDict(m); /* constants for the locking() function's mode argument */ insertint(d, "LK_LOCK", _LK_LOCK); Modified: python/branches/release24-maint/PC/winsound.c ============================================================================== --- python/branches/release24-maint/PC/winsound.c (original) +++ python/branches/release24-maint/PC/winsound.c Wed Oct 4 11:12:40 2006 @@ -215,12 +215,13 @@ { OSVERSIONINFO version; + PyObject *dict; PyObject *module = Py_InitModule3("winsound", sound_methods, sound_module_doc); if (module == NULL) return; - PyObject *dict = PyModule_GetDict(module); + dict = PyModule_GetDict(module); ADD_DEFINE(SND_ASYNC); ADD_DEFINE(SND_NODEFAULT); From python-checkins at python.org Wed Oct 4 11:18:51 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 11:18:51 +0200 (CEST) Subject: [Python-checkins] r52134 - python/branches/release24-maint/Tools/msi/uuids.py Message-ID: <20061004091851.B47751E4007@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 11:18:51 2006 New Revision: 52134 Modified: python/branches/release24-maint/Tools/msi/uuids.py Log: Add uuids for upcoming 2.4.4 release. Modified: python/branches/release24-maint/Tools/msi/uuids.py ============================================================================== --- python/branches/release24-maint/Tools/msi/uuids.py (original) +++ python/branches/release24-maint/Tools/msi/uuids.py Wed Oct 4 11:18:51 2006 @@ -22,4 +22,6 @@ '2.4.2150':'{b191e49c-ea23-43b2-b28a-14e0784069b8}', # 2.4.2 '2.4.3121':'{f669ed4d-1dce-41c4-9617-d985397187a1}', # 2.4.3c1 '2.4.3150':'{75e71add-042c-4f30-bfac-a9ec42351313}', # 2.4.3 + '2.4.4121':'{cd2862db-22a4-4688-8772-85407ea21550}', # 2.4.4c1 + '2.4.4150':'{60e2c8c9-6cf3-4b1a-9618-e304946c94e6}', # 2.4.4 } From python-checkins at python.org Wed Oct 4 11:21:20 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 11:21:20 +0200 (CEST) Subject: [Python-checkins] r52135 - python/trunk/Tools/msi/uuids.py Message-ID: <20061004092120.5192C1E4007@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 11:21:20 2006 New Revision: 52135 Modified: python/trunk/Tools/msi/uuids.py Log: Forward port r52134: Add uuids for 2.4.4. Modified: python/trunk/Tools/msi/uuids.py ============================================================================== --- python/trunk/Tools/msi/uuids.py (original) +++ python/trunk/Tools/msi/uuids.py Wed Oct 4 11:21:20 2006 @@ -22,6 +22,8 @@ '2.4.2150':'{b191e49c-ea23-43b2-b28a-14e0784069b8}', # 2.4.2 '2.4.3121':'{f669ed4d-1dce-41c4-9617-d985397187a1}', # 2.4.3c1 '2.4.3150':'{75e71add-042c-4f30-bfac-a9ec42351313}', # 2.4.3 + '2.4.4121':'{cd2862db-22a4-4688-8772-85407ea21550}', # 2.4.4c1 + '2.4.4150':'{60e2c8c9-6cf3-4b1a-9618-e304946c94e6}', # 2.4.4 '2.5.101': '{bc14ce3e-5e72-4a64-ac1f-bf59a571898c}', # 2.5a1 '2.5.102': '{5eed51c1-8e9d-4071-94c5-b40de5d49ba5}', # 2.5a2 '2.5.103': '{73dcd966-ffec-415f-bb39-8342c1f47017}', # 2.5a3 From python-checkins at python.org Wed Oct 4 12:13:35 2006 From: python-checkins at python.org (armin.rigo) Date: Wed, 4 Oct 2006 12:13:35 +0200 (CEST) Subject: [Python-checkins] r52136 - in python/branches/release24-maint: Lib/test/test_builtin.py Lib/test/test_long.py Misc/NEWS Objects/abstract.c Objects/fileobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/stringobject.c Objects/unicodeobject.c Python/marshal.c Python/mystrtoul.c Message-ID: <20061004101335.A67431E4005@bag.python.org> Author: armin.rigo Date: Wed Oct 4 12:13:32 2006 New Revision: 52136 Modified: python/branches/release24-maint/Lib/test/test_builtin.py python/branches/release24-maint/Lib/test/test_long.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/abstract.c python/branches/release24-maint/Objects/fileobject.c python/branches/release24-maint/Objects/intobject.c python/branches/release24-maint/Objects/listobject.c python/branches/release24-maint/Objects/longobject.c python/branches/release24-maint/Objects/stringobject.c python/branches/release24-maint/Objects/unicodeobject.c python/branches/release24-maint/Python/marshal.c python/branches/release24-maint/Python/mystrtoul.c Log: A review of overflow-detecting code in the 2.4 branch. * unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c. Modified: python/branches/release24-maint/Lib/test/test_builtin.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_builtin.py (original) +++ python/branches/release24-maint/Lib/test/test_builtin.py Wed Oct 4 12:13:32 2006 @@ -113,6 +113,11 @@ # str self.assertRaises(TypeError, abs, 'a') + def test_neg(self): + x = -sys.maxint-1 + self.assert_(isinstance(x, int)) + self.assertEqual(-x, sys.maxint+1) + def test_apply(self): def f0(*args): self.assertEqual(args, ()) @@ -574,9 +579,11 @@ pass s = repr(-1-sys.maxint) - self.assertEqual(int(s)+1, -sys.maxint) + x = int(s) + self.assertEqual(x+1, -sys.maxint) + self.assert_(isinstance(x, int)) # should return long - int(s[1:]) + self.assertEqual(int(s[1:]), sys.maxint+1) # should return long x = int(1e100) Modified: python/branches/release24-maint/Lib/test/test_long.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_long.py (original) +++ python/branches/release24-maint/Lib/test/test_long.py Wed Oct 4 12:13:32 2006 @@ -253,16 +253,22 @@ "long(-sys.maxint-1) != -sys.maxint-1") # long -> int should not fail for hugepos_aslong or hugeneg_aslong + x = int(hugepos_aslong) try: - check(int(hugepos_aslong) == hugepos, + check(x == hugepos, "converting sys.maxint to long and back to int fails") except OverflowError: raise TestFailed, "int(long(sys.maxint)) overflowed!" + if not isinstance(x, int): + raise TestFailed("int(long(sys.maxint)) should have returned int") + x = int(hugeneg_aslong) try: - check(int(hugeneg_aslong) == hugeneg, + check(x == hugeneg, "converting -sys.maxint-1 to long and back to int fails") except OverflowError: raise TestFailed, "int(long(-sys.maxint-1)) overflowed!" + if not isinstance(x, int): + raise TestFailed("int(long(-sys.maxint-1)) should have returned int") # but long -> int should overflow for hugepos+1 and hugeneg-1 x = hugepos_aslong + 1 Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Wed Oct 4 12:13:32 2006 @@ -12,8 +12,9 @@ Core and builtins ----------------- -- Integer negation and absolute value were fixed to not rely - on undefined behaviour of the C compiler anymore. +- A number of places, including integer negation and absolute value, + were fixed to not rely on undefined behaviour of the C compiler + anymore. - Patch #1567691: super() and new.instancemethod() now don't accept keyword arguments any more (previously they accepted them, but didn't Modified: python/branches/release24-maint/Objects/abstract.c ============================================================================== --- python/branches/release24-maint/Objects/abstract.c (original) +++ python/branches/release24-maint/Objects/abstract.c Wed Oct 4 12:13:32 2006 @@ -1591,12 +1591,12 @@ if (cmp > 0) { switch (operation) { case PY_ITERSEARCH_COUNT: - ++n; - if (n <= 0) { + if (n == INT_MAX) { PyErr_SetString(PyExc_OverflowError, "count exceeds C int size"); goto Fail; } + ++n; break; case PY_ITERSEARCH_INDEX: @@ -1617,9 +1617,9 @@ } if (operation == PY_ITERSEARCH_INDEX) { - ++n; - if (n <= 0) + if (n == INT_MAX) wrapped = 1; + ++n; } } Modified: python/branches/release24-maint/Objects/fileobject.c ============================================================================== --- python/branches/release24-maint/Objects/fileobject.c (original) +++ python/branches/release24-maint/Objects/fileobject.c Wed Oct 4 12:13:32 2006 @@ -908,6 +908,7 @@ size_t nfree; /* # of free buffer slots; pvend-pvfree */ size_t total_v_size; /* total # of slots in buffer */ size_t increment; /* amount to increment the buffer */ + size_t prev_v_size; /* Optimize for normal case: avoid _PyString_Resize if at all * possible via first reading into stack buffer "buf". @@ -1020,8 +1021,10 @@ /* expand buffer and try again */ assert(*(pvend-1) == '\0'); increment = total_v_size >> 2; /* mild exponential growth */ + prev_v_size = total_v_size; total_v_size += increment; - if (total_v_size > INT_MAX) { + /* check for overflow */ + if (total_v_size <= prev_v_size || total_v_size > INT_MAX) { PyErr_SetString(PyExc_OverflowError, "line is longer than a Python string can hold"); Py_DECREF(v); @@ -1030,7 +1033,7 @@ if (_PyString_Resize(&v, (int)total_v_size) < 0) return NULL; /* overwrite the trailing null byte */ - pvfree = BUF(v) + (total_v_size - increment - 1); + pvfree = BUF(v) + (prev_v_size - 1); } if (BUF(v) + total_v_size != p) _PyString_Resize(&v, p - BUF(v)); Modified: python/branches/release24-maint/Objects/intobject.c ============================================================================== --- python/branches/release24-maint/Objects/intobject.c (original) +++ python/branches/release24-maint/Objects/intobject.c Wed Oct 4 12:13:32 2006 @@ -460,6 +460,17 @@ } } +/* Integer overflow checking for unary negation: on a 2's-complement + * box, -x overflows iff x is the most negative long. In this case we + * get -x == x. However, -x is undefined (by C) if x /is/ the most + * negative long (it's a signed overflow case), and some compilers care. + * So we cast x to unsigned long first. However, then other compilers + * warn about applying unary minus to an unsigned operand. Hence the + * weird "0-". + */ +#define UNARY_NEG_WOULD_OVERFLOW(x) \ + ((x) < 0 && (unsigned long)(x) == 0-(unsigned long)(x)) + /* Return type of i_divmod */ enum divmod_result { DIVMOD_OK, /* Correct result */ @@ -478,14 +489,8 @@ "integer division or modulo by zero"); return DIVMOD_ERROR; } - /* (-sys.maxint-1)/-1 is the only overflow case. x is the most - * negative long iff x < 0 and, on a 2's-complement box, x == -x. - * However, -x is undefined (by C) if x /is/ the most negative long - * (it's a signed overflow case), and some compilers care. So we cast - * x to unsigned long first. However, then other compilers warn about - * applying unary minus to an unsigned operand. Hence the weird "0-". - */ - if (y == -1 && x < 0 && (unsigned long)x == 0-(unsigned long)x) + /* (-sys.maxint-1)/-1 is the only overflow case. */ + if (y == -1 && UNARY_NEG_WOULD_OVERFLOW(x)) return DIVMOD_OVERFLOW; xdivy = x / y; xmody = x - xdivy * y; @@ -676,7 +681,8 @@ { register long a; a = v->ob_ival; - if (a < 0 && (unsigned long)a == 0-(unsigned long)a) { + /* check for overflow */ + if (UNARY_NEG_WOULD_OVERFLOW(a)) { PyObject *o = PyLong_FromLong(a); if (o != NULL) { PyObject *result = PyNumber_Negative(o); Modified: python/branches/release24-maint/Objects/listobject.c ============================================================================== --- python/branches/release24-maint/Objects/listobject.c (original) +++ python/branches/release24-maint/Objects/listobject.c Wed Oct 4 12:13:32 2006 @@ -860,7 +860,8 @@ static PyObject * listpop(PyListObject *self, PyObject *args) { - int i = -1; + long ii = -1; + int i; PyObject *v, *arg = NULL; int status; @@ -868,8 +869,8 @@ return NULL; if (arg != NULL) { if (PyInt_Check(arg)) - i = (int)(PyInt_AS_LONG((PyIntObject*) arg)); - else if (!PyArg_ParseTuple(args, "|i:pop", &i)) + ii = PyInt_AS_LONG((PyIntObject*) arg); + else if (!PyArg_ParseTuple(args, "|l:pop", &ii)) return NULL; } if (self->ob_size == 0) { @@ -877,12 +878,13 @@ PyErr_SetString(PyExc_IndexError, "pop from empty list"); return NULL; } - if (i < 0) - i += self->ob_size; - if (i < 0 || i >= self->ob_size) { + if (ii < 0) + ii += self->ob_size; + if (ii < 0 || ii >= self->ob_size) { PyErr_SetString(PyExc_IndexError, "pop index out of range"); return NULL; } + i = (int)ii; v = self->ob_item[i]; if (i == self->ob_size - 1) { status = list_resize(self, self->ob_size - 1); Modified: python/branches/release24-maint/Objects/longobject.c ============================================================================== --- python/branches/release24-maint/Objects/longobject.c (original) +++ python/branches/release24-maint/Objects/longobject.c Wed Oct 4 12:13:32 2006 @@ -188,6 +188,17 @@ return (PyObject *)v; } +/* Checking for overflow in PyLong_AsLong is a PITA since C doesn't define + * anything about what happens when a signed integer operation overflows, + * and some compilers think they're doing you a favor by being "clever" + * then. The bit pattern for the largest postive signed long is + * (unsigned long)LONG_MAX, and for the smallest negative signed long + * it is abs(LONG_MIN), which we could write -(unsigned long)LONG_MIN. + * However, some other compilers warn about applying unary minus to an + * unsigned operand. Hence the weird "0-". + */ +#define Py_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) + /* Get a C long int from a long int object. Returns -1 and sets an error condition if overflow occurs. */ @@ -219,14 +230,16 @@ if ((x >> SHIFT) != prev) goto overflow; } - /* Haven't lost any bits, but if the sign bit is set we're in - * trouble *unless* this is the min negative number. So, - * trouble iff sign bit set && (positive || some bit set other - * than the sign bit). + /* Haven't lost any bits, but casting to long requires extra care + * (see comment above). */ - if ((long)x < 0 && (sign > 0 || (x << 1) != 0)) - goto overflow; - return (long)x * sign; + if (x <= (unsigned long)LONG_MAX) { + return (long)x * sign; + } + else if (sign < 0 && x == Py_ABS_LONG_MIN) { + return LONG_MIN; + } + /* else overflow */ overflow: PyErr_SetString(PyExc_OverflowError, @@ -1042,7 +1055,7 @@ { register PyLongObject *a = (PyLongObject *)aa; PyStringObject *str; - int i; + int i, j, sz; int size_a; char *p; int bits; @@ -1062,11 +1075,18 @@ ++bits; i >>= 1; } - i = 5 + (addL ? 1 : 0) + (size_a*SHIFT + bits-1) / bits; - str = (PyStringObject *) PyString_FromStringAndSize((char *)0, i); + i = 5 + (addL ? 1 : 0); + j = size_a*SHIFT + bits-1; + sz = i + j / bits; + if (j / SHIFT < size_a || sz < i) { + PyErr_SetString(PyExc_OverflowError, + "long is too large to format"); + return NULL; + } + str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz); if (str == NULL) return NULL; - p = PyString_AS_STRING(str) + i; + p = PyString_AS_STRING(str) + sz; *p = '\0'; if (addL) *--p = 'L'; @@ -1224,14 +1244,14 @@ ++p; } *str = p; - n = (p - start) * bits_per_char; - if (n / bits_per_char != p - start) { + /* n <- # of Python digits needed, = ceiling(n/SHIFT). */ + n = (p - start) * bits_per_char + SHIFT - 1; + if (n / bits_per_char < p - start) { PyErr_SetString(PyExc_ValueError, "long string too large to convert"); return NULL; } - /* n <- # of Python digits needed, = ceiling(n/SHIFT). */ - n = (n + SHIFT - 1) / SHIFT; + n = n / SHIFT; z = _PyLong_New(n); if (z == NULL) return NULL; Modified: python/branches/release24-maint/Objects/stringobject.c ============================================================================== --- python/branches/release24-maint/Objects/stringobject.c (original) +++ python/branches/release24-maint/Objects/stringobject.c Wed Oct 4 12:13:32 2006 @@ -799,7 +799,7 @@ register PyStringObject* op = (PyStringObject*) obj; size_t newsize = 2 + 4 * op->ob_size; PyObject *v; - if (newsize > INT_MAX) { + if (newsize > INT_MAX || newsize / 4 != op->ob_size) { PyErr_SetString(PyExc_OverflowError, "string is too large to make repr"); } Modified: python/branches/release24-maint/Objects/unicodeobject.c ============================================================================== --- python/branches/release24-maint/Objects/unicodeobject.c (original) +++ python/branches/release24-maint/Objects/unicodeobject.c Wed Oct 4 12:13:32 2006 @@ -2316,6 +2316,7 @@ PyObject *exc = NULL; unimax = PyUnicode_GetMax(); + /* XXX overflow detection missing */ v = _PyUnicode_New((size+Py_UNICODE_SIZE-1)/ Py_UNICODE_SIZE); if (v == NULL) goto onError; @@ -2931,6 +2932,7 @@ int needed = (targetsize - extrachars) + \ (targetsize << 2); extrachars += needed; + /* XXX overflow detection missing */ if (_PyUnicode_Resize(&v, PyUnicode_GET_SIZE(v) + needed) < 0) { Py_DECREF(x); Modified: python/branches/release24-maint/Python/marshal.c ============================================================================== --- python/branches/release24-maint/Python/marshal.c (original) +++ python/branches/release24-maint/Python/marshal.c Wed Oct 4 12:13:32 2006 @@ -451,6 +451,11 @@ int size; PyLongObject *ob; n = r_long(p); + if (n < -INT_MAX || n > INT_MAX) { + PyErr_SetString(PyExc_ValueError, + "bad marshal data"); + return NULL; + } size = n<0 ? -n : n; ob = _PyLong_New(size); if (ob == NULL) @@ -518,7 +523,7 @@ case TYPE_INTERNED: case TYPE_STRING: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -539,6 +544,10 @@ case TYPE_STRINGREF: n = r_long(p); + if (n < 0 || n >= PyList_GET_SIZE(p->strings)) { + PyErr_SetString(PyExc_ValueError, "bad marshal data"); + return NULL; + } v = PyList_GET_ITEM(p->strings, n); Py_INCREF(v); return v; @@ -549,7 +558,7 @@ char *buffer; n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -570,7 +579,7 @@ case TYPE_TUPLE: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -593,7 +602,7 @@ case TYPE_LIST: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -643,10 +652,11 @@ return NULL; } else { - int argcount = r_long(p); - int nlocals = r_long(p); - int stacksize = r_long(p); - int flags = r_long(p); + /* XXX ignore long->int overflows for now */ + int argcount = (int)r_long(p); + int nlocals = (int)r_long(p); + int stacksize = (int)r_long(p); + int flags = (int)r_long(p); PyObject *code = r_object(p); PyObject *consts = r_object(p); PyObject *names = r_object(p); @@ -655,7 +665,7 @@ PyObject *cellvars = r_object(p); PyObject *filename = r_object(p); PyObject *name = r_object(p); - int firstlineno = r_long(p); + int firstlineno = (int)r_long(p); PyObject *lnotab = r_object(p); if (!PyErr_Occurred()) { @@ -821,10 +831,16 @@ wf.strings = (version > 0) ? PyDict_New() : NULL; w_object(x, &wf); Py_XDECREF(wf.strings); - if (wf.str != NULL) - _PyString_Resize(&wf.str, - (int) (wf.ptr - - PyString_AS_STRING((PyStringObject *)wf.str))); + if (wf.str != NULL) { + char *base = PyString_AS_STRING((PyStringObject *)wf.str); + if (wf.ptr - base > INT_MAX) { + Py_DECREF(wf.str); + PyErr_SetString(PyExc_OverflowError, + "too much marshall data for a string"); + return NULL; + } + _PyString_Resize(&wf.str, (int)(wf.ptr - base)); + } if (wf.error) { Py_XDECREF(wf.str); PyErr_SetString(PyExc_ValueError, Modified: python/branches/release24-maint/Python/mystrtoul.c ============================================================================== --- python/branches/release24-maint/Python/mystrtoul.c (original) +++ python/branches/release24-maint/Python/mystrtoul.c Wed Oct 4 12:13:32 2006 @@ -122,30 +122,38 @@ return result; } +/* Checking for overflow in PyOS_strtol is a PITA; see comments + * about Py_ABS_LONG_MIN in longobject.c. + */ +#define Py_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) + long PyOS_strtol(char *str, char **ptr, int base) { long result; + unsigned long uresult; char sign; - + while (*str && isspace(Py_CHARMASK(*str))) str++; - + sign = *str; if (sign == '+' || sign == '-') str++; - - result = (long) PyOS_strtoul(str, ptr, base); - - /* Signal overflow if the result appears negative, - except for the largest negative integer */ - if (result < 0 && !(sign == '-' && result == -result)) { + + uresult = PyOS_strtoul(str, ptr, base); + + if (uresult <= (unsigned long)LONG_MAX) { + result = (long)uresult; + if (sign == '-') + result = -result; + } + else if (sign == '-' && uresult == Py_ABS_LONG_MIN) { + result = LONG_MIN; + } + else { errno = ERANGE; result = 0x7fffffff; } - - if (sign == '-') - result = -result; - return result; } From buildbot at python.org Wed Oct 4 12:14:56 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 10:14:56 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4 Message-ID: <20061004101457.1C2F21E4005@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.4/builds/189 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 12:23:58 2006 From: python-checkins at python.org (armin.rigo) Date: Wed, 4 Oct 2006 12:23:58 +0200 (CEST) Subject: [Python-checkins] r52137 - in python: branches/release24-maint/Modules/linuxaudiodev.c branches/release24-maint/Modules/ossaudiodev.c branches/release25-maint/Modules/linuxaudiodev.c branches/release25-maint/Modules/ossaudiodev.c trunk/Modules/linuxaudiodev.c trunk/Modules/ossaudiodev.c Message-ID: <20061004102358.E7AAA1E4005@bag.python.org> Author: armin.rigo Date: Wed Oct 4 12:23:57 2006 New Revision: 52137 Modified: python/branches/release24-maint/Modules/linuxaudiodev.c python/branches/release24-maint/Modules/ossaudiodev.c python/branches/release25-maint/Modules/linuxaudiodev.c python/branches/release25-maint/Modules/ossaudiodev.c python/trunk/Modules/linuxaudiodev.c python/trunk/Modules/ossaudiodev.c Log: Compilation problem caused by conflicting typedefs for uint32_t (unsigned long vs. unsigned int). Modified: python/branches/release24-maint/Modules/linuxaudiodev.c ============================================================================== --- python/branches/release24-maint/Modules/linuxaudiodev.c (original) +++ python/branches/release24-maint/Modules/linuxaudiodev.c Wed Oct 4 12:23:57 2006 @@ -28,7 +28,9 @@ #if defined(linux) #include +#ifndef HAVE_STDINT_H typedef unsigned long uint32_t; +#endif #elif defined(__FreeBSD__) #include Modified: python/branches/release24-maint/Modules/ossaudiodev.c ============================================================================== --- python/branches/release24-maint/Modules/ossaudiodev.c (original) +++ python/branches/release24-maint/Modules/ossaudiodev.c Wed Oct 4 12:23:57 2006 @@ -34,7 +34,9 @@ #if defined(linux) +#ifndef HAVE_STDINT_H typedef unsigned long uint32_t; +#endif #elif defined(__FreeBSD__) Modified: python/branches/release25-maint/Modules/linuxaudiodev.c ============================================================================== --- python/branches/release25-maint/Modules/linuxaudiodev.c (original) +++ python/branches/release25-maint/Modules/linuxaudiodev.c Wed Oct 4 12:23:57 2006 @@ -28,7 +28,9 @@ #if defined(linux) #include +#ifndef HAVE_STDINT_H typedef unsigned long uint32_t; +#endif #elif defined(__FreeBSD__) #include Modified: python/branches/release25-maint/Modules/ossaudiodev.c ============================================================================== --- python/branches/release25-maint/Modules/ossaudiodev.c (original) +++ python/branches/release25-maint/Modules/ossaudiodev.c Wed Oct 4 12:23:57 2006 @@ -34,7 +34,9 @@ #if defined(linux) +#ifndef HAVE_STDINT_H typedef unsigned long uint32_t; +#endif #elif defined(__FreeBSD__) Modified: python/trunk/Modules/linuxaudiodev.c ============================================================================== --- python/trunk/Modules/linuxaudiodev.c (original) +++ python/trunk/Modules/linuxaudiodev.c Wed Oct 4 12:23:57 2006 @@ -28,7 +28,9 @@ #if defined(linux) #include +#ifndef HAVE_STDINT_H typedef unsigned long uint32_t; +#endif #elif defined(__FreeBSD__) #include Modified: python/trunk/Modules/ossaudiodev.c ============================================================================== --- python/trunk/Modules/ossaudiodev.c (original) +++ python/trunk/Modules/ossaudiodev.c Wed Oct 4 12:23:57 2006 @@ -34,7 +34,9 @@ #if defined(linux) +#ifndef HAVE_STDINT_H typedef unsigned long uint32_t; +#endif #elif defined(__FreeBSD__) From buildbot at python.org Wed Oct 4 12:46:29 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 10:46:29 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061004104629.29A631E4017@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%2520trunk/builds/1198 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 13:44:11 2006 From: python-checkins at python.org (armin.rigo) Date: Wed, 4 Oct 2006 13:44:11 +0200 (CEST) Subject: [Python-checkins] r52138 - in python/branches/release25-maint: Lib/test/list_tests.py Lib/test/test_builtin.py Lib/test/test_long.py Misc/NEWS Modules/cPickle.c Objects/abstract.c Objects/fileobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/stringobject.c Objects/typeobject.c Objects/unicodeobject.c Python/errors.c Python/getargs.c Python/marshal.c Python/modsupport.c Python/mystrtoul.c Python/sysmodule.c Message-ID: <20061004114411.504BF1E4005@bag.python.org> Author: armin.rigo Date: Wed Oct 4 13:44:06 2006 New Revision: 52138 Modified: python/branches/release25-maint/Lib/test/list_tests.py python/branches/release25-maint/Lib/test/test_builtin.py python/branches/release25-maint/Lib/test/test_long.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/cPickle.c python/branches/release25-maint/Objects/abstract.c python/branches/release25-maint/Objects/fileobject.c python/branches/release25-maint/Objects/intobject.c python/branches/release25-maint/Objects/listobject.c python/branches/release25-maint/Objects/longobject.c python/branches/release25-maint/Objects/stringobject.c python/branches/release25-maint/Objects/typeobject.c python/branches/release25-maint/Objects/unicodeobject.c python/branches/release25-maint/Python/errors.c python/branches/release25-maint/Python/getargs.c python/branches/release25-maint/Python/marshal.c python/branches/release25-maint/Python/modsupport.c python/branches/release25-maint/Python/mystrtoul.c python/branches/release25-maint/Python/sysmodule.c Log: Forward-port of r52136: a review of overflow-detecting code. * unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c. * 2.5 specific: fixed a number of places that were still confusing int and Py_ssize_t. Some of them could potentially have caused "real-world" breakage. * list.pop(x): fixing overflow issues on x was messy. I just reverted to PyArg_ParseTuple("n"), which does the right thing. (An obscure test was trying to give a Decimal to list.pop()... doesn't make sense any more IMHO) * trying to write a few tests... Modified: python/branches/release25-maint/Lib/test/list_tests.py ============================================================================== --- python/branches/release25-maint/Lib/test/list_tests.py (original) +++ python/branches/release25-maint/Lib/test/list_tests.py Wed Oct 4 13:44:06 2006 @@ -269,7 +269,6 @@ self.assertRaises(TypeError, a.insert) def test_pop(self): - from decimal import Decimal a = self.type2test([-1, 0, 1]) a.pop() self.assertEqual(a, [-1, 0]) @@ -281,8 +280,6 @@ self.assertRaises(IndexError, a.pop) self.assertRaises(TypeError, a.pop, 42, 42) a = self.type2test([0, 10, 20, 30, 40]) - self.assertEqual(a.pop(Decimal(2)), 20) - self.assertRaises(IndexError, a.pop, Decimal(25)) def test_remove(self): a = self.type2test([0, 0, 1]) Modified: python/branches/release25-maint/Lib/test/test_builtin.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_builtin.py (original) +++ python/branches/release25-maint/Lib/test/test_builtin.py Wed Oct 4 13:44:06 2006 @@ -156,6 +156,11 @@ S = [10, 20, 30] self.assertEqual(any(x > 42 for x in S), False) + def test_neg(self): + x = -sys.maxint-1 + self.assert_(isinstance(x, int)) + self.assertEqual(-x, sys.maxint+1) + def test_apply(self): def f0(*args): self.assertEqual(args, ()) @@ -702,9 +707,11 @@ pass s = repr(-1-sys.maxint) - self.assertEqual(int(s)+1, -sys.maxint) + x = int(s) + self.assertEqual(x+1, -sys.maxint) + self.assert_(isinstance(x, int)) # should return long - int(s[1:]) + self.assertEqual(int(s[1:]), sys.maxint+1) # should return long x = int(1e100) Modified: python/branches/release25-maint/Lib/test/test_long.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_long.py (original) +++ python/branches/release25-maint/Lib/test/test_long.py Wed Oct 4 13:44:06 2006 @@ -247,17 +247,23 @@ "long(-sys.maxint-1) != -sys.maxint-1") # long -> int should not fail for hugepos_aslong or hugeneg_aslong + x = int(hugepos_aslong) try: - self.assertEqual(int(hugepos_aslong), hugepos, + self.assertEqual(x, hugepos, "converting sys.maxint to long and back to int fails") except OverflowError: self.fail("int(long(sys.maxint)) overflowed!") + if not isinstance(x, int): + raise TestFailed("int(long(sys.maxint)) should have returned int") + x = int(hugeneg_aslong) try: - self.assertEqual(int(hugeneg_aslong), hugeneg, + self.assertEqual(x, hugeneg, "converting -sys.maxint-1 to long and back to int fails") except OverflowError: self.fail("int(long(-sys.maxint-1)) overflowed!") - + if not isinstance(x, int): + raise TestFailed("int(long(-sys.maxint-1)) should have " + "returned int") # but long -> int should overflow for hugepos+1 and hugeneg-1 x = hugepos_aslong + 1 try: @@ -282,6 +288,17 @@ self.assert_(type(y) is long, "overflowing int conversion must return long not long subtype") + # long -> Py_ssize_t conversion + class X(object): + def __getslice__(self, i, j): + return i, j + + self.assertEqual(X()[-5L:7L], (-5, 7)) + # use the clamping effect to test the smallest and largest longs + # that fit a Py_ssize_t + slicemin, slicemax = X()[-2L**100:2L**100] + self.assertEqual(X()[slicemin:slicemax], (slicemin, slicemax)) + # ----------------------------------- tests of auto int->long conversion def test_auto_overflow(self): Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Wed Oct 4 13:44:06 2006 @@ -12,8 +12,14 @@ Core and builtins ----------------- -- Integer negation and absolute value were fixed to not rely - on undefined behaviour of the C compiler anymore. +- list.pop(x) accepts any object x following the __index__ protocol. + +- Fix some leftovers from the conversion from int to Py_ssize_t + (relevant to strings and sequences of more than 2**31 items). + +- A number of places, including integer negation and absolute value, + were fixed to not rely on undefined behaviour of the C compiler + anymore. - Bug #1566800: make sure that EnvironmentError can be called with any number of arguments, as was the case in Python 2.4. Modified: python/branches/release25-maint/Modules/cPickle.c ============================================================================== --- python/branches/release25-maint/Modules/cPickle.c (original) +++ python/branches/release25-maint/Modules/cPickle.c Wed Oct 4 13:44:06 2006 @@ -1024,7 +1024,7 @@ static int save_long(Picklerobject *self, PyObject *args) { - int size; + Py_ssize_t size; int res = -1; PyObject *repr = NULL; @@ -1066,7 +1066,7 @@ * byte at the start, and cut it back later if possible. */ nbytes = (nbits >> 3) + 1; - if ((int)nbytes < 0 || (size_t)(int)nbytes != nbytes) { + if (nbytes > INT_MAX) { PyErr_SetString(PyExc_OverflowError, "long too large " "to pickle"); goto finally; @@ -1208,12 +1208,14 @@ c_str[1] = size; len = 2; } - else { + else if (size <= INT_MAX) { c_str[0] = BINSTRING; for (i = 1; i < 5; i++) c_str[i] = (int)(size >> ((i - 1) * 8)); len = 5; } + else + return -1; /* string too large */ if (self->write_func(self, c_str, len) < 0) return -1; @@ -1286,7 +1288,7 @@ static int save_unicode(Picklerobject *self, PyObject *args, int doput) { - int size, len; + Py_ssize_t size, len; PyObject *repr=0; if (!PyUnicode_Check(args)) @@ -1325,6 +1327,8 @@ if ((size = PyString_Size(repr)) < 0) goto err; + if (size > INT_MAX) + return -1; /* string too large */ c_str[0] = BINUNICODE; for (i = 1; i < 5; i++) Modified: python/branches/release25-maint/Objects/abstract.c ============================================================================== --- python/branches/release25-maint/Objects/abstract.c (original) +++ python/branches/release25-maint/Objects/abstract.c Wed Oct 4 13:44:06 2006 @@ -1652,20 +1652,18 @@ if (cmp > 0) { switch (operation) { case PY_ITERSEARCH_COUNT: - ++n; - if (n <= 0) { - /* XXX(nnorwitz): int means ssize_t */ + if (n == PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, - "count exceeds C int size"); + "count exceeds C integer size"); goto Fail; } + ++n; break; case PY_ITERSEARCH_INDEX: if (wrapped) { - /* XXX(nnorwitz): int means ssize_t */ PyErr_SetString(PyExc_OverflowError, - "index exceeds C int size"); + "index exceeds C integer size"); goto Fail; } goto Done; @@ -1680,9 +1678,9 @@ } if (operation == PY_ITERSEARCH_INDEX) { - ++n; - if (n <= 0) + if (n == PY_SSIZE_T_MAX) wrapped = 1; + ++n; } } Modified: python/branches/release25-maint/Objects/fileobject.c ============================================================================== --- python/branches/release25-maint/Objects/fileobject.c (original) +++ python/branches/release25-maint/Objects/fileobject.c Wed Oct 4 13:44:06 2006 @@ -1001,6 +1001,7 @@ size_t nfree; /* # of free buffer slots; pvend-pvfree */ size_t total_v_size; /* total # of slots in buffer */ size_t increment; /* amount to increment the buffer */ + size_t prev_v_size; /* Optimize for normal case: avoid _PyString_Resize if at all * possible via first reading into stack buffer "buf". @@ -1115,8 +1116,11 @@ /* expand buffer and try again */ assert(*(pvend-1) == '\0'); increment = total_v_size >> 2; /* mild exponential growth */ + prev_v_size = total_v_size; total_v_size += increment; - if (total_v_size > PY_SSIZE_T_MAX) { + /* check for overflow */ + if (total_v_size <= prev_v_size || + total_v_size > PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, "line is longer than a Python string can hold"); Py_DECREF(v); @@ -1125,7 +1129,7 @@ if (_PyString_Resize(&v, (int)total_v_size) < 0) return NULL; /* overwrite the trailing null byte */ - pvfree = BUF(v) + (total_v_size - increment - 1); + pvfree = BUF(v) + (prev_v_size - 1); } if (BUF(v) + total_v_size != p) _PyString_Resize(&v, p - BUF(v)); Modified: python/branches/release25-maint/Objects/intobject.c ============================================================================== --- python/branches/release25-maint/Objects/intobject.c (original) +++ python/branches/release25-maint/Objects/intobject.c Wed Oct 4 13:44:06 2006 @@ -546,6 +546,17 @@ } } +/* Integer overflow checking for unary negation: on a 2's-complement + * box, -x overflows iff x is the most negative long. In this case we + * get -x == x. However, -x is undefined (by C) if x /is/ the most + * negative long (it's a signed overflow case), and some compilers care. + * So we cast x to unsigned long first. However, then other compilers + * warn about applying unary minus to an unsigned operand. Hence the + * weird "0-". + */ +#define UNARY_NEG_WOULD_OVERFLOW(x) \ + ((x) < 0 && (unsigned long)(x) == 0-(unsigned long)(x)) + /* Return type of i_divmod */ enum divmod_result { DIVMOD_OK, /* Correct result */ @@ -564,14 +575,8 @@ "integer division or modulo by zero"); return DIVMOD_ERROR; } - /* (-sys.maxint-1)/-1 is the only overflow case. x is the most - * negative long iff x < 0 and, on a 2's-complement box, x == -x. - * However, -x is undefined (by C) if x /is/ the most negative long - * (it's a signed overflow case), and some compilers care. So we cast - * x to unsigned long first. However, then other compilers warn about - * applying unary minus to an unsigned operand. Hence the weird "0-". - */ - if (y == -1 && x < 0 && (unsigned long)x == 0-(unsigned long)x) + /* (-sys.maxint-1)/-1 is the only overflow case. */ + if (y == -1 && UNARY_NEG_WOULD_OVERFLOW(x)) return DIVMOD_OVERFLOW; xdivy = x / y; xmody = x - xdivy * y; @@ -762,7 +767,8 @@ { register long a; a = v->ob_ival; - if (a < 0 && (unsigned long)a == 0-(unsigned long)a) { + /* check for overflow */ + if (UNARY_NEG_WOULD_OVERFLOW(a)) { PyObject *o = PyLong_FromLong(a); if (o != NULL) { PyObject *result = PyNumber_Negative(o); Modified: python/branches/release25-maint/Objects/listobject.c ============================================================================== --- python/branches/release25-maint/Objects/listobject.c (original) +++ python/branches/release25-maint/Objects/listobject.c Wed Oct 4 13:44:06 2006 @@ -863,17 +863,12 @@ listpop(PyListObject *self, PyObject *args) { Py_ssize_t i = -1; - PyObject *v, *arg = NULL; + PyObject *v; int status; - if (!PyArg_UnpackTuple(args, "pop", 0, 1, &arg)) + if (!PyArg_ParseTuple(args, "|n:pop", &i)) return NULL; - if (arg != NULL) { - if (PyInt_Check(arg)) - i = PyInt_AS_LONG((PyIntObject*) arg); - else if (!PyArg_ParseTuple(args, "|n:pop", &i)) - return NULL; - } + if (self->ob_size == 0) { /* Special-case most common failure cause */ PyErr_SetString(PyExc_IndexError, "pop from empty list"); Modified: python/branches/release25-maint/Objects/longobject.c ============================================================================== --- python/branches/release25-maint/Objects/longobject.c (original) +++ python/branches/release25-maint/Objects/longobject.c Wed Oct 4 13:44:06 2006 @@ -193,6 +193,18 @@ return (PyObject *)v; } +/* Checking for overflow in PyLong_AsLong is a PITA since C doesn't define + * anything about what happens when a signed integer operation overflows, + * and some compilers think they're doing you a favor by being "clever" + * then. The bit pattern for the largest postive signed long is + * (unsigned long)LONG_MAX, and for the smallest negative signed long + * it is abs(LONG_MIN), which we could write -(unsigned long)LONG_MIN. + * However, some other compilers warn about applying unary minus to an + * unsigned operand. Hence the weird "0-". + */ +#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) +#define PY_ABS_SSIZE_T_MIN (0-(size_t)PY_SSIZE_T_MIN) + /* Get a C long int from a long int object. Returns -1 and sets an error condition if overflow occurs. */ @@ -225,14 +237,16 @@ if ((x >> SHIFT) != prev) goto overflow; } - /* Haven't lost any bits, but if the sign bit is set we're in - * trouble *unless* this is the min negative number. So, - * trouble iff sign bit set && (positive || some bit set other - * than the sign bit). - */ - if ((long)x < 0 && (sign > 0 || (x << 1) != 0)) - goto overflow; - return (long)x * sign; + /* Haven't lost any bits, but casting to long requires extra care + * (see comment above). + */ + if (x <= (unsigned long)LONG_MAX) { + return (long)x * sign; + } + else if (sign < 0 && x == PY_ABS_LONG_MIN) { + return LONG_MIN; + } + /* else overflow */ overflow: PyErr_SetString(PyExc_OverflowError, @@ -268,14 +282,16 @@ if ((x >> SHIFT) != prev) goto overflow; } - /* Haven't lost any bits, but if the sign bit is set we're in - * trouble *unless* this is the min negative number. So, - * trouble iff sign bit set && (positive || some bit set other - * than the sign bit). + /* Haven't lost any bits, but casting to a signed type requires + * extra care (see comment above). */ - if ((Py_ssize_t)x < 0 && (sign > 0 || (x << 1) != 0)) - goto overflow; - return (Py_ssize_t)x * sign; + if (x <= (size_t)PY_SSIZE_T_MAX) { + return (Py_ssize_t)x * sign; + } + else if (sign < 0 && x == PY_ABS_SSIZE_T_MIN) { + return PY_SSIZE_T_MIN; + } + /* else overflow */ overflow: PyErr_SetString(PyExc_OverflowError, @@ -1167,7 +1183,7 @@ { register PyLongObject *a = (PyLongObject *)aa; PyStringObject *str; - Py_ssize_t i; + Py_ssize_t i, j, sz; Py_ssize_t size_a; char *p; int bits; @@ -1187,11 +1203,18 @@ ++bits; i >>= 1; } - i = 5 + (addL ? 1 : 0) + (size_a*SHIFT + bits-1) / bits; - str = (PyStringObject *) PyString_FromStringAndSize((char *)0, i); + i = 5 + (addL ? 1 : 0); + j = size_a*SHIFT + bits-1; + sz = i + j / bits; + if (j / SHIFT < size_a || sz < i) { + PyErr_SetString(PyExc_OverflowError, + "long is too large to format"); + return NULL; + } + str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz); if (str == NULL) return NULL; - p = PyString_AS_STRING(str) + i; + p = PyString_AS_STRING(str) + sz; *p = '\0'; if (addL) *--p = 'L'; @@ -1305,7 +1328,7 @@ } while ((*q++ = *p++) != '\0'); q--; _PyString_Resize((PyObject **)&str, - (int) (q - PyString_AS_STRING(str))); + (Py_ssize_t) (q - PyString_AS_STRING(str))); } return (PyObject *)str; } @@ -1363,14 +1386,14 @@ while (_PyLong_DigitValue[Py_CHARMASK(*p)] < base) ++p; *str = p; - n = (p - start) * bits_per_char; - if (n / bits_per_char != p - start) { + /* n <- # of Python digits needed, = ceiling(n/SHIFT). */ + n = (p - start) * bits_per_char + SHIFT - 1; + if (n / bits_per_char < p - start) { PyErr_SetString(PyExc_ValueError, "long string too large to convert"); return NULL; } - /* n <- # of Python digits needed, = ceiling(n/SHIFT). */ - n = (n + SHIFT - 1) / SHIFT; + n = n / SHIFT; z = _PyLong_New(n); if (z == NULL) return NULL; Modified: python/branches/release25-maint/Objects/stringobject.c ============================================================================== --- python/branches/release25-maint/Objects/stringobject.c (original) +++ python/branches/release25-maint/Objects/stringobject.c Wed Oct 4 13:44:06 2006 @@ -804,10 +804,22 @@ return ret; } if (flags & Py_PRINT_RAW) { + char *data = op->ob_sval; + Py_ssize_t size = op->ob_size; + while (size > INT_MAX) { + /* Very long strings cannot be written atomically. + * But don't write exactly INT_MAX bytes at a time + * to avoid memory aligment issues. + */ + const int chunk_size = INT_MAX & ~0x3FFF; + fwrite(data, 1, chunk_size, fp); + data += chunk_size; + size -= chunk_size; + } #ifdef __VMS - if (op->ob_size) fwrite(op->ob_sval, (int) op->ob_size, 1, fp); + if (size) fwrite(data, (int)size, 1, fp); #else - fwrite(op->ob_sval, 1, (int) op->ob_size, fp); + fwrite(data, 1, (int)size, fp); #endif return 0; } @@ -844,7 +856,7 @@ register PyStringObject* op = (PyStringObject*) obj; size_t newsize = 2 + 4 * op->ob_size; PyObject *v; - if (newsize > PY_SSIZE_T_MAX) { + if (newsize > PY_SSIZE_T_MAX || newsize / 4 != op->ob_size) { PyErr_SetString(PyExc_OverflowError, "string is too large to make repr"); } @@ -4237,7 +4249,7 @@ return NULL; } llen = PyString_Size(result); - if (llen > PY_SSIZE_T_MAX) { + if (llen > INT_MAX) { PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong"); return NULL; } @@ -4726,9 +4738,10 @@ default: PyErr_Format(PyExc_ValueError, "unsupported format character '%c' (0x%x) " - "at index %i", + "at index %zd", c, c, - (int)(fmt - 1 - PyString_AsString(format))); + (Py_ssize_t)(fmt - 1 - + PyString_AsString(format))); goto error; } if (sign) { Modified: python/branches/release25-maint/Objects/typeobject.c ============================================================================== --- python/branches/release25-maint/Objects/typeobject.c (original) +++ python/branches/release25-maint/Objects/typeobject.c Wed Oct 4 13:44:06 2006 @@ -98,7 +98,7 @@ s = strrchr(type->tp_name, '.'); if (s != NULL) return PyString_FromStringAndSize( - type->tp_name, (int)(s - type->tp_name)); + type->tp_name, (Py_ssize_t)(s - type->tp_name)); return PyString_FromString("__builtin__"); } } @@ -4116,19 +4116,10 @@ return -1; len = PyInt_AsSsize_t(res); Py_DECREF(res); - if (len == -1 && PyErr_Occurred()) - return -1; -#if SIZEOF_SIZE_T < SIZEOF_INT - /* Overflow check -- range of PyInt is more than C ssize_t */ - if (len != (int)len) { - PyErr_SetString(PyExc_OverflowError, - "__len__() should return 0 <= outcome < 2**31"); - return -1; - } -#endif if (len < 0) { - PyErr_SetString(PyExc_ValueError, - "__len__() should return >= 0"); + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_ValueError, + "__len__() should return >= 0"); return -1; } return len; Modified: python/branches/release25-maint/Objects/unicodeobject.c ============================================================================== --- python/branches/release25-maint/Objects/unicodeobject.c (original) +++ python/branches/release25-maint/Objects/unicodeobject.c Wed Oct 4 13:44:06 2006 @@ -2380,6 +2380,7 @@ Py_UNICODE unimax = PyUnicode_GetMax(); #endif + /* XXX overflow detection missing */ v = _PyUnicode_New((size+Py_UNICODE_SIZE-1)/ Py_UNICODE_SIZE); if (v == NULL) goto onError; @@ -3166,6 +3167,7 @@ Py_ssize_t needed = (targetsize - extrachars) + \ (targetsize << 2); extrachars += needed; + /* XXX overflow detection missing */ if (_PyUnicode_Resize(&v, PyUnicode_GET_SIZE(v) + needed) < 0) { Py_DECREF(x); @@ -7758,10 +7760,11 @@ default: PyErr_Format(PyExc_ValueError, "unsupported format character '%c' (0x%x) " - "at index %i", + "at index %zd", (31<=c && c<=126) ? (char)c : '?', (int)c, - (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); + (Py_ssize_t)(fmt - 1 - + PyUnicode_AS_UNICODE(uformat))); goto onError; } if (sign) { Modified: python/branches/release25-maint/Python/errors.c ============================================================================== --- python/branches/release25-maint/Python/errors.c (original) +++ python/branches/release25-maint/Python/errors.c Wed Oct 4 13:44:06 2006 @@ -551,7 +551,8 @@ goto failure; } if (PyDict_GetItemString(dict, "__module__") == NULL) { - modulename = PyString_FromStringAndSize(name, (int)(dot-name)); + modulename = PyString_FromStringAndSize(name, + (Py_ssize_t)(dot-name)); if (modulename == NULL) goto failure; if (PyDict_SetItemString(dict, "__module__", modulename) != 0) Modified: python/branches/release25-maint/Python/getargs.c ============================================================================== --- python/branches/release25-maint/Python/getargs.c (original) +++ python/branches/release25-maint/Python/getargs.c Wed Oct 4 13:44:06 2006 @@ -815,7 +815,7 @@ #endif else return converterr("string", arg, msgbuf, bufsize); - if ((int)strlen(*p) != PyString_Size(arg)) + if ((Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr("string without null bytes", arg, msgbuf, bufsize); } @@ -882,7 +882,7 @@ format++; } else if (*p != NULL && - (int)strlen(*p) != PyString_Size(arg)) + (Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr( "string without null bytes or None", arg, msgbuf, bufsize); @@ -1029,7 +1029,8 @@ PyMem_Free()ing it after usage */ - if ((int)strlen(PyString_AS_STRING(s)) != size) { + if ((Py_ssize_t)strlen(PyString_AS_STRING(s)) + != size) { Py_DECREF(s); return converterr( "(encoded string without NULL bytes)", Modified: python/branches/release25-maint/Python/marshal.c ============================================================================== --- python/branches/release25-maint/Python/marshal.c (original) +++ python/branches/release25-maint/Python/marshal.c Wed Oct 4 13:44:06 2006 @@ -546,6 +546,11 @@ int size; PyLongObject *ob; n = r_long(p); + if (n < -INT_MAX || n > INT_MAX) { + PyErr_SetString(PyExc_ValueError, + "bad marshal data"); + return NULL; + } size = n<0 ? -n : n; ob = _PyLong_New(size); if (ob == NULL) @@ -654,7 +659,7 @@ case TYPE_INTERNED: case TYPE_STRING: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -689,7 +694,7 @@ char *buffer; n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -710,7 +715,7 @@ case TYPE_TUPLE: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -733,7 +738,7 @@ case TYPE_LIST: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -831,10 +836,11 @@ v = NULL; - argcount = r_long(p); - nlocals = r_long(p); - stacksize = r_long(p); - flags = r_long(p); + /* XXX ignore long->int overflows for now */ + argcount = (int)r_long(p); + nlocals = (int)r_long(p); + stacksize = (int)r_long(p); + flags = (int)r_long(p); code = r_object(p); if (code == NULL) goto code_error; @@ -859,7 +865,7 @@ name = r_object(p); if (name == NULL) goto code_error; - firstlineno = r_long(p); + firstlineno = (int)r_long(p); lnotab = r_object(p); if (lnotab == NULL) goto code_error; @@ -1031,10 +1037,16 @@ wf.strings = (version > 0) ? PyDict_New() : NULL; w_object(x, &wf); Py_XDECREF(wf.strings); - if (wf.str != NULL) - _PyString_Resize(&wf.str, - (int) (wf.ptr - - PyString_AS_STRING((PyStringObject *)wf.str))); + if (wf.str != NULL) { + char *base = PyString_AS_STRING((PyStringObject *)wf.str); + if (wf.ptr - base > PY_SSIZE_T_MAX) { + Py_DECREF(wf.str); + PyErr_SetString(PyExc_OverflowError, + "too much marshall data for a string"); + return NULL; + } + _PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); + } if (wf.error) { Py_XDECREF(wf.str); PyErr_SetString(PyExc_ValueError, Modified: python/branches/release25-maint/Python/modsupport.c ============================================================================== --- python/branches/release25-maint/Python/modsupport.c (original) +++ python/branches/release25-maint/Python/modsupport.c Wed Oct 4 13:44:06 2006 @@ -421,7 +421,7 @@ "string too long for Python string"); return NULL; } - n = (int)m; + n = (Py_ssize_t)m; } v = PyString_FromStringAndSize(str, n); } Modified: python/branches/release25-maint/Python/mystrtoul.c ============================================================================== --- python/branches/release25-maint/Python/mystrtoul.c (original) +++ python/branches/release25-maint/Python/mystrtoul.c Wed Oct 4 13:44:06 2006 @@ -195,13 +195,10 @@ return (unsigned long)-1; } -/* Checking for overflow in PyOS_strtol is a PITA since C doesn't define - * anything about what happens when a signed integer operation overflows, - * and some compilers think they're doing you a favor by being "clever" - * then. Python assumes a 2's-complement representation, so that the bit - * pattern for the largest postive signed long is LONG_MAX, and for - * the smallest negative signed long is LONG_MAX + 1. +/* Checking for overflow in PyOS_strtol is a PITA; see comments + * about PY_ABS_LONG_MIN in longobject.c. */ +#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) long PyOS_strtol(char *str, char **ptr, int base) @@ -224,8 +221,7 @@ if (sign == '-') result = -result; } - else if (sign == '-' && uresult == (unsigned long)LONG_MAX + 1) { - assert(LONG_MIN == -LONG_MAX-1); + else if (sign == '-' && uresult == PY_ABS_LONG_MIN) { result = LONG_MIN; } else { Modified: python/branches/release25-maint/Python/sysmodule.c ============================================================================== --- python/branches/release25-maint/Python/sysmodule.c (original) +++ python/branches/release25-maint/Python/sysmodule.c Wed Oct 4 13:44:06 2006 @@ -1225,7 +1225,7 @@ p = strchr(path, delim); if (p == NULL) p = strchr(path, '\0'); /* End of string */ - w = PyString_FromStringAndSize(path, (int) (p - path)); + w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path)); if (w == NULL) { Py_DECREF(v); return NULL; From python-checkins at python.org Wed Oct 4 14:17:49 2006 From: python-checkins at python.org (armin.rigo) Date: Wed, 4 Oct 2006 14:17:49 +0200 (CEST) Subject: [Python-checkins] r52139 - in python/trunk: Lib/test/list_tests.py Lib/test/test_builtin.py Lib/test/test_long.py Misc/NEWS Modules/cPickle.c Objects/abstract.c Objects/fileobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/stringobject.c Objects/typeobject.c Objects/unicodeobject.c Python/errors.c Python/getargs.c Python/marshal.c Python/modsupport.c Python/mystrtoul.c Python/sysmodule.c Message-ID: <20061004121749.38BF51E4007@bag.python.org> Author: armin.rigo Date: Wed Oct 4 14:17:45 2006 New Revision: 52139 Modified: python/trunk/Lib/test/list_tests.py python/trunk/Lib/test/test_builtin.py python/trunk/Lib/test/test_long.py python/trunk/Misc/NEWS python/trunk/Modules/cPickle.c python/trunk/Objects/abstract.c python/trunk/Objects/fileobject.c python/trunk/Objects/intobject.c python/trunk/Objects/listobject.c python/trunk/Objects/longobject.c python/trunk/Objects/stringobject.c python/trunk/Objects/typeobject.c python/trunk/Objects/unicodeobject.c python/trunk/Python/errors.c python/trunk/Python/getargs.c python/trunk/Python/marshal.c python/trunk/Python/modsupport.c python/trunk/Python/mystrtoul.c python/trunk/Python/sysmodule.c Log: Forward-port of r52136,52138: a review of overflow-detecting code. * unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c. * 2.5 specific: fixed a number of places that were still confusing int and Py_ssize_t. Some of them could potentially have caused "real-world" breakage. * list.pop(x): fixing overflow issues on x was messy. I just reverted to PyArg_ParseTuple("n"), which does the right thing. (An obscure test was trying to give a Decimal to list.pop()... doesn't make sense any more IMHO) * trying to write a few tests... Modified: python/trunk/Lib/test/list_tests.py ============================================================================== --- python/trunk/Lib/test/list_tests.py (original) +++ python/trunk/Lib/test/list_tests.py Wed Oct 4 14:17:45 2006 @@ -269,7 +269,6 @@ self.assertRaises(TypeError, a.insert) def test_pop(self): - from decimal import Decimal a = self.type2test([-1, 0, 1]) a.pop() self.assertEqual(a, [-1, 0]) @@ -281,8 +280,6 @@ self.assertRaises(IndexError, a.pop) self.assertRaises(TypeError, a.pop, 42, 42) a = self.type2test([0, 10, 20, 30, 40]) - self.assertEqual(a.pop(Decimal(2)), 20) - self.assertRaises(IndexError, a.pop, Decimal(25)) def test_remove(self): a = self.type2test([0, 0, 1]) Modified: python/trunk/Lib/test/test_builtin.py ============================================================================== --- python/trunk/Lib/test/test_builtin.py (original) +++ python/trunk/Lib/test/test_builtin.py Wed Oct 4 14:17:45 2006 @@ -156,6 +156,11 @@ S = [10, 20, 30] self.assertEqual(any(x > 42 for x in S), False) + def test_neg(self): + x = -sys.maxint-1 + self.assert_(isinstance(x, int)) + self.assertEqual(-x, sys.maxint+1) + def test_apply(self): def f0(*args): self.assertEqual(args, ()) @@ -702,9 +707,11 @@ pass s = repr(-1-sys.maxint) - self.assertEqual(int(s)+1, -sys.maxint) + x = int(s) + self.assertEqual(x+1, -sys.maxint) + self.assert_(isinstance(x, int)) # should return long - int(s[1:]) + self.assertEqual(int(s[1:]), sys.maxint+1) # should return long x = int(1e100) Modified: python/trunk/Lib/test/test_long.py ============================================================================== --- python/trunk/Lib/test/test_long.py (original) +++ python/trunk/Lib/test/test_long.py Wed Oct 4 14:17:45 2006 @@ -247,17 +247,23 @@ "long(-sys.maxint-1) != -sys.maxint-1") # long -> int should not fail for hugepos_aslong or hugeneg_aslong + x = int(hugepos_aslong) try: - self.assertEqual(int(hugepos_aslong), hugepos, + self.assertEqual(x, hugepos, "converting sys.maxint to long and back to int fails") except OverflowError: self.fail("int(long(sys.maxint)) overflowed!") + if not isinstance(x, int): + raise TestFailed("int(long(sys.maxint)) should have returned int") + x = int(hugeneg_aslong) try: - self.assertEqual(int(hugeneg_aslong), hugeneg, + self.assertEqual(x, hugeneg, "converting -sys.maxint-1 to long and back to int fails") except OverflowError: self.fail("int(long(-sys.maxint-1)) overflowed!") - + if not isinstance(x, int): + raise TestFailed("int(long(-sys.maxint-1)) should have " + "returned int") # but long -> int should overflow for hugepos+1 and hugeneg-1 x = hugepos_aslong + 1 try: @@ -282,6 +288,17 @@ self.assert_(type(y) is long, "overflowing int conversion must return long not long subtype") + # long -> Py_ssize_t conversion + class X(object): + def __getslice__(self, i, j): + return i, j + + self.assertEqual(X()[-5L:7L], (-5, 7)) + # use the clamping effect to test the smallest and largest longs + # that fit a Py_ssize_t + slicemin, slicemax = X()[-2L**100:2L**100] + self.assertEqual(X()[slicemin:slicemax], (slicemin, slicemax)) + # ----------------------------------- tests of auto int->long conversion def test_auto_overflow(self): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Oct 4 14:17:45 2006 @@ -12,8 +12,14 @@ Core and builtins ----------------- -- Integer negation and absolute value were fixed to not rely - on undefined behaviour of the C compiler anymore. +- list.pop(x) accepts any object x following the __index__ protocol. + +- Fix some leftovers from the conversion from int to Py_ssize_t + (relevant to strings and sequences of more than 2**31 items). + +- A number of places, including integer negation and absolute value, + were fixed to not rely on undefined behaviour of the C compiler + anymore. - Bug #1566800: make sure that EnvironmentError can be called with any number of arguments, as was the case in Python 2.4. Modified: python/trunk/Modules/cPickle.c ============================================================================== --- python/trunk/Modules/cPickle.c (original) +++ python/trunk/Modules/cPickle.c Wed Oct 4 14:17:45 2006 @@ -1024,7 +1024,7 @@ static int save_long(Picklerobject *self, PyObject *args) { - int size; + Py_ssize_t size; int res = -1; PyObject *repr = NULL; @@ -1066,7 +1066,7 @@ * byte at the start, and cut it back later if possible. */ nbytes = (nbits >> 3) + 1; - if ((int)nbytes < 0 || (size_t)(int)nbytes != nbytes) { + if (nbytes > INT_MAX) { PyErr_SetString(PyExc_OverflowError, "long too large " "to pickle"); goto finally; @@ -1208,12 +1208,14 @@ c_str[1] = size; len = 2; } - else { + else if (size <= INT_MAX) { c_str[0] = BINSTRING; for (i = 1; i < 5; i++) c_str[i] = (int)(size >> ((i - 1) * 8)); len = 5; } + else + return -1; /* string too large */ if (self->write_func(self, c_str, len) < 0) return -1; @@ -1286,7 +1288,7 @@ static int save_unicode(Picklerobject *self, PyObject *args, int doput) { - int size, len; + Py_ssize_t size, len; PyObject *repr=0; if (!PyUnicode_Check(args)) @@ -1325,6 +1327,8 @@ if ((size = PyString_Size(repr)) < 0) goto err; + if (size > INT_MAX) + return -1; /* string too large */ c_str[0] = BINUNICODE; for (i = 1; i < 5; i++) Modified: python/trunk/Objects/abstract.c ============================================================================== --- python/trunk/Objects/abstract.c (original) +++ python/trunk/Objects/abstract.c Wed Oct 4 14:17:45 2006 @@ -1652,20 +1652,18 @@ if (cmp > 0) { switch (operation) { case PY_ITERSEARCH_COUNT: - ++n; - if (n <= 0) { - /* XXX(nnorwitz): int means ssize_t */ + if (n == PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, - "count exceeds C int size"); + "count exceeds C integer size"); goto Fail; } + ++n; break; case PY_ITERSEARCH_INDEX: if (wrapped) { - /* XXX(nnorwitz): int means ssize_t */ PyErr_SetString(PyExc_OverflowError, - "index exceeds C int size"); + "index exceeds C integer size"); goto Fail; } goto Done; @@ -1680,9 +1678,9 @@ } if (operation == PY_ITERSEARCH_INDEX) { - ++n; - if (n <= 0) + if (n == PY_SSIZE_T_MAX) wrapped = 1; + ++n; } } Modified: python/trunk/Objects/fileobject.c ============================================================================== --- python/trunk/Objects/fileobject.c (original) +++ python/trunk/Objects/fileobject.c Wed Oct 4 14:17:45 2006 @@ -1001,6 +1001,7 @@ size_t nfree; /* # of free buffer slots; pvend-pvfree */ size_t total_v_size; /* total # of slots in buffer */ size_t increment; /* amount to increment the buffer */ + size_t prev_v_size; /* Optimize for normal case: avoid _PyString_Resize if at all * possible via first reading into stack buffer "buf". @@ -1115,8 +1116,11 @@ /* expand buffer and try again */ assert(*(pvend-1) == '\0'); increment = total_v_size >> 2; /* mild exponential growth */ + prev_v_size = total_v_size; total_v_size += increment; - if (total_v_size > PY_SSIZE_T_MAX) { + /* check for overflow */ + if (total_v_size <= prev_v_size || + total_v_size > PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, "line is longer than a Python string can hold"); Py_DECREF(v); @@ -1125,7 +1129,7 @@ if (_PyString_Resize(&v, (int)total_v_size) < 0) return NULL; /* overwrite the trailing null byte */ - pvfree = BUF(v) + (total_v_size - increment - 1); + pvfree = BUF(v) + (prev_v_size - 1); } if (BUF(v) + total_v_size != p) _PyString_Resize(&v, p - BUF(v)); Modified: python/trunk/Objects/intobject.c ============================================================================== --- python/trunk/Objects/intobject.c (original) +++ python/trunk/Objects/intobject.c Wed Oct 4 14:17:45 2006 @@ -546,6 +546,17 @@ } } +/* Integer overflow checking for unary negation: on a 2's-complement + * box, -x overflows iff x is the most negative long. In this case we + * get -x == x. However, -x is undefined (by C) if x /is/ the most + * negative long (it's a signed overflow case), and some compilers care. + * So we cast x to unsigned long first. However, then other compilers + * warn about applying unary minus to an unsigned operand. Hence the + * weird "0-". + */ +#define UNARY_NEG_WOULD_OVERFLOW(x) \ + ((x) < 0 && (unsigned long)(x) == 0-(unsigned long)(x)) + /* Return type of i_divmod */ enum divmod_result { DIVMOD_OK, /* Correct result */ @@ -565,7 +576,7 @@ return DIVMOD_ERROR; } /* (-sys.maxint-1)/-1 is the only overflow case. */ - if (y == -1 && x == LONG_MIN) + if (y == -1 && UNARY_NEG_WOULD_OVERFLOW(x)) return DIVMOD_OVERFLOW; xdivy = x / y; xmody = x - xdivy * y; @@ -756,7 +767,8 @@ { register long a; a = v->ob_ival; - if (a < 0 && (unsigned long)a == 0-(unsigned long)a) { + /* check for overflow */ + if (UNARY_NEG_WOULD_OVERFLOW(a)) { PyObject *o = PyLong_FromLong(a); if (o != NULL) { PyObject *result = PyNumber_Negative(o); Modified: python/trunk/Objects/listobject.c ============================================================================== --- python/trunk/Objects/listobject.c (original) +++ python/trunk/Objects/listobject.c Wed Oct 4 14:17:45 2006 @@ -863,17 +863,12 @@ listpop(PyListObject *self, PyObject *args) { Py_ssize_t i = -1; - PyObject *v, *arg = NULL; + PyObject *v; int status; - if (!PyArg_UnpackTuple(args, "pop", 0, 1, &arg)) + if (!PyArg_ParseTuple(args, "|n:pop", &i)) return NULL; - if (arg != NULL) { - if (PyInt_Check(arg)) - i = PyInt_AS_LONG((PyIntObject*) arg); - else if (!PyArg_ParseTuple(args, "|n:pop", &i)) - return NULL; - } + if (self->ob_size == 0) { /* Special-case most common failure cause */ PyErr_SetString(PyExc_IndexError, "pop from empty list"); Modified: python/trunk/Objects/longobject.c ============================================================================== --- python/trunk/Objects/longobject.c (original) +++ python/trunk/Objects/longobject.c Wed Oct 4 14:17:45 2006 @@ -193,6 +193,18 @@ return (PyObject *)v; } +/* Checking for overflow in PyLong_AsLong is a PITA since C doesn't define + * anything about what happens when a signed integer operation overflows, + * and some compilers think they're doing you a favor by being "clever" + * then. The bit pattern for the largest postive signed long is + * (unsigned long)LONG_MAX, and for the smallest negative signed long + * it is abs(LONG_MIN), which we could write -(unsigned long)LONG_MIN. + * However, some other compilers warn about applying unary minus to an + * unsigned operand. Hence the weird "0-". + */ +#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) +#define PY_ABS_SSIZE_T_MIN (0-(size_t)PY_SSIZE_T_MIN) + /* Get a C long int from a long int object. Returns -1 and sets an error condition if overflow occurs. */ @@ -225,14 +237,16 @@ if ((x >> SHIFT) != prev) goto overflow; } - /* Haven't lost any bits, but if the sign bit is set we're in - * trouble *unless* this is the min negative number. So, - * trouble iff sign bit set && (positive || some bit set other - * than the sign bit). - */ - if ((long)x < 0 && (sign > 0 || (x << 1) != 0)) - goto overflow; - return (long)x * sign; + /* Haven't lost any bits, but casting to long requires extra care + * (see comment above). + */ + if (x <= (unsigned long)LONG_MAX) { + return (long)x * sign; + } + else if (sign < 0 && x == PY_ABS_LONG_MIN) { + return LONG_MIN; + } + /* else overflow */ overflow: PyErr_SetString(PyExc_OverflowError, @@ -268,14 +282,16 @@ if ((x >> SHIFT) != prev) goto overflow; } - /* Haven't lost any bits, but if the sign bit is set we're in - * trouble *unless* this is the min negative number. So, - * trouble iff sign bit set && (positive || some bit set other - * than the sign bit). + /* Haven't lost any bits, but casting to a signed type requires + * extra care (see comment above). */ - if ((Py_ssize_t)x < 0 && (sign > 0 || (x << 1) != 0)) - goto overflow; - return (Py_ssize_t)x * sign; + if (x <= (size_t)PY_SSIZE_T_MAX) { + return (Py_ssize_t)x * sign; + } + else if (sign < 0 && x == PY_ABS_SSIZE_T_MIN) { + return PY_SSIZE_T_MIN; + } + /* else overflow */ overflow: PyErr_SetString(PyExc_OverflowError, @@ -1167,7 +1183,7 @@ { register PyLongObject *a = (PyLongObject *)aa; PyStringObject *str; - Py_ssize_t i; + Py_ssize_t i, j, sz; Py_ssize_t size_a; char *p; int bits; @@ -1187,11 +1203,18 @@ ++bits; i >>= 1; } - i = 5 + (addL ? 1 : 0) + (size_a*SHIFT + bits-1) / bits; - str = (PyStringObject *) PyString_FromStringAndSize((char *)0, i); + i = 5 + (addL ? 1 : 0); + j = size_a*SHIFT + bits-1; + sz = i + j / bits; + if (j / SHIFT < size_a || sz < i) { + PyErr_SetString(PyExc_OverflowError, + "long is too large to format"); + return NULL; + } + str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz); if (str == NULL) return NULL; - p = PyString_AS_STRING(str) + i; + p = PyString_AS_STRING(str) + sz; *p = '\0'; if (addL) *--p = 'L'; @@ -1305,7 +1328,7 @@ } while ((*q++ = *p++) != '\0'); q--; _PyString_Resize((PyObject **)&str, - (int) (q - PyString_AS_STRING(str))); + (Py_ssize_t) (q - PyString_AS_STRING(str))); } return (PyObject *)str; } @@ -1363,14 +1386,14 @@ while (_PyLong_DigitValue[Py_CHARMASK(*p)] < base) ++p; *str = p; - n = (p - start) * bits_per_char; - if (n / bits_per_char != p - start) { + /* n <- # of Python digits needed, = ceiling(n/SHIFT). */ + n = (p - start) * bits_per_char + SHIFT - 1; + if (n / bits_per_char < p - start) { PyErr_SetString(PyExc_ValueError, "long string too large to convert"); return NULL; } - /* n <- # of Python digits needed, = ceiling(n/SHIFT). */ - n = (n + SHIFT - 1) / SHIFT; + n = n / SHIFT; z = _PyLong_New(n); if (z == NULL) return NULL; Modified: python/trunk/Objects/stringobject.c ============================================================================== --- python/trunk/Objects/stringobject.c (original) +++ python/trunk/Objects/stringobject.c Wed Oct 4 14:17:45 2006 @@ -804,10 +804,22 @@ return ret; } if (flags & Py_PRINT_RAW) { + char *data = op->ob_sval; + Py_ssize_t size = op->ob_size; + while (size > INT_MAX) { + /* Very long strings cannot be written atomically. + * But don't write exactly INT_MAX bytes at a time + * to avoid memory aligment issues. + */ + const int chunk_size = INT_MAX & ~0x3FFF; + fwrite(data, 1, chunk_size, fp); + data += chunk_size; + size -= chunk_size; + } #ifdef __VMS - if (op->ob_size) fwrite(op->ob_sval, (int) op->ob_size, 1, fp); + if (size) fwrite(data, (int)size, 1, fp); #else - fwrite(op->ob_sval, 1, (int) op->ob_size, fp); + fwrite(data, 1, (int)size, fp); #endif return 0; } @@ -844,7 +856,7 @@ register PyStringObject* op = (PyStringObject*) obj; size_t newsize = 2 + 4 * op->ob_size; PyObject *v; - if (newsize > PY_SSIZE_T_MAX) { + if (newsize > PY_SSIZE_T_MAX || newsize / 4 != op->ob_size) { PyErr_SetString(PyExc_OverflowError, "string is too large to make repr"); } @@ -4237,7 +4249,7 @@ return NULL; } llen = PyString_Size(result); - if (llen > PY_SSIZE_T_MAX) { + if (llen > INT_MAX) { PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong"); return NULL; } @@ -4726,9 +4738,10 @@ default: PyErr_Format(PyExc_ValueError, "unsupported format character '%c' (0x%x) " - "at index %i", + "at index %zd", c, c, - (int)(fmt - 1 - PyString_AsString(format))); + (Py_ssize_t)(fmt - 1 - + PyString_AsString(format))); goto error; } if (sign) { Modified: python/trunk/Objects/typeobject.c ============================================================================== --- python/trunk/Objects/typeobject.c (original) +++ python/trunk/Objects/typeobject.c Wed Oct 4 14:17:45 2006 @@ -98,7 +98,7 @@ s = strrchr(type->tp_name, '.'); if (s != NULL) return PyString_FromStringAndSize( - type->tp_name, (int)(s - type->tp_name)); + type->tp_name, (Py_ssize_t)(s - type->tp_name)); return PyString_FromString("__builtin__"); } } @@ -4116,19 +4116,10 @@ return -1; len = PyInt_AsSsize_t(res); Py_DECREF(res); - if (len == -1 && PyErr_Occurred()) - return -1; -#if SIZEOF_SIZE_T < SIZEOF_INT - /* Overflow check -- range of PyInt is more than C ssize_t */ - if (len != (int)len) { - PyErr_SetString(PyExc_OverflowError, - "__len__() should return 0 <= outcome < 2**31"); - return -1; - } -#endif if (len < 0) { - PyErr_SetString(PyExc_ValueError, - "__len__() should return >= 0"); + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_ValueError, + "__len__() should return >= 0"); return -1; } return len; Modified: python/trunk/Objects/unicodeobject.c ============================================================================== --- python/trunk/Objects/unicodeobject.c (original) +++ python/trunk/Objects/unicodeobject.c Wed Oct 4 14:17:45 2006 @@ -2384,6 +2384,7 @@ Py_UNICODE unimax = PyUnicode_GetMax(); #endif + /* XXX overflow detection missing */ v = _PyUnicode_New((size+Py_UNICODE_SIZE-1)/ Py_UNICODE_SIZE); if (v == NULL) goto onError; @@ -3170,6 +3171,7 @@ Py_ssize_t needed = (targetsize - extrachars) + \ (targetsize << 2); extrachars += needed; + /* XXX overflow detection missing */ if (_PyUnicode_Resize(&v, PyUnicode_GET_SIZE(v) + needed) < 0) { Py_DECREF(x); @@ -7762,10 +7764,11 @@ default: PyErr_Format(PyExc_ValueError, "unsupported format character '%c' (0x%x) " - "at index %i", + "at index %zd", (31<=c && c<=126) ? (char)c : '?', (int)c, - (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); + (Py_ssize_t)(fmt - 1 - + PyUnicode_AS_UNICODE(uformat))); goto onError; } if (sign) { Modified: python/trunk/Python/errors.c ============================================================================== --- python/trunk/Python/errors.c (original) +++ python/trunk/Python/errors.c Wed Oct 4 14:17:45 2006 @@ -551,7 +551,8 @@ goto failure; } if (PyDict_GetItemString(dict, "__module__") == NULL) { - modulename = PyString_FromStringAndSize(name, (int)(dot-name)); + modulename = PyString_FromStringAndSize(name, + (Py_ssize_t)(dot-name)); if (modulename == NULL) goto failure; if (PyDict_SetItemString(dict, "__module__", modulename) != 0) Modified: python/trunk/Python/getargs.c ============================================================================== --- python/trunk/Python/getargs.c (original) +++ python/trunk/Python/getargs.c Wed Oct 4 14:17:45 2006 @@ -815,7 +815,7 @@ #endif else return converterr("string", arg, msgbuf, bufsize); - if ((int)strlen(*p) != PyString_Size(arg)) + if ((Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr("string without null bytes", arg, msgbuf, bufsize); } @@ -882,7 +882,7 @@ format++; } else if (*p != NULL && - (int)strlen(*p) != PyString_Size(arg)) + (Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr( "string without null bytes or None", arg, msgbuf, bufsize); @@ -1029,7 +1029,8 @@ PyMem_Free()ing it after usage */ - if ((int)strlen(PyString_AS_STRING(s)) != size) { + if ((Py_ssize_t)strlen(PyString_AS_STRING(s)) + != size) { Py_DECREF(s); return converterr( "(encoded string without NULL bytes)", Modified: python/trunk/Python/marshal.c ============================================================================== --- python/trunk/Python/marshal.c (original) +++ python/trunk/Python/marshal.c Wed Oct 4 14:17:45 2006 @@ -546,6 +546,11 @@ int size; PyLongObject *ob; n = r_long(p); + if (n < -INT_MAX || n > INT_MAX) { + PyErr_SetString(PyExc_ValueError, + "bad marshal data"); + return NULL; + } size = n<0 ? -n : n; ob = _PyLong_New(size); if (ob == NULL) @@ -654,7 +659,7 @@ case TYPE_INTERNED: case TYPE_STRING: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -689,7 +694,7 @@ char *buffer; n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -710,7 +715,7 @@ case TYPE_TUPLE: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -733,7 +738,7 @@ case TYPE_LIST: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -831,10 +836,11 @@ v = NULL; - argcount = r_long(p); - nlocals = r_long(p); - stacksize = r_long(p); - flags = r_long(p); + /* XXX ignore long->int overflows for now */ + argcount = (int)r_long(p); + nlocals = (int)r_long(p); + stacksize = (int)r_long(p); + flags = (int)r_long(p); code = r_object(p); if (code == NULL) goto code_error; @@ -859,7 +865,7 @@ name = r_object(p); if (name == NULL) goto code_error; - firstlineno = r_long(p); + firstlineno = (int)r_long(p); lnotab = r_object(p); if (lnotab == NULL) goto code_error; @@ -1031,10 +1037,16 @@ wf.strings = (version > 0) ? PyDict_New() : NULL; w_object(x, &wf); Py_XDECREF(wf.strings); - if (wf.str != NULL) - _PyString_Resize(&wf.str, - (int) (wf.ptr - - PyString_AS_STRING((PyStringObject *)wf.str))); + if (wf.str != NULL) { + char *base = PyString_AS_STRING((PyStringObject *)wf.str); + if (wf.ptr - base > PY_SSIZE_T_MAX) { + Py_DECREF(wf.str); + PyErr_SetString(PyExc_OverflowError, + "too much marshall data for a string"); + return NULL; + } + _PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); + } if (wf.error) { Py_XDECREF(wf.str); PyErr_SetString(PyExc_ValueError, Modified: python/trunk/Python/modsupport.c ============================================================================== --- python/trunk/Python/modsupport.c (original) +++ python/trunk/Python/modsupport.c Wed Oct 4 14:17:45 2006 @@ -421,7 +421,7 @@ "string too long for Python string"); return NULL; } - n = (int)m; + n = (Py_ssize_t)m; } v = PyString_FromStringAndSize(str, n); } Modified: python/trunk/Python/mystrtoul.c ============================================================================== --- python/trunk/Python/mystrtoul.c (original) +++ python/trunk/Python/mystrtoul.c Wed Oct 4 14:17:45 2006 @@ -195,13 +195,10 @@ return (unsigned long)-1; } -/* Checking for overflow in PyOS_strtol is a PITA since C doesn't define - * anything about what happens when a signed integer operation overflows, - * and some compilers think they're doing you a favor by being "clever" - * then. Python assumes a 2's-complement representation, so that the bit - * pattern for the largest postive signed long is LONG_MAX, and for - * the smallest negative signed long is LONG_MAX + 1. +/* Checking for overflow in PyOS_strtol is a PITA; see comments + * about PY_ABS_LONG_MIN in longobject.c. */ +#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) long PyOS_strtol(char *str, char **ptr, int base) @@ -224,8 +221,7 @@ if (sign == '-') result = -result; } - else if (sign == '-' && uresult == (unsigned long)LONG_MAX + 1) { - assert(LONG_MIN == -LONG_MAX-1); + else if (sign == '-' && uresult == PY_ABS_LONG_MIN) { result = LONG_MIN; } else { Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Wed Oct 4 14:17:45 2006 @@ -1225,7 +1225,7 @@ p = strchr(path, delim); if (p == NULL) p = strchr(path, '\0'); /* End of string */ - w = PyString_FromStringAndSize(path, (int) (p - path)); + w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path)); if (w == NULL) { Py_DECREF(v); return NULL; From python-checkins at python.org Wed Oct 4 15:12:26 2006 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 4 Oct 2006 15:12:26 +0200 (CEST) Subject: [Python-checkins] r52142 - python/branches/release24-maint/Modules/unicodedata.c Message-ID: <20061004131226.7FC001E400A@bag.python.org> Author: andrew.kuchling Date: Wed Oct 4 15:12:26 2006 New Revision: 52142 Modified: python/branches/release24-maint/Modules/unicodedata.c Log: [Backport r51226 | neal.norwitz] I'm not sure why this code allocates this string for the error message. I think it would be better to always use snprintf and have the format limit the size of the name appropriately (like %.200s). Klocwork #340 Modified: python/branches/release24-maint/Modules/unicodedata.c ============================================================================== --- python/branches/release24-maint/Modules/unicodedata.c (original) +++ python/branches/release24-maint/Modules/unicodedata.c Wed Oct 4 15:12:26 2006 @@ -869,6 +869,7 @@ { Py_UCS4 code; Py_UNICODE str[1]; + char errbuf[256]; char* name; int namelen; @@ -876,11 +877,19 @@ return NULL; if (!_getcode(name, namelen, &code)) { + /* XXX(nnorwitz): why are we allocating for the error msg? + Why not always use snprintf? */ char fmt[] = "undefined character name '%s'"; char *buf = PyMem_MALLOC(sizeof(fmt) + namelen); - sprintf(buf, fmt, name); + if (buf) + sprintf(buf, fmt, name); + else { + buf = errbuf; + PyOS_snprintf(buf, sizeof(errbuf), fmt, name); + } PyErr_SetString(PyExc_KeyError, buf); - PyMem_FREE(buf); + if (buf != errbuf) + PyMem_FREE(buf); return NULL; } From python-checkins at python.org Wed Oct 4 15:14:48 2006 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 4 Oct 2006 15:14:48 +0200 (CEST) Subject: [Python-checkins] r52143 - python/branches/release24-maint/Modules/_bsddb.c Message-ID: <20061004131448.979C41E4006@bag.python.org> Author: andrew.kuchling Date: Wed Oct 4 15:14:48 2006 New Revision: 52143 Modified: python/branches/release24-maint/Modules/_bsddb.c Log: [Backport r51251 | neal.norwitz] Handle malloc and fopen failures more gracefully. Klocwork 180-181 Modified: python/branches/release24-maint/Modules/_bsddb.c ============================================================================== --- python/branches/release24-maint/Modules/_bsddb.c (original) +++ python/branches/release24-maint/Modules/_bsddb.c Wed Oct 4 15:14:48 2006 @@ -1693,7 +1693,6 @@ DBC** cursors; DBC* dbc; - if (!PyArg_ParseTuple(args,"O|i:join", &cursorsObj, &flags)) return NULL; @@ -1707,6 +1706,11 @@ length = PyObject_Length(cursorsObj); cursors = malloc((length+1) * sizeof(DBC*)); + if (!cursors) { + PyErr_NoMemory(); + return NULL; + } + cursors[length] = NULL; for (x=0; xdb->verify(self->db, fileName, dbName, outFile, flags); MYDB_END_ALLOW_THREADS; - if (outFileName) + if (outFile) fclose(outFile); /* DB.verify acts as a DB handle destructor (like close); this was From buildbot at python.org Wed Oct 4 15:16:42 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 13:16:42 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20061004131642.78A561E4006@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.5/builds/49 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: armin.rigo Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 15:17:42 2006 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 4 Oct 2006 15:17:42 +0200 (CEST) Subject: [Python-checkins] r52144 - python/branches/release24-maint/Python/ceval.c Message-ID: <20061004131742.A8F6B1E4005@bag.python.org> Author: andrew.kuchling Date: Wed Oct 4 15:17:42 2006 New Revision: 52144 Modified: python/branches/release24-maint/Python/ceval.c Log: [Backport r51245 | neal.norwitz] Move/copy assert for tstate != NULL before first use. Verify that PyEval_Get{Globals,Locals} returned valid pointers. Klocwork 231-232 Modified: python/branches/release24-maint/Python/ceval.c ============================================================================== --- python/branches/release24-maint/Python/ceval.c (original) +++ python/branches/release24-maint/Python/ceval.c Wed Oct 4 15:17:42 2006 @@ -2524,6 +2524,7 @@ return NULL; } + assert(tstate != NULL); assert(globals != NULL); f = PyFrame_New(tstate, co, globals, locals); if (f == NULL) @@ -3631,6 +3632,7 @@ PyFrame_New() that doesn't take locals, but does take builtins without sanity checking them. */ + assert(tstate != NULL); f = PyFrame_New(tstate, co, globals, NULL); if (f == NULL) return NULL; @@ -3643,7 +3645,6 @@ fastlocals[i] = *stack++; } retval = PyEval_EvalFrame(f); - assert(tstate != NULL); ++tstate->recursion_depth; Py_DECREF(f); --tstate->recursion_depth; @@ -4153,6 +4154,11 @@ locals = PyEval_GetLocals(); plain = 1; } + if (!globals || !locals) { + PyErr_SetString(PyExc_SystemError, + "globals and locals cannot be NULL"); + return -1; + } } else if (locals == Py_None) locals = globals; From python-checkins at python.org Wed Oct 4 15:20:05 2006 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 4 Oct 2006 15:20:05 +0200 (CEST) Subject: [Python-checkins] r52145 - python/branches/release24-maint/Modules/rgbimgmodule.c Message-ID: <20061004132005.A8D5E1E4005@bag.python.org> Author: andrew.kuchling Date: Wed Oct 4 15:20:05 2006 New Revision: 52145 Modified: python/branches/release24-maint/Modules/rgbimgmodule.c Log: [Backport r51232 | neal.norwitz] Verify verdat which is returned from malloc is not NULL. Ensure we don't pass NULL to free. Klocwork #306 (at least the first part, checking malloc) Modified: python/branches/release24-maint/Modules/rgbimgmodule.c ============================================================================== --- python/branches/release24-maint/Modules/rgbimgmodule.c (original) +++ python/branches/release24-maint/Modules/rgbimgmodule.c Wed Oct 4 15:20:05 2006 @@ -410,6 +410,11 @@ addlongimgtag(base, xsize, ysize); #endif verdat = (unsigned char *)malloc(xsize); + if (!verdat) { + Py_CLEAR(rv); + goto finally; + } + fseek(inf, 512, SEEK_SET); for (z = 0; z < zsize; z++) { lptr = base; @@ -431,10 +436,14 @@ copybw((Py_Int32 *) base, xsize * ysize); } finally: - free(starttab); - free(lengthtab); - free(rledat); - free(verdat); + if (starttab) + free(starttab); + if (lengthtab) + free(lengthtab); + if (rledat) + free(rledat); + if (verdat) + free(verdat); fclose(inf); return rv; } From buildbot at python.org Wed Oct 4 15:25:16 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 13:25:16 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian trunk Message-ID: <20061004132516.49D421E400A@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/591 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: armin.rigo Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 15:30:18 2006 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 4 Oct 2006 15:30:18 +0200 (CEST) Subject: [Python-checkins] r52146 - python/branches/release24-maint/Modules/_sre.c Message-ID: <20061004133018.30A481E4005@bag.python.org> Author: andrew.kuchling Date: Wed Oct 4 15:30:17 2006 New Revision: 52146 Modified: python/branches/release24-maint/Modules/_sre.c Log: [Backport r51225 | neal.norwitz] Try to handle a malloc failure. I'm not entirely sure this is correct. There might be something else we need to do to handle the exception. Klocwork # 212-213 [I think this needs more work; a malloc() failure will cause a match to fail, but nothing raises MemoryError. I'll work on this on the trunk and backport. --amk] Modified: python/branches/release24-maint/Modules/_sre.c ============================================================================== --- python/branches/release24-maint/Modules/_sre.c (original) +++ python/branches/release24-maint/Modules/_sre.c Wed Oct 4 15:30:17 2006 @@ -1162,6 +1162,9 @@ /* install new repeat context */ ctx->u.rep = (SRE_REPEAT*) malloc(sizeof(*ctx->u.rep)); + /* XXX(nnorwitz): anything else we need to do on error? */ + if (!ctx->u.rep) + RETURN_FAILURE; ctx->u.rep->count = -1; ctx->u.rep->pattern = ctx->pattern; ctx->u.rep->prev = state->repeat; From python-checkins at python.org Wed Oct 4 15:42:43 2006 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 4 Oct 2006 15:42:43 +0200 (CEST) Subject: [Python-checkins] r52147 - python/trunk/Modules/_sre.c Message-ID: <20061004134243.A3EBC1E4020@bag.python.org> Author: andrew.kuchling Date: Wed Oct 4 15:42:43 2006 New Revision: 52147 Modified: python/trunk/Modules/_sre.c Log: Cause a PyObject_Malloc() failure to trigger a MemoryError, and then add 'if (PyErr_Occurred())' checks to various places so that NULL is returned properly. 2.4 backport candidate. Modified: python/trunk/Modules/_sre.c ============================================================================== --- python/trunk/Modules/_sre.c (original) +++ python/trunk/Modules/_sre.c Wed Oct 4 15:42:43 2006 @@ -1166,9 +1166,10 @@ /* install new repeat context */ ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep)); - /* XXX(nnorwitz): anything else we need to do on error? */ - if (!ctx->u.rep) + if (!ctx->u.rep) { + PyErr_NoMemory(); RETURN_FAILURE; + } ctx->u.rep->count = -1; ctx->u.rep->pattern = ctx->pattern; ctx->u.rep->prev = state->repeat; @@ -1884,6 +1885,8 @@ } TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr)); + if (PyErr_Occurred()) + return NULL; state_fini(&state); @@ -1922,6 +1925,9 @@ state_fini(&state); + if (PyErr_Occurred()) + return NULL; + return pattern_new_match(self, &state, status); } @@ -2071,6 +2077,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -2198,6 +2207,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -2347,6 +2359,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -3250,6 +3265,8 @@ status = sre_umatch(state, PatternObject_GetCode(self->pattern)); #endif } + if (PyErr_Occurred()) + return NULL; match = pattern_new_match((PatternObject*) self->pattern, state, status); @@ -3281,6 +3298,8 @@ status = sre_usearch(state, PatternObject_GetCode(self->pattern)); #endif } + if (PyErr_Occurred()) + return NULL; match = pattern_new_match((PatternObject*) self->pattern, state, status); From python-checkins at python.org Wed Oct 4 17:25:29 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 17:25:29 +0200 (CEST) Subject: [Python-checkins] r52148 - in python/trunk: Lib/distutils/command/wininst-8.exe Misc/NEWS PC/bdist_wininst/wininst-8.sln PC/bdist_wininst/wininst-8.vcproj Message-ID: <20061004152529.96A821E4010@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 17:25:28 2006 New Revision: 52148 Added: python/trunk/Lib/distutils/command/wininst-8.exe (contents, props changed) python/trunk/PC/bdist_wininst/wininst-8.sln python/trunk/PC/bdist_wininst/wininst-8.vcproj Modified: python/trunk/Misc/NEWS Log: Add MSVC8 project files to create wininst-8.exe. Added: python/trunk/Lib/distutils/command/wininst-8.exe ============================================================================== Binary file. No diff available. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Oct 4 17:25:28 2006 @@ -72,6 +72,8 @@ Library ------- +- Support for MSVC 8 was added to bdist_wininst. + - Bug #1446043: correctly raise a LookupError if an encoding name given to encodings.search_function() contains a dot. Added: python/trunk/PC/bdist_wininst/wininst-8.sln ============================================================================== --- (empty file) +++ python/trunk/PC/bdist_wininst/wininst-8.sln Wed Oct 4 17:25:28 2006 @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wininst", "wininst-8.vcproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|Win32.ActiveCfg = Debug|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|Win32.Build.0 = Debug|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.ActiveCfg = Release|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: python/trunk/PC/bdist_wininst/wininst-8.vcproj ============================================================================== --- (empty file) +++ python/trunk/PC/bdist_wininst/wininst-8.vcproj Wed Oct 4 17:25:28 2006 @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From python-checkins at python.org Wed Oct 4 17:37:10 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 17:37:10 +0200 (CEST) Subject: [Python-checkins] r52150 - external/openssl-0.9.7l projects/external/openssl-0.9.7l Message-ID: <20061004153710.8EEAF1E400B@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 17:37:10 2006 New Revision: 52150 Added: external/openssl-0.9.7l/ - copied from r52149, projects/external/openssl-0.9.7l/ Removed: projects/external/openssl-0.9.7l/ Log: Move openssl 0.9.7l into proper repository location. From python-checkins at python.org Wed Oct 4 17:37:52 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 17:37:52 +0200 (CEST) Subject: [Python-checkins] r52151 - projects/external Message-ID: <20061004153752.988C91E4018@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 17:37:52 2006 New Revision: 52151 Removed: projects/external/ Log: Remove directory created by bogus import. From python-checkins at python.org Wed Oct 4 18:02:56 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 18:02:56 +0200 (CEST) Subject: [Python-checkins] r52152 - in python/branches/release24-maint: Misc/NEWS PCbuild/readme.txt Tools/buildbot/external.bat Message-ID: <20061004160256.136161E4017@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 18:02:55 2006 New Revision: 52152 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/PCbuild/readme.txt python/branches/release24-maint/Tools/buildbot/external.bat Log: Build _ssl.pyd with OpenSSL 0.9.7l Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Wed Oct 4 18:02:55 2006 @@ -219,6 +219,9 @@ Build ----- +- The Windows binaries for the _ssl module are now linked with + OpenSSL 0.9.7l. + - Bug #1568842: Fix test for uintptr_t. - Bug #1439538: Drop usage of test -e in configure as it is not portable. Modified: python/branches/release24-maint/PCbuild/readme.txt ============================================================================== --- python/branches/release24-maint/PCbuild/readme.txt (original) +++ python/branches/release24-maint/PCbuild/readme.txt Wed Oct 4 18:02:55 2006 @@ -250,17 +250,8 @@ _ssl Python wrapper for the secure sockets library. - Get the latest source code for OpenSSL from - http://www.openssl.org - - You (probably) don't want the "engine" code. For example, get - openssl-0.9.7d.tar.gz - not - openssl-engine-0.9.7d.tar.gz - - Unpack into the "dist" directory, retaining the folder name from - the archive - for example, the latest stable OpenSSL will install as - dist/openssl-0.9.7d + Download the source from the python.org copy: + svn export http://svn.python.org/projects/external/openssl-0.9.7l You can (theoretically) use any version of OpenSSL you like - the build process will automatically select the latest version. Modified: python/branches/release24-maint/Tools/buildbot/external.bat ============================================================================== --- python/branches/release24-maint/Tools/buildbot/external.bat (original) +++ python/branches/release24-maint/Tools/buildbot/external.bat Wed Oct 4 18:02:55 2006 @@ -4,4 +4,9 @@ cd .. @rem bzip -if not exist bzip2-1.0.3 svn export http://svn.python.org/projects/external/bzip2-1.0.3 \ No newline at end of file +if not exist bzip2-1.0.3 svn export http://svn.python.org/projects/external/bzip2-1.0.3 + + at rem OpenSSL +if exist openssl-0.9.7d rd /s/q openssl-0.9.7d +if not exist openssl-0.9.7l svn export http://svn.python.org/projects/external/openssl-0.9.7l + From python-checkins at python.org Wed Oct 4 18:34:36 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Oct 2006 18:34:36 +0200 (CEST) Subject: [Python-checkins] r52153 - python/branches/release24-maint/Tools/buildbot/external.bat Message-ID: <20061004163436.1ADAB1E4005@bag.python.org> Author: martin.v.loewis Date: Wed Oct 4 18:34:35 2006 New Revision: 52153 Modified: python/branches/release24-maint/Tools/buildbot/external.bat Log: Remove bogus openssl-0.9.8a directory. Modified: python/branches/release24-maint/Tools/buildbot/external.bat ============================================================================== --- python/branches/release24-maint/Tools/buildbot/external.bat (original) +++ python/branches/release24-maint/Tools/buildbot/external.bat Wed Oct 4 18:34:35 2006 @@ -8,5 +8,6 @@ @rem OpenSSL if exist openssl-0.9.7d rd /s/q openssl-0.9.7d +if exist openssl-0.9.8a rd /s/q openssl-0.9.8a if not exist openssl-0.9.7l svn export http://svn.python.org/projects/external/openssl-0.9.7l From buildbot at python.org Wed Oct 4 21:36:25 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Oct 2006 19:36:25 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061004193625.61BD71E4005@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/129 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 4 23:38:55 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 4 Oct 2006 23:38:55 +0200 (CEST) Subject: [Python-checkins] r52154 - sandbox/trunk/import_in_py Message-ID: <20061004213855.275341E4005@bag.python.org> Author: brett.cannon Date: Wed Oct 4 23:38:54 2006 New Revision: 52154 Added: sandbox/trunk/import_in_py/ Log: Place to do development work of re-implementing the import machinery in Python source. From python-checkins at python.org Thu Oct 5 00:55:02 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 5 Oct 2006 00:55:02 +0200 (CEST) Subject: [Python-checkins] r52155 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061004225502.96D9B1E4005@bag.python.org> Author: brett.cannon Date: Thu Oct 5 00:55:01 2006 New Revision: 52155 Added: sandbox/trunk/import_in_py/importer.py (contents, props changed) sandbox/trunk/import_in_py/test_importer.py (contents, props changed) Log: Add built-in importer with tests. Added: sandbox/trunk/import_in_py/importer.py ============================================================================== --- (empty file) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 5 00:55:01 2006 @@ -0,0 +1,58 @@ +"""Re-implementation of import machinery in Python source code. + +When developing please keep imports down to a minimum. There is a basic +bootstrapping problem of importing in import! It is best to keep imports to +only built-in modules (see sys.builtin_module_names) as having the built-in +importer written in C is fairly straight-forward. + +References on import: +* Language reference + http://docs.python.org/ref/import.html +* PEP 302: New Import Hooks + http://www.python.org/dev/peps/pep-0302/ +* __import__ function + http://docs.python.org/lib/built-in-funcs.html + +""" +import imp +import sys + + +class BuiltinImporter(object): + + """sys.meta_path class for importing built-in modules. + + Use static and classmethods as no purpose is served by having instances of + this class. + + """ + + @classmethod + def find_module(cls, fullname, path=None): + """See if import is for a built-in module. + + Since built-in modules should never have a path, short-circuit if one + is specified. + + """ + if path is not None: + return None + # Could also check sys.builtin_module_names to see if the import is for + # a built-in module. + if imp.is_builtin(fullname): + return cls + else: + return None + + @staticmethod + def load_module(fullname, path=None): + """Load a built-in module. + + 'imp' code for loading a built-in modules handles the setting of a + module in sys.modules before initializing the module. + + """ + try: + return sys.modules[fullname] + except KeyError: + return imp.init_builtin(fullname) Added: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- (empty file) +++ sandbox/trunk/import_in_py/test_importer.py Thu Oct 5 00:55:01 2006 @@ -0,0 +1,49 @@ +import unittest +from test import test_support +import importer +import sys + +class BuiltinImporterTests(unittest.TestCase): + + """Test the built-in module importer.""" + + def test_find_module_basic(self): + # Make sure only built-in modules are found. + for name in sys.builtin_module_names: + self.failUnless(importer.BuiltinImporter.find_module(name)) + self.failUnless(not importer.BuiltinImporter.find_module('time'), + 'incorrectly found an extension module') + self.failUnless(not importer.BuiltinImporter.find_module('token'), + 'incorrectly found a Python module') + + def test_find_module_path_shortcut(self): + # Test short-circuiting of finding a module if 'path' argument is given + # a value. + self.failUnless(not importer.BuiltinImporter.find_module('sys', '')) + + def test_load_module_prev_import_check(self): + # If a module is already in 'sys' it should be returned without being + # re-initialized. + self.failUnlessEqual(importer.BuiltinImporter.load_module('sys'), + sys.modules['sys']) + + def test_load_module_new_import(self): + # Make sure importing of a built-in that was not done before works + # properly. + try: + del sys.modules['sys'] + except KeyError: + pass + sys_module = importer.BuiltinImporter.load_module('sys') + self.failUnless(sys_module) + self.failUnless(hasattr(sys_module, 'version')) + + +def test_main(): + test_support.run_unittest( + BuiltinImporterTests, + ) + + +if __name__ == '__main__': + test_main() From python-checkins at python.org Thu Oct 5 01:05:22 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 5 Oct 2006 01:05:22 +0200 (CEST) Subject: [Python-checkins] r52156 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061004230522.CA25E1E4014@bag.python.org> Author: brett.cannon Date: Thu Oct 5 01:05:22 2006 New Revision: 52156 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Add frozen module importer. No tests since don't know of any frozen modules to test against in Python's test suite. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 5 01:05:22 2006 @@ -39,7 +39,7 @@ return None # Could also check sys.builtin_module_names to see if the import is for # a built-in module. - if imp.is_builtin(fullname): + elif imp.is_builtin(fullname): return cls else: return None @@ -52,7 +52,38 @@ module in sys.modules before initializing the module. """ + if path is not None: + raise TypeError("loader does not expect an argument for 'path'") try: return sys.modules[fullname] except KeyError: return imp.init_builtin(fullname) + + +class FrozenImporter(object): + + """sys.meta_path class for importing frozen modules. + + Based off of BuiltinImporter. + + """ + + @classmethod + def find_module(cls, fullname, path=None): + """Return a loader for frozen modules if the module is a frozen + module.""" + if path is not None: + return None + elif imp.is_frozen(fullname): + return cls + else: + return None + + @staticmethod + def load_module(fullname, path=None): + if path is not None: + raise TypeError("loader does not expect an argument for 'path'") + try: + return sys.modules[fullname] + except KeyError: + return imp.init_frozen(fullname) Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Thu Oct 5 01:05:22 2006 @@ -39,6 +39,13 @@ self.failUnless(hasattr(sys_module, 'version')) +class FrozenImporterTests(unittest.TestCase): + + """Test the frozen module importer.""" + + pass + + def test_main(): test_support.run_unittest( BuiltinImporterTests, From python-checkins at python.org Thu Oct 5 01:10:05 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 5 Oct 2006 01:10:05 +0200 (CEST) Subject: [Python-checkins] r52157 - sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061004231005.A8F271E4006@bag.python.org> Author: brett.cannon Date: Thu Oct 5 01:10:05 2006 New Revision: 52157 Modified: sandbox/trunk/import_in_py/test_importer.py Log: Add a test for BuiltinImporter to make sure exception is raised if load_module() is called with an argument for path. Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Thu Oct 5 01:10:05 2006 @@ -38,6 +38,11 @@ self.failUnless(sys_module) self.failUnless(hasattr(sys_module, 'version')) + def test_load_module_no_path_argument(self): + # TypeError should be raise if 'path' argument set. + self.failUnlessRaises(TypeError, importer.BuiltinImporter.load_module, + 'sys', '') + class FrozenImporterTests(unittest.TestCase): From theller at python.net Thu Oct 5 09:35:28 2006 From: theller at python.net (Thomas Heller) Date: Thu, 05 Oct 2006 09:35:28 +0200 Subject: [Python-checkins] r52156 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py In-Reply-To: <20061004230522.CA25E1E4014@bag.python.org> References: <20061004230522.CA25E1E4014@bag.python.org> Message-ID: brett.cannon schrieb: > Author: brett.cannon > Date: Thu Oct 5 01:05:22 2006 > New Revision: 52156 > > Modified: > sandbox/trunk/import_in_py/importer.py > sandbox/trunk/import_in_py/test_importer.py > Log: > Add frozen module importer. No tests since don't know of any frozen modules to > test against in Python's test suite. There is __hello__ and __phello__ in standard python, AFAIK. Thomas From python-checkins at python.org Thu Oct 5 19:07:00 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 19:07:00 +0200 (CEST) Subject: [Python-checkins] r52159 - python/branches/release24-maint/Modules/collectionsmodule.c Message-ID: <20061005170700.5D0951E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 19:06:59 2006 New Revision: 52159 Modified: python/branches/release24-maint/Modules/collectionsmodule.c Log: [Backport r51255 | neal.norwitz] Really address the issue of where to place the assert for leftblock. (Followup of Klocwork 274) Modified: python/branches/release24-maint/Modules/collectionsmodule.c ============================================================================== --- python/branches/release24-maint/Modules/collectionsmodule.c (original) +++ python/branches/release24-maint/Modules/collectionsmodule.c Thu Oct 5 19:06:59 2006 @@ -211,6 +211,7 @@ PyErr_SetString(PyExc_IndexError, "pop from an empty deque"); return NULL; } + assert(deque->leftblock != NULL); item = deque->leftblock->data[deque->leftindex]; deque->leftindex++; deque->len--; From python-checkins at python.org Thu Oct 5 19:18:15 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 19:18:15 +0200 (CEST) Subject: [Python-checkins] r52160 - in python/branches/release24-maint: Lib/test/test_format.py Misc/NEWS Objects/stringobject.c Message-ID: <20061005171815.6452C1E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 19:18:13 2006 New Revision: 52160 Modified: python/branches/release24-maint/Lib/test/test_format.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/stringobject.c Log: [Backport r51248 | neal.norwitz] Fix segfault when doing string formatting on subclasses of long if __oct__, __hex__ don't return a string. Klocwork 308 Modified: python/branches/release24-maint/Lib/test/test_format.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_format.py (original) +++ python/branches/release24-maint/Lib/test/test_format.py Thu Oct 5 19:18:13 2006 @@ -230,6 +230,14 @@ test_exc(u'no format', u'1', TypeError, "not all arguments converted during string formatting") +class Foobar(long): + def __oct__(self): + # Returning a non-string should not blow up. + return self + 1 + +test_exc('%o', Foobar(), TypeError, + "expected string or Unicode object, long found") + if sys.maxint == 2**31-1: # crashes 2.2.1 and earlier: try: Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Thu Oct 5 19:18:13 2006 @@ -30,7 +30,9 @@ - Fix memory leak of coding spec in Parser/tokenizer.c. - Fix memory leak in file_init. - + +- Fix segfault when doing string formatting on subclasses of long. + - Overflow checking code in integer division ran afoul of new gcc optimizations. Changed to be more standard-conforming. Modified: python/branches/release24-maint/Objects/stringobject.c ============================================================================== --- python/branches/release24-maint/Objects/stringobject.c (original) +++ python/branches/release24-maint/Objects/stringobject.c Thu Oct 5 19:18:13 2006 @@ -3665,12 +3665,15 @@ if (!result) return NULL; + buf = PyString_AsString(result); + if (!buf) + return NULL; + /* To modify the string in-place, there can only be one reference. */ if (result->ob_refcnt != 1) { PyErr_BadInternalCall(); return NULL; } - buf = PyString_AsString(result); len = PyString_Size(result); if (buf[len-1] == 'L') { --len; From python-checkins at python.org Thu Oct 5 19:19:31 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 19:19:31 +0200 (CEST) Subject: [Python-checkins] r52161 - python/branches/release24-maint/Python/import.c Message-ID: <20061005171931.4D4E91E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 19:19:30 2006 New Revision: 52161 Modified: python/branches/release24-maint/Python/import.c Log: [Backport r51247 | neal.norwitz] cpathname could be NULL if it was longer than MAXPATHLEN. Don't try to write the .pyc to NULL. Check results of PyList_GetItem() and PyModule_GetDict() are not NULL. Klocwork 282, 283, 285 Modified: python/branches/release24-maint/Python/import.c ============================================================================== --- python/branches/release24-maint/Python/import.c (original) +++ python/branches/release24-maint/Python/import.c Thu Oct 5 19:19:30 2006 @@ -904,7 +904,8 @@ if (Py_VerboseFlag) PySys_WriteStderr("import %s # from %s\n", name, pathname); - write_compiled_module(co, cpathname, mtime); + if (cpathname) + write_compiled_module(co, cpathname, mtime); } m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, pathname); Py_DECREF(co); @@ -1194,6 +1195,8 @@ for (i = 0; i < npath; i++) { PyObject *copy = NULL; PyObject *v = PyList_GetItem(path, i); + if (!v) + return NULL; #ifdef Py_USING_UNICODE if (PyUnicode_Check(v)) { copy = PyUnicode_Encode(PyUnicode_AS_UNICODE(v), @@ -2827,6 +2830,8 @@ if (m == NULL) goto failure; d = PyModule_GetDict(m); + if (d == NULL) + goto failure; if (setint(d, "SEARCH_ERROR", SEARCH_ERROR) < 0) goto failure; if (setint(d, "PY_SOURCE", PY_SOURCE) < 0) goto failure; From python-checkins at python.org Thu Oct 5 19:22:15 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 19:22:15 +0200 (CEST) Subject: [Python-checkins] r52162 - python/branches/release24-maint/Modules/collectionsmodule.c Message-ID: <20061005172215.EE2961E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 19:22:15 2006 New Revision: 52162 Modified: python/branches/release24-maint/Modules/collectionsmodule.c Log: [Backport r51224 | neal.norwitz] Move the assert which checks for a NULL pointer first. Klocwork #274. Modified: python/branches/release24-maint/Modules/collectionsmodule.c ============================================================================== --- python/branches/release24-maint/Modules/collectionsmodule.c (original) +++ python/branches/release24-maint/Modules/collectionsmodule.c Thu Oct 5 19:22:15 2006 @@ -225,9 +225,9 @@ deque->leftindex = CENTER + 1; deque->rightindex = CENTER; } else { + assert(deque->leftblock != NULL); assert(deque->leftblock != deque->rightblock); prevblock = deque->leftblock->rightlink; - assert(deque->leftblock != NULL); PyMem_Free(deque->leftblock); assert(prevblock != NULL); prevblock->leftlink = NULL; From python-checkins at python.org Thu Oct 5 19:24:09 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 19:24:09 +0200 (CEST) Subject: [Python-checkins] r52163 - python/branches/release24-maint/Modules/posixmodule.c Message-ID: <20061005172409.BD36B1E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 19:24:08 2006 New Revision: 52163 Modified: python/branches/release24-maint/Modules/posixmodule.c Log: [Backport r51223 | neal.norwitz] If _stat_float_times is false, we will try to INCREF ival which could be NULL. Return early in that case. The caller checks for PyErr_Occurred so this should be ok. Klocwork #297 Modified: python/branches/release24-maint/Modules/posixmodule.c ============================================================================== --- python/branches/release24-maint/Modules/posixmodule.c (original) +++ python/branches/release24-maint/Modules/posixmodule.c Thu Oct 5 19:24:08 2006 @@ -825,6 +825,8 @@ #else ival = PyInt_FromLong((long)sec); #endif + if (!ival) + return; if (_stat_float_times) { fval = PyFloat_FromDouble(sec + 1e-9*nsec); } else { From python-checkins at python.org Thu Oct 5 19:26:34 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 19:26:34 +0200 (CEST) Subject: [Python-checkins] r52164 - in python/branches/release25-maint: Misc/NEWS Modules/_sre.c Message-ID: <20061005172634.30A641E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 19:26:33 2006 New Revision: 52164 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/_sre.c Log: [Backport to 2-5maint of r52147 | andrew.kuchling ; the buildbots seem OK with this change.] Cause a PyObject_Malloc() failure to trigger a MemoryError, and then add 'if (PyErr_Occurred())' checks to various places so that NULL is returned properly. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Thu Oct 5 19:26:33 2006 @@ -49,6 +49,7 @@ - Fix itertools.count(n) to work with negative numbers again. +- Make regex engine raise MemoryError if allocating memory fails. Library ------- Modified: python/branches/release25-maint/Modules/_sre.c ============================================================================== --- python/branches/release25-maint/Modules/_sre.c (original) +++ python/branches/release25-maint/Modules/_sre.c Thu Oct 5 19:26:33 2006 @@ -1166,9 +1166,10 @@ /* install new repeat context */ ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep)); - /* XXX(nnorwitz): anything else we need to do on error? */ - if (!ctx->u.rep) + if (!ctx->u.rep) { + PyErr_NoMemory(); RETURN_FAILURE; + } ctx->u.rep->count = -1; ctx->u.rep->pattern = ctx->pattern; ctx->u.rep->prev = state->repeat; @@ -1884,6 +1885,8 @@ } TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr)); + if (PyErr_Occurred()) + return NULL; state_fini(&state); @@ -1922,6 +1925,9 @@ state_fini(&state); + if (PyErr_Occurred()) + return NULL; + return pattern_new_match(self, &state, status); } @@ -2071,6 +2077,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -2198,6 +2207,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -2347,6 +2359,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -3250,6 +3265,8 @@ status = sre_umatch(state, PatternObject_GetCode(self->pattern)); #endif } + if (PyErr_Occurred()) + return NULL; match = pattern_new_match((PatternObject*) self->pattern, state, status); @@ -3281,6 +3298,8 @@ status = sre_usearch(state, PatternObject_GetCode(self->pattern)); #endif } + if (PyErr_Occurred()) + return NULL; match = pattern_new_match((PatternObject*) self->pattern, state, status); From python-checkins at python.org Thu Oct 5 19:30:49 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 19:30:49 +0200 (CEST) Subject: [Python-checkins] r52165 - in python/branches/release24-maint: Misc/NEWS Modules/_sre.c Message-ID: <20061005173049.A498D1E4009@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 19:30:48 2006 New Revision: 52165 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Modules/_sre.c Log: [Backport r52147 | andrew.kuchling] Cause a PyObject_Malloc() failure to trigger a MemoryError, and then add 'if (PyErr_Occurred())' checks to various places so that NULL is returned properly. Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Thu Oct 5 19:30:48 2006 @@ -91,6 +91,8 @@ - Patch #1535500: fix segfault in BZ2File.writelines and make sure it raises the correct exceptions. +- Make regex engine raise MemoryError if allocating memory fails. + - Bug #1471938: Fix curses module build problem on Solaris 8; patch by Paul Eggert. Modified: python/branches/release24-maint/Modules/_sre.c ============================================================================== --- python/branches/release24-maint/Modules/_sre.c (original) +++ python/branches/release24-maint/Modules/_sre.c Thu Oct 5 19:30:48 2006 @@ -1162,9 +1162,10 @@ /* install new repeat context */ ctx->u.rep = (SRE_REPEAT*) malloc(sizeof(*ctx->u.rep)); - /* XXX(nnorwitz): anything else we need to do on error? */ - if (!ctx->u.rep) + if (!ctx->u.rep) { + PyErr_NoMemory(); RETURN_FAILURE; + } ctx->u.rep->count = -1; ctx->u.rep->pattern = ctx->pattern; ctx->u.rep->prev = state->repeat; @@ -2032,6 +2033,8 @@ } TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr)); + if (PyErr_Occurred()) + return NULL; state_fini(&state); @@ -2070,6 +2073,9 @@ state_fini(&state); + if (PyErr_Occurred()) + return NULL; + return pattern_new_match(self, &state, status); } @@ -2219,6 +2225,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -2346,6 +2355,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -2493,6 +2505,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -3289,6 +3304,8 @@ status = sre_umatch(state, PatternObject_GetCode(self->pattern)); #endif } + if (PyErr_Occurred()) + return NULL; match = pattern_new_match((PatternObject*) self->pattern, state, status); @@ -3320,6 +3337,8 @@ status = sre_usearch(state, PatternObject_GetCode(self->pattern)); #endif } + if (PyErr_Occurred()) + return NULL; match = pattern_new_match((PatternObject*) self->pattern, state, status); From buildbot at python.org Thu Oct 5 19:34:44 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Oct 2006 17:34:44 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4 Message-ID: <20061005173444.AB48E1E401C@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.4/builds/195 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Thu Oct 5 20:09:00 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 20:09:00 +0200 (CEST) Subject: [Python-checkins] r52166 - in python/branches/release24-maint: Misc/NEWS Objects/typeobject.c Objects/unicodeobject.c Python/import.c Python/pystate.c Python/sysmodule.c Message-ID: <20061005180900.96ED91E400E@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 20:08:58 2006 New Revision: 52166 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/typeobject.c python/branches/release24-maint/Objects/unicodeobject.c python/branches/release24-maint/Python/import.c python/branches/release24-maint/Python/pystate.c python/branches/release24-maint/Python/sysmodule.c Log: [Backport r50743 | neal.norwitz] Handle allocation failures gracefully. Found with failmalloc. Many (all?) of these could be backported. Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Thu Oct 5 20:08:58 2006 @@ -36,6 +36,8 @@ - Overflow checking code in integer division ran afoul of new gcc optimizations. Changed to be more standard-conforming. +- Fix some potential crashes found with failmalloc. + - Fix warnings reported by the Coverity and Klocwork static analysis tools. - Patch #1541585: fix buffer overrun when performing repr() on Modified: python/branches/release24-maint/Objects/typeobject.c ============================================================================== --- python/branches/release24-maint/Objects/typeobject.c (original) +++ python/branches/release24-maint/Objects/typeobject.c Thu Oct 5 20:08:58 2006 @@ -3239,6 +3239,8 @@ if (PyDict_GetItemString(type->tp_dict, "__doc__") == NULL) { if (type->tp_doc != NULL) { PyObject *doc = PyString_FromString(type->tp_doc); + if (doc == NULL) + goto error; PyDict_SetItemString(type->tp_dict, "__doc__", doc); Py_DECREF(doc); } else { Modified: python/branches/release24-maint/Objects/unicodeobject.c ============================================================================== --- python/branches/release24-maint/Objects/unicodeobject.c (original) +++ python/branches/release24-maint/Objects/unicodeobject.c Thu Oct 5 20:08:58 2006 @@ -7350,6 +7350,9 @@ unicode_freelist = NULL; unicode_freelist_size = 0; unicode_empty = _PyUnicode_New(0); + if (!unicode_empty) + return; + strcpy(unicode_default_encoding, "ascii"); for (i = 0; i < 256; i++) unicode_latin1[i] = NULL; Modified: python/branches/release24-maint/Python/import.c ============================================================================== --- python/branches/release24-maint/Python/import.c (original) +++ python/branches/release24-maint/Python/import.c Thu Oct 5 20:08:58 2006 @@ -104,6 +104,8 @@ for (scan = _PyImport_StandardFiletab; scan->suffix != NULL; ++scan) ++countS; filetab = PyMem_NEW(struct filedescr, countD + countS + 1); + if (filetab == NULL) + Py_FatalError("Can't intiialize import file table."); memcpy(filetab, _PyImport_DynLoadFiletab, countD * sizeof(struct filedescr)); memcpy(filetab + countD, _PyImport_StandardFiletab, @@ -227,8 +229,11 @@ long me = PyThread_get_thread_ident(); if (me == -1) return; /* Too bad */ - if (import_lock == NULL) + if (import_lock == NULL) { import_lock = PyThread_allocate_lock(); + if (import_lock == NULL) + return; /* Nothing much we can do. */ + } if (import_lock_thread == me) { import_lock_level++; return; @@ -247,7 +252,7 @@ unlock_import(void) { long me = PyThread_get_thread_ident(); - if (me == -1) + if (me == -1 || import_lock == NULL) return 0; /* Too bad */ if (import_lock_thread != me) return -1; Modified: python/branches/release24-maint/Python/pystate.c ============================================================================== --- python/branches/release24-maint/Python/pystate.c (original) +++ python/branches/release24-maint/Python/pystate.c Thu Oct 5 20:08:58 2006 @@ -66,6 +66,10 @@ if (interp != NULL) { HEAD_INIT(); +#ifdef WITH_THREAD + if (head_mutex == NULL) + Py_FatalError("Can't initialize threads for interpreter"); +#endif interp->modules = NULL; interp->sysdict = NULL; interp->builtins = NULL; Modified: python/branches/release24-maint/Python/sysmodule.c ============================================================================== --- python/branches/release24-maint/Python/sysmodule.c (original) +++ python/branches/release24-maint/Python/sysmodule.c Thu Oct 5 20:08:58 2006 @@ -1017,41 +1017,38 @@ #elif PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL s = "final"; #endif - PyDict_SetItemString(sysdict, "version_info", - v = Py_BuildValue("iiisi", PY_MAJOR_VERSION, + +#define SET_SYS_FROM_STRING(key, value) \ + v = value; \ + if (v != NULL) \ + PyDict_SetItemString(sysdict, key, v); \ + Py_XDECREF(v) + + SET_SYS_FROM_STRING("version_info", + Py_BuildValue("iiisi", PY_MAJOR_VERSION, PY_MINOR_VERSION, PY_MICRO_VERSION, s, PY_RELEASE_SERIAL)); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "api_version", - v = PyInt_FromLong(PYTHON_API_VERSION)); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "copyright", - v = PyString_FromString(Py_GetCopyright())); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "platform", - v = PyString_FromString(Py_GetPlatform())); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "executable", - v = PyString_FromString(Py_GetProgramFullPath())); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "prefix", - v = PyString_FromString(Py_GetPrefix())); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "exec_prefix", - v = PyString_FromString(Py_GetExecPrefix())); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "maxint", - v = PyInt_FromLong(PyInt_GetMax())); - Py_XDECREF(v); + SET_SYS_FROM_STRING("api_version", + PyInt_FromLong(PYTHON_API_VERSION)); + SET_SYS_FROM_STRING("copyright", + PyString_FromString(Py_GetCopyright())); + SET_SYS_FROM_STRING("platform", + PyString_FromString(Py_GetPlatform())); + SET_SYS_FROM_STRING("executable", + PyString_FromString(Py_GetProgramFullPath())); + SET_SYS_FROM_STRING("prefix", + PyString_FromString(Py_GetPrefix())); + SET_SYS_FROM_STRING("exec_prefix", + PyString_FromString(Py_GetExecPrefix())); + SET_SYS_FROM_STRING("maxint", + PyInt_FromLong(PyInt_GetMax())); #ifdef Py_USING_UNICODE - PyDict_SetItemString(sysdict, "maxunicode", - v = PyInt_FromLong(PyUnicode_GetMax())); - Py_XDECREF(v); + SET_SYS_FROM_STRING("maxunicode", + PyInt_FromLong(PyUnicode_GetMax())); #endif - PyDict_SetItemString(sysdict, "builtin_module_names", - v = list_builtin_module_names()); - Py_XDECREF(v); + SET_SYS_FROM_STRING("builtin_module_names", + list_builtin_module_names()); { /* Assumes that longs are at least 2 bytes long. Should be safe! */ @@ -1063,18 +1060,16 @@ value = "big"; else value = "little"; - PyDict_SetItemString(sysdict, "byteorder", - v = PyString_FromString(value)); - Py_XDECREF(v); + SET_SYS_FROM_STRING("byteorder", + PyString_FromString(value)); } #ifdef MS_COREDLL - PyDict_SetItemString(sysdict, "dllhandle", - v = PyLong_FromVoidPtr(PyWin_DLLhModule)); - Py_XDECREF(v); - PyDict_SetItemString(sysdict, "winver", - v = PyString_FromString(PyWin_DLLVersionString)); - Py_XDECREF(v); + SET_SYS_FROM_STRING("dllhandle", + PyLong_FromVoidPtr(PyWin_DLLhModule)); + SET_SYS_FROM_STRING("winver", + PyString_FromString(PyWin_DLLVersionString)); #endif +#undef SET_SYS_FROM_STRING if (warnoptions == NULL) { warnoptions = PyList_New(0); } From python-checkins at python.org Thu Oct 5 20:22:03 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 20:22:03 +0200 (CEST) Subject: [Python-checkins] r52167 - python/branches/release24-maint/Modules/bz2module.c python/branches/release24-maint/Modules/cPickle.c Message-ID: <20061005182203.3D2771E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 20:22:02 2006 New Revision: 52167 Modified: python/branches/release24-maint/Modules/bz2module.c python/branches/release24-maint/Modules/cPickle.c Log: [Partial backport of r50773 | neal.norwitz -- other parts of this patch applied to pyarena.c, compile.c, and symtable.c, which were different in 2.4.] Fix more memory allocation issues found with failmalloc. Modified: python/branches/release24-maint/Modules/bz2module.c ============================================================================== --- python/branches/release24-maint/Modules/bz2module.c (original) +++ python/branches/release24-maint/Modules/bz2module.c Thu Oct 5 20:22:02 2006 @@ -1359,8 +1359,10 @@ #ifdef WITH_THREAD self->lock = PyThread_allocate_lock(); - if (!self->lock) + if (!self->lock) { + PyErr_SetString(PyExc_MemoryError, "unable to allocate lock"); goto error; + } #endif if (mode_char == 'r') @@ -1382,10 +1384,12 @@ return 0; error: - Py_DECREF(self->file); + Py_CLEAR(self->file); #ifdef WITH_THREAD - if (self->lock) + if (self->lock) { PyThread_free_lock(self->lock); + self->lock = NULL; + } #endif return -1; } @@ -1693,8 +1697,10 @@ #ifdef WITH_THREAD self->lock = PyThread_allocate_lock(); - if (!self->lock) + if (!self->lock) { + PyErr_SetString(PyExc_MemoryError, "unable to allocate lock"); goto error; + } #endif memset(&self->bzs, 0, sizeof(bz_stream)); @@ -1709,8 +1715,10 @@ return 0; error: #ifdef WITH_THREAD - if (self->lock) + if (self->lock) { PyThread_free_lock(self->lock); + self->lock = NULL; + } #endif return -1; } @@ -1905,8 +1913,10 @@ #ifdef WITH_THREAD self->lock = PyThread_allocate_lock(); - if (!self->lock) + if (!self->lock) { + PyErr_SetString(PyExc_MemoryError, "unable to allocate lock"); goto error; + } #endif self->unused_data = PyString_FromString(""); @@ -1926,10 +1936,12 @@ error: #ifdef WITH_THREAD - if (self->lock) + if (self->lock) { PyThread_free_lock(self->lock); + self->lock = NULL; + } #endif - Py_XDECREF(self->unused_data); + Py_CLEAR(self->unused_data); return -1; } Modified: python/branches/release24-maint/Modules/cPickle.c ============================================================================== --- python/branches/release24-maint/Modules/cPickle.c (original) +++ python/branches/release24-maint/Modules/cPickle.c Thu Oct 5 20:22:02 2006 @@ -196,7 +196,7 @@ for (i = self->length, p = self->data + clearto; --i >= clearto; p++) { - Py_DECREF(*p); + Py_CLEAR(*p); } self->length = clearto; @@ -208,6 +208,7 @@ { int bigger; size_t nbytes; + PyObject **tmp; bigger = self->size << 1; if (bigger <= 0) /* was 0, or new value overflows */ @@ -217,14 +218,14 @@ nbytes = (size_t)bigger * sizeof(PyObject *); if (nbytes / sizeof(PyObject *) != (size_t)bigger) goto nomemory; - self->data = realloc(self->data, nbytes); - if (self->data == NULL) + tmp = realloc(self->data, nbytes); + if (tmp == NULL) goto nomemory; + self->data = tmp; self->size = bigger; return 0; nomemory: - self->size = 0; PyErr_NoMemory(); return -1; } @@ -4168,6 +4169,7 @@ int list_len; slice=Pdata_popList(self->stack, x); + if (!slice) return -1; list_len = PyList_GET_SIZE(list); i=PyList_SetSlice(list, list_len, list_len, slice); Py_DECREF(slice); @@ -5178,6 +5180,9 @@ if (!( self->memo = PyDict_New())) goto err; + if (!self->stack) + goto err; + Py_INCREF(f); self->file = f; From brett at python.org Thu Oct 5 20:28:19 2006 From: brett at python.org (Brett Cannon) Date: Thu, 5 Oct 2006 11:28:19 -0700 Subject: [Python-checkins] r52156 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py In-Reply-To: References: <20061004230522.CA25E1E4014@bag.python.org> Message-ID: On 10/5/06, Thomas Heller wrote: > > brett.cannon schrieb: > > Author: brett.cannon > > Date: Thu Oct 5 01:05:22 2006 > > New Revision: 52156 > > > > Modified: > > sandbox/trunk/import_in_py/importer.py > > sandbox/trunk/import_in_py/test_importer.py > > Log: > > Add frozen module importer. No tests since don't know of any frozen > modules to > > test against in Python's test suite. > > There is __hello__ and __phello__ in standard python, AFAIK. Ah, thanks, Thomas! Although they do output to stdout, which is a slight annoyance but obviously not hard to get around. -Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20061005/0d88ec06/attachment.html From buildbot at python.org Thu Oct 5 20:35:14 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Oct 2006 18:35:14 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4 Message-ID: <20061005183514.D8A221E4006@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.4/builds/197 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Thu Oct 5 20:37:09 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 20:37:09 +0200 (CEST) Subject: [Python-checkins] r52168 - in python/branches/release24-maint: Modules/_codecsmodule.c Modules/arraymodule.c Objects/structseq.c Message-ID: <20061005183709.842FA1E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 20:37:08 2006 New Revision: 52168 Modified: python/branches/release24-maint/Modules/_codecsmodule.c python/branches/release24-maint/Modules/arraymodule.c python/branches/release24-maint/Objects/structseq.c Log: [Partial backport of r51218 | neal.norwitz -- the changes to ast.c, symtable.c, and _elementtree.c weren't applicable] Klocwork made another run and found a bunch more problems. This is the first batch of fixes that should be easy to verify based on context. This fixes problem numbers: 220 (ast), 323-324 (symtable), 321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree). Modified: python/branches/release24-maint/Modules/_codecsmodule.c ============================================================================== --- python/branches/release24-maint/Modules/_codecsmodule.c (original) +++ python/branches/release24-maint/Modules/_codecsmodule.c Thu Oct 5 20:37:08 2006 @@ -226,7 +226,8 @@ buf = PyString_AS_STRING (str); len = PyString_GET_SIZE (str); memmove(buf, buf+1, len-2); - _PyString_Resize(&str, len-2); + if (_PyString_Resize(&str, len-2) < 0) + return NULL; return codec_tuple(str, PyString_Size(str)); } Modified: python/branches/release24-maint/Modules/arraymodule.c ============================================================================== --- python/branches/release24-maint/Modules/arraymodule.c (original) +++ python/branches/release24-maint/Modules/arraymodule.c Thu Oct 5 20:37:08 2006 @@ -701,6 +701,8 @@ /* Special case "a[i:j] = a" -- copy b first */ int ret; v = array_slice(b, 0, n); + if (!v) + return -1; ret = array_ass_slice(a, ilow, ihigh, v); Py_DECREF(v); return ret; @@ -1687,6 +1689,8 @@ if (self == av) { value = array_slice(av, 0, av->ob_size); av = (arrayobject*)value; + if (!av) + return -1; } else { Py_INCREF(value); Modified: python/branches/release24-maint/Objects/structseq.c ============================================================================== --- python/branches/release24-maint/Objects/structseq.c (original) +++ python/branches/release24-maint/Objects/structseq.c Thu Oct 5 20:37:08 2006 @@ -215,6 +215,8 @@ PyObject *tup; int result; tup = make_tuple(obj); + if (!tup) + return -1; result = PySequence_Contains(tup, o); Py_DECREF(tup); return result; @@ -226,6 +228,8 @@ PyObject *tup; long result; tup = make_tuple((PyStructSequence*) obj); + if (!tup) + return -1; result = PyObject_Hash(tup); Py_DECREF(tup); return result; From python-checkins at python.org Thu Oct 5 20:43:09 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 5 Oct 2006 20:43:09 +0200 (CEST) Subject: [Python-checkins] r52169 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061005184309.060AF1E4008@bag.python.org> Author: brett.cannon Date: Thu Oct 5 20:43:09 2006 New Revision: 52169 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Cause a call to load_module() that cannot load a module to raise ImportError (PEP 302 does not specify what to do). Also fleshed out tests to make sure the proper number of arguments are expected for find_module() (can be a common error when using static and classmethods; thanks Paul Moore for the tests). Finally, comments about the included frozen modules in the stdlib were added so as to not forget them. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 5 20:43:09 2006 @@ -13,6 +13,10 @@ * __import__ function http://docs.python.org/lib/built-in-funcs.html +Some design decisions have been made in this implementation. One is to raise +an ImportError if a call to load_module() on a loader fails to load a module. +PEP 302 does not specify what to do in the failing case. + """ import imp import sys @@ -57,7 +61,10 @@ try: return sys.modules[fullname] except KeyError: - return imp.init_builtin(fullname) + mod = imp.init_builtin(fullname) + if not mod: + raise ImportError("expected built-in module not loaded") + return mod class FrozenImporter(object): @@ -86,4 +93,7 @@ try: return sys.modules[fullname] except KeyError: - return imp.init_frozen(fullname) + mod = imp.init_frozen(fullname) + if not mod: + raise ImportError("expected frozen module not loaded") + return mod Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Thu Oct 5 20:43:09 2006 @@ -15,6 +15,10 @@ 'incorrectly found an extension module') self.failUnless(not importer.BuiltinImporter.find_module('token'), 'incorrectly found a Python module') + # Cover proper number of arguments. + self.failUnlessRaises(TypeError, importer.BuiltinImporter.find_module) + self.failUnlessRaises(TypeError, importer.BuiltinImporter.find_module, + 'sys', None, None) def test_find_module_path_shortcut(self): # Test short-circuiting of finding a module if 'path' argument is given @@ -43,10 +47,26 @@ self.failUnlessRaises(TypeError, importer.BuiltinImporter.load_module, 'sys', '') + def test_load_module_ImportError(self): + self.failUnlessRaises(ImportError, + importer.BuiltinImporter.load_module, + 'gobbledeegook') + + def test_load_module_arg_count(self): + self.failUnlessRaises(TypeError, importer.BuiltinImporter.load_module) + self.failUnlessRaises(TypeError, importer.BuiltinImporter.load_module, + 'sys', None, None) + class FrozenImporterTests(unittest.TestCase): - """Test the frozen module importer.""" + """Test the frozen module importer. + + Python include the __hello__ and __phello__ frozen modules (as defined in + Python/frozen.c). Both do output to the screen, though, which should be + suppressed during testing. + + """ pass From python-checkins at python.org Thu Oct 5 20:49:36 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 20:49:36 +0200 (CEST) Subject: [Python-checkins] r52170 - python/branches/release24-maint/Modules/_bsddb.c Message-ID: <20061005184936.E6A1E1E4008@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 20:49:36 2006 New Revision: 52170 Modified: python/branches/release24-maint/Modules/_bsddb.c Log: [Backport r50783 | neal.norwitz. The bytes_left code is complicated, but looks correct on a casual inspection and hasn't been modified in the trunk. Does anyone want to review further?] Ensure we don't write beyond errText. I think I got this right, but it definitely could use some review to ensure I'm not off by one and there's no possible overflow/wrap-around of bytes_left. Reported by Klocwork #1. Fix a problem if there is a failure allocating self->db. Found with failmalloc. Modified: python/branches/release24-maint/Modules/_bsddb.c ============================================================================== --- python/branches/release24-maint/Modules/_bsddb.c (original) +++ python/branches/release24-maint/Modules/_bsddb.c Thu Oct 5 20:49:36 2006 @@ -505,6 +505,7 @@ PyObject *errObj = NULL; PyObject *errTuple = NULL; int exceptionRaised = 0; + unsigned int bytes_left; switch (err) { case 0: /* successful, no error */ break; @@ -512,12 +513,15 @@ #if (DBVER < 41) case DB_INCOMPLETE: #if INCOMPLETE_IS_WARNING - our_strlcpy(errTxt, db_strerror(err), sizeof(errTxt)); - if (_db_errmsg[0]) { + bytes_left = our_strlcpy(errTxt, db_strerror(err), sizeof(errTxt)); + /* Ensure that bytes_left never goes negative */ + if (_db_errmsg[0] && bytes_left < (sizeof(errTxt) - 4)) { + bytes_left = sizeof(errTxt) - bytes_left - 4 - 1; + assert(bytes_left >= 0); strcat(errTxt, " -- "); - strcat(errTxt, _db_errmsg); - _db_errmsg[0] = 0; + strncat(errTxt, _db_errmsg, bytes_left); } + _db_errmsg[0] = 0; #ifdef HAVE_WARNINGS exceptionRaised = PyErr_Warn(PyExc_RuntimeWarning, errTxt); #else @@ -565,12 +569,15 @@ } if (errObj != NULL) { - our_strlcpy(errTxt, db_strerror(err), sizeof(errTxt)); - if (_db_errmsg[0]) { + bytes_left = our_strlcpy(errTxt, db_strerror(err), sizeof(errTxt)); + /* Ensure that bytes_left never goes negative */ + if (_db_errmsg[0] && bytes_left < (sizeof(errTxt) - 4)) { + bytes_left = sizeof(errTxt) - bytes_left - 4 - 1; + assert(bytes_left >= 0); strcat(errTxt, " -- "); - strcat(errTxt, _db_errmsg); - _db_errmsg[0] = 0; + strncat(errTxt, _db_errmsg, bytes_left); } + _db_errmsg[0] = 0; errTuple = Py_BuildValue("(is)", err, errTxt); PyErr_SetObject(errObj, errTuple); @@ -763,10 +770,12 @@ MYDB_BEGIN_ALLOW_THREADS; err = db_create(&self->db, db_env, flags); - self->db->set_errcall(self->db, _db_errorCallback); + if (self->db != NULL) { + self->db->set_errcall(self->db, _db_errorCallback); #if (DBVER >= 33) - self->db->app_private = (void*)self; + self->db->app_private = (void*)self; #endif + } MYDB_END_ALLOW_THREADS; /* TODO add a weakref(self) to the self->myenvobj->open_child_weakrefs * list so that a DBEnv can refuse to close without aborting any open From python-checkins at python.org Thu Oct 5 20:57:55 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 20:57:55 +0200 (CEST) Subject: [Python-checkins] r52171 - python/branches/release24-maint/Python/pythonrun.c Message-ID: <20061005185755.466591E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 20:57:54 2006 New Revision: 52171 Modified: python/branches/release24-maint/Python/pythonrun.c Log: [Backport r50685 | neal.norwitz] Reported by Klocwork #151. v2 can be NULL if exception2 is NULL. I don't think that condition can happen, but I'm not sure it can't either. Now the code will protect against either being NULL. Modified: python/branches/release24-maint/Python/pythonrun.c ============================================================================== --- python/branches/release24-maint/Python/pythonrun.c (original) +++ python/branches/release24-maint/Python/pythonrun.c Thu Oct 5 20:57:54 2006 @@ -1080,6 +1080,17 @@ } PyErr_Fetch(&exception2, &v2, &tb2); PyErr_NormalizeException(&exception2, &v2, &tb2); + /* It should not be possible for exception2 or v2 + to be NULL. However PyErr_Display() can't + tolerate NULLs, so just be safe. */ + if (exception2 == NULL) { + exception2 = Py_None; + Py_INCREF(exception2); + } + if (v2 == NULL) { + v2 = Py_None; + Py_INCREF(v2); + } if (Py_FlushLine()) PyErr_Clear(); fflush(stdout); @@ -1087,8 +1098,8 @@ PyErr_Display(exception2, v2, tb2); PySys_WriteStderr("\nOriginal exception was:\n"); PyErr_Display(exception, v, tb); - Py_XDECREF(exception2); - Py_XDECREF(v2); + Py_DECREF(exception2); + Py_DECREF(v2); Py_XDECREF(tb2); } Py_XDECREF(result); From python-checkins at python.org Thu Oct 5 21:01:50 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 21:01:50 +0200 (CEST) Subject: [Python-checkins] r52173 - python/branches/release24-maint/Python/bltinmodule.c Message-ID: <20061005190150.BBB2C1E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 21:01:50 2006 New Revision: 52173 Modified: python/branches/release24-maint/Python/bltinmodule.c Log: [Backport r51220 | neal.norwitz] It's highly unlikely, though possible for PyEval_Get*() to return NULLs. So be safe and do an XINCREF. Klocwork # 221-222. Modified: python/branches/release24-maint/Python/bltinmodule.c ============================================================================== --- python/branches/release24-maint/Python/bltinmodule.c (original) +++ python/branches/release24-maint/Python/bltinmodule.c Thu Oct 5 21:01:50 2006 @@ -687,7 +687,7 @@ PyObject *d; d = PyEval_GetGlobals(); - Py_INCREF(d); + Py_XINCREF(d); return d; } @@ -1118,7 +1118,7 @@ PyObject *d; d = PyEval_GetLocals(); - Py_INCREF(d); + Py_XINCREF(d); return d; } From python-checkins at python.org Thu Oct 5 21:08:30 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 21:08:30 +0200 (CEST) Subject: [Python-checkins] r52178 - python/branches/release24-maint/Python/marshal.c Message-ID: <20061005190830.D3C9A1E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 21:08:30 2006 New Revision: 52178 Modified: python/branches/release24-maint/Python/marshal.c Log: [Backport r51221 | neal.norwitz -- the original commit message is wrong; this code is only used if WITHOUT_COMPLEX is *not* defined, which is the common case for Python builds.] This code is actually not used unless WITHOUT_COMPLEX is defined. However, there was no error checking that PyFloat_FromDouble returned a valid pointer. I believe this change is correct as it seemed to follow other code in the area. Klocwork # 292. Modified: python/branches/release24-maint/Python/marshal.c ============================================================================== --- python/branches/release24-maint/Python/marshal.c (original) +++ python/branches/release24-maint/Python/marshal.c Thu Oct 5 21:08:30 2006 @@ -177,6 +177,10 @@ w_byte(TYPE_COMPLEX, p); temp = (PyFloatObject*)PyFloat_FromDouble( PyComplex_RealAsDouble(v)); + if (!temp) { + p->error = 1; + return; + } PyFloat_AsReprString(buf, temp); Py_DECREF(temp); n = strlen(buf); @@ -184,6 +188,10 @@ w_string(buf, n, p); temp = (PyFloatObject*)PyFloat_FromDouble( PyComplex_ImagAsDouble(v)); + if (!temp) { + p->error = 1; + return; + } PyFloat_AsReprString(buf, temp); Py_DECREF(temp); n = strlen(buf); From python-checkins at python.org Thu Oct 5 21:16:37 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 5 Oct 2006 21:16:37 +0200 (CEST) Subject: [Python-checkins] r52179 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061005191637.1AD7C1E4019@bag.python.org> Author: brett.cannon Date: Thu Oct 5 21:16:36 2006 New Revision: 52179 Modified: sandbox/trunk/import_in_py/importer.py Log: Refactor built-in and frozen module importers so as to work off of a common superclass. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 5 21:16:36 2006 @@ -22,38 +22,37 @@ import sys -class BuiltinImporter(object): +class BuiltinFrozenImporter(object): + + """Base class for meta_path importers for built-in and frozen modules. + + Subclasses must provide the _find and _load methods. Both expect only the + name of the modules to import. The methods are expected to be defined on + the subclass itself and not on an instance. - """sys.meta_path class for importing built-in modules. - - Use static and classmethods as no purpose is served by having instances of - this class. - """ @classmethod def find_module(cls, fullname, path=None): - """See if import is for a built-in module. + """See if import is for a built-in or frozen module. - Since built-in modules should never have a path, short-circuit if one - is specified. + Since built-in and frozen modules should never have a path, + short-circuit if one is specified. """ if path is not None: return None - # Could also check sys.builtin_module_names to see if the import is for - # a built-in module. - elif imp.is_builtin(fullname): + elif cls._find(fullname): return cls else: return None - @staticmethod - def load_module(fullname, path=None): - """Load a built-in module. + @classmethod + def load_module(cls, fullname, path=None): + """Load a built-in or frozen module. - 'imp' code for loading a built-in modules handles the setting of a - module in sys.modules before initializing the module. + 'imp' code for loading a built-in or frozen module handles the setting + of a module in sys.modules before initializing the module. """ if path is not None: @@ -61,39 +60,23 @@ try: return sys.modules[fullname] except KeyError: - mod = imp.init_builtin(fullname) + mod = cls._load(fullname) if not mod: raise ImportError("expected built-in module not loaded") return mod -class FrozenImporter(object): +class BuiltinImporter(BuiltinFrozenImporter): - """sys.meta_path class for importing frozen modules. + """sys.meta_path class for importing built-in modules.""" - Based off of BuiltinImporter. + _find = imp.is_builtin + _load = imp.init_builtin - """ - @classmethod - def find_module(cls, fullname, path=None): - """Return a loader for frozen modules if the module is a frozen - module.""" - if path is not None: - return None - elif imp.is_frozen(fullname): - return cls - else: - return None +class FrozenImporter(object): - @staticmethod - def load_module(fullname, path=None): - if path is not None: - raise TypeError("loader does not expect an argument for 'path'") - try: - return sys.modules[fullname] - except KeyError: - mod = imp.init_frozen(fullname) - if not mod: - raise ImportError("expected frozen module not loaded") - return mod + """sys.meta_path class for importing frozen modules.""" + + _find = imp.is_frozen + _load = imp.init_frozen From python-checkins at python.org Thu Oct 5 21:25:27 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 21:25:27 +0200 (CEST) Subject: [Python-checkins] r52186 - python/branches/release24-maint/Objects/classobject.c Message-ID: <20061005192527.4FC201E4008@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 21:25:26 2006 New Revision: 52186 Modified: python/branches/release24-maint/Objects/classobject.c Log: [Backport r51246 | neal.norwitz] Handle a whole lot of failures from PyString_FromInternedString(). Should fix most of Klocwork 234-272. [Backport r51400 | neal.norwitz] Move initialization of interned strings to before allocating the object so we don't leak op. (Fixes an earlier patch to this code) Klockwork #350 Modified: python/branches/release24-maint/Objects/classobject.c ============================================================================== --- python/branches/release24-maint/Objects/classobject.c (original) +++ python/branches/release24-maint/Objects/classobject.c Thu Oct 5 21:25:26 2006 @@ -94,8 +94,22 @@ } Py_INCREF(bases); } + + if (getattrstr == NULL) { + getattrstr = PyString_InternFromString("__getattr__"); + if (getattrstr == NULL) + goto alloc_error; + setattrstr = PyString_InternFromString("__setattr__"); + if (setattrstr == NULL) + goto alloc_error; + delattrstr = PyString_InternFromString("__delattr__"); + if (delattrstr == NULL) + goto alloc_error; + } + op = PyObject_GC_New(PyClassObject, &PyClass_Type); if (op == NULL) { +alloc_error: Py_DECREF(bases); return NULL; } @@ -104,11 +118,7 @@ op->cl_dict = dict; Py_XINCREF(name); op->cl_name = name; - if (getattrstr == NULL) { - getattrstr = PyString_InternFromString("__getattr__"); - setattrstr = PyString_InternFromString("__setattr__"); - delattrstr = PyString_InternFromString("__delattr__"); - } + op->cl_getattr = class_lookup(op, getattrstr, &dummy); op->cl_setattr = class_lookup(op, setattrstr, &dummy); op->cl_delattr = class_lookup(op, delattrstr, &dummy); @@ -550,11 +560,14 @@ PyObject *init; static PyObject *initstr; + if (initstr == NULL) { + initstr = PyString_InternFromString("__init__"); + if (initstr == NULL) + return NULL; + } inst = (PyInstanceObject *) PyInstance_NewRaw(klass, NULL); if (inst == NULL) return NULL; - if (initstr == NULL) - initstr = PyString_InternFromString("__init__"); init = instance_getattr2(inst, initstr); if (init == NULL) { if (PyErr_Occurred()) { @@ -640,8 +653,11 @@ /* Save the current exception, if any. */ PyErr_Fetch(&error_type, &error_value, &error_traceback); /* Execute __del__ method, if any. */ - if (delstr == NULL) + if (delstr == NULL) { delstr = PyString_InternFromString("__del__"); + if (delstr == NULL) + return NULL; + } if ((del = instance_getattr2(inst, delstr)) != NULL) { PyObject *res = PyEval_CallObject(del, (PyObject *)NULL); if (res == NULL) @@ -868,8 +884,11 @@ PyObject *res; static PyObject *reprstr; - if (reprstr == NULL) + if (reprstr == NULL) { reprstr = PyString_InternFromString("__repr__"); + if (reprstr == NULL) + return NULL; + } func = instance_getattr(inst, reprstr); if (func == NULL) { PyObject *classname, *mod; @@ -904,8 +923,11 @@ PyObject *res; static PyObject *strstr; - if (strstr == NULL) + if (strstr == NULL) { strstr = PyString_InternFromString("__str__"); + if (strstr == NULL) + return NULL; + } func = instance_getattr(inst, strstr); if (func == NULL) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) @@ -926,8 +948,11 @@ long outcome; static PyObject *hashstr, *eqstr, *cmpstr; - if (hashstr == NULL) + if (hashstr == NULL) { hashstr = PyString_InternFromString("__hash__"); + if (hashstr == NULL) + return -1; + } func = instance_getattr(inst, hashstr); if (func == NULL) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) @@ -936,15 +961,21 @@ /* If there is no __eq__ and no __cmp__ method, we hash on the address. If an __eq__ or __cmp__ method exists, there must be a __hash__. */ - if (eqstr == NULL) + if (eqstr == NULL) { eqstr = PyString_InternFromString("__eq__"); + if (eqstr == NULL) + return -1; + } func = instance_getattr(inst, eqstr); if (func == NULL) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) return -1; PyErr_Clear(); - if (cmpstr == NULL) + if (cmpstr == NULL) { cmpstr = PyString_InternFromString("__cmp__"); + if (cmpstr == NULL) + return -1; + } func = instance_getattr(inst, cmpstr); if (func == NULL) { if (!PyErr_ExceptionMatches( @@ -1003,8 +1034,11 @@ PyObject *res; int outcome; - if (lenstr == NULL) + if (lenstr == NULL) { lenstr = PyString_InternFromString("__len__"); + if (lenstr == NULL) + return -1; + } func = instance_getattr(inst, lenstr); if (func == NULL) return -1; @@ -1044,8 +1078,11 @@ PyObject *arg; PyObject *res; - if (getitemstr == NULL) + if (getitemstr == NULL) { getitemstr = PyString_InternFromString("__getitem__"); + if (getitemstr == NULL) + return NULL; + } func = instance_getattr(inst, getitemstr); if (func == NULL) return NULL; @@ -1068,13 +1105,19 @@ PyObject *res; if (value == NULL) { - if (delitemstr == NULL) + if (delitemstr == NULL) { delitemstr = PyString_InternFromString("__delitem__"); + if (delitemstr == NULL) + return -1; + } func = instance_getattr(inst, delitemstr); } else { - if (setitemstr == NULL) + if (setitemstr == NULL) { setitemstr = PyString_InternFromString("__setitem__"); + if (setitemstr == NULL) + return -1; + } func = instance_getattr(inst, setitemstr); } if (func == NULL) @@ -1107,8 +1150,11 @@ { PyObject *func, *arg, *res; - if (getitemstr == NULL) + if (getitemstr == NULL) { getitemstr = PyString_InternFromString("__getitem__"); + if (getitemstr == NULL) + return NULL; + } func = instance_getattr(inst, getitemstr); if (func == NULL) return NULL; @@ -1150,8 +1196,11 @@ PyObject *func, *arg, *res; static PyObject *getslicestr; - if (getslicestr == NULL) + if (getslicestr == NULL) { getslicestr = PyString_InternFromString("__getslice__"); + if (getslicestr == NULL) + return NULL; + } func = instance_getattr(inst, getslicestr); if (func == NULL) { @@ -1159,8 +1208,11 @@ return NULL; PyErr_Clear(); - if (getitemstr == NULL) + if (getitemstr == NULL) { getitemstr = PyString_InternFromString("__getitem__"); + if (getitemstr == NULL) + return NULL; + } func = instance_getattr(inst, getitemstr); if (func == NULL) return NULL; @@ -1184,13 +1236,19 @@ PyObject *func, *arg, *res; if (item == NULL) { - if (delitemstr == NULL) + if (delitemstr == NULL) { delitemstr = PyString_InternFromString("__delitem__"); + if (delitemstr == NULL) + return -1; + } func = instance_getattr(inst, delitemstr); } else { - if (setitemstr == NULL) + if (setitemstr == NULL) { setitemstr = PyString_InternFromString("__setitem__"); + if (setitemstr == NULL) + return -1; + } func = instance_getattr(inst, setitemstr); } if (func == NULL) @@ -1219,17 +1277,23 @@ static PyObject *setslicestr, *delslicestr; if (value == NULL) { - if (delslicestr == NULL) + if (delslicestr == NULL) { delslicestr = PyString_InternFromString("__delslice__"); + if (delslicestr == NULL) + return -1; + } func = instance_getattr(inst, delslicestr); if (func == NULL) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) return -1; PyErr_Clear(); - if (delitemstr == NULL) + if (delitemstr == NULL) { delitemstr = PyString_InternFromString("__delitem__"); + if (delitemstr == NULL) + return -1; + } func = instance_getattr(inst, delitemstr); if (func == NULL) return -1; @@ -1240,17 +1304,23 @@ arg = Py_BuildValue("(ii)", i, j); } else { - if (setslicestr == NULL) + if (setslicestr == NULL) { setslicestr = PyString_InternFromString("__setslice__"); + if (setslicestr == NULL) + return -1; + } func = instance_getattr(inst, setslicestr); if (func == NULL) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) return -1; PyErr_Clear(); - if (setitemstr == NULL) + if (setitemstr == NULL) { setitemstr = PyString_InternFromString("__setitem__"); + if (setitemstr == NULL) + return -1; + } func = instance_getattr(inst, setitemstr); if (func == NULL) return -1; @@ -1523,7 +1593,8 @@ #define UNARY(funcname, methodname) \ static PyObject *funcname(PyInstanceObject *self) { \ static PyObject *o; \ - if (o == NULL) o = PyString_InternFromString(methodname); \ + if (o == NULL) { o = PyString_InternFromString(methodname); \ + if (o == NULL) return NULL; } \ return generic_unary_op(self, o); \ } @@ -1695,14 +1766,20 @@ long outcome; static PyObject *nonzerostr; - if (nonzerostr == NULL) + if (nonzerostr == NULL) { nonzerostr = PyString_InternFromString("__nonzero__"); + if (nonzerostr == NULL) + return -1; + } if ((func = instance_getattr(self, nonzerostr)) == NULL) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) return -1; PyErr_Clear(); - if (lenstr == NULL) + if (lenstr == NULL) { lenstr = PyString_InternFromString("__len__"); + if (lenstr == NULL) + return -1; + } if ((func = instance_getattr(self, lenstr)) == NULL) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) return -1; @@ -1959,8 +2036,11 @@ { PyObject *func; - if (nextstr == NULL) + if (nextstr == NULL) { nextstr = PyString_InternFromString("next"); + if (nextstr == NULL) + return NULL; + } if ((func = instance_getattr(self, nextstr)) != NULL) { PyObject *res = PyEval_CallObject(func, (PyObject *)NULL); From python-checkins at python.org Thu Oct 5 21:28:03 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 5 Oct 2006 21:28:03 +0200 (CEST) Subject: [Python-checkins] r52188 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061005192803.264D41E4006@bag.python.org> Author: brett.cannon Date: Thu Oct 5 21:28:02 2006 New Revision: 52188 Modified: sandbox/trunk/import_in_py/importer.py Log: Rename superclass for built-in and frozen modules to make name a little bit more obvious. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 5 21:28:02 2006 @@ -22,7 +22,7 @@ import sys -class BuiltinFrozenImporter(object): +class BuiltinFrozen_Importer(object): """Base class for meta_path importers for built-in and frozen modules. @@ -66,7 +66,7 @@ return mod -class BuiltinImporter(BuiltinFrozenImporter): +class BuiltinImporter(BuiltinFrozen_Importer): """sys.meta_path class for importing built-in modules.""" @@ -74,7 +74,7 @@ _load = imp.init_builtin -class FrozenImporter(object): +class FrozenImporter(BuiltinFrozen_Importer): """sys.meta_path class for importing frozen modules.""" From python-checkins at python.org Thu Oct 5 21:28:51 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 5 Oct 2006 21:28:51 +0200 (CEST) Subject: [Python-checkins] r52189 - sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061005192851.8DC491E4006@bag.python.org> Author: brett.cannon Date: Thu Oct 5 21:28:51 2006 New Revision: 52189 Modified: sandbox/trunk/import_in_py/test_importer.py Log: Refactor testing of built-in and frozen importers so a superclass can be used. Still have to set up for the frozen importers, though. Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Thu Oct 5 21:28:51 2006 @@ -3,62 +3,83 @@ import importer import sys -class BuiltinImporterTests(unittest.TestCase): - """Test the built-in module importer.""" +class BuiltinFrozen_Tester(unittest.TestCase): + + """Common test cases for built-in and frozen modules. + + Expected attributes: + * self.importer + The meta_path importer to test. + * self.module_name + Name of a module that the importer can import. + * self.bad_module_names + Sequence of module names that cannot be imported. + + """ def test_find_module_basic(self): - # Make sure only built-in modules are found. - for name in sys.builtin_module_names: - self.failUnless(importer.BuiltinImporter.find_module(name)) - self.failUnless(not importer.BuiltinImporter.find_module('time'), - 'incorrectly found an extension module') - self.failUnless(not importer.BuiltinImporter.find_module('token'), - 'incorrectly found a Python module') + # Make sure expected modules can be found. + self.failUnless(self.importer.find_module(self.module_name)) + + def test_find_module_failures(self): + # Modules of the wrong type should not be found. + for module_name in self.bad_module_names: + self.failUnlessEqual(self.importer.find_module(module_name), None) + + def test_find_module_arg_count(self): # Cover proper number of arguments. - self.failUnlessRaises(TypeError, importer.BuiltinImporter.find_module) - self.failUnlessRaises(TypeError, importer.BuiltinImporter.find_module, - 'sys', None, None) + self.failUnlessRaises(TypeError, self.importer.find_module) + self.failUnlessRaises(TypeError, self.importer.find_module, + self.module_name, None, None) def test_find_module_path_shortcut(self): # Test short-circuiting of finding a module if 'path' argument is given # a value. - self.failUnless(not importer.BuiltinImporter.find_module('sys', '')) + self.failUnless(not self.importer.find_module(self.module_name, '')) def test_load_module_prev_import_check(self): - # If a module is already in 'sys' it should be returned without being - # re-initialized. - self.failUnlessEqual(importer.BuiltinImporter.load_module('sys'), - sys.modules['sys']) + # If a module is already in sys.modules it should be returned without + # being re-initialized. + self.failUnlessEqual(self.importer.load_module(self.module_name), + sys.modules[self.module_name]) def test_load_module_new_import(self): - # Make sure importing of a built-in that was not done before works + # Make sure importing of a modules -in that was not done before works # properly. try: - del sys.modules['sys'] + del sys.modules[self.module_name] except KeyError: pass - sys_module = importer.BuiltinImporter.load_module('sys') - self.failUnless(sys_module) - self.failUnless(hasattr(sys_module, 'version')) + loaded_module = self.importer.load_module(self.module_name) + self.failUnlessEqual(self.module_name, loaded_module.__name__) def test_load_module_no_path_argument(self): # TypeError should be raise if 'path' argument set. - self.failUnlessRaises(TypeError, importer.BuiltinImporter.load_module, - 'sys', '') + self.failUnlessRaises(TypeError, self.importer.load_module, + self.module_name, '') def test_load_module_ImportError(self): self.failUnlessRaises(ImportError, - importer.BuiltinImporter.load_module, - 'gobbledeegook') + self.importer.load_module, + self.bad_module_names[0]) def test_load_module_arg_count(self): - self.failUnlessRaises(TypeError, importer.BuiltinImporter.load_module) - self.failUnlessRaises(TypeError, importer.BuiltinImporter.load_module, - 'sys', None, None) + self.failUnlessRaises(TypeError, self.importer.load_module) + self.failUnlessRaises(TypeError, self.importer.load_module, + self.module_name, None, None) + + +class BuiltinImporterTests(BuiltinFrozen_Tester): + + """Test the built-in module importer.""" + + importer = importer.BuiltinImporter + module_name = 'sys' + bad_module_names = ('tokenize', 'time', '__hello__') -class FrozenImporterTests(unittest.TestCase): +class FrozenImporterTests(BuiltinFrozen_Tester): """Test the frozen module importer. From python-checkins at python.org Thu Oct 5 21:32:53 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 21:32:53 +0200 (CEST) Subject: [Python-checkins] r52190 - python/branches/release24-maint/Parser/parsetok.c Message-ID: <20061005193253.15C571E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 21:32:52 2006 New Revision: 52190 Modified: python/branches/release24-maint/Parser/parsetok.c Log: [Backport r51222 | neal.norwitz -- if you hack the code to set r=NULL, you find that Python does print "MemoryError". There's no traceback and no indication of which line of code is responsible, but it's better than a segfault.] Handle NULL nodes while parsing. I'm not entirely sure this is correct. There might be something else that needs to be done to setup the error. Klocwork #295. Modified: python/branches/release24-maint/Parser/parsetok.c ============================================================================== --- python/branches/release24-maint/Parser/parsetok.c (original) +++ python/branches/release24-maint/Parser/parsetok.c Thu Oct 5 21:32:52 2006 @@ -197,6 +197,11 @@ } } else if (tok->encoding != NULL) { node* r = PyNode_New(encoding_decl); + if (!r) { + err_ret->error = E_NOMEM; + n = NULL; + goto done; + } r->n_str = tok->encoding; r->n_nchildren = 1; r->n_child = n; @@ -204,6 +209,7 @@ n = r; } +done: PyTokenizer_Free(tok); return n; From python-checkins at python.org Thu Oct 5 21:36:24 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 5 Oct 2006 21:36:24 +0200 (CEST) Subject: [Python-checkins] r52191 - sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061005193624.329151E4006@bag.python.org> Author: brett.cannon Date: Thu Oct 5 21:36:23 2006 New Revision: 52191 Modified: sandbox/trunk/import_in_py/test_importer.py Log: Add tests for the frozen module importer. Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Thu Oct 5 21:36:23 2006 @@ -2,6 +2,7 @@ from test import test_support import importer import sys +import StringIO class BuiltinFrozen_Tester(unittest.TestCase): @@ -89,12 +90,25 @@ """ - pass + importer = importer.FrozenImporter + module_name = '__hello__' + bad_module_names = ('tokenize', 'time', 'sys') + + def setUp(self): + """Importing the testing frozen modules outputs to stdout. Redirect + stdout to block that.""" + self._orig_stdout = sys.stdout + sys.stdout = StringIO.StringIO() + + def tearDown(self): + """Reset stdout to what it is by default.""" + sys.stdout = self._orig_stdout def test_main(): test_support.run_unittest( BuiltinImporterTests, + FrozenImporterTests, ) From python-checkins at python.org Thu Oct 5 21:38:18 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 21:38:18 +0200 (CEST) Subject: [Python-checkins] r52192 - python/branches/release24-maint/Objects/funcobject.c Message-ID: <20061005193818.3ACEE1E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 21:38:17 2006 New Revision: 52192 Modified: python/branches/release24-maint/Objects/funcobject.c Log: [Backport r50681 | neal.norwitz] PyFunction_SetDefaults() is documented as taking None or a tuple. A NULL would crash the PyTuple_Check(). Now make NULL return a SystemError. Reported by Klocwork #73. Modified: python/branches/release24-maint/Objects/funcobject.c ============================================================================== --- python/branches/release24-maint/Objects/funcobject.c (original) +++ python/branches/release24-maint/Objects/funcobject.c Thu Oct 5 21:38:17 2006 @@ -109,8 +109,8 @@ } if (defaults == Py_None) defaults = NULL; - else if (PyTuple_Check(defaults)) { - Py_XINCREF(defaults); + else if (defaults && PyTuple_Check(defaults)) { + Py_INCREF(defaults); } else { PyErr_SetString(PyExc_SystemError, "non-tuple default args"); From python-checkins at python.org Thu Oct 5 21:42:49 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 5 Oct 2006 21:42:49 +0200 (CEST) Subject: [Python-checkins] r52193 - python/branches/release24-maint/Objects/complexobject.c Message-ID: <20061005194249.9CDEC1E4006@bag.python.org> Author: andrew.kuchling Date: Thu Oct 5 21:42:49 2006 New Revision: 52193 Modified: python/branches/release24-maint/Objects/complexobject.c Log: [Backport r50679 | neal.norwitz. This is the last Klocwork bug to be backported.] Use sizeof(buffer) instead of duplicating the constants to ensure they won't be wrong. The real change is to pass (bufsz - 1) to PyOS_ascii_formatd and 1 to strncat. strncat copies n+1 bytes from src (not dest). Reported by Klocwork #58. Modified: python/branches/release24-maint/Objects/complexobject.c ============================================================================== --- python/branches/release24-maint/Objects/complexobject.c (original) +++ python/branches/release24-maint/Objects/complexobject.c Thu Oct 5 21:42:49 2006 @@ -274,16 +274,16 @@ { char format[32]; if (v->cval.real == 0.) { - PyOS_snprintf(format, 32, "%%.%ig", precision); - PyOS_ascii_formatd(buf, bufsz, format, v->cval.imag); - strncat(buf, "j", bufsz); + PyOS_snprintf(format, sizeof(format), "%%.%ig", precision); + PyOS_ascii_formatd(buf, bufsz - 1, format, v->cval.imag); + strncat(buf, "j", 1); } else { char re[64], im[64]; /* Format imaginary part with sign, real part without */ - PyOS_snprintf(format, 32, "%%.%ig", precision); - PyOS_ascii_formatd(re, 64, format, v->cval.real); - PyOS_snprintf(format, 32, "%%+.%ig", precision); - PyOS_ascii_formatd(im, 64, format, v->cval.imag); + PyOS_snprintf(format, sizeof(format), "%%.%ig", precision); + PyOS_ascii_formatd(re, sizeof(re), format, v->cval.real); + PyOS_snprintf(format, sizeof(format), "%%+.%ig", precision); + PyOS_ascii_formatd(im, sizeof(im), format, v->cval.imag); PyOS_snprintf(buf, bufsz, "(%s%sj)", re, im); } } From python-checkins at python.org Thu Oct 5 22:04:54 2006 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 5 Oct 2006 22:04:54 +0200 (CEST) Subject: [Python-checkins] r52194 - python/branches/release24-maint/Tools/msi/msi.py Message-ID: <20061005200454.79B441E4006@bag.python.org> Author: martin.v.loewis Date: Thu Oct 5 22:04:53 2006 New Revision: 52194 Modified: python/branches/release24-maint/Tools/msi/msi.py Log: Include sgml_input.html. Modified: python/branches/release24-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release24-maint/Tools/msi/msi.py (original) +++ python/branches/release24-maint/Tools/msi/msi.py Thu Oct 5 22:04:53 2006 @@ -913,6 +913,7 @@ lib.add_file("185test.db") lib.add_file("audiotest.au") lib.add_file("cfgparser.1") + lib.add_file("sgml_input.html") lib.add_file("test.xml") lib.add_file("test.xml.out") lib.add_file("testtar.tar") From buildbot at python.org Thu Oct 5 22:29:43 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Oct 2006 20:29:43 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo 2.4 Message-ID: <20061005202943.429801E4006@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%25202.4/builds/266 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 5 22:50:37 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Oct 2006 20:50:37 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.4 Message-ID: <20061005205037.D9F2D1E400D@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.4/builds/39 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Thu Oct 5 23:42:48 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 5 Oct 2006 23:42:48 +0200 (CEST) Subject: [Python-checkins] r52195 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061005214248.4597E1E4007@bag.python.org> Author: brett.cannon Date: Thu Oct 5 23:42:47 2006 New Revision: 52195 Modified: sandbox/trunk/import_in_py/importer.py Log: Clarify a comment for load_module(). Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 5 23:42:47 2006 @@ -52,7 +52,8 @@ """Load a built-in or frozen module. 'imp' code for loading a built-in or frozen module handles the setting - of a module in sys.modules before initializing the module. + of a module in sys.modules before initializing the module. This means + that we do not need to perform that step as outlined by PEP 302. """ if path is not None: From python-checkins at python.org Fri Oct 6 00:02:31 2006 From: python-checkins at python.org (brett.cannon) Date: Fri, 6 Oct 2006 00:02:31 +0200 (CEST) Subject: [Python-checkins] r52196 - python/trunk/Doc/lib/libimp.tex Message-ID: <20061005220231.A79671E4007@bag.python.org> Author: brett.cannon Date: Fri Oct 6 00:02:31 2006 New Revision: 52196 Modified: python/trunk/Doc/lib/libimp.tex Log: Clarify what "re-initialization" means for init_builtin() and init_dynamic(). Also remove warning about re-initialization as possibly raising an execption as both call _PyImport_FindExtension() which pulls any module that was already imported from the Python process' extension cache and just copies the __dict__ into the module stored in sys.modules. Modified: python/trunk/Doc/lib/libimp.tex ============================================================================== --- python/trunk/Doc/lib/libimp.tex (original) +++ python/trunk/Doc/lib/libimp.tex Fri Oct 6 00:02:31 2006 @@ -161,10 +161,10 @@ \begin{funcdesc}{init_builtin}{name} Initialize the built-in module called \var{name} and return its module -object. If the module was already initialized, it will be initialized -\emph{again}. A few modules cannot be initialized twice --- attempting -to initialize these again will raise an \exception{ImportError} -exception. If there is no +object along with storing it in \code{sys.modules}. If the module was already +initialized, it will be initialized \emph{again}. Re-initialization involves +the copying of the built-in module's \code{__dict__} from the cached +module over the module's entry in \code{sys.modules}. If there is no built-in module called \var{name}, \code{None} is returned. \end{funcdesc} @@ -208,14 +208,15 @@ \begin{funcdesc}{load_dynamic}{name, pathname\optional{, file}} Load and initialize a module implemented as a dynamically loadable shared library and return its module object. If the module was -already initialized, it will be initialized \emph{again}. Some modules -don't like that and may raise an exception. The \var{pathname} -argument must point to the shared library. The \var{name} argument is -used to construct the name of the initialization function: an external -C function called \samp{init\var{name}()} in the shared library is -called. The optional \var{file} argument is ignored. (Note: using -shared libraries is highly system dependent, and not all systems -support it.) +already initialized, it will be initialized \emph{again}. +Re-initialization involves copying the \code{__dict__} attribute of the cached +instance of the module over the value used in the module cached in +\code{sys.modules}. The \var{pathname} argument must point to the shared +library. The \var{name} argument is used to construct the name of the +initialization function: an external C function called +\samp{init\var{name}()} in the shared library is called. The optional +\var{file} argument is ignored. (Note: using shared libraries is highly +system dependent, and not all systems support it.) \end{funcdesc} \begin{funcdesc}{load_source}{name, pathname\optional{, file}} From python-checkins at python.org Fri Oct 6 00:51:51 2006 From: python-checkins at python.org (brett.cannon) Date: Fri, 6 Oct 2006 00:51:51 +0200 (CEST) Subject: [Python-checkins] r52197 - in python/branches/pep302_phase2: Doc/lib/libimp.tex Doc/lib/liblogging.tex Lib/distutils/command/wininst-8.exe Lib/email/utils.py Lib/logging/__init__.py Lib/test/list_tests.py Lib/test/test_builtin.py Lib/test/test_imp.py Lib/test/test_long.py Lib/test/test_syntax.py Misc/NEWS Modules/_sre.c Modules/cPickle.c Modules/linuxaudiodev.c Modules/ossaudiodev.c Objects/abstract.c Objects/fileobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/stringobject.c Objects/typeobject.c Objects/unicodeobject.c PC/bdist_wininst/wininst-8.sln PC/bdist_wininst/wininst-8.vcproj Python/compile.c Python/errors.c Python/getargs.c Python/import.c Python/marshal.c Python/modsupport.c Python/mystrtoul.c Python/sysmodule.c Tools/msi/uuids.py Message-ID: <20061005225151.2B9841E4006@bag.python.org> Author: brett.cannon Date: Fri Oct 6 00:51:44 2006 New Revision: 52197 Added: python/branches/pep302_phase2/Lib/distutils/command/wininst-8.exe - copied unchanged from r52196, python/trunk/Lib/distutils/command/wininst-8.exe python/branches/pep302_phase2/PC/bdist_wininst/wininst-8.sln - copied unchanged from r52196, python/trunk/PC/bdist_wininst/wininst-8.sln python/branches/pep302_phase2/PC/bdist_wininst/wininst-8.vcproj - copied unchanged from r52196, python/trunk/PC/bdist_wininst/wininst-8.vcproj Modified: python/branches/pep302_phase2/ (props changed) python/branches/pep302_phase2/Doc/lib/libimp.tex python/branches/pep302_phase2/Doc/lib/liblogging.tex python/branches/pep302_phase2/Lib/email/utils.py python/branches/pep302_phase2/Lib/logging/__init__.py python/branches/pep302_phase2/Lib/test/list_tests.py python/branches/pep302_phase2/Lib/test/test_builtin.py python/branches/pep302_phase2/Lib/test/test_imp.py python/branches/pep302_phase2/Lib/test/test_long.py python/branches/pep302_phase2/Lib/test/test_syntax.py python/branches/pep302_phase2/Misc/NEWS python/branches/pep302_phase2/Modules/_sre.c python/branches/pep302_phase2/Modules/cPickle.c python/branches/pep302_phase2/Modules/linuxaudiodev.c python/branches/pep302_phase2/Modules/ossaudiodev.c python/branches/pep302_phase2/Objects/abstract.c python/branches/pep302_phase2/Objects/fileobject.c python/branches/pep302_phase2/Objects/intobject.c python/branches/pep302_phase2/Objects/listobject.c python/branches/pep302_phase2/Objects/longobject.c python/branches/pep302_phase2/Objects/stringobject.c python/branches/pep302_phase2/Objects/typeobject.c python/branches/pep302_phase2/Objects/unicodeobject.c python/branches/pep302_phase2/Python/compile.c python/branches/pep302_phase2/Python/errors.c python/branches/pep302_phase2/Python/getargs.c python/branches/pep302_phase2/Python/import.c python/branches/pep302_phase2/Python/marshal.c python/branches/pep302_phase2/Python/modsupport.c python/branches/pep302_phase2/Python/mystrtoul.c python/branches/pep302_phase2/Python/sysmodule.c python/branches/pep302_phase2/Tools/msi/uuids.py Log: Merged revisions 52092-52196 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk Modified: python/branches/pep302_phase2/Doc/lib/libimp.tex ============================================================================== --- python/branches/pep302_phase2/Doc/lib/libimp.tex (original) +++ python/branches/pep302_phase2/Doc/lib/libimp.tex Fri Oct 6 00:51:44 2006 @@ -161,10 +161,10 @@ \begin{funcdesc}{init_builtin}{name} Initialize the built-in module called \var{name} and return its module -object. If the module was already initialized, it will be initialized -\emph{again}. A few modules cannot be initialized twice --- attempting -to initialize these again will raise an \exception{ImportError} -exception. If there is no +object along with storing it in \code{sys.modules}. If the module was already +initialized, it will be initialized \emph{again}. Re-initialization involves +the copying of the built-in module's \code{__dict__} from the cached +module over the module's entry in \code{sys.modules}. If there is no built-in module called \var{name}, \code{None} is returned. \end{funcdesc} @@ -208,14 +208,15 @@ \begin{funcdesc}{load_dynamic}{name, pathname\optional{, file}} Load and initialize a module implemented as a dynamically loadable shared library and return its module object. If the module was -already initialized, it will be initialized \emph{again}. Some modules -don't like that and may raise an exception. The \var{pathname} -argument must point to the shared library. The \var{name} argument is -used to construct the name of the initialization function: an external -C function called \samp{init\var{name}()} in the shared library is -called. The optional \var{file} argument is ignored. (Note: using -shared libraries is highly system dependent, and not all systems -support it.) +already initialized, it will be initialized \emph{again}. +Re-initialization involves copying the \code{__dict__} attribute of the cached +instance of the module over the value used in the module cached in +\code{sys.modules}. The \var{pathname} argument must point to the shared +library. The \var{name} argument is used to construct the name of the +initialization function: an external C function called +\samp{init\var{name}()} in the shared library is called. The optional +\var{file} argument is ignored. (Note: using shared libraries is highly +system dependent, and not all systems support it.) \end{funcdesc} \begin{funcdesc}{load_source}{name, pathname\optional{, file}} Modified: python/branches/pep302_phase2/Doc/lib/liblogging.tex ============================================================================== --- python/branches/pep302_phase2/Doc/lib/liblogging.tex (original) +++ python/branches/pep302_phase2/Doc/lib/liblogging.tex Fri Oct 6 00:51:44 2006 @@ -528,8 +528,8 @@ \method{filter()}. \end{methoddesc} -\begin{methoddesc}{makeRecord}{name, lvl, fn, lno, msg, args, exc_info, - func, extra} +\begin{methoddesc}{makeRecord}{name, lvl, fn, lno, msg, args, exc_info + \optional{, func, extra}} This is a factory method which can be overridden in subclasses to create specialized \class{LogRecord} instances. \versionchanged[\var{func} and \var{extra} were added]{2.5} @@ -1479,7 +1479,7 @@ information to be logged. \begin{classdesc}{LogRecord}{name, lvl, pathname, lineno, msg, args, - exc_info} + exc_info \optional{, func}} Returns an instance of \class{LogRecord} initialized with interesting information. The \var{name} is the logger name; \var{lvl} is the numeric level; \var{pathname} is the absolute pathname of the source @@ -1489,7 +1489,9 @@ which, together with \var{msg}, makes up the user message; and \var{exc_info} is the exception tuple obtained by calling \function{sys.exc_info() }(or \constant{None}, if no exception information -is available). +is available). The \var{func} is the name of the function from which the +logging call was made. If not specified, it defaults to \var{None}. +\versionchanged[\var{func} was added]{2.5} \end{classdesc} \begin{methoddesc}{getMessage}{} Modified: python/branches/pep302_phase2/Lib/email/utils.py ============================================================================== --- python/branches/pep302_phase2/Lib/email/utils.py (original) +++ python/branches/pep302_phase2/Lib/email/utils.py Fri Oct 6 00:51:44 2006 @@ -235,10 +235,6 @@ parts = s.split(TICK, 2) if len(parts) <= 2: return None, None, s - if len(parts) > 3: - charset, language = parts[:2] - s = TICK.join(parts[2:]) - return charset, language, s return parts Modified: python/branches/pep302_phase2/Lib/logging/__init__.py ============================================================================== --- python/branches/pep302_phase2/Lib/logging/__init__.py (original) +++ python/branches/pep302_phase2/Lib/logging/__init__.py Fri Oct 6 00:51:44 2006 @@ -214,7 +214,7 @@ information to be logged. """ def __init__(self, name, level, pathname, lineno, - msg, args, exc_info, func): + msg, args, exc_info, func=None): """ Initialize a logging record with interesting information. """ Modified: python/branches/pep302_phase2/Lib/test/list_tests.py ============================================================================== --- python/branches/pep302_phase2/Lib/test/list_tests.py (original) +++ python/branches/pep302_phase2/Lib/test/list_tests.py Fri Oct 6 00:51:44 2006 @@ -269,7 +269,6 @@ self.assertRaises(TypeError, a.insert) def test_pop(self): - from decimal import Decimal a = self.type2test([-1, 0, 1]) a.pop() self.assertEqual(a, [-1, 0]) @@ -281,8 +280,6 @@ self.assertRaises(IndexError, a.pop) self.assertRaises(TypeError, a.pop, 42, 42) a = self.type2test([0, 10, 20, 30, 40]) - self.assertEqual(a.pop(Decimal(2)), 20) - self.assertRaises(IndexError, a.pop, Decimal(25)) def test_remove(self): a = self.type2test([0, 0, 1]) Modified: python/branches/pep302_phase2/Lib/test/test_builtin.py ============================================================================== --- python/branches/pep302_phase2/Lib/test/test_builtin.py (original) +++ python/branches/pep302_phase2/Lib/test/test_builtin.py Fri Oct 6 00:51:44 2006 @@ -116,6 +116,7 @@ self.assertEqual(abs(0), 0) self.assertEqual(abs(1234), 1234) self.assertEqual(abs(-1234), 1234) + self.assertTrue(abs(-sys.maxint-1) > 0) # float self.assertEqual(abs(0.0), 0.0) self.assertEqual(abs(3.14), 3.14) @@ -155,6 +156,11 @@ S = [10, 20, 30] self.assertEqual(any(x > 42 for x in S), False) + def test_neg(self): + x = -sys.maxint-1 + self.assert_(isinstance(x, int)) + self.assertEqual(-x, sys.maxint+1) + def test_apply(self): def f0(*args): self.assertEqual(args, ()) @@ -701,9 +707,11 @@ pass s = repr(-1-sys.maxint) - self.assertEqual(int(s)+1, -sys.maxint) + x = int(s) + self.assertEqual(x+1, -sys.maxint) + self.assert_(isinstance(x, int)) # should return long - int(s[1:]) + self.assertEqual(int(s[1:]), sys.maxint+1) # should return long x = int(1e100) Modified: python/branches/pep302_phase2/Lib/test/test_imp.py ============================================================================== --- python/branches/pep302_phase2/Lib/test/test_imp.py (original) +++ python/branches/pep302_phase2/Lib/test/test_imp.py Fri Oct 6 00:51:44 2006 @@ -1,43 +1,47 @@ import imp -from test.test_support import TestFailed, TestSkipped -try: - import thread -except ImportError: - raise TestSkipped("test only valid when thread support is available") - -def verify_lock_state(expected): - if imp.lock_held() != expected: - raise TestFailed("expected imp.lock_held() to be %r" % expected) - -def testLock(): - LOOPS = 50 - - # The import lock may already be held, e.g. if the test suite is run - # via "import test.autotest". - lock_held_at_start = imp.lock_held() - verify_lock_state(lock_held_at_start) - - for i in range(LOOPS): - imp.acquire_lock() - verify_lock_state(True) +import thread +import unittest +from test import test_support - for i in range(LOOPS): - imp.release_lock() - # The original state should be restored now. - verify_lock_state(lock_held_at_start) +class LockTests(unittest.TestCase): - if not lock_held_at_start: - try: + """Very basic test of import lock functions.""" + + def verify_lock_state(self, expected): + self.failUnlessEqual(imp.lock_held(), expected, + "expected imp.lock_held() to be %r" % expected) + def testLock(self): + LOOPS = 50 + + # The import lock may already be held, e.g. if the test suite is run + # via "import test.autotest". + lock_held_at_start = imp.lock_held() + self.verify_lock_state(lock_held_at_start) + + for i in range(LOOPS): + imp.acquire_lock() + self.verify_lock_state(True) + + for i in range(LOOPS): imp.release_lock() - except RuntimeError: - pass - else: - raise TestFailed("release_lock() without lock should raise " - "RuntimeError") + + # The original state should be restored now. + self.verify_lock_state(lock_held_at_start) + + if not lock_held_at_start: + try: + imp.release_lock() + except RuntimeError: + pass + else: + self.fail("release_lock() without lock should raise " + "RuntimeError") def test_main(): - testLock() + test_support.run_unittest( + LockTests, + ) if __name__ == "__main__": test_main() Modified: python/branches/pep302_phase2/Lib/test/test_long.py ============================================================================== --- python/branches/pep302_phase2/Lib/test/test_long.py (original) +++ python/branches/pep302_phase2/Lib/test/test_long.py Fri Oct 6 00:51:44 2006 @@ -247,17 +247,23 @@ "long(-sys.maxint-1) != -sys.maxint-1") # long -> int should not fail for hugepos_aslong or hugeneg_aslong + x = int(hugepos_aslong) try: - self.assertEqual(int(hugepos_aslong), hugepos, + self.assertEqual(x, hugepos, "converting sys.maxint to long and back to int fails") except OverflowError: self.fail("int(long(sys.maxint)) overflowed!") + if not isinstance(x, int): + raise TestFailed("int(long(sys.maxint)) should have returned int") + x = int(hugeneg_aslong) try: - self.assertEqual(int(hugeneg_aslong), hugeneg, + self.assertEqual(x, hugeneg, "converting -sys.maxint-1 to long and back to int fails") except OverflowError: self.fail("int(long(-sys.maxint-1)) overflowed!") - + if not isinstance(x, int): + raise TestFailed("int(long(-sys.maxint-1)) should have " + "returned int") # but long -> int should overflow for hugepos+1 and hugeneg-1 x = hugepos_aslong + 1 try: @@ -282,6 +288,17 @@ self.assert_(type(y) is long, "overflowing int conversion must return long not long subtype") + # long -> Py_ssize_t conversion + class X(object): + def __getslice__(self, i, j): + return i, j + + self.assertEqual(X()[-5L:7L], (-5, 7)) + # use the clamping effect to test the smallest and largest longs + # that fit a Py_ssize_t + slicemin, slicemax = X()[-2L**100:2L**100] + self.assertEqual(X()[slicemin:slicemax], (slicemin, slicemax)) + # ----------------------------------- tests of auto int->long conversion def test_auto_overflow(self): Modified: python/branches/pep302_phase2/Lib/test/test_syntax.py ============================================================================== --- python/branches/pep302_phase2/Lib/test/test_syntax.py (original) +++ python/branches/pep302_phase2/Lib/test/test_syntax.py Fri Oct 6 00:51:44 2006 @@ -322,6 +322,20 @@ ... SyntaxError: 'continue' not supported inside 'finally' clause (, line 8) +There is one test for a break that is not in a loop. The compiler +uses a single data structure to keep track of try-finally and loops, +so we need to be sure that a break is actually inside a loop. If it +isn't, there should be a syntax error. + + >>> try: + ... print 1 + ... break + ... print 2 + ... finally: + ... print 3 + Traceback (most recent call last): + ... + SyntaxError: 'break' outside loop (, line 3) """ import re Modified: python/branches/pep302_phase2/Misc/NEWS ============================================================================== --- python/branches/pep302_phase2/Misc/NEWS (original) +++ python/branches/pep302_phase2/Misc/NEWS Fri Oct 6 00:51:44 2006 @@ -12,6 +12,15 @@ Core and builtins ----------------- +- list.pop(x) accepts any object x following the __index__ protocol. + +- Fix some leftovers from the conversion from int to Py_ssize_t + (relevant to strings and sequences of more than 2**31 items). + +- A number of places, including integer negation and absolute value, + were fixed to not rely on undefined behaviour of the C compiler + anymore. + - Bug #1566800: make sure that EnvironmentError can be called with any number of arguments, as was the case in Python 2.4. @@ -63,6 +72,8 @@ Library ------- +- Support for MSVC 8 was added to bdist_wininst. + - Bug #1446043: correctly raise a LookupError if an encoding name given to encodings.search_function() contains a dot. @@ -139,6 +150,8 @@ Tests ----- +- Converted test_imp to use unittest. + - Fix bsddb test_basics.test06_Transactions to check the version number properly. Modified: python/branches/pep302_phase2/Modules/_sre.c ============================================================================== --- python/branches/pep302_phase2/Modules/_sre.c (original) +++ python/branches/pep302_phase2/Modules/_sre.c Fri Oct 6 00:51:44 2006 @@ -1166,9 +1166,10 @@ /* install new repeat context */ ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep)); - /* XXX(nnorwitz): anything else we need to do on error? */ - if (!ctx->u.rep) + if (!ctx->u.rep) { + PyErr_NoMemory(); RETURN_FAILURE; + } ctx->u.rep->count = -1; ctx->u.rep->pattern = ctx->pattern; ctx->u.rep->prev = state->repeat; @@ -1884,6 +1885,8 @@ } TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr)); + if (PyErr_Occurred()) + return NULL; state_fini(&state); @@ -1922,6 +1925,9 @@ state_fini(&state); + if (PyErr_Occurred()) + return NULL; + return pattern_new_match(self, &state, status); } @@ -2071,6 +2077,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -2198,6 +2207,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -2347,6 +2359,9 @@ #endif } + if (PyErr_Occurred()) + goto error; + if (status <= 0) { if (status == 0) break; @@ -3250,6 +3265,8 @@ status = sre_umatch(state, PatternObject_GetCode(self->pattern)); #endif } + if (PyErr_Occurred()) + return NULL; match = pattern_new_match((PatternObject*) self->pattern, state, status); @@ -3281,6 +3298,8 @@ status = sre_usearch(state, PatternObject_GetCode(self->pattern)); #endif } + if (PyErr_Occurred()) + return NULL; match = pattern_new_match((PatternObject*) self->pattern, state, status); Modified: python/branches/pep302_phase2/Modules/cPickle.c ============================================================================== --- python/branches/pep302_phase2/Modules/cPickle.c (original) +++ python/branches/pep302_phase2/Modules/cPickle.c Fri Oct 6 00:51:44 2006 @@ -1024,7 +1024,7 @@ static int save_long(Picklerobject *self, PyObject *args) { - int size; + Py_ssize_t size; int res = -1; PyObject *repr = NULL; @@ -1066,7 +1066,7 @@ * byte at the start, and cut it back later if possible. */ nbytes = (nbits >> 3) + 1; - if ((int)nbytes < 0 || (size_t)(int)nbytes != nbytes) { + if (nbytes > INT_MAX) { PyErr_SetString(PyExc_OverflowError, "long too large " "to pickle"); goto finally; @@ -1208,12 +1208,14 @@ c_str[1] = size; len = 2; } - else { + else if (size <= INT_MAX) { c_str[0] = BINSTRING; for (i = 1; i < 5; i++) c_str[i] = (int)(size >> ((i - 1) * 8)); len = 5; } + else + return -1; /* string too large */ if (self->write_func(self, c_str, len) < 0) return -1; @@ -1286,7 +1288,7 @@ static int save_unicode(Picklerobject *self, PyObject *args, int doput) { - int size, len; + Py_ssize_t size, len; PyObject *repr=0; if (!PyUnicode_Check(args)) @@ -1325,6 +1327,8 @@ if ((size = PyString_Size(repr)) < 0) goto err; + if (size > INT_MAX) + return -1; /* string too large */ c_str[0] = BINUNICODE; for (i = 1; i < 5; i++) Modified: python/branches/pep302_phase2/Modules/linuxaudiodev.c ============================================================================== --- python/branches/pep302_phase2/Modules/linuxaudiodev.c (original) +++ python/branches/pep302_phase2/Modules/linuxaudiodev.c Fri Oct 6 00:51:44 2006 @@ -28,7 +28,9 @@ #if defined(linux) #include +#ifndef HAVE_STDINT_H typedef unsigned long uint32_t; +#endif #elif defined(__FreeBSD__) #include Modified: python/branches/pep302_phase2/Modules/ossaudiodev.c ============================================================================== --- python/branches/pep302_phase2/Modules/ossaudiodev.c (original) +++ python/branches/pep302_phase2/Modules/ossaudiodev.c Fri Oct 6 00:51:44 2006 @@ -34,7 +34,9 @@ #if defined(linux) +#ifndef HAVE_STDINT_H typedef unsigned long uint32_t; +#endif #elif defined(__FreeBSD__) Modified: python/branches/pep302_phase2/Objects/abstract.c ============================================================================== --- python/branches/pep302_phase2/Objects/abstract.c (original) +++ python/branches/pep302_phase2/Objects/abstract.c Fri Oct 6 00:51:44 2006 @@ -1652,20 +1652,18 @@ if (cmp > 0) { switch (operation) { case PY_ITERSEARCH_COUNT: - ++n; - if (n <= 0) { - /* XXX(nnorwitz): int means ssize_t */ + if (n == PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, - "count exceeds C int size"); + "count exceeds C integer size"); goto Fail; } + ++n; break; case PY_ITERSEARCH_INDEX: if (wrapped) { - /* XXX(nnorwitz): int means ssize_t */ PyErr_SetString(PyExc_OverflowError, - "index exceeds C int size"); + "index exceeds C integer size"); goto Fail; } goto Done; @@ -1680,9 +1678,9 @@ } if (operation == PY_ITERSEARCH_INDEX) { - ++n; - if (n <= 0) + if (n == PY_SSIZE_T_MAX) wrapped = 1; + ++n; } } Modified: python/branches/pep302_phase2/Objects/fileobject.c ============================================================================== --- python/branches/pep302_phase2/Objects/fileobject.c (original) +++ python/branches/pep302_phase2/Objects/fileobject.c Fri Oct 6 00:51:44 2006 @@ -1001,6 +1001,7 @@ size_t nfree; /* # of free buffer slots; pvend-pvfree */ size_t total_v_size; /* total # of slots in buffer */ size_t increment; /* amount to increment the buffer */ + size_t prev_v_size; /* Optimize for normal case: avoid _PyString_Resize if at all * possible via first reading into stack buffer "buf". @@ -1115,8 +1116,11 @@ /* expand buffer and try again */ assert(*(pvend-1) == '\0'); increment = total_v_size >> 2; /* mild exponential growth */ + prev_v_size = total_v_size; total_v_size += increment; - if (total_v_size > PY_SSIZE_T_MAX) { + /* check for overflow */ + if (total_v_size <= prev_v_size || + total_v_size > PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, "line is longer than a Python string can hold"); Py_DECREF(v); @@ -1125,7 +1129,7 @@ if (_PyString_Resize(&v, (int)total_v_size) < 0) return NULL; /* overwrite the trailing null byte */ - pvfree = BUF(v) + (total_v_size - increment - 1); + pvfree = BUF(v) + (prev_v_size - 1); } if (BUF(v) + total_v_size != p) _PyString_Resize(&v, p - BUF(v)); Modified: python/branches/pep302_phase2/Objects/intobject.c ============================================================================== --- python/branches/pep302_phase2/Objects/intobject.c (original) +++ python/branches/pep302_phase2/Objects/intobject.c Fri Oct 6 00:51:44 2006 @@ -546,6 +546,17 @@ } } +/* Integer overflow checking for unary negation: on a 2's-complement + * box, -x overflows iff x is the most negative long. In this case we + * get -x == x. However, -x is undefined (by C) if x /is/ the most + * negative long (it's a signed overflow case), and some compilers care. + * So we cast x to unsigned long first. However, then other compilers + * warn about applying unary minus to an unsigned operand. Hence the + * weird "0-". + */ +#define UNARY_NEG_WOULD_OVERFLOW(x) \ + ((x) < 0 && (unsigned long)(x) == 0-(unsigned long)(x)) + /* Return type of i_divmod */ enum divmod_result { DIVMOD_OK, /* Correct result */ @@ -565,7 +576,7 @@ return DIVMOD_ERROR; } /* (-sys.maxint-1)/-1 is the only overflow case. */ - if (y == -1 && x == LONG_MIN) + if (y == -1 && UNARY_NEG_WOULD_OVERFLOW(x)) return DIVMOD_OVERFLOW; xdivy = x / y; xmody = x - xdivy * y; @@ -754,10 +765,10 @@ static PyObject * int_neg(PyIntObject *v) { - register long a, x; + register long a; a = v->ob_ival; - x = -a; - if (a < 0 && x < 0) { + /* check for overflow */ + if (UNARY_NEG_WOULD_OVERFLOW(a)) { PyObject *o = PyLong_FromLong(a); if (o != NULL) { PyObject *result = PyNumber_Negative(o); @@ -766,7 +777,7 @@ } return NULL; } - return PyInt_FromLong(x); + return PyInt_FromLong(-a); } static PyObject * Modified: python/branches/pep302_phase2/Objects/listobject.c ============================================================================== --- python/branches/pep302_phase2/Objects/listobject.c (original) +++ python/branches/pep302_phase2/Objects/listobject.c Fri Oct 6 00:51:44 2006 @@ -863,17 +863,12 @@ listpop(PyListObject *self, PyObject *args) { Py_ssize_t i = -1; - PyObject *v, *arg = NULL; + PyObject *v; int status; - if (!PyArg_UnpackTuple(args, "pop", 0, 1, &arg)) + if (!PyArg_ParseTuple(args, "|n:pop", &i)) return NULL; - if (arg != NULL) { - if (PyInt_Check(arg)) - i = PyInt_AS_LONG((PyIntObject*) arg); - else if (!PyArg_ParseTuple(args, "|n:pop", &i)) - return NULL; - } + if (self->ob_size == 0) { /* Special-case most common failure cause */ PyErr_SetString(PyExc_IndexError, "pop from empty list"); Modified: python/branches/pep302_phase2/Objects/longobject.c ============================================================================== --- python/branches/pep302_phase2/Objects/longobject.c (original) +++ python/branches/pep302_phase2/Objects/longobject.c Fri Oct 6 00:51:44 2006 @@ -193,6 +193,18 @@ return (PyObject *)v; } +/* Checking for overflow in PyLong_AsLong is a PITA since C doesn't define + * anything about what happens when a signed integer operation overflows, + * and some compilers think they're doing you a favor by being "clever" + * then. The bit pattern for the largest postive signed long is + * (unsigned long)LONG_MAX, and for the smallest negative signed long + * it is abs(LONG_MIN), which we could write -(unsigned long)LONG_MIN. + * However, some other compilers warn about applying unary minus to an + * unsigned operand. Hence the weird "0-". + */ +#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) +#define PY_ABS_SSIZE_T_MIN (0-(size_t)PY_SSIZE_T_MIN) + /* Get a C long int from a long int object. Returns -1 and sets an error condition if overflow occurs. */ @@ -225,14 +237,16 @@ if ((x >> SHIFT) != prev) goto overflow; } - /* Haven't lost any bits, but if the sign bit is set we're in - * trouble *unless* this is the min negative number. So, - * trouble iff sign bit set && (positive || some bit set other - * than the sign bit). - */ - if ((long)x < 0 && (sign > 0 || (x << 1) != 0)) - goto overflow; - return (long)x * sign; + /* Haven't lost any bits, but casting to long requires extra care + * (see comment above). + */ + if (x <= (unsigned long)LONG_MAX) { + return (long)x * sign; + } + else if (sign < 0 && x == PY_ABS_LONG_MIN) { + return LONG_MIN; + } + /* else overflow */ overflow: PyErr_SetString(PyExc_OverflowError, @@ -268,14 +282,16 @@ if ((x >> SHIFT) != prev) goto overflow; } - /* Haven't lost any bits, but if the sign bit is set we're in - * trouble *unless* this is the min negative number. So, - * trouble iff sign bit set && (positive || some bit set other - * than the sign bit). + /* Haven't lost any bits, but casting to a signed type requires + * extra care (see comment above). */ - if ((Py_ssize_t)x < 0 && (sign > 0 || (x << 1) != 0)) - goto overflow; - return (Py_ssize_t)x * sign; + if (x <= (size_t)PY_SSIZE_T_MAX) { + return (Py_ssize_t)x * sign; + } + else if (sign < 0 && x == PY_ABS_SSIZE_T_MIN) { + return PY_SSIZE_T_MIN; + } + /* else overflow */ overflow: PyErr_SetString(PyExc_OverflowError, @@ -1167,7 +1183,7 @@ { register PyLongObject *a = (PyLongObject *)aa; PyStringObject *str; - Py_ssize_t i; + Py_ssize_t i, j, sz; Py_ssize_t size_a; char *p; int bits; @@ -1187,11 +1203,18 @@ ++bits; i >>= 1; } - i = 5 + (addL ? 1 : 0) + (size_a*SHIFT + bits-1) / bits; - str = (PyStringObject *) PyString_FromStringAndSize((char *)0, i); + i = 5 + (addL ? 1 : 0); + j = size_a*SHIFT + bits-1; + sz = i + j / bits; + if (j / SHIFT < size_a || sz < i) { + PyErr_SetString(PyExc_OverflowError, + "long is too large to format"); + return NULL; + } + str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz); if (str == NULL) return NULL; - p = PyString_AS_STRING(str) + i; + p = PyString_AS_STRING(str) + sz; *p = '\0'; if (addL) *--p = 'L'; @@ -1305,7 +1328,7 @@ } while ((*q++ = *p++) != '\0'); q--; _PyString_Resize((PyObject **)&str, - (int) (q - PyString_AS_STRING(str))); + (Py_ssize_t) (q - PyString_AS_STRING(str))); } return (PyObject *)str; } @@ -1363,14 +1386,14 @@ while (_PyLong_DigitValue[Py_CHARMASK(*p)] < base) ++p; *str = p; - n = (p - start) * bits_per_char; - if (n / bits_per_char != p - start) { + /* n <- # of Python digits needed, = ceiling(n/SHIFT). */ + n = (p - start) * bits_per_char + SHIFT - 1; + if (n / bits_per_char < p - start) { PyErr_SetString(PyExc_ValueError, "long string too large to convert"); return NULL; } - /* n <- # of Python digits needed, = ceiling(n/SHIFT). */ - n = (n + SHIFT - 1) / SHIFT; + n = n / SHIFT; z = _PyLong_New(n); if (z == NULL) return NULL; Modified: python/branches/pep302_phase2/Objects/stringobject.c ============================================================================== --- python/branches/pep302_phase2/Objects/stringobject.c (original) +++ python/branches/pep302_phase2/Objects/stringobject.c Fri Oct 6 00:51:44 2006 @@ -804,10 +804,22 @@ return ret; } if (flags & Py_PRINT_RAW) { + char *data = op->ob_sval; + Py_ssize_t size = op->ob_size; + while (size > INT_MAX) { + /* Very long strings cannot be written atomically. + * But don't write exactly INT_MAX bytes at a time + * to avoid memory aligment issues. + */ + const int chunk_size = INT_MAX & ~0x3FFF; + fwrite(data, 1, chunk_size, fp); + data += chunk_size; + size -= chunk_size; + } #ifdef __VMS - if (op->ob_size) fwrite(op->ob_sval, (int) op->ob_size, 1, fp); + if (size) fwrite(data, (int)size, 1, fp); #else - fwrite(op->ob_sval, 1, (int) op->ob_size, fp); + fwrite(data, 1, (int)size, fp); #endif return 0; } @@ -844,7 +856,7 @@ register PyStringObject* op = (PyStringObject*) obj; size_t newsize = 2 + 4 * op->ob_size; PyObject *v; - if (newsize > PY_SSIZE_T_MAX) { + if (newsize > PY_SSIZE_T_MAX || newsize / 4 != op->ob_size) { PyErr_SetString(PyExc_OverflowError, "string is too large to make repr"); } @@ -4237,7 +4249,7 @@ return NULL; } llen = PyString_Size(result); - if (llen > PY_SSIZE_T_MAX) { + if (llen > INT_MAX) { PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong"); return NULL; } @@ -4726,9 +4738,10 @@ default: PyErr_Format(PyExc_ValueError, "unsupported format character '%c' (0x%x) " - "at index %i", + "at index %zd", c, c, - (int)(fmt - 1 - PyString_AsString(format))); + (Py_ssize_t)(fmt - 1 - + PyString_AsString(format))); goto error; } if (sign) { Modified: python/branches/pep302_phase2/Objects/typeobject.c ============================================================================== --- python/branches/pep302_phase2/Objects/typeobject.c (original) +++ python/branches/pep302_phase2/Objects/typeobject.c Fri Oct 6 00:51:44 2006 @@ -98,7 +98,7 @@ s = strrchr(type->tp_name, '.'); if (s != NULL) return PyString_FromStringAndSize( - type->tp_name, (int)(s - type->tp_name)); + type->tp_name, (Py_ssize_t)(s - type->tp_name)); return PyString_FromString("__builtin__"); } } @@ -4116,19 +4116,10 @@ return -1; len = PyInt_AsSsize_t(res); Py_DECREF(res); - if (len == -1 && PyErr_Occurred()) - return -1; -#if SIZEOF_SIZE_T < SIZEOF_INT - /* Overflow check -- range of PyInt is more than C ssize_t */ - if (len != (int)len) { - PyErr_SetString(PyExc_OverflowError, - "__len__() should return 0 <= outcome < 2**31"); - return -1; - } -#endif if (len < 0) { - PyErr_SetString(PyExc_ValueError, - "__len__() should return >= 0"); + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_ValueError, + "__len__() should return >= 0"); return -1; } return len; Modified: python/branches/pep302_phase2/Objects/unicodeobject.c ============================================================================== --- python/branches/pep302_phase2/Objects/unicodeobject.c (original) +++ python/branches/pep302_phase2/Objects/unicodeobject.c Fri Oct 6 00:51:44 2006 @@ -2384,6 +2384,7 @@ Py_UNICODE unimax = PyUnicode_GetMax(); #endif + /* XXX overflow detection missing */ v = _PyUnicode_New((size+Py_UNICODE_SIZE-1)/ Py_UNICODE_SIZE); if (v == NULL) goto onError; @@ -3170,6 +3171,7 @@ Py_ssize_t needed = (targetsize - extrachars) + \ (targetsize << 2); extrachars += needed; + /* XXX overflow detection missing */ if (_PyUnicode_Resize(&v, PyUnicode_GET_SIZE(v) + needed) < 0) { Py_DECREF(x); @@ -7762,10 +7764,11 @@ default: PyErr_Format(PyExc_ValueError, "unsupported format character '%c' (0x%x) " - "at index %i", + "at index %zd", (31<=c && c<=126) ? (char)c : '?', (int)c, - (int)(fmt -1 - PyUnicode_AS_UNICODE(uformat))); + (Py_ssize_t)(fmt - 1 - + PyUnicode_AS_UNICODE(uformat))); goto onError; } if (sign) { Modified: python/branches/pep302_phase2/Python/compile.c ============================================================================== --- python/branches/pep302_phase2/Python/compile.c (original) +++ python/branches/pep302_phase2/Python/compile.c Fri Oct 6 00:51:44 2006 @@ -187,6 +187,8 @@ basicblock *); static void compiler_pop_fblock(struct compiler *, enum fblocktype, basicblock *); +/* Returns true if there is a loop on the fblock stack. */ +static int compiler_in_loop(struct compiler *); static int inplace_binop(struct compiler *, operator_ty); static int expr_constant(expr_ty e); @@ -2157,7 +2159,7 @@ case Pass_kind: break; case Break_kind: - if (!c->u->u_nfblocks) + if (!compiler_in_loop(c)) return compiler_error(c, "'break' outside loop"); ADDOP(c, BREAK_LOOP); break; @@ -3147,6 +3149,16 @@ assert(u->u_fblock[u->u_nfblocks].fb_block == b); } +static int +compiler_in_loop(struct compiler *c) { + int i; + struct compiler_unit *u = c->u; + for (i = 0; i < u->u_nfblocks; ++i) { + if (u->u_fblock[i].fb_type == LOOP) + return 1; + } + return 0; +} /* Raises a SyntaxError and returns 0. If something goes wrong, a different exception may be raised. */ Modified: python/branches/pep302_phase2/Python/errors.c ============================================================================== --- python/branches/pep302_phase2/Python/errors.c (original) +++ python/branches/pep302_phase2/Python/errors.c Fri Oct 6 00:51:44 2006 @@ -551,7 +551,8 @@ goto failure; } if (PyDict_GetItemString(dict, "__module__") == NULL) { - modulename = PyString_FromStringAndSize(name, (int)(dot-name)); + modulename = PyString_FromStringAndSize(name, + (Py_ssize_t)(dot-name)); if (modulename == NULL) goto failure; if (PyDict_SetItemString(dict, "__module__", modulename) != 0) Modified: python/branches/pep302_phase2/Python/getargs.c ============================================================================== --- python/branches/pep302_phase2/Python/getargs.c (original) +++ python/branches/pep302_phase2/Python/getargs.c Fri Oct 6 00:51:44 2006 @@ -815,7 +815,7 @@ #endif else return converterr("string", arg, msgbuf, bufsize); - if ((int)strlen(*p) != PyString_Size(arg)) + if ((Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr("string without null bytes", arg, msgbuf, bufsize); } @@ -882,7 +882,7 @@ format++; } else if (*p != NULL && - (int)strlen(*p) != PyString_Size(arg)) + (Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr( "string without null bytes or None", arg, msgbuf, bufsize); @@ -1029,7 +1029,8 @@ PyMem_Free()ing it after usage */ - if ((int)strlen(PyString_AS_STRING(s)) != size) { + if ((Py_ssize_t)strlen(PyString_AS_STRING(s)) + != size) { Py_DECREF(s); return converterr( "(encoded string without NULL bytes)", Modified: python/branches/pep302_phase2/Python/import.c ============================================================================== --- python/branches/pep302_phase2/Python/import.c (original) +++ python/branches/pep302_phase2/Python/import.c Fri Oct 6 00:51:44 2006 @@ -1801,7 +1801,7 @@ /* Initialize a built-in module. - Return 1 for succes, 0 if the module is not found, and -1 with + Return 1 for success, 0 if the module is not found, and -1 with an exception set if the initialization failed. */ static int Modified: python/branches/pep302_phase2/Python/marshal.c ============================================================================== --- python/branches/pep302_phase2/Python/marshal.c (original) +++ python/branches/pep302_phase2/Python/marshal.c Fri Oct 6 00:51:44 2006 @@ -546,6 +546,11 @@ int size; PyLongObject *ob; n = r_long(p); + if (n < -INT_MAX || n > INT_MAX) { + PyErr_SetString(PyExc_ValueError, + "bad marshal data"); + return NULL; + } size = n<0 ? -n : n; ob = _PyLong_New(size); if (ob == NULL) @@ -654,7 +659,7 @@ case TYPE_INTERNED: case TYPE_STRING: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -689,7 +694,7 @@ char *buffer; n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -710,7 +715,7 @@ case TYPE_TUPLE: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -733,7 +738,7 @@ case TYPE_LIST: n = r_long(p); - if (n < 0) { + if (n < 0 || n > INT_MAX) { PyErr_SetString(PyExc_ValueError, "bad marshal data"); return NULL; } @@ -831,10 +836,11 @@ v = NULL; - argcount = r_long(p); - nlocals = r_long(p); - stacksize = r_long(p); - flags = r_long(p); + /* XXX ignore long->int overflows for now */ + argcount = (int)r_long(p); + nlocals = (int)r_long(p); + stacksize = (int)r_long(p); + flags = (int)r_long(p); code = r_object(p); if (code == NULL) goto code_error; @@ -859,7 +865,7 @@ name = r_object(p); if (name == NULL) goto code_error; - firstlineno = r_long(p); + firstlineno = (int)r_long(p); lnotab = r_object(p); if (lnotab == NULL) goto code_error; @@ -1031,10 +1037,16 @@ wf.strings = (version > 0) ? PyDict_New() : NULL; w_object(x, &wf); Py_XDECREF(wf.strings); - if (wf.str != NULL) - _PyString_Resize(&wf.str, - (int) (wf.ptr - - PyString_AS_STRING((PyStringObject *)wf.str))); + if (wf.str != NULL) { + char *base = PyString_AS_STRING((PyStringObject *)wf.str); + if (wf.ptr - base > PY_SSIZE_T_MAX) { + Py_DECREF(wf.str); + PyErr_SetString(PyExc_OverflowError, + "too much marshall data for a string"); + return NULL; + } + _PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); + } if (wf.error) { Py_XDECREF(wf.str); PyErr_SetString(PyExc_ValueError, Modified: python/branches/pep302_phase2/Python/modsupport.c ============================================================================== --- python/branches/pep302_phase2/Python/modsupport.c (original) +++ python/branches/pep302_phase2/Python/modsupport.c Fri Oct 6 00:51:44 2006 @@ -421,7 +421,7 @@ "string too long for Python string"); return NULL; } - n = (int)m; + n = (Py_ssize_t)m; } v = PyString_FromStringAndSize(str, n); } Modified: python/branches/pep302_phase2/Python/mystrtoul.c ============================================================================== --- python/branches/pep302_phase2/Python/mystrtoul.c (original) +++ python/branches/pep302_phase2/Python/mystrtoul.c Fri Oct 6 00:51:44 2006 @@ -195,13 +195,10 @@ return (unsigned long)-1; } -/* Checking for overflow in PyOS_strtol is a PITA since C doesn't define - * anything about what happens when a signed integer operation overflows, - * and some compilers think they're doing you a favor by being "clever" - * then. Python assumes a 2's-complement representation, so that the bit - * pattern for the largest postive signed long is LONG_MAX, and for - * the smallest negative signed long is LONG_MAX + 1. +/* Checking for overflow in PyOS_strtol is a PITA; see comments + * about PY_ABS_LONG_MIN in longobject.c. */ +#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) long PyOS_strtol(char *str, char **ptr, int base) @@ -224,8 +221,7 @@ if (sign == '-') result = -result; } - else if (sign == '-' && uresult == (unsigned long)LONG_MAX + 1) { - assert(LONG_MIN == -LONG_MAX-1); + else if (sign == '-' && uresult == PY_ABS_LONG_MIN) { result = LONG_MIN; } else { Modified: python/branches/pep302_phase2/Python/sysmodule.c ============================================================================== --- python/branches/pep302_phase2/Python/sysmodule.c (original) +++ python/branches/pep302_phase2/Python/sysmodule.c Fri Oct 6 00:51:44 2006 @@ -1225,7 +1225,7 @@ p = strchr(path, delim); if (p == NULL) p = strchr(path, '\0'); /* End of string */ - w = PyString_FromStringAndSize(path, (int) (p - path)); + w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path)); if (w == NULL) { Py_DECREF(v); return NULL; Modified: python/branches/pep302_phase2/Tools/msi/uuids.py ============================================================================== --- python/branches/pep302_phase2/Tools/msi/uuids.py (original) +++ python/branches/pep302_phase2/Tools/msi/uuids.py Fri Oct 6 00:51:44 2006 @@ -22,6 +22,8 @@ '2.4.2150':'{b191e49c-ea23-43b2-b28a-14e0784069b8}', # 2.4.2 '2.4.3121':'{f669ed4d-1dce-41c4-9617-d985397187a1}', # 2.4.3c1 '2.4.3150':'{75e71add-042c-4f30-bfac-a9ec42351313}', # 2.4.3 + '2.4.4121':'{cd2862db-22a4-4688-8772-85407ea21550}', # 2.4.4c1 + '2.4.4150':'{60e2c8c9-6cf3-4b1a-9618-e304946c94e6}', # 2.4.4 '2.5.101': '{bc14ce3e-5e72-4a64-ac1f-bf59a571898c}', # 2.5a1 '2.5.102': '{5eed51c1-8e9d-4071-94c5-b40de5d49ba5}', # 2.5a2 '2.5.103': '{73dcd966-ffec-415f-bb39-8342c1f47017}', # 2.5a3 From python-checkins at python.org Fri Oct 6 02:02:59 2006 From: python-checkins at python.org (fred.drake) Date: Fri, 6 Oct 2006 02:02:59 +0200 (CEST) Subject: [Python-checkins] r52198 - python/branches/release24-maint/Doc/lib/libbsddb.tex Message-ID: <20061006000259.9A3601E4006@bag.python.org> Author: fred.drake Date: Fri Oct 6 02:02:58 2006 New Revision: 52198 Modified: python/branches/release24-maint/Doc/lib/libbsddb.tex Log: - update links - remove Sleepycat name now that they have been bought Modified: python/branches/release24-maint/Doc/lib/libbsddb.tex ============================================================================== --- python/branches/release24-maint/Doc/lib/libbsddb.tex (original) +++ python/branches/release24-maint/Doc/lib/libbsddb.tex Fri Oct 6 02:02:58 2006 @@ -19,11 +19,13 @@ through 4.3 at the time of this writing). \begin{seealso} - \seeurl{http://pybsddb.sourceforge.net/}{Website with documentation - for the new python Berkeley DB interface that closely mirrors the - sleepycat object oriented interface provided in Berkeley DB 3 and 4.} - \seeurl{http://www.sleepycat.com/}{Sleepycat Software produces the - modern Berkeley DB library.} + \seeurl{http://pybsddb.sourceforge.net/} + {Website with documentation for the new python Berkeley DB + interface that closely mirrors the object oriented interface + provided in Berkeley DB 3 and 4.} + + \seeurl{http://www.oracle.com/database/berkeley-db/} + {The Berkeley DB library.} \end{seealso} The following is a description of the legacy \module{bsddb} interface From python-checkins at python.org Fri Oct 6 02:03:17 2006 From: python-checkins at python.org (fred.drake) Date: Fri, 6 Oct 2006 02:03:17 +0200 (CEST) Subject: [Python-checkins] r52199 - python/branches/release25-maint/Doc/lib/libbsddb.tex Message-ID: <20061006000317.7D2D11E4006@bag.python.org> Author: fred.drake Date: Fri Oct 6 02:03:17 2006 New Revision: 52199 Modified: python/branches/release25-maint/Doc/lib/libbsddb.tex Log: - update links - remove Sleepycat name now that they have been bought Modified: python/branches/release25-maint/Doc/lib/libbsddb.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libbsddb.tex (original) +++ python/branches/release25-maint/Doc/lib/libbsddb.tex Fri Oct 6 02:03:17 2006 @@ -19,15 +19,17 @@ 3.3 thru 4.4. \begin{seealso} - \seeurl{http://pybsddb.sourceforge.net/}{The website with documentation - for the \module{bsddb.db} python Berkeley DB interface that closely mirrors - the Sleepycat object oriented interface provided in Berkeley DB 3 and 4.} - \seeurl{http://www.sleepycat.com/}{Sleepycat Software produces the - Berkeley DB library.} + \seeurl{http://pybsddb.sourceforge.net/} + {The website with documentation for the \module{bsddb.db} + Python Berkeley DB interface that closely mirrors the object + oriented interface provided in Berkeley DB 3 and 4.} + + \seeurl{http://www.oracle.com/database/berkeley-db/} + {The Berkeley DB library.} \end{seealso} A more modern DB, DBEnv and DBSequence object interface is available in the -\module{bsddb.db} module which closely matches the Sleepycat Berkeley DB C API +\module{bsddb.db} module which closely matches the Berkeley DB C API documented at the above URLs. Additional features provided by the \module{bsddb.db} API include fine tuning, transactions, logging, and multiprocess concurrent database access. From python-checkins at python.org Fri Oct 6 02:03:45 2006 From: python-checkins at python.org (fred.drake) Date: Fri, 6 Oct 2006 02:03:45 +0200 (CEST) Subject: [Python-checkins] r52200 - python/trunk/Doc/lib/libbsddb.tex Message-ID: <20061006000345.DEE211E4006@bag.python.org> Author: fred.drake Date: Fri Oct 6 02:03:45 2006 New Revision: 52200 Modified: python/trunk/Doc/lib/libbsddb.tex Log: - update links - remove Sleepycat name now that they have been bought Modified: python/trunk/Doc/lib/libbsddb.tex ============================================================================== --- python/trunk/Doc/lib/libbsddb.tex (original) +++ python/trunk/Doc/lib/libbsddb.tex Fri Oct 6 02:03:45 2006 @@ -19,15 +19,17 @@ 3.3 thru 4.4. \begin{seealso} - \seeurl{http://pybsddb.sourceforge.net/}{The website with documentation - for the \module{bsddb.db} python Berkeley DB interface that closely mirrors - the Sleepycat object oriented interface provided in Berkeley DB 3 and 4.} - \seeurl{http://www.sleepycat.com/}{Sleepycat Software produces the - Berkeley DB library.} + \seeurl{http://pybsddb.sourceforge.net/} + {The website with documentation for the \module{bsddb.db} + Python Berkeley DB interface that closely mirrors the object + oriented interface provided in Berkeley DB 3 and 4.} + + \seeurl{http://www.oracle.com/database/berkeley-db/} + {The Berkeley DB library.} \end{seealso} A more modern DB, DBEnv and DBSequence object interface is available in the -\module{bsddb.db} module which closely matches the Sleepycat Berkeley DB C API +\module{bsddb.db} module which closely matches the Berkeley DB C API documented at the above URLs. Additional features provided by the \module{bsddb.db} API include fine tuning, transactions, logging, and multiprocess concurrent database access. From python-checkins at python.org Fri Oct 6 09:01:46 2006 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 6 Oct 2006 09:01:46 +0200 (CEST) Subject: [Python-checkins] r52201 - python/branches/release24-maint/PCbuild/_ssl.mak Message-ID: <20061006070146.773321E4012@bag.python.org> Author: martin.v.loewis Date: Fri Oct 6 09:01:45 2006 New Revision: 52201 Modified: python/branches/release24-maint/PCbuild/_ssl.mak Log: Add user32.lib to the libraries. Fixes #1571023. Modified: python/branches/release24-maint/PCbuild/_ssl.mak ============================================================================== --- python/branches/release24-maint/PCbuild/_ssl.mak (original) +++ python/branches/release24-maint/PCbuild/_ssl.mak Fri Oct 6 09:01:45 2006 @@ -12,7 +12,7 @@ !ENDIF INCLUDES=-I ../Include -I ../PC -I $(SSL_DIR)/inc32 -LIBS=gdi32.lib wsock32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib +LIBS=gdi32.lib user32.lib wsock32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib SOURCE=../Modules/_ssl.c $(SSL_LIB_DIR)/libeay32.lib $(SSL_LIB_DIR)/ssleay32.lib From python-checkins at python.org Fri Oct 6 12:38:11 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Oct 2006 12:38:11 +0200 (CEST) Subject: [Python-checkins] r52202 - python/branches/release24-maint/Doc/lib/libbsddb.tex Message-ID: <20061006103811.07D631E4013@bag.python.org> Author: andrew.kuchling Date: Fri Oct 6 12:38:10 2006 New Revision: 52202 Modified: python/branches/release24-maint/Doc/lib/libbsddb.tex Log: Case fixes Modified: python/branches/release24-maint/Doc/lib/libbsddb.tex ============================================================================== --- python/branches/release24-maint/Doc/lib/libbsddb.tex (original) +++ python/branches/release24-maint/Doc/lib/libbsddb.tex Fri Oct 6 12:38:10 2006 @@ -20,7 +20,7 @@ \begin{seealso} \seeurl{http://pybsddb.sourceforge.net/} - {Website with documentation for the new python Berkeley DB + {Website with documentation for the new Python Berkeley DB interface that closely mirrors the object oriented interface provided in Berkeley DB 3 and 4.} @@ -29,7 +29,7 @@ \end{seealso} The following is a description of the legacy \module{bsddb} interface -compatible with the old python bsddb module. For details about the more +compatible with the old Python bsddb module. For details about the more modern Db and DbEnv object oriented interface see the above mentioned pybsddb URL. From python-checkins at python.org Fri Oct 6 12:39:52 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Oct 2006 12:39:52 +0200 (CEST) Subject: [Python-checkins] r52203 - python/branches/release25-maint/Doc/lib/libbsddb.tex Message-ID: <20061006103952.352D71E4007@bag.python.org> Author: andrew.kuchling Date: Fri Oct 6 12:39:51 2006 New Revision: 52203 Modified: python/branches/release25-maint/Doc/lib/libbsddb.tex Log: Case fixes Modified: python/branches/release25-maint/Doc/lib/libbsddb.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libbsddb.tex (original) +++ python/branches/release25-maint/Doc/lib/libbsddb.tex Fri Oct 6 12:39:51 2006 @@ -35,7 +35,7 @@ multiprocess concurrent database access. The following is a description of the legacy \module{bsddb} interface -compatible with the old python bsddb module. Starting in Python 2.5 this +compatible with the old Python bsddb module. Starting in Python 2.5 this interface should be safe for multithreaded access. The \module{bsddb.db} API is recommended for threading users as it provides better control. From python-checkins at python.org Fri Oct 6 12:41:01 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Oct 2006 12:41:01 +0200 (CEST) Subject: [Python-checkins] r52204 - python/trunk/Doc/lib/libbsddb.tex Message-ID: <20061006104101.DDD701E4007@bag.python.org> Author: andrew.kuchling Date: Fri Oct 6 12:41:01 2006 New Revision: 52204 Modified: python/trunk/Doc/lib/libbsddb.tex Log: Case fix Modified: python/trunk/Doc/lib/libbsddb.tex ============================================================================== --- python/trunk/Doc/lib/libbsddb.tex (original) +++ python/trunk/Doc/lib/libbsddb.tex Fri Oct 6 12:41:01 2006 @@ -35,7 +35,7 @@ multiprocess concurrent database access. The following is a description of the legacy \module{bsddb} interface -compatible with the old python bsddb module. Starting in Python 2.5 this +compatible with the old Python bsddb module. Starting in Python 2.5 this interface should be safe for multithreaded access. The \module{bsddb.db} API is recommended for threading users as it provides better control. From python-checkins at python.org Fri Oct 6 14:43:54 2006 From: python-checkins at python.org (georg.brandl) Date: Fri, 6 Oct 2006 14:43:54 +0200 (CEST) Subject: [Python-checkins] r52207 - sandbox/trunk/path Message-ID: <20061006124354.698271E4007@bag.python.org> Author: georg.brandl Date: Fri Oct 6 14:43:54 2006 New Revision: 52207 Removed: sandbox/trunk/path/ Log: Remove path library. It won't ever be included in the stdlib in its current form. From python-checkins at python.org Fri Oct 6 14:46:08 2006 From: python-checkins at python.org (georg.brandl) Date: Fri, 6 Oct 2006 14:46:08 +0200 (CEST) Subject: [Python-checkins] r52208 - python/trunk/Tools/scripts/findnocoding.py python/trunk/Tools/scripts/pysource.py Message-ID: <20061006124608.6A4591E4007@bag.python.org> Author: georg.brandl Date: Fri Oct 6 14:46:08 2006 New Revision: 52208 Modified: python/trunk/Tools/scripts/findnocoding.py python/trunk/Tools/scripts/pysource.py Log: Fix name. Modified: python/trunk/Tools/scripts/findnocoding.py ============================================================================== --- python/trunk/Tools/scripts/findnocoding.py (original) +++ python/trunk/Tools/scripts/findnocoding.py Fri Oct 6 14:46:08 2006 @@ -5,7 +5,7 @@ Usage: nocoding.py dir1 [dir2...] """ -__author__ = "Oleg Broytmann, Reinhold Birkenfeld" +__author__ = "Oleg Broytmann, Georg Brandl" import sys, os, re, getopt Modified: python/trunk/Tools/scripts/pysource.py ============================================================================== --- python/trunk/Tools/scripts/pysource.py (original) +++ python/trunk/Tools/scripts/pysource.py Fri Oct 6 14:46:08 2006 @@ -15,7 +15,7 @@ walk_python_files() recursively lists all Python files under the given directories. """ -__author__ = "Oleg Broytmann, Reinhold Birkenfeld" +__author__ = "Oleg Broytmann, Georg Brandl" __all__ = ["has_python_ext", "looks_like_python", "can_be_compiled", "walk_python_files"] From python-checkins at python.org Fri Oct 6 14:46:33 2006 From: python-checkins at python.org (georg.brandl) Date: Fri, 6 Oct 2006 14:46:33 +0200 (CEST) Subject: [Python-checkins] r52209 - python/branches/release25-maint/Tools/scripts/findnocoding.py python/branches/release25-maint/Tools/scripts/pysource.py Message-ID: <20061006124633.F10131E4007@bag.python.org> Author: georg.brandl Date: Fri Oct 6 14:46:33 2006 New Revision: 52209 Modified: python/branches/release25-maint/Tools/scripts/findnocoding.py python/branches/release25-maint/Tools/scripts/pysource.py Log: Fix name. Modified: python/branches/release25-maint/Tools/scripts/findnocoding.py ============================================================================== --- python/branches/release25-maint/Tools/scripts/findnocoding.py (original) +++ python/branches/release25-maint/Tools/scripts/findnocoding.py Fri Oct 6 14:46:33 2006 @@ -5,7 +5,7 @@ Usage: nocoding.py dir1 [dir2...] """ -__author__ = "Oleg Broytmann, Reinhold Birkenfeld" +__author__ = "Oleg Broytmann, Georg Brandl" import sys, os, re, getopt Modified: python/branches/release25-maint/Tools/scripts/pysource.py ============================================================================== --- python/branches/release25-maint/Tools/scripts/pysource.py (original) +++ python/branches/release25-maint/Tools/scripts/pysource.py Fri Oct 6 14:46:33 2006 @@ -15,7 +15,7 @@ walk_python_files() recursively lists all Python files under the given directories. """ -__author__ = "Oleg Broytmann, Reinhold Birkenfeld" +__author__ = "Oleg Broytmann, Georg Brandl" __all__ = ["has_python_ext", "looks_like_python", "can_be_compiled", "walk_python_files"] From python-checkins at python.org Fri Oct 6 15:13:58 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Oct 2006 15:13:58 +0200 (CEST) Subject: [Python-checkins] r52210 - peps/trunk/pep-0291.txt Message-ID: <20061006131358.65D461E4007@bag.python.org> Author: andrew.kuchling Date: Fri Oct 6 15:13:57 2006 New Revision: 52210 Modified: peps/trunk/pep-0291.txt Log: Add an item Modified: peps/trunk/pep-0291.txt ============================================================================== --- peps/trunk/pep-0291.txt (original) +++ peps/trunk/pep-0291.txt Fri Oct 6 15:13:57 2006 @@ -67,6 +67,7 @@ 2.1 use of object or new-style classes, iterators, using generators, nested scopes, or // without from __future__ import ... statement, + isinstance(X, TYP) where TYP is a tuple of types, plus all features below 2.2 bool, True, False, basestring, enumerate(), From python-checkins at python.org Fri Oct 6 15:18:27 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Oct 2006 15:18:27 +0200 (CEST) Subject: [Python-checkins] r52211 - python/trunk/Lib/distutils/command/register.py Message-ID: <20061006131827.750591E4007@bag.python.org> Author: andrew.kuchling Date: Fri Oct 6 15:18:26 2006 New Revision: 52211 Modified: python/trunk/Lib/distutils/command/register.py Log: [Bug #1545341] Allow 'classifier' parameter to be a tuple as well as a list. Will backport. Modified: python/trunk/Lib/distutils/command/register.py ============================================================================== --- python/trunk/Lib/distutils/command/register.py (original) +++ python/trunk/Lib/distutils/command/register.py Fri Oct 6 15:18:26 2006 @@ -251,7 +251,7 @@ body = StringIO.StringIO() for key, value in data.items(): # handle multiple entries for the same name - if type(value) != type([]): + if type(value) not in (type([]), type( () )): value = [value] for value in value: value = unicode(value).encode("utf-8") From buildbot at python.org Fri Oct 6 15:38:21 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Oct 2006 13:38:21 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061006133821.D9A3F1E4007@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%2520trunk/builds/1202 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,brett.cannon,fred.drake,georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Fri Oct 6 16:53:10 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Oct 2006 14:53:10 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20061006145310.C5B8B1E400C@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.5/builds/52 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling,fred.drake,georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Fri Oct 6 17:00:16 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Oct 2006 15:00:16 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061006150016.DC1461E4007@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/131 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From steven.bethard at gmail.com Fri Oct 6 18:29:08 2006 From: steven.bethard at gmail.com (Steven Bethard) Date: Fri, 6 Oct 2006 10:29:08 -0600 Subject: [Python-checkins] PEP topic filter In-Reply-To: References: Message-ID: On 10/3/06, Barry Warsaw wrote: > On Oct 2, 2006, at 3:59 PM, Steven Bethard wrote: > > Would it be possible to update the PEP topic filter to something like > > "peps/trunk" instead of just "PEP"? The current setup means those of > > us just subscribed to the PEP topic filter are going to get every one > > of Brett's python/branches/pep302_phase2 checkins. > > Good idea. I've updated the regexp to "peps/trunk" as suggested > (sans quotes). Can someone make an innocent checkin to that > directory to see if that does the trick? Looks like everything is working fine. I got this message: * r52210 - peps/trunk/pep-0291.txt But not any of these: * r52122 - python/branches/pep302_phase2/BRANCH_PLANS * r52125 - python/branches/pep302_phase2/Python/import.c * r52197 - in python/branches/pep302_phase2: Doc/lib/libimp.tex ... Which looks right to me. Thanks again! Steve -- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy From python-checkins at python.org Fri Oct 6 18:33:22 2006 From: python-checkins at python.org (armin.rigo) Date: Fri, 6 Oct 2006 18:33:22 +0200 (CEST) Subject: [Python-checkins] r52212 - python/trunk/Lib/colorsys.py Message-ID: <20061006163322.C50871E400A@bag.python.org> Author: armin.rigo Date: Fri Oct 6 18:33:22 2006 New Revision: 52212 Modified: python/trunk/Lib/colorsys.py Log: A very minor bug fix: this code looks like it is designed to accept any hue value and do the modulo itself, except it doesn't quite do it in all cases. At least, the "cannot get here" comment was wrong. Modified: python/trunk/Lib/colorsys.py ============================================================================== --- python/trunk/Lib/colorsys.py (original) +++ python/trunk/Lib/colorsys.py Fri Oct 6 18:33:22 2006 @@ -117,7 +117,8 @@ p = v*(1.0 - s) q = v*(1.0 - s*f) t = v*(1.0 - s*(1.0-f)) - if i%6 == 0: return v, t, p + i = i%6 + if i == 0: return v, t, p if i == 1: return q, v, p if i == 2: return p, v, t if i == 3: return p, q, v From python-checkins at python.org Fri Oct 6 20:51:56 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Oct 2006 20:51:56 +0200 (CEST) Subject: [Python-checkins] r52213 - python/trunk/Parser/tokenizer.c Message-ID: <20061006185156.7B3E21E4008@bag.python.org> Author: andrew.kuchling Date: Fri Oct 6 20:51:55 2006 New Revision: 52213 Modified: python/trunk/Parser/tokenizer.c Log: Comment grammar Modified: python/trunk/Parser/tokenizer.c ============================================================================== --- python/trunk/Parser/tokenizer.c (original) +++ python/trunk/Parser/tokenizer.c Fri Oct 6 20:51:55 2006 @@ -897,7 +897,7 @@ tok->cur = tok->buf + cur; tok->line_start = tok->cur; /* replace "\r\n" with "\n" */ - /* For Mac leave the \r, giving syntax error */ + /* For Mac leave the \r, giving a syntax error */ pt = tok->inp - 2; if (pt >= tok->buf && *pt == '\r') { *pt++ = '\n'; From python-checkins at python.org Fri Oct 6 20:59:11 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Oct 2006 20:59:11 +0200 (CEST) Subject: [Python-checkins] r52214 - python/branches/release24-maint/Parser/tokenizer.c Message-ID: <20061006185911.4B6E11E4008@bag.python.org> Author: andrew.kuchling Date: Fri Oct 6 20:59:10 2006 New Revision: 52214 Modified: python/branches/release24-maint/Parser/tokenizer.c Log: [Backport r46602 | neal.norwitz] Patch #1357836: Prevent an invalid memory read from test_coding in case the done flag is set. In that case, the loop isn't entered. I wonder if rather than setting the done flag in the cases before the loop, if they should just exit early. This code looks like it should be refactored. Backport candidate (also the early break above if decoding_fgets fails) Modified: python/branches/release24-maint/Parser/tokenizer.c ============================================================================== --- python/branches/release24-maint/Parser/tokenizer.c (original) +++ python/branches/release24-maint/Parser/tokenizer.c Fri Oct 6 20:59:10 2006 @@ -865,6 +865,11 @@ if (decoding_fgets(tok->inp, (int)(tok->end - tok->inp), tok) == NULL) { + /* Break out early on decoding + errors, as tok->buf will be NULL + */ + if (tok->decoding_erred) + return EOF; /* Last line does not end in \n, fake one */ strcpy(tok->inp, "\n"); @@ -872,14 +877,16 @@ tok->inp = strchr(tok->inp, '\0'); done = tok->inp[-1] == '\n'; } - tok->cur = tok->buf + cur; - /* replace "\r\n" with "\n" */ - /* For Mac we leave the \r, giving a syntax error */ - pt = tok->inp - 2; - if (pt >= tok->buf && *pt == '\r') { - *pt++ = '\n'; - *pt = '\0'; - tok->inp = pt; + if (tok->buf != NULL) { + tok->cur = tok->buf + cur; + /* replace "\r\n" with "\n" */ + /* For Mac we leave the \r, giving a syntax error */ + pt = tok->inp - 2; + if (pt >= tok->buf && *pt == '\r') { + *pt++ = '\n'; + *pt = '\0'; + tok->inp = pt; + } } } if (tok->done != E_OK) { From python-checkins at python.org Fri Oct 6 21:09:36 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Oct 2006 21:09:36 +0200 (CEST) Subject: [Python-checkins] r52215 - python/branches/release24-maint/Python/ceval.c Message-ID: <20061006190936.B2EFF1E4008@bag.python.org> Author: andrew.kuchling Date: Fri Oct 6 21:09:36 2006 New Revision: 52215 Modified: python/branches/release24-maint/Python/ceval.c Log: [Backport r46044 | neal.norwitz] Fix #132 from Coverity, retval could have been derefed if a continue inside a try failed. Modified: python/branches/release24-maint/Python/ceval.c ============================================================================== --- python/branches/release24-maint/Python/ceval.c (original) +++ python/branches/release24-maint/Python/ceval.c Fri Oct 6 21:09:36 2006 @@ -2142,6 +2142,10 @@ case CONTINUE_LOOP: retval = PyInt_FromLong(oparg); + if (!retval) { + x = NULL; + break; + } why = WHY_CONTINUE; goto fast_block_end; From buildbot at python.org Fri Oct 6 21:18:52 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Oct 2006 19:18:52 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20061006191852.D9FD91E400B@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/142 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Fri Oct 6 21:26:14 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Oct 2006 21:26:14 +0200 (CEST) Subject: [Python-checkins] r52216 - python/branches/release24-maint/Objects/stringobject.c Message-ID: <20061006192614.D3F921E400A@bag.python.org> Author: andrew.kuchling Date: Fri Oct 6 21:26:14 2006 New Revision: 52216 Modified: python/branches/release24-maint/Objects/stringobject.c Log: [Backport r43695 | neal.norwitz] Remove dead code (reported by HP compiler). Can probably be backported if anyone cares. Modified: python/branches/release24-maint/Objects/stringobject.c ============================================================================== --- python/branches/release24-maint/Objects/stringobject.c (original) +++ python/branches/release24-maint/Objects/stringobject.c Fri Oct 6 21:26:14 2006 @@ -1926,17 +1926,14 @@ return res; } #endif - else { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, #ifdef Py_USING_UNICODE - "%s arg must be None, str or unicode", + "%s arg must be None, str or unicode", #else - "%s arg must be None or str", + "%s arg must be None or str", #endif - STRIPNAME(striptype)); - return NULL; - } - return do_xstrip(self, striptype, sep); + STRIPNAME(striptype)); + return NULL; } return do_strip(self, striptype); From buildbot at python.org Fri Oct 6 21:40:40 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Oct 2006 19:40:40 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian 2.5 Message-ID: <20061006194041.1ACAA1E4008@bag.python.org> The Buildbot has detected a new failure of alpha Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%25202.5/builds/52 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling,fred.drake,georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From brett at python.org Fri Oct 6 22:41:35 2006 From: brett at python.org (Brett Cannon) Date: Fri, 6 Oct 2006 13:41:35 -0700 Subject: [Python-checkins] PEP topic filter In-Reply-To: References: Message-ID: On 10/6/06, Steven Bethard wrote: > > On 10/3/06, Barry Warsaw wrote: > > On Oct 2, 2006, at 3:59 PM, Steven Bethard wrote: > > > Would it be possible to update the PEP topic filter to something like > > > "peps/trunk" instead of just "PEP"? The current setup means those of > > > us just subscribed to the PEP topic filter are going to get every one > > > of Brett's python/branches/pep302_phase2 checkins. > > > > Good idea. I've updated the regexp to "peps/trunk" as suggested > > (sans quotes). Can someone make an innocent checkin to that > > directory to see if that does the trick? > > Looks like everything is working fine. I got this message: > > * r52210 - peps/trunk/pep-0291.txt > > But not any of these: > > * r52122 - python/branches/pep302_phase2/BRANCH_PLANS > * r52125 - python/branches/pep302_phase2/Python/import.c > * r52197 - in python/branches/pep302_phase2: Doc/lib/libimp.tex ... > > Which looks right to me. Thanks again! I am just causing all sorts of trouble this week. =) -Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20061006/65291d3a/attachment.htm From buildbot at python.org Fri Oct 6 23:29:55 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Oct 2006 21:29:55 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian trunk Message-ID: <20061006212955.377901E4009@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/595 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sat Oct 7 01:36:39 2006 From: python-checkins at python.org (brett.cannon) Date: Sat, 7 Oct 2006 01:36:39 +0200 (CEST) Subject: [Python-checkins] r52217 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061006233639.548811E4008@bag.python.org> Author: brett.cannon Date: Sat Oct 7 01:36:38 2006 New Revision: 52217 Modified: sandbox/trunk/import_in_py/importer.py Log: Initial (untested) stab at a filesystem path hook, importer, and loader along with a handler for Python source modules. Doing the bytecode importer should help with working out possible kinks in the API. But it will probably require adding package support before that really comes about. Also started a list of possible improvements to the import machinery for Py3K based on experience from this re-implementation. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Sat Oct 7 01:36:38 2006 @@ -17,9 +17,24 @@ an ImportError if a call to load_module() on a loader fails to load a module. PEP 302 does not specify what to do in the failing case. +Possible Py3K improvements: + * Have __import__ check for sys.modules entry to alleviate need for every + loader to do so. + * Have __import__ pass in module to initialize for imported module so to + alleviate loader from having to pull from sys.modules. + * Put importer objects directly into sys.path to remove need for + sys.path_importer_cache. Could leave string entries on sys.path that do + not have an importer that can handle them so they can be retried at the + next needed import (that was not found in sys.modules). + """ +from __future__ import with_statement + import imp import sys +# XXX Importing os will not work in the end as it is implemented in Python +# itself. +import os class BuiltinFrozen_Importer(object): @@ -81,3 +96,101 @@ _find = imp.is_frozen _load = imp.init_frozen + + +class FileSystemFactory(object): + + """Factory object for sys.path_hooks for directory entries on sys.path.""" + + def __init__(self, *handlers): + """Store handlers to be used in attempting to import. + + The order that the handlers are specified are the order in which + files will be considered for importing. + + """ + self.handlers = handlers + + def __call__(self, path_entry): + """If path_entry is a directory, return an importer object for it, else + raise ImportError.""" + if os.path.isdir(path_entry): + return FileSystemImporter(path_entry, *self.handlers) + else: + raise ImportError("can only handle directory entries from " + "sys.path") + + +class FileSystemImporter(object): + + """Importer for the filesystem.""" + + def __init__(self, path_entry, *handlers): + self.path_entry = path_entry + self.handlers = handlers + + def find_module(self, fullname, path=None): + """Determine if this path entry can handle this import.""" + # XXX Ignores 'path' at the moment. + # XXX Does not worry about case-insensitive filesystems. + for handler in self.handlers: + file_name = fullname + '.' + handler.handles + possible_file = os.path.join(self.path_entry, file_name) + if os.path.isfile(possible_file): + break + else: + return None + return FileSystemLoader(file_path, handler) + + +class FileSystemLoader(object): + + """Loader for the filesystem.""" + + def __init__(self, file_path, handler): + self.file_path = file_path + self.handler = handler + + def load_module(self, fullname, path=None): + """Load the module from self.path using self.handler.""" + # XXX Ignores 'path' at the moment. + try: + return sys.modules[fullname] + except KeyError: + module = imp.new_module(fullname) + sys.modules[fullname] = module + self.handler.handle_file(module, fullname, path, self.file_path) + return module + + +class PySourceHandler(object): + + """Handler for importing Python source modules.""" + + # XXX Does not generate a .pyc at the moment. + + handles = 'py' + + def handle_file(self, module, fullname, path, file_path): + """Import the Python source file at 'path' and use it to initialize + 'module'.""" + module.__file__ = file_path + module.__name__ = fullname + with open(file_path) as source_file: + source_code = source_file.read() + compiled_code = compile(source_code, file_path, 'exec') + exec compiled_code in module.__dict__ + return module + + +class PyBytecodeHandler(object): + + """Handler for importing .pyc/.pyo modules.""" + + # XXX 'handles' should be a property that returns based on whether -O was + # specified when running the interpreter. + + # XXX Should probably add a handle_string() method to PySourceHandler() so + # that if the .pyc is outdated it can easily use PySourceHandler to do the + # import for it and then write out the new .pyc . + # XXX Writing out a new .pyc should be made optional. From python-checkins at python.org Sat Oct 7 13:05:03 2006 From: python-checkins at python.org (skip.montanaro) Date: Sat, 7 Oct 2006 13:05:03 +0200 (CEST) Subject: [Python-checkins] r52218 - python/trunk/Doc/lib/libcsv.tex Message-ID: <20061007110503.87DC51E400B@bag.python.org> Author: skip.montanaro Date: Sat Oct 7 13:05:02 2006 New Revision: 52218 Modified: python/trunk/Doc/lib/libcsv.tex Log: Note that the excel_tab class is registered as the "excel-tab" dialect. Fixes 1572471. Make a similar change for the excel class and clean up references to the Dialects and Formatting Parameters section in a few places. Modified: python/trunk/Doc/lib/libcsv.tex ============================================================================== --- python/trunk/Doc/lib/libcsv.tex (original) +++ python/trunk/Doc/lib/libcsv.tex Sat Oct 7 13:05:02 2006 @@ -64,9 +64,9 @@ class or one of the strings returned by the \function{list_dialects} function. The other optional {}\var{fmtparam} keyword arguments can be given to override individual formatting parameters in the current -dialect. For more information about the dialect and formatting +dialect. For full details about the dialect and formatting parameters, see section~\ref{csv-fmt-params}, ``Dialects and Formatting -Parameters'' for details of these parameters. +Parameters''. All data read are returned as strings. No automatic data type conversion is performed. @@ -96,10 +96,10 @@ of a subclass of the \class{Dialect} class or one of the strings returned by the \function{list_dialects} function. The other optional {}\var{fmtparam} keyword arguments can be given to override individual -formatting parameters in the current dialect. For more information +formatting parameters in the current dialect. For full details about the dialect and formatting parameters, see -section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters'' for -details of these parameters. To make it as easy as possible to +section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters''. +To make it as easy as possible to interface with modules which implement the DB API, the value \constant{None} is written as the empty string. While this isn't a reversible transformation, it makes it easier to dump SQL NULL data values @@ -113,9 +113,8 @@ or Unicode object. The dialect can be specified either by passing a sub-class of \class{Dialect}, or by \var{fmtparam} keyword arguments, or both, with keyword arguments overriding parameters of the dialect. -For more information about the dialect and formatting parameters, see -section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters'' -for details of these parameters. +For full details about the dialect and formatting parameters, see +section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters''. \end{funcdesc} \begin{funcdesc}{unregister_dialect}{name} @@ -197,12 +196,13 @@ \begin{classdesc}{excel}{} The \class{excel} class defines the usual properties of an Excel-generated -CSV file. +CSV file. It is registered with the dialect name \code{'excel'}. \end{classdesc} \begin{classdesc}{excel_tab}{} The \class{excel_tab} class defines the usual properties of an -Excel-generated TAB-delimited file. +Excel-generated TAB-delimited file. It is registered with the dialect name +\code{'excel-tab'}. \end{classdesc} \begin{classdesc}{Sniffer}{} From python-checkins at python.org Sat Oct 7 16:56:31 2006 From: python-checkins at python.org (kristjan.jonsson) Date: Sat, 7 Oct 2006 16:56:31 +0200 (CEST) Subject: [Python-checkins] r52219 - in python/branches/release25-maint: Modules/_struct.c PCbuild8/_ctypes.vcproj PCbuild8/_ctypes_test.vcproj PCbuild8/_elementtree.vcproj PCbuild8/_msi.vcproj PCbuild8/_sqlite3.vcproj PCbuild8/make_buildinfo.c PCbuild8/make_buildinfo.vcproj PCbuild8/pcbuild.sln PCbuild8/python.vcproj PCbuild8/pythoncore.vcproj PCbuild8/pythonw.vcproj PCbuild8/readme.txt PCbuild8/select.vcproj PCbuild8/unicodedata.vcproj PCbuild8/w9xpopen.vcproj PCbuild8/winsound.vcproj Message-ID: <20061007145631.C802C1E4002@bag.python.org> Author: kristjan.jonsson Date: Sat Oct 7 16:56:30 2006 New Revision: 52219 Modified: python/branches/release25-maint/Modules/_struct.c python/branches/release25-maint/PCbuild8/_ctypes.vcproj python/branches/release25-maint/PCbuild8/_ctypes_test.vcproj python/branches/release25-maint/PCbuild8/_elementtree.vcproj python/branches/release25-maint/PCbuild8/_msi.vcproj python/branches/release25-maint/PCbuild8/_sqlite3.vcproj python/branches/release25-maint/PCbuild8/make_buildinfo.c python/branches/release25-maint/PCbuild8/make_buildinfo.vcproj python/branches/release25-maint/PCbuild8/pcbuild.sln python/branches/release25-maint/PCbuild8/python.vcproj python/branches/release25-maint/PCbuild8/pythoncore.vcproj python/branches/release25-maint/PCbuild8/pythonw.vcproj python/branches/release25-maint/PCbuild8/readme.txt python/branches/release25-maint/PCbuild8/select.vcproj python/branches/release25-maint/PCbuild8/unicodedata.vcproj python/branches/release25-maint/PCbuild8/w9xpopen.vcproj python/branches/release25-maint/PCbuild8/winsound.vcproj Log: Backport the .sln and .vcproj files for PCBuild8 from the python trunk to the 2.5 maintainance branch. This fixes build problems with visual studio 2005, and cleans up profile guided optimization. Modified: python/branches/release25-maint/Modules/_struct.c ============================================================================== --- python/branches/release25-maint/Modules/_struct.c (original) +++ python/branches/release25-maint/Modules/_struct.c Sat Oct 7 16:56:30 2006 @@ -820,7 +820,7 @@ } while (--i > 0); /* Extend the sign bit. */ if (SIZEOF_LONG_LONG > f->size) - x |= -(x & (1L << ((8 * f->size) - 1))); + x |= -(x & ( (PY_LONG_LONG)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); @@ -1038,7 +1038,7 @@ } while (i > 0); /* Extend the sign bit. */ if (SIZEOF_LONG_LONG > f->size) - x |= -(x & (1L << ((8 * f->size) - 1))); + x |= -(x & ( (PY_LONG_LONG)1 << ((8 * f->size) - 1))); if (x >= LONG_MIN && x <= LONG_MAX) return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); Modified: python/branches/release25-maint/PCbuild8/_ctypes.vcproj ============================================================================== --- python/branches/release25-maint/PCbuild8/_ctypes.vcproj (original) +++ python/branches/release25-maint/PCbuild8/_ctypes.vcproj Sat Oct 7 16:56:30 2006 @@ -4,20 +4,24 @@ Version="8,00" Name="_ctypes" ProjectGUID="{F22F40F4-D318-40DC-96B3-88DC81CE0894}" + RootNamespace="_ctypes" Keyword="Win32Proj" > + + + @@ -236,17 +236,18 @@ /> @@ -327,17 +326,18 @@ /> + + @@ -238,18 +238,18 @@ /> @@ -330,18 +327,18 @@ /> #include -/* This file creates the getbuildinfo.o object, by first - invoking subwcrev.exe (if found), and then invoking cl.exe. - As a side effect, it might generate PCBuild\getbuildinfo2.c - also. If this isn't a subversion checkout, or subwcrev isn't - found, it compiles ..\\Modules\\getbuildinfo.c instead. +/* This file creates the getbuildinfo2.c file, by + invoking subwcrev.exe (if found). + If this isn't a subversion checkout, or subwcrev isn't + found, it copies ..\\Modules\\getbuildinfo.c instead. + + A file, getbuildinfo2.h is then updated to define + SUBWCREV if it was a subversion checkout. + + getbuildinfo2.c is part of the pythoncore project with + getbuildinfo2.h as a forced include. This helps + VisualStudio refrain from unnecessary compiles much of the + time. Currently, subwcrev.exe is found from the registry entries of TortoiseSVN. - No attempt is made to place getbuildinfo.o into the proper - binary directory. This isn't necessary, as this tool is - invoked as a pre-link step for pythoncore, so that overwrites - any previous getbuildinfo.o. + make_buildinfo.exe is called as a pre-build step for pythoncore. */ @@ -40,11 +44,11 @@ type != REG_SZ) /* Registry corrupted */ return 0; - strcat(command, "bin\\subwcrev.exe"); + strcat_s(command, sizeof(command), "bin\\subwcrev.exe"); if (_stat(command+1, &st) < 0) /* subwcrev.exe not part of the release */ return 0; - strcat(command, "\" .. ..\\Modules\\getbuildinfo.c getbuildinfo2.c"); + strcat_s(command, sizeof(command), "\" .. ..\\Modules\\getbuildinfo.c getbuildinfo2.c"); puts(command); fflush(stdout); if (system(command) < 0) return 0; @@ -53,40 +57,25 @@ int main(int argc, char*argv[]) { - char command[500] = "cl.exe -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL "; - int do_unlink, result; - if (argc != 2) { - fprintf(stderr, "make_buildinfo $(ConfigurationName)\n"); - return EXIT_FAILURE; - } - if (strcmp(argv[1], "Release") == 0) { - strcat(command, "-MD "); - } - else if (strcmp(argv[1], "Debug") == 0) { - strcat(command, "-D_DEBUG -MDd "); - } - else if (strcmp(argv[1], "ReleaseItanium") == 0) { - strcat(command, "-MD /USECL:MS_ITANIUM "); - } - else if (strcmp(argv[1], "ReleaseAMD64") == 0) { - strcat(command, "-MD "); - strcat(command, "-MD /USECL:MS_OPTERON "); - } - else { - fprintf(stderr, "unsupported configuration %s\n", argv[1]); - return EXIT_FAILURE; - } + char command[500] = ""; + int svn; + FILE *f; - if ((do_unlink = make_buildinfo2())) - strcat(command, "getbuildinfo2.c -DSUBWCREV "); - else - strcat(command, "..\\Modules\\getbuildinfo.c"); - strcat(command, " -Fogetbuildinfo.o -I..\\Include -I..\\PC"); - puts(command); fflush(stdout); - result = system(command); - if (do_unlink) - unlink("getbuildinfo2.c"); - if (result < 0) + if (fopen_s(&f, "getbuildinfo2.h", "w")) return EXIT_FAILURE; + /* Get getbuildinfo.c from svn as getbuildinfo2.c */ + svn = make_buildinfo2(); + if (svn) { + puts("got getbuildinfo2.c from svn. Updating getbuildinfo2.h"); + /* yes. make sure SUBWCREV is defined */ + fprintf(f, "#define SUBWCREV\n"); + } else { + puts("didn't get getbuildinfo2.c from svn. Copying from Modules and clearing getbuildinfo2.h"); + strcat_s(command, sizeof(command), "copy ..\\Modules\\getbuildinfo.c getbuildinfo2.c"); + puts(command); fflush(stdout); + if (system(command) < 0) + return EXIT_FAILURE; + } + fclose(f); return 0; } \ No newline at end of file Modified: python/branches/release25-maint/PCbuild8/make_buildinfo.vcproj ============================================================================== --- python/branches/release25-maint/PCbuild8/make_buildinfo.vcproj (original) +++ python/branches/release25-maint/PCbuild8/make_buildinfo.vcproj Sat Oct 7 16:56:30 2006 @@ -4,6 +4,7 @@ Version="8,00" Name="make_buildinfo" ProjectGUID="{C73F0EC1-358B-4177-940F-0846AC8B04CD}" + RootNamespace="make_buildinfo" Keyword="Win32Proj" > @@ -40,7 +41,7 @@ - - - - - - - - - - - - - - - - - - - - Modified: python/branches/release25-maint/PCbuild8/pcbuild.sln ============================================================================== --- python/branches/release25-maint/PCbuild8/pcbuild.sln (original) +++ python/branches/release25-maint/PCbuild8/pcbuild.sln Sat Oct 7 16:56:30 2006 @@ -2,8 +2,8 @@ # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" ProjectSection(ProjectDependencies) = postProject - {C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD} {F0E0541E-F17D-430B-97C4-93ADF0DD284E} = {F0E0541E-F17D-430B-97C4-93ADF0DD284E} + {C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}" @@ -61,137 +61,244 @@ readme.txt = readme.txt EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore_pgo", "pythoncore_pgo.vcproj", "{8B59C1FF-2439-4BE9-9F24-84D4982D28D4}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" ProjectSection(ProjectDependencies) = postProject {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{F0E0541E-F17D-430B-97C4-93ADF0DD284E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + PGIRelease|Win32 = PGIRelease|Win32 + PGIRelease|x64 = PGIRelease|x64 + PGORelease|Win32 = PGORelease|Win32 + PGORelease|x64 = PGORelease|x64 Release|Win32 = Release|Win32 - ReleaseAMD64|Win32 = ReleaseAMD64|Win32 - ReleaseItanium|Win32 = ReleaseItanium|Win32 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.ActiveCfg = Debug|Win32 {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.Build.0 = Debug|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.ActiveCfg = Debug|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.Build.0 = Debug|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|Win32.ActiveCfg = PGIRelease|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|Win32.Build.0 = PGIRelease|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|x64.ActiveCfg = PGIRelease|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGIRelease|x64.Build.0 = PGIRelease|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|Win32.ActiveCfg = PGORelease|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|Win32.Build.0 = PGORelease|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|x64.ActiveCfg = PGORelease|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGORelease|x64.Build.0 = PGORelease|x64 {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.ActiveCfg = Release|Win32 {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.Build.0 = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.ReleaseAMD64|Win32.Build.0 = ReleaseAMD64|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.ReleaseItanium|Win32.Build.0 = ReleaseItanium|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.ActiveCfg = Release|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.Build.0 = Release|x64 {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.ActiveCfg = Debug|Win32 {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.Build.0 = Debug|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.ActiveCfg = Debug|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.Build.0 = Debug|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|Win32.Build.0 = Release|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|x64.ActiveCfg = Release|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGIRelease|x64.Build.0 = Release|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|Win32.ActiveCfg = Release|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|Win32.Build.0 = Release|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|x64.ActiveCfg = Release|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGORelease|x64.Build.0 = Release|x64 {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.ActiveCfg = Release|Win32 {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.Build.0 = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.ReleaseAMD64|Win32.Build.0 = ReleaseAMD64|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.ReleaseItanium|Win32.Build.0 = ReleaseItanium|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.ActiveCfg = Release|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.Build.0 = Release|x64 {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|Win32.ActiveCfg = Debug|Win32 {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|Win32.Build.0 = Debug|Win32 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|x64.ActiveCfg = Debug|x64 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Debug|x64.Build.0 = Debug|x64 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|Win32.Build.0 = Release|Win32 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|x64.ActiveCfg = Release|x64 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGIRelease|x64.Build.0 = Release|x64 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|Win32.ActiveCfg = Release|Win32 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|Win32.Build.0 = Release|Win32 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|x64.ActiveCfg = Release|x64 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.PGORelease|x64.Build.0 = Release|x64 {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|Win32.ActiveCfg = Release|Win32 {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|Win32.Build.0 = Release|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.ReleaseAMD64|Win32.Build.0 = ReleaseAMD64|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 - {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.ReleaseItanium|Win32.Build.0 = ReleaseItanium|Win32 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|x64.ActiveCfg = Release|x64 + {97239A56-DBC0-41D2-BC14-C87D9B97D63B}.Release|x64.Build.0 = Release|x64 {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|Win32.ActiveCfg = Debug|Win32 {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|Win32.Build.0 = Debug|Win32 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|x64.ActiveCfg = Debug|x64 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Debug|x64.Build.0 = Debug|x64 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|Win32.Build.0 = Release|Win32 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|x64.ActiveCfg = Release|x64 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGIRelease|x64.Build.0 = Release|x64 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|Win32.ActiveCfg = Release|Win32 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|Win32.Build.0 = Release|Win32 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|x64.ActiveCfg = Release|x64 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.PGORelease|x64.Build.0 = Release|x64 {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|Win32.ActiveCfg = Release|Win32 {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|Win32.Build.0 = Release|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.ReleaseAMD64|Win32.Build.0 = ReleaseAMD64|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 - {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.ReleaseItanium|Win32.Build.0 = ReleaseItanium|Win32 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|x64.ActiveCfg = Release|x64 + {FA5FC7EB-C72F-415F-AE42-91DD605ABDDA}.Release|x64.Build.0 = Release|x64 {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.ActiveCfg = Debug|Win32 {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.Build.0 = Debug|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.ActiveCfg = Debug|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.Build.0 = Debug|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|Win32.Build.0 = Release|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|x64.ActiveCfg = Release|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGIRelease|x64.Build.0 = Release|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|Win32.ActiveCfg = Release|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|Win32.Build.0 = Release|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|x64.ActiveCfg = Release|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGORelease|x64.Build.0 = Release|x64 {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.ActiveCfg = Release|Win32 {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.Build.0 = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.ReleaseAMD64|Win32.ActiveCfg = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.ReleaseItanium|Win32.ActiveCfg = Release|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.ActiveCfg = Release|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.Build.0 = Release|x64 {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|Win32.ActiveCfg = Debug|Win32 {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|Win32.Build.0 = Debug|Win32 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|x64.ActiveCfg = Debug|x64 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Debug|x64.Build.0 = Debug|x64 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|Win32.Build.0 = Release|Win32 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|x64.ActiveCfg = Release|x64 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGIRelease|x64.Build.0 = Release|x64 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|Win32.ActiveCfg = Release|Win32 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|Win32.Build.0 = Release|Win32 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|x64.ActiveCfg = Release|x64 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.PGORelease|x64.Build.0 = Release|x64 {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|Win32.ActiveCfg = Release|Win32 {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|Win32.Build.0 = Release|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.ReleaseAMD64|Win32.Build.0 = ReleaseAMD64|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 - {51F35FAE-FB92-4B2C-9187-1542C065AD77}.ReleaseItanium|Win32.Build.0 = ReleaseItanium|Win32 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|x64.ActiveCfg = Release|x64 + {51F35FAE-FB92-4B2C-9187-1542C065AD77}.Release|x64.Build.0 = Release|x64 {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|Win32.ActiveCfg = Debug|Win32 {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|Win32.Build.0 = Debug|Win32 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|x64.ActiveCfg = Debug|x64 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Debug|x64.Build.0 = Debug|x64 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|Win32.Build.0 = Release|Win32 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|x64.ActiveCfg = Release|x64 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGIRelease|x64.Build.0 = Release|x64 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|Win32.ActiveCfg = Release|Win32 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|Win32.Build.0 = Release|Win32 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|x64.ActiveCfg = Release|x64 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.PGORelease|x64.Build.0 = Release|x64 {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|Win32.ActiveCfg = Release|Win32 {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|Win32.Build.0 = Release|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.ReleaseAMD64|Win32.Build.0 = ReleaseAMD64|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 - {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.ReleaseItanium|Win32.Build.0 = ReleaseItanium|Win32 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|x64.ActiveCfg = Release|x64 + {1966DDE2-4AB7-4E4E-ACC9-C121E4D37F8E}.Release|x64.Build.0 = Release|x64 {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.ActiveCfg = Debug|Win32 {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.Build.0 = Debug|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.ReleaseAMD64|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.ReleaseAMD64|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.ReleaseItanium|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.ReleaseItanium|Win32.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.Build.0 = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGIRelease|Win32.ActiveCfg = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGIRelease|Win32.Build.0 = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGIRelease|x64.ActiveCfg = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGORelease|Win32.ActiveCfg = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGORelease|Win32.Build.0 = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGORelease|x64.ActiveCfg = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.ActiveCfg = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.Build.0 = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.ActiveCfg = Debug|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.Build.0 = Debug|Win32 {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|Win32.ActiveCfg = Debug|Win32 {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|Win32.Build.0 = Debug|Win32 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|x64.ActiveCfg = Debug|x64 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Debug|x64.Build.0 = Debug|x64 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|Win32.Build.0 = Release|Win32 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|x64.ActiveCfg = Release|x64 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGIRelease|x64.Build.0 = Release|x64 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|Win32.ActiveCfg = Release|Win32 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|Win32.Build.0 = Release|Win32 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|x64.ActiveCfg = Release|x64 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.PGORelease|x64.Build.0 = Release|x64 {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|Win32.ActiveCfg = Release|Win32 {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|Win32.Build.0 = Release|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.ReleaseAMD64|Win32.Build.0 = ReleaseAMD64|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 - {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.ReleaseItanium|Win32.Build.0 = ReleaseItanium|Win32 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|x64.ActiveCfg = Release|x64 + {2C0BEFB9-70E2-4F80-AC5B-4AB8EE023574}.Release|x64.Build.0 = Release|x64 {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|Win32.ActiveCfg = Debug|Win32 {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|Win32.Build.0 = Debug|Win32 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|x64.ActiveCfg = Debug|x64 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Debug|x64.Build.0 = Debug|x64 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|Win32.Build.0 = Release|Win32 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|x64.ActiveCfg = Release|x64 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGIRelease|x64.Build.0 = Release|x64 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|Win32.ActiveCfg = Release|Win32 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|Win32.Build.0 = Release|Win32 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|x64.ActiveCfg = Release|x64 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.PGORelease|x64.Build.0 = Release|x64 {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Release|Win32.ActiveCfg = Release|Win32 {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Release|Win32.Build.0 = Release|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {F22F40F4-D318-40DC-96B3-88DC81CE0894}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 + {F22F40F4-D318-40DC-96B3-88DC81CE0894}.Release|x64.ActiveCfg = Release|x64 {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|Win32.ActiveCfg = Debug|Win32 {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|Win32.Build.0 = Debug|Win32 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|x64.ActiveCfg = Debug|x64 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Debug|x64.Build.0 = Debug|x64 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|Win32.Build.0 = Release|Win32 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|x64.ActiveCfg = Release|x64 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGIRelease|x64.Build.0 = Release|x64 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|Win32.ActiveCfg = Release|Win32 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|Win32.Build.0 = Release|Win32 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|x64.ActiveCfg = Release|x64 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.PGORelease|x64.Build.0 = Release|x64 {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|Win32.ActiveCfg = Release|Win32 {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|Win32.Build.0 = Release|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|x64.ActiveCfg = Release|x64 + {8CF334D9-4F82-42EB-97AF-83592C5AFD2F}.Release|x64.Build.0 = Release|x64 {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|Win32.ActiveCfg = Debug|Win32 {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|Win32.Build.0 = Debug|Win32 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|x64.ActiveCfg = Debug|x64 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.Debug|x64.Build.0 = Debug|x64 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|Win32.Build.0 = Release|Win32 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|x64.ActiveCfg = Release|x64 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGIRelease|x64.Build.0 = Release|x64 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|Win32.ActiveCfg = Release|Win32 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|Win32.Build.0 = Release|Win32 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|x64.ActiveCfg = Release|x64 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.PGORelease|x64.Build.0 = Release|x64 {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|Win32.ActiveCfg = Release|Win32 {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|Win32.Build.0 = Release|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.ReleaseAMD64|Win32.Build.0 = ReleaseAMD64|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 - {2FF0A312-22F9-4C34-B070-842916DE27A9}.ReleaseItanium|Win32.Build.0 = ReleaseItanium|Win32 - {8B59C1FF-2439-4BE9-9F24-84D4982D28D4}.Debug|Win32.ActiveCfg = Release|Win32 - {8B59C1FF-2439-4BE9-9F24-84D4982D28D4}.Debug|Win32.Build.0 = Release|Win32 - {8B59C1FF-2439-4BE9-9F24-84D4982D28D4}.Release|Win32.ActiveCfg = Release|Win32 - {8B59C1FF-2439-4BE9-9F24-84D4982D28D4}.Release|Win32.Build.0 = Release|Win32 - {8B59C1FF-2439-4BE9-9F24-84D4982D28D4}.ReleaseAMD64|Win32.ActiveCfg = Release|Win32 - {8B59C1FF-2439-4BE9-9F24-84D4982D28D4}.ReleaseAMD64|Win32.Build.0 = Release|Win32 - {8B59C1FF-2439-4BE9-9F24-84D4982D28D4}.ReleaseItanium|Win32.ActiveCfg = Release|Win32 - {8B59C1FF-2439-4BE9-9F24-84D4982D28D4}.ReleaseItanium|Win32.Build.0 = Release|Win32 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|x64.ActiveCfg = Release|x64 + {2FF0A312-22F9-4C34-B070-842916DE27A9}.Release|x64.Build.0 = Release|x64 {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.ActiveCfg = Debug|Win32 {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.Build.0 = Debug|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.ActiveCfg = Debug|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.Build.0 = Debug|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|Win32.Build.0 = Release|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|x64.ActiveCfg = Release|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGIRelease|x64.Build.0 = Release|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|Win32.ActiveCfg = Release|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|Win32.Build.0 = Release|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|x64.ActiveCfg = Release|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGORelease|x64.Build.0 = Release|x64 {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.ActiveCfg = Release|Win32 {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.Build.0 = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.ReleaseAMD64|Win32.ActiveCfg = ReleaseAMD64|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.ReleaseAMD64|Win32.Build.0 = ReleaseAMD64|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.ReleaseItanium|Win32.ActiveCfg = ReleaseItanium|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.ReleaseItanium|Win32.Build.0 = ReleaseItanium|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.ActiveCfg = Release|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.Build.0 = Release|x64 {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Debug|Win32 {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGIRelease|Win32.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGIRelease|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGIRelease|x64.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGORelease|Win32.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGORelease|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGORelease|x64.ActiveCfg = Release|Win32 {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.ActiveCfg = Release|Win32 {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.ReleaseAMD64|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.ReleaseAMD64|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.ReleaseItanium|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.ReleaseItanium|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE Modified: python/branches/release25-maint/PCbuild8/python.vcproj ============================================================================== --- python/branches/release25-maint/PCbuild8/python.vcproj (original) +++ python/branches/release25-maint/PCbuild8/python.vcproj Sat Oct 7 16:56:30 2006 @@ -4,19 +4,23 @@ Version="8,00" Name="python" ProjectGUID="{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" + RootNamespace="python" > + @@ -239,25 +241,26 @@ /> @@ -333,25 +331,26 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -253,23 +437,21 @@ /> @@ -350,23 +533,21 @@ /> - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -558,6 +1293,10 @@ > + + @@ -738,6 +1477,74 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -797,6 +1604,14 @@ /> + + + + + + + + + + + + + @@ -240,16 +240,16 @@ /> @@ -332,16 +329,16 @@ /> + @@ -238,18 +241,18 @@ /> @@ -330,18 +327,18 @@ /> + @@ -234,14 +237,15 @@ /> @@ -323,14 +322,15 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/release25-maint/PCbuild8/winsound.vcproj ============================================================================== --- python/branches/release25-maint/PCbuild8/winsound.vcproj (original) +++ python/branches/release25-maint/PCbuild8/winsound.vcproj Sat Oct 7 16:56:30 2006 @@ -4,19 +4,23 @@ Version="8,00" Name="winsound" ProjectGUID="{51F35FAE-FB92-4B2C-9187-1542C065AD77}" + RootNamespace="winsound" > + The Buildbot has detected a new failure of x86 W2k 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%25202.5/builds/64 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: kristjan.jonsson Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sun Oct 8 09:06:30 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 8 Oct 2006 09:06:30 +0200 (CEST) Subject: [Python-checkins] r52220 - in python/branches/release25-maint: Lib/test/test_syntax.py Misc/NEWS Python/compile.c Message-ID: <20061008070630.78B7B1E4004@bag.python.org> Author: georg.brandl Date: Sun Oct 8 09:06:29 2006 New Revision: 52220 Modified: python/branches/release25-maint/Lib/test/test_syntax.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Python/compile.c Log: Patch #1542451: fix crash with continue in nested try/finally (backport from rev. 51439) Modified: python/branches/release25-maint/Lib/test/test_syntax.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_syntax.py (original) +++ python/branches/release25-maint/Lib/test/test_syntax.py Sun Oct 8 09:06:29 2006 @@ -235,6 +235,90 @@ >>> f() += 1 Traceback (most recent call last): SyntaxError: illegal expression for augmented assignment (, line 1) + + +Test continue in finally in weird combinations. + +continue in for loop under finally shouuld be ok. + + >>> def test(): + ... try: + ... pass + ... finally: + ... for abc in range(10): + ... continue + ... print abc + >>> test() + 9 + +Start simple, a continue in a finally should not be allowed. + + >>> def test(): + ... for abc in range(10): + ... try: + ... pass + ... finally: + ... continue + ... + Traceback (most recent call last): + ... + SyntaxError: 'continue' not supported inside 'finally' clause (, line 6) + +This is essentially a continue in a finally which should not be allowed. + + >>> def test(): + ... for abc in range(10): + ... try: + ... pass + ... finally: + ... try: + ... continue + ... except: + ... pass + Traceback (most recent call last): + ... + SyntaxError: 'continue' not supported inside 'finally' clause (, line 7) + + >>> def foo(): + ... try: + ... pass + ... finally: + ... continue + Traceback (most recent call last): + ... + SyntaxError: 'continue' not supported inside 'finally' clause (, line 5) + + >>> def foo(): + ... for a in (): + ... try: pass + ... finally: continue + Traceback (most recent call last): + ... + SyntaxError: 'continue' not supported inside 'finally' clause (, line 4) + + >>> def foo(): + ... for a in (): + ... try: pass + ... finally: + ... try: + ... continue + ... finally: pass + Traceback (most recent call last): + ... + SyntaxError: 'continue' not supported inside 'finally' clause (, line 6) + + >>> def foo(): + ... for a in (): + ... try: pass + ... finally: + ... try: + ... pass + ... except: + ... continue + Traceback (most recent call last): + ... + SyntaxError: 'continue' not supported inside 'finally' clause (, line 8) + """ import re Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 8 09:06:29 2006 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Patch #1542451: disallow continue anywhere under a finally. + - list.pop(x) accepts any object x following the __index__ protocol. - Fix some leftovers from the conversion from int to Py_ssize_t Modified: python/branches/release25-maint/Python/compile.c ============================================================================== --- python/branches/release25-maint/Python/compile.c (original) +++ python/branches/release25-maint/Python/compile.c Sun Oct 8 09:06:29 2006 @@ -2288,6 +2288,8 @@ compiler_continue(struct compiler *c) { static const char LOOP_ERROR_MSG[] = "'continue' not properly in loop"; + static const char IN_FINALLY_ERROR_MSG[] = + "'continue' not supported inside 'finally' clause"; int i; if (!c->u->u_nfblocks) @@ -2299,15 +2301,19 @@ break; case EXCEPT: case FINALLY_TRY: - while (--i >= 0 && c->u->u_fblock[i].fb_type != LOOP) - ; + while (--i >= 0 && c->u->u_fblock[i].fb_type != LOOP) { + /* Prevent try: ... finally: + try: continue ... or + try: ... except: continue */ + if (c->u->u_fblock[i].fb_type == FINALLY_END) + return compiler_error(c, IN_FINALLY_ERROR_MSG); + } if (i == -1) return compiler_error(c, LOOP_ERROR_MSG); ADDOP_JABS(c, CONTINUE_LOOP, c->u->u_fblock[i].fb_block); break; case FINALLY_END: - return compiler_error(c, - "'continue' not supported inside 'finally' clause"); + return compiler_error(c, IN_FINALLY_ERROR_MSG); } return 1; From python-checkins at python.org Sun Oct 8 09:11:55 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 8 Oct 2006 09:11:55 +0200 (CEST) Subject: [Python-checkins] r52221 - python/trunk/Misc/NEWS Message-ID: <20061008071155.9026D1E4004@bag.python.org> Author: georg.brandl Date: Sun Oct 8 09:11:54 2006 New Revision: 52221 Modified: python/trunk/Misc/NEWS Log: Add missing NEWS entry for rev. 52129. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 8 09:11:54 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Bug #1569998: break inside a try statement (outside a loop) is now + recognized and rejected. + - list.pop(x) accepts any object x following the __index__ protocol. - Fix some leftovers from the conversion from int to Py_ssize_t From python-checkins at python.org Sun Oct 8 09:12:25 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 8 Oct 2006 09:12:25 +0200 (CEST) Subject: [Python-checkins] r52222 - in python/branches/release25-maint: Lib/test/test_syntax.py Misc/NEWS Python/compile.c Message-ID: <20061008071225.19CB11E4004@bag.python.org> Author: georg.brandl Date: Sun Oct 8 09:12:23 2006 New Revision: 52222 Modified: python/branches/release25-maint/Lib/test/test_syntax.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Python/compile.c Log: Fix #1569998: no break inside try statement (outside loop) allowed. (backport from rev. 52129) Modified: python/branches/release25-maint/Lib/test/test_syntax.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_syntax.py (original) +++ python/branches/release25-maint/Lib/test/test_syntax.py Sun Oct 8 09:12:23 2006 @@ -319,6 +319,20 @@ ... SyntaxError: 'continue' not supported inside 'finally' clause (, line 8) +There is one test for a break that is not in a loop. The compiler +uses a single data structure to keep track of try-finally and loops, +so we need to be sure that a break is actually inside a loop. If it +isn't, there should be a syntax error. + + >>> try: + ... print 1 + ... break + ... print 2 + ... finally: + ... print 3 + Traceback (most recent call last): + ... + SyntaxError: 'break' outside loop (, line 3) """ import re Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 8 09:12:23 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Bug #1569998: break inside a try statement (outside a loop) is now + recognized and rejected. + - Patch #1542451: disallow continue anywhere under a finally. - list.pop(x) accepts any object x following the __index__ protocol. Modified: python/branches/release25-maint/Python/compile.c ============================================================================== --- python/branches/release25-maint/Python/compile.c (original) +++ python/branches/release25-maint/Python/compile.c Sun Oct 8 09:12:23 2006 @@ -187,6 +187,8 @@ basicblock *); static void compiler_pop_fblock(struct compiler *, enum fblocktype, basicblock *); +/* Returns true if there is a loop on the fblock stack. */ +static int compiler_in_loop(struct compiler *); static int inplace_binop(struct compiler *, operator_ty); static int expr_constant(expr_ty e); @@ -2764,7 +2766,7 @@ case Pass_kind: break; case Break_kind: - if (!c->u->u_nfblocks) + if (!compiler_in_loop(c)) return compiler_error(c, "'break' outside loop"); ADDOP(c, BREAK_LOOP); break; @@ -3754,6 +3756,16 @@ assert(u->u_fblock[u->u_nfblocks].fb_block == b); } +static int +compiler_in_loop(struct compiler *c) { + int i; + struct compiler_unit *u = c->u; + for (i = 0; i < u->u_nfblocks; ++i) { + if (u->u_fblock[i].fb_type == LOOP) + return 1; + } + return 0; +} /* Raises a SyntaxError and returns 0. If something goes wrong, a different exception may be raised. */ From python-checkins at python.org Sun Oct 8 15:48:35 2006 From: python-checkins at python.org (hyeshik.chang) Date: Sun, 8 Oct 2006 15:48:35 +0200 (CEST) Subject: [Python-checkins] r52223 - in python/trunk: Lib/test/test_multibytecodec.py Misc/NEWS Modules/cjkcodecs/_codecs_iso2022.c Message-ID: <20061008134835.8AC391E4004@bag.python.org> Author: hyeshik.chang Date: Sun Oct 8 15:48:34 2006 New Revision: 52223 Modified: python/trunk/Lib/test/test_multibytecodec.py python/trunk/Misc/NEWS python/trunk/Modules/cjkcodecs/_codecs_iso2022.c Log: Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP unicode characters. (Submitted by Ray Chason) Modified: python/trunk/Lib/test/test_multibytecodec.py ============================================================================== --- python/trunk/Lib/test/test_multibytecodec.py (original) +++ python/trunk/Lib/test/test_multibytecodec.py Sun Oct 8 15:48:34 2006 @@ -208,6 +208,16 @@ e = u'\u3406'.encode(encoding) self.failIf(filter(lambda x: x >= '\x80', e)) + def test_bug1572832(self): + if sys.maxunicode >= 0x10000: + myunichr = unichr + else: + myunichr = lambda x: unichr(0xD7C0+(x>>10)) + unichr(0xDC00+(x&0x3FF)) + + for x in xrange(0x10000, 0x110000): + # Any ISO 2022 codec will cause the segfault + myunichr(x).encode('iso_2022_jp', 'ignore') + def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Test_MultibyteCodec)) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 8 15:48:34 2006 @@ -123,6 +123,9 @@ Extension Modules ----------------- +- Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault + when encoding non-BMP unicode characters. + - Bug #1556784: allow format strings longer than 127 characters in datetime's strftime function. Modified: python/trunk/Modules/cjkcodecs/_codecs_iso2022.c ============================================================================== --- python/trunk/Modules/cjkcodecs/_codecs_iso2022.c (original) +++ python/trunk/Modules/cjkcodecs/_codecs_iso2022.c Sun Oct 8 15:48:34 2006 @@ -592,9 +592,11 @@ { DBCHAR coded; assert(*length == 1); - TRYMAP_ENC(cp949, coded, *data) - if (!(coded & 0x8000)) - return coded; + if (*data < 0x10000) { + TRYMAP_ENC(cp949, coded, *data) + if (!(coded & 0x8000)) + return coded; + } return MAP_UNMAPPABLE; } @@ -628,11 +630,13 @@ { DBCHAR coded; assert(*length == 1); - if (*data == 0xff3c) /* F/W REVERSE SOLIDUS */ - return 0x2140; - else TRYMAP_ENC(jisxcommon, coded, *data) { - if (!(coded & 0x8000)) - return coded; + if (*data < 0x10000) { + if (*data == 0xff3c) /* F/W REVERSE SOLIDUS */ + return 0x2140; + else TRYMAP_ENC(jisxcommon, coded, *data) { + if (!(coded & 0x8000)) + return coded; + } } return MAP_UNMAPPABLE; } @@ -665,9 +669,11 @@ { DBCHAR coded; assert(*length == 1); - TRYMAP_ENC(jisxcommon, coded, *data) { - if (coded & 0x8000) - return coded & 0x7fff; + if (*data < 0x10000) { + TRYMAP_ENC(jisxcommon, coded, *data) { + if (coded & 0x8000) + return coded & 0x7fff; + } } return MAP_UNMAPPABLE; } @@ -970,9 +976,11 @@ { DBCHAR coded; assert(*length == 1); - TRYMAP_ENC(gbcommon, coded, *data) { - if (!(coded & 0x8000)) - return coded; + if (*data < 0x10000) { + TRYMAP_ENC(gbcommon, coded, *data) { + if (!(coded & 0x8000)) + return coded; + } } return MAP_UNMAPPABLE; } From python-checkins at python.org Sun Oct 8 15:56:01 2006 From: python-checkins at python.org (hyeshik.chang) Date: Sun, 8 Oct 2006 15:56:01 +0200 (CEST) Subject: [Python-checkins] r52224 - in python/branches/release24-maint: Lib/test/test_multibytecodec.py Misc/NEWS Modules/cjkcodecs/_codecs_iso2022.c Message-ID: <20061008135601.DD5171E4004@bag.python.org> Author: hyeshik.chang Date: Sun Oct 8 15:56:00 2006 New Revision: 52224 Modified: python/branches/release24-maint/Lib/test/test_multibytecodec.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Modules/cjkcodecs/_codecs_iso2022.c Log: Backport from trunk r52223: Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP unicode characters. (Submitted by Ray Chason) Modified: python/branches/release24-maint/Lib/test/test_multibytecodec.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_multibytecodec.py (original) +++ python/branches/release24-maint/Lib/test/test_multibytecodec.py Sun Oct 8 15:56:00 2006 @@ -7,7 +7,7 @@ from test import test_support from test import test_multibytecodec_support -import unittest, StringIO, codecs +import unittest, StringIO, codecs, sys class Test_StreamWriter(unittest.TestCase): if len(u'\U00012345') == 2: # UCS2 @@ -87,6 +87,16 @@ e = u'\u3406'.encode(encoding) self.failIf(filter(lambda x: x >= '\x80', e)) + def test_bug1572832(self): + if sys.maxunicode >= 0x10000: + myunichr = unichr + else: + myunichr = lambda x: unichr(0xD7C0+(x>>10)) + unichr(0xDC00+(x&0x3FF)) + + for x in xrange(0x10000, 0x110000): + # Any ISO 2022 codec will cause the segfault + myunichr(x).encode('iso_2022_jp', 'ignore') + def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Test_StreamWriter)) Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Sun Oct 8 15:56:00 2006 @@ -80,6 +80,9 @@ Extension Modules ----------------- +- Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault + when encoding non-BMP unicode characters. + - Bug #1556784: allow format strings longer than 127 characters in datetime's strftime function. Modified: python/branches/release24-maint/Modules/cjkcodecs/_codecs_iso2022.c ============================================================================== --- python/branches/release24-maint/Modules/cjkcodecs/_codecs_iso2022.c (original) +++ python/branches/release24-maint/Modules/cjkcodecs/_codecs_iso2022.c Sun Oct 8 15:56:00 2006 @@ -593,9 +593,11 @@ { DBCHAR coded; assert(*length == 1); - TRYMAP_ENC(cp949, coded, *data) - if (!(coded & 0x8000)) - return coded; + if (*data < 0x10000) { + TRYMAP_ENC(cp949, coded, *data) + if (!(coded & 0x8000)) + return coded; + } return MAP_UNMAPPABLE; } @@ -629,11 +631,13 @@ { DBCHAR coded; assert(*length == 1); - if (*data == 0xff3c) /* F/W REVERSE SOLIDUS */ - return 0x2140; - else TRYMAP_ENC(jisxcommon, coded, *data) { - if (!(coded & 0x8000)) - return coded; + if (*data < 0x10000) { + if (*data == 0xff3c) /* F/W REVERSE SOLIDUS */ + return 0x2140; + else TRYMAP_ENC(jisxcommon, coded, *data) { + if (!(coded & 0x8000)) + return coded; + } } return MAP_UNMAPPABLE; } @@ -666,9 +670,11 @@ { DBCHAR coded; assert(*length == 1); - TRYMAP_ENC(jisxcommon, coded, *data) { - if (coded & 0x8000) - return coded & 0x7fff; + if (*data < 0x10000) { + TRYMAP_ENC(jisxcommon, coded, *data) { + if (coded & 0x8000) + return coded & 0x7fff; + } } return MAP_UNMAPPABLE; } @@ -971,9 +977,11 @@ { DBCHAR coded; assert(*length == 1); - TRYMAP_ENC(gbcommon, coded, *data) { - if (!(coded & 0x8000)) - return coded; + if (*data < 0x10000) { + TRYMAP_ENC(gbcommon, coded, *data) { + if (!(coded & 0x8000)) + return coded; + } } return MAP_UNMAPPABLE; } From buildbot at python.org Sun Oct 8 16:01:12 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 14:01:12 +0000 Subject: [Python-checkins] buildbot failure in alpha Debian trunk Message-ID: <20061008140112.607FC1E400E@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/597 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,hyeshik.chang,skip.montanaro BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Sun Oct 8 16:01:45 2006 From: python-checkins at python.org (hyeshik.chang) Date: Sun, 8 Oct 2006 16:01:45 +0200 (CEST) Subject: [Python-checkins] r52225 - in python/branches/release25-maint: Lib/test/test_multibytecodec.py Misc/NEWS Modules/cjkcodecs/_codecs_iso2022.c Message-ID: <20061008140145.C85701E4004@bag.python.org> Author: hyeshik.chang Date: Sun Oct 8 16:01:45 2006 New Revision: 52225 Modified: python/branches/release25-maint/Lib/test/test_multibytecodec.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/cjkcodecs/_codecs_iso2022.c Log: Backport from trunk r52223: Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP unicode characters. (Submitted by Ray Chason) Modified: python/branches/release25-maint/Lib/test/test_multibytecodec.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_multibytecodec.py (original) +++ python/branches/release25-maint/Lib/test/test_multibytecodec.py Sun Oct 8 16:01:45 2006 @@ -208,6 +208,16 @@ e = u'\u3406'.encode(encoding) self.failIf(filter(lambda x: x >= '\x80', e)) + def test_bug1572832(self): + if sys.maxunicode >= 0x10000: + myunichr = unichr + else: + myunichr = lambda x: unichr(0xD7C0+(x>>10)) + unichr(0xDC00+(x&0x3FF)) + + for x in xrange(0x10000, 0x110000): + # Any ISO 2022 codec will cause the segfault + myunichr(x).encode('iso_2022_jp', 'ignore') + def test_main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Test_MultibyteCodec)) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 8 16:01:45 2006 @@ -49,6 +49,9 @@ Extension Modules ----------------- +- Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault + when encoding non-BMP unicode characters. + - Bug #1556784: allow format strings longer than 127 characters in datetime's strftime function. Modified: python/branches/release25-maint/Modules/cjkcodecs/_codecs_iso2022.c ============================================================================== --- python/branches/release25-maint/Modules/cjkcodecs/_codecs_iso2022.c (original) +++ python/branches/release25-maint/Modules/cjkcodecs/_codecs_iso2022.c Sun Oct 8 16:01:45 2006 @@ -592,9 +592,11 @@ { DBCHAR coded; assert(*length == 1); - TRYMAP_ENC(cp949, coded, *data) - if (!(coded & 0x8000)) - return coded; + if (*data < 0x10000) { + TRYMAP_ENC(cp949, coded, *data) + if (!(coded & 0x8000)) + return coded; + } return MAP_UNMAPPABLE; } @@ -628,11 +630,13 @@ { DBCHAR coded; assert(*length == 1); - if (*data == 0xff3c) /* F/W REVERSE SOLIDUS */ - return 0x2140; - else TRYMAP_ENC(jisxcommon, coded, *data) { - if (!(coded & 0x8000)) - return coded; + if (*data < 0x10000) { + if (*data == 0xff3c) /* F/W REVERSE SOLIDUS */ + return 0x2140; + else TRYMAP_ENC(jisxcommon, coded, *data) { + if (!(coded & 0x8000)) + return coded; + } } return MAP_UNMAPPABLE; } @@ -665,9 +669,11 @@ { DBCHAR coded; assert(*length == 1); - TRYMAP_ENC(jisxcommon, coded, *data) { - if (coded & 0x8000) - return coded & 0x7fff; + if (*data < 0x10000) { + TRYMAP_ENC(jisxcommon, coded, *data) { + if (coded & 0x8000) + return coded & 0x7fff; + } } return MAP_UNMAPPABLE; } @@ -970,9 +976,11 @@ { DBCHAR coded; assert(*length == 1); - TRYMAP_ENC(gbcommon, coded, *data) { - if (!(coded & 0x8000)) - return coded; + if (*data < 0x10000) { + TRYMAP_ENC(gbcommon, coded, *data) { + if (!(coded & 0x8000)) + return coded; + } } return MAP_UNMAPPABLE; } From python-checkins at python.org Sun Oct 8 16:24:27 2006 From: python-checkins at python.org (hyeshik.chang) Date: Sun, 8 Oct 2006 16:24:27 +0200 (CEST) Subject: [Python-checkins] r52226 - python/branches/release24-maint/Misc/NEWS Message-ID: <20061008142427.48BEA1E4004@bag.python.org> Author: hyeshik.chang Date: Sun Oct 8 16:24:26 2006 New Revision: 52226 Modified: python/branches/release24-maint/Misc/NEWS Log: Move an old news entry about cjkcodecs to the right place; "Extension Modules". Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Sun Oct 8 16:24:26 2006 @@ -67,13 +67,6 @@ - Patch #1488312, Fix memory alignment problem on SPARC in unicode -- Fixed a few bugs in cjkcodecs: - - gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly. - - iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312 - codepoints to conform the standard. - - iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 2013:2 - codepoints now. - - fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments were transposed. @@ -83,6 +76,13 @@ - Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP unicode characters. +- Fixed a few bugs in cjkcodecs: + - gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly. + - iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312 + codepoints to conform the standard. + - iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 2013:2 + codepoints now. + - Bug #1556784: allow format strings longer than 127 characters in datetime's strftime function. From buildbot at python.org Sun Oct 8 18:09:20 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 16:09:20 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20061008160920.E44771E4004@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/58 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: hyeshik.chang Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 8 18:44:42 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 16:44:42 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk 2.4 Message-ID: <20061008164442.AE9561E4004@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%25202.4/builds/47 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: hyeshik.chang Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 8 19:11:07 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 17:11:07 +0000 Subject: [Python-checkins] buildbot warnings in PPC64 Debian 2.4 Message-ID: <20061008171108.055441E4004@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%2520Debian%25202.4/builds/99 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: hyeshik.chang Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sun Oct 8 19:37:58 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:37:58 +0200 (CEST) Subject: [Python-checkins] r52227 - python/trunk/Mac/BuildScript/scripts/postflight.documentation Message-ID: <20061008173758.DFE451E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:37:58 2006 New Revision: 52227 Modified: python/trunk/Mac/BuildScript/scripts/postflight.documentation Log: Add version number to the link to the python documentation in /Developer/Documentation/Python, better for users that install multiple versions of python. Modified: python/trunk/Mac/BuildScript/scripts/postflight.documentation ============================================================================== --- python/trunk/Mac/BuildScript/scripts/postflight.documentation (original) +++ python/trunk/Mac/BuildScript/scripts/postflight.documentation Sun Oct 8 19:37:58 2006 @@ -1,6 +1,5 @@ #!/bin/sh -# FIXME PYVER="@PYVER@" if [ -d /Developer/Documentation ]; then @@ -8,5 +7,5 @@ mkdir -p /Developer/Documentation/Python fi - ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation" + ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation @PYVER@" fi From python-checkins at python.org Sun Oct 8 19:38:48 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:38:48 +0200 (CEST) Subject: [Python-checkins] r52228 - python/branches/release25-maint/Mac/BuildScript/scripts/postflight.documentation Message-ID: <20061008173848.BC0B31E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:38:48 2006 New Revision: 52228 Modified: python/branches/release25-maint/Mac/BuildScript/scripts/postflight.documentation Log: Backport of r52227. Modified: python/branches/release25-maint/Mac/BuildScript/scripts/postflight.documentation ============================================================================== --- python/branches/release25-maint/Mac/BuildScript/scripts/postflight.documentation (original) +++ python/branches/release25-maint/Mac/BuildScript/scripts/postflight.documentation Sun Oct 8 19:38:48 2006 @@ -1,6 +1,5 @@ #!/bin/sh -# FIXME PYVER="@PYVER@" if [ -d /Developer/Documentation ]; then @@ -8,5 +7,5 @@ mkdir -p /Developer/Documentation/Python fi - ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation" + ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation @PYVER@" fi From python-checkins at python.org Sun Oct 8 19:40:02 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:40:02 +0200 (CEST) Subject: [Python-checkins] r52229 - python/trunk/Mac/PythonLauncher/FileSettings.m Message-ID: <20061008174002.F1D551E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:40:02 2006 New Revision: 52229 Modified: python/trunk/Mac/PythonLauncher/FileSettings.m Log: Fix for bug #1570284 Modified: python/trunk/Mac/PythonLauncher/FileSettings.m ============================================================================== --- python/trunk/Mac/PythonLauncher/FileSettings.m (original) +++ python/trunk/Mac/PythonLauncher/FileSettings.m Sun Oct 8 19:40:02 2006 @@ -207,7 +207,7 @@ [NSNumber numberWithBool: inspect], @"inspect", [NSNumber numberWithBool: optimize], @"optimize", [NSNumber numberWithBool: nosite], @"nosite", - [NSNumber numberWithBool: nosite], @"nosite", + [NSNumber numberWithBool: tabs], @"tabs", others, @"others", scriptargs, @"scriptargs", [NSNumber numberWithBool: with_terminal], @"with_terminal", @@ -235,7 +235,7 @@ if (value) optimize = [value boolValue]; value = [dict objectForKey: @"nosite"]; if (value) nosite = [value boolValue]; - value = [dict objectForKey: @"nosite"]; + value = [dict objectForKey: @"tabs"]; if (value) tabs = [value boolValue]; value = [dict objectForKey: @"others"]; if (value) others = [value retain]; @@ -291,7 +291,7 @@ tabs?" -t":"", others, [self _replaceSingleQuotes:script], - scriptargs, + scriptargs ? scriptargs : @"", with_terminal? "&& echo Exit status: $? && exit 1" : " &"]; } From python-checkins at python.org Sun Oct 8 19:40:52 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:40:52 +0200 (CEST) Subject: [Python-checkins] r52230 - python/branches/release25-maint/Mac/PythonLauncher/FileSettings.m Message-ID: <20061008174052.E4ADC1E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:40:52 2006 New Revision: 52230 Modified: python/branches/release25-maint/Mac/PythonLauncher/FileSettings.m Log: Backport of r52229 Modified: python/branches/release25-maint/Mac/PythonLauncher/FileSettings.m ============================================================================== --- python/branches/release25-maint/Mac/PythonLauncher/FileSettings.m (original) +++ python/branches/release25-maint/Mac/PythonLauncher/FileSettings.m Sun Oct 8 19:40:52 2006 @@ -207,7 +207,7 @@ [NSNumber numberWithBool: inspect], @"inspect", [NSNumber numberWithBool: optimize], @"optimize", [NSNumber numberWithBool: nosite], @"nosite", - [NSNumber numberWithBool: nosite], @"nosite", + [NSNumber numberWithBool: tabs], @"tabs", others, @"others", scriptargs, @"scriptargs", [NSNumber numberWithBool: with_terminal], @"with_terminal", @@ -235,7 +235,7 @@ if (value) optimize = [value boolValue]; value = [dict objectForKey: @"nosite"]; if (value) nosite = [value boolValue]; - value = [dict objectForKey: @"nosite"]; + value = [dict objectForKey: @"tabs"]; if (value) tabs = [value boolValue]; value = [dict objectForKey: @"others"]; if (value) others = [value retain]; @@ -291,7 +291,7 @@ tabs?" -t":"", others, [self _replaceSingleQuotes:script], - scriptargs, + scriptargs ? scriptargs : @"", with_terminal? "&& echo Exit status: $? && exit 1" : " &"]; } From python-checkins at python.org Sun Oct 8 19:41:34 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:41:34 +0200 (CEST) Subject: [Python-checkins] r52231 - in python/branches/release24-maint: Lib/distutils/sysconfig.py Lib/distutils/unixccompiler.py Lib/distutils/util.py Lib/idlelib/EditorWindow.py Lib/plat-mac/buildtools.py Lib/platform.py Lib/test/test_applesingle.py Mac/BuildScript Mac/BuildScript/README.txt Mac/BuildScript/build-installer.py Mac/BuildScript/ncurses-5.5.patch Mac/BuildScript/resources Mac/BuildScript/resources/ReadMe.txt Mac/BuildScript/resources/Welcome.rtf Mac/BuildScript/resources/background.jpg Mac/BuildScript/scripts Mac/BuildScript/scripts/postflight.documentation Mac/BuildScript/scripts/postflight.framework Mac/BuildScript/scripts/postflight.patch-profile Mac/Modules/carbonevt/CarbonEvtsupport.py Mac/Modules/carbonevt/_CarbonEvtmodule.c Mac/Modules/cf/_CFmodule.c Mac/Modules/cf/cfsupport.py Mac/Modules/cf/pycfbridge.c Mac/Modules/gestaltmodule.c Mac/OSX/Extras.install.py Mac/OSX/IDLE Mac/OSX/IDLE/IDLE.icns Mac/OSX/IDLE/Info.plist Mac/OSX/IDLE/Makefile.in Mac/OSX/IDLE/idlemain.py Mac/OSX/Makefile Mac/OSX/Makefile.in Mac/OSX/PythonLauncher/FileSettings.m Mac/OSX/PythonLauncher/Info.plist Mac/OSX/PythonLauncher/Makefile.in Mac/OSX/PythonLauncher/PythonCompiled.icns Mac/OSX/PythonLauncher/PythonInterpreter.icns Mac/OSX/PythonLauncher/PythonSource.icns Mac/OSX/PythonLauncher/PythonWSource.icns Mac/OSX/fixapplepython23.py Mac/OSX/pythonw.c Mac/OSXResources/app/Resources/PythonApplet.icns Mac/OSXResources/app/Resources/PythonInterpreter.icns Mac/scripts/BuildApplet.icns Makefile.pre.in Modules/expat/expat_config.h Modules/posixmodule.c Modules/socketmodule.c Modules/timemodule.c Python/mactoolboxglue.c README configure configure.in pyconfig.h.in setup.py Message-ID: <20061008174134.C53761E4009@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:41:25 2006 New Revision: 52231 Added: python/branches/release24-maint/Mac/BuildScript/ python/branches/release24-maint/Mac/BuildScript/README.txt python/branches/release24-maint/Mac/BuildScript/build-installer.py (contents, props changed) python/branches/release24-maint/Mac/BuildScript/ncurses-5.5.patch python/branches/release24-maint/Mac/BuildScript/resources/ python/branches/release24-maint/Mac/BuildScript/resources/ReadMe.txt python/branches/release24-maint/Mac/BuildScript/resources/Welcome.rtf python/branches/release24-maint/Mac/BuildScript/resources/background.jpg (contents, props changed) python/branches/release24-maint/Mac/BuildScript/scripts/ python/branches/release24-maint/Mac/BuildScript/scripts/postflight.documentation (contents, props changed) python/branches/release24-maint/Mac/BuildScript/scripts/postflight.framework (contents, props changed) python/branches/release24-maint/Mac/BuildScript/scripts/postflight.patch-profile (contents, props changed) python/branches/release24-maint/Mac/OSX/IDLE/ python/branches/release24-maint/Mac/OSX/IDLE/IDLE.icns (contents, props changed) python/branches/release24-maint/Mac/OSX/IDLE/Info.plist python/branches/release24-maint/Mac/OSX/IDLE/Makefile.in python/branches/release24-maint/Mac/OSX/IDLE/idlemain.py (contents, props changed) python/branches/release24-maint/Mac/OSX/Makefile.in - copied, changed from r46040, python/branches/release24-maint/Mac/OSX/Makefile python/branches/release24-maint/Mac/OSX/PythonLauncher/Info.plist python/branches/release24-maint/Mac/OSX/PythonLauncher/Makefile.in python/branches/release24-maint/Mac/OSX/pythonw.c python/branches/release24-maint/Modules/expat/expat_config.h (contents, props changed) Removed: python/branches/release24-maint/Mac/OSX/Makefile Modified: python/branches/release24-maint/Lib/distutils/sysconfig.py python/branches/release24-maint/Lib/distutils/unixccompiler.py python/branches/release24-maint/Lib/distutils/util.py python/branches/release24-maint/Lib/idlelib/EditorWindow.py python/branches/release24-maint/Lib/plat-mac/buildtools.py python/branches/release24-maint/Lib/platform.py python/branches/release24-maint/Lib/test/test_applesingle.py python/branches/release24-maint/Mac/Modules/carbonevt/CarbonEvtsupport.py python/branches/release24-maint/Mac/Modules/carbonevt/_CarbonEvtmodule.c python/branches/release24-maint/Mac/Modules/cf/_CFmodule.c python/branches/release24-maint/Mac/Modules/cf/cfsupport.py python/branches/release24-maint/Mac/Modules/cf/pycfbridge.c python/branches/release24-maint/Mac/Modules/gestaltmodule.c python/branches/release24-maint/Mac/OSX/Extras.install.py python/branches/release24-maint/Mac/OSX/PythonLauncher/FileSettings.m python/branches/release24-maint/Mac/OSX/PythonLauncher/PythonCompiled.icns python/branches/release24-maint/Mac/OSX/PythonLauncher/PythonInterpreter.icns python/branches/release24-maint/Mac/OSX/PythonLauncher/PythonSource.icns python/branches/release24-maint/Mac/OSX/PythonLauncher/PythonWSource.icns python/branches/release24-maint/Mac/OSX/fixapplepython23.py python/branches/release24-maint/Mac/OSXResources/app/Resources/PythonApplet.icns python/branches/release24-maint/Mac/OSXResources/app/Resources/PythonInterpreter.icns python/branches/release24-maint/Mac/scripts/BuildApplet.icns python/branches/release24-maint/Makefile.pre.in python/branches/release24-maint/Modules/posixmodule.c python/branches/release24-maint/Modules/socketmodule.c python/branches/release24-maint/Modules/timemodule.c python/branches/release24-maint/Python/mactoolboxglue.c python/branches/release24-maint/README python/branches/release24-maint/configure python/branches/release24-maint/configure.in python/branches/release24-maint/pyconfig.h.in python/branches/release24-maint/setup.py Log: Port of universal binary support for Mac OSX from python 2.5. This takes away the need for the out-of-tree universal binary support that was used to build the 2.4.3 installer. Missing here relative to that tree are some changes to IDLE, IMHO those patches aren't appropriate for the 2.4 branch and users are better of using 2.5's IDLE. Modified: python/branches/release24-maint/Lib/distutils/sysconfig.py ============================================================================== --- python/branches/release24-maint/Lib/distutils/sysconfig.py (original) +++ python/branches/release24-maint/Lib/distutils/sysconfig.py Sun Oct 8 19:41:25 2006 @@ -361,8 +361,8 @@ # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so # it needs to be compatible. # If it isn't set we set it to the configure-time value - if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'): - cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET'] + if sys.platform == 'darwin' and g.has_key('MACOSX_DEPLOYMENT_TARGET'): + cfg_target = g['MACOSX_DEPLOYMENT_TARGET'] cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '') if cur_target == '': cur_target = cfg_target @@ -495,6 +495,24 @@ _config_vars['prefix'] = PREFIX _config_vars['exec_prefix'] = EXEC_PREFIX + if sys.platform == 'darwin': + kernel_version = os.uname()[2] # Kernel version (8.4.3) + major_version = int(kernel_version.split('.')[0]) + + if major_version < 8: + # On Mac OS X before 10.4, check if -arch and -isysroot + # are in CFLAGS or LDFLAGS and remove them if they are. + # This is needed when building extensions on a 10.3 system + # using a universal build of python. + for key in ('LDFLAGS', 'BASECFLAGS', + # The values below are derived from the earlier ones, + # but subsitution has been by now. + 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + flags = _config_vars[key] + flags = re.sub('-arch\s+\w+\s', ' ', flags) + flags = re.sub('-isysroot [^ \t]*', ' ', flags) + _config_vars[key] = flags + if args: vals = [] for name in args: Modified: python/branches/release24-maint/Lib/distutils/unixccompiler.py ============================================================================== --- python/branches/release24-maint/Lib/distutils/unixccompiler.py (original) +++ python/branches/release24-maint/Lib/distutils/unixccompiler.py Sun Oct 8 19:41:25 2006 @@ -42,6 +42,49 @@ # should just happily stuff them into the preprocessor/compiler/linker # options and carry on. +def _darwin_compiler_fixup(compiler_so, cc_args): + """ + This function will strip '-isysroot PATH' and '-arch ARCH' from the + compile flag if the user has specified one of them in extra_compile_flags. + + This is needed because '-arch ARCH' adds another architecture to the + build, without a way to remove an architecture. Furthermore GCC will + barf if multiple '-isysroot' arguments are present. + """ + stripArch = stripSysroot = 0 + + compiler_so = list(compiler_so) + kernel_version = os.uname()[2] # 8.4.3 + major_version = int(kernel_version.split('.')[0]) + + if major_version < 8: + # OSX before 10.4.0, these don't support -arch and -isysroot at + # all. + stripArch = stripSysroot = True + else: + stripArch = '-arch' in cc_args + stripSysroot = '-isysroot' in cc_args + + if stripArch: + while 1: + try: + index = compiler_so.index('-arch') + # Strip this argument and the next one: + del compiler_so[index:index+2] + except ValueError: + break + + if stripSysroot: + try: + index = compiler_so.index('-isysroot') + # Strip this argument and the next one: + del compiler_so[index:index+2] + except ValueError: + pass + + return compiler_so + + class UnixCCompiler(CCompiler): compiler_type = 'unix' @@ -108,8 +151,11 @@ raise CompileError, msg def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + compiler_so = self.compiler_so + if sys.platform == 'darwin': + compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) try: - self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + + self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs) except DistutilsExecError, msg: raise CompileError, msg @@ -173,6 +219,10 @@ linker = self.linker_so[:] if target_lang == "c++" and self.compiler_cxx: linker[0] = self.compiler_cxx[0] + + if sys.platform == 'darwin': + linker = _darwin_compiler_fixup(linker, ld_args) + self.spawn(linker + ld_args) except DistutilsExecError, msg: raise LinkError, msg Modified: python/branches/release24-maint/Lib/distutils/util.py ============================================================================== --- python/branches/release24-maint/Lib/distutils/util.py (original) +++ python/branches/release24-maint/Lib/distutils/util.py Sun Oct 8 19:41:25 2006 @@ -67,6 +67,55 @@ m = rel_re.match(release) if m: release = m.group() + elif osname[:6] == "darwin": + # + # For our purposes, we'll assume that the system version from + # distutils' perspective is what MACOSX_DEPLOYMENT_TARGET is set + # to. This makes the compatibility story a bit more sane because the + # machine is going to compile and link as if it were + # MACOSX_DEPLOYMENT_TARGET. + from distutils.sysconfig import get_config_vars + cfgvars = get_config_vars() + + macver = os.environ.get('MACOSX_DEPLOYMENT_TARGET') + if not macver: + macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET') + + if not macver: + # Get the system version. Reading this plist is a documented + # way to get the system version (see the documentation for + # the Gestalt Manager) + try: + f = open('/System/Library/CoreServices/SystemVersion.plist') + except IOError: + # We're on a plain darwin box, fall back to the default + # behaviour. + pass + else: + m = re.search( + r'ProductUserVisibleVersion\s*' + + r'(.*?)', f.read()) + f.close() + if m is not None: + macver = '.'.join(m.group(1).split('.')[:2]) + # else: fall back to the default behaviour + + if macver: + from distutils.sysconfig import get_config_vars + release = macver + osname = 'macosx' + platver = os.uname()[2] + osmajor = int(platver.split('.')[0]) + + if osmajor >= 8 and \ + get_config_vars().get('UNIVERSALSDK', '').strip(): + # The universal build will build fat binaries, but not on + # systems before 10.4 + machine = 'fat' + + elif machine in ('PowerPC', 'Power_Macintosh'): + # Pick a sane name for the PPC architecture + machine = 'ppc' return "%s-%s-%s" % (osname, release, machine) Modified: python/branches/release24-maint/Lib/idlelib/EditorWindow.py ============================================================================== --- python/branches/release24-maint/Lib/idlelib/EditorWindow.py (original) +++ python/branches/release24-maint/Lib/idlelib/EditorWindow.py Sun Oct 8 19:41:25 2006 @@ -65,9 +65,16 @@ 'Python%d%d.chm' % sys.version_info[:2]) if os.path.isfile(chmfile): dochome = chmfile + + elif sys.platform == 'darwin': + dochome = os.path.join(sys.prefix, + 'Resources/English.lproj/Documentation/index.html') dochome = os.path.normpath(dochome) if os.path.isfile(dochome): EditorWindow.help_url = dochome + if sys.platform == 'darwin': + # Safari requires real file:-URLs + EditorWindow.help_url = 'file://' + EditorWindow.help_url else: EditorWindow.help_url = "http://www.python.org/doc/current" currentTheme=idleConf.CurrentTheme() Modified: python/branches/release24-maint/Lib/plat-mac/buildtools.py ============================================================================== --- python/branches/release24-maint/Lib/plat-mac/buildtools.py (original) +++ python/branches/release24-maint/Lib/plat-mac/buildtools.py Sun Oct 8 19:41:25 2006 @@ -293,6 +293,15 @@ dft_icnsname = os.path.join(sys.prefix, 'Resources/Python.app/Contents/Resources/PythonApplet.icns') if os.path.exists(dft_icnsname): icnsname = dft_icnsname + else: + # This part will work when we're in the build environment + import __main__ + dft_icnsname = os.path.join( + os.path.dirname(__main__.__file__), + 'PythonApplet.icns') + if os.paht.exists(dft_icnsname): + icnsname = dft_icnsname + if not os.path.exists(rsrcname): rsrcname = None if progress: Modified: python/branches/release24-maint/Lib/platform.py ============================================================================== --- python/branches/release24-maint/Lib/platform.py (original) +++ python/branches/release24-maint/Lib/platform.py Sun Oct 8 19:41:25 2006 @@ -601,7 +601,8 @@ versioninfo = (version,stage,nonrel) if sysa: machine = {0x1: '68k', - 0x2: 'PowerPC'}.get(sysa,'') + 0x2: 'PowerPC', + 0xa: 'i386'}.get(sysa,'') return release,versioninfo,machine def _java_getprop(name,default): Modified: python/branches/release24-maint/Lib/test/test_applesingle.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_applesingle.py (original) +++ python/branches/release24-maint/Lib/test/test_applesingle.py Sun Oct 8 19:41:25 2006 @@ -15,8 +15,8 @@ dataforkdata = 'hello\r\0world\n' resourceforkdata = 'goodbye\ncruel\0world\r' -applesingledata = struct.pack("ll16sh", AS_MAGIC, AS_VERSION, "foo", 2) + \ - struct.pack("llllll", 1, 50, len(dataforkdata), +applesingledata = struct.pack(">ll16sh", AS_MAGIC, AS_VERSION, "foo", 2) + \ + struct.pack(">llllll", 1, 50, len(dataforkdata), 2, 50+len(dataforkdata), len(resourceforkdata)) + \ dataforkdata + \ resourceforkdata Added: python/branches/release24-maint/Mac/BuildScript/README.txt ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/BuildScript/README.txt Sun Oct 8 19:41:25 2006 @@ -0,0 +1,35 @@ +Building a MacPython distribution +================================= + +The ``build-install.py`` script creates MacPython distributions, including +sleepycat db4, sqlite3 and readline support. It builds a complete +framework-based Python out-of-tree, installs it in a funny place with +$DESTROOT, massages that installation to remove .pyc files and such, creates +an Installer package from the installation plus other files in ``resources`` +and ``scripts`` and placed that on a ``.dmg`` disk image. + +Here are the steps you ned to follow to build a MacPython installer: + +- Run ``./build-installer.py``. Optionally you can pass a number of arguments + to specify locations of various files. Please see the top of + ``build-installer.py`` for its usage. +- When done the script will tell you where the DMG image is. + +The script needs to be run on Mac OS X 10.4 with Xcode 2.2 or later and +the 10.4u SDK. + +When all is done, announcements can be posted to at least the following +places: +- pythonmac-sig at python.org +- python-dev at python.org +- python-announce at python.org +- archivist at info-mac.org +- adcnews at apple.com +- news at macnn.com +- http://www.macupdate.com +- http://guide.apple.com/usindex.lasso +- http://www.apple.com/downloads/macosx/submit +- http://www.versiontracker.com/ (userid Jack.Jansen at oratrix.com) +- http://www.macshareware.net (userid jackjansen) + +Also, check out Stephan Deibels http://pythonology.org/market contact list Added: python/branches/release24-maint/Mac/BuildScript/build-installer.py ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/BuildScript/build-installer.py Sun Oct 8 19:41:25 2006 @@ -0,0 +1,1050 @@ +#!/usr/bin/python2.3 +""" +This script is used to build the "official unofficial" universal build on +Mac OS X. It requires Mac OS X 10.4, Xcode 2.2 and the 10.4u SDK to do its +work. + +Please ensure that this script keeps working with Python 2.3, to avoid +bootstrap issues (/usr/bin/python is Python 2.3 on OSX 10.4) + +Usage: see USAGE variable in the script. +""" +import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd + +INCLUDE_TIMESTAMP=1 +VERBOSE=1 + +from plistlib import Plist + +import MacOS +import Carbon.File +import Carbon.Icn +import Carbon.Res +from Carbon.Files import kCustomIconResource, fsRdWrPerm, kHasCustomIcon +from Carbon.Files import kFSCatInfoFinderInfo + +try: + from plistlib import writePlist +except ImportError: + # We're run using python2.3 + def writePlist(plist, path): + plist.write(path) + +def shellQuote(value): + """ + Return the string value in a form that can savely be inserted into + a shell command. + """ + return "'%s'"%(value.replace("'", "'\"'\"'")) + +def grepValue(fn, variable): + variable = variable + '=' + for ln in open(fn, 'r'): + if ln.startswith(variable): + value = ln[len(variable):].strip() + return value[1:-1] + +def getVersion(): + return grepValue(os.path.join(SRCDIR, 'configure'), 'PACKAGE_VERSION') + +def getFullVersion(): + fn = os.path.join(SRCDIR, 'Include', 'patchlevel.h') + for ln in open(fn): + if 'PY_VERSION' in ln: + return ln.split()[-1][1:-1] + + raise RuntimeError, "Cannot find full version??" + +# The directory we'll use to create the build, will be erased and recreated +WORKDIR="/tmp/_py" + +# The directory we'll use to store third-party sources, set this to something +# else if you don't want to re-fetch required libraries every time. +DEPSRC=os.path.join(WORKDIR, 'third-party') +DEPSRC=os.path.expanduser('~/Universal/other-sources') + +# Location of the preferred SDK +SDKPATH="/Developer/SDKs/MacOSX10.4u.sdk" +#SDKPATH="/" + +ARCHLIST=('i386', 'ppc',) + +# Source directory (asume we're in Mac/BuildScript) +SRCDIR=os.path.dirname( + os.path.dirname( + os.path.dirname( + os.path.abspath(__file__ + )))) + +USAGE=textwrap.dedent("""\ + Usage: build_python [options] + + Options: + -? or -h: Show this message + -b DIR + --build-dir=DIR: Create build here (default: %(WORKDIR)r) + --third-party=DIR: Store third-party sources here (default: %(DEPSRC)r) + --sdk-path=DIR: Location of the SDK (default: %(SDKPATH)r) + --src-dir=DIR: Location of the Python sources (default: %(SRCDIR)r) +""")% globals() + + +# Instructions for building libraries that are necessary for building a +# batteries included python. +LIBRARY_RECIPES=[ + dict( + name="Bzip2 1.0.3", + url="http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz", + configure=None, + install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( + shellQuote(os.path.join(WORKDIR, 'libraries')), + ' -arch '.join(ARCHLIST), + SDKPATH, + ), + ), + dict( + name="ZLib 1.2.3", + url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz", + configure=None, + install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( + shellQuote(os.path.join(WORKDIR, 'libraries')), + ' -arch '.join(ARCHLIST), + SDKPATH, + ), + ), + dict( + # Note that GNU readline is GPL'd software + name="GNU Readline 5.1.4", + url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" , + patchlevel='0', + patches=[ + # The readline maintainers don't do actual micro releases, but + # just ship a set of patches. + 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-001', + 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-002', + 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-003', + 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-004', + ] + ), + + dict( + name="NCurses 5.5", + url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz", + configure_pre=[ + "--without-cxx", + "--without-ada", + "--without-progs", + "--without-curses-h", + "--enable-shared", + "--with-shared", + "--datadir=/usr/share", + "--sysconfdir=/etc", + "--sharedstatedir=/usr/com", + "--with-terminfo-dirs=/usr/share/terminfo", + "--with-default-terminfo-dir=/usr/share/terminfo", + "--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib"%(getVersion(),), + "--enable-termcap", + ], + patches=[ + "ncurses-5.5.patch", + ], + useLDFlags=False, + install='make && make install DESTDIR=%s && cd %s/usr/local/lib && ln -fs ../../../Library/Frameworks/Python.framework/Versions/%s/lib/lib* .'%( + shellQuote(os.path.join(WORKDIR, 'libraries')), + shellQuote(os.path.join(WORKDIR, 'libraries')), + getVersion(), + ), + ), + dict( + name="Sleepycat DB 4.4", + url="http://downloads.sleepycat.com/db-4.4.20.tar.gz", + #name="Sleepycat DB 4.3.29", + #url="http://downloads.sleepycat.com/db-4.3.29.tar.gz", + buildDir="build_unix", + configure="../dist/configure", + configure_pre=[ + '--includedir=/usr/local/include/db4', + ] + ), +] + + +# Instructions for building packages inside the .mpkg. +PKG_RECIPES=[ + dict( + name="PythonFramework", + long_name="Python Framework", + source="/Library/Frameworks/Python.framework", + readme="""\ + This package installs Python.framework, that is the python + interpreter and the standard library. This also includes Python + wrappers for lots of Mac OS X API's. + """, + postflight="scripts/postflight.framework", + ), + dict( + name="PythonApplications", + long_name="GUI Applications", + source="/Applications/MacPython %(VER)s", + readme="""\ + This package installs IDLE (an interactive Python IDLE), + Python Launcher and Build Applet (create application bundles + from python scripts). + + It also installs a number of examples and demos. + """, + required=False, + ), + dict( + name="PythonUnixTools", + long_name="UNIX command-line tools", + source="/usr/local/bin", + readme="""\ + This package installs the unix tools in /usr/local/bin for + compatibility with older releases of MacPython. This package + is not necessary to use MacPython. + """, + required=False, + ), + dict( + name="PythonDocumentation", + long_name="Python Documentation", + topdir="/Library/Frameworks/Python.framework/Versions/%(VER)s/Resources/English.lproj/Documentation", + source="/pydocs", + readme="""\ + This package installs the python documentation at a location + that is useable for pydoc and IDLE. If you have installed Xcode + it will also install a link to the documentation in + /Developer/Documentation/Python + """, + postflight="scripts/postflight.documentation", + required=False, + ), + dict( + name="PythonProfileChanges", + long_name="Shell profile updater", + readme="""\ + This packages updates your shell profile to make sure that + the MacPython tools are found by your shell in preference of + the system provided Python tools. + + If you don't install this package you'll have to add + "/Library/Frameworks/Python.framework/Versions/%(VER)s/bin" + to your PATH by hand. + """, + postflight="scripts/postflight.patch-profile", + topdir="/Library/Frameworks/Python.framework", + source="/empty-dir", + required=False, + ), + dict( + name="PythonSystemFixes", + long_name="Fix system Python", + readme="""\ + This package updates the system python installation on + Mac OS X 10.3 to ensure that you can build new python extensions + using that copy of python after installing this version of + python. + """, + postflight="../OSX/fixapplepython23.py", + topdir="/Library/Frameworks/Python.framework", + source="/empty-dir", + required=False, + ) +] + +def fatal(msg): + """ + A fatal error, bail out. + """ + sys.stderr.write('FATAL: ') + sys.stderr.write(msg) + sys.stderr.write('\n') + sys.exit(1) + +def fileContents(fn): + """ + Return the contents of the named file + """ + return open(fn, 'rb').read() + +def runCommand(commandline): + """ + Run a command and raise RuntimeError if it fails. Output is surpressed + unless the command fails. + """ + fd = os.popen(commandline, 'r') + data = fd.read() + xit = fd.close() + if xit != None: + sys.stdout.write(data) + raise RuntimeError, "command failed: %s"%(commandline,) + + if VERBOSE: + sys.stdout.write(data); sys.stdout.flush() + +def captureCommand(commandline): + fd = os.popen(commandline, 'r') + data = fd.read() + xit = fd.close() + if xit != None: + sys.stdout.write(data) + raise RuntimeError, "command failed: %s"%(commandline,) + + return data + +def checkEnvironment(): + """ + Check that we're running on a supported system. + """ + + if platform.system() != 'Darwin': + fatal("This script should be run on a Mac OS X 10.4 system") + + if platform.release() <= '8.': + fatal("This script should be run on a Mac OS X 10.4 system") + + if not os.path.exists(SDKPATH): + fatal("Please install the latest version of Xcode and the %s SDK"%( + os.path.basename(SDKPATH[:-4]))) + + + +def parseOptions(args = None): + """ + Parse arguments and update global settings. + """ + global WORKDIR, DEPSRC, SDKPATH, SRCDIR + + if args is None: + args = sys.argv[1:] + + try: + options, args = getopt.getopt(args, '?hb', + [ 'build-dir=', 'third-party=', 'sdk-path=' , 'src-dir=']) + except getopt.error, msg: + print msg + sys.exit(1) + + if args: + print "Additional arguments" + sys.exit(1) + + for k, v in options: + if k in ('-h', '-?'): + print USAGE + sys.exit(0) + + elif k in ('-d', '--build-dir'): + WORKDIR=v + + elif k in ('--third-party',): + DEPSRC=v + + elif k in ('--sdk-path',): + SDKPATH=v + + elif k in ('--src-dir',): + SRCDIR=v + + else: + raise NotImplementedError, k + + SRCDIR=os.path.abspath(SRCDIR) + WORKDIR=os.path.abspath(WORKDIR) + SDKPATH=os.path.abspath(SDKPATH) + DEPSRC=os.path.abspath(DEPSRC) + + print "Settings:" + print " * Source directory:", SRCDIR + print " * Build directory: ", WORKDIR + print " * SDK location: ", SDKPATH + print " * third-party source:", DEPSRC + print "" + + + + +def extractArchive(builddir, archiveName): + """ + Extract a source archive into 'builddir'. Returns the path of the + extracted archive. + + XXX: This function assumes that archives contain a toplevel directory + that is has the same name as the basename of the archive. This is + save enough for anything we use. + """ + curdir = os.getcwd() + try: + os.chdir(builddir) + if archiveName.endswith('.tar.gz'): + retval = os.path.basename(archiveName[:-7]) + if os.path.exists(retval): + shutil.rmtree(retval) + fp = os.popen("tar zxf %s 2>&1"%(shellQuote(archiveName),), 'r') + + elif archiveName.endswith('.tar.bz2'): + retval = os.path.basename(archiveName[:-8]) + if os.path.exists(retval): + shutil.rmtree(retval) + fp = os.popen("tar jxf %s 2>&1"%(shellQuote(archiveName),), 'r') + + elif archiveName.endswith('.tar'): + retval = os.path.basename(archiveName[:-4]) + if os.path.exists(retval): + shutil.rmtree(retval) + fp = os.popen("tar xf %s 2>&1"%(shellQuote(archiveName),), 'r') + + elif archiveName.endswith('.zip'): + retval = os.path.basename(archiveName[:-4]) + if os.path.exists(retval): + shutil.rmtree(retval) + fp = os.popen("unzip %s 2>&1"%(shellQuote(archiveName),), 'r') + + data = fp.read() + xit = fp.close() + if xit is not None: + sys.stdout.write(data) + raise RuntimeError, "Cannot extract %s"%(archiveName,) + + return os.path.join(builddir, retval) + + finally: + os.chdir(curdir) + +KNOWNSIZES = { + "http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz": 7952742, + "http://downloads.sleepycat.com/db-4.4.20.tar.gz": 2030276, +} + +def downloadURL(url, fname): + """ + Download the contents of the url into the file. + """ + try: + size = os.path.getsize(fname) + except OSError: + pass + else: + if KNOWNSIZES.get(url) == size: + print "Using existing file for", url + return + fpIn = urllib2.urlopen(url) + fpOut = open(fname, 'wb') + block = fpIn.read(10240) + try: + while block: + fpOut.write(block) + block = fpIn.read(10240) + fpIn.close() + fpOut.close() + except: + try: + os.unlink(fname) + except: + pass + +def buildRecipe(recipe, basedir, archList): + """ + Build software using a recipe. This function does the + 'configure;make;make install' dance for C software, with a possibility + to customize this process, basically a poor-mans DarwinPorts. + """ + curdir = os.getcwd() + + name = recipe['name'] + url = recipe['url'] + configure = recipe.get('configure', './configure') + install = recipe.get('install', 'make && make install DESTDIR=%s'%( + shellQuote(basedir))) + + archiveName = os.path.split(url)[-1] + sourceArchive = os.path.join(DEPSRC, archiveName) + + if not os.path.exists(DEPSRC): + os.mkdir(DEPSRC) + + + if os.path.exists(sourceArchive): + print "Using local copy of %s"%(name,) + + else: + print "Downloading %s"%(name,) + downloadURL(url, sourceArchive) + print "Archive for %s stored as %s"%(name, sourceArchive) + + print "Extracting archive for %s"%(name,) + buildDir=os.path.join(WORKDIR, '_bld') + if not os.path.exists(buildDir): + os.mkdir(buildDir) + + workDir = extractArchive(buildDir, sourceArchive) + os.chdir(workDir) + if 'buildDir' in recipe: + os.chdir(recipe['buildDir']) + + + for fn in recipe.get('patches', ()): + if fn.startswith('http://'): + # Download the patch before applying it. + path = os.path.join(DEPSRC, os.path.basename(fn)) + downloadURL(fn, path) + fn = path + + fn = os.path.join(curdir, fn) + runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1), + shellQuote(fn),)) + + if configure is not None: + configure_args = [ + "--prefix=/usr/local", + "--enable-static", + "--disable-shared", + #"CPP=gcc -arch %s -E"%(' -arch '.join(archList,),), + ] + + if 'configure_pre' in recipe: + args = list(recipe['configure_pre']) + if '--disable-static' in args: + configure_args.remove('--enable-static') + if '--enable-shared' in args: + configure_args.remove('--disable-shared') + configure_args.extend(args) + + if recipe.get('useLDFlags', 1): + configure_args.extend([ + "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%( + ' -arch '.join(archList), + shellQuote(SDKPATH)[1:-1], + shellQuote(basedir)[1:-1],), + "LDFLAGS=-syslibroot,%s -L%s/usr/local/lib -arch %s"%( + shellQuote(SDKPATH)[1:-1], + shellQuote(basedir)[1:-1], + ' -arch '.join(archList)), + ]) + else: + configure_args.extend([ + "CFLAGS=-arch %s -isysroot %s -I%s/usr/local/include"%( + ' -arch '.join(archList), + shellQuote(SDKPATH)[1:-1], + shellQuote(basedir)[1:-1],), + ]) + + if 'configure_post' in recipe: + configure_args = configure_args = list(recipe['configure_post']) + + configure_args.insert(0, configure) + configure_args = [ shellQuote(a) for a in configure_args ] + + print "Running configure for %s"%(name,) + runCommand(' '.join(configure_args) + ' 2>&1') + + print "Running install for %s"%(name,) + runCommand('{ ' + install + ' ;} 2>&1') + + print "Done %s"%(name,) + print "" + + os.chdir(curdir) + +def buildLibraries(): + """ + Build our dependencies into $WORKDIR/libraries/usr/local + """ + print "" + print "Building required libraries" + print "" + universal = os.path.join(WORKDIR, 'libraries') + os.mkdir(universal) + os.makedirs(os.path.join(universal, 'usr', 'local', 'lib')) + os.makedirs(os.path.join(universal, 'usr', 'local', 'include')) + + for recipe in LIBRARY_RECIPES: + buildRecipe(recipe, universal, ARCHLIST) + + + +def buildPythonDocs(): + # This stores the documentation as Resources/English.lproj/Docuentation + # inside the framwork. pydoc and IDLE will pick it up there. + print "Install python documentation" + rootDir = os.path.join(WORKDIR, '_root') + version = getVersion() + docdir = os.path.join(rootDir, 'pydocs') + + name = 'html-%s.tar.bz2'%(getFullVersion(),) + sourceArchive = os.path.join(DEPSRC, name) + if os.path.exists(sourceArchive): + print "Using local copy of %s"%(name,) + + else: + print "Downloading %s"%(name,) + downloadURL('http://www.python.org/ftp/python/doc/%s/%s'%( + getFullVersion(), name), sourceArchive) + print "Archive for %s stored as %s"%(name, sourceArchive) + + extractArchive(os.path.dirname(docdir), sourceArchive) + os.rename( + os.path.join( + os.path.dirname(docdir), 'Python-Docs-%s'%(getFullVersion(),)), + docdir) + + +def buildPython(): + print "Building a universal python" + + buildDir = os.path.join(WORKDIR, '_bld', 'python') + rootDir = os.path.join(WORKDIR, '_root') + + if os.path.exists(buildDir): + shutil.rmtree(buildDir) + if os.path.exists(rootDir): + shutil.rmtree(rootDir) + os.mkdir(buildDir) + os.mkdir(rootDir) + os.mkdir(os.path.join(rootDir, 'empty-dir')) + curdir = os.getcwd() + os.chdir(buildDir) + + # Not sure if this is still needed, the original build script + # claims that parts of the install assume python.exe exists. + os.symlink('python', os.path.join(buildDir, 'python.exe')) + + # Extract the version from the configure file, needed to calculate + # several paths. + version = getVersion() + + print "Running configure..." + runCommand("%s -C --enable-framework --enable-universalsdk=%s LDFLAGS='-g -L%s/libraries/usr/local/lib' OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%( + shellQuote(os.path.join(SRCDIR, 'configure')), + shellQuote(SDKPATH), shellQuote(WORKDIR)[1:-1], + shellQuote(WORKDIR)[1:-1])) + + print "Running make" + runCommand("make") + + print "Runing make frameworkinstall" + runCommand("make frameworkinstall DESTDIR=%s"%( + shellQuote(rootDir))) + + print "Runing make frameworkinstallextras" + runCommand("make frameworkinstallextras DESTDIR=%s"%( + shellQuote(rootDir))) + + print "Copy required shared libraries" + if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')): + runCommand("mv %s/* %s"%( + shellQuote(os.path.join( + WORKDIR, 'libraries', 'Library', 'Frameworks', + 'Python.framework', 'Versions', getVersion(), + 'lib')), + shellQuote(os.path.join(WORKDIR, '_root', 'Library', 'Frameworks', + 'Python.framework', 'Versions', getVersion(), + 'lib')))) + + print "Fix file modes" + frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework') + for dirpath, dirnames, filenames in os.walk(frmDir): + for dn in dirnames: + os.chmod(os.path.join(dirpath, dn), 0775) + + for fn in filenames: + if os.path.islink(fn): + continue + + # "chmod g+w $fn" + p = os.path.join(dirpath, fn) + st = os.stat(p) + os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP) + + # We added some directories to the search path during the configure + # phase. Remove those because those directories won't be there on + # the end-users system. + path =os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework', + 'Versions', version, 'lib', 'python%s'%(version,), + 'config', 'Makefile') + fp = open(path, 'r') + data = fp.read() + fp.close() + + data = data.replace('-L%s/libraries/usr/local/lib'%(WORKDIR,), '') + data = data.replace('-I%s/libraries/usr/local/include'%(WORKDIR,), '') + fp = open(path, 'w') + fp.write(data) + fp.close() + + # Add symlinks in /usr/local/bin, using relative links + usr_local_bin = os.path.join(rootDir, 'usr', 'local', 'bin') + to_framework = os.path.join('..', '..', '..', 'Library', 'Frameworks', + 'Python.framework', 'Versions', version, 'bin') + if os.path.exists(usr_local_bin): + shutil.rmtree(usr_local_bin) + os.makedirs(usr_local_bin) + for fn in os.listdir( + os.path.join(frmDir, 'Versions', version, 'bin')): + os.symlink(os.path.join(to_framework, fn), + os.path.join(usr_local_bin, fn)) + + os.chdir(curdir) + + + +def patchFile(inPath, outPath): + data = fileContents(inPath) + data = data.replace('$FULL_VERSION', getFullVersion()) + data = data.replace('$VERSION', getVersion()) + data = data.replace('$MACOSX_DEPLOYMENT_TARGET', '10.3 or later') + data = data.replace('$ARCHITECTURES', "i386, ppc") + data = data.replace('$INSTALL_SIZE', installSize()) + + # This one is not handy as a template variable + data = data.replace('$PYTHONFRAMEWORKINSTALLDIR', '/Library/Frameworks/Python.framework') + fp = open(outPath, 'wb') + fp.write(data) + fp.close() + +def patchScript(inPath, outPath): + data = fileContents(inPath) + data = data.replace('@PYVER@', getVersion()) + fp = open(outPath, 'wb') + fp.write(data) + fp.close() + os.chmod(outPath, 0755) + + + +def packageFromRecipe(targetDir, recipe): + curdir = os.getcwd() + try: + # The major version (such as 2.5) is included in the pacakge name + # because haveing two version of python installed at the same time is + # common. + pkgname = '%s-%s'%(recipe['name'], getVersion()) + srcdir = recipe.get('source') + pkgroot = recipe.get('topdir', srcdir) + postflight = recipe.get('postflight') + readme = textwrap.dedent(recipe['readme']) + isRequired = recipe.get('required', True) + + print "- building package %s"%(pkgname,) + + # Substitute some variables + textvars = dict( + VER=getVersion(), + FULLVER=getFullVersion(), + ) + readme = readme % textvars + + if pkgroot is not None: + pkgroot = pkgroot % textvars + else: + pkgroot = '/' + + if srcdir is not None: + srcdir = os.path.join(WORKDIR, '_root', srcdir[1:]) + srcdir = srcdir % textvars + + if postflight is not None: + postflight = os.path.abspath(postflight) + + packageContents = os.path.join(targetDir, pkgname + '.pkg', 'Contents') + os.makedirs(packageContents) + + if srcdir is not None: + os.chdir(srcdir) + runCommand("pax -wf %s . 2>&1"%(shellQuote(os.path.join(packageContents, 'Archive.pax')),)) + runCommand("gzip -9 %s 2>&1"%(shellQuote(os.path.join(packageContents, 'Archive.pax')),)) + runCommand("mkbom . %s 2>&1"%(shellQuote(os.path.join(packageContents, 'Archive.bom')),)) + + fn = os.path.join(packageContents, 'PkgInfo') + fp = open(fn, 'w') + fp.write('pmkrpkg1') + fp.close() + + rsrcDir = os.path.join(packageContents, "Resources") + os.mkdir(rsrcDir) + fp = open(os.path.join(rsrcDir, 'ReadMe.txt'), 'w') + fp.write(readme) + fp.close() + + if postflight is not None: + patchScript(postflight, os.path.join(rsrcDir, 'postflight')) + + vers = getFullVersion() + major, minor = map(int, getVersion().split('.', 2)) + pl = Plist( + CFBundleGetInfoString="MacPython.%s %s"%(pkgname, vers,), + CFBundleIdentifier='org.python.MacPython.%s'%(pkgname,), + CFBundleName='MacPython.%s'%(pkgname,), + CFBundleShortVersionString=vers, + IFMajorVersion=major, + IFMinorVersion=minor, + IFPkgFormatVersion=0.10000000149011612, + IFPkgFlagAllowBackRev=False, + IFPkgFlagAuthorizationAction="RootAuthorization", + IFPkgFlagDefaultLocation=pkgroot, + IFPkgFlagFollowLinks=True, + IFPkgFlagInstallFat=True, + IFPkgFlagIsRequired=isRequired, + IFPkgFlagOverwritePermissions=False, + IFPkgFlagRelocatable=False, + IFPkgFlagRestartAction="NoRestart", + IFPkgFlagRootVolumeOnly=True, + IFPkgFlagUpdateInstalledLangauges=False, + ) + writePlist(pl, os.path.join(packageContents, 'Info.plist')) + + pl = Plist( + IFPkgDescriptionDescription=readme, + IFPkgDescriptionTitle=recipe.get('long_name', "MacPython.%s"%(pkgname,)), + IFPkgDescriptionVersion=vers, + ) + writePlist(pl, os.path.join(packageContents, 'Resources', 'Description.plist')) + + finally: + os.chdir(curdir) + + +def makeMpkgPlist(path): + + vers = getFullVersion() + major, minor = map(int, getVersion().split('.', 2)) + + pl = Plist( + CFBundleGetInfoString="MacPython %s"%(vers,), + CFBundleIdentifier='org.python.MacPython', + CFBundleName='MacPython', + CFBundleShortVersionString=vers, + IFMajorVersion=major, + IFMinorVersion=minor, + IFPkgFlagComponentDirectory="Contents/Packages", + IFPkgFlagPackageList=[ + dict( + IFPkgFlagPackageLocation='%s-%s.pkg'%(item['name'], getVersion()), + IFPkgFlagPackageSelection='selected' + ) + for item in PKG_RECIPES + ], + IFPkgFormatVersion=0.10000000149011612, + IFPkgFlagBackgroundScaling="proportional", + IFPkgFlagBackgroundAlignment="left", + IFPkgFlagAuthorizationAction="RootAuthorization", + ) + + writePlist(pl, path) + + +def buildInstaller(): + + # Zap all compiled files + for dirpath, _, filenames in os.walk(os.path.join(WORKDIR, '_root')): + for fn in filenames: + if fn.endswith('.pyc') or fn.endswith('.pyo'): + os.unlink(os.path.join(dirpath, fn)) + + outdir = os.path.join(WORKDIR, 'installer') + if os.path.exists(outdir): + shutil.rmtree(outdir) + os.mkdir(outdir) + + pkgroot = os.path.join(outdir, 'MacPython.mpkg', 'Contents') + pkgcontents = os.path.join(pkgroot, 'Packages') + os.makedirs(pkgcontents) + for recipe in PKG_RECIPES: + packageFromRecipe(pkgcontents, recipe) + + rsrcDir = os.path.join(pkgroot, 'Resources') + + fn = os.path.join(pkgroot, 'PkgInfo') + fp = open(fn, 'w') + fp.write('pmkrpkg1') + fp.close() + + os.mkdir(rsrcDir) + + makeMpkgPlist(os.path.join(pkgroot, 'Info.plist')) + pl = Plist( + IFPkgDescriptionTitle="Universal MacPython", + IFPkgDescriptionVersion=getVersion(), + ) + + writePlist(pl, os.path.join(pkgroot, 'Resources', 'Description.plist')) + for fn in os.listdir('resources'): + if fn == '.svn': continue + if fn.endswith('.jpg'): + shutil.copy(os.path.join('resources', fn), os.path.join(rsrcDir, fn)) + else: + patchFile(os.path.join('resources', fn), os.path.join(rsrcDir, fn)) + + shutil.copy("../../LICENSE", os.path.join(rsrcDir, 'License.txt')) + + +def installSize(clear=False, _saved=[]): + if clear: + del _saved[:] + if not _saved: + data = captureCommand("du -ks %s"%( + shellQuote(os.path.join(WORKDIR, '_root')))) + _saved.append("%d"%((0.5 + (int(data.split()[0]) / 1024.0)),)) + return _saved[0] + + +def buildDMG(): + """ + Create DMG containing the rootDir + """ + outdir = os.path.join(WORKDIR, 'diskimage') + if os.path.exists(outdir): + shutil.rmtree(outdir) + + imagepath = os.path.join(outdir, + 'python-%s-macosx'%(getFullVersion(),)) + if INCLUDE_TIMESTAMP: + imagepath = imagepath + '%04d-%02d-%02d'%(time.localtime()[:3]) + imagepath = imagepath + '.dmg' + + os.mkdir(outdir) + time.sleep(1) + runCommand("hdiutil create -volname 'Univeral MacPython %s' -srcfolder %s %s"%( + getFullVersion(), + shellQuote(os.path.join(WORKDIR, 'installer')), + shellQuote(imagepath))) + + return imagepath + + +def setIcon(filePath, icnsPath): + """ + Set the custom icon for the specified file or directory. + + For a directory the icon data is written in a file named 'Icon\r' inside + the directory. For both files and directories write the icon as an 'icns' + resource. Furthermore set kHasCustomIcon in the finder flags for filePath. + """ + ref, isDirectory = Carbon.File.FSPathMakeRef(icnsPath) + icon = Carbon.Icn.ReadIconFile(ref) + del ref + + # + # Open the resource fork of the target, to add the icon later on. + # For directories we use the file 'Icon\r' inside the directory. + # + + ref, isDirectory = Carbon.File.FSPathMakeRef(filePath) + + if isDirectory: + # There is a problem with getting this into the pax(1) archive, + # just ignore directory icons for now. + return + + tmpPath = os.path.join(filePath, "Icon\r") + if not os.path.exists(tmpPath): + fp = open(tmpPath, 'w') + fp.close() + + tmpRef, _ = Carbon.File.FSPathMakeRef(tmpPath) + spec = Carbon.File.FSSpec(tmpRef) + + else: + spec = Carbon.File.FSSpec(ref) + + try: + Carbon.Res.HCreateResFile(*spec.as_tuple()) + except MacOS.Error: + pass + + # Try to create the resource fork again, this will avoid problems + # when adding an icon to a directory. I have no idea why this helps, + # but without this adding the icon to a directory will fail sometimes. + try: + Carbon.Res.HCreateResFile(*spec.as_tuple()) + except MacOS.Error: + pass + + refNum = Carbon.Res.FSpOpenResFile(spec, fsRdWrPerm) + + Carbon.Res.UseResFile(refNum) + + # Check if there already is an icon, remove it if there is. + try: + h = Carbon.Res.Get1Resource('icns', kCustomIconResource) + except MacOS.Error: + pass + + else: + h.RemoveResource() + del h + + # Add the icon to the resource for of the target + res = Carbon.Res.Resource(icon) + res.AddResource('icns', kCustomIconResource, '') + res.WriteResource() + res.DetachResource() + Carbon.Res.CloseResFile(refNum) + + # And now set the kHasCustomIcon property for the target. Annoyingly, + # python doesn't seem to have bindings for the API that is needed for + # this. Cop out and call SetFile + os.system("/Developer/Tools/SetFile -a C %s"%( + shellQuote(filePath),)) + + if isDirectory: + os.system('/Developer/Tools/SetFile -a V %s'%( + shellQuote(tmpPath), + )) + +def main(): + # First parse options and check if we can perform our work + parseOptions() + checkEnvironment() + + os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.3' + + if os.path.exists(WORKDIR): + shutil.rmtree(WORKDIR) + os.mkdir(WORKDIR) + + # Then build third-party libraries such as sleepycat DB4. + buildLibraries() + + # Now build python itself + buildPython() + buildPythonDocs() + fn = os.path.join(WORKDIR, "_root", "Applications", + "MacPython %s"%(getVersion(),), "Update Shell Profile.command") + patchFile("scripts/postflight.patch-profile", fn) + os.chmod(fn, 0755) + + folder = os.path.join(WORKDIR, "_root", "Applications", "MacPython %s"%( + getVersion(),)) + os.chmod(folder, 0755) + #setIcon(folder, "../Icons/Python Folder.icns") + + # Create the installer + buildInstaller() + + # And copy the readme into the directory containing the installer + patchFile('resources/ReadMe.txt', os.path.join(WORKDIR, 'installer', 'ReadMe.txt')) + + # Ditto for the license file. + shutil.copy('../../LICENSE', os.path.join(WORKDIR, 'installer', 'License.txt')) + + fp = open(os.path.join(WORKDIR, 'installer', 'Build.txt'), 'w') + print >> fp, "# BUILD INFO" + print >> fp, "# Date:", time.ctime() + print >> fp, "# By:", pwd.getpwuid(os.getuid()).pw_gecos + fp.close() + + # Custom icon for the DMG, shown when the DMG is mounted. + #shutil.copy("../Icons/Disk Image.icns", + # os.path.join(WORKDIR, "installer", ".VolumeIcon.icns")) + #os.system("/Developer/Tools/SetFile -a C %s"%( + # os.path.join(WORKDIR, "installer", ".VolumeIcon.icns"))) + + + # And copy it to a DMG + buildDMG() + + +if __name__ == "__main__": + main() Added: python/branches/release24-maint/Mac/BuildScript/ncurses-5.5.patch ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/BuildScript/ncurses-5.5.patch Sun Oct 8 19:41:25 2006 @@ -0,0 +1,36 @@ +diff -r -u ncurses-5.5-orig/test/Makefile.in ncurses-5.5/test/Makefile.in +--- ncurses-5.5-orig/test/Makefile.in 2006-03-24 12:47:40.000000000 +0100 ++++ ncurses-5.5/test/Makefile.in 2006-03-24 12:47:50.000000000 +0100 +@@ -75,7 +75,7 @@ + MATH_LIB = @MATH_LIB@ + + LD = @LD@ +-LINK = @LINK_TESTS@ $(LIBTOOL_LINK) $(CC) $(CFLAGS) ++LINK = @LINK_TESTS@ $(LIBTOOL_LINK) $(CC) + + usFLAGS = @LD_MODEL@ @LOCAL_LDFLAGS@ @LDFLAGS@ + +diff -ru ncurses-5.5-orig/ncurses/tinfo/read_entry.c ncurses-5.5/ncurses/tinfo/read_entry.c +--- ncurses-5.5-orig/ncurses/tinfo/read_entry.c 2004-01-11 02:57:05.000000000 +0100 ++++ ncurses-5.5/ncurses/tinfo/read_entry.c 2006-03-25 22:49:39.000000000 +0100 +@@ -474,7 +474,7 @@ + } + + /* truncate the terminal name to prevent buffer overflow */ +- (void) sprintf(ttn, "%c/%.*s", *tn, (int) sizeof(ttn) - 3, tn); ++ (void) sprintf(ttn, "%x/%.*s", *tn, (int) sizeof(ttn) - 3, tn); + + /* This is System V behavior, in conjunction with our requirements for + * writing terminfo entries. +diff -ru ncurses-5.5-orig/configure ncurses-5.5/configure +--- ncurses-5.5-orig/configure 2005-09-24 23:50:50.000000000 +0200 ++++ ncurses-5.5/configure 2006-03-26 22:24:59.000000000 +0200 +@@ -5027,7 +5027,7 @@ + darwin*) + EXTRA_CFLAGS="-no-cpp-precomp" + CC_SHARED_OPTS="-dynamic" +- MK_SHARED_LIB='$(CC) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $@` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $@' ++ MK_SHARED_LIB='$(CC) $(CFLAGS) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $@` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $@' + test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi + cf_cv_shlib_version_infix=yes + ;; Added: python/branches/release24-maint/Mac/BuildScript/resources/ReadMe.txt ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/BuildScript/resources/ReadMe.txt Sun Oct 8 19:41:25 2006 @@ -0,0 +1,31 @@ +This package will install MacPython $FULL_VERSION for Mac OS X +$MACOSX_DEPLOYMENT_TARGET for the following +architecture(s): $ARCHITECTURES. + +Separate installers are available for older versions +of Mac OS X, see the homepage, below. + +Installation requires approximately $INSTALL_SIZE MB of disk +space, ignore the message that it will take zero bytes. + +You must install onto your current boot disk, even +though the installer does not enforce this, otherwise +things will not work. + +MacPython consists of the Python programming language +interpreter, plus a set of programs to allow easy +access to it for Mac users (an integrated development +environment, an applet builder), plus a set of pre-built +extension modules that open up specific Macintosh technologies +to Python programs (Carbon, AppleScript, Quicktime, more). + +The installer puts the applications in "MacPython $VERSION" +in your Applications folder, command-line tools in +/usr/local/bin and the underlying machinery in +$PYTHONFRAMEWORKINSTALLDIR. + +More information on MacPython can be found at +http://www.cwi.nl/~jack/macpython and +http://pythonmac.org/. More information on +Python in general can be found at +http://www.python.org. Added: python/branches/release24-maint/Mac/BuildScript/resources/Welcome.rtf ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/BuildScript/resources/Welcome.rtf Sun Oct 8 19:41:25 2006 @@ -0,0 +1,15 @@ +{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf330 +{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;} +{\colortbl;\red255\green255\blue255;} +\paperw11900\paperh16840\margl1440\margr1440\vieww9920\viewh10660\viewkind0 +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural + +\f0\fs24 \cf0 This package will install +\f1\b MacPython $FULL_VERSION +\f0\b0 for +\f1\b Mac OS X $MACOSX_DEPLOYMENT_TARGET +\f0\b0 .\ +\ +MacPython consists of the Python programming language interpreter, plus a set of programs to allow easy access to it for Mac users (an integrated development environment, an applet builder), plus a set of pre-built extension modules that open up specific Macintosh technologies to Python programs (Carbon, AppleScript, Quicktime, more).\ +\ +See the ReadMe file for more information.} \ No newline at end of file Added: python/branches/release24-maint/Mac/BuildScript/resources/background.jpg ============================================================================== Binary file. No diff available. Added: python/branches/release24-maint/Mac/BuildScript/scripts/postflight.documentation ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/BuildScript/scripts/postflight.documentation Sun Oct 8 19:41:25 2006 @@ -0,0 +1,12 @@ +#!/bin/sh + +# FIXME +PYVER="@PYVER@" + +if [ -d /Developer/Documentation ]; then + if [ ! -d /Developer/Documentation/Python ]; then + mkdir -p /Developer/Documentation/Python + fi + + ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation @PYVER@" +fi Added: python/branches/release24-maint/Mac/BuildScript/scripts/postflight.framework ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/BuildScript/scripts/postflight.framework Sun Oct 8 19:41:25 2006 @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Recompile the .py files. +# + +PYVER="@PYVER@" +FWK="/Library/Frameworks/Python.framework/Versions/@PYVER@/" + +"${FWK}/bin/python" -Wi -tt \ + "${FWK}/lib/python${PYVER}/compileall.py" \ + -x badsyntax -x site-packages \ + "${FWK}/lib/python${PYVER}" + +"${FWK}/bin/python" -Wi -tt -O \ + "${FWK}/lib/python${PYVER}/compileall.py" \ + -x badsyntax -x site-packages \ + "${FWK}/lib/python${PYVER}" + +"${FWK}/bin/python" -Wi -tt \ + "${FWK}/lib/python${PYVER}/compileall.py" \ + -x badsyntax -x site-packages \ + "${FWK}/Mac/Tools" + +"${FWK}/bin/python" -Wi -tt -O \ + "${FWK}/lib/python${PYVER}/compileall.py" \ + -x badsyntax -x site-packages \ + "${FWK}/Mac/Tools" + + +chown -R admin "${FWK}" +chmod -R g+w "${FWK}" + +exit 0 Added: python/branches/release24-maint/Mac/BuildScript/scripts/postflight.patch-profile ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/BuildScript/scripts/postflight.patch-profile Sun Oct 8 19:41:25 2006 @@ -0,0 +1,71 @@ +#!/bin/sh + +echo "This script will update your shell profile when the 'bin' directory" +echo "of python is not early enough of the PATH of your shell." +echo "These changes will be effective only in shell windows that you open" +echo "after running this script." + +PYVER=@PYVER@ +PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/Current" + +# Make sure the directory ${PYTHON_ROOT}/bin is on the users PATH. +BSH="`basename "${SHELL}"`" +case "${BSH}" in +bash|ksh|sh|*csh) + P="`${SHELL} -c 'echo $PATH'`" + ;; +*) + echo "Sorry, I don't know how to patch $BSH shells" + exit 0 + ;; +esac + +# Now ensure that our bin directory is on $P and before /usr/bin at that +for elem in `echo $P | tr ':' ' '` +do + if [ "${elem}" == "${PYTHON_ROOT}/bin" ]; then + echo "All right, you're a python lover already" + exit 0 + elif [ "${elem}" == "/usr/bin" ]; then + break + fi +done + +echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough" +case "${BSH}" in +*csh) + # Create backup copy before patching + if [ -f "${HOME}/.cshrc" ]; then + cp -fp "${HOME}/.cshrc" "${HOME}/.cshrc.pysave" + fi + echo "" >> "${HOME}/.cshrc" + echo "# Setting PATH for MacPython ${PYVER}" >> "${HOME}/.cshrc" + echo "# The orginal version is saved in .cshrc.pysave" >> "${HOME}/.cshrc" + echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc" + exit 0 + ;; +bash) + if [ -e "${HOME}/.profile" ]; then + PR="${HOME}/.profile" + else + PR="${HOME}/.bash_profile" + fi + ;; +*sh) + PR="${HOME}/.profile" + ;; +esac + +# Create backup copy before patching +if [ -f "${PR}" ]; then + cp -fp "${PR}" "${PR}.pysave" +fi +echo "" >> "${PR}" +echo "# Setting PATH for MacPython ${PYVER}" >> "${PR}" +echo "# The orginal version is saved in `basename ${PR}`.pysave" >> "${PR}" +echo 'PATH="'"${PYTHON_ROOT}/bin"':${PATH}"' >> "${PR}" +echo 'export PATH' >> "${PR}" +if [ `id -ur` = 0 ]; then + chown "${LOGNAME}" "${PR}" +fi +exit 0 Modified: python/branches/release24-maint/Mac/Modules/carbonevt/CarbonEvtsupport.py ============================================================================== --- python/branches/release24-maint/Mac/Modules/carbonevt/CarbonEvtsupport.py (original) +++ python/branches/release24-maint/Mac/Modules/carbonevt/CarbonEvtsupport.py Sun Oct 8 19:41:25 2006 @@ -86,11 +86,13 @@ PyObject *EventRef_New(EventRef itself); /********** EventTypeSpec *******/ +#if 0 static PyObject* EventTypeSpec_New(EventTypeSpec *in) { return Py_BuildValue("ll", in->eventClass, in->eventKind); } +#endif static int EventTypeSpec_Convert(PyObject *v, EventTypeSpec *out) @@ -99,7 +101,7 @@ PyMac_GetOSType, &(out->eventClass), &(out->eventKind))) return 1; - return NULL; + return 0; } /********** end EventTypeSpec *******/ @@ -118,19 +120,20 @@ { if (PyArg_ParseTuple(v, "ff", &(out->x), &(out->y))) return 1; - return NULL; + return 0; } #endif /********** end HIPoint *******/ /********** EventHotKeyID *******/ - +#if 0 static PyObject* EventHotKeyID_New(EventHotKeyID *in) { return Py_BuildValue("ll", in->signature, in->id); } +#endif static int EventHotKeyID_Convert(PyObject *v, EventHotKeyID *out) Modified: python/branches/release24-maint/Mac/Modules/carbonevt/_CarbonEvtmodule.c ============================================================================== --- python/branches/release24-maint/Mac/Modules/carbonevt/_CarbonEvtmodule.c (original) +++ python/branches/release24-maint/Mac/Modules/carbonevt/_CarbonEvtmodule.c Sun Oct 8 19:41:25 2006 @@ -27,11 +27,13 @@ PyObject *EventRef_New(EventRef itself); /********** EventTypeSpec *******/ +#if 0 static PyObject* EventTypeSpec_New(EventTypeSpec *in) { return Py_BuildValue("ll", in->eventClass, in->eventKind); } +#endif static int EventTypeSpec_Convert(PyObject *v, EventTypeSpec *out) @@ -40,7 +42,7 @@ PyMac_GetOSType, &(out->eventClass), &(out->eventKind))) return 1; - return NULL; + return 0; } /********** end EventTypeSpec *******/ @@ -66,19 +68,20 @@ /********** end HIPoint *******/ /********** EventHotKeyID *******/ - +#if 0 static PyObject* EventHotKeyID_New(EventHotKeyID *in) { return Py_BuildValue("ll", in->signature, in->id); } +#endif static int EventHotKeyID_Convert(PyObject *v, EventHotKeyID *out) { if (PyArg_ParseTuple(v, "ll", &out->signature, &out->id)) return 1; - return NULL; + return 0; } /********** end EventHotKeyID *******/ Modified: python/branches/release24-maint/Mac/Modules/cf/_CFmodule.c ============================================================================== --- python/branches/release24-maint/Mac/Modules/cf/_CFmodule.c (original) +++ python/branches/release24-maint/Mac/Modules/cf/_CFmodule.c Sun Oct 8 19:41:25 2006 @@ -1818,7 +1818,7 @@ if (PyString_Check(v)) { char *cStr; if (!PyArg_Parse(v, "es", "ascii", &cStr)) - return NULL; + return 0; *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); return 1; } Modified: python/branches/release24-maint/Mac/Modules/cf/cfsupport.py ============================================================================== --- python/branches/release24-maint/Mac/Modules/cf/cfsupport.py (original) +++ python/branches/release24-maint/Mac/Modules/cf/cfsupport.py Sun Oct 8 19:41:25 2006 @@ -427,7 +427,7 @@ if (PyString_Check(v)) { char *cStr; if (!PyArg_Parse(v, "es", "ascii", &cStr)) - return NULL; + return 0; *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); return 1; } Modified: python/branches/release24-maint/Mac/Modules/cf/pycfbridge.c ============================================================================== --- python/branches/release24-maint/Mac/Modules/cf/pycfbridge.c (original) +++ python/branches/release24-maint/Mac/Modules/cf/pycfbridge.c Sun Oct 8 19:41:25 2006 @@ -283,7 +283,7 @@ if (PyString_Check(src)) { if (!PyArg_Parse(src, "es", "ascii", &chars)) - return NULL; /* This error is more descriptive than the general one below */ + return 0; /* This error is more descriptive than the general one below */ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); return 1; } Modified: python/branches/release24-maint/Mac/Modules/gestaltmodule.c ============================================================================== --- python/branches/release24-maint/Mac/Modules/gestaltmodule.c (original) +++ python/branches/release24-maint/Mac/Modules/gestaltmodule.c Sun Oct 8 19:41:25 2006 @@ -33,17 +33,10 @@ gestalt_gestalt(PyObject *self, PyObject *args) { OSErr iErr; - char *str; - int size; OSType selector; long response; - if (!PyArg_Parse(args, "s#", &str, &size)) + if (!PyArg_Parse(args, "O&", PyMac_GetOSType, &selector)) return NULL; - if (size != 4) { - PyErr_SetString(PyExc_TypeError, "gestalt arg must be 4-char string"); - return NULL; - } - selector = *(OSType*)str; iErr = Gestalt ( selector, &response ); if (iErr != 0) return PyMac_Error(iErr); Modified: python/branches/release24-maint/Mac/OSX/Extras.install.py ============================================================================== --- python/branches/release24-maint/Mac/OSX/Extras.install.py (original) +++ python/branches/release24-maint/Mac/OSX/Extras.install.py Sun Oct 8 19:41:25 2006 @@ -9,6 +9,7 @@ debug = 0 def isclean(name): + if name == '.svn': return 0 if name == 'CVS': return 0 if name == '.cvsignore': return 0 if name == '.DS_store': return 0 Added: python/branches/release24-maint/Mac/OSX/IDLE/IDLE.icns ============================================================================== Binary file. No diff available. Added: python/branches/release24-maint/Mac/OSX/IDLE/Info.plist ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/OSX/IDLE/Info.plist Sun Oct 8 19:41:25 2006 @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + IDLE + CFBundleGetInfoString + 2.5, ? 001-2006 Python Software Foundation + CFBundleIconFile + PythonApplet.icns + CFBundleIdentifier + org.python.IDLE + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + IDLE + CFBundlePackageType + APPL + CFBundleShortVersionString + 2.5 + CFBundleVersion + 2.5 + + Added: python/branches/release24-maint/Mac/OSX/IDLE/Makefile.in ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/OSX/IDLE/Makefile.in Sun Oct 8 19:41:25 2006 @@ -0,0 +1,49 @@ +prefix=@prefix@ +CC=@CC@ +LD=@CC@ +BASECFLAGS=@BASECFLAGS@ +OPT=@OPT@ +CFLAGS=$(BASECFLAGS) $(OPT) +LDFLAGS=@LDFLAGS@ +srcdir= @srcdir@ +VERSION= @VERSION@ +UNIVERSALSDK=@UNIVERSALSDK@ +builddir= ../../.. + +RUNSHARED= @RUNSHARED@ +BUILDEXE= @BUILDEXEEXT@ +BUILDPYTHON= ../../../python$(BUILDEXE) + +# Deployment target selected during configure, to be checked +# by distutils +MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ + at EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET + +BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py + +PYTHONAPPSDIR=/Applications/MacPython $(VERSION) + +all: IDLE.app + +install: IDLE.app + test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)" + -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" + cp -PR IDLE.app "$(DESTDIR)$(PYTHONAPPSDIR)" + touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" + +clean: + rm -rf IDLE.app + +IDLE.app: \ + $(srcdir)/../../OSXResources/app/Resources/PythonApplet.icns \ + $(srcdir)/idlemain.py + rm -fr PythonLauncher.app + $(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \ + --builddir=. \ + --name=IDLE \ + --link-exec \ + --plist=$(srcdir)/Info.plist \ + --mainprogram=$(srcdir)/idlemain.py \ + --iconfile=$(srcdir)/IDLE.icns \ + --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \ + build Added: python/branches/release24-maint/Mac/OSX/IDLE/idlemain.py ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/OSX/IDLE/idlemain.py Sun Oct 8 19:41:25 2006 @@ -0,0 +1,27 @@ +""" +Bootstrap script for IDLE as an application bundle. +""" +import sys, os + +from idlelib.PyShell import main + +# Change the current directory the user's home directory, that way we'll get +# a more useful default location in the open/save dialogs. +os.chdir(os.path.expanduser('~/Documents')) + + +# Make sure sys.executable points to the python interpreter inside the +# framework, instead of at the helper executable inside the application +# bundle (the latter works, but doesn't allow access to the window server) +sys.executable = os.path.join(sys.prefix, 'bin', 'python') + +# Look for the -psn argument that the launcher adds and remove it, it will +# only confuse the IDLE startup code. +for idx, value in enumerate(sys.argv): + if value.startswith('-psn_'): + del sys.argv[idx] + break + +#argvemulator.ArgvCollector().mainloop() +if __name__ == '__main__': + main() Deleted: /python/branches/release24-maint/Mac/OSX/Makefile ============================================================================== --- /python/branches/release24-maint/Mac/OSX/Makefile Sun Oct 8 19:41:25 2006 +++ (empty file) @@ -1,273 +0,0 @@ -# This file can be invoked from the various frameworkinstall... targets in the -# main Makefile. The next couple of variables are overridden on the -# commandline in that case. - -VERSION=2.4 -builddir = ../.. -srcdir = ../.. -prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) -LIBDEST=$(prefix)/lib/python$(VERSION) -BUILDPYTHON=$(builddir)/python.exe -DESTDIR= -# Test whether to use xcodebuild (preferred) or pbxbuild: -ifeq ($(shell ls /usr/bin/xcodebuild),/usr/bin/xcodebuild) -PBXBUILD=xcodebuild -else -PBXBUILD=pbxbuild -endif - -# These are normally glimpsed from the previous set -bindir=/usr/local/bin -PYTHONAPPSPATH=/Applications/MacPython-$(VERSION) -PYTHONAPPSDIR=$(PYTHONAPPSPATH) -APPINSTALLDIR=$(prefix)/Resources/Python.app - -# Variables for installing the "normal" unix binaries -INSTALLED_PYTHON=$(prefix)/bin/python -INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/Python - -# Items more-or-less copied from the main Makefile -DIRMODE=755 -FILEMODE=644 -INSTALL=/usr/bin/install -c -INSTALL_SYMLINK=ln -fsn -INSTALL_PROGRAM=${INSTALL} -INSTALL_SCRIPT= ${INSTALL_PROGRAM} -INSTALL_DATA= ${INSTALL} -m ${FILEMODE} -LN=ln -STRIPFLAG=-s -##OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ -## -fno-common -dynamic -##INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include -##DEFINES= -## -##CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) -##LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \ -## -framework Foundation -##CC=cc -##LD=cc -CPMAC=/Developer/Tools/CpMac - -APPTEMPLATE=$(srcdir)/Mac/OSXResources/app -APPSUBDIRS=MacOS Resources Resources/English.lproj \ - Resources/English.lproj/Documentation \ - Resources/English.lproj/Documentation/doc \ - Resources/English.lproj/Documentation/ide -DOCDIR=$(srcdir)/Mac/OSXResources/app/Resources/English.lproj/Documentation -DOCINDEX=$(DOCDIR)/"Documentation idx" -CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py -compileall=$(srcdir)/Lib/compileall.py -bundlebuilder=$(srcdir)/Lib/plat-mac/bundlebuilder.py - -installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE \ - install_IDLE install_PackageManager checkapplepython - -install_PythonLauncher: - cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ - $(PBXBUILD) -target PythonLauncher -buildstyle Deployment install \ - DSTROOT=$(DESTDIR)/ INSTALL_PATH=$(PYTHONAPPSPATH) - -install_Python: - @if test ! -f $(DOCINDEX); then \ - echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \ - fi - @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ - if test ! -d $(DESTDIR)$$i; then \ - echo "Creating directory $(DESTDIR)$$i"; \ - $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ - fi;\ - done - @for i in $(APPSUBDIRS); do \ - if test ! -d $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; then \ - echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ - $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; \ - else true; \ - fi; \ - done - @for d in . $(APPSUBDIRS); \ - do \ - a=$(APPTEMPLATE)/$$d; \ - if test ! -d $$a; then continue; else true; fi; \ - b=$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d; \ - for i in $$a/*; \ - do \ - case $$i in \ - *CVS) ;; \ - *.py[co]) ;; \ - *.orig) ;; \ - *~) ;; \ - *idx) \ - echo $(CPMAC) "$$i" $$b; \ - $(CPMAC) "$$i" $$b; \ - ;; \ - *) \ - if test -d $$i; then continue; fi; \ - if test -x $$i; then \ - echo $(INSTALL_SCRIPT) $$i $$b; \ - $(INSTALL_SCRIPT) $$i $$b; \ - else \ - echo $(INSTALL_DATA) $$i $$b; \ - $(INSTALL_DATA) $$i $$b; \ - fi;; \ - esac; \ - done; \ - done - $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/Python - -install_IDE: - @if ! $(BUILDPYTHON) -c "import waste"; then \ - echo PythonIDE needs the \"waste\" extension module; \ - echo See Mac/OSX/README for details; \ - else \ - echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \ - $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \ - $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \ - $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \ - fi - -install_PackageManager: - @if ! $(BUILDPYTHON) -c "import waste"; then \ - echo PackageManager needs the \"waste\" extension module; \ - echo See Mac/OSX/README for details; \ - else \ - echo $(BUILDPYTHON) $(bundlebuilder) \ - --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ - --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ - --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ - --creator Pimp build; \ - $(BUILDPYTHON) $(bundlebuilder) \ - --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ - --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ - --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ - --creator Pimp build; \ - fi - -install_IDLE: - @if ! $(BUILDPYTHON) -c "import _tkinter"; then \ - echo IDLE needs the \"Tkinter\" extension module; \ - echo See Mac/OSX/README for details; \ - else \ - echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --python $(INSTALLED_PYTHONW) \ - --destroot "$(DESTDIR)" \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ - --extra $(srcdir)/Lib/idlelib \ - $(srcdir)/Tools/scripts/idle ; \ - $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --python $(INSTALLED_PYTHONW) \ - --destroot "$(DESTDIR)" \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ - --extra $(srcdir)/Lib/idlelib:Contents/Resources/idlelib \ - $(srcdir)/Tools/scripts/idle ; \ - fi - - -install_BuildApplet: - $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app \ - $(srcdir)/Mac/scripts/BuildApplet.py - -MACLIBDEST=$(LIBDEST)/plat-mac -MACTOOLSDEST=$(prefix)/Mac/Tools -MACTOOLSSRC=$(srcdir)/Mac/Tools -MACTOOLSSUBDIRS=IDE -installmacsubtree: - @for i in $(MACTOOLSDEST); \ - do \ - if test ! -d $(DESTDIR)$$i; then \ - echo "Creating directory $(DESTDIR)$$i"; \ - $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ - else true; \ - fi; \ - done - @for d in $(MACTOOLSSUBDIRS); \ - do \ - a=$(MACTOOLSSRC)/$$d; \ - if test ! -d $$a; then continue; else true; fi; \ - b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ - if test ! -d $$b; then \ - echo "Creating directory $$b"; \ - $(INSTALL) -d -m $(DIRMODE) $$b; \ - else true; \ - fi; \ - done - @for d in $(MACTOOLSSUBDIRS); \ - do \ - a=$(MACTOOLSSRC)/$$d; \ - if test ! -d $$a; then continue; else true; fi; \ - b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ - for i in $$a/*; \ - do \ - case $$i in \ - *CVS) ;; \ - *.py[co]) ;; \ - *.orig) ;; \ - *~) ;; \ - *.rsrc) \ - echo $(CPMAC) $$i $$b ; \ - $(CPMAC) $$i $$b ; \ - ;; \ - *) \ - if test -d $$i; then continue; fi; \ - if test -x $$i; then \ - echo $(INSTALL_SCRIPT) $$i $$b; \ - $(INSTALL_SCRIPT) $$i $$b; \ - else \ - echo $(INSTALL_DATA) $$i $$b; \ - $(INSTALL_DATA) $$i $$b; \ - fi;; \ - esac; \ - done; \ - done - - - $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) - $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) - $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) - -# -# We use the full name here in stead of $(INSTALLED_PYTHONW), because -# the latter may be overridden by Makefile.jaguar when building for a pre-installed -# /usr/bin/python -$(APPINSTALLDIR)/Contents/MacOS/Python: install_Python - -# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. -# At least this rule will give an error if it doesn't exist. - -installunixtools: - $(INSTALL) -d $(DESTDIR)$(bindir) - $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(DESTDIR)$(bindir)/python$(VERSION) - $(INSTALL_SYMLINK) python$(VERSION) $(DESTDIR)$(bindir)/python - echo "#!/bin/sh" > pythonw.sh - echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh - $(INSTALL) pythonw.sh $(DESTDIR)$(bindir)/pythonw$(VERSION) - $(INSTALL_SYMLINK) pythonw$(VERSION) $(DESTDIR)$(bindir)/pythonw - -installextras: - $(INSTALL) -d $(DESTDIR)$(PYTHONAPPSDIR)/Extras - $(INSTALL) $(srcdir)/Mac/OSX/Extras.ReadMe.txt $(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe - $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Demo \ - $(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo - $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Tools \ - $(DESTDIR)$(PYTHONAPPSDIR)/Extras/Tools - -checkapplepython: - @if ! $(BUILDPYTHON) $(srcdir)/Mac/OSX/fixapplepython23.py -n; then \ - echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \ - echo "* WARNING: Run $(srcdir)/Mac/OSX/fixapplepython23.py with \"sudo\" to fix this."; \ - fi - Copied: python/branches/release24-maint/Mac/OSX/Makefile.in (from r46040, python/branches/release24-maint/Mac/OSX/Makefile) ============================================================================== --- python/branches/release24-maint/Mac/OSX/Makefile (original) +++ python/branches/release24-maint/Mac/OSX/Makefile.in Sun Oct 8 19:41:25 2006 @@ -2,85 +2,83 @@ # main Makefile. The next couple of variables are overridden on the # commandline in that case. -VERSION=2.4 +VERSION=@VERSION@ builddir = ../.. -srcdir = ../.. +srcdir = @srcdir@ prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) LIBDEST=$(prefix)/lib/python$(VERSION) BUILDPYTHON=$(builddir)/python.exe +RUNSHARED= @RUNSHARED@ DESTDIR= -# Test whether to use xcodebuild (preferred) or pbxbuild: -ifeq ($(shell ls /usr/bin/xcodebuild),/usr/bin/xcodebuild) -PBXBUILD=xcodebuild -else -PBXBUILD=pbxbuild -endif +LDFLAGS=@LDFLAGS@ +FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@ + # These are normally glimpsed from the previous set -bindir=/usr/local/bin -PYTHONAPPSPATH=/Applications/MacPython-$(VERSION) +bindir=@exec_prefix@/bin +PYTHONAPPSPATH=/Applications/MacPython $(VERSION) PYTHONAPPSDIR=$(PYTHONAPPSPATH) APPINSTALLDIR=$(prefix)/Resources/Python.app # Variables for installing the "normal" unix binaries +INSTALLED_PYDOC=$(prefix)/bin/pydoc INSTALLED_PYTHON=$(prefix)/bin/python -INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/Python +INSTALLED_PYTHONW=$(prefix)/bin/pythonw +INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/Python # Items more-or-less copied from the main Makefile DIRMODE=755 FILEMODE=644 -INSTALL=/usr/bin/install -c +INSTALL=@INSTALL@ INSTALL_SYMLINK=ln -fsn -INSTALL_PROGRAM=${INSTALL} -INSTALL_SCRIPT= ${INSTALL_PROGRAM} -INSTALL_DATA= ${INSTALL} -m ${FILEMODE} -LN=ln +INSTALL_PROGRAM=@INSTALL_PROGRAM@ +INSTALL_SCRIPT=@INSTALL_SCRIPT@ +INSTALL_DATA=@INSTALL_DATA@ +LN=@LN@ STRIPFLAG=-s -##OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ -## -fno-common -dynamic -##INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include -##DEFINES= -## -##CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) -##LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \ -## -framework Foundation -##CC=cc -##LD=cc CPMAC=/Developer/Tools/CpMac -APPTEMPLATE=$(srcdir)/Mac/OSXResources/app +APPTEMPLATE=$(srcdir)/../OSXResources/app APPSUBDIRS=MacOS Resources Resources/English.lproj \ Resources/English.lproj/Documentation \ Resources/English.lproj/Documentation/doc \ Resources/English.lproj/Documentation/ide -DOCDIR=$(srcdir)/Mac/OSXResources/app/Resources/English.lproj/Documentation +DOCDIR=$(srcdir)/../OSXResources/app/Resources/English.lproj/Documentation DOCINDEX=$(DOCDIR)/"Documentation idx" -CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py -compileall=$(srcdir)/Lib/compileall.py -bundlebuilder=$(srcdir)/Lib/plat-mac/bundlebuilder.py +CACHERSRC=$(srcdir)/../scripts/cachersrc.py +compileall=$(srcdir)/../../Lib/compileall.py installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE \ - install_IDLE install_PackageManager checkapplepython + install_IDLE install_PackageManager checkapplepython install_pythonw \ + install_versionedtools + +install_pythonw: pythonw + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)" + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)" + ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python" + ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw" + +pythonw: $(srcdir)/pythonw.c + $(CC) $(LDFLAGS) -o $@ $(srcdir)/pythonw.c \ + -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/Python"' install_PythonLauncher: - cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ - $(PBXBUILD) -target PythonLauncher -buildstyle Deployment install \ - DSTROOT=$(DESTDIR)/ INSTALL_PATH=$(PYTHONAPPSPATH) + cd PythonLauncher && make install install_Python: @if test ! -f $(DOCINDEX); then \ echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \ fi - @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ + @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \ if test ! -d $(DESTDIR)$$i; then \ echo "Creating directory $(DESTDIR)$$i"; \ - $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ + $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \ fi;\ done @for i in $(APPSUBDIRS); do \ if test ! -d $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; then \ echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ - $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; \ + $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ else true; \ fi; \ done @@ -88,7 +86,7 @@ do \ a=$(APPTEMPLATE)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ - b=$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d; \ + b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \ for i in $$a/*; \ do \ case $$i in \ @@ -101,53 +99,53 @@ $(CPMAC) "$$i" $$b; \ ;; \ *) \ - if test -d $$i; then continue; fi; \ - if test -x $$i; then \ - echo $(INSTALL_SCRIPT) $$i $$b; \ - $(INSTALL_SCRIPT) $$i $$b; \ + if test -d "$$i"; then continue; fi; \ + if test -x "$$i"; then \ + echo $(INSTALL_SCRIPT) "$$i" "$$b"; \ + $(INSTALL_SCRIPT) "$$i" "$$b"; \ else \ - echo $(INSTALL_DATA) $$i $$b; \ - $(INSTALL_DATA) $$i $$b; \ + echo $(INSTALL_DATA) "$$i" "$$b"; \ + $(INSTALL_DATA) "$$i" "$$b"; \ fi;; \ esac; \ done; \ done - $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/Python + $(INSTALL_PROGRAM) $(STRIPFLAG) "$(BUILDPYTHON)" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/Python" install_IDE: - @if ! $(BUILDPYTHON) -c "import waste"; then \ + @if ! $(RUNSHARED) $(BUILDPYTHON) -c "import waste"; then \ echo PythonIDE needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ else \ - echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ + echo $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/../scripts/BuildApplet.py \ --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \ + --python "$(INSTALLED_PYTHONAPP)" \ + --output "$(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app" --noargv \ $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \ - $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ + $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/../scripts/BuildApplet.py \ --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \ + --python "$(INSTALLED_PYTHONAPP)" \ + --output "$(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app" --noargv \ $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \ fi install_PackageManager: - @if ! $(BUILDPYTHON) -c "import waste"; then \ + @if ! $(RUNSHARED) $(BUILDPYTHON) -c "import waste"; then \ echo PackageManager needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ else \ - echo $(BUILDPYTHON) $(bundlebuilder) \ + echo $(RUNSHARED) $(BUILDPYTHON) $(bundlebuilder) \ --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ + --python $(INSTALLED_PYTHONAPP) \ --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ --creator Pimp build; \ - $(BUILDPYTHON) $(bundlebuilder) \ + $(RUNSHARED) $(BUILDPYTHON) $(bundlebuilder) \ --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ + --python $(INSTALLED_PYTHONAPP) \ --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ @@ -155,31 +153,20 @@ fi install_IDLE: - @if ! $(BUILDPYTHON) -c "import _tkinter"; then \ + @if ! $(RUNSHARED) $(BUILDPYTHON) -c "import _tkinter"; then \ echo IDLE needs the \"Tkinter\" extension module; \ echo See Mac/OSX/README for details; \ else \ - echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --python $(INSTALLED_PYTHONW) \ - --destroot "$(DESTDIR)" \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ - --extra $(srcdir)/Lib/idlelib \ - $(srcdir)/Tools/scripts/idle ; \ - $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --python $(INSTALLED_PYTHONW) \ - --destroot "$(DESTDIR)" \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ - --extra $(srcdir)/Lib/idlelib:Contents/Resources/idlelib \ - $(srcdir)/Tools/scripts/idle ; \ + cd IDLE && make install ;\ fi install_BuildApplet: - $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ + $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/../scripts/BuildApplet.py \ --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app \ - $(srcdir)/Mac/scripts/BuildApplet.py + --python "$(INSTALLED_PYTHONAPP)" \ + --output "$(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app" \ + "$(srcdir)/../scripts/BuildApplet.py" MACLIBDEST=$(LIBDEST)/plat-mac MACTOOLSDEST=$(prefix)/Mac/Tools @@ -235,12 +222,12 @@ done - $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) - $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) - $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) + $(RUNSHARED) $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) + $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) + $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) # -# We use the full name here in stead of $(INSTALLED_PYTHONW), because +# We use the full name here in stead of $(INSTALLED_PYTHONAPP), because # the latter may be overridden by Makefile.jaguar when building for a pre-installed # /usr/bin/python $(APPINSTALLDIR)/Contents/MacOS/Python: install_Python @@ -249,25 +236,59 @@ # At least this rule will give an error if it doesn't exist. installunixtools: - $(INSTALL) -d $(DESTDIR)$(bindir) - $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(DESTDIR)$(bindir)/python$(VERSION) - $(INSTALL_SYMLINK) python$(VERSION) $(DESTDIR)$(bindir)/python - echo "#!/bin/sh" > pythonw.sh - echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh - $(INSTALL) pythonw.sh $(DESTDIR)$(bindir)/pythonw$(VERSION) - $(INSTALL_SYMLINK) pythonw$(VERSION) $(DESTDIR)$(bindir)/pythonw - -installextras: - $(INSTALL) -d $(DESTDIR)$(PYTHONAPPSDIR)/Extras - $(INSTALL) $(srcdir)/Mac/OSX/Extras.ReadMe.txt $(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe - $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Demo \ - $(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo - $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Tools \ - $(DESTDIR)$(PYTHONAPPSDIR)/Extras/Tools + if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \ + $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ + fi + for fn in python pythonw idle pydoc smtpd.py \ + python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ + pydoc$(VERSION) smtpd$(VERSION).py ;\ + do \ + ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ + done + +# +# Like installunixtools, but only install links to the versioned binaries. + +altinstallunixtools: + if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \ + $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ + fi + for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ + pydoc$(VERSION) smtpd$(VERSION).py ;\ + do \ + ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ + done + + + +installextras:$(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py + $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras" + $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe" + $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \ + "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac" + $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../../Demo \ + "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo" checkapplepython: - @if ! $(BUILDPYTHON) $(srcdir)/Mac/OSX/fixapplepython23.py -n; then \ + @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/fixapplepython23.py -n; then \ echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \ - echo "* WARNING: Run $(srcdir)/Mac/OSX/fixapplepython23.py with \"sudo\" to fix this."; \ + echo "* WARNING: Run $(srcdir)/fixapplepython23.py with \"sudo\" to fix this."; \ + fi + +# By default most tools are installed without a version in their basename, to +# make it easier to install (and use) several python versions side-by-side move +# the tools to a version-specific name and add the non-versioned name as an +# alias. +install_versionedtools: + for fn in idle pydoc ;\ + do \ + if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \ + continue ;\ + fi ;\ + mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\ + ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\ + done + if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \ + mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\ + ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\ fi - Modified: python/branches/release24-maint/Mac/OSX/PythonLauncher/FileSettings.m ============================================================================== --- python/branches/release24-maint/Mac/OSX/PythonLauncher/FileSettings.m (original) +++ python/branches/release24-maint/Mac/OSX/PythonLauncher/FileSettings.m Sun Oct 8 19:41:25 2006 @@ -207,7 +207,7 @@ [NSNumber numberWithBool: inspect], @"inspect", [NSNumber numberWithBool: optimize], @"optimize", [NSNumber numberWithBool: nosite], @"nosite", - [NSNumber numberWithBool: nosite], @"nosite", + [NSNumber numberWithBool: tabs], @"tabs", others, @"others", scriptargs, @"scriptargs", [NSNumber numberWithBool: with_terminal], @"with_terminal", @@ -235,7 +235,7 @@ if (value) optimize = [value boolValue]; value = [dict objectForKey: @"nosite"]; if (value) nosite = [value boolValue]; - value = [dict objectForKey: @"nosite"]; + value = [dict objectForKey: @"tabs"]; if (value) tabs = [value boolValue]; value = [dict objectForKey: @"others"]; if (value) others = [value retain]; @@ -245,12 +245,26 @@ if (value) with_terminal = [value boolValue]; } +- (NSString*)_replaceSingleQuotes: (NSString*)string +{ + /* Replace all single-quotes by '"'"', that way shellquoting will + * be correct when the result value is delimited using single quotes. + */ + NSArray* components = [string componentsSeparatedByString:@"'"]; + + return [components componentsJoinedByString:@"'\"'\"'"]; +} + - (NSString *)commandLineForScript: (NSString *)script { NSString *cur_interp = NULL; + NSString* script_dir = NULL; char hashbangbuf[1024]; FILE *fp; char *p; + + script_dir = [script substringToIndex: + [script length]-[[script lastPathComponent] length]]; if (honourhashbang && (fp=fopen([script cString], "r")) && @@ -266,8 +280,9 @@ cur_interp = interpreter; return [NSString stringWithFormat: - @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %@ %s", - cur_interp, + @"cd '%@' && '%@'%s%s%s%s%s%s %@ '%@' %@ %s", + [self _replaceSingleQuotes:script_dir], + [self _replaceSingleQuotes:cur_interp], debug?" -d":"", verbose?" -v":"", inspect?" -i":"", @@ -275,7 +290,7 @@ nosite?" -S":"", tabs?" -t":"", others, - script, + [self _replaceSingleQuotes:script], scriptargs, with_terminal? "&& echo Exit status: $? && exit 1" : " &"]; } Added: python/branches/release24-maint/Mac/OSX/PythonLauncher/Info.plist ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/OSX/PythonLauncher/Info.plist Sun Oct 8 19:41:25 2006 @@ -0,0 +1,65 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + py + pyw + + CFBundleTypeIconFile + PythonSource.icns + CFBundleTypeName + Python Script + CFBundleTypeRole + Viewer + NSDocumentClass + MyDocument + + + CFBundleTypeExtensions + + pyc + pyo + + CFBundleTypeIconFile + PythonCompiled.icns + CFBundleTypeName + Python Bytecode Document + CFBundleTypeRole + Viewer + NSDocumentClass + MyDocument + + + CFBundleExecutable + PythonLauncher + CFBundleGetInfoString + 2.4, ? 2001-2006 Python Software Foundation + CFBundleIconFile + PythonInterpreter.icns + CFBundleIdentifier + org.python.PythonLauncher + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Python Launcher + CFBundlePackageType + APPL + CFBundleShortVersionString + 2.4 + CFBundleSignature + PytL + CFBundleVersion + 2.4 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + Added: python/branches/release24-maint/Mac/OSX/PythonLauncher/Makefile.in ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/OSX/PythonLauncher/Makefile.in Sun Oct 8 19:41:25 2006 @@ -0,0 +1,81 @@ +CC=@CC@ +LD=@CC@ +BASECFLAGS=@BASECFLAGS@ +OPT=@OPT@ +CFLAGS=$(BASECFLAGS) $(OPT) +LDFLAGS=@LDFLAGS@ +srcdir= @srcdir@ +VERSION= @VERSION@ +UNIVERSALSDK=@UNIVERSALSDK@ +builddir= ../../.. + +RUNSHARED= @RUNSHARED@ +BUILDEXE= @BUILDEXEEXT@ +BUILDPYTHON= ../../../python$(BUILDEXE) + +# Deployment target selected during configure, to be checked +# by distutils +MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ + at EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET + +BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py + +PYTHONAPPSDIR=/Applications/MacPython $(VERSION) +OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o + +all: PythonLauncher.app + +install: PythonLauncher.app + test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)" + -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/PythonLauncher.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/PythonLauncher.app" + cp -r "PythonLauncher.app" "$(DESTDIR)$(PYTHONAPPSDIR)" + touch "$(DESTDIR)$(PYTHONAPPSDIR)/PythonLauncher.app" + +clean: + rm -f *.o "PythonLauncher" + rm -rf "PythonLauncher.app" + +PythonLauncher.app: \ + PythonLauncher $(srcdir)/PythonInterpreter.icns \ + $(srcdir)/PythonSource.icns \ + $(srcdir)/PythonWSource.icns \ + $(srcdir)/PythonCompiled.icns \ + $(srcdir)/factorySettings.plist + rm -fr "PythonLauncher.app" + $(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \ + --builddir=. \ + --name="PythonLauncher" \ + --executable="PythonLauncher" \ + --iconfile=$(srcdir)/PythonInterpreter.icns \ + --bundle-id=org.python.PythonLauncher \ + --resource=$(srcdir)/PythonSource.icns \ + --resource=$(srcdir)/PythonWSource.icns \ + --resource=$(srcdir)/PythonCompiled.icns \ + --resource=$(srcdir)/English.lproj \ + --resource=$(srcdir)/PreferenceWindow.nib \ + --resource=$(srcdir)/factorySettings.plist \ + --plist=$(srcdir)/Info.plist \ + build + find "PythonLauncher.app" -name '.svn' -print0 | xargs -0 rm -r + + +FileSettings.o: $(srcdir)/FileSettings.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/FileSettings.m + +MyAppDelegate.o: $(srcdir)/MyAppDelegate.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyAppDelegate.m + +MyDocument.o: $(srcdir)/MyDocument.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyDocument.m + +PreferencesWindowController.o: $(srcdir)/PreferencesWindowController.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/PreferencesWindowController.m + +doscript.o: $(srcdir)/doscript.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/doscript.m + +main.o: $(srcdir)/main.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/main.m + +PythonLauncher: $(OBJECTS) + $(CC) $(LDFLAGS) -o "PythonLauncher" $(OBJECTS) -framework AppKit -framework Carbon Modified: python/branches/release24-maint/Mac/OSX/PythonLauncher/PythonCompiled.icns ============================================================================== Binary files. No diff available. Modified: python/branches/release24-maint/Mac/OSX/PythonLauncher/PythonInterpreter.icns ============================================================================== Binary files. No diff available. Modified: python/branches/release24-maint/Mac/OSX/PythonLauncher/PythonSource.icns ============================================================================== Binary files. No diff available. Modified: python/branches/release24-maint/Mac/OSX/PythonLauncher/PythonWSource.icns ============================================================================== Binary files. No diff available. Modified: python/branches/release24-maint/Mac/OSX/fixapplepython23.py ============================================================================== --- python/branches/release24-maint/Mac/OSX/fixapplepython23.py (original) +++ python/branches/release24-maint/Mac/OSX/fixapplepython23.py Sun Oct 8 19:41:25 2006 @@ -1,3 +1,4 @@ +#!/usr/bin/python """fixapplepython23 - Fix Apple-installed Python 2.3 (on Mac OS X 10.3) Python 2.3 (and 2.3.X for X<5) have the problem that building an extension @@ -93,9 +94,19 @@ else: do_apply = True # First check OS version + if sys.byteorder == 'little': + # All intel macs are fine + print "fixapplypython23: no fix is needed on MacOSX on Intel" + sys.exit(0) + if gestalt.gestalt('sysv') < 0x1030: print 'fixapplepython23: no fix needed on MacOSX < 10.3' sys.exit(0) + + if gestalt.gestalt('sysv') >= 0x1040: + print 'fixapplepython23: no fix needed on MacOSX >= 10.4' + sys.exit(0) + # Test that a framework Python is indeed installed if not os.path.exists(MAKEFILE): print 'fixapplepython23: Python framework does not appear to be installed (?), nothing fixed' @@ -112,7 +123,8 @@ makescript(GXX_SCRIPT, "g++") # Finally fix the makefile rv = fix(MAKEFILE, do_apply) - sys.exit(rv) + #sys.exit(rv) + sys.exit(0) if __name__ == '__main__': main() Added: python/branches/release24-maint/Mac/OSX/pythonw.c ============================================================================== --- (empty file) +++ python/branches/release24-maint/Mac/OSX/pythonw.c Sun Oct 8 19:41:25 2006 @@ -0,0 +1,17 @@ +/* + * This wrapper program executes a python executable hidden inside an + * application bundle inside the Python framework. This is needed to run + * GUI code: some GUI API's don't work unless the program is inside an + * application bundle. + */ +#include +#include + +static char Python[] = PYTHONWEXECUTABLE; + +int main(int argc, char **argv) { + argv[0] = Python; + execv(Python, argv); + err(1, "execv: %s", Python); + /* NOTREACHED */ +} Modified: python/branches/release24-maint/Mac/OSXResources/app/Resources/PythonApplet.icns ============================================================================== Binary files. No diff available. Modified: python/branches/release24-maint/Mac/OSXResources/app/Resources/PythonInterpreter.icns ============================================================================== Binary files. No diff available. Modified: python/branches/release24-maint/Mac/scripts/BuildApplet.icns ============================================================================== Binary files. No diff available. Modified: python/branches/release24-maint/Makefile.pre.in ============================================================================== --- python/branches/release24-maint/Makefile.pre.in (original) +++ python/branches/release24-maint/Makefile.pre.in Sun Oct 8 19:41:25 2006 @@ -103,13 +103,17 @@ BUILDEXE= @BUILDEXEEXT@ # Short name and location for Mac OS X Python framework +UNIVERSALSDK=@UNIVERSALSDK@ PYTHONFRAMEWORK= @PYTHONFRAMEWORK@ PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@ PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@ PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@ # Deployment target selected during configure, to be checked -# by distutils -CONFIGURE_MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ +# by distutils. The export statement is needed to ensure that the +# deployment target is active during build. +MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ + at EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET + # Options to enable prebinding (for fast startup prior to Mac OS X 10.3) OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@ @@ -370,8 +374,17 @@ $(RESSRCDIR)/version.plist \ $(RESSRCDIR)/English.lproj/InfoPlist.strings $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION) - libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ - @LIBTOOL_CRUFT@ + if test "${UNIVERSALSDK}"; then \ + $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \ + -isysroot "${UNIVERSALSDK}" \ + -all_load $(LIBRARY) -Wl,-single_module \ + -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python \ + -compatibility_version $(VERSION) \ + -current_version $(VERSION); \ + else \ + libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ + @LIBTOOL_CRUFT@ ;\ + fi $(INSTALL) -d -m $(DIRMODE) \ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \ @@ -546,6 +559,19 @@ -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall +# Run the unitests for both architectures in a Universal build on OSX +# Must be run on an Intel box. +testuniversal: all platform + if [ `arch` != 'i386' ];then \ + echo "This can only be used on OSX/i386" ;\ + exit 1 ;\ + fi + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f + -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall + $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall + $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall + + # Like testall, but with a single pass only buildbottest: all platform $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw @@ -566,11 +592,11 @@ $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS) # Install everything -install: altinstall bininstall maninstall +install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@ # Install almost everything without disturbing previous versions -altinstall: altbininstall libinstall inclinstall libainstall \ - sharedinstall oldsharedinstall +altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \ + sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@ # Install shared libraries enabled by Setup DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED) @@ -878,29 +904,25 @@ # This installs Mac/Lib into the framework frameworkinstallmaclib: - $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \ - $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ - srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST) \ - DESTDIR=$(DESTDIR) + ln -sf ../../../Python $(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a + cd Mac/OSX && $(MAKE) installmacsubtree \ + $(RUNSHARED) DESTDIR=$(DESTDIR) # This installs the IDE, the Launcher and other apps into /Applications frameworkinstallapps: - $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \ - $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ - srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) prefix=$(prefix) + cd Mac/OSX && $(MAKE) installapps DESTDIR=$(DESTDIR) # This install the unix python and pythonw tools in /usr/local/bin frameworkinstallunixtools: - $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \ - DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ - srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) prefix=$(prefix) + cd Mac/OSX && $(MAKE) installunixtools DESTDIR=$(DESTDIR) + +frameworkaltinstallunixtools: + cd Mac/OSX && $(MAKE) altinstallunixtools DESTDIR=$(DESTDIR) # This installs the Demos and Tools into the applications directory. # It is not part of a normal frameworkinstall frameworkinstallextras: - $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installextras \ - $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ - srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) + cd Mac/OSX && $(MAKE) installextras DESTDIR=$(DESTDIR) # This installs a few of the useful scripts in Tools/scripts scriptsinstall: Added: python/branches/release24-maint/Modules/expat/expat_config.h ============================================================================== --- (empty file) +++ python/branches/release24-maint/Modules/expat/expat_config.h Sun Oct 8 19:41:25 2006 @@ -0,0 +1,19 @@ +/* + * Expat configuration for python. This file is not part of the expat + * distribution. + */ +#ifndef EXPAT_CONFIG_H +#define EXPAT_CONFIG_H + +#include +#ifdef WORDS_BIGENDIAN +#define BYTEORDER 4321 +#else +#define BYTEORDER 1234 +#endif + +#define XML_NS 1 +#define XML_DTD 1 +#define XML_CONTEXT_BYTES 1024 + +#endif /* EXPAT_CONFIG_H */ Modified: python/branches/release24-maint/Modules/posixmodule.c ============================================================================== --- python/branches/release24-maint/Modules/posixmodule.c (original) +++ python/branches/release24-maint/Modules/posixmodule.c Sun Oct 8 19:41:25 2006 @@ -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__ */ + #include "Python.h" #include "structseq.h" @@ -7978,4 +7990,41 @@ Py_INCREF((PyObject*) &StatVFSResultType); PyModule_AddObject(m, "statvfs_result", (PyObject*) &StatVFSResultType); + +#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__ */ } Modified: python/branches/release24-maint/Modules/socketmodule.c ============================================================================== --- python/branches/release24-maint/Modules/socketmodule.c (original) +++ python/branches/release24-maint/Modules/socketmodule.c Sun Oct 8 19:41:25 2006 @@ -61,6 +61,15 @@ */ +#ifdef __APPLE__ + /* + * inet_aton is not available on OSX 10.3, yet we want to use a binary + * that was build on 10.4 or later to work on that release, weak linking + * comes to the rescue. + */ +# pragma weak inet_aton +#endif + #include "Python.h" #undef MAX @@ -300,6 +309,11 @@ older releases don't have */ #undef HAVE_GETADDRINFO #endif + +#ifdef HAVE_INET_ATON +#define USE_INET_ATON_WEAKLINK +#endif + #endif /* I know this is a bad practice, but it is the easiest... */ @@ -3261,7 +3275,9 @@ #endif #ifdef HAVE_INET_ATON struct in_addr buf; -#else +#endif + +#if !defined(HAVE_INET_ATON) || defined(USE_INET_ATON_WEAKLINK) /* Have to use inet_addr() instead */ unsigned long packed_addr; #endif @@ -3272,6 +3288,10 @@ #ifdef HAVE_INET_ATON + +#ifdef USE_INET_ATON_WEAKLINK + if (inet_aton != NULL) { +#endif if (inet_aton(ip_addr, &buf)) return PyString_FromStringAndSize((char *)(&buf), sizeof(buf)); @@ -3280,7 +3300,14 @@ "illegal IP address string passed to inet_aton"); return NULL; -#else /* ! HAVE_INET_ATON */ +#ifdef USE_INET_ATON_WEAKLINK + } else { +#endif + +#endif + +#if !defined(HAVE_INET_ATON) || defined(USE_INET_ATON_WEAKLINK) + /* special-case this address as inet_addr might return INADDR_NONE * for this */ if (strcmp(ip_addr, "255.255.255.255") == 0) { @@ -3297,6 +3324,11 @@ } return PyString_FromStringAndSize((char *) &packed_addr, sizeof(packed_addr)); + +#ifdef USE_INET_ATON_WEAKLINK + } +#endif + #endif } Modified: python/branches/release24-maint/Modules/timemodule.c ============================================================================== --- python/branches/release24-maint/Modules/timemodule.c (original) +++ python/branches/release24-maint/Modules/timemodule.c Sun Oct 8 19:41:25 2006 @@ -5,6 +5,19 @@ #include "structseq.h" #include "timefuncs.h" +#ifdef __APPLE__ +#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME) + /* + * floattime falls back to ftime when getttimeofday fails because the latter + * might fail on some platforms. This fallback is unwanted on MacOSX because + * that makes it impossible to use a binary build on OSX 10.4 on earlier + * releases of the OS. Therefore claim we don't support ftime. + */ +# undef HAVE_FTIME +#endif +#endif + + #include #include @@ -830,14 +843,16 @@ { struct timeval t; #ifdef GETTIMEOFDAY_NO_TZ - if (gettimeofday(&t) == 0) - return (double)t.tv_sec + t.tv_usec*0.000001; + gettimeofday(&t); + return (double)t.tv_sec + t.tv_usec*0.000001; #else /* !GETTIMEOFDAY_NO_TZ */ - if (gettimeofday(&t, (struct timezone *)NULL) == 0) - return (double)t.tv_sec + t.tv_usec*0.000001; + gettimeofday(&t, (struct timezone *)NULL); + return (double)t.tv_sec + t.tv_usec*0.000001; #endif /* !GETTIMEOFDAY_NO_TZ */ } -#endif /* !HAVE_GETTIMEOFDAY */ + +#else /* !HAVE_GETTIMEOFDAY */ + { #if defined(HAVE_FTIME) struct timeb t; @@ -849,6 +864,8 @@ return (double)secs; #endif /* !HAVE_FTIME */ } + +#endif /* !HAVE_GETTIMEOFDAY */ } Modified: python/branches/release24-maint/Python/mactoolboxglue.c ============================================================================== --- python/branches/release24-maint/Python/mactoolboxglue.c (original) +++ python/branches/release24-maint/Python/mactoolboxglue.c Sun Oct 8 19:41:25 2006 @@ -25,7 +25,7 @@ #include "Python.h" #include "pymactoolbox.h" - +#include /* for ntohl, htonl */ /* Like strerror() but for Mac OS error numbers */ char * @@ -156,12 +156,14 @@ int PyMac_GetOSType(PyObject *v, OSType *pr) { + int32_t tmp; if (!PyString_Check(v) || PyString_Size(v) != 4) { PyErr_SetString(PyExc_TypeError, "OSType arg must be string of 4 chars"); return 0; } - memcpy((char *)pr, PyString_AsString(v), 4); + memcpy((char *)&tmp, PyString_AsString(v), 4); + *pr = (OSType)ntohl(tmp); return 1; } @@ -169,7 +171,8 @@ PyObject * PyMac_BuildOSType(OSType t) { - return PyString_FromStringAndSize((char *)&t, 4); + uint32_t tmp = htonl((uint32_t)t); + return PyString_FromStringAndSize((char *)&tmp, 4); } /* Convert an NumVersion value to a 4-element tuple */ @@ -363,10 +366,10 @@ \ int routinename(PyObject *pyobj, object *cobj) { \ if (!PyMacGluePtr_##routinename) { \ - if (!PyImport_ImportModule(module)) return NULL; \ + if (!PyImport_ImportModule(module)) return 0; \ if (!PyMacGluePtr_##routinename) { \ PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ - return NULL; \ + return 0; \ } \ } \ return (*PyMacGluePtr_##routinename)(pyobj, cobj); \ Modified: python/branches/release24-maint/README ============================================================================== --- python/branches/release24-maint/README (original) +++ python/branches/release24-maint/README Sun Oct 8 19:41:25 2006 @@ -595,7 +595,11 @@ /Library/Frameworks). A framework install is probably needed if you want to use any Aqua-based GUI toolkit (whether Tkinter, wxPython, Carbon, Cocoa or anything else). - + + You may also want to try the configure option "--enable-universalsdk" + which builds Python as a universal binary with support for the + i386 and PPC architetures. This requires Xcode 2.1 or later to build. + See Mac/OSX/README for more information on framework builds. Cygwin: With recent (relative to the time of writing, 2001-12-19) Modified: python/branches/release24-maint/configure ============================================================================== --- python/branches/release24-maint/configure (original) +++ python/branches/release24-maint/configure Sun Oct 8 19:41:25 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52088 . +# From configure.in Revision: 52098 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.4. # @@ -312,7 +312,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET CXX MAINOBJ EXEEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS UNIVERSALSDK PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR FRAMEWORKINSTALLFIRST FRAMEWORKINSTALLLAST FRAMEWORKALTINSTALLFIRST FRAMEWORKALTINSTALLLAST FRAMEWORKUNIXTOOLSPREFIX MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET EXPORT_MACOSX_DEPLOYMENT_TARGET CXX MAINOBJ EXEEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -845,6 +845,8 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-universalsdk[=SDKDIR] + Build agains Mac OS X 10.4u SDK (ppc/i386) --enable-framework[=INSTALLDIR] Build (MacOSX|Darwin) framework --enable-shared disable/enable building shared python library @@ -1397,6 +1399,33 @@ CONFIG_ARGS="$ac_configure_args" +# Check whether --enable-universalsdk or --disable-universalsdk was given. +if test "${enable_universalsdk+set}" = set; then + enableval="$enable_universalsdk" + + case $enableval in + yes) + enableval=/Developer/SDKs/MacOSX10.4u.sdk + ;; + esac + case $enableval in + no) + UNIVERSALSDK= + enable_universalsdk= + ;; + *) + UNIVERSALSDK=$enableval + ;; + esac + +else + + UNIVERSALSDK= + enable_universalsdk= + +fi; + + # Check whether --enable-framework or --disable-framework was given. if test "${enable_framework+set}" = set; then enableval="$enable_framework" @@ -1411,6 +1440,10 @@ PYTHONFRAMEWORKDIR=no-framework PYTHONFRAMEWORKPREFIX= PYTHONFRAMEWORKINSTALLDIR= + FRAMEWORKINSTALLFIRST= + FRAMEWORKINSTALLLAST= + FRAMEWORKALTINSTALLFIRST= + FRAMEWORKALTINSTALLLAST= enable_framework= ;; *) @@ -1418,7 +1451,26 @@ PYTHONFRAMEWORKDIR=Python.framework PYTHONFRAMEWORKPREFIX=$enableval PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR + FRAMEWORKINSTALLFIRST="frameworkinstallstructure" + FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools" + FRAMEWORKALTINSTALLFIRST="${FRAMEWORKINSTALLFIRST} bininstall maninstall" + FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + if test "x${prefix}" = "xNONE" ; then + FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" + else + FRAMEWORKUNIXTOOLSPREFIX="${prefix}" + fi + prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION + + # Add makefiles for Mac specific code to the list of output + # files: + ac_config_files="$ac_config_files Mac/OSX/Makefile" + + ac_config_files="$ac_config_files Mac/OSX/PythonLauncher/Makefile" + + ac_config_files="$ac_config_files Mac/OSX/IDLE/Makefile" + esac else @@ -1427,6 +1479,15 @@ PYTHONFRAMEWORKDIR=no-framework PYTHONFRAMEWORKPREFIX= PYTHONFRAMEWORKINSTALLDIR= + FRAMEWORKINSTALLFIRST= + FRAMEWORKINSTALLLAST= + FRAMEWORKALTINSTALLFIRST= + FRAMEWORKALTINSTALLLAST= + if test "x${prefix}" = "xNONE" ; then + FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" + else + FRAMEWORKUNIXTOOLSPREFIX="${prefix}" + fi enable_framework= fi; @@ -1435,6 +1496,11 @@ + + + + + ##AC_ARG_WITH(dyld, ## AC_HELP_STRING(--with-dyld, ## Use (OpenStep|Rhapsody) dynamic linker)) @@ -1515,7 +1581,7 @@ # disables platform specific features beyond repair. # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE # has no effect, don't bother defining them - Darwin/[78].*) + Darwin/[789].*) define_xopen_source=no ;; @@ -1614,7 +1680,9 @@ # it may influence the way we can build extensions, so distutils # needs to check it + CONFIGURE_MACOSX_DEPLOYMENT_TARGET= +EXPORT_MACOSX_DEPLOYMENT_TARGET='#' # checks for alternative programs @@ -3840,6 +3908,10 @@ # is there any other compiler on Darwin besides gcc? Darwin*) BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd" + if test "${enable_universalsdk}"; then + BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + fi + ;; OSF*) BASECFLAGS="$BASECFLAGS -mieee" @@ -10242,7 +10314,10 @@ case $ac_sys_system/$ac_sys_release in Darwin/[01234567].*) - LIBTOOL_CRUFT="-framework System -lcc_dynamic -arch_only ppc" + LIBTOOL_CRUFT="-framework System -lcc_dynamic" + if test -z "${enable_universalsdk}"; then + LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`" + fi LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; Darwin/*) @@ -10377,9 +10452,16 @@ # Use -undefined dynamic_lookup whenever possible (10.3 and later). # This allows an extension to be used in any Python cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'` + if test ${cur_target} '>' 10.2; then + cur_target=10.3 + fi CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} + EXPORT_MACOSX_DEPLOYMENT_TARGET='' if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2 then + if test "${enable_universalsdk}"; then + LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}" + fi LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' BLDSHARED="$LDSHARED" else @@ -19368,6 +19450,8 @@ esac + + # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). echo "$as_me:$LINENO: checking whether right shift extends the sign bit" >&5 @@ -21152,6 +21236,9 @@ do case "$ac_config_target" in # Handling of arguments. + "Mac/OSX/Makefile" ) CONFIG_FILES="$CONFIG_FILES Mac/OSX/Makefile" ;; + "Mac/OSX/PythonLauncher/Makefile" ) CONFIG_FILES="$CONFIG_FILES Mac/OSX/PythonLauncher/Makefile" ;; + "Mac/OSX/IDLE/Makefile" ) CONFIG_FILES="$CONFIG_FILES Mac/OSX/IDLE/Makefile" ;; "Makefile.pre" ) CONFIG_FILES="$CONFIG_FILES Makefile.pre" ;; "Modules/Setup.config" ) CONFIG_FILES="$CONFIG_FILES Modules/Setup.config" ;; "pyconfig.h" ) CONFIG_HEADERS="$CONFIG_HEADERS pyconfig.h" ;; @@ -21242,15 +21329,22 @@ s, at VERSION@,$VERSION,;t t s, at SOVERSION@,$SOVERSION,;t t s, at CONFIG_ARGS@,$CONFIG_ARGS,;t t +s, at UNIVERSALSDK@,$UNIVERSALSDK,;t t s, at PYTHONFRAMEWORK@,$PYTHONFRAMEWORK,;t t s, at PYTHONFRAMEWORKDIR@,$PYTHONFRAMEWORKDIR,;t t s, at PYTHONFRAMEWORKPREFIX@,$PYTHONFRAMEWORKPREFIX,;t t s, at PYTHONFRAMEWORKINSTALLDIR@,$PYTHONFRAMEWORKINSTALLDIR,;t t +s, at FRAMEWORKINSTALLFIRST@,$FRAMEWORKINSTALLFIRST,;t t +s, at FRAMEWORKINSTALLLAST@,$FRAMEWORKINSTALLLAST,;t t +s, at FRAMEWORKALTINSTALLFIRST@,$FRAMEWORKALTINSTALLFIRST,;t t +s, at FRAMEWORKALTINSTALLLAST@,$FRAMEWORKALTINSTALLLAST,;t t +s, at FRAMEWORKUNIXTOOLSPREFIX@,$FRAMEWORKUNIXTOOLSPREFIX,;t t s, at MACHDEP@,$MACHDEP,;t t s, at SGI_ABI@,$SGI_ABI,;t t s, at EXTRAPLATDIR@,$EXTRAPLATDIR,;t t s, at EXTRAMACHDEPPATH@,$EXTRAMACHDEPPATH,;t t s, at CONFIGURE_MACOSX_DEPLOYMENT_TARGET@,$CONFIGURE_MACOSX_DEPLOYMENT_TARGET,;t t +s, at EXPORT_MACOSX_DEPLOYMENT_TARGET@,$EXPORT_MACOSX_DEPLOYMENT_TARGET,;t t s, at CXX@,$CXX,;t t s, at MAINOBJ@,$MAINOBJ,;t t s, at EXEEXT@,$EXEEXT,;t t Modified: python/branches/release24-maint/configure.in ============================================================================== --- python/branches/release24-maint/configure.in (original) +++ python/branches/release24-maint/configure.in Sun Oct 8 19:41:25 2006 @@ -60,6 +60,29 @@ AC_SUBST(CONFIG_ARGS) CONFIG_ARGS="$ac_configure_args" +AC_ARG_ENABLE(universalsdk, + AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build agains Mac OS X 10.4u SDK (ppc/i386)), +[ + case $enableval in + yes) + enableval=/Developer/SDKs/MacOSX10.4u.sdk + ;; + esac + case $enableval in + no) + UNIVERSALSDK= + enable_universalsdk= + ;; + *) + UNIVERSALSDK=$enableval + ;; + esac +],[ + UNIVERSALSDK= + enable_universalsdk= +]) +AC_SUBST(UNIVERSALSDK) + dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output AC_ARG_ENABLE(framework, AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework), @@ -74,6 +97,10 @@ PYTHONFRAMEWORKDIR=no-framework PYTHONFRAMEWORKPREFIX= PYTHONFRAMEWORKINSTALLDIR= + FRAMEWORKINSTALLFIRST= + FRAMEWORKINSTALLLAST= + FRAMEWORKALTINSTALLFIRST= + FRAMEWORKALTINSTALLLAST= enable_framework= ;; *) @@ -81,19 +108,49 @@ PYTHONFRAMEWORKDIR=Python.framework PYTHONFRAMEWORKPREFIX=$enableval PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR + FRAMEWORKINSTALLFIRST="frameworkinstallstructure" + FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools" + FRAMEWORKALTINSTALLFIRST="${FRAMEWORKINSTALLFIRST} bininstall maninstall" + FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + if test "x${prefix}" = "xNONE" ; then + FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" + else + FRAMEWORKUNIXTOOLSPREFIX="${prefix}" + fi + prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION + + # Add makefiles for Mac specific code to the list of output + # files: + AC_CONFIG_FILES(Mac/OSX/Makefile) + AC_CONFIG_FILES(Mac/OSX/PythonLauncher/Makefile) + AC_CONFIG_FILES(Mac/OSX/IDLE/Makefile) esac ],[ PYTHONFRAMEWORK= PYTHONFRAMEWORKDIR=no-framework PYTHONFRAMEWORKPREFIX= PYTHONFRAMEWORKINSTALLDIR= + FRAMEWORKINSTALLFIRST= + FRAMEWORKINSTALLLAST= + FRAMEWORKALTINSTALLFIRST= + FRAMEWORKALTINSTALLLAST= + if test "x${prefix}" = "xNONE" ; then + FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" + else + FRAMEWORKUNIXTOOLSPREFIX="${prefix}" + fi enable_framework= ]) AC_SUBST(PYTHONFRAMEWORK) AC_SUBST(PYTHONFRAMEWORKDIR) AC_SUBST(PYTHONFRAMEWORKPREFIX) AC_SUBST(PYTHONFRAMEWORKINSTALLDIR) +AC_SUBST(FRAMEWORKINSTALLFIRST) +AC_SUBST(FRAMEWORKINSTALLLAST) +AC_SUBST(FRAMEWORKALTINSTALLFIRST) +AC_SUBST(FRAMEWORKALTINSTALLLAST) +AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX) ##AC_ARG_WITH(dyld, ## AC_HELP_STRING(--with-dyld, @@ -175,7 +232,7 @@ # disables platform specific features beyond repair. # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE # has no effect, don't bother defining them - Darwin/@<:@78@:>@.*) + Darwin/@<:@789@:>@.*) define_xopen_source=no ;; @@ -258,7 +315,9 @@ # it may influence the way we can build extensions, so distutils # needs to check it AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET) +AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET) CONFIGURE_MACOSX_DEPLOYMENT_TARGET= +EXPORT_MACOSX_DEPLOYMENT_TARGET='#' # checks for alternative programs @@ -738,6 +797,10 @@ # is there any other compiler on Darwin besides gcc? Darwin*) BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd" + if test "${enable_universalsdk}"; then + BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + fi + ;; OSF*) BASECFLAGS="$BASECFLAGS -mieee" @@ -1238,7 +1301,10 @@ AC_SUBST(LIBTOOL_CRUFT) case $ac_sys_system/$ac_sys_release in Darwin/@<:@01234567@:>@.*) - LIBTOOL_CRUFT="-framework System -lcc_dynamic -arch_only ppc" + LIBTOOL_CRUFT="-framework System -lcc_dynamic" + if test -z "${enable_universalsdk}"; then + LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`" + fi LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; Darwin/*) @@ -1361,9 +1427,16 @@ # Use -undefined dynamic_lookup whenever possible (10.3 and later). # This allows an extension to be used in any Python cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'` + if test ${cur_target} '>' 10.2; then + cur_target=10.3 + fi CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} + EXPORT_MACOSX_DEPLOYMENT_TARGET='' if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2 then + if test "${enable_universalsdk}"; then + LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}" + fi LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' BLDSHARED="$LDSHARED" else @@ -2847,6 +2920,23 @@ # check for endianness AC_C_BIGENDIAN +AH_VERBATIM([WORDS_BIGENDIAN], +[ + /* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). + + The block below does compile-time checking for endianness on platforms + that use GCC and therefore allows compiling fat binaries on OSX by using + '-arch ppc -arch i386' as the compile flags. The phrasing was choosen + such that the configure-result is used on systems that don't use GCC. + */ +#ifdef __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#else +#ifndef __LITTLE_ENDIAN__ +#undef WORDS_BIGENDIAN +#endif +#endif]) # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). Modified: python/branches/release24-maint/pyconfig.h.in ============================================================================== --- python/branches/release24-maint/pyconfig.h.in (original) +++ python/branches/release24-maint/pyconfig.h.in Sun Oct 8 19:41:25 2006 @@ -804,9 +804,22 @@ /* Define to profile with the Pentium timestamp counter */ #undef WITH_TSC -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ + + /* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). + + The block below does compile-time checking for endianness on platforms + that use GCC and therefore allows compiling fat binaries on OSX by using + '-arch ppc -arch i386' as the compile flags. The phrasing was choosen + such that the configure-result is used on systems that don't use GCC. + */ +#ifdef __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#else +#ifndef __LITTLE_ENDIAN__ #undef WORDS_BIGENDIAN +#endif +#endif /* Define to 1 if on AIX 3. System headers sometimes define this. Modified: python/branches/release24-maint/setup.py ============================================================================== --- python/branches/release24-maint/setup.py (original) +++ python/branches/release24-maint/setup.py Sun Oct 8 19:41:25 2006 @@ -249,8 +249,8 @@ add_dir_to_list(self.compiler.library_dirs, '/sw/lib') add_dir_to_list(self.compiler.include_dirs, '/sw/include') # DarwinPorts installs into /opt/local by default - add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib') - add_dir_to_list(self.compiler.include_dirs, '/opt/local/include') + #add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib') + #add_dir_to_list(self.compiler.include_dirs, '/opt/local/include') if os.path.normpath(sys.prefix) != '/usr': add_dir_to_list(self.compiler.library_dirs, @@ -287,6 +287,23 @@ if platform in ['osf1', 'unixware7', 'openunix8']: lib_dirs += ['/usr/ccs/lib'] + if platform == 'darwin': + # This should work on any unixy platform ;-) + # If the user has bothered specifying additional -I and -L flags + # in OPT and LDFLAGS we might as well use them here. + # NOTE: using shlex.split would technically be more correct, but + # also gives a bootstrap problem. Let's hope nobody uses directories + # with whitespace in the name to store libraries. + cflags, ldflags = sysconfig.get_config_vars( + 'CFLAGS', 'LDFLAGS') + for item in cflags.split(): + if item.startswith('-I'): + inc_dirs.append(item[2:]) + + for item in ldflags.split(): + if item.startswith('-L'): + lib_dirs.append(item[2:]) + # Check for MacOS X, which doesn't need libm.a at all math_libs = ['m'] if platform in ['darwin', 'beos', 'mac']: @@ -436,8 +453,20 @@ ['/usr/lib/termcap'], 'termcap'): readline_libs.append('termcap') + + if sys.platform == 'darwin': + # In every directory on the search path search for a dynamic + # library and then a static library, instead of first looking + # for dynamic libraries on the entiry path. + # This way a staticly linked custom readline gets picked up + # before the (broken) dynamic library in /usr/lib. + readline_extra_link_args = ('-Wl,-search_paths_first',) + else: + readline_extra_link_args = () + exts.append( Extension('readline', ['readline.c'], library_dirs=['/usr/lib/termcap'], + extra_link_args=readline_extra_link_args, libraries=readline_libs) ) if platform not in ['mac']: # crypt module. @@ -525,6 +554,23 @@ db_inc_paths.append('/pkg/db-3.%d/include' % x) db_inc_paths.append('/opt/db-3.%d/include' % x) + # Add some common subdirectories for Sleepycat DB to the list, + # based on the standard include directories. This way DB3/4 gets + # picked up when it is installed in a non-standard prefix and + # the user has added that prefix into inc_dirs. + std_variants = [] + for dn in inc_dirs: + std_variants.append(os.path.join(dn, 'db3')) + std_variants.append(os.path.join(dn, 'db4')) + for x in (0,1,2,3,4): + std_variants.append(os.path.join(dn, "db4%d"%x)) + std_variants.append(os.path.join(dn, "db4.%d"%x)) + for x in (2,3): + std_variants.append(os.path.join(dn, "db3%d"%x)) + std_variants.append(os.path.join(dn, "db3.%d"%x)) + + db_inc_paths = std_variants + db_inc_paths + db_ver_inc_map = {} class db_found(Exception): pass @@ -760,22 +806,10 @@ # # More information on Expat can be found at www.libexpat.org. # - if sys.byteorder == "little": - xmlbo = "1234" - else: - xmlbo = "4321" expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat') define_macros = [ - ('XML_NS', '1'), - ('XML_DTD', '1'), - ('BYTEORDER', xmlbo), - ('XML_CONTEXT_BYTES','1024'), + ('HAVE_EXPAT_CONFIG_H', '1'), ] - config_h = sysconfig.get_config_h_filename() - config_h_vars = sysconfig.parse_config_h(open(config_h)) - for feature_macro in ['HAVE_MEMMOVE', 'HAVE_BCOPY']: - if config_h_vars.has_key(feature_macro): - define_macros.append((feature_macro, '1')) exts.append(Extension('pyexpat', define_macros = define_macros, include_dirs = [expatinc], From python-checkins at python.org Sun Oct 8 19:43:31 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:43:31 +0200 (CEST) Subject: [Python-checkins] r52232 - python/branches/release24-maint/Mac/OSX/PythonLauncher/FileSettings.m Message-ID: <20061008174331.6B18D1E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:43:31 2006 New Revision: 52232 Modified: python/branches/release24-maint/Mac/OSX/PythonLauncher/FileSettings.m Log: Backport of missing part of r52229 Modified: python/branches/release24-maint/Mac/OSX/PythonLauncher/FileSettings.m ============================================================================== --- python/branches/release24-maint/Mac/OSX/PythonLauncher/FileSettings.m (original) +++ python/branches/release24-maint/Mac/OSX/PythonLauncher/FileSettings.m Sun Oct 8 19:43:31 2006 @@ -291,7 +291,7 @@ tabs?" -t":"", others, [self _replaceSingleQuotes:script], - scriptargs, + scriptargs?scriptargs:@"", with_terminal? "&& echo Exit status: $? && exit 1" : " &"]; } From python-checkins at python.org Sun Oct 8 19:49:52 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:49:52 +0200 (CEST) Subject: [Python-checkins] r52233 - python/trunk/Lib/distutils/sysconfig.py Message-ID: <20061008174952.8044F1E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:49:52 2006 New Revision: 52233 Modified: python/trunk/Lib/distutils/sysconfig.py Log: MacOSX: distutils changes the values of BASECFLAGS and LDFLAGS when using a universal build of python on OSX 10.3 to ensure that those flags can be used to compile code (the universal build uses compiler flags that aren't supported on 10.3). This patches gives the same treatment to CFLAGS, PY_CFLAGS and BLDSHARED. Modified: python/trunk/Lib/distutils/sysconfig.py ============================================================================== --- python/trunk/Lib/distutils/sysconfig.py (original) +++ python/trunk/Lib/distutils/sysconfig.py Sun Oct 8 19:49:52 2006 @@ -509,7 +509,10 @@ # are in CFLAGS or LDFLAGS and remove them if they are. # This is needed when building extensions on a 10.3 system # using a universal build of python. - for key in ('LDFLAGS', 'BASECFLAGS'): + for key in ('LDFLAGS', 'BASECFLAGS', + # a number of derived variables. These need to be + # patched up as well. + 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): flags = _config_vars[key] flags = re.sub('-arch\s+\w+\s', ' ', flags) flags = re.sub('-isysroot [^ \t]*', ' ', flags) From python-checkins at python.org Sun Oct 8 19:50:26 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:50:26 +0200 (CEST) Subject: [Python-checkins] r52234 - python/branches/release25-maint/Lib/distutils/sysconfig.py Message-ID: <20061008175026.581261E400D@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:50:26 2006 New Revision: 52234 Modified: python/branches/release25-maint/Lib/distutils/sysconfig.py Log: Backport of r52233 Modified: python/branches/release25-maint/Lib/distutils/sysconfig.py ============================================================================== --- python/branches/release25-maint/Lib/distutils/sysconfig.py (original) +++ python/branches/release25-maint/Lib/distutils/sysconfig.py Sun Oct 8 19:50:26 2006 @@ -509,7 +509,11 @@ # are in CFLAGS or LDFLAGS and remove them if they are. # This is needed when building extensions on a 10.3 system # using a universal build of python. - for key in ('LDFLAGS', 'BASECFLAGS'): + for key in ('LDFLAGS', 'BASECFLAGS', + # a number of derived variables. These need to be + # patched up as well. + 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + flags = _config_vars[key] flags = re.sub('-arch\s+\w+\s', ' ', flags) flags = re.sub('-isysroot [^ \t]*', ' ', flags) From python-checkins at python.org Sun Oct 8 19:51:25 2006 From: python-checkins at python.org (skip.montanaro) Date: Sun, 8 Oct 2006 19:51:25 +0200 (CEST) Subject: [Python-checkins] r52235 - python/branches/release25-maint/Doc/lib/libcsv.tex Message-ID: <20061008175125.5C2CF1E4004@bag.python.org> Author: skip.montanaro Date: Sun Oct 8 19:51:24 2006 New Revision: 52235 Modified: python/branches/release25-maint/Doc/lib/libcsv.tex Log: Backport libcsv.tex bugfix from rev 52218. (SF ticket 1572471) Modified: python/branches/release25-maint/Doc/lib/libcsv.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libcsv.tex (original) +++ python/branches/release25-maint/Doc/lib/libcsv.tex Sun Oct 8 19:51:24 2006 @@ -64,9 +64,9 @@ class or one of the strings returned by the \function{list_dialects} function. The other optional {}\var{fmtparam} keyword arguments can be given to override individual formatting parameters in the current -dialect. For more information about the dialect and formatting +dialect. For full details about the dialect and formatting parameters, see section~\ref{csv-fmt-params}, ``Dialects and Formatting -Parameters'' for details of these parameters. +Parameters''. All data read are returned as strings. No automatic data type conversion is performed. @@ -96,10 +96,10 @@ of a subclass of the \class{Dialect} class or one of the strings returned by the \function{list_dialects} function. The other optional {}\var{fmtparam} keyword arguments can be given to override individual -formatting parameters in the current dialect. For more information +formatting parameters in the current dialect. For full details about the dialect and formatting parameters, see -section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters'' for -details of these parameters. To make it as easy as possible to +section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters''. +To make it as easy as possible to interface with modules which implement the DB API, the value \constant{None} is written as the empty string. While this isn't a reversible transformation, it makes it easier to dump SQL NULL data values @@ -113,9 +113,8 @@ or Unicode object. The dialect can be specified either by passing a sub-class of \class{Dialect}, or by \var{fmtparam} keyword arguments, or both, with keyword arguments overriding parameters of the dialect. -For more information about the dialect and formatting parameters, see -section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters'' -for details of these parameters. +For full details about the dialect and formatting parameters, see +section~\ref{csv-fmt-params}, ``Dialects and Formatting Parameters''. \end{funcdesc} \begin{funcdesc}{unregister_dialect}{name} @@ -197,12 +196,13 @@ \begin{classdesc}{excel}{} The \class{excel} class defines the usual properties of an Excel-generated -CSV file. +CSV file. It is registered with the dialect name \code{'excel'}. \end{classdesc} \begin{classdesc}{excel_tab}{} The \class{excel_tab} class defines the usual properties of an -Excel-generated TAB-delimited file. +Excel-generated TAB-delimited file. It is registered with the dialect name +\code{'excel-tab'}. \end{classdesc} \begin{classdesc}{Sniffer}{} From python-checkins at python.org Sun Oct 8 19:51:46 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:51:46 +0200 (CEST) Subject: [Python-checkins] r52236 - python/trunk/Lib/distutils/unixccompiler.py Message-ID: <20061008175146.6F6D81E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:51:46 2006 New Revision: 52236 Modified: python/trunk/Lib/distutils/unixccompiler.py Log: MacOSX: The universal build requires that users have the MacOSX10.4u SDK installed to build extensions. This patch makes distutils emit a warning when the compiler should use an SDK but that SDK is not installed, hopefully reducing some confusion. Modified: python/trunk/Lib/distutils/unixccompiler.py ============================================================================== --- python/trunk/Lib/distutils/unixccompiler.py (original) +++ python/trunk/Lib/distutils/unixccompiler.py Sun Oct 8 19:51:46 2006 @@ -82,6 +82,22 @@ except ValueError: pass + # Check if the SDK that is used during compilation actually exists, + # the universal build requires the usage of a universal SDK and not all + # users have that installed by default. + sysroot = None + if '-isysroot' in cc_args: + idx = cc_args.index('-isysroot') + sysroot = cc_args[idx+1] + elif '-isysroot' in compiler_so: + idx = compiler_so.index('-isysroot') + sysroot = compiler_so[idx+1] + + if sysroot and not os.path.isdir(sysroot): + log.warn("Compiling with an SDK that doesn't seem to exist: %s", + sysroot) + log.warn("Please check your Xcode installation") + return compiler_so class UnixCCompiler(CCompiler): From python-checkins at python.org Sun Oct 8 19:52:37 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 19:52:37 +0200 (CEST) Subject: [Python-checkins] r52237 - python/branches/release25-maint/Lib/distutils/unixccompiler.py Message-ID: <20061008175237.496F71E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 19:52:37 2006 New Revision: 52237 Modified: python/branches/release25-maint/Lib/distutils/unixccompiler.py Log: Backport of r52236 Modified: python/branches/release25-maint/Lib/distutils/unixccompiler.py ============================================================================== --- python/branches/release25-maint/Lib/distutils/unixccompiler.py (original) +++ python/branches/release25-maint/Lib/distutils/unixccompiler.py Sun Oct 8 19:52:37 2006 @@ -82,6 +82,22 @@ except ValueError: pass + # Check if the SDK that is used during compilation actually exists, + # the universal build requires the usage of a universal SDK and not all + # users have that installed by default. + sysroot = None + if '-isysroot' in cc_args: + idx = cc_args.index('-isysroot') + sysroot = cc_args[idx+1] + elif '-isysroot' in compiler_so: + idx = compiler_so.index('-isysroot') + sysroot = compiler_so[idx+1] + + if sysroot and not os.path.isdir(sysroot): + log.warn("Compiling with an SDK that doesn't seem to exist: %s", + sysroot) + log.warn("Please check your Xcode installation") + return compiler_so class UnixCCompiler(CCompiler): From buildbot at python.org Sun Oct 8 19:55:41 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 17:55:41 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061008175541.CD6491E400C@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/135 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sun Oct 8 20:18:26 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 20:18:26 +0200 (CEST) Subject: [Python-checkins] r52238 - python/trunk/Mac/BuildScript/scripts/postflight.patch-profile Message-ID: <20061008181826.F02CE1E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 20:18:26 2006 New Revision: 52238 Modified: python/trunk/Mac/BuildScript/scripts/postflight.patch-profile Log: MacOSX: add more logic to recognize the correct startup file to patch to the shell profile patching post-install script. Modified: python/trunk/Mac/BuildScript/scripts/postflight.patch-profile ============================================================================== --- python/trunk/Mac/BuildScript/scripts/postflight.patch-profile (original) +++ python/trunk/Mac/BuildScript/scripts/postflight.patch-profile Sun Oct 8 20:18:26 2006 @@ -47,22 +47,29 @@ echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough" case "${BSH}" in *csh) + if [ -f "${HOME}/.tcshrc" ]; then + RC="${HOME}/.tcshrc" + else + RC="${HOME}/.cshrc" + fi # Create backup copy before patching - if [ -f "${HOME}/.cshrc" ]; then - cp -fp "${HOME}/.cshrc" "${HOME}/.cshrc.pysave" + if [ -f "${RC}" ]; then + cp -fp "${RC}" "${RC}.pysave" fi - echo "" >> "${HOME}/.cshrc" - echo "# Setting PATH for MacPython ${PYVER}" >> "${HOME}/.cshrc" - echo "# The orginal version is saved in .cshrc.pysave" >> "${HOME}/.cshrc" - echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc" + echo "" >> "${RC}" + echo "# Setting PATH for MacPython ${PYVER}" >> "${RC}" + echo "# The orginal version is saved in .cshrc.pysave" >> "${RC}" + echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${RC}" if [ `id -ur` = 0 ]; then - chown "${USER}" "${HOME}/.cshrc" + chown "${USER}" "${RC}" fi exit 0 ;; bash) if [ -e "${HOME}/.bash_profile" ]; then PR="${HOME}/.bash_profile" + elif [ -e "${HOME}/.bash_login" ]; then + PR="${HOME}/.bash_login" elif [ -e "${HOME}/.profile" ]; then PR="${HOME}/.profile" else From python-checkins at python.org Sun Oct 8 20:19:29 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 20:19:29 +0200 (CEST) Subject: [Python-checkins] r52239 - python/branches/release25-maint/Mac/BuildScript/scripts/postflight.patch-profile Message-ID: <20061008181929.298501E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 20:19:28 2006 New Revision: 52239 Modified: python/branches/release25-maint/Mac/BuildScript/scripts/postflight.patch-profile Log: Backport of r52238 Modified: python/branches/release25-maint/Mac/BuildScript/scripts/postflight.patch-profile ============================================================================== --- python/branches/release25-maint/Mac/BuildScript/scripts/postflight.patch-profile (original) +++ python/branches/release25-maint/Mac/BuildScript/scripts/postflight.patch-profile Sun Oct 8 20:19:28 2006 @@ -47,22 +47,29 @@ echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough" case "${BSH}" in *csh) + if [ -f "${HOME}/.tcshrc" ]; then + RC="${HOME}/.tcshrc" + else + RC="${HOME}/.cshrc" + fi # Create backup copy before patching - if [ -f "${HOME}/.cshrc" ]; then - cp -fp "${HOME}/.cshrc" "${HOME}/.cshrc.pysave" + if [ -f "${RC}" ]; then + cp -fp "${RC}" "${RC}.pysave" fi - echo "" >> "${HOME}/.cshrc" - echo "# Setting PATH for MacPython ${PYVER}" >> "${HOME}/.cshrc" - echo "# The orginal version is saved in .cshrc.pysave" >> "${HOME}/.cshrc" - echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc" + echo "" >> "${RC}" + echo "# Setting PATH for MacPython ${PYVER}" >> "${RC}" + echo "# The orginal version is saved in .cshrc.pysave" >> "${RC}" + echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${RC}" if [ `id -ur` = 0 ]; then - chown "${USER}" "${HOME}/.cshrc" + chown "${USER}" "${RC}" fi exit 0 ;; bash) if [ -e "${HOME}/.bash_profile" ]; then PR="${HOME}/.bash_profile" + elif [ -e "${HOME}/.bash_login" ]; then + PR="${HOME}/.bash_login" elif [ -e "${HOME}/.profile" ]; then PR="${HOME}/.profile" else From python-checkins at python.org Sun Oct 8 20:20:10 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 8 Oct 2006 20:20:10 +0200 (CEST) Subject: [Python-checkins] r52240 - python/branches/release24-maint/Mac/BuildScript/scripts/postflight.patch-profile Message-ID: <20061008182010.A5C931E400E@bag.python.org> Author: ronald.oussoren Date: Sun Oct 8 20:20:10 2006 New Revision: 52240 Modified: python/branches/release24-maint/Mac/BuildScript/scripts/postflight.patch-profile Log: Backport of r52238 Modified: python/branches/release24-maint/Mac/BuildScript/scripts/postflight.patch-profile ============================================================================== --- python/branches/release24-maint/Mac/BuildScript/scripts/postflight.patch-profile (original) +++ python/branches/release24-maint/Mac/BuildScript/scripts/postflight.patch-profile Sun Oct 8 20:20:10 2006 @@ -5,14 +5,27 @@ echo "These changes will be effective only in shell windows that you open" echo "after running this script." -PYVER=@PYVER@ +PYVER=2.5 PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/Current" +if [ `id -ur` = 0 ]; then + # Run from the installer, do some trickery to fetch the information + # we need. + theShell="`finger $USER | grep Shell: | head -1 | awk '{ print $NF }'`" + +else + theShell="${SHELL}" +fi + # Make sure the directory ${PYTHON_ROOT}/bin is on the users PATH. -BSH="`basename "${SHELL}"`" +BSH="`basename "${theShell}"`" case "${BSH}" in bash|ksh|sh|*csh) - P="`${SHELL} -c 'echo $PATH'`" + if [ `id -ur` = 0 ]; then + P=`su - ${USER} -c 'echo A-X-4-X@@$PATH@@X-4-X-A' | grep 'A-X-4-X@@.*@@X-4-X-A' | sed -e 's/^A-X-4-X@@//g' -e 's/@@X-4-X-A$//g'` + else + P="`(exec -l ${theShell} -c 'echo $PATH')`" + fi ;; *) echo "Sorry, I don't know how to patch $BSH shells" @@ -34,18 +47,30 @@ echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough" case "${BSH}" in *csh) + if [ -f "${HOME}/.tcshrc" ]; then + RC="${HOME}/.tcshrc" + else + RC="${HOME}/.cshrc" + fi # Create backup copy before patching - if [ -f "${HOME}/.cshrc" ]; then - cp -fp "${HOME}/.cshrc" "${HOME}/.cshrc.pysave" + if [ -f "${RC}" ]; then + cp -fp "${RC}" "${RC}.pysave" + fi + echo "" >> "${RC}" + echo "# Setting PATH for MacPython ${PYVER}" >> "${RC}" + echo "# The orginal version is saved in .cshrc.pysave" >> "${RC}" + echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${RC}" + if [ `id -ur` = 0 ]; then + chown "${USER}" "${RC}" fi - echo "" >> "${HOME}/.cshrc" - echo "# Setting PATH for MacPython ${PYVER}" >> "${HOME}/.cshrc" - echo "# The orginal version is saved in .cshrc.pysave" >> "${HOME}/.cshrc" - echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc" exit 0 ;; bash) - if [ -e "${HOME}/.profile" ]; then + if [ -e "${HOME}/.bash_profile" ]; then + PR="${HOME}/.bash_profile" + elif [ -e "${HOME}/.bash_login" ]; then + PR="${HOME}/.bash_login" + elif [ -e "${HOME}/.profile" ]; then PR="${HOME}/.profile" else PR="${HOME}/.bash_profile" @@ -66,6 +91,6 @@ echo 'PATH="'"${PYTHON_ROOT}/bin"':${PATH}"' >> "${PR}" echo 'export PATH' >> "${PR}" if [ `id -ur` = 0 ]; then - chown "${LOGNAME}" "${PR}" + chown "${USER}" "${PR}" fi exit 0 From buildbot at python.org Sun Oct 8 21:01:52 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 19:01:52 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20061008190152.84B301E400F@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/1554 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 8 21:24:06 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 19:24:06 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.4 Message-ID: <20061008192406.3F9991E400B@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.4/builds/45 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: hyeshik.chang,ronald.oussoren Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 8 21:46:24 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 19:46:24 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian trunk Message-ID: <20061008194624.61CE71E4003@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/598 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon Oct 9 00:07:30 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 22:07:30 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian 2.4 Message-ID: <20061008220730.998041E4004@bag.python.org> The Buildbot has detected a new failure of alpha Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%25202.4/builds/52 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: ronald.oussoren Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon Oct 9 00:53:12 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 22:53:12 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061008225312.D91CA1E4004@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/137 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Mon Oct 9 01:45:34 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Oct 2006 23:45:34 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian trunk Message-ID: <20061008234534.B40721E4004@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/600 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: The web-page 'force build' button was pressed by 'nnorwitz': retry build Build Source Stamp: [branch trunk] HEAD Blamelist: Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon Oct 9 19:10:13 2006 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 9 Oct 2006 19:10:13 +0200 (CEST) Subject: [Python-checkins] r52242 - python/trunk/Misc/NEWS Message-ID: <20061009171013.1EA4D1E4008@bag.python.org> Author: andrew.kuchling Date: Mon Oct 9 19:10:12 2006 New Revision: 52242 Modified: python/trunk/Misc/NEWS Log: Add news item for rev. 52211 change Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Oct 9 19:10:12 2006 @@ -112,6 +112,9 @@ - Patch #1550886: Fix decimal module context management implementation to match the localcontext() example from PEP 343. +- Bug #1545341: The 'classifier' keyword argument to the Distutils setup() + function now accepts tuples as well as lists. + - Bug #1541863: uuid.uuid1 failed to generate unique identifiers on systems with low clock resolution. From python-checkins at python.org Mon Oct 9 19:13:27 2006 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 9 Oct 2006 19:13:27 +0200 (CEST) Subject: [Python-checkins] r52243 - in python/branches/release25-maint: Lib/distutils/command/register.py Misc/NEWS Message-ID: <20061009171327.135B91E4008@bag.python.org> Author: andrew.kuchling Date: Mon Oct 9 19:13:26 2006 New Revision: 52243 Modified: python/branches/release25-maint/Lib/distutils/command/register.py python/branches/release25-maint/Misc/NEWS Log: [Bug #1545341] Let the 'classifiers' parameter be a tuple as well as a list. Modified: python/branches/release25-maint/Lib/distutils/command/register.py ============================================================================== --- python/branches/release25-maint/Lib/distutils/command/register.py (original) +++ python/branches/release25-maint/Lib/distutils/command/register.py Mon Oct 9 19:13:26 2006 @@ -251,7 +251,7 @@ body = StringIO.StringIO() for key, value in data.items(): # handle multiple entries for the same name - if type(value) != type([]): + if type(value) not in (type([]), type( () )): value = [value] for value in value: value = unicode(value).encode("utf-8") Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Oct 9 19:13:26 2006 @@ -65,6 +65,9 @@ - Bug #1446043: correctly raise a LookupError if an encoding name given to encodings.search_function() contains a dot. +- Bug #1545341: The 'classifier' keyword argument to the Distutils setup() + function now accepts tuples as well as lists. + - Bug #1560617: in pyclbr, return full module name not only for classes, but also for functions. From python-checkins at python.org Mon Oct 9 19:15:39 2006 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 9 Oct 2006 19:15:39 +0200 (CEST) Subject: [Python-checkins] r52244 - in python/branches/release24-maint: Lib/distutils/command/register.py Misc/NEWS Message-ID: <20061009171539.E44921E4014@bag.python.org> Author: andrew.kuchling Date: Mon Oct 9 19:15:39 2006 New Revision: 52244 Modified: python/branches/release24-maint/Lib/distutils/command/register.py python/branches/release24-maint/Misc/NEWS Log: [Bug #1545341] Let the 'classifiers' parameter be a tuple as well as a list. Modified: python/branches/release24-maint/Lib/distutils/command/register.py ============================================================================== --- python/branches/release24-maint/Lib/distutils/command/register.py (original) +++ python/branches/release24-maint/Lib/distutils/command/register.py Mon Oct 9 19:15:39 2006 @@ -245,7 +245,7 @@ body = StringIO.StringIO() for key, value in data.items(): # handle multiple entries for the same name - if type(value) != type([]): + if type(value) not in (type([]), type( () )): value = [value] for value in value: value = unicode(value).encode("utf-8") Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Mon Oct 9 19:15:39 2006 @@ -140,6 +140,9 @@ Library ------- +- Bug #1545341: The 'classifier' keyword argument to the Distutils setup() + function now accepts tuples as well as lists. + - Bug #1560617: in pyclbr, return full module name not only for classes, but also for functions. From python-checkins at python.org Mon Oct 9 20:05:20 2006 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 9 Oct 2006 20:05:20 +0200 (CEST) Subject: [Python-checkins] r52245 - python/trunk/Objects/typeobject.c Message-ID: <20061009180520.275941E4008@bag.python.org> Author: andrew.kuchling Date: Mon Oct 9 20:05:19 2006 New Revision: 52245 Modified: python/trunk/Objects/typeobject.c Log: Fix wording in comment Modified: python/trunk/Objects/typeobject.c ============================================================================== --- python/trunk/Objects/typeobject.c (original) +++ python/trunk/Objects/typeobject.c Mon Oct 9 20:05:19 2006 @@ -3743,7 +3743,7 @@ while (type && type->tp_flags & Py_TPFLAGS_HEAPTYPE) type = type->tp_base; /* If type is NULL now, this is a really weird type. - In the same of backwards compatibility (?), just shut up. */ + In the spirit of backwards compatibility (?), just shut up. */ if (type && type->tp_setattro != func) { PyErr_Format(PyExc_TypeError, "can't apply this %s to %s object", @@ -3960,7 +3960,7 @@ while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) staticbase = staticbase->tp_base; /* If staticbase is NULL now, it is a really weird type. - In the same of backwards compatibility (?), just shut up. */ + In the spirit of backwards compatibility (?), just shut up. */ if (staticbase && staticbase->tp_new != type->tp_new) { PyErr_Format(PyExc_TypeError, "%s.__new__(%s) is not safe, use %s.__new__()", From buildbot at python.org Mon Oct 9 20:10:31 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Oct 2006 18:10:31 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian 2.5 Message-ID: <20061009181031.348E41E4008@bag.python.org> The Buildbot has detected a new failure of alpha Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%25202.5/builds/59 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon Oct 9 20:19:02 2006 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 9 Oct 2006 20:19:02 +0200 (CEST) Subject: [Python-checkins] r52246 - python/branches/release24-maint/Objects/typeobject.c Message-ID: <20061009181902.345701E400B@bag.python.org> Author: andrew.kuchling Date: Mon Oct 9 20:19:01 2006 New Revision: 52246 Modified: python/branches/release24-maint/Objects/typeobject.c Log: [Backport r42951 | guido.van.rossum] Fix three nits found by Coverity, adding null checks and comments. [This commit only makes two changes. One change in the original patch is just adding a comment, and another adds a 'base != NULL' check to silence Coverity, but a comment adds that that base is never going to be NULL. I didn't backport that change. --amk] Modified: python/branches/release24-maint/Objects/typeobject.c ============================================================================== --- python/branches/release24-maint/Objects/typeobject.c (original) +++ python/branches/release24-maint/Objects/typeobject.c Mon Oct 9 20:19:01 2006 @@ -3712,7 +3712,9 @@ PyTypeObject *type = self->ob_type; while (type && type->tp_flags & Py_TPFLAGS_HEAPTYPE) type = type->tp_base; - if (type->tp_setattro != func) { + /* If type is NULL now, this is a really weird type. + In the spirit of backwards compatibility (?), just shut up. */ + if (type && type->tp_setattro != func) { PyErr_Format(PyExc_TypeError, "can't apply this %s to %s object", what, @@ -3927,7 +3929,9 @@ staticbase = subtype; while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) staticbase = staticbase->tp_base; - if (staticbase->tp_new != type->tp_new) { + /* If staticbase is NULL now, this is a really weird type. + In the spirit of backwards compatibility (?), just shut up. */ + if (staticbase && staticbase->tp_new != type->tp_new) { PyErr_Format(PyExc_TypeError, "%s.__new__(%s) is not safe, use %s.__new__()", type->tp_name, From python-checkins at python.org Mon Oct 9 20:30:14 2006 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 9 Oct 2006 20:30:14 +0200 (CEST) Subject: [Python-checkins] r52247 - python/branches/release24-maint/Modules/_csv.c python/branches/release24-maint/Modules/_ssl.c Message-ID: <20061009183014.73BD41E4008@bag.python.org> Author: andrew.kuchling Date: Mon Oct 9 20:30:13 2006 New Revision: 52247 Modified: python/branches/release24-maint/Modules/_csv.c python/branches/release24-maint/Modules/_ssl.c Log: [Partial backport of r45947 | neal.norwitz] Fix problems found by Coverity. _ssl.c: under fail: self is DECREF'd, but it would have been NULL. _csv.c: I'm not sure if lineterminator could have been anything other than a string. However, other string method calls are checked, so check this one too. Modified: python/branches/release24-maint/Modules/_csv.c ============================================================================== --- python/branches/release24-maint/Modules/_csv.c (original) +++ python/branches/release24-maint/Modules/_csv.c Mon Oct 9 20:30:13 2006 @@ -1051,6 +1051,8 @@ int terminator_len; terminator_len = PyString_Size(self->dialect->lineterminator); + if (terminator_len == -1) + return 0; /* grow record buffer if necessary */ if (!join_check_rec_size(self, self->rec_len + terminator_len)) Modified: python/branches/release24-maint/Modules/_ssl.c ============================================================================== --- python/branches/release24-maint/Modules/_ssl.c (original) +++ python/branches/release24-maint/Modules/_ssl.c Mon Oct 9 20:30:13 2006 @@ -184,9 +184,9 @@ int sockstate; self = PyObject_New(PySSLObject, &PySSL_Type); /* Create new object */ - if (self == NULL){ - errstr = "newPySSLObject error"; - goto fail; + if (self == NULL) { + PyErr_SetString(PySSLErrorObject, "newPySSLObject error"); + return NULL; } memset(self->server, '\0', sizeof(char) * X509_NAME_MAXLEN); memset(self->issuer, '\0', sizeof(char) * X509_NAME_MAXLEN); From python-checkins at python.org Mon Oct 9 20:42:08 2006 From: python-checkins at python.org (brett.cannon) Date: Mon, 9 Oct 2006 20:42:08 +0200 (CEST) Subject: [Python-checkins] r52248 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061009184208.40D7E1E4008@bag.python.org> Author: brett.cannon Date: Mon Oct 9 20:42:07 2006 New Revision: 52248 Modified: sandbox/trunk/import_in_py/importer.py Log: Clarify note on vagueness of PEP 302 to state that it is a clarification and not a design decision. The PEP might be vague but the code isn't. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Mon Oct 9 20:42:07 2006 @@ -13,9 +13,9 @@ * __import__ function http://docs.python.org/lib/built-in-funcs.html -Some design decisions have been made in this implementation. One is to raise -an ImportError if a call to load_module() on a loader fails to load a module. -PEP 302 does not specify what to do in the failing case. +Clarifications for PEP 302: + * Raise ImportError when load_module() fails to load a module without + raising an exception. Possible Py3K improvements: * Have __import__ check for sys.modules entry to alleviate need for every From python-checkins at python.org Mon Oct 9 20:42:49 2006 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 9 Oct 2006 20:42:49 +0200 (CEST) Subject: [Python-checkins] r52249 - python/branches/release24-maint/Objects/longobject.c Message-ID: <20061009184249.ED87A1E4008@bag.python.org> Author: andrew.kuchling Date: Mon Oct 9 20:42:49 2006 New Revision: 52249 Modified: python/branches/release24-maint/Objects/longobject.c Log: [Partial backport of r45947 | neal.norwitz] Fix problems found by Coverity. longobject.c: also fix an ssize_t problem could have been NULL, so hoist the size calc to not use . [The ssize_t change isn't needed for 2.4. The other changes in this revision are to modules not present in 2.4. --amk] Modified: python/branches/release24-maint/Objects/longobject.c ============================================================================== --- python/branches/release24-maint/Objects/longobject.c (original) +++ python/branches/release24-maint/Objects/longobject.c Mon Oct 9 20:42:49 2006 @@ -1468,9 +1468,10 @@ assert(size_w == ABS(w->ob_size)); /* That's how d was calculated */ size_v = ABS(v->ob_size); - a = _PyLong_New(size_v - size_w + 1); + k = size_v - size_w; + a = _PyLong_New(k + 1); - for (j = size_v, k = a->ob_size-1; a != NULL && k >= 0; --j, --k) { + for (j = size_v; a != NULL && k >= 0; --j, --k) { digit vj = (j >= size_v) ? 0 : v->ob_digit[j]; twodigits q; stwodigits carry = 0; From python-checkins at python.org Mon Oct 9 20:47:22 2006 From: python-checkins at python.org (brett.cannon) Date: Mon, 9 Oct 2006 20:47:22 +0200 (CEST) Subject: [Python-checkins] r52250 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061009184722.BA3631E4008@bag.python.org> Author: brett.cannon Date: Mon Oct 9 20:47:22 2006 New Revision: 52250 Modified: sandbox/trunk/import_in_py/importer.py Log: Add rough bytecode handler (contributed by Paul Moore). No tests yet. Also lacking error checking. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Mon Oct 9 20:47:22 2006 @@ -189,8 +189,21 @@ # XXX 'handles' should be a property that returns based on whether -O was # specified when running the interpreter. + handles = 'pyc' # XXX Should probably add a handle_string() method to PySourceHandler() so # that if the .pyc is outdated it can easily use PySourceHandler to do the # import for it and then write out the new .pyc . # XXX Writing out a new .pyc should be made optional. + + def handle_file(self, module, fullname, path, file_path): + """Import the Python bytecode file at 'path' and use it to initialize + 'module'.""" + module.__file__ = file_path + module.__name__ = fullname + with open(file_path, 'rb') as bytecode_file: + magic = bytecode_file.read(4) + mtime = bytecode_file.read(4) + compiled_code = marshal.load(bytecode_file) + exec compiled_code in module.__dict__ + return module From python-checkins at python.org Mon Oct 9 21:03:09 2006 From: python-checkins at python.org (georg.brandl) Date: Mon, 9 Oct 2006 21:03:09 +0200 (CEST) Subject: [Python-checkins] r52251 - in python/trunk: Misc/NEWS PC/_msi.c Message-ID: <20061009190309.5E9501E4008@bag.python.org> Author: georg.brandl Date: Mon Oct 9 21:03:06 2006 New Revision: 52251 Modified: python/trunk/Misc/NEWS python/trunk/PC/_msi.c Log: Patch #1572724: fix typo ('=' instead of '==') in _msi.c. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Oct 9 21:03:06 2006 @@ -126,6 +126,8 @@ Extension Modules ----------------- +- Patch #1572724: fix typo ('=' instead of '==') in _msi.c. + - Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP unicode characters. Modified: python/trunk/PC/_msi.c ============================================================================== --- python/trunk/PC/_msi.c (original) +++ python/trunk/PC/_msi.c Mon Oct 9 21:03:06 2006 @@ -495,7 +495,7 @@ status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, &fval, sval, &ssize); - if (status = ERROR_MORE_DATA) { + if (status == ERROR_MORE_DATA) { sval = malloc(ssize); status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, &fval, sval, &ssize); From python-checkins at python.org Mon Oct 9 21:03:13 2006 From: python-checkins at python.org (georg.brandl) Date: Mon, 9 Oct 2006 21:03:13 +0200 (CEST) Subject: [Python-checkins] r52252 - in python/branches/release25-maint: Misc/NEWS PC/_msi.c Message-ID: <20061009190313.8A3481E400F@bag.python.org> Author: georg.brandl Date: Mon Oct 9 21:03:12 2006 New Revision: 52252 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/PC/_msi.c Log: Patch #1572724: fix typo ('=' instead of '==') in _msi.c. (backport from rev. 52251) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Oct 9 21:03:12 2006 @@ -49,6 +49,8 @@ Extension Modules ----------------- +- Patch #1572724: fix typo ('=' instead of '==') in _msi.c. + - Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP unicode characters. Modified: python/branches/release25-maint/PC/_msi.c ============================================================================== --- python/branches/release25-maint/PC/_msi.c (original) +++ python/branches/release25-maint/PC/_msi.c Mon Oct 9 21:03:12 2006 @@ -495,7 +495,7 @@ status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, &fval, sval, &ssize); - if (status = ERROR_MORE_DATA) { + if (status == ERROR_MORE_DATA) { sval = malloc(ssize); status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, &fval, sval, &ssize); From python-checkins at python.org Mon Oct 9 21:29:07 2006 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 9 Oct 2006 21:29:07 +0200 (CEST) Subject: [Python-checkins] r52253 - in python/branches/release24-maint: Doc/lib/libos.tex Lib/test/test_posix.py Misc/NEWS Modules/posixmodule.c Message-ID: <20061009192907.D23B11E4008@bag.python.org> Author: martin.v.loewis Date: Mon Oct 9 21:29:06 2006 New Revision: 52253 Modified: python/branches/release24-maint/Doc/lib/libos.tex python/branches/release24-maint/Lib/test/test_posix.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Modules/posixmodule.c Log: Backport r45505, r45573, r45576 - reset errno before calling confstr - use confstr() doc to simplify checks afterwards - Correct implementation and documentation of os.confstr. Add a simple test case. I've yet to figure out how to provoke a None return I can test. - Address issues brought up by MvL on python-checkins. I tested this with valgrind on amd64. The man pages I found for diff architectures are inconsistent on this. I'm not entirely sure this change is correct for all architectures either. Perhaps we should just over-allocate and not worry about it? The change to return None instead of "" in case of unconfigured values has not been backported. Modified: python/branches/release24-maint/Doc/lib/libos.tex ============================================================================== --- python/branches/release24-maint/Doc/lib/libos.tex (original) +++ python/branches/release24-maint/Doc/lib/libos.tex Mon Oct 9 21:29:06 2006 @@ -1773,7 +1773,7 @@ string which is the name of a defined system value; these names are specified in a number of standards (\POSIX, \UNIX{} 95, \UNIX{} 98, and others). Some platforms define additional names as well. The names -known to the host operating system are given in the +known to the host operating system are given as the keys of the \code{confstr_names} dictionary. For configuration variables not included in that mapping, passing an integer for \var{name} is also accepted. Modified: python/branches/release24-maint/Lib/test/test_posix.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_posix.py (original) +++ python/branches/release24-maint/Lib/test/test_posix.py Mon Oct 9 21:29:06 2006 @@ -73,6 +73,11 @@ finally: fp.close() + def test_confstr(self): + if hasattr(posix, 'confstr'): + self.assertRaises(ValueError, posix.confstr, "CS_garbage") + self.assertEqual(len(posix.confstr("CS_PATH")) > 0, True) + def test_dup2(self): if hasattr(posix, 'dup2'): fp1 = open(test_support.TESTFN) Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Mon Oct 9 21:29:06 2006 @@ -73,6 +73,8 @@ Extension Modules ----------------- +- Fix buffer handling in posix.confstr. + - Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP unicode characters. Modified: python/branches/release24-maint/Modules/posixmodule.c ============================================================================== --- python/branches/release24-maint/Modules/posixmodule.c (original) +++ python/branches/release24-maint/Modules/posixmodule.c Mon Oct 9 21:29:06 2006 @@ -6599,12 +6599,13 @@ { PyObject *result = NULL; int name; - char buffer[64]; + char buffer[256]; if (PyArg_ParseTuple(args, "O&:confstr", conv_confstr_confname, &name)) { - int len = confstr(name, buffer, sizeof(buffer)); + int len; errno = 0; + len = confstr(name, buffer, sizeof(buffer)); if (len == 0) { if (errno != 0) posix_error(); @@ -6612,13 +6613,13 @@ result = PyString_FromString(""); } else { - if (len >= sizeof(buffer)) { - result = PyString_FromStringAndSize(NULL, len); + if ((unsigned int)len >= sizeof(buffer)) { + result = PyString_FromStringAndSize(NULL, len-1); if (result != NULL) - confstr(name, PyString_AS_STRING(result), len+1); + confstr(name, PyString_AS_STRING(result), len); } else - result = PyString_FromString(buffer); + result = PyString_FromStringAndSize(buffer, len-1); } } return result; From python-checkins at python.org Mon Oct 9 21:42:33 2006 From: python-checkins at python.org (barry.warsaw) Date: Mon, 9 Oct 2006 21:42:33 +0200 (CEST) Subject: [Python-checkins] r52254 - python/branches/release25-maint/Modules/gcmodule.c Message-ID: <20061009194233.EDF471E4008@bag.python.org> Author: barry.warsaw Date: Mon Oct 9 21:42:33 2006 New Revision: 52254 Modified: python/branches/release25-maint/Modules/gcmodule.c Log: List gc.get_count() in the module docstring. Modified: python/branches/release25-maint/Modules/gcmodule.c ============================================================================== --- python/branches/release25-maint/Modules/gcmodule.c (original) +++ python/branches/release25-maint/Modules/gcmodule.c Mon Oct 9 21:42:33 2006 @@ -1179,6 +1179,7 @@ "disable() -- Disable automatic garbage collection.\n" "isenabled() -- Returns true if automatic collection is enabled.\n" "collect() -- Do a full collection right now.\n" +"get_count() -- Return the current collection counts.\n" "set_debug() -- Set debugging flags.\n" "get_debug() -- Get debugging flags.\n" "set_threshold() -- Set the collection thresholds.\n" From python-checkins at python.org Mon Oct 9 21:43:25 2006 From: python-checkins at python.org (barry.warsaw) Date: Mon, 9 Oct 2006 21:43:25 +0200 (CEST) Subject: [Python-checkins] r52255 - python/trunk/Modules/gcmodule.c Message-ID: <20061009194325.424211E4008@bag.python.org> Author: barry.warsaw Date: Mon Oct 9 21:43:24 2006 New Revision: 52255 Modified: python/trunk/Modules/gcmodule.c Log: List gc.get_count() in the module docstring. Modified: python/trunk/Modules/gcmodule.c ============================================================================== --- python/trunk/Modules/gcmodule.c (original) +++ python/trunk/Modules/gcmodule.c Mon Oct 9 21:43:24 2006 @@ -1179,6 +1179,7 @@ "disable() -- Disable automatic garbage collection.\n" "isenabled() -- Returns true if automatic collection is enabled.\n" "collect() -- Do a full collection right now.\n" +"get_count() -- Return the current collection counts.\n" "set_debug() -- Set debugging flags.\n" "get_debug() -- Get debugging flags.\n" "set_threshold() -- Set the collection thresholds.\n" From python-checkins at python.org Mon Oct 9 22:24:47 2006 From: python-checkins at python.org (tim.peters) Date: Mon, 9 Oct 2006 22:24:47 +0200 (CEST) Subject: [Python-checkins] r52256 - in python/branches/release24-maint: Lib/test/output/test_operations Lib/test/test_operations.py Misc/NEWS Objects/dictobject.c Message-ID: <20061009202447.834911E4008@bag.python.org> Author: tim.peters Date: Mon Oct 9 22:24:45 2006 New Revision: 52256 Modified: python/branches/release24-maint/Lib/test/output/test_operations python/branches/release24-maint/Lib/test/test_operations.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/dictobject.c Log: Backport of the pieces of trunk rev 46589 relevant to fixing an unlikely crash bug in dict resizing, SF bug 1456209. The rest of rev 46589 changes whether Python suppresses exceptions during some dict-related comparisons. While I think that's a good idea, it does change visible behavior at times, and there was already some complaining about that on the trunk. Not a good idea for backporting. The part of 46589 checked in here can at worst stop segfaults, and I doubt anyone will gripe about that ;-) Modified: python/branches/release24-maint/Lib/test/output/test_operations ============================================================================== --- python/branches/release24-maint/Lib/test/output/test_operations (original) +++ python/branches/release24-maint/Lib/test/output/test_operations Mon Oct 9 22:24:45 2006 @@ -4,3 +4,4 @@ 3.1 Dictionary lookups succeed even if __cmp__() raises an exception raising error No exception passed through. +resize bugs not triggered. Modified: python/branches/release24-maint/Lib/test/test_operations.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_operations.py (original) +++ python/branches/release24-maint/Lib/test/test_operations.py Mon Oct 9 22:24:45 2006 @@ -7,9 +7,6 @@ print '3.1 Dictionary lookups succeed even if __cmp__() raises an exception' -# SourceForge bug #112558: -# http://sourceforge.net/bugs/?func=detailbug&bug_id=112558&group_id=5470 - class BadDictKey: already_printed_raising_error = 0 @@ -50,3 +47,27 @@ del d[i] for i in range(5, 9): # i==8 was the problem d[i] = i + + +# Another dict resizing bug (SF bug #1456209). +# This caused Segmentation faults or Illegal instructions. + +class X(object): + def __hash__(self): + return 5 + def __eq__(self, other): + if resizing: + d.clear() + return False +d = {} +resizing = False +d[X()] = 1 +d[X()] = 2 +d[X()] = 3 +d[X()] = 4 +d[X()] = 5 +# now trigger a resize +resizing = True +d[9] = 6 + +print 'resize bugs not triggered.' Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Mon Oct 9 22:24:45 2006 @@ -12,6 +12,11 @@ Core and builtins ----------------- +- Bug #1456209: In some obscure cases it was possible for a class with a + custom ``__eq__()`` method to confuse dict internals when class instances + were used as a dict's keys and the ``__eq__()`` method mutated the dict. + No, you don't have any code that did this ;-) + - A number of places, including integer negation and absolute value, were fixed to not rely on undefined behaviour of the C compiler anymore. @@ -73,7 +78,7 @@ Extension Modules ----------------- -- Fix buffer handling in posix.confstr. +- Fix buffer handling in posix.confstr. - Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault when encoding non-BMP unicode characters. @@ -142,7 +147,7 @@ Library ------- -- Bug #1545341: The 'classifier' keyword argument to the Distutils setup() +- Bug #1545341: The 'classifier' keyword argument to the Distutils setup() function now accepts tuples as well as lists. - Bug #1560617: in pyclbr, return full module name not only for classes, Modified: python/branches/release24-maint/Objects/dictobject.c ============================================================================== --- python/branches/release24-maint/Objects/dictobject.c (original) +++ python/branches/release24-maint/Objects/dictobject.c Mon Oct 9 22:24:45 2006 @@ -418,6 +418,35 @@ } /* +Internal routine used by dictresize() to insert an item which is +known to be absent from the dict. This routine also assumes that +the dict contains no deleted entries. Besides the performance benefit, +using insertdict() in dictresize() is dangerous (SF bug #1456209). +*/ +static void +insertdict_clean(register dictobject *mp, PyObject *key, long hash, + PyObject *value) +{ + register unsigned int i; + register unsigned int perturb; + register unsigned int mask = mp->ma_mask; + dictentry *ep0 = mp->ma_table; + register dictentry *ep; + + i = hash & mask; + ep = &ep0[i]; + for (perturb = hash; ep->me_key != NULL; perturb >>= PERTURB_SHIFT) { + i = (i << 2) + i + perturb + 1; + ep = &ep0[i & mask]; + } + mp->ma_fill++; + ep->me_key = key; + ep->me_hash = hash; + ep->me_value = value; + mp->ma_used++; +} + +/* Restructure the table by allocating a new table and reinserting all items again. When entries have been deleted, the new table may actually be smaller than the old one. @@ -489,7 +518,8 @@ for (ep = oldtable; i > 0; ep++) { if (ep->me_value != NULL) { /* active entry */ --i; - insertdict(mp, ep->me_key, ep->me_hash, ep->me_value); + insertdict_clean(mp, ep->me_key, ep->me_hash, + ep->me_value); } else if (ep->me_key != NULL) { /* dummy entry */ --i; From buildbot at python.org Mon Oct 9 22:25:39 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Oct 2006 20:25:39 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4 Message-ID: <20061009202539.485151E4008@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.4/builds/214 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Mon Oct 9 22:32:21 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Oct 2006 20:32:21 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian 2.4 Message-ID: <20061009203221.178521E4008@bag.python.org> The Buildbot has detected a new failure of alpha Debian 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%25202.4/builds/55 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: andrew.kuchling Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon Oct 9 22:44:26 2006 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 9 Oct 2006 22:44:26 +0200 (CEST) Subject: [Python-checkins] r52257 - in python/trunk: Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c Message-ID: <20061009204426.DA6A31E4008@bag.python.org> Author: martin.v.loewis Date: Mon Oct 9 22:44:25 2006 New Revision: 52257 Modified: python/trunk/Lib/test/test_os.py python/trunk/Misc/NEWS python/trunk/Modules/posixmodule.c Log: Bug #1565150: Fix subsecond processing for os.utime on Windows. Modified: python/trunk/Lib/test/test_os.py ============================================================================== --- python/trunk/Lib/test/test_os.py (original) +++ python/trunk/Lib/test/test_os.py Mon Oct 9 22:44:25 2006 @@ -223,6 +223,14 @@ except TypeError: pass + # Restrict test to Win32, since there is no guarantee other + # systems support centiseconds + if sys.platform == 'win32': + def test_1565150(self): + t1 = 1159195039.25 + os.utime(self.fname, (t1, t1)) + self.assertEquals(os.stat(self.fname).st_mtime, t1) + from test import mapping_tests class EnvironTests(mapping_tests.BasicTestMappingProtocol): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Oct 9 22:44:25 2006 @@ -75,6 +75,8 @@ Library ------- +- Bug #1565150: Fix subsecond processing for os.utime on Windows. + - Support for MSVC 8 was added to bdist_wininst. - Bug #1446043: correctly raise a LookupError if an encoding name given Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Mon Oct 9 22:44:25 2006 @@ -792,7 +792,7 @@ /* XXX endianness */ __int64 out; out = time_in + secs_between_epochs; - out = out * 10000000 + nsec_in; + out = out * 10000000 + nsec_in / 100; memcpy(out_ptr, &out, sizeof(out)); } @@ -2501,11 +2501,11 @@ if (extract_time(PyTuple_GET_ITEM(arg, 0), &atimesec, &ausec) == -1) goto done; - time_t_to_FILE_TIME(atimesec, ausec, &atime); + time_t_to_FILE_TIME(atimesec, 1000*ausec, &atime); if (extract_time(PyTuple_GET_ITEM(arg, 1), &mtimesec, &musec) == -1) goto done; - time_t_to_FILE_TIME(mtimesec, musec, &mtime); + time_t_to_FILE_TIME(mtimesec, 1000*musec, &mtime); } if (!SetFileTime(hFile, NULL, &atime, &mtime)) { /* Avoid putting the file name into the error here, From python-checkins at python.org Mon Oct 9 22:44:52 2006 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 9 Oct 2006 22:44:52 +0200 (CEST) Subject: [Python-checkins] r52258 - in python/branches/release25-maint: Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c Message-ID: <20061009204452.288E01E400D@bag.python.org> Author: martin.v.loewis Date: Mon Oct 9 22:44:50 2006 New Revision: 52258 Modified: python/branches/release25-maint/Lib/test/test_os.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/posixmodule.c Log: Bug #1565150: Fix subsecond processing for os.utime on Windows. Modified: python/branches/release25-maint/Lib/test/test_os.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_os.py (original) +++ python/branches/release25-maint/Lib/test/test_os.py Mon Oct 9 22:44:50 2006 @@ -223,6 +223,14 @@ except TypeError: pass + # Restrict test to Win32, since there is no guarantee other + # systems support centiseconds + if sys.platform == 'win32': + def test_1565150(self): + t1 = 1159195039.25 + os.utime(self.fname, (t1, t1)) + self.assertEquals(os.stat(self.fname).st_mtime, t1) + from test import mapping_tests class EnvironTests(mapping_tests.BasicTestMappingProtocol): Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Oct 9 22:44:50 2006 @@ -49,6 +49,8 @@ Extension Modules ----------------- +- Bug #1565150: Fix subsecond processing for os.utime on Windows. + - Patch #1572724: fix typo ('=' instead of '==') in _msi.c. - Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault Modified: python/branches/release25-maint/Modules/posixmodule.c ============================================================================== --- python/branches/release25-maint/Modules/posixmodule.c (original) +++ python/branches/release25-maint/Modules/posixmodule.c Mon Oct 9 22:44:50 2006 @@ -792,7 +792,7 @@ /* XXX endianness */ __int64 out; out = time_in + secs_between_epochs; - out = out * 10000000 + nsec_in; + out = out * 10000000 + nsec_in / 100; memcpy(out_ptr, &out, sizeof(out)); } @@ -2501,11 +2501,11 @@ if (extract_time(PyTuple_GET_ITEM(arg, 0), &atimesec, &ausec) == -1) goto done; - time_t_to_FILE_TIME(atimesec, ausec, &atime); + time_t_to_FILE_TIME(atimesec, 1000*ausec, &atime); if (extract_time(PyTuple_GET_ITEM(arg, 1), &mtimesec, &musec) == -1) goto done; - time_t_to_FILE_TIME(mtimesec, musec, &mtime); + time_t_to_FILE_TIME(mtimesec, 1000*musec, &mtime); } if (!SetFileTime(hFile, NULL, &atime, &mtime)) { /* Avoid putting the file name into the error here, From python-checkins at python.org Tue Oct 10 01:18:44 2006 From: python-checkins at python.org (tim.peters) Date: Tue, 10 Oct 2006 01:18:44 +0200 (CEST) Subject: [Python-checkins] r52259 - python/branches/release24-maint/Tools/buildbot/build.bat python/branches/release24-maint/Tools/buildbot/test.bat Message-ID: <20061009231844.D25491E400D@bag.python.org> Author: tim.peters Date: Tue Oct 10 01:18:44 2006 New Revision: 52259 Modified: python/branches/release24-maint/Tools/buildbot/build.bat python/branches/release24-maint/Tools/buildbot/test.bat Log: Move fetching of encoding test files from the end of the Windows builbot's "build" step to the start of its "test" step. This is poke-and-hope. The hope is that compilation failures on Windows will become visible to the buildbot (bsddb has apparently been failing to compile in 2.4 on Windows "for some time" now, but the buildbots haven't noticed that). Modified: python/branches/release24-maint/Tools/buildbot/build.bat ============================================================================== --- python/branches/release24-maint/Tools/buildbot/build.bat (original) +++ python/branches/release24-maint/Tools/buildbot/build.bat Tue Oct 10 01:18:44 2006 @@ -2,6 +2,4 @@ cmd /c Tools\buildbot\external.bat call "%VS71COMNTOOLS%vsvars32.bat" cd PCbuild -devenv.com /useenv /build Debug pcbuild.sln - at rem Fetch encoding test files. Note that python_d needs to be built first. -if not exist BIG5.TXT python_d.exe ..\Tools\buildbot\fetch_data_files.py \ No newline at end of file +devenv.com /useenv /build Debug pcbuild.sln \ No newline at end of file Modified: python/branches/release24-maint/Tools/buildbot/test.bat ============================================================================== --- python/branches/release24-maint/Tools/buildbot/test.bat (original) +++ python/branches/release24-maint/Tools/buildbot/test.bat Tue Oct 10 01:18:44 2006 @@ -1,3 +1,5 @@ @rem Used by the buildbot "test" step. cd PCbuild + at rem Fetch encoding test files. Note that python_d needs to be built first. +if not exist BIG5.TXT python_d.exe ..\Tools\buildbot\fetch_data_files.py call rt.bat -d -q -uall -rw From buildbot at python.org Tue Oct 10 01:23:55 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Oct 2006 23:23:55 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian 2.5 Message-ID: <20061009232355.D0FE81E400A@bag.python.org> The Buildbot has detected a new failure of alpha Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%25202.5/builds/62 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Tue Oct 10 01:24:48 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Oct 2006 23:24:48 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k 2.4 Message-ID: <20061009232448.5DBE31E4008@bag.python.org> The Buildbot has detected a new failure of x86 W2k 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%25202.4/builds/264 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: tim.peters BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Tue Oct 10 01:25:47 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Oct 2006 23:25:47 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-2 2.4 Message-ID: <20061009232547.E28301E4008@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%25202.4/builds/174 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: tim.peters BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Tue Oct 10 01:37:59 2006 From: python-checkins at python.org (tim.peters) Date: Tue, 10 Oct 2006 01:37:59 +0200 (CEST) Subject: [Python-checkins] r52260 - python/branches/release24-maint/Objects/classobject.c Message-ID: <20061009233759.1B5EC1E4008@bag.python.org> Author: tim.peters Date: Tue Oct 10 01:37:58 2006 New Revision: 52260 Modified: python/branches/release24-maint/Objects/classobject.c Log: Backport rev 51262 from trunk -- squashes a compiler warning on Windows about truly wrong code. Checkin comment from 51262: Can't return NULL from a void function. If there is a memory error, about the best we can do is call PyErr_WriteUnraisable and go on. We won't be able to do the call below either, so verify delstr is valid. Modified: python/branches/release24-maint/Objects/classobject.c ============================================================================== --- python/branches/release24-maint/Objects/classobject.c (original) +++ python/branches/release24-maint/Objects/classobject.c Tue Oct 10 01:37:58 2006 @@ -656,9 +656,9 @@ if (delstr == NULL) { delstr = PyString_InternFromString("__del__"); if (delstr == NULL) - return NULL; + PyErr_WriteUnraisable((PyObject*)inst); } - if ((del = instance_getattr2(inst, delstr)) != NULL) { + if (delstr && (del = instance_getattr2(inst, delstr)) != NULL) { PyObject *res = PyEval_CallObject(del, (PyObject *)NULL); if (res == NULL) PyErr_WriteUnraisable(del); From python-checkins at python.org Tue Oct 10 01:57:54 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 01:57:54 +0200 (CEST) Subject: [Python-checkins] r52261 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061009235754.D67A51E4008@bag.python.org> Author: brett.cannon Date: Tue Oct 10 01:57:54 2006 New Revision: 52261 Modified: sandbox/trunk/import_in_py/importer.py Log: Add handling of 'handles' for the bytecode handler. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Tue Oct 10 01:57:54 2006 @@ -186,16 +186,18 @@ class PyBytecodeHandler(object): """Handler for importing .pyc/.pyo modules.""" - - # XXX 'handles' should be a property that returns based on whether -O was - # specified when running the interpreter. - handles = 'pyc' # XXX Should probably add a handle_string() method to PySourceHandler() so # that if the .pyc is outdated it can easily use PySourceHandler to do the # import for it and then write out the new .pyc . # XXX Writing out a new .pyc should be made optional. + def _handles(self): + """Return either 'pyc' or 'pyo' based on __debug__.""" + return 'pyc' if __debug__ else 'pyo' + + handles = property(_handles) + def handle_file(self, module, fullname, path, file_path): """Import the Python bytecode file at 'path' and use it to initialize 'module'.""" From python-checkins at python.org Tue Oct 10 02:01:39 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 02:01:39 +0200 (CEST) Subject: [Python-checkins] r52262 - sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061010000139.2EDFF1E4008@bag.python.org> Author: brett.cannon Date: Tue Oct 10 02:01:38 2006 New Revision: 52262 Modified: sandbox/trunk/import_in_py/test_importer.py Log: Initial set of tests for Python source handler. Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Tue Oct 10 02:01:38 2006 @@ -1,8 +1,12 @@ +from __future__ import with_statement import unittest from test import test_support import importer import sys import StringIO +import os +import tempfile +import new class BuiltinFrozen_Tester(unittest.TestCase): @@ -105,10 +109,43 @@ sys.stdout = self._orig_stdout +class SourceHandlerTests(unittest.TestCase): + + """Test the Python source code handler.""" + + def setUp(self): + """Generate the path to a temporary file to test with.""" + self.test_module = 'source_tester' + self.test_dir = tempfile.gettempdir() + self.file_path = os.path.join(self.test_dir, self.test_module+'.py') + self.handler = importer.PySourceHandler() + + def tearDown(self): + """If the temporary path was used, make sure to clean up.""" + if os.path.exists(self.file_path): + os.remove(self.file_path) + + def test_handle(self): + # Should claim it handles 'py' data. + self.failUnlessEqual(self.handler.handles, 'py') + + def test_handle_file_module(self): + # Should be handle a module that is directly pointed at. + with open(self.file_path, 'w') as py_file: + py_file.write("test_attr = None") + new_module = new.module(self.test_module) + self.handler.handle_file(new_module, self.test_module, + None, self.file_path) + self.failUnlessEqual(self.test_module, new_module.__name__) + self.failUnlessEqual(self.file_path, new_module.__file__) + self.failUnless(hasattr(new_module, 'test_attr')) + + def test_main(): test_support.run_unittest( BuiltinImporterTests, FrozenImporterTests, + SourceHandlerTests, ) From buildbot at python.org Tue Oct 10 02:04:37 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Oct 2006 00:04:37 +0000 Subject: [Python-checkins] buildbot failure in hppa Ubuntu dapper 2.5 Message-ID: <20061010000437.81E051E4008@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.5/builds/61 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: barry.warsaw,martin.v.loewis BUILD FAILED: failed configure sincerely, -The Buildbot From buildbot at python.org Tue Oct 10 02:09:18 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Oct 2006 00:09:18 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4 Message-ID: <20061010000918.A5A251E4008@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.4/builds/217 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: tim.peters Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Tue Oct 10 02:30:41 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Oct 2006 00:30:41 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20061010003041.70A271E400F@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/63 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: barry.warsaw,martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 10 02:51:23 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 02:51:23 +0200 (CEST) Subject: [Python-checkins] r52263 - sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061010005123.E00831E4008@bag.python.org> Author: brett.cannon Date: Tue Oct 10 02:51:23 2006 New Revision: 52263 Modified: sandbox/trunk/import_in_py/test_importer.py Log: Initial tests for the filesystem loader. Factored out basic Python source test code into separate superclass to be used by both the Python source handler tests and the filesystem loader tests. Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Tue Oct 10 02:51:23 2006 @@ -107,45 +107,82 @@ def tearDown(self): """Reset stdout to what it is by default.""" sys.stdout = self._orig_stdout + + +class SourceFileTests(unittest.TestCase): + + """Base class to help in generating a fresh source file.""" + + def setUp(self): + """Generate the path to a temporary file to test with.""" + self.module = 'source_tester' + self.directory = tempfile.gettempdir() + self.file_path = os.path.join(self.directory, self.module+'.py') + self.attr_name = 'test_attr' + self.attr_value = None + with open(self.file_path, 'w') as py_file: + py_file.write('%s = %r' % (self.attr_name, self.attr_value)) + def tearDown(self): + """If the temporary path was used, make sure to clean up.""" + os.remove(self.file_path) + + def verify_module(self, module): + """Verify that the module is the one created during setup and has the + expected attributes and values.""" + self.failUnlessEqual(module.__name__, self.module) + self.failUnlessEqual(module.__file__, self.file_path) + self.failUnless(hasattr(module, self.attr_name)) + self.failUnlessEqual(getattr(module, self.attr_name), self.attr_value) -class SourceHandlerTests(unittest.TestCase): - """Test the Python source code handler.""" +class SourceHandlerTests(SourceFileTests): + """Test the Python source code handler.""" + def setUp(self): - """Generate the path to a temporary file to test with.""" - self.test_module = 'source_tester' - self.test_dir = tempfile.gettempdir() - self.file_path = os.path.join(self.test_dir, self.test_module+'.py') + """Create a handler to use for each test.""" + super(self.__class__, self).setUp() self.handler = importer.PySourceHandler() - def tearDown(self): - """If the temporary path was used, make sure to clean up.""" - if os.path.exists(self.file_path): - os.remove(self.file_path) - def test_handle(self): # Should claim it handles 'py' data. self.failUnlessEqual(self.handler.handles, 'py') def test_handle_file_module(self): - # Should be handle a module that is directly pointed at. - with open(self.file_path, 'w') as py_file: - py_file.write("test_attr = None") - new_module = new.module(self.test_module) - self.handler.handle_file(new_module, self.test_module, + # Should be able to handle a module that is directly pointed at. + new_module = new.module(self.module) + self.handler.handle_file(new_module, self.module, None, self.file_path) - self.failUnlessEqual(self.test_module, new_module.__name__) - self.failUnlessEqual(self.file_path, new_module.__file__) - self.failUnless(hasattr(new_module, 'test_attr')) - + self.verify_module(new_module) + + +class FileSystemLoaderTests(SourceFileTests): + + """Test the filesystem loader.""" + + def setUp(self): + """Create a fresh loader per run.""" + super(self.__class__, self).setUp() + self.loader = importer.FileSystemLoader(self.file_path, + importer.PySourceHandler()) + + def test_load_module_fresh(self): + # Test a basic module load where there is no sys.modules entry. + try: + del sys.modules[self.module] + except KeyError: + pass + new_module = self.loader.load_module(self.module) + self.verify_module(new_module) + def test_main(): test_support.run_unittest( BuiltinImporterTests, FrozenImporterTests, SourceHandlerTests, + FileSystemLoaderTests, ) From python-checkins at python.org Tue Oct 10 02:53:44 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 02:53:44 +0200 (CEST) Subject: [Python-checkins] r52264 - sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061010005344.1C9921E4008@bag.python.org> Author: brett.cannon Date: Tue Oct 10 02:53:43 2006 New Revision: 52264 Modified: sandbox/trunk/import_in_py/test_importer.py Log: Add another test for the filesystem loader to make sure it loads from sys.modules when it can. Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Tue Oct 10 02:53:43 2006 @@ -176,6 +176,14 @@ new_module = self.loader.load_module(self.module) self.verify_module(new_module) + def test_load_module_sys_modules(self): + # Make sure that the loader returns the module from sys.modules if it + # is there. + new_module = new.module(self.module) + sys.modules[self.module] = new_module + loaded_module = self.loader.load_module(self.module) + self.failUnless(loaded_module is new_module) + def test_main(): test_support.run_unittest( From buildbot at python.org Tue Oct 10 03:55:53 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Oct 2006 01:55:53 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061010015553.8CB691E4008@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/140 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 10 06:46:51 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 06:46:51 +0200 (CEST) Subject: [Python-checkins] r52265 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061010044651.2D2031E400A@bag.python.org> Author: brett.cannon Date: Tue Oct 10 06:46:50 2006 New Revision: 52265 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Add tests for the bytecode handler (along with fixes needed to make it work and a few notes about its current shortcomings). Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Tue Oct 10 06:46:50 2006 @@ -32,6 +32,7 @@ import imp import sys +import marshal # XXX Importing os will not work in the end as it is implemented in Python # itself. import os @@ -204,7 +205,9 @@ module.__file__ = file_path module.__name__ = fullname with open(file_path, 'rb') as bytecode_file: + # XXX No verification of magic number. magic = bytecode_file.read(4) + # XXX No verification of timestamp. mtime = bytecode_file.read(4) compiled_code = marshal.load(bytecode_file) exec compiled_code in module.__dict__ Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Tue Oct 10 06:46:50 2006 @@ -7,6 +7,7 @@ import os import tempfile import new +import py_compile class BuiltinFrozen_Tester(unittest.TestCase): @@ -184,12 +185,43 @@ loaded_module = self.loader.load_module(self.module) self.failUnless(loaded_module is new_module) + +class BytecodeHandlerTests(SourceFileTests): + + """Tests for the bytecode handler.""" + + def setUp(self): + """Make sure that the module has its bytecode generated.""" + super(self.__class__, self).setUp() + py_compile.compile(self.file_path, doraise=True) + self.file_path += 'c' if __debug__ else 'o' + self.handler = importer.PyBytecodeHandler() + + def test_handles_attr(self): + # 'handles' should return 'pyc' or 'pyo' depending on __debug__. + try: + importer.__debug__ = True + self.failUnlessEqual(self.handler.handles, 'pyc') + importer.__debug__ = False + self.failUnlessEqual(self.handler.handles, 'pyo') + finally: + del importer.__debug__ + + def test_handle_file(self): + # Should be able to handle a simple bytecode file that is freshly + # generated. + new_module = new.module(self.module) + self.handler.handle_file(new_module, self.module, None, + self.file_path) + self.verify_module(new_module) + def test_main(): test_support.run_unittest( BuiltinImporterTests, FrozenImporterTests, SourceHandlerTests, + BytecodeHandlerTests, FileSystemLoaderTests, ) From python-checkins at python.org Tue Oct 10 09:53:37 2006 From: python-checkins at python.org (ronald.oussoren) Date: Tue, 10 Oct 2006 09:53:37 +0200 (CEST) Subject: [Python-checkins] r52266 - python/branches/release24-maint/Mac/BuildScript/build-installer.py Message-ID: <20061010075337.23B051E4008@bag.python.org> Author: ronald.oussoren Date: Tue Oct 10 09:53:36 2006 New Revision: 52266 Modified: python/branches/release24-maint/Mac/BuildScript/build-installer.py Log: fix permission problem in the generated installer Modified: python/branches/release24-maint/Mac/BuildScript/build-installer.py ============================================================================== --- python/branches/release24-maint/Mac/BuildScript/build-installer.py (original) +++ python/branches/release24-maint/Mac/BuildScript/build-installer.py Tue Oct 10 09:53:36 2006 @@ -10,6 +10,7 @@ Usage: see USAGE variable in the script. """ import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd +import grp INCLUDE_TIMESTAMP=1 VERBOSE=1 @@ -56,7 +57,7 @@ raise RuntimeError, "Cannot find full version??" # The directory we'll use to create the build, will be erased and recreated -WORKDIR="/tmp/_py" +WORKDIR="/tmp/_py24" # The directory we'll use to store third-party sources, set this to something # else if you don't want to re-fetch required libraries every time. @@ -643,10 +644,12 @@ 'lib')))) print "Fix file modes" + gid = grp.getgrnam('admin').gr_gid frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework') for dirpath, dirnames, filenames in os.walk(frmDir): for dn in dirnames: os.chmod(os.path.join(dirpath, dn), 0775) + os.chown(os.path.join(dirpath, dn), -1, gid) for fn in filenames: if os.path.islink(fn): @@ -655,7 +658,8 @@ # "chmod g+w $fn" p = os.path.join(dirpath, fn) st = os.stat(p) - os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP) + os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP) + os.chown(p, -1, gid) # We added some directories to the search path during the configure # phase. Remove those because those directories won't be there on From python-checkins at python.org Tue Oct 10 09:54:25 2006 From: python-checkins at python.org (ronald.oussoren) Date: Tue, 10 Oct 2006 09:54:25 +0200 (CEST) Subject: [Python-checkins] r52267 - python/branches/release25-maint/Mac/BuildScript/build-installer.py Message-ID: <20061010075425.157B51E4008@bag.python.org> Author: ronald.oussoren Date: Tue Oct 10 09:54:24 2006 New Revision: 52267 Modified: python/branches/release25-maint/Mac/BuildScript/build-installer.py Log: Macosx: fix permission problem in generated installer Modified: python/branches/release25-maint/Mac/BuildScript/build-installer.py ============================================================================== --- python/branches/release25-maint/Mac/BuildScript/build-installer.py (original) +++ python/branches/release25-maint/Mac/BuildScript/build-installer.py Tue Oct 10 09:54:24 2006 @@ -10,6 +10,7 @@ Usage: see USAGE variable in the script. """ import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd +import grp INCLUDE_TIMESTAMP=1 VERBOSE=1 @@ -657,9 +658,13 @@ print "Fix file modes" frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework') + gid = grp.getgrnam('admin').gr_gid + for dirpath, dirnames, filenames in os.walk(frmDir): for dn in dirnames: os.chmod(os.path.join(dirpath, dn), 0775) + os.chown(os.path.join(dirpath, dn), -1, gid) + for fn in filenames: if os.path.islink(fn): @@ -668,7 +673,8 @@ # "chmod g+w $fn" p = os.path.join(dirpath, fn) st = os.stat(p) - os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP) + os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP) + os.chown(p, -1, gid) # We added some directories to the search path during the configure # phase. Remove those because those directories won't be there on From python-checkins at python.org Tue Oct 10 09:55:07 2006 From: python-checkins at python.org (ronald.oussoren) Date: Tue, 10 Oct 2006 09:55:07 +0200 (CEST) Subject: [Python-checkins] r52268 - python/trunk/Mac/BuildScript/build-installer.py Message-ID: <20061010075507.8D0DE1E4011@bag.python.org> Author: ronald.oussoren Date: Tue Oct 10 09:55:06 2006 New Revision: 52268 Modified: python/trunk/Mac/BuildScript/build-installer.py Log: MacOSX: fix permission problem in the generated installer Modified: python/trunk/Mac/BuildScript/build-installer.py ============================================================================== --- python/trunk/Mac/BuildScript/build-installer.py (original) +++ python/trunk/Mac/BuildScript/build-installer.py Tue Oct 10 09:55:06 2006 @@ -10,6 +10,7 @@ Usage: see USAGE variable in the script. """ import platform, os, sys, getopt, textwrap, shutil, urllib2, stat, time, pwd +import grp INCLUDE_TIMESTAMP=1 VERBOSE=1 @@ -657,9 +658,13 @@ print "Fix file modes" frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework') + gid = grp.getgrnam('admin').gr_gid + for dirpath, dirnames, filenames in os.walk(frmDir): for dn in dirnames: os.chmod(os.path.join(dirpath, dn), 0775) + os.chown(os.path.join(dirpath, dn), -1, gid) + for fn in filenames: if os.path.islink(fn): @@ -668,7 +673,8 @@ # "chmod g+w $fn" p = os.path.join(dirpath, fn) st = os.stat(p) - os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP) + os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP) + os.chown(p, -1, gid) # We added some directories to the search path during the configure # phase. Remove those because those directories won't be there on @@ -945,7 +951,10 @@ ref, isDirectory = Carbon.File.FSPathMakeRef(filePath) if isDirectory: + # There is a problem with getting this into the pax(1) archive, + # just ignore directory icons for now. return + tmpPath = os.path.join(filePath, "Icon\r") if not os.path.exists(tmpPath): fp = open(tmpPath, 'w') From python-checkins at python.org Tue Oct 10 10:10:43 2006 From: python-checkins at python.org (anthony.baxter) Date: Tue, 10 Oct 2006 10:10:43 +0200 (CEST) Subject: [Python-checkins] r52269 - python/branches/release24-maint/Lib/distutils/__init__.py Message-ID: <20061010081043.2FD861E400A@bag.python.org> Author: anthony.baxter Date: Tue Oct 10 10:10:42 2006 New Revision: 52269 Modified: python/branches/release24-maint/Lib/distutils/__init__.py Log: Update distutils version number to match the library version number Modified: python/branches/release24-maint/Lib/distutils/__init__.py ============================================================================== --- python/branches/release24-maint/Lib/distutils/__init__.py (original) +++ python/branches/release24-maint/Lib/distutils/__init__.py Tue Oct 10 10:10:42 2006 @@ -12,4 +12,4 @@ __revision__ = "$Id$" -__version__ = "2.4.1" +__version__ = "2.4.4" From buildbot at python.org Tue Oct 10 11:52:08 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Oct 2006 09:52:08 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20061010095208.A09581E4005@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.5/builds/62 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: ronald.oussoren Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Tue Oct 10 12:30:46 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Oct 2006 10:30:46 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061010103046.C95661E4005@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%2520trunk/builds/1212 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 10 15:50:39 2006 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 10 Oct 2006 15:50:39 +0200 (CEST) Subject: [Python-checkins] r52271 - python/branches/release24-maint/PCbuild/_bsddb.vcproj Message-ID: <20061010135039.8694F1E401A@bag.python.org> Author: martin.v.loewis Date: Tue Oct 10 15:50:39 2006 New Revision: 52271 Modified: python/branches/release24-maint/PCbuild/_bsddb.vcproj Log: Ignore libcmt, not msvcrt. Modified: python/branches/release24-maint/PCbuild/_bsddb.vcproj ============================================================================== --- python/branches/release24-maint/PCbuild/_bsddb.vcproj (original) +++ python/branches/release24-maint/PCbuild/_bsddb.vcproj Tue Oct 10 15:50:39 2006 @@ -40,7 +40,7 @@ OutputFile="./_bsddb_d.pyd" LinkIncremental="1" SuppressStartupBanner="TRUE" - IgnoreDefaultLibraryNames="msvcrtd" + IgnoreDefaultLibraryNames="libcmtd" GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\./_bsddb_d.pdb" SubSystem="2" @@ -109,7 +109,8 @@ OutputFile="./_bsddb.pyd" LinkIncremental="1" SuppressStartupBanner="TRUE" - IgnoreDefaultLibraryNames="msvcrt" + IgnoreDefaultLibraryNames="libcmt" + ModuleDefinitionFile="" GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\./_bsddb.pdb" SubSystem="2" From buildbot at python.org Tue Oct 10 17:19:26 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Oct 2006 15:19:26 +0000 Subject: [Python-checkins] buildbot warnings in alpha Debian trunk Message-ID: <20061010151926.25B9D1E4008@bag.python.org> The Buildbot has detected a new failure of alpha Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Debian%2520trunk/builds/605 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 10 18:20:42 2006 From: python-checkins at python.org (anthony.baxter) Date: Tue, 10 Oct 2006 18:20:42 +0200 (CEST) Subject: [Python-checkins] r52272 - python/branches/release24-maint/Modules/_ssl.c python/branches/release24-maint/Modules/socketmodule.c Message-ID: <20061010162042.4A7CF1E4008@bag.python.org> Author: anthony.baxter Date: Tue Oct 10 18:20:41 2006 New Revision: 52272 Modified: python/branches/release24-maint/Modules/_ssl.c python/branches/release24-maint/Modules/socketmodule.c Log: Backport 50567 #1494314: Fix a regression with high-numbered sockets in 2.4.3. This means that select() on sockets > FD_SETSIZE (typically 1024) work again. The patch makes sockets use poll() internally where available. Modified: python/branches/release24-maint/Modules/_ssl.c ============================================================================== --- python/branches/release24-maint/Modules/_ssl.c (original) +++ python/branches/release24-maint/Modules/_ssl.c Tue Oct 10 18:20:41 2006 @@ -26,6 +26,12 @@ /* Include symbols from _socket module */ #include "socketmodule.h" +#if defined(HAVE_POLL_H) +#include +#elif defined(HAVE_SYS_POLL_H) +#include +#endif + /* Include OpenSSL header files */ #include "openssl/rsa.h" #include "openssl/crypto.h" @@ -354,7 +360,7 @@ PyObject_Del(self); } -/* If the socket has a timeout, do a select() on the socket. +/* If the socket has a timeout, do a select()/poll() on the socket. The argument writing indicates the direction. Returns one of the possibilities in the timeout_state enum (above). */ @@ -376,6 +382,26 @@ if (s->sock_fd < 0) return SOCKET_HAS_BEEN_CLOSED; + /* Prefer poll, if available, since you can poll() any fd + * which can't be done with select(). */ +#ifdef HAVE_POLL + { + struct pollfd pollfd; + int timeout; + + pollfd.fd = s->sock_fd; + pollfd.events = writing ? POLLOUT : POLLIN; + + /* s->sock_timeout is in seconds, timeout in ms */ + timeout = (int)(s->sock_timeout * 1000 + 0.5); + Py_BEGIN_ALLOW_THREADS + rc = poll(&pollfd, 1, timeout); + Py_END_ALLOW_THREADS + + goto normal_return; + } +#endif + /* Guard against socket too large for select*/ #ifndef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE if (s->sock_fd >= FD_SETSIZE) @@ -396,6 +422,7 @@ rc = select(s->sock_fd+1, &fds, NULL, NULL, &tv); Py_END_ALLOW_THREADS +normal_return: /* Return SOCKET_TIMED_OUT on timeout, SOCKET_OPERATION_OK otherwise (when we are able to write or when there's something to read) */ return rc == 0 ? SOCKET_HAS_TIMED_OUT : SOCKET_OPERATION_OK; Modified: python/branches/release24-maint/Modules/socketmodule.c ============================================================================== --- python/branches/release24-maint/Modules/socketmodule.c (original) +++ python/branches/release24-maint/Modules/socketmodule.c Tue Oct 10 18:20:41 2006 @@ -412,14 +412,24 @@ there has to be a circular reference. */ static PyTypeObject sock_type; -/* Can we call select() with this socket without a buffer overrun? */ +#if defined(HAVE_POLL_H) +#include +#elif defined(HAVE_SYS_POLL_H) +#include +#endif + #ifdef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE /* Platform can select file descriptors beyond FD_SETSIZE */ #define IS_SELECTABLE(s) 1 +#elif defined(HAVE_POLL) +/* Instead of select(), we'll use poll() since poll() works on any fd. */ +#define IS_SELECTABLE(s) 1 +/* Can we call select() with this socket without a buffer overrun? */ #else /* POSIX says selecting file descriptors beyond FD_SETSIZE - has undefined behaviour. */ -#define IS_SELECTABLE(s) ((s)->sock_fd < FD_SETSIZE) + has undefined behaviour. If there's no timeout left, we don't have to + call select, so it's a safe, little white lie. */ +#define IS_SELECTABLE(s) ((s)->sock_fd < FD_SETSIZE || s->sock_timeout <= 0.0) #endif static PyObject* @@ -662,7 +672,7 @@ return 1; } -/* Do a select() on the socket, if necessary (sock_timeout > 0). +/* Do a select()/poll() on the socket, if necessary (sock_timeout > 0). The argument writing indicates the direction. This does not raise an exception; we'll let our caller do that after they've reacquired the interpreter lock. @@ -670,8 +680,6 @@ static int internal_select(PySocketSockObject *s, int writing) { - fd_set fds; - struct timeval tv; int n; /* Nothing to do unless we're in timeout mode (not non-blocking) */ @@ -682,17 +690,37 @@ if (s->sock_fd < 0) return 0; - /* Construct the arguments to select */ - tv.tv_sec = (int)s->sock_timeout; - tv.tv_usec = (int)((s->sock_timeout - tv.tv_sec) * 1e6); - FD_ZERO(&fds); - FD_SET(s->sock_fd, &fds); - - /* See if the socket is ready */ - if (writing) - n = select(s->sock_fd+1, NULL, &fds, NULL, &tv); - else - n = select(s->sock_fd+1, &fds, NULL, NULL, &tv); + /* Prefer poll, if available, since you can poll() any fd + * which can't be done with select(). */ +#ifdef HAVE_POLL + { + struct pollfd pollfd; + int timeout; + + pollfd.fd = s->sock_fd; + pollfd.events = writing ? POLLOUT : POLLIN; + + /* s->sock_timeout is in seconds, timeout in ms */ + timeout = (int)(s->sock_timeout * 1000 + 0.5); + n = poll(&pollfd, 1, timeout); + } +#else + { + /* Construct the arguments to select */ + fd_set fds; + struct timeval tv; + tv.tv_sec = (int)s->sock_timeout; + tv.tv_usec = (int)((s->sock_timeout - tv.tv_sec) * 1e6); + FD_ZERO(&fds); + FD_SET(s->sock_fd, &fds); + + /* See if the socket is ready */ + if (writing) + n = select(s->sock_fd+1, NULL, &fds, NULL, &tv); + else + n = select(s->sock_fd+1, &fds, NULL, NULL, &tv); + } +#endif if (n == 0) return 1; return 0; From buildbot at python.org Tue Oct 10 18:41:00 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Oct 2006 16:41:00 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4 Message-ID: <20061010164100.A90741E401B@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.4/builds/221 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: anthony.baxter Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Tue Oct 10 18:42:10 2006 From: python-checkins at python.org (tim.peters) Date: Tue, 10 Oct 2006 18:42:10 +0200 (CEST) Subject: [Python-checkins] r52273 - in python/branches/release24-maint: Misc/NEWS PCbuild/readme.txt Message-ID: <20061010164210.4A30B1E4008@bag.python.org> Author: tim.peters Date: Tue Oct 10 18:42:09 2006 New Revision: 52273 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/PCbuild/readme.txt Log: Note that there are no longer warnings when building _bsddb on Windows (Martin recently repaired that -- thanks!). Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Oct 10 18:42:09 2006 @@ -241,6 +241,9 @@ - The Windows binaries for the _ssl module are now linked with OpenSSL 0.9.7l. +- On Windows, there are no longer linker warnings when building the + ``_bsddb`` project. + - Bug #1568842: Fix test for uintptr_t. - Bug #1439538: Drop usage of test -e in configure as it is not portable. Modified: python/branches/release24-maint/PCbuild/readme.txt ============================================================================== --- python/branches/release24-maint/PCbuild/readme.txt (original) +++ python/branches/release24-maint/PCbuild/readme.txt Tue Oct 10 18:42:09 2006 @@ -114,7 +114,7 @@ all.tcl: Total 8420 Passed 6826 Skipped 1581 Failed 13 Sourced 91 Test Files. Files with failing tests: canvImg.test scrollbar.test textWind.test winWm.test - + Built Tix --------- Download from http://prdownloads.sourceforge.net/tix/tix-8.1.4.tar.gz @@ -191,22 +191,6 @@ software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory. Build the "Release Static" version. - XXX We're linking against Release_static\libdb42s.lib. - XXX This yields the following warnings: -""" -Compiling... -_bsddb.c -Linking... - Creating library ./_bsddb.lib and object ./_bsddb.exp -_bsddb.obj : warning LNK4217: locally defined symbol _malloc imported in function __db_associateCallback -_bsddb.obj : warning LNK4217: locally defined symbol _free imported in function __DB_consume -_bsddb.obj : warning LNK4217: locally defined symbol _fclose imported in function _DB_verify -_bsddb.obj : warning LNK4217: locally defined symbol _fopen imported in function _DB_verify -_bsddb.obj : warning LNK4217: locally defined symbol _strncpy imported in function _init_pybsddb -__bsddb - 0 error(s), 5 warning(s) -""" - XXX This isn't encouraging, but I don't know what to do about it. - To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py is then enabled. Running in verbose mode may be helpful. From python-checkins at python.org Tue Oct 10 18:43:07 2006 From: python-checkins at python.org (anthony.baxter) Date: Tue, 10 Oct 2006 18:43:07 +0200 (CEST) Subject: [Python-checkins] r52274 - python/branches/release24-maint/Misc/NEWS Message-ID: <20061010164307.48E3F1E4019@bag.python.org> Author: anthony.baxter Date: Tue Oct 10 18:43:06 2006 New Revision: 52274 Modified: python/branches/release24-maint/Misc/NEWS Log: note the previous checkin Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Oct 10 18:43:06 2006 @@ -7,7 +7,7 @@ What's New in Python 2.4.4c1? ============================= -*Release date: DD-MMM-2006* +*Release date: 11-SEP-2006* Core and builtins ----------------- @@ -77,6 +77,9 @@ Extension Modules ----------------- +- #1494314: Fix a regression with high-numbered sockets in 2.4.3. This + means that select() on sockets > FD_SETSIZE (typically 1024) work again. + The patch makes sockets use poll() internally where available. - Fix buffer handling in posix.confstr. From python-checkins at python.org Tue Oct 10 18:44:17 2006 From: python-checkins at python.org (anthony.baxter) Date: Tue, 10 Oct 2006 18:44:17 +0200 (CEST) Subject: [Python-checkins] r52275 - in python/branches/release24-maint: Doc/commontex/boilerplate.tex Doc/commontex/license.tex Include/patchlevel.h LICENSE Lib/idlelib/NEWS.txt Lib/idlelib/idlever.py Misc/RPM/python-2.4.spec PCbuild/BUILDno.txt PCbuild/pythoncore.vcproj README Message-ID: <20061010164417.F3EB41E4008@bag.python.org> Author: anthony.baxter Date: Tue Oct 10 18:44:16 2006 New Revision: 52275 Modified: python/branches/release24-maint/Doc/commontex/boilerplate.tex python/branches/release24-maint/Doc/commontex/license.tex python/branches/release24-maint/Include/patchlevel.h python/branches/release24-maint/LICENSE python/branches/release24-maint/Lib/idlelib/NEWS.txt python/branches/release24-maint/Lib/idlelib/idlever.py python/branches/release24-maint/Misc/RPM/python-2.4.spec python/branches/release24-maint/PCbuild/BUILDno.txt python/branches/release24-maint/PCbuild/pythoncore.vcproj python/branches/release24-maint/README Log: preparing for 2.4.4c1 Modified: python/branches/release24-maint/Doc/commontex/boilerplate.tex ============================================================================== --- python/branches/release24-maint/Doc/commontex/boilerplate.tex (original) +++ python/branches/release24-maint/Doc/commontex/boilerplate.tex Tue Oct 10 18:44:16 2006 @@ -5,5 +5,5 @@ Email: \email{docs at python.org} } -\date{29 March 2006} % XXX update before final release! +\date{11 September 2006} % XXX update before final release! \input{patchlevel} % include Python version information Modified: python/branches/release24-maint/Doc/commontex/license.tex ============================================================================== --- python/branches/release24-maint/Doc/commontex/license.tex (original) +++ python/branches/release24-maint/Doc/commontex/license.tex Tue Oct 10 18:44:16 2006 @@ -50,6 +50,8 @@ \linev{2.4.1}{2.4}{2005}{PSF}{yes} \linev{2.4.2}{2.4.1}{2005}{PSF}{yes} \linev{2.4.3}{2.4.2}{2006}{PSF}{yes} + \linev{2.4.4}{2.4.3}{2006}{PSF}{yes} + \linev{2.5}{2.4}{2006}{PSF}{yes} \end{tablev} \note{GPL-compatible doesn't mean that we're distributing Modified: python/branches/release24-maint/Include/patchlevel.h ============================================================================== --- python/branches/release24-maint/Include/patchlevel.h (original) +++ python/branches/release24-maint/Include/patchlevel.h Tue Oct 10 18:44:16 2006 @@ -23,10 +23,10 @@ #define PY_MINOR_VERSION 4 #define PY_MICRO_VERSION 4 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 0 +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "2.4.4c0" +#define PY_VERSION "2.4.4c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ Modified: python/branches/release24-maint/LICENSE ============================================================================== --- python/branches/release24-maint/LICENSE (original) +++ python/branches/release24-maint/LICENSE Tue Oct 10 18:44:16 2006 @@ -52,6 +52,8 @@ 2.4.1 2.4.1 2005 PSF yes 2.4.2 2.4.1 2005 PSF yes 2.4.3 2.4.2 2006 PSF yes + 2.4.4 2.4.3 2006 PSF yes + 2.5 2.4 2006 PSF yes Footnotes: Modified: python/branches/release24-maint/Lib/idlelib/NEWS.txt ============================================================================== --- python/branches/release24-maint/Lib/idlelib/NEWS.txt (original) +++ python/branches/release24-maint/Lib/idlelib/NEWS.txt Tue Oct 10 18:44:16 2006 @@ -1,3 +1,8 @@ +What's New in IDLE 1.1.4c1? +=========================== + +*Release date: 11-SEP-2006* + What's New in IDLE 1.1.3? ========================= Modified: python/branches/release24-maint/Lib/idlelib/idlever.py ============================================================================== --- python/branches/release24-maint/Lib/idlelib/idlever.py (original) +++ python/branches/release24-maint/Lib/idlelib/idlever.py Tue Oct 10 18:44:16 2006 @@ -1 +1 @@ -IDLE_VERSION = "1.1.3" +IDLE_VERSION = "1.1.4c1" Modified: python/branches/release24-maint/Misc/RPM/python-2.4.spec ============================================================================== --- python/branches/release24-maint/Misc/RPM/python-2.4.spec (original) +++ python/branches/release24-maint/Misc/RPM/python-2.4.spec Tue Oct 10 18:44:16 2006 @@ -33,7 +33,7 @@ ################################# %define name python -%define version 2.4.3 +%define version 2.4.4c1 %define libvers 2.4 %define release 1pydotorg %define __prefix /usr Modified: python/branches/release24-maint/PCbuild/BUILDno.txt ============================================================================== --- python/branches/release24-maint/PCbuild/BUILDno.txt (original) +++ python/branches/release24-maint/PCbuild/BUILDno.txt Tue Oct 10 18:44:16 2006 @@ -33,6 +33,8 @@ Windows Python BUILD numbers ---------------------------- + 70 2.4.4c1 + 11-Sep-2006 69 2.4.3 29-Mar-2006 68 2.4.3c1 Modified: python/branches/release24-maint/PCbuild/pythoncore.vcproj ============================================================================== --- python/branches/release24-maint/PCbuild/pythoncore.vcproj (original) +++ python/branches/release24-maint/PCbuild/pythoncore.vcproj Tue Oct 10 18:44:16 2006 @@ -1385,7 +1385,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=69"/> + PreprocessorDefinitions="BUILD=70"/> @@ -1393,7 +1393,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=69"/> + PreprocessorDefinitions="BUILD=70"/> @@ -1401,7 +1401,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=69"/> + PreprocessorDefinitions="BUILD=70"/> The release24-maint branch is frozen for the 2.4.4c1 release from 00:00UTC on the 11th of October. That's about 7 hours from now. Anthony -- Anthony Baxter It's never too late to have a happy childhood. From neal at metaslash.com Tue Oct 10 18:50:08 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 12:50:08 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061010165008.GA29226@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From buildbot at python.org Tue Oct 10 18:57:24 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Oct 2006 16:57:24 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-2 2.4 Message-ID: <20061010165724.289021E4008@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%25202.4/builds/176 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: anthony.baxter,martin.v.loewis,ronald.oussoren Build Had Warnings: warnings failed slave lost sincerely, -The Buildbot From amk at amk.ca Tue Oct 10 19:36:58 2006 From: amk at amk.ca (A.M. Kuchling) Date: Tue, 10 Oct 2006 13:36:58 -0400 Subject: [Python-checkins] r52274 - python/branches/release24-maint/Misc/NEWS In-Reply-To: <20061010164307.48E3F1E4019@bag.python.org> References: <20061010164307.48E3F1E4019@bag.python.org> Message-ID: <20061010173658.GC31165@rogue.amk.ca> On Tue, Oct 10, 2006 at 06:43:07PM +0200, anthony.baxter wrote: > -*Release date: DD-MMM-2006* > +*Release date: 11-SEP-2006* October, surely? --amk From anthony at interlink.com.au Tue Oct 10 19:27:14 2006 From: anthony at interlink.com.au (Anthony Baxter) Date: Wed, 11 Oct 2006 03:27:14 +1000 Subject: [Python-checkins] r52274 - python/branches/release24-maint/Misc/NEWS In-Reply-To: <20061010173658.GC31165@rogue.amk.ca> References: <20061010164307.48E3F1E4019@bag.python.org> <20061010173658.GC31165@rogue.amk.ca> Message-ID: <200610110327.17765.anthony@interlink.com.au> On Wednesday 11 October 2006 03:36, A.M. Kuchling wrote: > On Tue, Oct 10, 2006 at 06:43:07PM +0200, anthony.baxter wrote: > > -*Release date: DD-MMM-2006* > > +*Release date: 11-SEP-2006* > > October, surely? Waaaah. Yes. From python-checkins at python.org Tue Oct 10 19:28:34 2006 From: python-checkins at python.org (anthony.baxter) Date: Tue, 10 Oct 2006 19:28:34 +0200 (CEST) Subject: [Python-checkins] r52276 - in python/branches/release24-maint: Doc/commontex/boilerplate.tex Lib/idlelib/NEWS.txt Misc/NEWS PCbuild/BUILDno.txt Message-ID: <20061010172834.CF2FB1E4008@bag.python.org> Author: anthony.baxter Date: Tue Oct 10 19:28:33 2006 New Revision: 52276 Modified: python/branches/release24-maint/Doc/commontex/boilerplate.tex python/branches/release24-maint/Lib/idlelib/NEWS.txt python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/PCbuild/BUILDno.txt Log: what month is it again? I get confused... Modified: python/branches/release24-maint/Doc/commontex/boilerplate.tex ============================================================================== --- python/branches/release24-maint/Doc/commontex/boilerplate.tex (original) +++ python/branches/release24-maint/Doc/commontex/boilerplate.tex Tue Oct 10 19:28:33 2006 @@ -5,5 +5,5 @@ Email: \email{docs at python.org} } -\date{11 September 2006} % XXX update before final release! +\date{11 October 2006} % XXX update before final release! \input{patchlevel} % include Python version information Modified: python/branches/release24-maint/Lib/idlelib/NEWS.txt ============================================================================== --- python/branches/release24-maint/Lib/idlelib/NEWS.txt (original) +++ python/branches/release24-maint/Lib/idlelib/NEWS.txt Tue Oct 10 19:28:33 2006 @@ -1,7 +1,7 @@ What's New in IDLE 1.1.4c1? =========================== -*Release date: 11-SEP-2006* +*Release date: 11-OCT-2006* What's New in IDLE 1.1.3? ========================= Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Oct 10 19:28:33 2006 @@ -7,7 +7,7 @@ What's New in Python 2.4.4c1? ============================= -*Release date: 11-SEP-2006* +*Release date: 11-OCT-2006* Core and builtins ----------------- Modified: python/branches/release24-maint/PCbuild/BUILDno.txt ============================================================================== --- python/branches/release24-maint/PCbuild/BUILDno.txt (original) +++ python/branches/release24-maint/PCbuild/BUILDno.txt Tue Oct 10 19:28:33 2006 @@ -34,7 +34,7 @@ Windows Python BUILD numbers ---------------------------- 70 2.4.4c1 - 11-Sep-2006 + 11-Oct-2006 69 2.4.3 29-Mar-2006 68 2.4.3c1 From neal at metaslash.com Tue Oct 10 19:50:06 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 13:50:06 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061010175006.GA11817@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From neal at metaslash.com Tue Oct 10 20:50:07 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 14:50:07 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061010185007.GA12118@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From neal at metaslash.com Tue Oct 10 21:50:05 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 15:50:05 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061010195005.GA12433@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From python-checkins at python.org Tue Oct 10 22:12:36 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 22:12:36 +0200 (CEST) Subject: [Python-checkins] r52277 - sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061010201236.AF4E41E4008@bag.python.org> Author: brett.cannon Date: Tue Oct 10 22:12:36 2006 New Revision: 52277 Modified: sandbox/trunk/import_in_py/test_importer.py Log: Properly clean up after bytecode tests. Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Tue Oct 10 22:12:36 2006 @@ -193,10 +193,20 @@ def setUp(self): """Make sure that the module has its bytecode generated.""" super(self.__class__, self).setUp() + # Bytecode file cleaned up by SourceFileTests.tearDown() thanks to + # assigning the bytecode file's path to self.file_path. + # But that does leave the original .py file in place; handle that in + # tearDown(). py_compile.compile(self.file_path, doraise=True) self.file_path += 'c' if __debug__ else 'o' self.handler = importer.PyBytecodeHandler() + def tearDown(self): + """Clean up the .py file since self.file_path is set to the bytecode + file and that is handled in the superclass.""" + super(self.__class__, self).tearDown() + os.remove(self.file_path[:-1]) + def test_handles_attr(self): # 'handles' should return 'pyc' or 'pyo' depending on __debug__. try: From python-checkins at python.org Tue Oct 10 22:29:22 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 22:29:22 +0200 (CEST) Subject: [Python-checkins] r52278 - sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061010202922.18CE41E4008@bag.python.org> Author: brett.cannon Date: Tue Oct 10 22:29:21 2006 New Revision: 52278 Modified: sandbox/trunk/import_in_py/test_importer.py Log: Refactor superclass for helping with py/pyc tests to generate both the py and pyc files since specifying individual handlers makes sure that one does not override the other when importing. Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Tue Oct 10 22:29:21 2006 @@ -110,34 +110,37 @@ sys.stdout = self._orig_stdout -class SourceFileTests(unittest.TestCase): +class PyPycTests(unittest.TestCase): - """Base class to help in generating a fresh source file.""" + """Base class to help in generating a fresh source and bytecode file.""" def setUp(self): """Generate the path to a temporary file to test with.""" self.module = 'source_tester' self.directory = tempfile.gettempdir() - self.file_path = os.path.join(self.directory, self.module+'.py') + self.source_path = os.path.join(self.directory, self.module+'.py') self.attr_name = 'test_attr' self.attr_value = None - with open(self.file_path, 'w') as py_file: + with open(self.source_path, 'w') as py_file: py_file.write('%s = %r' % (self.attr_name, self.attr_value)) + py_compile.compile(self.source_path, doraise=True) + self.bytecode_path = self.source_path + ('c' if __debug__ else 'o') def tearDown(self): """If the temporary path was used, make sure to clean up.""" - os.remove(self.file_path) + os.remove(self.source_path) + os.remove(self.bytecode_path) - def verify_module(self, module): + def verify_module(self, module, file_path): """Verify that the module is the one created during setup and has the expected attributes and values.""" self.failUnlessEqual(module.__name__, self.module) - self.failUnlessEqual(module.__file__, self.file_path) + self.failUnlessEqual(module.__file__, file_path) self.failUnless(hasattr(module, self.attr_name)) self.failUnlessEqual(getattr(module, self.attr_name), self.attr_value) -class SourceHandlerTests(SourceFileTests): +class SourceHandlerTests(PyPycTests): """Test the Python source code handler.""" @@ -154,59 +157,19 @@ # Should be able to handle a module that is directly pointed at. new_module = new.module(self.module) self.handler.handle_file(new_module, self.module, - None, self.file_path) - self.verify_module(new_module) - - -class FileSystemLoaderTests(SourceFileTests): - - """Test the filesystem loader.""" - - def setUp(self): - """Create a fresh loader per run.""" - super(self.__class__, self).setUp() - self.loader = importer.FileSystemLoader(self.file_path, - importer.PySourceHandler()) - - def test_load_module_fresh(self): - # Test a basic module load where there is no sys.modules entry. - try: - del sys.modules[self.module] - except KeyError: - pass - new_module = self.loader.load_module(self.module) - self.verify_module(new_module) - - def test_load_module_sys_modules(self): - # Make sure that the loader returns the module from sys.modules if it - # is there. - new_module = new.module(self.module) - sys.modules[self.module] = new_module - loaded_module = self.loader.load_module(self.module) - self.failUnless(loaded_module is new_module) - - -class BytecodeHandlerTests(SourceFileTests): + None, self.source_path) + self.verify_module(new_module, self.source_path) + + +class BytecodeHandlerTests(PyPycTests): """Tests for the bytecode handler.""" def setUp(self): """Make sure that the module has its bytecode generated.""" super(self.__class__, self).setUp() - # Bytecode file cleaned up by SourceFileTests.tearDown() thanks to - # assigning the bytecode file's path to self.file_path. - # But that does leave the original .py file in place; handle that in - # tearDown(). - py_compile.compile(self.file_path, doraise=True) - self.file_path += 'c' if __debug__ else 'o' self.handler = importer.PyBytecodeHandler() - def tearDown(self): - """Clean up the .py file since self.file_path is set to the bytecode - file and that is handled in the superclass.""" - super(self.__class__, self).tearDown() - os.remove(self.file_path[:-1]) - def test_handles_attr(self): # 'handles' should return 'pyc' or 'pyo' depending on __debug__. try: @@ -222,9 +185,37 @@ # generated. new_module = new.module(self.module) self.handler.handle_file(new_module, self.module, None, - self.file_path) - self.verify_module(new_module) - + self.bytecode_path) + self.verify_module(new_module, self.bytecode_path) + + +class FileSystemLoaderTests(PyPycTests): + + """Test the filesystem loader.""" + + def setUp(self): + """Create a fresh loader per run.""" + super(self.__class__, self).setUp() + self.loader = importer.FileSystemLoader(self.source_path, + importer.PySourceHandler()) + + def test_load_module_fresh(self): + # Test a basic module load where there is no sys.modules entry. + try: + del sys.modules[self.module] + except KeyError: + pass + new_module = self.loader.load_module(self.module) + self.verify_module(new_module, self.source_path) + + def test_load_module_sys_modules(self): + # Make sure that the loader returns the module from sys.modules if it + # is there. + new_module = new.module(self.module) + sys.modules[self.module] = new_module + loaded_module = self.loader.load_module(self.module) + self.failUnless(loaded_module is new_module) + def test_main(): test_support.run_unittest( From neal at metaslash.com Tue Oct 10 22:50:06 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 16:50:06 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061010205006.GA27282@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From python-checkins at python.org Tue Oct 10 22:52:33 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 22:52:33 +0200 (CEST) Subject: [Python-checkins] r52279 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061010205233.8A5AD1E4008@bag.python.org> Author: brett.cannon Date: Tue Oct 10 22:52:33 2006 New Revision: 52279 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Add tests for the filesystem importer. Along the way fix bugs to pass the tests. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Tue Oct 10 22:52:33 2006 @@ -136,8 +136,8 @@ # XXX Does not worry about case-insensitive filesystems. for handler in self.handlers: file_name = fullname + '.' + handler.handles - possible_file = os.path.join(self.path_entry, file_name) - if os.path.isfile(possible_file): + file_path = os.path.join(self.path_entry, file_name) + if os.path.isfile(file_path): break else: return None Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Tue Oct 10 22:52:33 2006 @@ -117,6 +117,10 @@ def setUp(self): """Generate the path to a temporary file to test with.""" self.module = 'source_tester' + try: + del sys.modules[self.module] + except KeyError: + pass self.directory = tempfile.gettempdir() self.source_path = os.path.join(self.directory, self.module+'.py') self.attr_name = 'test_attr' @@ -201,10 +205,7 @@ def test_load_module_fresh(self): # Test a basic module load where there is no sys.modules entry. - try: - del sys.modules[self.module] - except KeyError: - pass + # PyPycTests.setUp() clears sys.modules for us. new_module = self.loader.load_module(self.module) self.verify_module(new_module, self.source_path) @@ -215,6 +216,48 @@ sys.modules[self.module] = new_module loaded_module = self.loader.load_module(self.module) self.failUnless(loaded_module is new_module) + + +class FileSystemImporterTests(PyPycTests): + + """Test the filesystem importer.""" + + def setUp(self): + """Create a basic importer.""" + super(self.__class__, self).setUp() + self.importer = importer.FileSystemImporter(self.directory, + importer.PySourceHandler()) + + def test_find_module_single_handler(self): + # Having a single handler should work without issue. + loader = self.importer.find_module(self.module) + self.failUnless(isinstance(loader, importer.FileSystemLoader)) + self.failUnlessEqual(loader.file_path, self.source_path) + self.failUnless(isinstance(loader.handler, importer.PySourceHandler)) + + def test_find_module_cannot_find(self): + # Should return None if it can't find the module. + found = self.importer.find_module('gobbledeegook') + self.failUnlessEqual(found, None) + + def test_find_module_multiple_handlers(self): + # Modules should be found based on the order of the handlers. + fs_importer = importer.FileSystemImporter(self.directory, + importer.PyBytecodeHandler(), + importer.PySourceHandler()) + loader = fs_importer.find_module(self.module) + self.failUnless(isinstance(loader, importer.FileSystemLoader)) + self.failUnlessEqual(loader.file_path, self.bytecode_path) + self.failUnless(isinstance(loader.handler, importer.PyBytecodeHandler)) + + def test_find_to_load(self): + # Make sure that one can go from find_module() to getting a module + # imported. + loader = self.importer.find_module(self.module) + self.failUnless(loader) + module = loader.load_module(self.module) + self.verify_module(module, self.source_path) + self.failUnlessEqual(module, sys.modules[self.module]) def test_main(): @@ -224,6 +267,7 @@ SourceHandlerTests, BytecodeHandlerTests, FileSystemLoaderTests, + FileSystemImporterTests, ) From python-checkins at python.org Tue Oct 10 23:35:10 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 23:35:10 +0200 (CEST) Subject: [Python-checkins] r52280 - peps/trunk/pep-0360.txt Message-ID: <20061010213510.0C6271E4023@bag.python.org> Author: brett.cannon Date: Tue Oct 10 23:35:09 2006 New Revision: 52280 Modified: peps/trunk/pep-0360.txt Log: Update the PEP with a note about how no new PEPs should be added to this PEP. This is to reflect the fact that python-dev deemed it bad to allow module maintainers to have extra requirements on any code in Python. Modified: peps/trunk/pep-0360.txt ============================================================================== --- peps/trunk/pep-0360.txt (original) +++ peps/trunk/pep-0360.txt Tue Oct 10 23:35:09 2006 @@ -9,6 +9,13 @@ Created: 30-May-2006 +.. warning:: No new modules are to be added to this PEP. It has been + deemed dangerous to codify external maintenance of any + code checked into Python's code repository. Code + contributers should expect Python's development + methodology to be used for any and all code checked into + Python's code repository. + Abstract ======== From neal at metaslash.com Tue Oct 10 23:50:06 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 17:50:06 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061010215006.GA393@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From python-checkins at python.org Tue Oct 10 23:55:19 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 10 Oct 2006 23:55:19 +0200 (CEST) Subject: [Python-checkins] r52281 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061010215519.5E31D1E4011@bag.python.org> Author: brett.cannon Date: Tue Oct 10 23:55:18 2006 New Revision: 52281 Modified: sandbox/trunk/import_in_py/importer.py Log: Add more notes about where various import specifications are. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Tue Oct 10 23:55:18 2006 @@ -8,10 +8,18 @@ References on import: * Language reference http://docs.python.org/ref/import.html -* PEP 302: New Import Hooks - http://www.python.org/dev/peps/pep-0302/ * __import__ function http://docs.python.org/lib/built-in-funcs.html +* Packages + http://www.python.org/doc/essays/packages.html +* PEP 235: Import on Case-Insensitive Platforms + http://www.python.org/dev/peps/pep-0235 +* PEP 275: Import Modules from Zip Archives + http://www.python.org/dev/peps/pep-0273 +* PEP 302: New Import Hooks + http://www.python.org/dev/peps/pep-0302/ +* PEP 328: Imports: Multi-line and Absolute/Relative + http://www.python.org/dev/peps/pep-0328 Clarifications for PEP 302: * Raise ImportError when load_module() fails to load a module without From neal at metaslash.com Wed Oct 11 00:50:06 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 18:50:06 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061010225006.GA697@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From neal at metaslash.com Wed Oct 11 01:50:06 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 19:50:06 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061010235006.GA1002@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From neal at metaslash.com Wed Oct 11 02:50:06 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 20:50:06 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061011005006.GA1297@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From neal at metaslash.com Wed Oct 11 03:50:05 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 21:50:05 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061011015005.GA1597@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From neal at metaslash.com Wed Oct 11 04:50:06 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 10 Oct 2006 22:50:06 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061011025006.GA1898@python.psfb.org> TEXINPUTS=/home/neal/python/r24/Doc/commontex: python /home/neal/python/r24/Doc/tools/mkhowto --html --about html/stdabout.dat --iconserver ../icons --favicon ../icons/pyfav.png --address "See About this document... for information on suggesting changes." --up-link ../index.html --up-title "Python Documentation Index" --global-module-index "../modindex.html" --dvips-safe --dir html/api api/api.tex *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. The relevant lines from the transcript are: ------------------------------------------------------------------------ +++ latex api This is TeX, Version 3.14159 (Web2C 7.4.5) (/home/neal/python/r24/Doc/api/api.tex LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/home/neal/python/r24/Doc/texinputs/manual.cls Document Class: manual 1998/03/03 Document class (Python manual) (/home/neal/python/r24/Doc/texinputs/pypaper.sty (/usr/share/texmf/tex/latex/psnfss/times.sty) Using Times instead of Computer Modern. ) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/home/neal/python/r24/Doc/texinputs/fancyhdr.sty) Using fancier footers than usual. (/home/neal/python/r24/Doc/texinputs/fncychap.sty) Using fancy chapter headings. (/home/neal/python/r24/Doc/texinputs/python.sty (/usr/share/texmf/tex/latex/tools/longtable.sty) (/usr/share/texmf/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/base/alltt.sty))) (/home/neal/python/r24/Doc/commontex/boilerplate.tex ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.8 < <<<<<< .mine ? ! Emergency stop. ... l.8 < <<<<<< .mine No pages of output. Transcript written on api.log. *** Session transcript and error messages are in /home/neal/python/r24/Doc/html/api/api.how. *** Exited with status 1. +++ TEXINPUTS=/home/neal/python/r24/Doc/api:/home/neal/python/r24/Doc/commontex:/home/neal/python/r24/Doc/paper-letter:/home/neal/python/r24/Doc/texinputs: +++ latex api make: *** [html/api/api.html] Error 1 From python-checkins at python.org Wed Oct 11 06:32:53 2006 From: python-checkins at python.org (anthony.baxter) Date: Wed, 11 Oct 2006 06:32:53 +0200 (CEST) Subject: [Python-checkins] r52282 - python/tags/r244c1 Message-ID: <20061011043253.554C21E4008@bag.python.org> Author: anthony.baxter Date: Wed Oct 11 06:32:52 2006 New Revision: 52282 Added: python/tags/r244c1/ - copied from r52281, python/branches/release24-maint/ Log: Tagging for release of Python 2.4.4c1 From python-checkins at python.org Wed Oct 11 20:48:47 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 11 Oct 2006 20:48:47 +0200 (CEST) Subject: [Python-checkins] r52284 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061011184847.41D201E4008@bag.python.org> Author: brett.cannon Date: Wed Oct 11 20:48:46 2006 New Revision: 52284 Modified: sandbox/trunk/import_in_py/importer.py Log: Open source files in the source code handler with 'rU'. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Wed Oct 11 20:48:46 2006 @@ -185,7 +185,7 @@ 'module'.""" module.__file__ = file_path module.__name__ = fullname - with open(file_path) as source_file: + with open(file_path, 'rU') as source_file: source_code = source_file.read() compiled_code = compile(source_code, file_path, 'exec') exec compiled_code in module.__dict__ From python-checkins at python.org Wed Oct 11 22:35:09 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 11 Oct 2006 22:35:09 +0200 (CEST) Subject: [Python-checkins] r52286 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061011203509.BB8111E400E@bag.python.org> Author: brett.cannon Date: Wed Oct 11 22:35:08 2006 New Revision: 52286 Modified: sandbox/trunk/import_in_py/importer.py Log: A sketch of how to handle regenerating bytecode. It does not work right now because the needed marshal functions are not exposed at the moment. This is mostly to get the basic flow in code so as to see what API changes might be needed. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Wed Oct 11 22:35:08 2006 @@ -24,6 +24,12 @@ Clarifications for PEP 302: * Raise ImportError when load_module() fails to load a module without raising an exception. + +Differences from C implementation: + * Bytecode handler handles regenerating the source code rather than when + the source code is handled. This puts the burden of regeneration of + bytecode where it belongs since the source never requires the bytecode to + exist to work properly. Possible Py3K improvements: * Have __import__ check for sys.modules entry to alleviate need for every @@ -176,8 +182,6 @@ """Handler for importing Python source modules.""" - # XXX Does not generate a .pyc at the moment. - handles = 'py' def handle_file(self, module, fullname, path, file_path): @@ -195,7 +199,7 @@ class PyBytecodeHandler(object): """Handler for importing .pyc/.pyo modules.""" - + # XXX Should probably add a handle_string() method to PySourceHandler() so # that if the .pyc is outdated it can easily use PySourceHandler to do the # import for it and then write out the new .pyc . @@ -206,17 +210,69 @@ return 'pyc' if __debug__ else 'pyo' handles = property(_handles) + + def find_source(self, bytecode_path): + """Return the path to the source file for the bytecode or None if it + was not found.""" + # XXX Might be nicer to not hard-code this and instead work off of a handler. + source_path = bytecode_path[:-1] + return source_path if os.path.exists(source_path) else None + + def validate_magic(self, marshalled_magic): + """Return a boolean as to whether the marshalled magic number is good + or not.""" + return True + # XXX Need Python/marshal.c:r_long() exposed. + magic_number = marshal.loads(marshalled_magic) + return True if magic_number == imp.get_magic() else False + + def validate_timestamp(self, marshalled_timestamp, source_path): + """Return a boolean as to whether the timestamp was valid or not + compared to the source file.""" + return True + # XXX Need Python/marshal.c:r_long() exposed. + bytecode_timestamp = marshal.loads(marshalled_timestamp) + source_timestampe = os.stat(source_path).st_mtime + if source_timestamp >> 32: + raise OverflowError("modification time overflows a 4 byte field") + return True if source_timestamp <= bytecode_timestamp else False + + def regenerate_bytecode(self, source_path, bytecode_path): + """Regenerate the bytecode_path file from source_path and return the + code object created.""" + raise NotImplementedError("need to be able to marshal longs directly") + # XXX Need to be expose Python/marshal.c:w_long() + marshalled_magic = marshal.loads(imp.get_magic()) + timestamp = os.stat(source_path).st_mtime + marshalled_timestamp = marshal.loads(timestamp) + with open(source_path, 'rU') as source_file: + source_code = source_file.read() + code_object = compile(source_code, source_path, 'exec') + with open(bytecode_path, 'wb') as bytecode_file: + bytecode_file.write(marshalled_magic) + bytecode_file.write(marshalled_timestamp) + marshal.dump(code_object, bytecode_file) + return code_object + + def handle_file(self, module, fullname, path, file_path): """Import the Python bytecode file at 'path' and use it to initialize 'module'.""" - module.__file__ = file_path - module.__name__ = fullname with open(file_path, 'rb') as bytecode_file: - # XXX No verification of magic number. magic = bytecode_file.read(4) - # XXX No verification of timestamp. - mtime = bytecode_file.read(4) + timestamp = bytecode_file.read(4) compiled_code = marshal.load(bytecode_file) + source_path = self.find_source(file_path) + if source_path: + if (not self.validate_magic(magic) or + not self.validate_timestamp(timestamp, source_path)): + compiled_code = self.regenerate_bytecode(source_path, + bytecode_path) + else: + if not self.validate_magic(magic): + raise ImportError("bad magic number") exec compiled_code in module.__dict__ + module.__file__ = file_path + module.__name__ = fullname return module From python-checkins at python.org Wed Oct 11 22:42:39 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 11 Oct 2006 22:42:39 +0200 (CEST) Subject: [Python-checkins] r52287 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061011204239.81E591E400F@bag.python.org> Author: brett.cannon Date: Wed Oct 11 22:42:39 2006 New Revision: 52287 Modified: sandbox/trunk/import_in_py/importer.py Log: Outline an optimal use case that should be supported in the easiest way possible with good code reuse from what is already provided. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Wed Oct 11 22:42:39 2006 @@ -40,6 +40,15 @@ sys.path_importer_cache. Could leave string entries on sys.path that do not have an importer that can handle them so they can be retried at the next needed import (that was not found in sys.modules). + +XXX Use cases to consider: + * PTL files (from Quixote) + + Tweaked source files that need to be pre-processed before they are imported. + + Should be able to write out bytecode files. + - Need to make it easy for .pyc file output, or should just have them use their + own file extension? + + Should let them use as much base infrastructure from the source and bytecode + handlers as possible along with the filesystem importer/loader. """ from __future__ import with_statement From python-checkins at python.org Thu Oct 12 00:39:16 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Oct 2006 00:39:16 +0200 (CEST) Subject: [Python-checkins] r52288 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061011223916.4FB0E1E4007@bag.python.org> Author: brett.cannon Date: Thu Oct 12 00:39:15 2006 New Revision: 52288 Modified: sandbox/trunk/import_in_py/importer.py Log: Flesh out PTL example and make bytecode handler abstract out more of handling source code. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 12 00:39:15 2006 @@ -41,14 +41,22 @@ not have an importer that can handle them so they can be retried at the next needed import (that was not found in sys.modules). -XXX Use cases to consider: - * PTL files (from Quixote) - + Tweaked source files that need to be pre-processed before they are imported. - + Should be able to write out bytecode files. - - Need to make it easy for .pyc file output, or should just have them use their - own file extension? - + Should let them use as much base infrastructure from the source and bytecode - handlers as possible along with the filesystem importer/loader. +XXX PTL use-case: + * Tweaked source files that need to be pre-processed before they are imported. + * Should be able to write out bytecode files easily. + * Should let them use as much base infrastructure from the source and bytecode + handlers as possible along with the filesystem importer/loader. + * Expected implementaiton + + Source handler + - Set 'handles' to source extension + * 'ptl' + - Override get_code() + * Read PTL source. + * Translate as needed. + * Generate code object. + + Bytecode handler + - Set 'handles' to bytecode extension + * 'ptlc' """ from __future__ import with_statement @@ -192,15 +200,19 @@ """Handler for importing Python source modules.""" handles = 'py' + + def get_code(self, file_path): + """Return the code object as stored at file_path.""" + with open(file_path, 'rU') as source_file: + source_code = source_file.read() + return compile(source_code, file_path, 'exec') def handle_file(self, module, fullname, path, file_path): """Import the Python source file at 'path' and use it to initialize 'module'.""" module.__file__ = file_path module.__name__ = fullname - with open(file_path, 'rU') as source_file: - source_code = source_file.read() - compiled_code = compile(source_code, file_path, 'exec') + compiled_code = self.get_code(file_path) exec compiled_code in module.__dict__ return module @@ -213,6 +225,10 @@ # that if the .pyc is outdated it can easily use PySourceHandler to do the # import for it and then write out the new .pyc . # XXX Writing out a new .pyc should be made optional. + + def __init__(self, source=None): + """Store a source handler in case bytecode is invalid.""" + self.source_handler = source def _handles(self): """Return either 'pyc' or 'pyo' based on __debug__.""" @@ -223,8 +239,11 @@ def find_source(self, bytecode_path): """Return the path to the source file for the bytecode or None if it was not found.""" - # XXX Might be nicer to not hard-code this and instead work off of a handler. - source_path = bytecode_path[:-1] + if self.source_handler is None: + return None + source_ext = self.source_handler.handles + bytecode_base, bytecode_ext = os.path.splitext(bytecode_path) + source_path = bytecode_base + '.' + source_ext return source_path if os.path.exists(source_path) else None def validate_magic(self, marshalled_magic): @@ -251,19 +270,13 @@ code object created.""" raise NotImplementedError("need to be able to marshal longs directly") # XXX Need to be expose Python/marshal.c:w_long() - marshalled_magic = marshal.loads(imp.get_magic()) timestamp = os.stat(source_path).st_mtime - marshalled_timestamp = marshal.loads(timestamp) - with open(source_path, 'rU') as source_file: - source_code = source_file.read() - code_object = compile(source_code, source_path, 'exec') + code_object = self.source_handler.get_code(source_path) with open(bytecode_path, 'wb') as bytecode_file: - bytecode_file.write(marshalled_magic) - bytecode_file.write(marshalled_timestamp) + marshal.dump(imp.get_magic(), bytecode_file) + marshal.dump(timestamp, bytecode_file) marshal.dump(code_object, bytecode_file) return code_object - - def handle_file(self, module, fullname, path, file_path): """Import the Python bytecode file at 'path' and use it to initialize @@ -284,4 +297,4 @@ exec compiled_code in module.__dict__ module.__file__ = file_path module.__name__ = fullname - return module + return module \ No newline at end of file From python-checkins at python.org Thu Oct 12 00:43:13 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Oct 2006 00:43:13 +0200 (CEST) Subject: [Python-checkins] r52289 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061011224313.0DDE31E4007@bag.python.org> Author: brett.cannon Date: Thu Oct 12 00:43:12 2006 New Revision: 52289 Modified: sandbox/trunk/import_in_py/importer.py Log: Add assignment to __loader__. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 12 00:43:12 2006 @@ -192,6 +192,7 @@ module = imp.new_module(fullname) sys.modules[fullname] = module self.handler.handle_file(module, fullname, path, self.file_path) + module.__loader__ = self return module From python-checkins at python.org Thu Oct 12 01:09:43 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Oct 2006 01:09:43 +0200 (CEST) Subject: [Python-checkins] r52290 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061011230943.79D9B1E4008@bag.python.org> Author: brett.cannon Date: Thu Oct 12 01:09:43 2006 New Revision: 52290 Modified: sandbox/trunk/import_in_py/importer.py Log: Add a note of what changes would be needed for zipimport to be easily implemented in Python along with reuse of the source and bytecode handlers. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 12 01:09:43 2006 @@ -57,6 +57,22 @@ + Bytecode handler - Set 'handles' to bytecode extension * 'ptlc' + +XXX zipimport use-case: + * New path_hooks function. + + If sys.path entry is an existing zip file, return an importer for it. + + Initialize the path_hooks function with handlers that are to be considered + for use. + * New importer. + + Open zipfile and check if it has a path to the desired module. + * New loader. + + Return a new file-like object for the zipfile for the contained file. + - Implement read(). + * Should it implement # of bytes to return, or just a complete read? + - Have a 'name' attribute. + * PySourceHandler() and PyBytecodeHandler() would need to switch to accepting a + file-like object that has a read() method along with a name attribute (for use + in compile() for error reporting). """ from __future__ import with_statement @@ -191,6 +207,8 @@ except KeyError: module = imp.new_module(fullname) sys.modules[fullname] = module + # XXX Could have handlers return code objects and do module initialization + # ourselves if extension modules and imp were changed to support such a thing. self.handler.handle_file(module, fullname, path, self.file_path) module.__loader__ = self return module @@ -221,14 +239,14 @@ class PyBytecodeHandler(object): """Handler for importing .pyc/.pyo modules.""" - - # XXX Should probably add a handle_string() method to PySourceHandler() so - # that if the .pyc is outdated it can easily use PySourceHandler to do the - # import for it and then write out the new .pyc . - # XXX Writing out a new .pyc should be made optional. def __init__(self, source=None): - """Store a source handler in case bytecode is invalid.""" + """Store a source handler in case bytecode is invalid. + + Source handler must implement get_code(file_path) and return a code + object to be used for writing the bytecode file. + + """ self.source_handler = source def _handles(self): From python-checkins at python.org Thu Oct 12 01:35:56 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Oct 2006 01:35:56 +0200 (CEST) Subject: [Python-checkins] r52291 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061011233556.D4A311E4007@bag.python.org> Author: brett.cannon Date: Thu Oct 12 01:35:56 2006 New Revision: 52291 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Flesh out documentation for how everything plugs in together. Tweaked how PyBytecodeHandler sets 'handles' (directly set attribute instead of a property since the property was not really needed). Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 12 01:35:56 2006 @@ -148,13 +148,19 @@ class FileSystemFactory(object): - """Factory object for sys.path_hooks for directory entries on sys.path.""" + """Factory object for sys.path_hooks for directory entries on sys.path. + + The path to be handled, if it is a filesystem directory, is used to + initialize a new FileSystemImporter for that path entry. The handlers are + also passed on to the importer. + + """ def __init__(self, *handlers): """Store handlers to be used in attempting to import. The order that the handlers are specified are the order in which - files will be considered for importing. + the handlers will be passed on to any instantiated importers. """ self.handlers = handlers @@ -171,14 +177,16 @@ class FileSystemImporter(object): - """Importer for the filesystem.""" + """Importer for the filesystem using the passed-in handlers.""" def __init__(self, path_entry, *handlers): self.path_entry = path_entry self.handlers = handlers def find_module(self, fullname, path=None): - """Determine if this path entry can handle this import.""" + """Determine if this path entry can handle this import, and if so, + return a loader for the module on this path entry based on the handlers + registered.""" # XXX Ignores 'path' at the moment. # XXX Does not worry about case-insensitive filesystems. for handler in self.handlers: @@ -200,7 +208,12 @@ self.handler = handler def load_module(self, fullname, path=None): - """Load the module from self.path using self.handler.""" + """Load the module from self.path using self.handler. + + The handler is expected to implement a handle_file method that will + deal with initializing the module passed to it. + + """ # XXX Ignores 'path' at the moment. try: return sys.modules[fullname] @@ -221,14 +234,19 @@ handles = 'py' def get_code(self, file_path): - """Return the code object as stored at file_path.""" + """Return the code object as stored at file_path. + + Provided for use by PyBytecodeHandler to recreate bytecode for a source + file. + + """ with open(file_path, 'rU') as source_file: source_code = source_file.read() return compile(source_code, file_path, 'exec') def handle_file(self, module, fullname, path, file_path): - """Import the Python source file at 'path' and use it to initialize - 'module'.""" + """Import the Python source file at file_path and use it to + initialize 'module'.""" module.__file__ = file_path module.__name__ = fullname compiled_code = self.get_code(file_path) @@ -238,29 +256,31 @@ class PyBytecodeHandler(object): - """Handler for importing .pyc/.pyo modules.""" + """Handler for importing .pyc/.pyo modules. + + Subclasses are expected at least override 'handles'. If any special + bytecode handling is needed in terms of recreating it, then use the + appropriate source provider during initialization. - def __init__(self, source=None): + """ + + def __init__(self, source_provider=None): """Store a source handler in case bytecode is invalid. - Source handler must implement get_code(file_path) and return a code - object to be used for writing the bytecode file. + source_provider must implement get_code(file_path) and return a code + object to be used for writing a new bytecode file. It also needs to + have a 'handles' attribute. """ - self.source_handler = source - - def _handles(self): - """Return either 'pyc' or 'pyo' based on __debug__.""" - return 'pyc' if __debug__ else 'pyo' - - handles = property(_handles) + self.source_provider = source_provider + self.handles = 'pyc' if __debug__ else 'pyo' def find_source(self, bytecode_path): """Return the path to the source file for the bytecode or None if it was not found.""" - if self.source_handler is None: + if self.source_provider is None: return None - source_ext = self.source_handler.handles + source_ext = self.source_provider.handles bytecode_base, bytecode_ext = os.path.splitext(bytecode_path) source_path = bytecode_base + '.' + source_ext return source_path if os.path.exists(source_path) else None @@ -290,7 +310,7 @@ raise NotImplementedError("need to be able to marshal longs directly") # XXX Need to be expose Python/marshal.c:w_long() timestamp = os.stat(source_path).st_mtime - code_object = self.source_handler.get_code(source_path) + code_object = self.source_provider.get_code(source_path) with open(bytecode_path, 'wb') as bytecode_file: marshal.dump(imp.get_magic(), bytecode_file) marshal.dump(timestamp, bytecode_file) Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Thu Oct 12 01:35:56 2006 @@ -178,9 +178,11 @@ # 'handles' should return 'pyc' or 'pyo' depending on __debug__. try: importer.__debug__ = True - self.failUnlessEqual(self.handler.handles, 'pyc') + handler = importer.PyBytecodeHandler() + self.failUnlessEqual(handler.handles, 'pyc') importer.__debug__ = False - self.failUnlessEqual(self.handler.handles, 'pyo') + handler = importer.PyBytecodeHandler() + self.failUnlessEqual(handler.handles, 'pyo') finally: del importer.__debug__ From python-checkins at python.org Thu Oct 12 01:56:57 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Oct 2006 01:56:57 +0200 (CEST) Subject: [Python-checkins] r52292 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061011235657.59CD61E4007@bag.python.org> Author: brett.cannon Date: Thu Oct 12 01:56:56 2006 New Revision: 52292 Modified: sandbox/trunk/import_in_py/importer.py Log: Update some ideas. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 12 01:56:56 2006 @@ -34,14 +34,18 @@ Possible Py3K improvements: * Have __import__ check for sys.modules entry to alleviate need for every loader to do so. - * Have __import__ pass in module to initialize for imported module so to - alleviate loader from having to pull from sys.modules. + * Have __import__ pass into the loader the module to be initialized so as + remove that boilerplate (also keeps sys.modules manipulation within + __import__ when the previous suggestion is used). * Put importer objects directly into sys.path to remove need for sys.path_importer_cache. Could leave string entries on sys.path that do - not have an importer that can handle them so they can be retried at the - next needed import (that was not found in sys.modules). + not have an importer so they can be re-checked the next time a new import + is attempted. + + If __import__ handles sys.modules then the impact from having to + recheck sys.path entries that lack an importer is minimized as it is + only on imports that have not been handled before. -XXX PTL use-case: +PTL use-case: * Tweaked source files that need to be pre-processed before they are imported. * Should be able to write out bytecode files easily. * Should let them use as much base infrastructure from the source and bytecode @@ -58,7 +62,7 @@ - Set 'handles' to bytecode extension * 'ptlc' -XXX zipimport use-case: +zipimport use-case: * New path_hooks function. + If sys.path entry is an existing zip file, return an importer for it. + Initialize the path_hooks function with handlers that are to be considered @@ -72,7 +76,8 @@ - Have a 'name' attribute. * PySourceHandler() and PyBytecodeHandler() would need to switch to accepting a file-like object that has a read() method along with a name attribute (for use - in compile() for error reporting). + in compile() for error reporting). Also do not pass in a source provider for + the bytecode handler so as to suppress that writing of new bytecode. """ from __future__ import with_statement @@ -230,6 +235,12 @@ class PySourceHandler(object): """Handler for importing Python source modules.""" + + # XXX Need to have a way to generate bytecode when none was found in the + # first place. If there ends up being too much overlap with the bytecode + # handler in terms of bytecode generation then consider + # following the current convention and have a unified source/bytecode + # handler that does it all. handles = 'py' From python-checkins at python.org Thu Oct 12 09:38:04 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 09:38:04 +0200 (CEST) Subject: [Python-checkins] r52293 - python/trunk/Doc/lib/libfuncs.tex Message-ID: <20061012073804.ECF0A1E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 09:38:04 2006 New Revision: 52293 Modified: python/trunk/Doc/lib/libfuncs.tex Log: Bug #1575746: fix typo in property() docs. Modified: python/trunk/Doc/lib/libfuncs.tex ============================================================================== --- python/trunk/Doc/lib/libfuncs.tex (original) +++ python/trunk/Doc/lib/libfuncs.tex Thu Oct 12 09:38:04 2006 @@ -791,7 +791,7 @@ \begin{verbatim} class C(object): - def __init__(self): self.__x = None + def __init__(self): self._x = None def getx(self): return self._x def setx(self, value): self._x = value def delx(self): del self._x From python-checkins at python.org Thu Oct 12 09:38:08 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 09:38:08 +0200 (CEST) Subject: [Python-checkins] r52294 - python/branches/release25-maint/Doc/lib/libfuncs.tex Message-ID: <20061012073808.74CF11E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 09:38:08 2006 New Revision: 52294 Modified: python/branches/release25-maint/Doc/lib/libfuncs.tex Log: Bug #1575746: fix typo in property() docs. (backport from rev. 52293) Modified: python/branches/release25-maint/Doc/lib/libfuncs.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libfuncs.tex (original) +++ python/branches/release25-maint/Doc/lib/libfuncs.tex Thu Oct 12 09:38:08 2006 @@ -791,7 +791,7 @@ \begin{verbatim} class C(object): - def __init__(self): self.__x = None + def __init__(self): self._x = None def getx(self): return self._x def setx(self, value): self._x = value def delx(self): del self._x From python-checkins at python.org Thu Oct 12 09:57:22 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 09:57:22 +0200 (CEST) Subject: [Python-checkins] r52295 - in python/trunk: Lib/idlelib/PyShell.py Misc/NEWS Message-ID: <20061012075722.1B6B91E4024@bag.python.org> Author: georg.brandl Date: Thu Oct 12 09:57:21 2006 New Revision: 52295 Modified: python/trunk/Lib/idlelib/PyShell.py python/trunk/Misc/NEWS Log: Bug #813342: Start the IDLE subprocess with -Qnew if the parent is started with that option. Modified: python/trunk/Lib/idlelib/PyShell.py ============================================================================== --- python/trunk/Lib/idlelib/PyShell.py (original) +++ python/trunk/Lib/idlelib/PyShell.py Thu Oct 12 09:57:21 2006 @@ -351,6 +351,8 @@ def build_subprocess_arglist(self): w = ['-W' + s for s in sys.warnoptions] + if 1/2 > 0: # account for new division + w.append('-Qnew') # Maybe IDLE is installed and is being accessed via sys.path, # or maybe it's not installed and the idle.py script is being # run from the IDLE source directory. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Oct 12 09:57:21 2006 @@ -75,6 +75,9 @@ Library ------- +- Bug #813342: Start the IDLE subprocess with -Qnew if the parent + is started with that option. + - Bug #1565150: Fix subsecond processing for os.utime on Windows. - Support for MSVC 8 was added to bdist_wininst. From python-checkins at python.org Thu Oct 12 09:57:25 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 09:57:25 +0200 (CEST) Subject: [Python-checkins] r52296 - in python/branches/release25-maint: Lib/idlelib/PyShell.py Misc/NEWS Message-ID: <20061012075725.72C251E404F@bag.python.org> Author: georg.brandl Date: Thu Oct 12 09:57:24 2006 New Revision: 52296 Modified: python/branches/release25-maint/Lib/idlelib/PyShell.py python/branches/release25-maint/Misc/NEWS Log: Bug #813342: Start the IDLE subprocess with -Qnew if the parent is started with that option. (backport from rev. 52295) Modified: python/branches/release25-maint/Lib/idlelib/PyShell.py ============================================================================== --- python/branches/release25-maint/Lib/idlelib/PyShell.py (original) +++ python/branches/release25-maint/Lib/idlelib/PyShell.py Thu Oct 12 09:57:24 2006 @@ -351,6 +351,8 @@ def build_subprocess_arglist(self): w = ['-W' + s for s in sys.warnoptions] + if 1/2 > 0: # account for new division + w.append('-Qnew') # Maybe IDLE is installed and is being accessed via sys.path, # or maybe it's not installed and the idle.py script is being # run from the IDLE source directory. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Thu Oct 12 09:57:24 2006 @@ -66,6 +66,9 @@ Library ------- +- Bug #813342: Start the IDLE subprocess with -Qnew if the parent + is started with that option. + - Bug #1446043: correctly raise a LookupError if an encoding name given to encodings.search_function() contains a dot. From python-checkins at python.org Thu Oct 12 10:22:54 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 10:22:54 +0200 (CEST) Subject: [Python-checkins] r52297 - in python/trunk: Doc/ref/ref3.tex Misc/NEWS Message-ID: <20061012082254.A04431E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 10:22:53 2006 New Revision: 52297 Modified: python/trunk/Doc/ref/ref3.tex python/trunk/Misc/NEWS Log: Bug #1565919: document set types in the Language Reference. Modified: python/trunk/Doc/ref/ref3.tex ============================================================================== --- python/trunk/Doc/ref/ref3.tex (original) +++ python/trunk/Doc/ref/ref3.tex Thu Oct 12 10:22:53 2006 @@ -379,6 +379,41 @@ \end{description} % Sequences + +\item[Set types] +These represent unordered, finite sets of unique, immutable objects. +As such, they cannot be indexed by any subscript. However, they can be +iterated over, and the built-in function \function{len()} returns the +number of items in a set. Common uses for sets are +fast membership testing, removing duplicates from a sequence, and +computing mathematical operations such as intersection, union, difference, +and symmetric difference. +\bifuncindex{len} +\obindex{set type} + +For set elements, the same immutability rules apply as for dictionary +keys. Note that numeric types obey the normal rules for numeric +comparison: if two numbers compare equal (e.g., \code{1} and +\code{1.0}), only one of them can be contained in a set. + +There are currently two intrinsic set types: + +\begin{description} + +\item[Sets] +These\obindex{set} represent a mutable set. They are created by the +built-in \function{set()} constructor and can be modified afterwards +by several methods, such as \method{add()}. + +\item[Frozen sets] +These\obindex{frozenset} represent an immutable set. They are created by +the built-in \function{frozenset()} constructor. As a frozenset is +immutable and hashable, it can be used again as an element of another set, +or as a dictionary key. + +\end{description} % Set types + + \item[Mappings] These represent finite sets of objects indexed by arbitrary index sets. The subscript notation \code{a[k]} selects the item indexed Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Oct 12 10:22:53 2006 @@ -175,6 +175,8 @@ Documentation ------------- +- Bug #1565919: document set types in the Language Reference. + - Bug #1546052: clarify that PyString_FromString(AndSize) copies the string pointed to by its parameter. From python-checkins at python.org Thu Oct 12 10:22:58 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 10:22:58 +0200 (CEST) Subject: [Python-checkins] r52298 - in python/branches/release25-maint: Doc/ref/ref3.tex Misc/NEWS Message-ID: <20061012082258.4554D1E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 10:22:57 2006 New Revision: 52298 Modified: python/branches/release25-maint/Doc/ref/ref3.tex python/branches/release25-maint/Misc/NEWS Log: Bug #1565919: document set types in the Language Reference. (backport from rev. 52297) Modified: python/branches/release25-maint/Doc/ref/ref3.tex ============================================================================== --- python/branches/release25-maint/Doc/ref/ref3.tex (original) +++ python/branches/release25-maint/Doc/ref/ref3.tex Thu Oct 12 10:22:57 2006 @@ -379,6 +379,41 @@ \end{description} % Sequences + +\item[Set types] +These represent unordered, finite sets of unique, immutable objects. +As such, they cannot be indexed by any subscript. However, they can be +iterated over, and the built-in function \function{len()} returns the +number of items in a set. Common uses for sets are +fast membership testing, removing duplicates from a sequence, and +computing mathematical operations such as intersection, union, difference, +and symmetric difference. +\bifuncindex{len} +\obindex{set type} + +For set elements, the same immutability rules apply as for dictionary +keys. Note that numeric types obey the normal rules for numeric +comparison: if two numbers compare equal (e.g., \code{1} and +\code{1.0}), only one of them can be contained in a set. + +There are currently two intrinsic set types: + +\begin{description} + +\item[Sets] +These\obindex{set} represent a mutable set. They are created by the +built-in \function{set()} constructor and can be modified afterwards +by several methods, such as \method{add()}. + +\item[Frozen sets] +These\obindex{frozenset} represent an immutable set. They are created by +the built-in \function{frozenset()} constructor. As a frozenset is +immutable and hashable, it can be used again as an element of another set, +or as a dictionary key. + +\end{description} % Set types + + \item[Mappings] These represent finite sets of objects indexed by arbitrary index sets. The subscript notation \code{a[k]} selects the item indexed Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Thu Oct 12 10:22:57 2006 @@ -191,6 +191,8 @@ Documentation ------------- +- Bug #1565919: document set types in the Language Reference. + - Bug #1546052: clarify that PyString_FromString(AndSize) copies the string pointed to by its parameter. From python-checkins at python.org Thu Oct 12 11:20:33 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 11:20:33 +0200 (CEST) Subject: [Python-checkins] r52299 - python/trunk/Lib/inspect.py Message-ID: <20061012092033.E298F1E4017@bag.python.org> Author: georg.brandl Date: Thu Oct 12 11:20:33 2006 New Revision: 52299 Modified: python/trunk/Lib/inspect.py Log: Bug #1550524: better heuristics to find correct class definition in inspect.findsource(). Modified: python/trunk/Lib/inspect.py ============================================================================== --- python/trunk/Lib/inspect.py (original) +++ python/trunk/Lib/inspect.py Thu Oct 12 11:20:33 2006 @@ -472,9 +472,24 @@ if isclass(object): name = object.__name__ - pat = re.compile(r'^\s*class\s*' + name + r'\b') + pat = re.compile(r'^(\s*)class\s*' + name + r'\b') + # make some effort to find the best matching class definition: + # use the one with the least indentation, which is the one + # that's most probably not inside a function definition. + candidates = [] for i in range(len(lines)): - if pat.match(lines[i]): return lines, i + match = pat.match(lines[i]) + if match: + # if it's at toplevel, it's already the best one + if lines[i][0] == 'c': + return lines, i + # else add whitespace to candidate list + candidates.append((match.group(1), i)) + if candidates: + # this will sort by whitespace, and by line number, + # less whitespace first + candidates.sort() + return lines, candidates[0][1] else: raise IOError('could not find class definition') From python-checkins at python.org Thu Oct 12 11:20:37 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 11:20:37 +0200 (CEST) Subject: [Python-checkins] r52300 - python/branches/release25-maint/Lib/inspect.py Message-ID: <20061012092037.040731E400C@bag.python.org> Author: georg.brandl Date: Thu Oct 12 11:20:36 2006 New Revision: 52300 Modified: python/branches/release25-maint/Lib/inspect.py Log: Bug #1550524: better heuristics to find correct class definition in inspect.findsource(). (backport from rev. 52299) Modified: python/branches/release25-maint/Lib/inspect.py ============================================================================== --- python/branches/release25-maint/Lib/inspect.py (original) +++ python/branches/release25-maint/Lib/inspect.py Thu Oct 12 11:20:36 2006 @@ -472,9 +472,24 @@ if isclass(object): name = object.__name__ - pat = re.compile(r'^\s*class\s*' + name + r'\b') + pat = re.compile(r'^(\s*)class\s*' + name + r'\b') + # make some effort to find the best matching class definition: + # use the one with the least indentation, which is the one + # that's most probably not inside a function definition. + candidates = [] for i in range(len(lines)): - if pat.match(lines[i]): return lines, i + match = pat.match(lines[i]) + if match: + # if it's at toplevel, it's already the best one + if lines[i][0] == 'c': + return lines, i + # else add whitespace to candidate list + candidates.append((match.group(1), i)) + if candidates: + # this will sort by whitespace, and by line number, + # less whitespace first + candidates.sort() + return lines, candidates[0][1] else: raise IOError('could not find class definition') From buildbot at python.org Thu Oct 12 11:42:08 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 09:42:08 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20061012094208.2E1AA1E4007@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%25202.5/builds/65 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Thu Oct 12 11:47:14 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 11:47:14 +0200 (CEST) Subject: [Python-checkins] r52301 - in python/trunk: Lib/test/test_StringIO.py Misc/NEWS Modules/cStringIO.c Message-ID: <20061012094714.449841E4017@bag.python.org> Author: georg.brandl Date: Thu Oct 12 11:47:12 2006 New Revision: 52301 Modified: python/trunk/Lib/test/test_StringIO.py python/trunk/Misc/NEWS python/trunk/Modules/cStringIO.c Log: Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode arguments with the system default encoding just like the write() method does, instead of converting it to a raw buffer. Modified: python/trunk/Lib/test/test_StringIO.py ============================================================================== --- python/trunk/Lib/test/test_StringIO.py (original) +++ python/trunk/Lib/test/test_StringIO.py Thu Oct 12 11:47:12 2006 @@ -120,6 +120,28 @@ class TestcStringIO(TestGenericStringIO): MODULE = cStringIO + def test_unicode(self): + + if not test_support.have_unicode: return + + # The cStringIO module converts Unicode strings to character + # strings when writing them to cStringIO objects. + # Check that this works. + + f = self.MODULE.StringIO() + f.write(unicode(self._line[:5])) + s = f.getvalue() + self.assertEqual(s, 'abcde') + self.assertEqual(type(s), types.StringType) + + f = self.MODULE.StringIO(unicode(self._line[:5])) + s = f.getvalue() + self.assertEqual(s, 'abcde') + self.assertEqual(type(s), types.StringType) + + self.assertRaises(UnicodeEncodeError, self.MODULE.StringIO, + unicode('\xf4', 'latin-1')) + import sys if sys.platform.startswith('java'): # Jython doesn't have a buffer object, so we just do a useless Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Oct 12 11:47:12 2006 @@ -131,6 +131,10 @@ Extension Modules ----------------- +- Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode + arguments with the system default encoding just like the write() + method does, instead of converting it to a raw buffer. + - Patch #1572724: fix typo ('=' instead of '==') in _msi.c. - Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault Modified: python/trunk/Modules/cStringIO.c ============================================================================== --- python/trunk/Modules/cStringIO.c (original) +++ python/trunk/Modules/cStringIO.c Thu Oct 12 11:47:12 2006 @@ -657,11 +657,9 @@ char *buf; Py_ssize_t size; - if (PyObject_AsReadBuffer(s, (const void **)&buf, &size)) { - PyErr_Format(PyExc_TypeError, "expected read buffer, %.200s found", - s->ob_type->tp_name); + if (PyObject_AsCharBuffer(s, (const void **)&buf, &size) != 0) return NULL; - } + self = PyObject_New(Iobject, &Itype); if (!self) return NULL; Py_INCREF(s); From python-checkins at python.org Thu Oct 12 11:47:20 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 11:47:20 +0200 (CEST) Subject: [Python-checkins] r52302 - in python/branches/release25-maint: Lib/test/test_StringIO.py Misc/NEWS Modules/cStringIO.c Message-ID: <20061012094720.06EC21E4008@bag.python.org> Author: georg.brandl Date: Thu Oct 12 11:47:17 2006 New Revision: 52302 Modified: python/branches/release25-maint/Lib/test/test_StringIO.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/cStringIO.c Log: Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode arguments with the system default encoding just like the write() method does, instead of converting it to a raw buffer. (backport from rev. 52301) Modified: python/branches/release25-maint/Lib/test/test_StringIO.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_StringIO.py (original) +++ python/branches/release25-maint/Lib/test/test_StringIO.py Thu Oct 12 11:47:17 2006 @@ -120,6 +120,28 @@ class TestcStringIO(TestGenericStringIO): MODULE = cStringIO + def test_unicode(self): + + if not test_support.have_unicode: return + + # The cStringIO module converts Unicode strings to character + # strings when writing them to cStringIO objects. + # Check that this works. + + f = self.MODULE.StringIO() + f.write(unicode(self._line[:5])) + s = f.getvalue() + self.assertEqual(s, 'abcde') + self.assertEqual(type(s), types.StringType) + + f = self.MODULE.StringIO(unicode(self._line[:5])) + s = f.getvalue() + self.assertEqual(s, 'abcde') + self.assertEqual(type(s), types.StringType) + + self.assertRaises(UnicodeEncodeError, self.MODULE.StringIO, + unicode('\xf4', 'latin-1')) + import sys if sys.platform.startswith('java'): # Jython doesn't have a buffer object, so we just do a useless Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Thu Oct 12 11:47:17 2006 @@ -49,6 +49,10 @@ Extension Modules ----------------- +- Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode + arguments with the system default encoding just like the write() + method does, instead of converting it to a raw buffer. + - Bug #1565150: Fix subsecond processing for os.utime on Windows. - Patch #1572724: fix typo ('=' instead of '==') in _msi.c. Modified: python/branches/release25-maint/Modules/cStringIO.c ============================================================================== --- python/branches/release25-maint/Modules/cStringIO.c (original) +++ python/branches/release25-maint/Modules/cStringIO.c Thu Oct 12 11:47:17 2006 @@ -657,11 +657,9 @@ char *buf; Py_ssize_t size; - if (PyObject_AsReadBuffer(s, (const void **)&buf, &size)) { - PyErr_Format(PyExc_TypeError, "expected read buffer, %.200s found", - s->ob_type->tp_name); + if (PyObject_AsCharBuffer(s, (const void **)&buf, &size) != 0) return NULL; - } + self = PyObject_New(Iobject, &Itype); if (!self) return NULL; Py_INCREF(s); From python-checkins at python.org Thu Oct 12 13:14:40 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:14:40 +0200 (CEST) Subject: [Python-checkins] r52303 - python/trunk/Doc/lib/liburlparse.tex Message-ID: <20061012111440.011B01E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:14:40 2006 New Revision: 52303 Modified: python/trunk/Doc/lib/liburlparse.tex Log: Bug #1546628: add a note about urlparse.urljoin() and absolute paths. Modified: python/trunk/Doc/lib/liburlparse.tex ============================================================================== --- python/trunk/Doc/lib/liburlparse.tex (original) +++ python/trunk/Doc/lib/liburlparse.tex Thu Oct 12 13:14:40 2006 @@ -142,7 +142,7 @@ \begin{funcdesc}{urljoin}{base, url\optional{, allow_fragments}} Construct a full (``absolute'') URL by combining a ``base URL'' -(\var{base}) with a ``relative URL'' (\var{url}). Informally, this +(\var{base}) with another URL (\var{url}). Informally, this uses components of the base URL, in particular the addressing scheme, the network location and (part of) the path, to provide missing components in the relative URL. For example: @@ -155,6 +155,20 @@ The \var{allow_fragments} argument has the same meaning and default as for \function{urlparse()}. + +\note{If \var{url} is an absolute URL (that is, starting with \code{//} + or \code{scheme://}, the \var{url}'s host name and/or scheme + will be present in the result. For example:} + +\begin{verbatim} +>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', +... '//www.python.org/%7Eguido') +'http://www.python.org/%7Eguido' +\end{verbatim} + +If you do not want that behavior, preprocess +the \var{url} with \function{urlsplit()} and \function{urlunsplit()}, +removing possible \em{scheme} and \em{netloc} parts. \end{funcdesc} \begin{funcdesc}{urldefrag}{url} From python-checkins at python.org Thu Oct 12 13:14:44 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:14:44 +0200 (CEST) Subject: [Python-checkins] r52304 - python/branches/release25-maint/Doc/lib/liburlparse.tex Message-ID: <20061012111444.DEBB81E400C@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:14:44 2006 New Revision: 52304 Modified: python/branches/release25-maint/Doc/lib/liburlparse.tex Log: Bug #1546628: add a note about urlparse.urljoin() and absolute paths. (backport from rev. 52303) Modified: python/branches/release25-maint/Doc/lib/liburlparse.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/liburlparse.tex (original) +++ python/branches/release25-maint/Doc/lib/liburlparse.tex Thu Oct 12 13:14:44 2006 @@ -142,7 +142,7 @@ \begin{funcdesc}{urljoin}{base, url\optional{, allow_fragments}} Construct a full (``absolute'') URL by combining a ``base URL'' -(\var{base}) with a ``relative URL'' (\var{url}). Informally, this +(\var{base}) with another URL (\var{url}). Informally, this uses components of the base URL, in particular the addressing scheme, the network location and (part of) the path, to provide missing components in the relative URL. For example: @@ -155,6 +155,20 @@ The \var{allow_fragments} argument has the same meaning and default as for \function{urlparse()}. + +\note{If \var{url} is an absolute URL (that is, starting with \code{//} + or \code{scheme://}, the \var{url}'s host name and/or scheme + will be present in the result. For example:} + +\begin{verbatim} +>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', +... '//www.python.org/%7Eguido') +'http://www.python.org/%7Eguido' +\end{verbatim} + +If you do not want that behavior, preprocess +the \var{url} with \function{urlsplit()} and \function{urlunsplit()}, +removing possible \em{scheme} and \em{netloc} parts. \end{funcdesc} \begin{funcdesc}{urldefrag}{url} From buildbot at python.org Thu Oct 12 13:25:40 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 11:25:40 +0000 Subject: [Python-checkins] buildbot warnings in ppc Debian unstable trunk Message-ID: <20061012112540.D47101E4007@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%2520Debian%2520unstable%2520trunk/builds/1229 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 13:25:43 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 11:25:43 +0000 Subject: [Python-checkins] buildbot warnings in PPC64 Debian trunk Message-ID: <20061012112543.7007E1E400C@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%2520Debian%2520trunk/builds/526 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 13:27:33 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 11:27:33 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian 2.5 Message-ID: <20061012112733.CBAC81E4007@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%2520Debian%25202.5/builds/65 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Thu Oct 12 13:28:01 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:28:01 +0200 (CEST) Subject: [Python-checkins] r52305 - in python/trunk: Lib/test/test_builtin.py Misc/NEWS Objects/intobject.c Message-ID: <20061012112801.EDFA51E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:27:59 2006 New Revision: 52305 Modified: python/trunk/Lib/test/test_builtin.py python/trunk/Misc/NEWS python/trunk/Objects/intobject.c Log: Bug #1545497: when given an explicit base, int() did ignore NULs embedded in the string to convert. Modified: python/trunk/Lib/test/test_builtin.py ============================================================================== --- python/trunk/Lib/test/test_builtin.py (original) +++ python/trunk/Lib/test/test_builtin.py Thu Oct 12 13:27:59 2006 @@ -729,6 +729,11 @@ self.assertRaises(ValueError, int, '123\0') self.assertRaises(ValueError, int, '53', 40) + # SF bug 1545497: embedded NULs were not detected with + # explicit base + self.assertRaises(ValueError, int, '123\0', 10) + self.assertRaises(ValueError, int, '123\x00 245', 20) + x = int('1' * 600) self.assert_(isinstance(x, long)) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Oct 12 13:27:59 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Bug #1545497: when given an explicit base, int() did ignore NULs + embedded in the string to convert. + - Bug #1569998: break inside a try statement (outside a loop) is now recognized and rejected. Modified: python/trunk/Objects/intobject.c ============================================================================== --- python/trunk/Objects/intobject.c (original) +++ python/trunk/Objects/intobject.c Thu Oct 12 13:27:59 2006 @@ -987,8 +987,25 @@ return PyInt_FromLong(0L); if (base == -909) return PyNumber_Int(x); - if (PyString_Check(x)) - return PyInt_FromString(PyString_AS_STRING(x), NULL, base); + if (PyString_Check(x)) { + /* Since PyInt_FromString doesn't have a length parameter, + * check here for possible NULs in the string. */ + char *string = PyString_AS_STRING(x); + if (strlen(string) != PyString_Size(x)) { + /* create a repr() of the input string, + * just like PyInt_FromString does */ + PyObject *srepr; + srepr = PyObject_Repr(x); + if (srepr == NULL) + return NULL; + PyErr_Format(PyExc_ValueError, + "invalid literal for int() with base %d: %s", + base, PyString_AS_STRING(srepr)); + Py_DECREF(srepr); + return NULL; + } + return PyInt_FromString(string, NULL, base); + } #ifdef Py_USING_UNICODE if (PyUnicode_Check(x)) return PyInt_FromUnicode(PyUnicode_AS_UNICODE(x), From python-checkins at python.org Thu Oct 12 13:28:05 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:28:05 +0200 (CEST) Subject: [Python-checkins] r52306 - in python/branches/release25-maint: Lib/test/test_builtin.py Misc/NEWS Objects/intobject.c Message-ID: <20061012112805.64C391E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:28:04 2006 New Revision: 52306 Modified: python/branches/release25-maint/Lib/test/test_builtin.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Objects/intobject.c Log: Bug #1545497: when given an explicit base, int() did ignore NULs embedded in the string to convert. (backport from rev. 52305) Modified: python/branches/release25-maint/Lib/test/test_builtin.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_builtin.py (original) +++ python/branches/release25-maint/Lib/test/test_builtin.py Thu Oct 12 13:28:04 2006 @@ -729,6 +729,11 @@ self.assertRaises(ValueError, int, '123\0') self.assertRaises(ValueError, int, '53', 40) + # SF bug 1545497: embedded NULs were not detected with + # explicit base + self.assertRaises(ValueError, int, '123\0', 10) + self.assertRaises(ValueError, int, '123\x00 245', 20) + x = int('1' * 600) self.assert_(isinstance(x, long)) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Thu Oct 12 13:28:04 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Bug #1545497: when given an explicit base, int() did ignore NULs + embedded in the string to convert. + - Bug #1569998: break inside a try statement (outside a loop) is now recognized and rejected. Modified: python/branches/release25-maint/Objects/intobject.c ============================================================================== --- python/branches/release25-maint/Objects/intobject.c (original) +++ python/branches/release25-maint/Objects/intobject.c Thu Oct 12 13:28:04 2006 @@ -987,8 +987,25 @@ return PyInt_FromLong(0L); if (base == -909) return PyNumber_Int(x); - if (PyString_Check(x)) - return PyInt_FromString(PyString_AS_STRING(x), NULL, base); + if (PyString_Check(x)) { + /* Since PyInt_FromString doesn't have a length parameter, + * check here for possible NULs in the string. */ + char *string = PyString_AS_STRING(x); + if (strlen(string) != PyString_Size(x)) { + /* create a repr() of the input string, + * just like PyInt_FromString does */ + PyObject *srepr; + srepr = PyObject_Repr(x); + if (srepr == NULL) + return NULL; + PyErr_Format(PyExc_ValueError, + "invalid literal for int() with base %d: %s", + base, PyString_AS_STRING(srepr)); + Py_DECREF(srepr); + return NULL; + } + return PyInt_FromString(string, NULL, base); + } #ifdef Py_USING_UNICODE if (PyUnicode_Check(x)) return PyInt_FromUnicode(PyUnicode_AS_UNICODE(x), From buildbot at python.org Thu Oct 12 13:33:12 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 11:33:12 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 2.5 Message-ID: <20061012113312.D61FF1E4007@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%2520Debian%2520unstable%25202.5/builds/66 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Thu Oct 12 13:41:12 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:41:12 +0200 (CEST) Subject: [Python-checkins] r52307 - python/trunk/Doc/lib/libfpectl.tex Message-ID: <20061012114112.683D31E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:41:11 2006 New Revision: 52307 Modified: python/trunk/Doc/lib/libfpectl.tex Log: Add a note to fpectl docs that it's not built by default (bug #1556261). Modified: python/trunk/Doc/lib/libfpectl.tex ============================================================================== --- python/trunk/Doc/lib/libfpectl.tex (original) +++ python/trunk/Doc/lib/libfpectl.tex Thu Oct 12 13:41:11 2006 @@ -7,6 +7,11 @@ \sectionauthor{Lee Busby}{busby1 at llnl.gov} \modulesynopsis{Provide control for floating point exception handling.} +\note{The \module{fpectl} module is not built by default, and its usage + is discouraged and may be dangerous except in the hand of + experts. See also the section \ref{fpectl-limitations} on + limitations for more details.} + Most computers carry out floating point operations\index{IEEE-754} in conformance with the so-called IEEE-754 standard. On any real computer, @@ -95,7 +100,7 @@ \end{verbatim} -\subsection{Limitations and other considerations} +\subsection{Limitations and other considerations \label{fpectl-limitations}} Setting up a given processor to trap IEEE-754 floating point errors currently requires custom code on a per-architecture basis. From python-checkins at python.org Thu Oct 12 13:41:15 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:41:15 +0200 (CEST) Subject: [Python-checkins] r52308 - python/branches/release25-maint/Doc/lib/libfpectl.tex Message-ID: <20061012114115.D61FD1E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:41:15 2006 New Revision: 52308 Modified: python/branches/release25-maint/Doc/lib/libfpectl.tex Log: Add a note to fpectl docs that it's not built by default (bug #1556261). (backport from rev. 52307) Modified: python/branches/release25-maint/Doc/lib/libfpectl.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libfpectl.tex (original) +++ python/branches/release25-maint/Doc/lib/libfpectl.tex Thu Oct 12 13:41:15 2006 @@ -7,6 +7,11 @@ \sectionauthor{Lee Busby}{busby1 at llnl.gov} \modulesynopsis{Provide control for floating point exception handling.} +\note{The \module{fpectl} module is not built by default, and its usage + is discouraged and may be dangerous except in the hand of + experts. See also the section \ref{fpectl-limitations} on + limitations for more details.} + Most computers carry out floating point operations\index{IEEE-754} in conformance with the so-called IEEE-754 standard. On any real computer, @@ -95,7 +100,7 @@ \end{verbatim} -\subsection{Limitations and other considerations} +\subsection{Limitations and other considerations \label{fpectl-limitations}} Setting up a given processor to trap IEEE-754 floating point errors currently requires custom code on a per-architecture basis. From python-checkins at python.org Thu Oct 12 13:46:57 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:46:57 +0200 (CEST) Subject: [Python-checkins] r52309 - python/trunk/Doc/tut/tut.tex Message-ID: <20061012114657.CF60A1E4019@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:46:57 2006 New Revision: 52309 Modified: python/trunk/Doc/tut/tut.tex Log: Bug #1560114: the Mac filesystem does have accurate information about the case of filenames. Modified: python/trunk/Doc/tut/tut.tex ============================================================================== --- python/trunk/Doc/tut/tut.tex (original) +++ python/trunk/Doc/tut/tut.tex Thu Oct 12 13:46:57 2006 @@ -2855,7 +2855,7 @@ *}? Ideally, one would hope that this somehow goes out to the filesystem, finds which submodules are present in the package, and imports them all. Unfortunately, this operation does not work very -well on Mac and Windows platforms, where the filesystem does not +well on Windows platforms, where the filesystem does not always have accurate information about the case of a filename! On these platforms, there is no guaranteed way to know whether a file \file{ECHO.PY} should be imported as a module \module{echo}, From python-checkins at python.org Thu Oct 12 13:47:01 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:47:01 +0200 (CEST) Subject: [Python-checkins] r52310 - python/branches/release25-maint/Doc/tut/tut.tex Message-ID: <20061012114701.4D6371E4019@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:47:00 2006 New Revision: 52310 Modified: python/branches/release25-maint/Doc/tut/tut.tex Log: Bug #1560114: the Mac filesystem does have accurate information about the case of filenames. (backport from rev. 52309) Modified: python/branches/release25-maint/Doc/tut/tut.tex ============================================================================== --- python/branches/release25-maint/Doc/tut/tut.tex (original) +++ python/branches/release25-maint/Doc/tut/tut.tex Thu Oct 12 13:47:00 2006 @@ -2855,7 +2855,7 @@ *}? Ideally, one would hope that this somehow goes out to the filesystem, finds which submodules are present in the package, and imports them all. Unfortunately, this operation does not work very -well on Mac and Windows platforms, where the filesystem does not +well on Windows platforms, where the filesystem does not always have accurate information about the case of a filename! On these platforms, there is no guaranteed way to know whether a file \file{ECHO.PY} should be imported as a module \module{echo}, From buildbot at python.org Thu Oct 12 13:51:24 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 11:51:24 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20061012115124.5B0BB1E4007@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%2520trunk/builds/1660 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 13:52:09 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 11:52:09 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20061012115209.9C0DA1E4007@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%2520trunk/builds/1574 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 13:53:47 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 11:53:47 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20061012115347.E77C71E4007@bag.python.org> The Buildbot has detected a new failure of x86 W2k trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%2520trunk/builds/1564 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From sjoerd at acm.org Thu Oct 12 13:53:44 2006 From: sjoerd at acm.org (Sjoerd Mullender) Date: Thu, 12 Oct 2006 13:53:44 +0200 Subject: [Python-checkins] r52307 - python/trunk/Doc/lib/libfpectl.tex In-Reply-To: <20061012114112.683D31E4007@bag.python.org> References: <20061012114112.683D31E4007@bag.python.org> Message-ID: <452E2CC8.7070505@acm.org> On 2006-10-12 13:41, georg.brandl wrote: > Author: georg.brandl > Date: Thu Oct 12 13:41:11 2006 > New Revision: 52307 > > Modified: > python/trunk/Doc/lib/libfpectl.tex > Log: > Add a note to fpectl docs that it's not built by default > (bug #1556261). > > > Modified: python/trunk/Doc/lib/libfpectl.tex > ============================================================================== > --- python/trunk/Doc/lib/libfpectl.tex (original) > +++ python/trunk/Doc/lib/libfpectl.tex Thu Oct 12 13:41:11 2006 > @@ -7,6 +7,11 @@ > \sectionauthor{Lee Busby}{busby1 at llnl.gov} > \modulesynopsis{Provide control for floating point exception handling.} > > +\note{The \module{fpectl} module is not built by default, and its usage > + is discouraged and may be dangerous except in the hand of That should be "hands". > + experts. See also the section \ref{fpectl-limitations} on > + limitations for more details.} > + > Most computers carry out floating point operations\index{IEEE-754} > in conformance with the so-called IEEE-754 standard. > On any real computer, > @@ -95,7 +100,7 @@ > \end{verbatim} > > > -\subsection{Limitations and other considerations} > +\subsection{Limitations and other considerations \label{fpectl-limitations}} > > Setting up a given processor to trap IEEE-754 floating point > errors currently requires custom code on a per-architecture basis. > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins -- Sjoerd Mullender -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 370 bytes Desc: OpenPGP digital signature Url : http://mail.python.org/pipermail/python-checkins/attachments/20061012/899e9cb1/attachment.pgp From buildbot at python.org Thu Oct 12 13:58:32 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 11:58:32 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD trunk Message-ID: <20061012115832.8A2121E4007@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%2520trunk/builds/1332 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Thu Oct 12 13:59:27 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:59:27 +0200 (CEST) Subject: [Python-checkins] r52311 - python/trunk/Doc/lib/libfpectl.tex Message-ID: <20061012115927.5B7C41E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:59:27 2006 New Revision: 52311 Modified: python/trunk/Doc/lib/libfpectl.tex Log: Small grammar fix, thanks Sjoerd. Modified: python/trunk/Doc/lib/libfpectl.tex ============================================================================== --- python/trunk/Doc/lib/libfpectl.tex (original) +++ python/trunk/Doc/lib/libfpectl.tex Thu Oct 12 13:59:27 2006 @@ -8,7 +8,7 @@ \modulesynopsis{Provide control for floating point exception handling.} \note{The \module{fpectl} module is not built by default, and its usage - is discouraged and may be dangerous except in the hand of + is discouraged and may be dangerous except in the hands of experts. See also the section \ref{fpectl-limitations} on limitations for more details.} From python-checkins at python.org Thu Oct 12 13:59:29 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 13:59:29 +0200 (CEST) Subject: [Python-checkins] r52312 - python/branches/release25-maint/Doc/lib/libfpectl.tex Message-ID: <20061012115929.B07451E400B@bag.python.org> Author: georg.brandl Date: Thu Oct 12 13:59:29 2006 New Revision: 52312 Modified: python/branches/release25-maint/Doc/lib/libfpectl.tex Log: Small grammar fix, thanks Sjoerd. (backport from rev. 52311) Modified: python/branches/release25-maint/Doc/lib/libfpectl.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libfpectl.tex (original) +++ python/branches/release25-maint/Doc/lib/libfpectl.tex Thu Oct 12 13:59:29 2006 @@ -8,7 +8,7 @@ \modulesynopsis{Provide control for floating point exception handling.} \note{The \module{fpectl} module is not built by default, and its usage - is discouraged and may be dangerous except in the hand of + is discouraged and may be dangerous except in the hands of experts. See also the section \ref{fpectl-limitations} on limitations for more details.} From python-checkins at python.org Thu Oct 12 14:03:08 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 14:03:08 +0200 (CEST) Subject: [Python-checkins] r52313 - python/trunk/Lib/tarfile.py Message-ID: <20061012120308.7EE691E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 14:03:07 2006 New Revision: 52313 Modified: python/trunk/Lib/tarfile.py Log: Fix tarfile depending on buggy int('1\0', base) behavior. Modified: python/trunk/Lib/tarfile.py ============================================================================== --- python/trunk/Lib/tarfile.py (original) +++ python/trunk/Lib/tarfile.py Thu Oct 12 14:03:07 2006 @@ -144,7 +144,7 @@ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0200): - n = int(s.rstrip(NUL) or "0", 8) + n = int(s.rstrip(NUL + " ") or "0", 8) else: n = 0L for i in xrange(len(s) - 1): From python-checkins at python.org Thu Oct 12 14:03:11 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 14:03:11 +0200 (CEST) Subject: [Python-checkins] r52314 - python/branches/release25-maint/Lib/tarfile.py Message-ID: <20061012120311.EC6AE1E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 14:03:11 2006 New Revision: 52314 Modified: python/branches/release25-maint/Lib/tarfile.py Log: Fix tarfile depending on buggy int('1\0', base) behavior. (backport from rev. 52313) Modified: python/branches/release25-maint/Lib/tarfile.py ============================================================================== --- python/branches/release25-maint/Lib/tarfile.py (original) +++ python/branches/release25-maint/Lib/tarfile.py Thu Oct 12 14:03:11 2006 @@ -144,7 +144,7 @@ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0200): - n = int(s.rstrip(NUL) or "0", 8) + n = int(s.rstrip(NUL + " ") or "0", 8) else: n = 0L for i in xrange(len(s) - 1): From buildbot at python.org Thu Oct 12 14:09:44 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 12:09:44 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo 2.5 Message-ID: <20061012120945.14EF11E4007@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520gentoo%25202.5/builds/79 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 14:11:27 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 12:11:27 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo 2.5 Message-ID: <20061012121127.4A64F1E4007@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%2520gentoo%25202.5/builds/79 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 14:14:19 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 12:14:19 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k 2.5 Message-ID: <20061012121419.6B48F1E4007@bag.python.org> The Buildbot has detected a new failure of x86 W2k 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520W2k%25202.5/builds/78 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 14:30:12 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 12:30:12 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.5 Message-ID: <20061012123012.61E871E4007@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520OpenBSD%25202.5/builds/75 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 14:30:31 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 12:30:31 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061012123031.C71731E4007@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%2520Tru64%25205.1%2520trunk/builds/1215 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 14:32:29 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 12:32:29 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20061012123229.6CBBF1E4007@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%2520trunk/builds/1509 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Thu Oct 12 14:33:08 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 14:33:08 +0200 (CEST) Subject: [Python-checkins] r52315 - python/trunk/Python/bltinmodule.c Message-ID: <20061012123308.6586D1E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 14:33:07 2006 New Revision: 52315 Modified: python/trunk/Python/bltinmodule.c Log: Bug #1283491: follow docstring convention wrt. keyword-able args in sum(). Modified: python/trunk/Python/bltinmodule.c ============================================================================== --- python/trunk/Python/bltinmodule.c (original) +++ python/trunk/Python/bltinmodule.c Thu Oct 12 14:33:07 2006 @@ -2055,10 +2055,11 @@ } PyDoc_STRVAR(sum_doc, -"sum(sequence, start=0) -> value\n\ +"sum(sequence[, start]) -> value\n\ \n\ Returns the sum of a sequence of numbers (NOT strings) plus the value\n\ -of parameter 'start'. When the sequence is empty, returns start."); +of parameter 'start' (which defaults to 0). When the sequence is\n\ +empty, returns start."); static PyObject * From buildbot at python.org Thu Oct 12 14:40:03 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 12:40:03 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20061012124003.7AA5F1E4007@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%2520osx.4%2520trunk/builds/1494 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 15:03:46 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 13:03:46 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061012130346.6BE071E4016@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%2520trunk/builds/144 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Thu Oct 12 15:08:17 2006 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Oct 2006 15:08:17 +0200 (CEST) Subject: [Python-checkins] r52316 - python/trunk/Lib/posixpath.py Message-ID: <20061012130817.467BB1E4007@bag.python.org> Author: georg.brandl Date: Thu Oct 12 15:08:16 2006 New Revision: 52316 Modified: python/trunk/Lib/posixpath.py Log: Bug #1560179: speed up posixpath.(dir|base)name Modified: python/trunk/Lib/posixpath.py ============================================================================== --- python/trunk/Lib/posixpath.py (original) +++ python/trunk/Lib/posixpath.py Thu Oct 12 15:08:16 2006 @@ -106,18 +106,23 @@ return '', p -# Return the tail (basename) part of a path. +# Return the tail (basename) part of a path, same as split(path)[1]. def basename(p): """Returns the final component of a pathname""" - return split(p)[1] + i = p.rfind('/') + 1 + return p[i:] -# Return the head (dirname) part of a path. +# Return the head (dirname) part of a path, same as split(path)[0]. def dirname(p): """Returns the directory component of a pathname""" - return split(p)[0] + i = p.rfind('/') + 1 + head = p[:i] + if head and head != '/'*len(head): + head = head.rstrip('/') + return head # Is a path a symbolic link? From buildbot at python.org Thu Oct 12 15:09:04 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 13:09:04 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc 2.5 Message-ID: <20061012130904.65ABD1E4007@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520solaris10%2520gcc%25202.5/builds/74 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 15:18:01 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 13:18:01 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian 2.5 Message-ID: <20061012131801.AB5301E4007@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%2520Debian%25202.5/builds/63 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 15:19:35 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 13:19:35 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 2.5 Message-ID: <20061012131935.933D41E4007@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/g4%2520osx.4%25202.5/builds/73 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 15:30:15 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 13:30:15 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20061012133015.D552C1E400F@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%2520Ubuntu%2520trunk%2520trunk/builds/153 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From jimjjewett at gmail.com Thu Oct 12 15:33:15 2006 From: jimjjewett at gmail.com (Jim Jewett) Date: Thu, 12 Oct 2006 09:33:15 -0400 Subject: [Python-checkins] r52290 - sandbox/trunk/import_in_py/importer.py In-Reply-To: <20061011230943.79D9B1E4008@bag.python.org> References: <20061011230943.79D9B1E4008@bag.python.org> Message-ID: On 10/11/06, brett.cannon wrote: > New Revision: 52290 > Modified: > sandbox/trunk/import_in_py/importer.py > Log: > Add a note of what changes would be needed for zipimport to be easily > implemented in Python along with reuse of the source and bytecode handlers. > +XXX zipimport use-case: > + * New path_hooks function. > + + If sys.path entry is an existing zip file, return an importer for it. > + + Initialize the path_hooks function with handlers that are to be considered > + for use. > + * New importer. > + + Open zipfile and check if it has a path to the desired module. > + * New loader. > + + Return a new file-like object for the zipfile for the contained file. > + - Implement read(). > + * Should it implement # of bytes to return, or just a complete read? > + - Have a 'name' attribute. I'm not quite sure I understand your intent. I thought the algorithm was basically for location in sys.meta_path: loader = location.find_module(fullname, path, level) if loader: return loader.load_module(fullname) else: raise ImportError("Could not find %s" % fullname) where a typical storage would try delegating to each format_handler (such as source, bytecode, PTL) in turn. Then the only thing special about a ZipImporter is that it would use a zipfile for (raw data) storage instead of a generic filesystem directory. But your XXX comment makes it look like zipimport is a special kind of file, rather than a special kind of directory. -jJ From jimjjewett at gmail.com Thu Oct 12 15:41:17 2006 From: jimjjewett at gmail.com (Jim Jewett) Date: Thu, 12 Oct 2006 09:41:17 -0400 Subject: [Python-checkins] r52292 - sandbox/trunk/import_in_py/importer.py In-Reply-To: <20061011235657.59CD61E4007@bag.python.org> References: <20061011235657.59CD61E4007@bag.python.org> Message-ID: On 10/11/06, brett.cannon wrote: > New Revision: 52292 ============================================================================== > --- sandbox/trunk/import_in_py/importer.py (original) > +++ sandbox/trunk/import_in_py/importer.py Thu Oct 12 01:56:56 2006 > @@ -34,14 +34,18 @@ > Possible Py3K improvements: > * Have __import__ check for sys.modules entry to alleviate need for every > loader to do so. > - * Have __import__ pass in module to initialize for imported module so to > - alleviate loader from having to pull from sys.modules. > + * Have __import__ pass into the loader the module to be initialized so as > + remove that boilerplate (also keeps sys.modules manipulation within > + __import__ when the previous suggestion is used). Putting a "just get the one that's already there" loader at the front should take care of this. Having __import__ always generate the module would make it harder to use things that aren't really modules. (examples: A module with a custom __dict__ type that gripes at external modification; the forwarders used when a module changes its name; Lazy Importers) -jJ From buildbot at python.org Thu Oct 12 16:03:27 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 14:03:27 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20061012140328.0A7F41E4007@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu dapper 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%2520Ubuntu%2520dapper%25202.5/builds/65 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Thu Oct 12 19:23:56 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Oct 2006 17:23:56 +0000 Subject: [Python-checkins] buildbot warnings in sparc Ubuntu dapper trunk Message-ID: <20061012172356.4E8E01E4008@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu dapper trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%2520Ubuntu%2520dapper%2520trunk/builds/738 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl Build Had Warnings: warnings test sincerely, -The Buildbot From brett at python.org Thu Oct 12 19:35:26 2006 From: brett at python.org (Brett Cannon) Date: Thu, 12 Oct 2006 10:35:26 -0700 Subject: [Python-checkins] r52290 - sandbox/trunk/import_in_py/importer.py In-Reply-To: References: <20061011230943.79D9B1E4008@bag.python.org> Message-ID: On 10/12/06, Jim Jewett wrote: > > On 10/11/06, brett.cannon wrote: > > New Revision: 52290 > > > Modified: > > sandbox/trunk/import_in_py/importer.py > > Log: > > Add a note of what changes would be needed for zipimport to be easily > > implemented in Python along with reuse of the source and bytecode > handlers. > > > +XXX zipimport use-case: > > + * New path_hooks function. > > + + If sys.path entry is an existing zip file, return an importer > for it. > > + + Initialize the path_hooks function with handlers that are to > be considered > > + for use. > > + * New importer. > > + + Open zipfile and check if it has a path to the desired > module. > > + * New loader. > > + + Return a new file-like object for the zipfile for the > contained file. > > + - Implement read(). > > + * Should it implement # of bytes to return, or just a > complete read? > > + - Have a 'name' attribute. > > I'm not quite sure I understand your intent. I thought the algorithm > was basically > > for location in sys.meta_path: > loader = location.find_module(fullname, path, level) > if loader: > return loader.load_module(fullname) > else: > raise ImportError("Could not find %s" % fullname) > > where a typical storage would try delegating to each format_handler > (such as source, bytecode, PTL) in turn. Nope, I am not using a meta_path importer for directory entries on sys.path. sys.path_hooks holds factory functions that return importers that get cached for handling specific entries on sys.path. You are right about the delegating, but this is not done on meta_path. Then the only thing special about a ZipImporter is that it would use a > zipfile for (raw data) storage instead of a generic filesystem > directory. Right. I had to completely rethink how I am going to handle this stuff. But your XXX comment makes it look like zipimport is a special kind of > file, rather than a special kind of directory. > > That's because right now the py/pyc handlers only accept a file path. But I am going to change this (hopefully) today. -Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20061012/86fdd751/attachment.html From brett at python.org Thu Oct 12 19:38:52 2006 From: brett at python.org (Brett Cannon) Date: Thu, 12 Oct 2006 10:38:52 -0700 Subject: [Python-checkins] r52292 - sandbox/trunk/import_in_py/importer.py In-Reply-To: References: <20061011235657.59CD61E4007@bag.python.org> Message-ID: On 10/12/06, Jim Jewett wrote: > > On 10/11/06, brett.cannon wrote: > > New Revision: 52292 > > > ============================================================================== > > --- sandbox/trunk/import_in_py/importer.py (original) > > +++ sandbox/trunk/import_in_py/importer.py Thu Oct 12 01:56:56 2006 > > @@ -34,14 +34,18 @@ > > Possible Py3K improvements: > > * Have __import__ check for sys.modules entry to alleviate need for > every > > loader to do so. > > - * Have __import__ pass in module to initialize for imported module > so to > > - alleviate loader from having to pull from sys.modules. > > + * Have __import__ pass into the loader the module to be initialized > so as > > + remove that boilerplate (also keeps sys.modules manipulation > within > > + __import__ when the previous suggestion is used). > > Putting a "just get the one that's already there" loader at the front > should take care of this. True. It could just be a meta_path importer. Having __import__ always generate the module would make it harder to > use things that aren't really modules. (examples: A module with a > custom __dict__ type that gripes at external modification; the > forwarders used when a module changes its name; Lazy Importers) Good point. Question is whether these use-cases will occur enough to make it worth it. We can either lean towards hyper-generalization or try to minimize what the importer/loaders have to do. -Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20061012/c8faa888/attachment.htm From python-checkins at python.org Thu Oct 12 19:44:05 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Oct 2006 19:44:05 +0200 (CEST) Subject: [Python-checkins] r52317 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061012174405.219A51E4007@bag.python.org> Author: brett.cannon Date: Thu Oct 12 19:44:04 2006 New Revision: 52317 Modified: sandbox/trunk/import_in_py/importer.py Log: Add comment made by Jim Jewett about drawback of having __import__ manage sys.modules. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 12 19:44:04 2006 @@ -44,6 +44,10 @@ + If __import__ handles sys.modules then the impact from having to recheck sys.path entries that lack an importer is minimized as it is only on imports that have not been handled before. + - This has the drawback of making it more difficult for + non-standard modules to be put into sys.modules. Could go other + way and hyper-generalize by having a meta_path importer that + returns entries in sys.path. PTL use-case: * Tweaked source files that need to be pre-processed before they are imported. From python-checkins at python.org Thu Oct 12 19:50:20 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Oct 2006 19:50:20 +0200 (CEST) Subject: [Python-checkins] r52318 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061012175020.428671E4017@bag.python.org> Author: brett.cannon Date: Thu Oct 12 19:50:19 2006 New Revision: 52318 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Changes 'handles' to be a sequence of file extensions (which include the '.'). Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Thu Oct 12 19:50:19 2006 @@ -198,14 +198,17 @@ registered.""" # XXX Ignores 'path' at the moment. # XXX Does not worry about case-insensitive filesystems. - for handler in self.handlers: - file_name = fullname + '.' + handler.handles - file_path = os.path.join(self.path_entry, file_name) - if os.path.isfile(file_path): - break + try: + for handler in self.handlers: + for file_ext in handler.handles: + file_name = fullname + file_ext + file_path = os.path.join(self.path_entry, file_name) + if os.path.isfile(file_path): + raise StopIteration("file found") + except StopIteration: + return FileSystemLoader(file_path, handler) else: return None - return FileSystemLoader(file_path, handler) class FileSystemLoader(object): @@ -246,7 +249,7 @@ # following the current convention and have a unified source/bytecode # handler that does it all. - handles = 'py' + handles = ('.py',) def get_code(self, file_path): """Return the code object as stored at file_path. @@ -288,7 +291,7 @@ """ self.source_provider = source_provider - self.handles = 'pyc' if __debug__ else 'pyo' + self.handles = ('.pyc',) if __debug__ else ('.pyo',) def find_source(self, bytecode_path): """Return the path to the source file for the bytecode or None if it Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Thu Oct 12 19:50:19 2006 @@ -155,7 +155,7 @@ def test_handle(self): # Should claim it handles 'py' data. - self.failUnlessEqual(self.handler.handles, 'py') + self.failUnlessEqual(self.handler.handles, ('.py',)) def test_handle_file_module(self): # Should be able to handle a module that is directly pointed at. @@ -179,10 +179,10 @@ try: importer.__debug__ = True handler = importer.PyBytecodeHandler() - self.failUnlessEqual(handler.handles, 'pyc') + self.failUnlessEqual(handler.handles, ('.pyc',)) importer.__debug__ = False handler = importer.PyBytecodeHandler() - self.failUnlessEqual(handler.handles, 'pyo') + self.failUnlessEqual(handler.handles, ('.pyo',)) finally: del importer.__debug__ From python-checkins at python.org Thu Oct 12 21:56:00 2006 From: python-checkins at python.org (thomas.heller) Date: Thu, 12 Oct 2006 21:56:00 +0200 (CEST) Subject: [Python-checkins] r52319 - python/branches/theller_modulefinder/Lib/test/test_modulefinder.py Message-ID: <20061012195600.ACC391E4007@bag.python.org> Author: thomas.heller Date: Thu Oct 12 21:56:00 2006 New Revision: 52319 Modified: python/branches/theller_modulefinder/Lib/test/test_modulefinder.py Log: Create test-packages in a tempdir. Add tests for modulefinder's any_missing_maybe() method. Modified: python/branches/theller_modulefinder/Lib/test/test_modulefinder.py ============================================================================== --- python/branches/theller_modulefinder/Lib/test/test_modulefinder.py (original) +++ python/branches/theller_modulefinder/Lib/test/test_modulefinder.py Thu Oct 12 21:56:00 2006 @@ -2,6 +2,7 @@ import sys, os import unittest import distutils.dir_util +import tempfile from test import test_support @@ -10,31 +11,61 @@ import modulefinder -# XXX To test modulefinder with Python 2.2, sets.py and +# Note: To test modulefinder with Python 2.2, sets.py and # modulefinder.py must be available - they are not in the standard # library. -# XXX FIXME: do NOT create files in the current directory -TEST_DIR = os.path.abspath("testing") +TEST_DIR = tempfile.mkdtemp() TEST_PATH = [TEST_DIR, os.path.dirname(__future__.__file__)] -# Each test description is a list of 4 items: +# Each test description is a list of 5 items: # # 1. a module name that will be imported by modulefinder # 2. a list of module names that modulefinder is required to find # 3. a list of module names that modulefinder should complain # about because they are not found -# 4. a string specifying a package to create; the format is obvious imo. +# 4. a list of module names that modulefinder should complain +# about because they MAY be not found +# 5. a string specifying packages to create; the format is obvious imo. # # Each package will be created in TEST_DIR, and TEST_DIR will be # removed after the tests again. # Modulefinder searches in a path that contains TEST_DIR, plus # the standard Lib directory. +maybe_test = [ + "a.module", + ["a", "a.module", "sys", + "b"], + ["c"], ["b.something"], + """\ +a/__init__.py +a/module.py + from b import something + from c import something +b/__init__.py + from sys import * +"""] + +maybe_test_new = [ + "a.module", + ["a", "a.module", "sys", + "b", "__future__"], + ["c"], ["b.something"], + """\ +a/__init__.py +a/module.py + from b import something + from c import something +b/__init__.py + from __future__ import absolute_import + from sys import * +"""] + package_test = [ "a.module", ["a", "a.b", "a.c", "a.module", "mymodule", "sys"], - ["blahblah"], + ["blahblah"], [], """\ mymodule.py a/__init__.py @@ -49,6 +80,7 @@ a/c.py from a.module import x import mymodule as sillyname + from sys import version_info """] absolute_import_test = [ @@ -56,7 +88,7 @@ ["a", "a.module", "b", "b.x", "b.y", "b.z", "__future__", "sys", "exceptions"], - ["blahblah"], + ["blahblah"], [], """\ mymodule.py a/__init__.py @@ -92,7 +124,7 @@ "a.b.c.d", "a.b.c.e", "a.b.x", "exceptions"], - [], + [], [], """\ mymodule.py a/__init__.py @@ -130,7 +162,7 @@ "a.b.c.f", "a.b.x", "a.another"], - [], + [], [], """\ mymodule.py a/__init__.py @@ -174,7 +206,7 @@ class ModuleFinderTest(unittest.TestCase): def _do_test(self, info, report=False): - import_this, modules, missing, source = info + import_this, modules, missing, maybe_missing, source = info create_package(source) try: mf = modulefinder.ModuleFinder(path=TEST_PATH) @@ -197,17 +229,24 @@ # check if we found what we expected, not more, not less self.failUnlessEqual((more, less), ([], [])) - # check if missing modules are reported correctly - bad = mf.badmodules.keys() + # check for missing and maybe missing modules + bad, maybe = mf.any_missing_maybe() self.failUnlessEqual(bad, missing) + self.failUnlessEqual(maybe, maybe_missing) finally: distutils.dir_util.remove_tree(TEST_DIR) def test_package(self): self._do_test(package_test) + def test_maybe(self): + self._do_test(maybe_test) + if getattr(__future__, "absolute_import", None): + def test_maybe_new(self): + self._do_test(maybe_test_new) + def test_absolute_imports(self): self._do_test(absolute_import_test) From python-checkins at python.org Thu Oct 12 21:57:33 2006 From: python-checkins at python.org (thomas.heller) Date: Thu, 12 Oct 2006 21:57:33 +0200 (CEST) Subject: [Python-checkins] r52320 - python/branches/theller_modulefinder/Lib/modulefinder.py Message-ID: <20061012195733.2E2AC1E4007@bag.python.org> Author: thomas.heller Date: Thu Oct 12 21:57:32 2006 New Revision: 52320 Modified: python/branches/theller_modulefinder/Lib/modulefinder.py Log: Handle 'import *' for absolute imports. Modified: python/branches/theller_modulefinder/Lib/modulefinder.py ============================================================================== --- python/branches/theller_modulefinder/Lib/modulefinder.py (original) +++ python/branches/theller_modulefinder/Lib/modulefinder.py Thu Oct 12 21:57:32 2006 @@ -398,14 +398,16 @@ if what == "store": name, = args m.globalnames[name] = 1 - elif what == "import": + elif what in ("import", "absolute_import"): fromlist, name = args have_star = 0 if fromlist is not None: if "*" in fromlist: have_star = 1 fromlist = [f for f in fromlist if f != "*"] - self._safe_import_hook(name, m, fromlist) + if what == "absolute_import": level = 0 + else: level = -1 + self._safe_import_hook(name, m, fromlist, level=level) if have_star: # We've encountered an "import *". If it is a Python module, # the code has already been parsed and we can suck out the @@ -425,22 +427,13 @@ m.starimports[name] = 1 else: m.starimports[name] = 1 - elif what == "absolute_import": - fromlist, name = args - # XXX - self._safe_import_hook(name, m, fromlist, level=0) - # XXX elif what == "relative_import": level, fromlist, name = args - # XXX if name: self._safe_import_hook(name, m, fromlist, level=level) - # XXX else: - # XXX parent = self.determine_parent(m, level=level) self._safe_import_hook(parent.__name__, None, fromlist, level=0) - # XXX else: # We don't expect anything else from the generator. raise RuntimeError(what) From python-checkins at python.org Thu Oct 12 22:31:30 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 12 Oct 2006 22:31:30 +0200 (CEST) Subject: [Python-checkins] r52321 - sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061012203130.3A7EC1E4008@bag.python.org> Author: brett.cannon Date: Thu Oct 12 22:31:29 2006 New Revision: 52321 Modified: sandbox/trunk/import_in_py/test_importer.py Log: Rename PyPycTests to PyPycFileHelper to be more descriptive and to not clash with the naming scheme of having classes that contain tests end in 'Tests'. Modified: sandbox/trunk/import_in_py/test_importer.py ============================================================================== --- sandbox/trunk/import_in_py/test_importer.py (original) +++ sandbox/trunk/import_in_py/test_importer.py Thu Oct 12 22:31:29 2006 @@ -110,7 +110,7 @@ sys.stdout = self._orig_stdout -class PyPycTests(unittest.TestCase): +class PyPycFileHelper(unittest.TestCase): """Base class to help in generating a fresh source and bytecode file.""" @@ -144,7 +144,7 @@ self.failUnlessEqual(getattr(module, self.attr_name), self.attr_value) -class SourceHandlerTests(PyPycTests): +class SourceHandlerTests(PyPycFileHelper): """Test the Python source code handler.""" @@ -165,7 +165,7 @@ self.verify_module(new_module, self.source_path) -class BytecodeHandlerTests(PyPycTests): +class BytecodeHandlerTests(PyPycFileHelper): """Tests for the bytecode handler.""" @@ -195,7 +195,7 @@ self.verify_module(new_module, self.bytecode_path) -class FileSystemLoaderTests(PyPycTests): +class FileSystemLoaderTests(PyPycFileHelper): """Test the filesystem loader.""" @@ -207,7 +207,7 @@ def test_load_module_fresh(self): # Test a basic module load where there is no sys.modules entry. - # PyPycTests.setUp() clears sys.modules for us. + # PyPycFileHelper.setUp() clears sys.modules for us. new_module = self.loader.load_module(self.module) self.verify_module(new_module, self.source_path) @@ -220,7 +220,7 @@ self.failUnless(loaded_module is new_module) -class FileSystemImporterTests(PyPycTests): +class FileSystemImporterTests(PyPycFileHelper): """Test the filesystem importer.""" From ncoghlan at gmail.com Fri Oct 13 10:59:41 2006 From: ncoghlan at gmail.com (Nick Coghlan) Date: Fri, 13 Oct 2006 18:59:41 +1000 Subject: [Python-checkins] r52292 - sandbox/trunk/import_in_py/importer.py In-Reply-To: References: <20061011235657.59CD61E4007@bag.python.org> Message-ID: <452F557D.6090208@gmail.com> Brett Cannon wrote: > Having __import__ always generate the module would make it harder to > use things that aren't really modules. (examples: A module with a > custom __dict__ type that gripes at external modification; the > forwarders used when a module changes its name; Lazy Importers) > > > Good point. Question is whether these use-cases will occur enough to > make it worth it. We can either lean towards hyper-generalization or > try to minimize what the importer/loaders have to do. Go with the generalization - there are existing application toolkits like PEAK that use lazy importing to avoid slowing startup to a crawl (by deferring the actual import until the first time someone attempts to access the module's namespace). The minimisation of what importers/loaders have to do can be handled the same you're handling it for your code - by providing pluggable base classes that delegate to internal methods. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From brett at python.org Sat Oct 14 01:26:00 2006 From: brett at python.org (Brett Cannon) Date: Fri, 13 Oct 2006 16:26:00 -0700 Subject: [Python-checkins] r52292 - sandbox/trunk/import_in_py/importer.py In-Reply-To: <452F557D.6090208@gmail.com> References: <20061011235657.59CD61E4007@bag.python.org> <452F557D.6090208@gmail.com> Message-ID: On 10/13/06, Nick Coghlan wrote: > > Brett Cannon wrote: > > Having __import__ always generate the module would make it harder to > > use things that aren't really modules. (examples: A module with a > > custom __dict__ type that gripes at external modification; the > > forwarders used when a module changes its name; Lazy Importers) > > > > > > Good point. Question is whether these use-cases will occur enough to > > make it worth it. We can either lean towards hyper-generalization or > > try to minimize what the importer/loaders have to do. > > Go with the generalization - there are existing application toolkits like > PEAK > that use lazy importing to avoid slowing startup to a crawl (by deferring > the > actual import until the first time someone attempts to access the module's > namespace). Fine with me. It might change semantics in some odd way, though, so it might be a Py3K change. The minimisation of what importers/loaders have to do can be handled the > same > you're handling it for your code - by providing pluggable base classes > that > delegate to internal methods. Yeah. I really want to keep the interfaces simple and minimize the amount of repeated code. But I also want to be flexible enough so that people can reuse common things (e.g., the filesystem importer/loaders) easily. -Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20061013/eefcac3b/attachment.html From ncoghlan at gmail.com Sat Oct 14 03:32:54 2006 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sat, 14 Oct 2006 11:32:54 +1000 Subject: [Python-checkins] r52292 - sandbox/trunk/import_in_py/importer.py In-Reply-To: References: <20061011235657.59CD61E4007@bag.python.org> <452F557D.6090208@gmail.com> Message-ID: <45303E46.9080901@gmail.com> Brett Cannon wrote: > On 10/13/06, *Nick Coghlan* > wrote: > Go with the generalization - there are existing application toolkits > like PEAK > that use lazy importing to avoid slowing startup to a crawl (by > deferring the > actual import until the first time someone attempts to access the > module's > namespace). > > Fine with me. It might change semantics in some odd way, though, so it > might be a Py3K change. I may have misunderstood what you meant by generalise... ah well, I'll wait and see what you come up with - I like what I've seen on this branch so far :) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From python-checkins at python.org Sat Oct 14 08:36:46 2006 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Oct 2006 08:36:46 +0200 (CEST) Subject: [Python-checkins] r52327 - python/trunk/Doc/lib/libsqlite3.tex Message-ID: <20061014063646.B5A911E4007@bag.python.org> Author: brett.cannon Date: Sat Oct 14 08:36:45 2006 New Revision: 52327 Modified: python/trunk/Doc/lib/libsqlite3.tex Log: Clean up the language of a sentence relating to the connect() function and user-defined datatypes. Modified: python/trunk/Doc/lib/libsqlite3.tex ============================================================================== --- python/trunk/Doc/lib/libsqlite3.tex (original) +++ python/trunk/Doc/lib/libsqlite3.tex Sat Oct 14 08:36:45 2006 @@ -150,7 +150,7 @@ property of \class{Connection} objects in section~\ref{sqlite3-Connection-IsolationLevel}. SQLite natively supports only the types TEXT, INTEGER, FLOAT, BLOB and NULL. If -you want to use other types, like you have to add support for them yourself. +you want to use other types you must add support for them yourself. The \var{detect_types} parameter and the using custom \strong{converters} registered with the module-level \function{register_converter} function allow you to easily do that. From python-checkins at python.org Sat Oct 14 20:46:32 2006 From: python-checkins at python.org (brett.cannon) Date: Sat, 14 Oct 2006 20:46:32 +0200 (CEST) Subject: [Python-checkins] r52331 - python/branches/bcannon-objcap/securing_python.txt Message-ID: <20061014184632.F153D1E4008@bag.python.org> Author: brett.cannon Date: Sat Oct 14 20:46:32 2006 New Revision: 52331 Modified: python/branches/bcannon-objcap/securing_python.txt Log: Add comment about something to watch out for when new import lands and inheriting abilities for the sys data dict is dealt with. Modified: python/branches/bcannon-objcap/securing_python.txt ============================================================================== --- python/branches/bcannon-objcap/securing_python.txt (original) +++ python/branches/bcannon-objcap/securing_python.txt Sat Oct 14 20:46:32 2006 @@ -27,6 +27,12 @@ - open() - __import__() / PEP 302 importer (`Imports`_) * Make sure importing built-in modules can be blocked. + * Make sure that no abilities are exposed by importers since + they will be accessible from inheritance through sys data + dict for any created interpreters. + + Do not inject full sys module. + + Most likely will need to wrap built-in importer so as to + be able to effectively block access to sys. - execfile() * Force to go through open() + Prevents opening unauthorized files. From python-checkins at python.org Sat Oct 14 23:33:40 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 14 Oct 2006 23:33:40 +0200 (CEST) Subject: [Python-checkins] r52332 - in python/trunk: Lib/test/test_peepholer.py Misc/NEWS Python/import.c Python/peephole.c Message-ID: <20061014213340.2E7271E4008@bag.python.org> Author: neal.norwitz Date: Sat Oct 14 23:33:38 2006 New Revision: 52332 Modified: python/trunk/Lib/test/test_peepholer.py python/trunk/Misc/NEWS python/trunk/Python/import.c python/trunk/Python/peephole.c Log: Update the peephole optimizer to remove more dead code (jumps after returns) and inline jumps to returns. Modified: python/trunk/Lib/test/test_peepholer.py ============================================================================== --- python/trunk/Lib/test/test_peepholer.py (original) +++ python/trunk/Lib/test/test_peepholer.py Sat Oct 14 23:33:38 2006 @@ -161,6 +161,41 @@ self.assert_('(None)' not in asm) self.assertEqual(asm.split().count('RETURN_VALUE'), 1) + def test_elim_jump_to_return(self): + # JUMP_FORWARD to RETURN --> RETURN + def f(cond, true_value, false_value): + return true_value if cond else false_value + asm = disassemble(f) + self.assert_('JUMP_FORWARD' not in asm) + self.assert_('JUMP_ABSOLUTE' not in asm) + self.assertEqual(asm.split().count('RETURN_VALUE'), 2) + + def test_elim_jump_after_return1(self): + # Eliminate dead code: jumps immediately after returns can't be reached + def f(cond1, cond2): + if cond1: return 1 + if cond2: return 2 + while 1: + return 3 + while 1: + if cond1: return 4 + return 5 + return 6 + asm = disassemble(f) + self.assert_('JUMP_FORWARD' not in asm) + self.assert_('JUMP_ABSOLUTE' not in asm) + self.assertEqual(asm.split().count('RETURN_VALUE'), 6) + + def test_elim_jump_after_return2(self): + # Eliminate dead code: jumps immediately after returns can't be reached + def f(cond1, cond2): + while 1: + if cond1: return 4 + asm = disassemble(f) + self.assert_('JUMP_FORWARD' not in asm) + # There should be one jump for the while loop. + self.assertEqual(asm.split().count('JUMP_ABSOLUTE'), 1) + self.assertEqual(asm.split().count('RETURN_VALUE'), 2) def test_main(verbose=None): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Oct 14 23:33:38 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Update the peephole optimizer to remove more dead code (jumps after returns) + and inline unconditional jumps to returns. + - Bug #1545497: when given an explicit base, int() did ignore NULs embedded in the string to convert. Modified: python/trunk/Python/import.c ============================================================================== --- python/trunk/Python/import.c (original) +++ python/trunk/Python/import.c Sat Oct 14 23:33:38 2006 @@ -65,9 +65,10 @@ Python 2.5c1: 62121 (fix wrong lnotab with for loops and storing constants that should have been removed) Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp) + Python 2.6a0: 62141 (peephole optimizations) . */ -#define MAGIC (62131 | ((long)'\r'<<16) | ((long)'\n'<<24)) +#define MAGIC (62141 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the value of this global to accommodate for alterations of how the Modified: python/trunk/Python/peephole.c ============================================================================== --- python/trunk/Python/peephole.c (original) +++ python/trunk/Python/peephole.c Sat Oct 14 23:33:38 2006 @@ -523,6 +523,13 @@ case SETUP_EXCEPT: case SETUP_FINALLY: tgt = GETJUMPTGT(codestr, i); + /* Replace JUMP_* to a RETURN into just a RETURN */ + if (UNCONDITIONAL_JUMP(opcode) && + codestr[tgt] == RETURN_VALUE) { + codestr[i] = RETURN_VALUE; + memset(codestr+i+1, NOP, 2); + continue; + } if (!UNCONDITIONAL_JUMP(codestr[tgt])) continue; tgttgt = GETJUMPTGT(codestr, tgt); @@ -540,12 +547,16 @@ goto exitUnchanged; /* Replace RETURN LOAD_CONST None RETURN with just RETURN */ + /* Remove unreachable JUMPs after RETURN */ case RETURN_VALUE: - if (i+4 >= codelen || - codestr[i+4] != RETURN_VALUE || - !ISBASICBLOCK(blocks,i,5)) + if (i+4 >= codelen) continue; - memset(codestr+i+1, NOP, 4); + if (codestr[i+4] == RETURN_VALUE && + ISBASICBLOCK(blocks,i,5)) + memset(codestr+i+1, NOP, 4); + else if (UNCONDITIONAL_JUMP(codestr[i+1]) && + ISBASICBLOCK(blocks,i,4)) + memset(codestr+i+1, NOP, 3); break; } } From python-checkins at python.org Sun Oct 15 09:54:40 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 09:54:40 +0200 (CEST) Subject: [Python-checkins] r52333 - in python/trunk: Misc/NEWS PC/VC6/pythoncore.dsp PCbuild/pythoncore.vcproj Message-ID: <20061015075440.C9CD71E4009@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 09:54:40 2006 New Revision: 52333 Modified: python/trunk/Misc/NEWS python/trunk/PC/VC6/pythoncore.dsp python/trunk/PCbuild/pythoncore.vcproj Log: Patch #1576954: Update VC6 build directory; remove redundant files in VC7. Will backport to 2.5. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 15 09:54:40 2006 @@ -211,6 +211,9 @@ Build ----- +- Patch #1576954: Update VC6 build directory; remove redundant + files in VC7. + - Bug #1568842: Fix test for uintptr_t. - Patch #1540470, for OpenBSD 4.0. Modified: python/trunk/PC/VC6/pythoncore.dsp ============================================================================== Binary files. No diff available. Modified: python/trunk/PCbuild/pythoncore.vcproj ============================================================================== --- python/trunk/PCbuild/pythoncore.vcproj (original) +++ python/trunk/PCbuild/pythoncore.vcproj Sun Oct 15 09:54:40 2006 @@ -464,9 +464,6 @@ RelativePath="..\Python\compile.c"> - - + + - - - - Author: martin.v.loewis Date: Sun Oct 15 09:55:42 2006 New Revision: 52334 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/PC/VC6/pythoncore.dsp python/branches/release25-maint/PCbuild/pythoncore.vcproj Log: Patch #1576954: Update VC6 build directory; remove redundant files in VC7.1 pythoncore.vcproj. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 15 09:55:42 2006 @@ -99,6 +99,12 @@ the close_fds arg to subprocess.Popen is not supported). +Build +----- + +- Patch #1576954: Update VC6 build directory; remove redundant + files in VC7. + What's New in Python 2.5 (final) ================================ Modified: python/branches/release25-maint/PC/VC6/pythoncore.dsp ============================================================================== Binary files. No diff available. Modified: python/branches/release25-maint/PCbuild/pythoncore.vcproj ============================================================================== --- python/branches/release25-maint/PCbuild/pythoncore.vcproj (original) +++ python/branches/release25-maint/PCbuild/pythoncore.vcproj Sun Oct 15 09:55:42 2006 @@ -725,18 +725,12 @@ RelativePath="..\Modules\sha512module.c"> - - - - Author: martin.v.loewis Date: Sun Oct 15 10:43:33 2006 New Revision: 52335 Modified: python/trunk/Lib/test/test_os.py python/trunk/Misc/NEWS python/trunk/Modules/posixmodule.c Log: Patch #1576166: Support os.utime for directories on Windows NT+. Modified: python/trunk/Lib/test/test_os.py ============================================================================== --- python/trunk/Lib/test/test_os.py (original) +++ python/trunk/Lib/test/test_os.py Sun Oct 15 10:43:33 2006 @@ -223,6 +223,13 @@ except TypeError: pass + def test_utime_dir(self): + delta = 1000000 + st = os.stat(test_support.TESTFN) + os.utime(test_support.TESTFN, (st.st_atime, st.st_mtime-delta)) + st2 = os.stat(test_support.TESTFN) + self.assertEquals(st2.st_mtime, st.st_mtime-delta) + # Restrict test to Win32, since there is no guarantee other # systems support centiseconds if sys.platform == 'win32': Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 15 10:43:33 2006 @@ -137,6 +137,8 @@ Extension Modules ----------------- +- Patch #1576166: Support os.utime for directories on Windows NT+. + - Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode arguments with the system default encoding just like the write() method does, instead of converting it to a raw buffer. Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Sun Oct 15 10:43:33 2006 @@ -2458,7 +2458,8 @@ wpath = PyUnicode_AS_UNICODE(obwpath); Py_BEGIN_ALLOW_THREADS hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0, - NULL, OPEN_EXISTING, 0, NULL); + NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); Py_END_ALLOW_THREADS if (hFile == INVALID_HANDLE_VALUE) return win32_error_unicode("utime", wpath); @@ -2473,7 +2474,8 @@ return NULL; Py_BEGIN_ALLOW_THREADS hFile = CreateFileA(apath, FILE_WRITE_ATTRIBUTES, 0, - NULL, OPEN_EXISTING, 0, NULL); + NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); Py_END_ALLOW_THREADS if (hFile == INVALID_HANDLE_VALUE) { win32_error("utime", apath); @@ -8617,3 +8619,4 @@ } #endif + From python-checkins at python.org Sun Oct 15 10:51:23 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 10:51:23 +0200 (CEST) Subject: [Python-checkins] r52336 - python/trunk/PC/VC6/_ctypes.dsp python/trunk/PC/VC6/_ctypes_test.dsp python/trunk/PC/VC6/_elementtree.dsp python/trunk/PC/VC6/pcbuild.dsw Message-ID: <20061015085123.5F7091E4009@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 10:51:22 2006 New Revision: 52336 Added: python/trunk/PC/VC6/_ctypes.dsp (contents, props changed) python/trunk/PC/VC6/_ctypes_test.dsp (contents, props changed) python/trunk/PC/VC6/_elementtree.dsp (contents, props changed) Modified: python/trunk/PC/VC6/pcbuild.dsw Log: Patch #1577551: Add ctypes and ET build support for VC6. Will backport to 2.5. Added: python/trunk/PC/VC6/_ctypes.dsp ============================================================================== --- (empty file) +++ python/trunk/PC/VC6/_ctypes.dsp Sun Oct 15 10:51:22 2006 @@ -0,0 +1,182 @@ +# Microsoft Developer Studio Project File - Name="_ctypes" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=_ctypes - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "_ctypes.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by