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 defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_ctypes.mak" CFG="_ctypes - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_ctypes - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_ctypes - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_ctypes - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_ctypes" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes.pyd" + +!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_ctypes" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /incremental:no + +!ENDIF + +# Begin Target + +# Name "_ctypes - Win32 Release" +# Name "_ctypes - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\callbacks.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\callproc.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\cfield.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\malloc_closure.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\prep_cif.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\stgdict.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\win32.c + +!IF "$(CFG)" == "_ctypes - Win32 Release" + +# SUBTRACT CPP /I "..\..\Include" + +!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" + +# ADD CPP /I "..\Include" /I "..\PC" /I "..\Modules\_ctypes\libffi_msvc" +# SUBTRACT CPP /I "..\..\Include" + +!ENDIF + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\ctypes.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\ctypes_dlfcn.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi_common.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\fficonfig.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffitarget.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Added: python/trunk/PC/VC6/_ctypes_test.dsp ============================================================================== --- (empty file) +++ python/trunk/PC/VC6/_ctypes_test.dsp Sun Oct 15 10:51:22 2006 @@ -0,0 +1,113 @@ +# Microsoft Developer Studio Project File - Name="_ctypes_test" - 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_test - 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_test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_ctypes_test.mak" CFG="_ctypes_test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_ctypes_test - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_ctypes_test - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_ctypes_test - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_ctypes_test" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" + +!ELSEIF "$(CFG)" == "_ctypes_test - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Intermediate_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_ctypes_test" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\Include" /I "..\..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "_ctypes_test - Win32 Release" +# Name "_ctypes_test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Added: python/trunk/PC/VC6/_elementtree.dsp ============================================================================== --- (empty file) +++ python/trunk/PC/VC6/_elementtree.dsp Sun Oct 15 10:51:22 2006 @@ -0,0 +1,129 @@ +# Microsoft Developer Studio Project File - Name="_elementtree" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=_elementtree - 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 "_elementtree.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_elementtree.mak" CFG="_elementtree - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_elementtree - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_elementtree - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_elementtree - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_elementtree" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree.pyd" + +!ELSEIF "$(CFG)" == "_elementtree - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "_elementtree___Win32_Debug" +# PROP BASE Intermediate_Dir "_elementtree___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_elementtree" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "_DEBUG" /D "HAVE_EXPAT_H" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "_elementtree - Win32 Release" +# Name "_elementtree - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_elementtree.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlparse.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlrole.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmltok.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlrole.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmltok.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Modified: python/trunk/PC/VC6/pcbuild.dsw ============================================================================== Binary files. No diff available. From python-checkins at python.org Sun Oct 15 10:51:48 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 10:51:48 +0200 (CEST) Subject: [Python-checkins] r52337 - python/branches/release25-maint/PC/VC6/_ctypes.dsp python/branches/release25-maint/PC/VC6/_ctypes_test.dsp python/branches/release25-maint/PC/VC6/_elementtree.dsp python/branches/release25-maint/PC/VC6/pcbuild.dsw Message-ID: <20061015085148.1CC3E1E4009@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 10:51:47 2006 New Revision: 52337 Added: python/branches/release25-maint/PC/VC6/_ctypes.dsp (contents, props changed) python/branches/release25-maint/PC/VC6/_ctypes_test.dsp (contents, props changed) python/branches/release25-maint/PC/VC6/_elementtree.dsp (contents, props changed) Modified: python/branches/release25-maint/PC/VC6/pcbuild.dsw Log: Patch #1577551: Add ctypes and ET build support for VC6. Added: python/branches/release25-maint/PC/VC6/_ctypes.dsp ============================================================================== --- (empty file) +++ python/branches/release25-maint/PC/VC6/_ctypes.dsp Sun Oct 15 10:51:47 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 defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_ctypes.mak" CFG="_ctypes - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_ctypes - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_ctypes - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_ctypes - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_ctypes" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes.pyd" + +!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_ctypes" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /incremental:no + +!ENDIF + +# Begin Target + +# Name "_ctypes - Win32 Release" +# Name "_ctypes - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\callbacks.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\callproc.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\cfield.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\malloc_closure.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\prep_cif.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\stgdict.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\win32.c + +!IF "$(CFG)" == "_ctypes - Win32 Release" + +# SUBTRACT CPP /I "..\..\Include" + +!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" + +# ADD CPP /I "..\Include" /I "..\PC" /I "..\Modules\_ctypes\libffi_msvc" +# SUBTRACT CPP /I "..\..\Include" + +!ENDIF + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\ctypes.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\ctypes_dlfcn.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi_common.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\fficonfig.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffitarget.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Added: python/branches/release25-maint/PC/VC6/_ctypes_test.dsp ============================================================================== --- (empty file) +++ python/branches/release25-maint/PC/VC6/_ctypes_test.dsp Sun Oct 15 10:51:47 2006 @@ -0,0 +1,113 @@ +# Microsoft Developer Studio Project File - Name="_ctypes_test" - 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_test - 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_test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_ctypes_test.mak" CFG="_ctypes_test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_ctypes_test - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_ctypes_test - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_ctypes_test - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_ctypes_test" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" + +!ELSEIF "$(CFG)" == "_ctypes_test - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Intermediate_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_ctypes_test" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\Include" /I "..\..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "_ctypes_test - Win32 Release" +# Name "_ctypes_test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Added: python/branches/release25-maint/PC/VC6/_elementtree.dsp ============================================================================== --- (empty file) +++ python/branches/release25-maint/PC/VC6/_elementtree.dsp Sun Oct 15 10:51:47 2006 @@ -0,0 +1,129 @@ +# Microsoft Developer Studio Project File - Name="_elementtree" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=_elementtree - 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 "_elementtree.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_elementtree.mak" CFG="_elementtree - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_elementtree - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_elementtree - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_elementtree - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_elementtree" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree.pyd" + +!ELSEIF "$(CFG)" == "_elementtree - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "_elementtree___Win32_Debug" +# PROP BASE Intermediate_Dir "_elementtree___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_elementtree" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "_DEBUG" /D "HAVE_EXPAT_H" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "_elementtree - Win32 Release" +# Name "_elementtree - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_elementtree.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlparse.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlrole.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmltok.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlrole.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmltok.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Modified: python/branches/release25-maint/PC/VC6/pcbuild.dsw ============================================================================== Binary files. No diff available. From buildbot at python.org Sun Oct 15 11:07:07 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Oct 2006 09:07:07 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20061015090707.612811E4009@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/1580 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 buildbot at python.org Sun Oct 15 11:09:10 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Oct 2006 09:09:10 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20061015090910.3749D1E4009@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/1570 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 buildbot at python.org Sun Oct 15 11:17:26 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Oct 2006 09:17:26 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20061015091726.E7BA21E400B@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/1666 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 Sun Oct 15 11:35:51 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 11:35:51 +0200 (CEST) Subject: [Python-checkins] r52338 - python/trunk/Lib/test/test_os.py Message-ID: <20061015093551.445971E4009@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 11:35:51 2006 New Revision: 52338 Modified: python/trunk/Lib/test/test_os.py Log: Loosen the test for equal time stamps. 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 11:35:51 2006 @@ -228,7 +228,7 @@ 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) + self.assertAlmostEquals(st2.st_mtime, st.st_mtime-delta, 2) # Restrict test to Win32, since there is no guarantee other # systems support centiseconds From python-checkins at python.org Sun Oct 15 11:43:40 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 11:43:40 +0200 (CEST) Subject: [Python-checkins] r52339 - in python/trunk: Misc/NEWS Modules/posixmodule.c Message-ID: <20061015094340.58E181E4009@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 11:43:39 2006 New Revision: 52339 Modified: python/trunk/Misc/NEWS python/trunk/Modules/posixmodule.c Log: Bug #1567666: Emulate GetFileAttributesExA for Win95. Will backport to 2.5. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 15 11:43:39 2006 @@ -137,6 +137,8 @@ Extension Modules ----------------- +- Bug #1567666: Emulate GetFileAttributesExA for Win95. + - Patch #1576166: Support os.utime for directories on Windows NT+. - Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Sun Oct 15 11:43:39 2006 @@ -828,6 +828,106 @@ return 0; } +/* Emulate GetFileAttributesEx[AW] on Windows 95 */ +static int checked = 0; +static BOOL (CALLBACK *gfaxa)(LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID); +static BOOL (CALLBACK *gfaxw)(LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID); +static void +check_gfax() +{ + HINSTANCE hKernel32; + if (checked) + return; + checked = 1; + hKernel32 = GetModuleHandle("KERNEL32"); + *(FARPROC*)&gfaxa = GetProcAddress(hKernel32, "GetFileAttributesExA"); + *(FARPROC*)&gfaxw = GetProcAddress(hKernel32, "GetFileAttributesExW"); +} + +static BOOL WINAPI +Py_GetFileAttributesExA(LPCSTR pszFile, + GET_FILEEX_INFO_LEVELS level, + LPVOID pv) +{ + BOOL result; + HANDLE hFindFile; + WIN32_FIND_DATAA FileData; + LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; + /* First try to use the system's implementation, if that is + available and either succeeds to gives an error other than + that it isn't implemented. */ + check_gfax(); + if (gfaxa) { + result = gfaxa(pszFile, level, pv); + if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) + return result; + } + /* It's either not present, or not implemented. + Emulate using FindFirstFile. */ + if (level != GetFileExInfoStandard) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + /* Use GetFileAttributes to validate that the file name + does not contain wildcards (which FindFirstFile would + accept). */ + if (GetFileAttributesA(pszFile) == 0xFFFFFFFF) + return FALSE; + hFindFile = FindFirstFileA(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + +static BOOL WINAPI +Py_GetFileAttributesExW(LPCWSTR pszFile, + GET_FILEEX_INFO_LEVELS level, + LPVOID pv) +{ + BOOL result; + HANDLE hFindFile; + WIN32_FIND_DATAW FileData; + LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; + /* First try to use the system's implementation, if that is + available and either succeeds to gives an error other than + that it isn't implemented. */ + check_gfax(); + if (gfaxa) { + result = gfaxw(pszFile, level, pv); + if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) + return result; + } + /* It's either not present, or not implemented. + Emulate using FindFirstFile. */ + if (level != GetFileExInfoStandard) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + /* Use GetFileAttributes to validate that the file name + does not contain wildcards (which FindFirstFile would + accept). */ + if (GetFileAttributesW(pszFile) == 0xFFFFFFFF) + return FALSE; + hFindFile = FindFirstFileW(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + static int win32_stat(const char* path, struct win32_stat *result) { @@ -835,7 +935,7 @@ int code; char *dot; /* XXX not supported on Win95 and NT 3.x */ - if (!GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { + if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ errno = 0; @@ -863,7 +963,7 @@ const wchar_t *dot; WIN32_FILE_ATTRIBUTE_DATA info; /* XXX not supported on Win95 and NT 3.x */ - if (!GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { + if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ errno = 0; From python-checkins at python.org Sun Oct 15 11:44:04 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 11:44:04 +0200 (CEST) Subject: [Python-checkins] r52340 - in python/branches/release25-maint: Misc/NEWS Modules/posixmodule.c Message-ID: <20061015094404.2333B1E4009@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 11:44:02 2006 New Revision: 52340 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/posixmodule.c Log: Bug #1567666: Emulate GetFileAttributesExA for Win95. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 15 11:44:02 2006 @@ -52,6 +52,8 @@ Extension Modules ----------------- +- Bug #1567666: Emulate GetFileAttributesExA for Win95. + - 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/branches/release25-maint/Modules/posixmodule.c ============================================================================== --- python/branches/release25-maint/Modules/posixmodule.c (original) +++ python/branches/release25-maint/Modules/posixmodule.c Sun Oct 15 11:44:02 2006 @@ -828,6 +828,106 @@ return 0; } +/* Emulate GetFileAttributesEx[AW] on Windows 95 */ +static int checked = 0; +static BOOL (CALLBACK *gfaxa)(LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID); +static BOOL (CALLBACK *gfaxw)(LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID); +static void +check_gfax() +{ + HINSTANCE hKernel32; + if (checked) + return; + checked = 1; + hKernel32 = GetModuleHandle("KERNEL32"); + *(FARPROC*)&gfaxa = GetProcAddress(hKernel32, "GetFileAttributesExA"); + *(FARPROC*)&gfaxw = GetProcAddress(hKernel32, "GetFileAttributesExW"); +} + +static BOOL WINAPI +Py_GetFileAttributesExA(LPCSTR pszFile, + GET_FILEEX_INFO_LEVELS level, + LPVOID pv) +{ + BOOL result; + HANDLE hFindFile; + WIN32_FIND_DATAA FileData; + LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; + /* First try to use the system's implementation, if that is + available and either succeeds to gives an error other than + that it isn't implemented. */ + check_gfax(); + if (gfaxa) { + result = gfaxa(pszFile, level, pv); + if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) + return result; + } + /* It's either not present, or not implemented. + Emulate using FindFirstFile. */ + if (level != GetFileExInfoStandard) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + /* Use GetFileAttributes to validate that the file name + does not contain wildcards (which FindFirstFile would + accept). */ + if (GetFileAttributesA(pszFile) == 0xFFFFFFFF) + return FALSE; + hFindFile = FindFirstFileA(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + +static BOOL WINAPI +Py_GetFileAttributesExW(LPCWSTR pszFile, + GET_FILEEX_INFO_LEVELS level, + LPVOID pv) +{ + BOOL result; + HANDLE hFindFile; + WIN32_FIND_DATAW FileData; + LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; + /* First try to use the system's implementation, if that is + available and either succeeds to gives an error other than + that it isn't implemented. */ + check_gfax(); + if (gfaxa) { + result = gfaxw(pszFile, level, pv); + if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) + return result; + } + /* It's either not present, or not implemented. + Emulate using FindFirstFile. */ + if (level != GetFileExInfoStandard) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + /* Use GetFileAttributes to validate that the file name + does not contain wildcards (which FindFirstFile would + accept). */ + if (GetFileAttributesW(pszFile) == 0xFFFFFFFF) + return FALSE; + hFindFile = FindFirstFileW(pszFile, &FileData); + if (hFindFile == INVALID_HANDLE_VALUE) + return FALSE; + FindClose(hFindFile); + pfad->dwFileAttributes = FileData.dwFileAttributes; + pfad->ftCreationTime = FileData.ftCreationTime; + pfad->ftLastAccessTime = FileData.ftLastAccessTime; + pfad->ftLastWriteTime = FileData.ftLastWriteTime; + pfad->nFileSizeHigh = FileData.nFileSizeHigh; + pfad->nFileSizeLow = FileData.nFileSizeLow; + return TRUE; +} + static int win32_stat(const char* path, struct win32_stat *result) { @@ -835,7 +935,7 @@ int code; char *dot; /* XXX not supported on Win95 and NT 3.x */ - if (!GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { + if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ errno = 0; @@ -863,7 +963,7 @@ const wchar_t *dot; WIN32_FILE_ATTRIBUTE_DATA info; /* XXX not supported on Win95 and NT 3.x */ - if (!GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { + if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ errno = 0; @@ -8617,3 +8717,4 @@ } #endif + From buildbot at python.org Sun Oct 15 11:54:34 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Oct 2006 09:54:34 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20061015095434.9573B1E4009@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/1514 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 Sun Oct 15 13:02:08 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 13:02:08 +0200 (CEST) Subject: [Python-checkins] r52341 - python/trunk/Lib/test/test_os.py Message-ID: <20061015110208.06C1C1E4009@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 13:02:07 2006 New Revision: 52341 Modified: python/trunk/Lib/test/test_os.py Log: Round to int, because some systems support sub-second time stamps in stat, but not in utime. Also be consistent with modifying only mtime, not atime. 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 13:02:07 2006 @@ -226,9 +226,11 @@ 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)) + # round to int, because some systems may support sub-second + # time stamps in stat, but not in utime. + os.utime(test_support.TESTFN, (st.st_atime, int(st.st_mtime-delta))) st2 = os.stat(test_support.TESTFN) - self.assertAlmostEquals(st2.st_mtime, st.st_mtime-delta, 2) + self.assertEquals(st2.st_mtime, int(st.st_mtime-delta)) # Restrict test to Win32, since there is no guarantee other # systems support centiseconds From buildbot at python.org Sun Oct 15 13:04:14 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Oct 2006 11:04:14 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061015110414.80AC91E4009@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/149 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 Sun Oct 15 13:57:40 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 13:57:40 +0200 (CEST) Subject: [Python-checkins] r52342 - python/trunk/PC/VC6/_ctypes.dsp python/trunk/PC/VC6/_ctypes_test.dsp python/trunk/PC/VC6/_elementtree.dsp Message-ID: <20061015115740.DF0601E4005@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 13:57:40 2006 New Revision: 52342 Modified: 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) Log: Set the eol-style for project files to "CRLF". Modified: python/trunk/PC/VC6/_ctypes.dsp ============================================================================== --- python/trunk/PC/VC6/_ctypes.dsp (original) +++ python/trunk/PC/VC6/_ctypes.dsp Sun Oct 15 13:57:40 2006 @@ -1,182 +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 defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "_ctypes.mak" CFG="_ctypes - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "_ctypes - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "_ctypes - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "_ctypes - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-release\_ctypes" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes.pyd" - -!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-debug\_ctypes" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept -# SUBTRACT LINK32 /incremental:no - -!ENDIF - -# Begin Target - -# Name "_ctypes - Win32 Release" -# Name "_ctypes - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\callbacks.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\callproc.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\cfield.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\malloc_closure.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\prep_cif.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\stgdict.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\win32.c - -!IF "$(CFG)" == "_ctypes - Win32 Release" - -# SUBTRACT CPP /I "..\..\Include" - -!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" - -# ADD CPP /I "..\Include" /I "..\PC" /I "..\Modules\_ctypes\libffi_msvc" -# SUBTRACT CPP /I "..\..\Include" - -!ENDIF - -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\ctypes.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\ctypes_dlfcn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi_common.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\fficonfig.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffitarget.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project +# 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 defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_ctypes.mak" CFG="_ctypes - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_ctypes - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_ctypes - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_ctypes - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_ctypes" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes.pyd" + +!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_ctypes" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /incremental:no + +!ENDIF + +# Begin Target + +# Name "_ctypes - Win32 Release" +# Name "_ctypes - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\callbacks.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\callproc.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\cfield.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\malloc_closure.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\prep_cif.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\stgdict.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\win32.c + +!IF "$(CFG)" == "_ctypes - Win32 Release" + +# SUBTRACT CPP /I "..\..\Include" + +!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" + +# ADD CPP /I "..\Include" /I "..\PC" /I "..\Modules\_ctypes\libffi_msvc" +# SUBTRACT CPP /I "..\..\Include" + +!ENDIF + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\ctypes.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\ctypes_dlfcn.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi_common.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\fficonfig.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffitarget.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Modified: python/trunk/PC/VC6/_ctypes_test.dsp ============================================================================== --- python/trunk/PC/VC6/_ctypes_test.dsp (original) +++ python/trunk/PC/VC6/_ctypes_test.dsp Sun Oct 15 13:57:40 2006 @@ -1,113 +1,113 @@ -# Microsoft Developer Studio Project File - Name="_ctypes_test" - 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_test - 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_test.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "_ctypes_test.mak" CFG="_ctypes_test - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "_ctypes_test - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "_ctypes_test - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "_ctypes_test - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-release\_ctypes_test" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" - -!ELSEIF "$(CFG)" == "_ctypes_test - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "_ctypes_test___Win32_Debug" -# PROP BASE Intermediate_Dir "_ctypes_test___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-debug\_ctypes_test" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\Include" /I "..\..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "_ctypes_test - Win32 Release" -# Name "_ctypes_test - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="_ctypes_test" - 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_test - 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_test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_ctypes_test.mak" CFG="_ctypes_test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_ctypes_test - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_ctypes_test - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_ctypes_test - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_ctypes_test" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" + +!ELSEIF "$(CFG)" == "_ctypes_test - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Intermediate_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_ctypes_test" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\Include" /I "..\..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "_ctypes_test - Win32 Release" +# Name "_ctypes_test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Modified: python/trunk/PC/VC6/_elementtree.dsp ============================================================================== --- python/trunk/PC/VC6/_elementtree.dsp (original) +++ python/trunk/PC/VC6/_elementtree.dsp Sun Oct 15 13:57:40 2006 @@ -1,129 +1,129 @@ -# Microsoft Developer Studio Project File - Name="_elementtree" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=_elementtree - 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 "_elementtree.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "_elementtree.mak" CFG="_elementtree - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "_elementtree - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "_elementtree - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "_elementtree - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-release\_elementtree" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree.pyd" - -!ELSEIF "$(CFG)" == "_elementtree - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "_elementtree___Win32_Debug" -# PROP BASE Intermediate_Dir "_elementtree___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-debug\_elementtree" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "_DEBUG" /D "HAVE_EXPAT_H" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "_elementtree - Win32 Release" -# Name "_elementtree - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\Modules\_elementtree.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmlparse.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmltok.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\expat\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmltok.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="_elementtree" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=_elementtree - 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 "_elementtree.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_elementtree.mak" CFG="_elementtree - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_elementtree - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_elementtree - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_elementtree - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_elementtree" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree.pyd" + +!ELSEIF "$(CFG)" == "_elementtree - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "_elementtree___Win32_Debug" +# PROP BASE Intermediate_Dir "_elementtree___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_elementtree" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "_DEBUG" /D "HAVE_EXPAT_H" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "_elementtree - Win32 Release" +# Name "_elementtree - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_elementtree.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlparse.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlrole.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmltok.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlrole.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmltok.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project From python-checkins at python.org Sun Oct 15 13:59:56 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 13:59:56 +0200 (CEST) Subject: [Python-checkins] r52343 - python/trunk/PC/VC6/_bsddb.dsp python/trunk/PC/VC6/_socket.dsp python/trunk/PC/VC6/_ssl.dsp python/trunk/PC/VC6/_testcapi.dsp python/trunk/PC/VC6/_tkinter.dsp python/trunk/PC/VC6/bz2.dsp python/trunk/PC/VC6/make_versioninfo.dsp python/trunk/PC/VC6/pyexpat.dsp python/trunk/PC/VC6/python.dsp python/trunk/PC/VC6/pythoncore.dsp python/trunk/PC/VC6/pythonw.dsp python/trunk/PC/VC6/select.dsp python/trunk/PC/VC6/unicodedata.dsp python/trunk/PC/VC6/w9xpopen.dsp python/trunk/PC/VC6/winsound.dsp python/trunk/PC/VC6/zlib.dsp Message-ID: <20061015115956.E56401E4005@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 13:59:56 2006 New Revision: 52343 Modified: python/trunk/PC/VC6/_bsddb.dsp (props changed) python/trunk/PC/VC6/_socket.dsp (props changed) python/trunk/PC/VC6/_ssl.dsp (props changed) python/trunk/PC/VC6/_testcapi.dsp (props changed) python/trunk/PC/VC6/_tkinter.dsp (props changed) python/trunk/PC/VC6/bz2.dsp (props changed) python/trunk/PC/VC6/make_versioninfo.dsp (props changed) python/trunk/PC/VC6/pyexpat.dsp (props changed) python/trunk/PC/VC6/python.dsp (props changed) python/trunk/PC/VC6/pythoncore.dsp (props changed) python/trunk/PC/VC6/pythonw.dsp (props changed) python/trunk/PC/VC6/select.dsp (props changed) python/trunk/PC/VC6/unicodedata.dsp (props changed) python/trunk/PC/VC6/w9xpopen.dsp (props changed) python/trunk/PC/VC6/winsound.dsp (props changed) python/trunk/PC/VC6/zlib.dsp (props changed) Log: Drop binary property on dsp files, set eol-style to CRLF instead. From python-checkins at python.org Sun Oct 15 14:01:43 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 14:01:43 +0200 (CEST) Subject: [Python-checkins] r52344 - python/trunk/PC/VC6/pcbuild.dsw Message-ID: <20061015120143.C47BB1E4009@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 14:01:43 2006 New Revision: 52344 Modified: python/trunk/PC/VC6/pcbuild.dsw (props changed) Log: Remove binary property, set eol-style to CRLF instead. From python-checkins at python.org Sun Oct 15 14:04:07 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 14:04:07 +0200 (CEST) Subject: [Python-checkins] r52345 - python/branches/release25-maint/PC/VC6/_bsddb.dsp python/branches/release25-maint/PC/VC6/_ctypes.dsp python/branches/release25-maint/PC/VC6/_ctypes_test.dsp python/branches/release25-maint/PC/VC6/_elementtree.dsp python/branches/release25-maint/PC/VC6/_socket.dsp python/branches/release25-maint/PC/VC6/_ssl.dsp python/branches/release25-maint/PC/VC6/_testcapi.dsp python/branches/release25-maint/PC/VC6/_tkinter.dsp python/branches/release25-maint/PC/VC6/bz2.dsp python/branches/release25-maint/PC/VC6/make_versioninfo.dsp python/branches/release25-maint/PC/VC6/pcbuild.dsw python/branches/release25-maint/PC/VC6/pyexpat.dsp python/branches/release25-maint/PC/VC6/python.dsp python/branches/release25-maint/PC/VC6/pythoncore.dsp python/branches/release25-maint/PC/VC6/pythonw.dsp python/branches/release25-maint/PC/VC6/select.dsp python/branches/release25-maint/PC/VC6/unicodedata.dsp python/branches/release25-maint/PC/VC6/w9xpopen.dsp python/branches/release25-maint/PC/VC6/winsound.dsp python/branches/release25-maint/PC/VC6/zlib.dsp Message-ID: <20061015120407.E69361E4005@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 14:04:07 2006 New Revision: 52345 Modified: python/branches/release25-maint/PC/VC6/_bsddb.dsp (props changed) python/branches/release25-maint/PC/VC6/_ctypes.dsp (contents, props changed) python/branches/release25-maint/PC/VC6/_ctypes_test.dsp (contents, props changed) python/branches/release25-maint/PC/VC6/_elementtree.dsp (contents, props changed) python/branches/release25-maint/PC/VC6/_socket.dsp (props changed) python/branches/release25-maint/PC/VC6/_ssl.dsp (props changed) python/branches/release25-maint/PC/VC6/_testcapi.dsp (props changed) python/branches/release25-maint/PC/VC6/_tkinter.dsp (props changed) python/branches/release25-maint/PC/VC6/bz2.dsp (props changed) python/branches/release25-maint/PC/VC6/make_versioninfo.dsp (props changed) python/branches/release25-maint/PC/VC6/pcbuild.dsw (props changed) python/branches/release25-maint/PC/VC6/pyexpat.dsp (props changed) python/branches/release25-maint/PC/VC6/python.dsp (props changed) python/branches/release25-maint/PC/VC6/pythoncore.dsp (props changed) python/branches/release25-maint/PC/VC6/pythonw.dsp (props changed) python/branches/release25-maint/PC/VC6/select.dsp (props changed) python/branches/release25-maint/PC/VC6/unicodedata.dsp (props changed) python/branches/release25-maint/PC/VC6/w9xpopen.dsp (props changed) python/branches/release25-maint/PC/VC6/winsound.dsp (props changed) python/branches/release25-maint/PC/VC6/zlib.dsp (props changed) Log: Remove binary property on project files, set eol-style to CRLF instead. Modified: python/branches/release25-maint/PC/VC6/_ctypes.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/_ctypes.dsp (original) +++ python/branches/release25-maint/PC/VC6/_ctypes.dsp Sun Oct 15 14:04:07 2006 @@ -1,182 +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 defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "_ctypes.mak" CFG="_ctypes - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "_ctypes - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "_ctypes - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "_ctypes - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-release\_ctypes" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes.pyd" - -!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-debug\_ctypes" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept -# SUBTRACT LINK32 /incremental:no - -!ENDIF - -# Begin Target - -# Name "_ctypes - Win32 Release" -# Name "_ctypes - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\callbacks.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\callproc.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\cfield.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\malloc_closure.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\prep_cif.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\stgdict.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\win32.c - -!IF "$(CFG)" == "_ctypes - Win32 Release" - -# SUBTRACT CPP /I "..\..\Include" - -!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" - -# ADD CPP /I "..\Include" /I "..\PC" /I "..\Modules\_ctypes\libffi_msvc" -# SUBTRACT CPP /I "..\..\Include" - -!ENDIF - -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\ctypes.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\ctypes_dlfcn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi_common.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\fficonfig.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffitarget.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project +# 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 defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_ctypes.mak" CFG="_ctypes - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_ctypes - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_ctypes - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_ctypes - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_ctypes" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes.pyd" + +!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_ctypes" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /incremental:no + +!ENDIF + +# Begin Target + +# Name "_ctypes - Win32 Release" +# Name "_ctypes - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\callbacks.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\callproc.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\cfield.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\malloc_closure.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\prep_cif.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\stgdict.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\win32.c + +!IF "$(CFG)" == "_ctypes - Win32 Release" + +# SUBTRACT CPP /I "..\..\Include" + +!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" + +# ADD CPP /I "..\Include" /I "..\PC" /I "..\Modules\_ctypes\libffi_msvc" +# SUBTRACT CPP /I "..\..\Include" + +!ENDIF + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\ctypes.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\ctypes_dlfcn.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi_common.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\fficonfig.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffitarget.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Modified: python/branches/release25-maint/PC/VC6/_ctypes_test.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/_ctypes_test.dsp (original) +++ python/branches/release25-maint/PC/VC6/_ctypes_test.dsp Sun Oct 15 14:04:07 2006 @@ -1,113 +1,113 @@ -# Microsoft Developer Studio Project File - Name="_ctypes_test" - 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_test - 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_test.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "_ctypes_test.mak" CFG="_ctypes_test - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "_ctypes_test - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "_ctypes_test - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "_ctypes_test - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-release\_ctypes_test" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" - -!ELSEIF "$(CFG)" == "_ctypes_test - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "_ctypes_test___Win32_Debug" -# PROP BASE Intermediate_Dir "_ctypes_test___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-debug\_ctypes_test" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\Include" /I "..\..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "_ctypes_test - Win32 Release" -# Name "_ctypes_test - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="_ctypes_test" - 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_test - 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_test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_ctypes_test.mak" CFG="_ctypes_test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_ctypes_test - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_ctypes_test - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_ctypes_test - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_ctypes_test" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" + +!ELSEIF "$(CFG)" == "_ctypes_test - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Intermediate_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_ctypes_test" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\Include" /I "..\..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "_ctypes_test - Win32 Release" +# Name "_ctypes_test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\_ctypes\_ctypes_test.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Modified: python/branches/release25-maint/PC/VC6/_elementtree.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/_elementtree.dsp (original) +++ python/branches/release25-maint/PC/VC6/_elementtree.dsp Sun Oct 15 14:04:07 2006 @@ -1,129 +1,129 @@ -# Microsoft Developer Studio Project File - Name="_elementtree" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=_elementtree - 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 "_elementtree.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "_elementtree.mak" CFG="_elementtree - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "_elementtree - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "_elementtree - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "_elementtree - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-release\_elementtree" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree.pyd" - -!ELSEIF "$(CFG)" == "_elementtree - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "_elementtree___Win32_Debug" -# PROP BASE Intermediate_Dir "_elementtree___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" -# PROP Intermediate_Dir "x86-temp-debug\_elementtree" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "_DEBUG" /D "HAVE_EXPAT_H" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "_elementtree - Win32 Release" -# Name "_elementtree - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\Modules\_elementtree.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmlparse.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmltok.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\expat\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmltok.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="_elementtree" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=_elementtree - 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 "_elementtree.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_elementtree.mak" CFG="_elementtree - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_elementtree - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_elementtree - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_elementtree - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-release\_elementtree" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree.pyd" + +!ELSEIF "$(CFG)" == "_elementtree - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "_elementtree___Win32_Debug" +# PROP BASE Intermediate_Dir "_elementtree___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "x86-temp-debug\_elementtree" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "_DEBUG" /D "HAVE_EXPAT_H" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "_elementtree - Win32 Release" +# Name "_elementtree - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Modules\_elementtree.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlparse.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlrole.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmltok.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Modules\expat\xmlrole.h +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\expat\xmltok.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project From python-checkins at python.org Sun Oct 15 16:30:39 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 16:30:39 +0200 (CEST) Subject: [Python-checkins] r52346 - python/trunk/Doc/dist/dist.tex Message-ID: <20061015143039.01A111E4005@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 16:30:38 2006 New Revision: 52346 Modified: python/trunk/Doc/dist/dist.tex Log: Mention the bdist_msi module. Will backport to 2.5. Modified: python/trunk/Doc/dist/dist.tex ============================================================================== --- python/trunk/Doc/dist/dist.tex (original) +++ python/trunk/Doc/dist/dist.tex Sun Oct 15 16:30:38 2006 @@ -3607,6 +3607,11 @@ % todo +\section{\module{distutils.command.bdist_msi} --- Build a Microsoft Installer binary package} +\declaremodule[distutils.command.bdistmsi]{standard}{distutils.command.bdist_msi} +\modulesynopsis{Build a binary distribution as a Windows MSI file} + +% todo \section{\module{distutils.command.bdist_rpm} --- Build a binary distribution as a Redhat RPM and SRPM} \declaremodule[distutils.command.bdistrpm]{standard}{distutils.command.bdist_rpm} From python-checkins at python.org Sun Oct 15 16:30:49 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 15 Oct 2006 16:30:49 +0200 (CEST) Subject: [Python-checkins] r52347 - python/branches/release25-maint/Doc/dist/dist.tex Message-ID: <20061015143049.CFF191E4005@bag.python.org> Author: martin.v.loewis Date: Sun Oct 15 16:30:49 2006 New Revision: 52347 Modified: python/branches/release25-maint/Doc/dist/dist.tex Log: Mention the bdist_msi module. Modified: python/branches/release25-maint/Doc/dist/dist.tex ============================================================================== --- python/branches/release25-maint/Doc/dist/dist.tex (original) +++ python/branches/release25-maint/Doc/dist/dist.tex Sun Oct 15 16:30:49 2006 @@ -3607,6 +3607,11 @@ % todo +\section{\module{distutils.command.bdist_msi} --- Build a Microsoft Installer binary package} +\declaremodule[distutils.command.bdistmsi]{standard}{distutils.command.bdist_msi} +\modulesynopsis{Build a binary distribution as a Windows MSI file} + +% todo \section{\module{distutils.command.bdist_rpm} --- Build a binary distribution as a Redhat RPM and SRPM} \declaremodule[distutils.command.bdistrpm]{standard}{distutils.command.bdist_rpm} From stackless-checkins-bounces at stackless.com Sun Oct 15 14:17:00 2006 From: stackless-checkins-bounces at stackless.com (stackless-checkins-bounces at stackless.com) Date: Sun, 15 Oct 2006 14:17:00 +0200 Subject: [Python-checkins] Your message to Stackless-checkins awaits moderator approval Message-ID: Your mail to 'Stackless-checkins' with the subject r52348 - in stackless/trunk: Doc/Makefile Doc/api/abstract.tex Doc/api/concrete.tex Doc/api/intro.tex Doc/api/newtypes.tex Doc/commontex/boilerplate.tex Doc/ext/extending.tex Doc/howto/functional.rst Doc/lib/libbsddb.tex Doc/lib/libcsv.tex Doc/lib/libdatetime.tex Doc/lib/libdecimal.tex Doc/lib/libetree.tex Doc/lib/libfpectl.tex Doc/lib/libfuncs.tex Doc/lib/libhashlib.tex Doc/lib/libimp.tex Doc/lib/liblogging.tex Doc/lib/libpyexpat.tex Doc/lib/libsqlite3.tex Doc/lib/libstdtypes.tex Doc/lib/libunittest.tex Doc/lib/liburlparse.tex Doc/lib/libuuid.tex Doc/lib/sqlite3/executescript.py Doc/perl/python.perl Doc/ref/ref3.tex Doc/tut/tut.tex Doc/whatsnew/whatsnew25.tex Doc/whatsnew/whatsnew26.tex Grammar/Grammar Include/code.h Include/import.h Include/parsetok.h Include/patchlevel.h Include/pyport.h Lib/SimpleXMLRPCServer.py Lib/_strptime.py Lib/bsddb/test/test_basics.py Lib/cgi.py Lib/colorsys.py Lib/ctypes/__init__.py Lib/ctypes/test/test_bitfields.py Lib/ctypes/test/test_! cast.py Lib/ctypes/test/test_win32.py Lib/decimal.py Lib/distutils/command/register.py Lib/distutils/command/wininst-8.exe Lib/distutils/sysconfig.py Lib/distutils/unixccompiler.py Lib/doctest.py Lib/email/utils.py Lib/encodings/__init__.py Lib/genericpath.py Lib/idlelib/NEWS.txt Lib/idlelib/PyShell.py Lib/idlelib/ScriptBinding.py Lib/idlelib/idlever.py Lib/inspect.py Lib/logging/__init__.py Lib/logging/config.py Lib/macpath.py Lib/ntpath.py Lib/os2emxpath.py Lib/pdb.py Lib/plat-mac/aetools.py Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py Lib/plat-sunos5/STROPTS.py Lib/posixpath.py Lib/pyclbr.py Lib/sgmllib.py Lib/subprocess.py Lib/tarfile.py Lib/test/crashers/bogus_sre_bytecode.py Lib/test/crashers/infinite_loop_re.py Lib/test/crashers/loosing_mro_ref.py Lib/test/list_tests.py Lib/test/output/test_tokenize Lib/test/sgml_input.html Lib/test/string_tests.py Lib/test/test_StringIO.py Lib/test/test_array.py Lib/test/test_builtin.py Lib/test/test_codecencodings! _cn.py Lib/test/test_complex_args.py Lib/test/test_contextlib.py Lib/test/test_datetime.py Lib/test/test_decimal.py Lib/test/test_descr.py Lib/test/test_exceptions.py Lib/test/test_fcntl.py Lib/test/test_future.py Lib/test/test_genericpath.py Lib/test/test_grammar.py Lib/test/test_imp.py Lib/test/test_import.py Lib/test/test Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 707884 bytes with a limit of 500 KB Either the message will get posted to the list, or you will receive notification of the moderator's decision. If you would like to cancel this posting, please visit the following URL: http://www.stackless.com/mailman/confirm/stackless-checkins/7f3f2628cc66f0b30068a823e08cb1b607b10f8c From brett at python.org Sun Oct 15 19:53:35 2006 From: brett at python.org (Brett Cannon) Date: Sun, 15 Oct 2006 10:53:35 -0700 Subject: [Python-checkins] r52292 - sandbox/trunk/import_in_py/importer.py In-Reply-To: <45303E46.9080901@gmail.com> References: <20061011235657.59CD61E4007@bag.python.org> <452F557D.6090208@gmail.com> <45303E46.9080901@gmail.com> Message-ID: On 10/13/06, Nick Coghlan wrote: > > 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... I don't think you did. There is a design choice of keeping highly common things in __import__, or generalizing it out so that it uses the basic infrastructure more. This includes whether __import__ should handle checking sys.modules itself or if that should be left to a meta_path importer. I think the only contention here is how to handle adding modules to sys.modules during an import. Someone has to stash something into sys.modules to prevent recursion on a circular import dependency. I had suggested letting __import__ do it and to then just pass in the module to load_module to remove that level of boilerplate. Jim didn't like that since it would restrict loaders to standard module objects because any other import statements in a circular dependency would then store a reference to the module. My thing is that if they need something else they can swap out the module first thing upon execution and use what they want. It's a very small amount of boilerplate, but I definitely could see myself forgetting to do it. Either way, the key is that the module put into sys.modules cannot change from when it's added and the module is initialized. Otherwise circular imports would end up with a different module than others who import later. ah well, I'll wait > and see what you come up with - I like what I've seen on this branch so > far :) Thanks! Glad that my ideas have seemed sane to other people beyond just me. The API redesign for the py/pyc handler is done and I am just finishing the tests (I have 49 for the module so far). Once the tests are finished I will check it in. I like the result because I abstracted the algorithm for handling choosing bytecode over source, regenerating bytecode, etc., to a point that opaque objects are used so that it is easy to use whatever setup you want while not having to touch the basic algorithm. -Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20061015/0d70d587/attachment.html From kbk at shore.net Mon Oct 16 01:43:27 2006 From: kbk at shore.net (Kurt B. Kaiser) Date: Sun, 15 Oct 2006 19:43:27 -0400 Subject: [Python-checkins] r52295 - in python/trunk: Lib/idlelib/PyShell.py Misc/NEWS In-Reply-To: <20061012075722.1B6B91E4024@bag.python.org> (georg brandl's message of "Thu, 12 Oct 2006 09:57:22 +0200 (CEST)") References: <20061012075722.1B6B91E4024@bag.python.org> Message-ID: <87fydp16xs.fsf@hydra.bayview.thirdcreek.com> "georg.brandl" writes: > 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. > + This is a nice fix. Thanks. Note that IDLE maintains its own NEWS.txt file and IDLE changes have not been going into Python NEWS. I suppose major ones should be noted there, though. -- KBK From python-checkins at python.org Mon Oct 16 05:09:54 2006 From: python-checkins at python.org (brett.cannon) Date: Mon, 16 Oct 2006 05:09:54 +0200 (CEST) Subject: [Python-checkins] r52354 - in python/trunk: Lib/lib-tk/turtle.py Misc/NEWS Message-ID: <20061016030954.BBCDA1E4005@bag.python.org> Author: brett.cannon Date: Mon Oct 16 05:09:52 2006 New Revision: 52354 Modified: python/trunk/Lib/lib-tk/turtle.py python/trunk/Misc/NEWS Log: Fix turtle so that you can launch the demo2 function on its own instead of only when the module is launched as a script. Modified: python/trunk/Lib/lib-tk/turtle.py ============================================================================== --- python/trunk/Lib/lib-tk/turtle.py (original) +++ python/trunk/Lib/lib-tk/turtle.py Mon Oct 16 05:09:52 2006 @@ -15,6 +15,7 @@ """ from math import * # Also for export +from time import sleep import Tkinter speeds = ['fastest', 'fast', 'normal', 'slow', 'slowest'] @@ -949,7 +950,6 @@ if __name__ == '__main__': - from time import sleep demo() sleep(3) demo2() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Oct 16 05:09:52 2006 @@ -81,6 +81,10 @@ Library ------- +- Fix turtle so that time.sleep is imported for the entire library. Allows + the demo2 function to be executed on its own instead of only when the + module is run as a script. + - Bug #813342: Start the IDLE subprocess with -Qnew if the parent is started with that option. From python-checkins at python.org Tue Oct 17 17:18:06 2006 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 17 Oct 2006 17:18:06 +0200 (CEST) Subject: [Python-checkins] r52356 - python/trunk/PC/VC6/_bsddb.dsp python/trunk/PC/VC6/_ctypes.dsp python/trunk/PC/VC6/_ctypes_test.dsp python/trunk/PC/VC6/_elementtree.dsp python/trunk/PC/VC6/_sqlite3.dsp python/trunk/PC/VC6/_ssl.mak python/trunk/PC/VC6/_tkinter.dsp python/trunk/PC/VC6/bz2.dsp python/trunk/PC/VC6/pcbuild.dsw python/trunk/PC/VC6/readme.txt python/trunk/PC/VC6/zlib.dsp Message-ID: <20061017151806.DA9041E401D@bag.python.org> Author: martin.v.loewis Date: Tue Oct 17 17:18:06 2006 New Revision: 52356 Added: python/trunk/PC/VC6/_sqlite3.dsp (contents, props changed) Modified: python/trunk/PC/VC6/_bsddb.dsp python/trunk/PC/VC6/_ctypes.dsp python/trunk/PC/VC6/_ctypes_test.dsp python/trunk/PC/VC6/_elementtree.dsp python/trunk/PC/VC6/_ssl.mak python/trunk/PC/VC6/_tkinter.dsp python/trunk/PC/VC6/bz2.dsp python/trunk/PC/VC6/pcbuild.dsw python/trunk/PC/VC6/readme.txt python/trunk/PC/VC6/zlib.dsp Log: Patch #1457736: Update VC6 to use current PCbuild settings. Will backport to 2.5. Modified: python/trunk/PC/VC6/_bsddb.dsp ============================================================================== --- python/trunk/PC/VC6/_bsddb.dsp (original) +++ python/trunk/PC/VC6/_bsddb.dsp Tue Oct 17 17:18:06 2006 @@ -44,7 +44,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\db-4.1.25\build_win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\db-4.4.20\build_win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\db-4.1.25\build_win32\Release_static\libdb41s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"./_bsddb.pyd" +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\db-4.4.20\build_win32\Release\libdb44s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"./_bsddb.pyd" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_bsddb - Win32 Debug" @@ -72,7 +72,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\db-4.1.25\build_win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\db-4.4.20\build_win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -82,7 +82,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\db-4.1.25\build_win32\Release_static\libdb41s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd" /out:"./_bsddb_d.pyd" /pdbtype:sept +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\db-4.4.20\build_win32\Release\libdb44s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd" /out:"./_bsddb_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF Modified: python/trunk/PC/VC6/_ctypes.dsp ============================================================================== --- python/trunk/PC/VC6/_ctypes.dsp (original) +++ python/trunk/PC/VC6/_ctypes.dsp Tue Oct 17 17:18:06 2006 @@ -23,8 +23,8 @@ # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" +# PROP Scc_ProjName "_ctypes" +# PROP Scc_LocalPath ".." CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -38,23 +38,24 @@ # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-release\_ctypes" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes.pyd" +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d1a0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_ctypes.pyd" +# SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" @@ -65,24 +66,24 @@ # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-debug\_ctypes" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept -# SUBTRACT LINK32 /incremental:no +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d1a0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none !ENDIF @@ -90,9 +91,6 @@ # Name "_ctypes - Win32 Release" # Name "_ctypes - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\Modules\_ctypes\_ctypes.c @@ -128,55 +126,6 @@ # Begin Source File SOURCE=..\..\Modules\_ctypes\libffi_msvc\win32.c - -!IF "$(CFG)" == "_ctypes - Win32 Release" - -# SUBTRACT CPP /I "..\..\Include" - -!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" - -# ADD CPP /I "..\Include" /I "..\PC" /I "..\Modules\_ctypes\libffi_msvc" -# SUBTRACT CPP /I "..\..\Include" - -!ENDIF - -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\ctypes.h # End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\ctypes_dlfcn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi_common.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\fficonfig.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffitarget.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group # End Target # End Project Modified: python/trunk/PC/VC6/_ctypes_test.dsp ============================================================================== --- python/trunk/PC/VC6/_ctypes_test.dsp (original) +++ python/trunk/PC/VC6/_ctypes_test.dsp Tue Oct 17 17:18:06 2006 @@ -23,8 +23,8 @@ # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" +# PROP Scc_ProjName "_ctypes_test" +# PROP Scc_LocalPath ".." CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -38,50 +38,52 @@ # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-release\_ctypes_test" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" +# SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_ctypes_test - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "_ctypes_test___Win32_Debug" -# PROP BASE Intermediate_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-debug\_ctypes_test" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\Include" /I "..\..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none !ENDIF @@ -89,25 +91,9 @@ # Name "_ctypes_test - Win32 Release" # Name "_ctypes_test - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\Modules\_ctypes\_ctypes_test.c # End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group # End Target # End Project Modified: python/trunk/PC/VC6/_elementtree.dsp ============================================================================== --- python/trunk/PC/VC6/_elementtree.dsp (original) +++ python/trunk/PC/VC6/_elementtree.dsp Tue Oct 17 17:18:06 2006 @@ -23,8 +23,8 @@ # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" +# PROP Scc_ProjName "_elementtree" +# PROP Scc_LocalPath ".." CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -38,50 +38,52 @@ # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-release\_elementtree" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D "BYTEORDER=1234" /D "XML_CONTEXT_BYTES=1024" /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree.pyd" +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d100000" /subsystem:windows /dll /debug /machine:I386 /out:"./_elementtree.pyd" +# SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_elementtree - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "_elementtree___Win32_Debug" -# PROP BASE Intermediate_Dir "_elementtree___Win32_Debug" +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-debug\_elementtree" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "_DEBUG" /D "HAVE_EXPAT_H" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\Modules\expat" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D "BYTEORDER=1234" /D "XML_CONTEXT_BYTES=1024" /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d100000" /subsystem:windows /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none !ENDIF @@ -89,9 +91,6 @@ # Name "_elementtree - Win32 Release" # Name "_elementtree - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\Modules\_elementtree.c @@ -108,22 +107,5 @@ SOURCE=..\..\Modules\expat\xmltok.c # End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\expat\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmltok.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group # End Target # End Project Added: python/trunk/PC/VC6/_sqlite3.dsp ============================================================================== --- (empty file) +++ python/trunk/PC/VC6/_sqlite3.dsp Tue Oct 17 17:18:06 2006 @@ -0,0 +1,131 @@ +# Microsoft Developer Studio Project File - Name="_sqlite3" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=_sqlite3 - 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 "_sqlite3.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_sqlite3.mak" CFG="_sqlite3 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_sqlite3 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_sqlite3 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "_sqlite3" +# PROP Scc_LocalPath ".." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_sqlite3 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "." +# PROP Intermediate_Dir "x86-temp-release\_sqlite3" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\sqlite-source-3.3.4" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "MODULE_NAME=\"sqlite3\"" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\sqlite-source-3.3.4\sqlite3.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sqlite3.pyd" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "_sqlite3 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "." +# PROP Intermediate_Dir "x86-temp-debug\_sqlite3" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\sqlite-source-3.3.4" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "MODULE_NAME=\"sqlite3\"" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\sqlite-source-3.3.4\sqlite3.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sqlite3_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "_sqlite3 - Win32 Release" +# Name "_sqlite3 - Win32 Debug" +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\cache.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\connection.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\cursor.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\microprotocols.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\module.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\prepare_protocol.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\row.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\statement.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\util.c +# End Source File +# End Target +# End Project Modified: python/trunk/PC/VC6/_ssl.mak ============================================================================== --- python/trunk/PC/VC6/_ssl.mak (original) +++ python/trunk/PC/VC6/_ssl.mak Tue Oct 17 17:18:06 2006 @@ -2,17 +2,17 @@ !IFDEF DEBUG MODULE=_ssl_d.pyd TEMP_DIR=x86-temp-debug/_ssl -CFLAGS=/Od /Zi /MDd /LDd /DDEBUG /D_DEBUG +CFLAGS=/Od /Zi /MDd /LDd /DDEBUG /D_DEBUG /DWIN32 SSL_LIB_DIR=$(SSL_DIR)/out32.dbg !ELSE MODULE=_ssl.pyd TEMP_DIR=x86-temp-release/_ssl -CFLAGS=/Ox /MD /LD +CFLAGS=/Ox /MD /LD /DWIN32 SSL_LIB_DIR=$(SSL_DIR)/out32 !ENDIF INCLUDES=-I ../../Include -I .. -I $(SSL_DIR)/inc32 -LIBS=gdi32.lib wsock32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib +LIBS=gdi32.lib wsock32.lib user32.lib advapi32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib SOURCE=../../Modules/_ssl.c $(SSL_LIB_DIR)/libeay32.lib $(SSL_LIB_DIR)/ssleay32.lib Modified: python/trunk/PC/VC6/_tkinter.dsp ============================================================================== --- python/trunk/PC/VC6/_tkinter.dsp (original) +++ python/trunk/PC/VC6/_tkinter.dsp Tue Oct 17 17:18:06 2006 @@ -17,8 +17,8 @@ !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "_tkinter - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "_tkinter - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_tkinter - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project @@ -44,7 +44,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\tcl84\include" /I "..\..\Include" /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\tcltk\include" /I "..\..\Include" /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\..\tcl84\lib\tk84.lib ..\..\..\tcl84\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" +# ADD LINK32 ..\..\..\tcltk\lib\tk84.lib ..\..\..\tcltk\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_tkinter - Win32 Release" @@ -72,7 +72,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\..\tcl84\include" /I "..\..\Include" /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\..\tcltk\include" /I "..\..\Include" /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -82,15 +82,15 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\..\tcl84\lib\tk84.lib ..\..\..\tcl84\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" +# ADD LINK32 ..\..\..\tcltk\lib\tk84.lib ..\..\..\tcltk\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target -# Name "_tkinter - Win32 Debug" # Name "_tkinter - Win32 Release" +# Name "_tkinter - Win32 Debug" # Begin Source File SOURCE=..\..\Modules\_tkinter.c Modified: python/trunk/PC/VC6/bz2.dsp ============================================================================== --- python/trunk/PC/VC6/bz2.dsp (original) +++ python/trunk/PC/VC6/bz2.dsp Tue Oct 17 17:18:06 2006 @@ -44,7 +44,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.2" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.3" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -54,12 +54,8 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\..\bzip2-1.0.2\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./bz2.pyd" +# ADD LINK32 ..\..\..\bzip2-1.0.3\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./bz2.pyd" # SUBTRACT LINK32 /pdb:none /nodefaultlib -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Cmds=cd ..\..\..\bzip2-1.0.2 nmake /nologo /f makefile.msc -# End Special Build Tool !ELSEIF "$(CFG)" == "bz2 - Win32 Debug" @@ -76,7 +72,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.2" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.3" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -86,12 +82,8 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\..\bzip2-1.0.2\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /nodefaultlib:"libc" /out:"./bz2_d.pyd" /pdbtype:sept +# ADD LINK32 ..\..\..\bzip2-1.0.3\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /nodefaultlib:"libc" /out:"./bz2_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Cmds=cd ..\..\..\bzip2-1.0.2 nmake /nologo /f makefile.msc -# End Special Build Tool !ENDIF Modified: python/trunk/PC/VC6/pcbuild.dsw ============================================================================== --- python/trunk/PC/VC6/pcbuild.dsw (original) +++ python/trunk/PC/VC6/pcbuild.dsw Tue Oct 17 17:18:06 2006 @@ -69,6 +69,18 @@ ############################################################################### +Project: "_sqlite3"=".\_sqlite3.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "_ssl"=".\_ssl.dsp" - Package Owner=<4> Package=<5> @@ -261,21 +273,6 @@ ############################################################################### -Project: "zlib"=".\zlib.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name pythoncore - End Project Dependency -}}} - -############################################################################### - Global: Package=<5> Modified: python/trunk/PC/VC6/readme.txt ============================================================================== --- python/trunk/PC/VC6/readme.txt (original) +++ python/trunk/PC/VC6/readme.txt Tue Oct 17 17:18:06 2006 @@ -62,40 +62,37 @@ _tkinter Python wrapper for the Tk windowing system. Requires building - Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.3: + Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.12. Get source ---------- - Go to - http://prdownloads.sourceforge.net/tcl/ - and download - tcl843-src.zip - tk843-src.zip - Unzip into - dist\tcl8.4.3\ - dist\tk8.4.3\ - respectively. + In the dist directory, run + svn export http://svn.python.org/projects/external/tcl8.4.12 + svn export http://svn.python.org/projects/external/tk8.4.12 + svn export http://svn.python.org/projects/external/tix-8.4.0 - Build Tcl first (done here w/ MSVC 6 on Win98SE) + Build Tcl first (done here w/ MSVC 6 on Win2K) --------------- - cd dist\tcl8.4.3\win - run vcvars32.bat [necessary even on Win2K] + cd dist\tcl8.4.12\win + run vcvars32.bat nmake -f makefile.vc - nmake -f makefile.vc INSTALLDIR=..\..\tcl84 install + nmake -f makefile.vc INSTALLDIR=..\..\tcltk install XXX Should we compile with OPTS=threads? - XXX Some tests failed in "nmake -f makefile.vc test". - XXX all.tcl: Total 10480 Passed 9743 Skipped 719 Failed 18 - XXX - XXX That was on Win98SE. On Win2K: - XXX all.tcl Total 10480 Passed 9781 Skipped 698 Failed 1 + Optional: run tests, via + nmake -f makefile.vc test + + all.tcl: Total 10835 Passed 10096 Skipped 732 Failed 7 + Sourced 129 Test Files. + Files with failing tests: exec.test expr.test io.test main.test string.test stri + ngObj.test Build Tk -------- - cd dist\tk8.4.3\win - nmake -f makefile.vc TCLDIR=..\..\tcl8.4.3 - nmake -f makefile.vc TCLDIR=..\..\tcl8.4.3 INSTALLDIR=..\..\tcl84 install + cd dist\tk8.4.12\win + nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 + nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 INSTALLDIR=..\..\tcltk install XXX Should we compile with OPTS=threads? @@ -103,96 +100,59 @@ XXX failed. It popped up tons of little windows, and did lots of XXX stuff, and nothing blew up. - XXX Our installer copies a lot of stuff out of the Tcl/Tk install - XXX directory. Is all of that really needed for Python use of Tcl/Tk? - - Make sure the installer matches - ------------------------------- - Ensure that the Wise compiler vrbl _TCLDIR_ is set to the name of - the common Tcl/Tk installation directory (tcl84 for the instructions - above). This is needed so the installer can copy various Tcl/Tk - files into the Python distribution. - - -zlib - Python wrapper for the zlib compression library. Get the source code - for version 1.1.4 from a convenient mirror at: - http://www.gzip.org/zlib/ - Unpack into dist\zlib-1.1.4. - A custom pre-link step in the zlib project settings should manage to - build zlib-1.1.4\zlib.lib by magic before zlib.pyd (or zlib_d.pyd) is - linked in PCbuild\. - However, the zlib project is not smart enough to remove anything under - zlib-1.1.4\ when you do a clean, so if you want to rebuild zlib.lib - you need to clean up zlib-1.1.4\ by hand. + Built Tix + --------- + cd dist\tix-8.4.0\win + nmake -f python.mak + nmake -f python.mak install bz2 Python wrapper for the libbz2 compression library. Homepage http://sources.redhat.com/bzip2/ - Download the source tarball, bzip2-1.0.2.tar.gz. - Unpack into dist\bzip2-1.0.2. WARNING: If you're using WinZip, you - must disable its "TAR file smart CR/LF conversion" feature (under - Options -> Configuration -> Miscellaneous -> Other) for the duration. - - A custom pre-link step in the bz2 project settings should manage to - build bzip2-1.0.2\libbz2.lib by magic before bz2.pyd (or bz2_d.pyd) is - linked in PCbuild\. - However, the bz2 project is not smart enough to remove anything under - bzip2-1.0.2\ when you do a clean, so if you want to rebuild bzip2.lib - you need to clean up bzip2-1.0.2\ by hand. - - The build step shouldn't yield any warnings or errors, and should end - by displaying 6 blocks each terminated with - FC: no differences encountered - If FC finds differences, see the warning abou WinZip above (when I - first tried it, sample3.ref failed due to CRLF conversion). + Download the source from the python.org copy into the dist + directory: + + svn export http://svn.python.org/projects/external/bzip2-1.0.3 + + And requires building bz2 first. - All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python + cd dist\bzip2-1.0.3 + nmake -f makefile.msc + + All of this managed to build bzip2-1.0.3\libbz2.lib, which the Python project links in. _bsddb - Go to Sleepycat's download page: - http://www.sleepycat.com/download/ + To use the version of bsddb that Python is built with by default, invoke + (in the dist directory) + + svn export http://svn.python.org/projects/external/db-4.4.20 + + Then open db-4.4.20\build_win32\Berkeley_DB.dsw and build the "db_static" + project for "Release" mode. + + Alternatively, if you want to start with the original sources, + go to Sleepycat's download page: + http://www.sleepycat.com/downloads/releasehistorybdb.html + + and download version 4.4.20. - and download version 4.1.25. The file name is db-4.1.25.NC.zip. - XXX with or without strong cryptography? I picked "without". + With or without strong cryptography? You can choose either with or + without strong cryptography, as per the instructions below. By + default, Python is built and distributed WITHOUT strong crypto. - Unpack into - dist\db-4.1.25 + Unpack the sources; if you downloaded the non-crypto version, rename + the directory from db-4.4.20.NC to db-4.4.20. - [If using WinZip to unpack the db-4.1.25.NC distro, that requires - renaming the directory (to remove ".NC") after unpacking. - ] - - Open - dist\db-4.1.25\docs\index.html - - and follow the Windows instructions for building the Sleepycat - software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory. - Build the Release version ("build_all -- Win32 Release"). - - XXX We're actually linking against Release_static\libdb41s.lib. - XXX This yields the following warnings: -""" -Compiling... -_bsddb.c -Linking... - Creating library ./_bsddb.lib and object ./_bsddb.exp -LINK : warning LNK4049: locally defined symbol "_malloc" imported -LINK : warning LNK4049: locally defined symbol "_free" imported -LINK : warning LNK4049: locally defined symbol "_fclose" imported -LINK : warning LNK4049: locally defined symbol "_fopen" imported -_bsddb.pyd - 0 error(s), 4 warning(s) -""" - XXX This isn't encouraging, but I don't know what to do about it. + Now apply any patches that apply to your version. To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py is then enabled. Running in verbose mode may be helpful. XXX The test_bsddb3 tests don't always pass, on Windows (according to - XXX me) or on Linux (according to Barry). I had much better luck - XXX on Win2K than on Win98SE. The common failure mode across platforms + XXX me) or on Linux (according to Barry). (I had much better luck + XXX on Win2K than on Win98SE.) The common failure mode across platforms XXX is XXX DBAgainError: (11, 'Resource temporarily unavailable -- unable XXX to join the environment') Modified: python/trunk/PC/VC6/zlib.dsp ============================================================================== --- python/trunk/PC/VC6/zlib.dsp (original) +++ python/trunk/PC/VC6/zlib.dsp Tue Oct 17 17:18:06 2006 @@ -1,109 +0,0 @@ -# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=zlib - 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 "zlib.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "zlib.mak" CFG="zlib - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "zlib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "zlib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "zlib" -# PROP Scc_LocalPath ".." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "zlib - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "." -# PROP Intermediate_Dir "x86-temp-release\zlib" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\zlib-1.1.4" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib.pyd" -# SUBTRACT LINK32 /pdb:none -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=Checking static zlib has been built -PreLink_Cmds=cd ..\..\..\zlib-1.1.4 nmake -nologo -f msdos\makefile.w32 zlib.lib -# End Special Build Tool - -!ELSEIF "$(CFG)" == "zlib - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "." -# PROP Intermediate_Dir "x86-temp-debug\zlib" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\zlib-1.1.4" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib_d.pyd" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=Checking static zlib has been built -PreLink_Cmds=cd ..\..\..\zlib-1.1.4 nmake -nologo -f msdos\makefile.w32 zlib.lib -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "zlib - Win32 Release" -# Name "zlib - Win32 Debug" -# Begin Source File - -SOURCE=..\..\Modules\zlibmodule.c -# End Source File -# End Target -# End Project From python-checkins at python.org Tue Oct 17 17:22:21 2006 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 17 Oct 2006 17:22:21 +0200 (CEST) Subject: [Python-checkins] r52357 - python/branches/release25-maint/PC/VC6/_bsddb.dsp python/branches/release25-maint/PC/VC6/_ctypes.dsp python/branches/release25-maint/PC/VC6/_ctypes_test.dsp python/branches/release25-maint/PC/VC6/_elementtree.dsp python/branches/release25-maint/PC/VC6/_sqlite3.dsp python/branches/release25-maint/PC/VC6/_ssl.mak python/branches/release25-maint/PC/VC6/_tkinter.dsp python/branches/release25-maint/PC/VC6/bz2.dsp python/branches/release25-maint/PC/VC6/pcbuild.dsw python/branches/release25-maint/PC/VC6/readme.txt python/branches/release25-maint/PC/VC6/zlib.dsp Message-ID: <20061017152221.61E341E4072@bag.python.org> Author: martin.v.loewis Date: Tue Oct 17 17:22:20 2006 New Revision: 52357 Added: python/branches/release25-maint/PC/VC6/_sqlite3.dsp (contents, props changed) Modified: python/branches/release25-maint/PC/VC6/_bsddb.dsp python/branches/release25-maint/PC/VC6/_ctypes.dsp python/branches/release25-maint/PC/VC6/_ctypes_test.dsp python/branches/release25-maint/PC/VC6/_elementtree.dsp python/branches/release25-maint/PC/VC6/_ssl.mak python/branches/release25-maint/PC/VC6/_tkinter.dsp python/branches/release25-maint/PC/VC6/bz2.dsp python/branches/release25-maint/PC/VC6/pcbuild.dsw python/branches/release25-maint/PC/VC6/readme.txt python/branches/release25-maint/PC/VC6/zlib.dsp Log: Patch #1457736: Update VC6 to use current PCbuild settings. Modified: python/branches/release25-maint/PC/VC6/_bsddb.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/_bsddb.dsp (original) +++ python/branches/release25-maint/PC/VC6/_bsddb.dsp Tue Oct 17 17:22:20 2006 @@ -44,7 +44,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\db-4.1.25\build_win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\db-4.4.20\build_win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\db-4.1.25\build_win32\Release_static\libdb41s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"./_bsddb.pyd" +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\db-4.4.20\build_win32\Release\libdb44s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"./_bsddb.pyd" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_bsddb - Win32 Debug" @@ -72,7 +72,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\db-4.1.25\build_win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\db-4.4.20\build_win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -82,7 +82,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\db-4.1.25\build_win32\Release_static\libdb41s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd" /out:"./_bsddb_d.pyd" /pdbtype:sept +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\db-4.4.20\build_win32\Release\libdb44s.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd" /out:"./_bsddb_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF Modified: python/branches/release25-maint/PC/VC6/_ctypes.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/_ctypes.dsp (original) +++ python/branches/release25-maint/PC/VC6/_ctypes.dsp Tue Oct 17 17:22:20 2006 @@ -23,8 +23,8 @@ # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" +# PROP Scc_ProjName "_ctypes" +# PROP Scc_LocalPath ".." CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -38,23 +38,24 @@ # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-release\_ctypes" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\Modules\_ctypes\libffi_msvc" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes.pyd" +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d1a0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_ctypes.pyd" +# SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" @@ -65,24 +66,24 @@ # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-debug\_ctypes" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\Modules\_ctypes\libffi_msvc" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept -# SUBTRACT LINK32 /incremental:no +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d1a0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_ctypes_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none !ENDIF @@ -90,9 +91,6 @@ # Name "_ctypes - Win32 Release" # Name "_ctypes - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\Modules\_ctypes\_ctypes.c @@ -128,55 +126,6 @@ # Begin Source File SOURCE=..\..\Modules\_ctypes\libffi_msvc\win32.c - -!IF "$(CFG)" == "_ctypes - Win32 Release" - -# SUBTRACT CPP /I "..\..\Include" - -!ELSEIF "$(CFG)" == "_ctypes - Win32 Debug" - -# ADD CPP /I "..\Include" /I "..\PC" /I "..\Modules\_ctypes\libffi_msvc" -# SUBTRACT CPP /I "..\..\Include" - -!ENDIF - -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\ctypes.h # End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\ctypes_dlfcn.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffi_common.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\fficonfig.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\libffi_msvc\ffitarget.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group # End Target # End Project Modified: python/branches/release25-maint/PC/VC6/_ctypes_test.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/_ctypes_test.dsp (original) +++ python/branches/release25-maint/PC/VC6/_ctypes_test.dsp Tue Oct 17 17:22:20 2006 @@ -23,8 +23,8 @@ # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" +# PROP Scc_ProjName "_ctypes_test" +# PROP Scc_LocalPath ".." CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -38,50 +38,52 @@ # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-release\_ctypes_test" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"./_ctypes_test.pyd" +# SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_ctypes_test - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "_ctypes_test___Win32_Debug" -# PROP BASE Intermediate_Dir "_ctypes_test___Win32_Debug" +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-debug\_ctypes_test" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_CTYPES_TEST_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\Include" /I "..\..\PC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"./_ctypes_test_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none !ENDIF @@ -89,25 +91,9 @@ # Name "_ctypes_test - Win32 Release" # Name "_ctypes_test - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\Modules\_ctypes\_ctypes_test.c # End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\_ctypes\_ctypes_test.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group # End Target # End Project Modified: python/branches/release25-maint/PC/VC6/_elementtree.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/_elementtree.dsp (original) +++ python/branches/release25-maint/PC/VC6/_elementtree.dsp Tue Oct 17 17:22:20 2006 @@ -23,8 +23,8 @@ # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" +# PROP Scc_ProjName "_elementtree" +# PROP Scc_LocalPath ".." CPP=cl.exe MTL=midl.exe RSC=rc.exe @@ -38,50 +38,52 @@ # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-release\_elementtree" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\Modules\expat" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D "BYTEORDER=1234" /D "XML_CONTEXT_BYTES=1024" /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree.pyd" +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d100000" /subsystem:windows /dll /debug /machine:I386 /out:"./_elementtree.pyd" +# SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_elementtree - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "_elementtree___Win32_Debug" -# PROP BASE Intermediate_Dir "_elementtree___Win32_Debug" +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "" +# PROP Output_Dir "." # PROP Intermediate_Dir "x86-temp-debug\_elementtree" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ELEMENTTREE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I "..\..\PC" /I "..\..\Modules\expat" /D "_DEBUG" /D "HAVE_EXPAT_H" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D BYTEORDER=1234 /D XML_CONTEXT_BYTES=1024 /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\Modules\expat" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_NS" /D "XML_DTD" /D "BYTEORDER=1234" /D "XML_CONTEXT_BYTES=1024" /D "USE_PYEXPAT_CAPI" /D "XML_STATIC" /D "HAVE_MEMMOVE" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x1d100000" /subsystem:windows /dll /debug /machine:I386 /out:"./_elementtree_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none !ENDIF @@ -89,9 +91,6 @@ # Name "_elementtree - Win32 Release" # Name "_elementtree - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\Modules\_elementtree.c @@ -108,22 +107,5 @@ SOURCE=..\..\Modules\expat\xmltok.c # End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\Modules\expat\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\expat\xmltok.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group # End Target # End Project Added: python/branches/release25-maint/PC/VC6/_sqlite3.dsp ============================================================================== --- (empty file) +++ python/branches/release25-maint/PC/VC6/_sqlite3.dsp Tue Oct 17 17:22:20 2006 @@ -0,0 +1,131 @@ +# Microsoft Developer Studio Project File - Name="_sqlite3" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=_sqlite3 - 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 "_sqlite3.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "_sqlite3.mak" CFG="_sqlite3 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "_sqlite3 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_sqlite3 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "_sqlite3" +# PROP Scc_LocalPath ".." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "_sqlite3 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "." +# PROP Intermediate_Dir "x86-temp-release\_sqlite3" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\sqlite-source-3.3.4" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "MODULE_NAME=\"sqlite3\"" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\sqlite-source-3.3.4\sqlite3.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sqlite3.pyd" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "_sqlite3 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "." +# PROP Intermediate_Dir "x86-temp-debug\_sqlite3" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\sqlite-source-3.3.4" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "MODULE_NAME=\"sqlite3\"" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\sqlite-source-3.3.4\sqlite3.lib /nologo /base:"0x1e180000" /subsystem:windows /dll /debug /machine:I386 /out:"./_sqlite3_d.pyd" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "_sqlite3 - Win32 Release" +# Name "_sqlite3 - Win32 Debug" +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\cache.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\connection.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\cursor.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\microprotocols.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\module.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\prepare_protocol.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\row.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\statement.c +# End Source File +# Begin Source File + +SOURCE=..\..\Modules\_sqlite\util.c +# End Source File +# End Target +# End Project Modified: python/branches/release25-maint/PC/VC6/_ssl.mak ============================================================================== --- python/branches/release25-maint/PC/VC6/_ssl.mak (original) +++ python/branches/release25-maint/PC/VC6/_ssl.mak Tue Oct 17 17:22:20 2006 @@ -2,17 +2,17 @@ !IFDEF DEBUG MODULE=_ssl_d.pyd TEMP_DIR=x86-temp-debug/_ssl -CFLAGS=/Od /Zi /MDd /LDd /DDEBUG /D_DEBUG +CFLAGS=/Od /Zi /MDd /LDd /DDEBUG /D_DEBUG /DWIN32 SSL_LIB_DIR=$(SSL_DIR)/out32.dbg !ELSE MODULE=_ssl.pyd TEMP_DIR=x86-temp-release/_ssl -CFLAGS=/Ox /MD /LD +CFLAGS=/Ox /MD /LD /DWIN32 SSL_LIB_DIR=$(SSL_DIR)/out32 !ENDIF INCLUDES=-I ../../Include -I .. -I $(SSL_DIR)/inc32 -LIBS=gdi32.lib wsock32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib +LIBS=gdi32.lib wsock32.lib user32.lib advapi32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib SOURCE=../../Modules/_ssl.c $(SSL_LIB_DIR)/libeay32.lib $(SSL_LIB_DIR)/ssleay32.lib Modified: python/branches/release25-maint/PC/VC6/_tkinter.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/_tkinter.dsp (original) +++ python/branches/release25-maint/PC/VC6/_tkinter.dsp Tue Oct 17 17:22:20 2006 @@ -17,8 +17,8 @@ !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "_tkinter - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "_tkinter - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "_tkinter - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project @@ -44,7 +44,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\tcl84\include" /I "..\..\Include" /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\tcltk\include" /I "..\..\Include" /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\..\tcl84\lib\tk84.lib ..\..\..\tcl84\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" +# ADD LINK32 ..\..\..\tcltk\lib\tk84.lib ..\..\..\tcltk\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter_d.pyd" /pdbtype:sept /libpath:"C:\Program Files\Tcl\lib" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_tkinter - Win32 Release" @@ -72,7 +72,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\..\tcl84\include" /I "..\..\Include" /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\..\tcltk\include" /I "..\..\Include" /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "WITH_APPINIT" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -82,15 +82,15 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\..\tcl84\lib\tk84.lib ..\..\..\tcl84\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" +# ADD LINK32 ..\..\..\tcltk\lib\tk84.lib ..\..\..\tcltk\lib\tcl84.lib odbc32.lib odbccp32.lib user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1e190000" /subsystem:windows /dll /debug /machine:I386 /out:"./_tkinter.pyd" /libpath:"C:\Program Files\Tcl\lib" # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target -# Name "_tkinter - Win32 Debug" # Name "_tkinter - Win32 Release" +# Name "_tkinter - Win32 Debug" # Begin Source File SOURCE=..\..\Modules\_tkinter.c Modified: python/branches/release25-maint/PC/VC6/bz2.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/bz2.dsp (original) +++ python/branches/release25-maint/PC/VC6/bz2.dsp Tue Oct 17 17:22:20 2006 @@ -44,7 +44,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.2" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.3" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -54,12 +54,8 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\..\bzip2-1.0.2\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./bz2.pyd" +# ADD LINK32 ..\..\..\bzip2-1.0.3\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./bz2.pyd" # SUBTRACT LINK32 /pdb:none /nodefaultlib -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Cmds=cd ..\..\..\bzip2-1.0.2 nmake /nologo /f makefile.msc -# End Special Build Tool !ELSEIF "$(CFG)" == "bz2 - Win32 Debug" @@ -76,7 +72,7 @@ # PROP Target_Dir "" F90=df.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.2" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\bzip2-1.0.3" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -86,12 +82,8 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\..\bzip2-1.0.2\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /nodefaultlib:"libc" /out:"./bz2_d.pyd" /pdbtype:sept +# ADD LINK32 ..\..\..\bzip2-1.0.3\libbz2.lib /nologo /base:"0x1D170000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /nodefaultlib:"libc" /out:"./bz2_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Cmds=cd ..\..\..\bzip2-1.0.2 nmake /nologo /f makefile.msc -# End Special Build Tool !ENDIF Modified: python/branches/release25-maint/PC/VC6/pcbuild.dsw ============================================================================== --- python/branches/release25-maint/PC/VC6/pcbuild.dsw (original) +++ python/branches/release25-maint/PC/VC6/pcbuild.dsw Tue Oct 17 17:22:20 2006 @@ -69,6 +69,18 @@ ############################################################################### +Project: "_sqlite3"=".\_sqlite3.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "_ssl"=".\_ssl.dsp" - Package Owner=<4> Package=<5> @@ -261,21 +273,6 @@ ############################################################################### -Project: "zlib"=".\zlib.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name pythoncore - End Project Dependency -}}} - -############################################################################### - Global: Package=<5> Modified: python/branches/release25-maint/PC/VC6/readme.txt ============================================================================== --- python/branches/release25-maint/PC/VC6/readme.txt (original) +++ python/branches/release25-maint/PC/VC6/readme.txt Tue Oct 17 17:22:20 2006 @@ -62,40 +62,37 @@ _tkinter Python wrapper for the Tk windowing system. Requires building - Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.3: + Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.12. Get source ---------- - Go to - http://prdownloads.sourceforge.net/tcl/ - and download - tcl843-src.zip - tk843-src.zip - Unzip into - dist\tcl8.4.3\ - dist\tk8.4.3\ - respectively. + In the dist directory, run + svn export http://svn.python.org/projects/external/tcl8.4.12 + svn export http://svn.python.org/projects/external/tk8.4.12 + svn export http://svn.python.org/projects/external/tix-8.4.0 - Build Tcl first (done here w/ MSVC 6 on Win98SE) + Build Tcl first (done here w/ MSVC 6 on Win2K) --------------- - cd dist\tcl8.4.3\win - run vcvars32.bat [necessary even on Win2K] + cd dist\tcl8.4.12\win + run vcvars32.bat nmake -f makefile.vc - nmake -f makefile.vc INSTALLDIR=..\..\tcl84 install + nmake -f makefile.vc INSTALLDIR=..\..\tcltk install XXX Should we compile with OPTS=threads? - XXX Some tests failed in "nmake -f makefile.vc test". - XXX all.tcl: Total 10480 Passed 9743 Skipped 719 Failed 18 - XXX - XXX That was on Win98SE. On Win2K: - XXX all.tcl Total 10480 Passed 9781 Skipped 698 Failed 1 + Optional: run tests, via + nmake -f makefile.vc test + + all.tcl: Total 10835 Passed 10096 Skipped 732 Failed 7 + Sourced 129 Test Files. + Files with failing tests: exec.test expr.test io.test main.test string.test stri + ngObj.test Build Tk -------- - cd dist\tk8.4.3\win - nmake -f makefile.vc TCLDIR=..\..\tcl8.4.3 - nmake -f makefile.vc TCLDIR=..\..\tcl8.4.3 INSTALLDIR=..\..\tcl84 install + cd dist\tk8.4.12\win + nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 + nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 INSTALLDIR=..\..\tcltk install XXX Should we compile with OPTS=threads? @@ -103,96 +100,59 @@ XXX failed. It popped up tons of little windows, and did lots of XXX stuff, and nothing blew up. - XXX Our installer copies a lot of stuff out of the Tcl/Tk install - XXX directory. Is all of that really needed for Python use of Tcl/Tk? - - Make sure the installer matches - ------------------------------- - Ensure that the Wise compiler vrbl _TCLDIR_ is set to the name of - the common Tcl/Tk installation directory (tcl84 for the instructions - above). This is needed so the installer can copy various Tcl/Tk - files into the Python distribution. - - -zlib - Python wrapper for the zlib compression library. Get the source code - for version 1.1.4 from a convenient mirror at: - http://www.gzip.org/zlib/ - Unpack into dist\zlib-1.1.4. - A custom pre-link step in the zlib project settings should manage to - build zlib-1.1.4\zlib.lib by magic before zlib.pyd (or zlib_d.pyd) is - linked in PCbuild\. - However, the zlib project is not smart enough to remove anything under - zlib-1.1.4\ when you do a clean, so if you want to rebuild zlib.lib - you need to clean up zlib-1.1.4\ by hand. + Built Tix + --------- + cd dist\tix-8.4.0\win + nmake -f python.mak + nmake -f python.mak install bz2 Python wrapper for the libbz2 compression library. Homepage http://sources.redhat.com/bzip2/ - Download the source tarball, bzip2-1.0.2.tar.gz. - Unpack into dist\bzip2-1.0.2. WARNING: If you're using WinZip, you - must disable its "TAR file smart CR/LF conversion" feature (under - Options -> Configuration -> Miscellaneous -> Other) for the duration. - - A custom pre-link step in the bz2 project settings should manage to - build bzip2-1.0.2\libbz2.lib by magic before bz2.pyd (or bz2_d.pyd) is - linked in PCbuild\. - However, the bz2 project is not smart enough to remove anything under - bzip2-1.0.2\ when you do a clean, so if you want to rebuild bzip2.lib - you need to clean up bzip2-1.0.2\ by hand. - - The build step shouldn't yield any warnings or errors, and should end - by displaying 6 blocks each terminated with - FC: no differences encountered - If FC finds differences, see the warning abou WinZip above (when I - first tried it, sample3.ref failed due to CRLF conversion). + Download the source from the python.org copy into the dist + directory: + + svn export http://svn.python.org/projects/external/bzip2-1.0.3 + + And requires building bz2 first. - All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python + cd dist\bzip2-1.0.3 + nmake -f makefile.msc + + All of this managed to build bzip2-1.0.3\libbz2.lib, which the Python project links in. _bsddb - Go to Sleepycat's download page: - http://www.sleepycat.com/download/ + To use the version of bsddb that Python is built with by default, invoke + (in the dist directory) + + svn export http://svn.python.org/projects/external/db-4.4.20 + + Then open db-4.4.20\build_win32\Berkeley_DB.dsw and build the "db_static" + project for "Release" mode. + + Alternatively, if you want to start with the original sources, + go to Sleepycat's download page: + http://www.sleepycat.com/downloads/releasehistorybdb.html + + and download version 4.4.20. - and download version 4.1.25. The file name is db-4.1.25.NC.zip. - XXX with or without strong cryptography? I picked "without". + With or without strong cryptography? You can choose either with or + without strong cryptography, as per the instructions below. By + default, Python is built and distributed WITHOUT strong crypto. - Unpack into - dist\db-4.1.25 + Unpack the sources; if you downloaded the non-crypto version, rename + the directory from db-4.4.20.NC to db-4.4.20. - [If using WinZip to unpack the db-4.1.25.NC distro, that requires - renaming the directory (to remove ".NC") after unpacking. - ] - - Open - dist\db-4.1.25\docs\index.html - - and follow the Windows instructions for building the Sleepycat - software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory. - Build the Release version ("build_all -- Win32 Release"). - - XXX We're actually linking against Release_static\libdb41s.lib. - XXX This yields the following warnings: -""" -Compiling... -_bsddb.c -Linking... - Creating library ./_bsddb.lib and object ./_bsddb.exp -LINK : warning LNK4049: locally defined symbol "_malloc" imported -LINK : warning LNK4049: locally defined symbol "_free" imported -LINK : warning LNK4049: locally defined symbol "_fclose" imported -LINK : warning LNK4049: locally defined symbol "_fopen" imported -_bsddb.pyd - 0 error(s), 4 warning(s) -""" - XXX This isn't encouraging, but I don't know what to do about it. + Now apply any patches that apply to your version. To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py is then enabled. Running in verbose mode may be helpful. XXX The test_bsddb3 tests don't always pass, on Windows (according to - XXX me) or on Linux (according to Barry). I had much better luck - XXX on Win2K than on Win98SE. The common failure mode across platforms + XXX me) or on Linux (according to Barry). (I had much better luck + XXX on Win2K than on Win98SE.) The common failure mode across platforms XXX is XXX DBAgainError: (11, 'Resource temporarily unavailable -- unable XXX to join the environment') Modified: python/branches/release25-maint/PC/VC6/zlib.dsp ============================================================================== --- python/branches/release25-maint/PC/VC6/zlib.dsp (original) +++ python/branches/release25-maint/PC/VC6/zlib.dsp Tue Oct 17 17:22:20 2006 @@ -1,109 +0,0 @@ -# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=zlib - 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 "zlib.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "zlib.mak" CFG="zlib - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "zlib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "zlib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "zlib" -# PROP Scc_LocalPath ".." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "zlib - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "." -# PROP Intermediate_Dir "x86-temp-release\zlib" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\..\Include" /I ".." /I "..\..\..\zlib-1.1.4" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib.pyd" -# SUBTRACT LINK32 /pdb:none -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=Checking static zlib has been built -PreLink_Cmds=cd ..\..\..\zlib-1.1.4 nmake -nologo -f msdos\makefile.w32 zlib.lib -# End Special Build Tool - -!ELSEIF "$(CFG)" == "zlib - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "." -# PROP Intermediate_Dir "x86-temp-debug\zlib" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Include" /I ".." /I "..\..\..\zlib-1.1.4" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\..\zlib-1.1.4\zlib.lib /nologo /base:"0x1e1B0000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./zlib_d.pyd" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Desc=Checking static zlib has been built -PreLink_Cmds=cd ..\..\..\zlib-1.1.4 nmake -nologo -f msdos\makefile.w32 zlib.lib -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "zlib - Win32 Release" -# Name "zlib - Win32 Debug" -# Begin Source File - -SOURCE=..\..\Modules\zlibmodule.c -# End Source File -# End Target -# End Project From buildbot at python.org Tue Oct 17 17:23:13 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:23:13 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20061017152313.B57A91E4136@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/1671 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:23:16 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:23:16 +0000 Subject: [Python-checkins] buildbot failure in MIPS Debian trunk Message-ID: <20061017152317.19F8B1E413A@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/449 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:23:24 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:23:24 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu dapper trunk Message-ID: <20061017152324.7F9391E413E@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/744 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:23:26 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:23:26 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20061017152326.4F5541E4142@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/1586 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:23:33 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:23:33 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian trunk Message-ID: <20061017152333.BC8261E4146@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/447 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:23:34 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:23:34 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD trunk Message-ID: <20061017152334.7A3A91E4146@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/1342 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:23:41 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:23:41 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k trunk Message-ID: <20061017152341.5CF7E1E414E@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/1575 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:24:02 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:24:02 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20061017152402.78E981E4152@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/1503 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:24:28 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:24:28 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20061017152428.633F51E415A@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/1518 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:25:00 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:25:00 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20061017152500.E78451E415E@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/1224 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:25:34 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:25:34 +0000 Subject: [Python-checkins] buildbot failure in x86 XP trunk Message-ID: <20061017152534.C58FB1E4163@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/3 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:27:27 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:27:27 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 2.5 Message-ID: <20061017152727.63B951E41C3@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/84 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:27:38 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:27:38 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu dapper 2.5 Message-ID: <20061017152738.216AC1E41C7@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/61 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:27:41 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:27:41 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 2.5 Message-ID: <20061017152741.EBBDE1E41CB@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/84 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:27:42 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:27:42 +0000 Subject: [Python-checkins] buildbot failure in MIPS Debian 2.5 Message-ID: <20061017152743.20FA51E41CE@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/44 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:27:45 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:27:45 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 2.5 Message-ID: <20061017152745.BB3F31E41CE@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/80 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:27:46 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:27:46 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 2.5 Message-ID: <20061017152746.671831E41D2@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/78 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:27:47 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:27:47 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k 2.5 Message-ID: <20061017152747.C4A5B1E41D2@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/83 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:27:50 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:27:50 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 2.5 Message-ID: <20061017152750.1ABBD1E41E3@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/79 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:27:53 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:27:53 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 2.5 Message-ID: <20061017152753.A7AF91E41E3@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/68 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:29:03 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:29:03 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 2.5 Message-ID: <20061017152903.293351E41EB@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/72 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:29:28 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:29:28 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk trunk Message-ID: <20061017152929.0B0EF1E4242@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/161 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:29:33 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:29:33 +0000 Subject: [Python-checkins] buildbot failure in hppa Ubuntu dapper trunk Message-ID: <20061017152933.D146F1E4246@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/153 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From anthony at interlink.com.au Tue Oct 17 17:28:53 2006 From: anthony at interlink.com.au (Anthony Baxter) Date: Wed, 18 Oct 2006 01:28:53 +1000 Subject: [Python-checkins] BRANCH FREEZE release24-maint, Wed 18th Oct, 00:00UTC Message-ID: <200610180128.57266.anthony@interlink.com.au> I'm declaring the branch frozen for 2.4.4 final from 00:00 UTC (that's about 8 hours from now). The release will either be Wednesday 18th or Thursday 19th. There's a blocking bug http://www.python.org/sf/1578513 - I've attached a patch for it, if someone with autoconf knowledge wants to review that it can be checked in. It _should_ be good, and probably needs to be applied to release25-maint and the trunk as well. Anthony -- Anthony Baxter It's never too late to have a happy childhood. From buildbot at python.org Tue Oct 17 17:30:05 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:30:05 +0000 Subject: [Python-checkins] buildbot failure in x86 XP 2.5 Message-ID: <20061017153005.E7ED21E43D3@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:35:50 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:35:50 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk 2.5 Message-ID: <20061017153550.B52591E44F2@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/76 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Oct 17 17:35:57 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 15:35:57 +0000 Subject: [Python-checkins] buildbot failure in hppa Ubuntu dapper 2.5 Message-ID: <20061017153557.5E9C81E4580@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/68 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Tue Oct 17 18:03:41 2006 From: python-checkins at python.org (anthony.baxter) Date: Tue, 17 Oct 2006 18:03:41 +0200 (CEST) Subject: [Python-checkins] r52358 - in python/branches/release24-maint: Misc/NEWS configure configure.in Message-ID: <20061017160341.338541E401A@bag.python.org> Author: anthony.baxter Date: Tue Oct 17 18:03:36 2006 New Revision: 52358 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/configure python/branches/release24-maint/configure.in Log: - Bug #1578513: Cross compilation was broken by a change to configure. Repair so that it's back to how it was in 2.4.3. Needs to be forward-ported to 2.5 branch and trunk. Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Oct 17 18:03:36 2006 @@ -9,6 +9,17 @@ *Release date: 11-OCT-2006* +Build +----- + +- Bug #1578513: Cross compilation was broken by a change to configure. +Repair so that it's back to how it was in 2.4.3. + +What's New in Python 2.4.4c1? +============================= + +*Release date: 11-OCT-2006* + Core and builtins ----------------- Modified: python/branches/release24-maint/configure ============================================================================== --- python/branches/release24-maint/configure (original) +++ python/branches/release24-maint/configure Tue Oct 17 18:03:36 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52098 . +# From configure.in Revision: 52231 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.4. # @@ -20565,55 +20565,38 @@ echo "$as_me:$LINENO: checking for /dev/ptmx" >&5 echo $ECHO_N "checking for /dev/ptmx... $ECHO_C" >&6 -if test "${ac_cv_file__dev_ptmx+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - test "$cross_compiling" = yes && - { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 -echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} - { (exit 1); exit 1; }; } -if test -r "/dev/ptmx"; then - ac_cv_file__dev_ptmx=yes -else - ac_cv_file__dev_ptmx=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_file__dev_ptmx" >&5 -echo "${ECHO_T}$ac_cv_file__dev_ptmx" >&6 -if test $ac_cv_file__dev_ptmx = yes; then + +if test -r /dev/ptmx +then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTMX 1 _ACEOF +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking for /dev/ptc" >&5 echo $ECHO_N "checking for /dev/ptc... $ECHO_C" >&6 -if test "${ac_cv_file__dev_ptc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - test "$cross_compiling" = yes && - { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 -echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} - { (exit 1); exit 1; }; } -if test -r "/dev/ptc"; then - ac_cv_file__dev_ptc=yes -else - ac_cv_file__dev_ptc=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_file__dev_ptc" >&5 -echo "${ECHO_T}$ac_cv_file__dev_ptc" >&6 -if test $ac_cv_file__dev_ptc = yes; then + +if test -r /dev/ptc +then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTC 1 _ACEOF +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - echo "$as_me:$LINENO: checking for socklen_t" >&5 echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 if test "${ac_cv_type_socklen_t+set}" = set; then Modified: python/branches/release24-maint/configure.in ============================================================================== --- python/branches/release24-maint/configure.in (original) +++ python/branches/release24-maint/configure.in Tue Oct 17 18:03:36 2006 @@ -3202,8 +3202,27 @@ [Define if WINDOW in curses.h offers a field _flags.]) fi -AC_CHECK_FILE(/dev/ptmx, AC_DEFINE(HAVE_DEV_PTMX, 1, [Define if we have /dev/ptmx.])) -AC_CHECK_FILE(/dev/ptc, AC_DEFINE(HAVE_DEV_PTC, 1, [Define if we have /dev/ptc.])) +AC_MSG_CHECKING(for /dev/ptmx) + +if test -r /dev/ptmx +then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DEV_PTMX, 1, + [Define if we have /dev/ptmx.]) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(for /dev/ptc) + +if test -r /dev/ptc +then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DEV_PTC, 1, + [Define if we have /dev/ptc.]) +else + AC_MSG_RESULT(no) +fi AC_CHECK_TYPE(socklen_t,, AC_DEFINE(socklen_t,int, From python-checkins at python.org Tue Oct 17 18:07:58 2006 From: python-checkins at python.org (anthony.baxter) Date: Tue, 17 Oct 2006 18:07:58 +0200 (CEST) Subject: [Python-checkins] r52359 - in python/branches/release24-maint: Doc/commontex/boilerplate.tex Include/patchlevel.h Lib/idlelib/NEWS.txt Lib/idlelib/idlever.py Misc/NEWS Misc/RPM/python-2.4.spec Message-ID: <20061017160758.CFD9B1E401A@bag.python.org> Author: anthony.baxter Date: Tue Oct 17 18:07:57 2006 New Revision: 52359 Modified: python/branches/release24-maint/Doc/commontex/boilerplate.tex python/branches/release24-maint/Include/patchlevel.h python/branches/release24-maint/Lib/idlelib/NEWS.txt python/branches/release24-maint/Lib/idlelib/idlever.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Misc/RPM/python-2.4.spec Log: preparing for 2.4.4 final 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 17 18:07:57 2006 @@ -5,5 +5,5 @@ Email: \email{docs at python.org} } -\date{11 October 2006} % XXX update before final release! +\date{18 October 2006} % XXX update before final release! \input{patchlevel} % include Python version information 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 17 18:07:57 2006 @@ -22,11 +22,11 @@ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 4 #define PY_MICRO_VERSION 4 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.4.4c1" +#define PY_VERSION "2.4.4" /* 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/Lib/idlelib/NEWS.txt ============================================================================== --- python/branches/release24-maint/Lib/idlelib/NEWS.txt (original) +++ python/branches/release24-maint/Lib/idlelib/NEWS.txt Tue Oct 17 18:07:57 2006 @@ -1,3 +1,8 @@ +What's New in IDLE 1.1.4? +========================= + +*Release date: 18-OCT-2006* + What's New in IDLE 1.1.4c1? =========================== 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 17 18:07:57 2006 @@ -1 +1 @@ -IDLE_VERSION = "1.1.4c1" +IDLE_VERSION = "1.1.4" Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Oct 17 18:07:57 2006 @@ -4,10 +4,10 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) -What's New in Python 2.4.4c1? -============================= +What's New in Python 2.4.4? +=========================== -*Release date: 11-OCT-2006* +*Release date: 18-OCT-2006* Build ----- 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 17 18:07:57 2006 @@ -33,7 +33,7 @@ ################################# %define name python -%define version 2.4.4c1 +%define version 2.4.4 %define libvers 2.4 %define release 1pydotorg %define __prefix /usr From neal at metaslash.com Tue Oct 17 18:50:07 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 17 Oct 2006 12:50:07 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061017165007.GA30054@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 17 19:06:01 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 17:06:01 +0000 Subject: [Python-checkins] buildbot warnings in x86 Ubuntu edgy (icc) 2.4 Message-ID: <20061017170601.78F451E421B@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu edgy (icc) 2.4. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520edgy%2520%2528icc%2529%25202.4/builds/205 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 neal at metaslash.com Tue Oct 17 19:50:05 2006 From: neal at metaslash.com (Neal Norwitz) Date: Tue, 17 Oct 2006 13:50:05 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20061017175005.GA30354@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 17 20:09:56 2006 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 17 Oct 2006 20:09:56 +0200 (CEST) Subject: [Python-checkins] r52360 - python/trunk/PC/VC6/zlib.dsp Message-ID: <20061017180956.453811E4004@bag.python.org> Author: martin.v.loewis Date: Tue Oct 17 20:09:55 2006 New Revision: 52360 Removed: python/trunk/PC/VC6/zlib.dsp Log: Remove obsolete file. Will backport. Deleted: /python/trunk/PC/VC6/zlib.dsp ============================================================================== From python-checkins at python.org Tue Oct 17 20:10:10 2006 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 17 Oct 2006 20:10:10 +0200 (CEST) Subject: [Python-checkins] r52361 - python/branches/release25-maint/PC/VC6/zlib.dsp Message-ID: <20061017181010.2E6051E4004@bag.python.org> Author: martin.v.loewis Date: Tue Oct 17 20:10:09 2006 New Revision: 52361 Removed: python/branches/release25-maint/PC/VC6/zlib.dsp Log: Remove obsolete file. Deleted: /python/branches/release25-maint/PC/VC6/zlib.dsp ============================================================================== From python-checkins at python.org Tue Oct 17 20:59:14 2006 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 17 Oct 2006 20:59:14 +0200 (CEST) Subject: [Python-checkins] r52362 - in python/branches/release25-maint: Misc/NEWS configure configure.in Message-ID: <20061017185914.9BB211E4011@bag.python.org> Author: martin.v.loewis Date: Tue Oct 17 20:59:06 2006 New Revision: 52362 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/configure python/branches/release25-maint/configure.in Log: Forward-port r52358: - Bug #1578513: Cross compilation was broken by a change to configure. Repair so that it's back to how it was in 2.4.3. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Tue Oct 17 20:59:06 2006 @@ -104,6 +104,9 @@ Build ----- +- Bug #1578513: Cross compilation was broken by a change to configure. + Repair so that it's back to how it was in 2.4.3. + - Patch #1576954: Update VC6 build directory; remove redundant files in VC7. Modified: python/branches/release25-maint/configure ============================================================================== --- python/branches/release25-maint/configure (original) +++ python/branches/release25-maint/configure Tue Oct 17 20:59:06 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52087 . +# From configure.in Revision: 52090 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.5. # @@ -22051,55 +22051,38 @@ echo "$as_me:$LINENO: checking for /dev/ptmx" >&5 echo $ECHO_N "checking for /dev/ptmx... $ECHO_C" >&6 -if test "${ac_cv_file__dev_ptmx+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - test "$cross_compiling" = yes && - { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 -echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} - { (exit 1); exit 1; }; } -if test -r "/dev/ptmx"; then - ac_cv_file__dev_ptmx=yes -else - ac_cv_file__dev_ptmx=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_file__dev_ptmx" >&5 -echo "${ECHO_T}$ac_cv_file__dev_ptmx" >&6 -if test $ac_cv_file__dev_ptmx = yes; then + +if test -r /dev/ptmx +then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTMX 1 _ACEOF +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking for /dev/ptc" >&5 echo $ECHO_N "checking for /dev/ptc... $ECHO_C" >&6 -if test "${ac_cv_file__dev_ptc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - test "$cross_compiling" = yes && - { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 -echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} - { (exit 1); exit 1; }; } -if test -r "/dev/ptc"; then - ac_cv_file__dev_ptc=yes -else - ac_cv_file__dev_ptc=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_file__dev_ptc" >&5 -echo "${ECHO_T}$ac_cv_file__dev_ptc" >&6 -if test $ac_cv_file__dev_ptc = yes; then + +if test -r /dev/ptc +then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTC 1 _ACEOF +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - echo "$as_me:$LINENO: checking for %zd printf() format support" >&5 echo $ECHO_N "checking for %zd printf() format support... $ECHO_C" >&6 if test "$cross_compiling" = yes; then Modified: python/branches/release25-maint/configure.in ============================================================================== --- python/branches/release25-maint/configure.in (original) +++ python/branches/release25-maint/configure.in Tue Oct 17 20:59:06 2006 @@ -3338,8 +3338,27 @@ AC_MSG_RESULT(no) ) -AC_CHECK_FILE(/dev/ptmx, AC_DEFINE(HAVE_DEV_PTMX, 1, [Define if we have /dev/ptmx.])) -AC_CHECK_FILE(/dev/ptc, AC_DEFINE(HAVE_DEV_PTC, 1, [Define if we have /dev/ptc.])) +AC_MSG_CHECKING(for /dev/ptmx) + +if test -r /dev/ptmx +then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DEV_PTMX, 1, + [Define if we have /dev/ptmx.]) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(for /dev/ptc) + +if test -r /dev/ptc +then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DEV_PTC, 1, + [Define if we have /dev/ptc.]) +else + AC_MSG_RESULT(no) +fi AC_MSG_CHECKING(for %zd printf() format support) AC_TRY_RUN([#include From python-checkins at python.org Tue Oct 17 20:59:30 2006 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 17 Oct 2006 20:59:30 +0200 (CEST) Subject: [Python-checkins] r52363 - in python/trunk: Misc/NEWS configure configure.in Message-ID: <20061017185930.332191E4011@bag.python.org> Author: martin.v.loewis Date: Tue Oct 17 20:59:23 2006 New Revision: 52363 Modified: python/trunk/Misc/NEWS python/trunk/configure python/trunk/configure.in Log: Forward-port r52358: - Bug #1578513: Cross compilation was broken by a change to configure. Repair so that it's back to how it was in 2.4.3. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Oct 17 20:59:23 2006 @@ -219,6 +219,9 @@ Build ----- +- Bug #1578513: Cross compilation was broken by a change to configure. + Repair so that it's back to how it was in 2.4.3. + - Patch #1576954: Update VC6 build directory; remove redundant files in VC7. Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Tue Oct 17 20:59:23 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52086 . +# From configure.in Revision: 52089 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.6. # @@ -22051,55 +22051,38 @@ echo "$as_me:$LINENO: checking for /dev/ptmx" >&5 echo $ECHO_N "checking for /dev/ptmx... $ECHO_C" >&6 -if test "${ac_cv_file__dev_ptmx+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - test "$cross_compiling" = yes && - { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 -echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} - { (exit 1); exit 1; }; } -if test -r "/dev/ptmx"; then - ac_cv_file__dev_ptmx=yes -else - ac_cv_file__dev_ptmx=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_file__dev_ptmx" >&5 -echo "${ECHO_T}$ac_cv_file__dev_ptmx" >&6 -if test $ac_cv_file__dev_ptmx = yes; then + +if test -r /dev/ptmx +then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTMX 1 _ACEOF +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking for /dev/ptc" >&5 echo $ECHO_N "checking for /dev/ptc... $ECHO_C" >&6 -if test "${ac_cv_file__dev_ptc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - test "$cross_compiling" = yes && - { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 -echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} - { (exit 1); exit 1; }; } -if test -r "/dev/ptc"; then - ac_cv_file__dev_ptc=yes -else - ac_cv_file__dev_ptc=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_file__dev_ptc" >&5 -echo "${ECHO_T}$ac_cv_file__dev_ptc" >&6 -if test $ac_cv_file__dev_ptc = yes; then + +if test -r /dev/ptc +then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTC 1 _ACEOF +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - echo "$as_me:$LINENO: checking for %zd printf() format support" >&5 echo $ECHO_N "checking for %zd printf() format support... $ECHO_C" >&6 if test "$cross_compiling" = yes; then Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Tue Oct 17 20:59:23 2006 @@ -3338,8 +3338,27 @@ AC_MSG_RESULT(no) ) -AC_CHECK_FILE(/dev/ptmx, AC_DEFINE(HAVE_DEV_PTMX, 1, [Define if we have /dev/ptmx.])) -AC_CHECK_FILE(/dev/ptc, AC_DEFINE(HAVE_DEV_PTC, 1, [Define if we have /dev/ptc.])) +AC_MSG_CHECKING(for /dev/ptmx) + +if test -r /dev/ptmx +then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DEV_PTMX, 1, + [Define if we have /dev/ptmx.]) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(for /dev/ptc) + +if test -r /dev/ptc +then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DEV_PTC, 1, + [Define if we have /dev/ptc.]) +else + AC_MSG_RESULT(no) +fi AC_MSG_CHECKING(for %zd printf() format support) AC_TRY_RUN([#include From python-checkins at python.org Tue Oct 17 21:20:51 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 17 Oct 2006 21:20:51 +0200 (CEST) Subject: [Python-checkins] r52364 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061017192051.E107E1E4004@bag.python.org> Author: brett.cannon Date: Tue Oct 17 21:20:50 2006 New Revision: 52364 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Rework the py/pyc handler. Factor out a superclass that implements the algorithm for verifying bytecode, using either bytecode or source, and possibly regenerating bytecode. The algorithm itself makes no assumptions and uses supporting methods for specific details of how to get the source or bytecode. Also added a py/pyc filesystem handler that subclasses the generic superclass. This class assumes a simple file-like interface on the source and bytecode. Files work right off, but StringIO instances work if one adds on a 'name' interface. 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 17 21:20:50 2006 @@ -1,10 +1,5 @@ """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 @@ -24,64 +19,51 @@ 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. + * Is module returned by load_module() actually used for anything? + +Things to be exposed at the Python level: + * Python/marshal.c:r_long()/w_long() Possible Py3K improvements: - * Have __import__ check for sys.modules entry to alleviate need for every - loader to do so. - * 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 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. - - 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. +* Have a meta_path entry for checking sys.modules to remove need for + loaders to do it. +* 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 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. + - 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. +* Loaders don't have to return the loaded module. + + Since they have the responsibility of adding it to sys.modules, there + no real need. + + Importing the module being imported in a circular import dependency + requires that module added to sys.modules stay consistent from the + point it is added to initialization. + +Rejected Py3K improvements: +* Passing in new module to loaders + Creating a new module is minimal and loader might want to use a different + type of object. 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' +* 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). Also do not pass in a source provider for - the bytecode handler so as to suppress that writing of new bytecode. +* Simple way + + XXX +* Feature-rich way + + XXX + +sqlite3 importer use-case: +* Simple way + + XXX +* Feature-rich way + + XXX """ from __future__ import with_statement @@ -89,12 +71,14 @@ import imp import sys import marshal -# XXX Importing os will not work in the end as it is implemented in Python -# itself. +# XXX Following imports will eventually need to be removed since they involve +# Python source. import os +import contextlib +import py_compile -class BuiltinFrozen_Importer(object): +class BuiltinFrozenBaseImporter(object): """Base class for meta_path importers for built-in and frozen modules. @@ -139,7 +123,7 @@ return mod -class BuiltinImporter(BuiltinFrozen_Importer): +class BuiltinImporter(BuiltinFrozenBaseImporter): """sys.meta_path class for importing built-in modules.""" @@ -147,7 +131,7 @@ _load = imp.init_builtin -class FrozenImporter(BuiltinFrozen_Importer): +class FrozenImporter(BuiltinFrozenBaseImporter): """sys.meta_path class for importing frozen modules.""" @@ -206,7 +190,7 @@ if os.path.isfile(file_path): raise StopIteration("file found") except StopIteration: - return FileSystemLoader(file_path, handler) + return FileSystemLoader(file_path, handler, file_ext) else: return None @@ -215,14 +199,16 @@ """Loader for the filesystem.""" - def __init__(self, file_path, handler): + def __init__(self, file_path, handler, chosen_handle): + """Store arguments on to the instance.""" self.file_path = file_path self.handler = handler + self.chosen_handle = chosen_handle def load_module(self, fullname, path=None): """Load the module from self.path using self.handler. - The handler is expected to implement a handle_file method that will + The handler is expected to implement a handle_code method that will deal with initializing the module passed to it. """ @@ -232,126 +218,280 @@ 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 + module.__file__ = self.file_path + module.__name__ = fullname + try: + with open(self.file_path) as code_file: + self.handler.handle_code(module, code_file, + self.chosen_handle) + except: + del sys.modules[fullname] + raise return module -class PySourceHandler(object): - - """Handler for importing Python source modules.""" +class PyPycBaseHandler(object): - # 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',) + """Superclass for reading bytecode and/or source code for initializing a + module (with optional recreating of bytecode as needed). + + The entry point of the class is handle_code(). All other methods are + provided for overriding to control how bytecode/source handling algorithm + gets what it needs. handle_code() treats source code and bytecode as + opaque objects that are passed around to the proper methods for handling. + This allows storage back-ends to use the algorithm in handle_code() while + not having to worry about any assumptions about how source or bytecode are + dealt with. It also allows for possible source or bytecode translations + before a code object is expected for initializing the module. - def get_code(self, file_path): - """Return the code object as stored at file_path. + To suppress the implicit use of source code when handling bytecode (or to + suppress writing new bytecode when handling source code), set the proper + argument passed to the object initializer to a False value. This allows + for subclasses to skip having to implement support for handling source code + (or bytecode) if it is not needed/desired. + + """ + + def __init__(self, source_handles, bytecode_handles): + """Specify the handles for source and bytecode to be handled by this + handler and set 'handles' appropriately. - Provided for use by PyBytecodeHandler to recreate bytecode for a source - file. + If either source code or bytecode are not to be used, pass in a false + value for the appropriate argument. """ - with open(file_path, 'rU') as source_file: - source_code = source_file.read() - return compile(source_code, file_path, 'exec') + if not source_handles: + self.source_handles = tuple() + else: + self.source_handles = source_handles + if not bytecode_handles: + self.bytecode_handles = tuple() + else: + self.bytecode_handles = bytecode_handles + self.handles = self.bytecode_handles + self.source_handles + + def find_source_to_read(self, opaque_bytecode): + """Return the opaque source object corresponding to the opaque + bytecode object for reading, or None if no corresponding source exists. + + Meant to be overridden as needed (always returns None otherwise). + + """ + return None + + def find_bytecode_to_write(self, opaque_source): + """Return the opaque bytecode object that corresponds to the opaque + source object for writing, or None if no corresponding bytecode exists. + + Meant to be overridden as needed (always returns None otherwise). + + """ + return None + + def get_location(self, opaque_code): + """Return the "location" of the opaque object.""" + raise NotImplementedError + + def get_bytecode(self, opaque_bytecode): + """Return the magic number, timestamp, and bytecode from the opaque + bytecode object.""" + raise NotImplementedError + + def get_code_from_bytecode(self, bytecode): + """Return the code object created from the bytecode.""" + return marshal.loads(bytecode) + + def verify_magic(self, magic_number): + """Compare the given magic_number against the one the interpreter + uses.""" + return True + # XXX Won't work until can unmarshal longs. + return True if magic_number == imp.get_magic() else False + + def verify_timestamp(self, timestamp, opaque_source): + """Verify the timestamp against the opaque source object.""" + raise NotImplementedError + + def get_code_from_source(self, opaque_source): + """Return a code object created from the opaque source object along + with the timestamp of the opaque object. + + The timestamp needs to be returned for possible recreation of the + bytecode. This is to prevent the possible race condition where the + bytecode's timestamp is used; if the source is modified between reading + it and the writing out of the bytecode then the bytecode would not be + recreated. + + """ + raise NotImplementedError + + def write_bytecode(self, code_object, opaque_bytecode, timestamp): + """Dump the code object on to the opaque bytecode object using the + specified timestamp.""" + raise NotImplementedError + + def handle_code(self, module, opaque_code, handle_this): + """Initialize the module using the opaque code object (treating it as + specified by the passed-in handle). + + If an opaque bytecode object was passed in, first verify its magic + number and timestamp. If it checks out, it will be used to initialize + the module. If the bytecode is invalid, then try to fetch the + corresponding source code. If it can be found, use it and recreate + the bytecode if possible (if bytecode cannot be recreated, assign the + proper value to __file__). If no source can be found, raise + ImportError. + + If an opaque source object was given, use it to initialize the module. + Also recreate the bytecode (if desired based on whether any bytecode + handles are listed) since either it does not exist yet (based + on the fact that bytecode are listed to be handled first) or it + was found to be invalid. - def handle_file(self, module, fullname, path, file_path): - """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) - exec compiled_code in module.__dict__ + """ + if handle_this in self.bytecode_handles: + # Asked to handle bytecode. + try: + magic, timestamp, bytecode = self.get_bytecode(opaque_code) + # Need source code no matter what (if source code is supported + # by handler); for timestamp check or to see if source can be + # used if magic number check failed. + if self.source_handles: + opaque_source = self.find_source_to_read(opaque_code) + else: + opaque_source = None + if not self.verify_magic(magic): + raise ImportError("bad magic number") + if (opaque_source and + not self.verify_timestamp(timestamp, opaque_source)): + raise ImportError("outdated timestamp") + except ImportError, exc: + if not self.source_handles or not opaque_source: + # Bytecode invalid and no source to recreate from, so error + # out. + raise + else: + # Bytecode invalid, but source exists to work from. + pass + else: + # Bytecode is valid. + code_object = self.get_code_from_bytecode(bytecode) + exec code_object in module.__dict__ + return module + # Either the handler was requested to handle source or the bytecode was + # found to be stale. Regardless, source code was already fetched. + if handle_this in self.source_handles: + # Requested to handle source. + opaque_source = opaque_code + code_object, timestamp = self.get_code_from_source(opaque_source) + elif self.bytecode_handles: + # Bytecode was invalid. + code_object, timestamp = self.get_code_from_source(opaque_source) + else: + # Should never be reached; importer should have stated that module + # could not be imported. + raise ImportError("no source or bytecode handles specified") + exec code_object in module.__dict__ + if self.bytecode_handles: + opaque_bytecode = self.find_bytecode_to_write(opaque_source) + if opaque_bytecode: + # Recreate bytecode. + self.write_bytecode(code_object, opaque_bytecode, timestamp) + else: + # Need to reassign __name__ since bytecode that was supposed + # to use was bad and we could not update to make it as if we + # has used it. + module.__file__ = self.get_location(opaque_source) return module -class PyBytecodeHandler(object): - - """Handler for importing .pyc/.pyo modules. +class PyPycFileHandler(PyPycBaseHandler): + + """Handler for source code and bytecode files. - 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. + All methods that work with opaque objects expect a file-like interface: + * read(n=-1) + Read n bytes from the file, or all bytes if no argument is given. + * close() + Close the file. It is a no-op if called previously. + * name + Attribute with the location to the file. If source and bytecode are + not both used by an instance of this class then the values does not + need to be a valid path, otherwise care needs to be taken to make sure + the value is reasonable. + + The file type by default implements the required interface. StringIO + objects require the 'name' attribute to be set. """ - def __init__(self, source_provider=None): - """Store a source handler in case bytecode is invalid. + def __init__(self, source_handles=None, bytecode_handles=None): + """Set the file extensions to be handled. - 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. + Not passing an argument (or setting to None) for either type of file + extension will lead to default values being used. """ - self.source_provider = source_provider - self.handles = ('.pyc',) if __debug__ else ('.pyo',) + if source_handles is None: + source_handles = ('.py',) + if bytecode_handles is None: + bytecode_handles = ('.pyc',) if __debug__ else ('.pyo',) + super(PyPycFileHandler, self).__init__(source_handles, + bytecode_handles) - 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_provider is None: - return None - 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 - - 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() - timestamp = os.stat(source_path).st_mtime - 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) - 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'.""" - with open(file_path, 'rb') as bytecode_file: + def find_source_to_read(self, bytecode_file): + """Return the file object to the corresponding source code.""" + base, ext = os.path.splitext(self.get_location(bytecode_file)) + return open(base + self.source_handles[-1], 'U') + + def find_bytecode_to_write(self, source_file): + """Return the file object to the corresponding bytecode.""" + base, ext = os.path.splitext(self.get_location(source_file)) + return open(base + self.bytecode_handles[-1], 'wb') + + def get_location(self, file_object): + """Return the path to the file object.""" + return file_object.name + + def get_bytecode(self, bytecode_file): + """Return the magic number, timestamp, and bytecode from the bytecode + file.""" + with contextlib.closing(bytecode_file): magic = 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 \ No newline at end of file + bytecode = bytecode_file.read() + # XXX Need Python/marshal.c:r_long() to properly convert magic number + # and timestamp. + return magic, timestamp, bytecode + + def verify_timestamp(self, bytecode_timestamp, source_file): + """Verify that 'timestamp' is newer than the modification time for + 'source_path'.""" + return True + # XXX Won't work until can unmarshal longs. + source_path = self.get_location(source_file) + source_timestamp = os.stat(source_path).st_mtime + return source_timestamp <= bytecode_timestamp + + def get_code_from_source(self, source_file): + """Return the code object created from the source code file and the + timestamp on the source file.""" + with contextlib.closing(source_file): + source_code = source_file.read() + source_location = self.get_location(source_file) + timestamp = os.stat(source_location).st_mtime + code_object = compile(source_code, self.get_location(source_file), + 'exec') + return code_object, timestamp + + def write_bytecode(self, code_object, bytecode_file, timestamp): + """Write out code_object to the file location bytecode_path with the + passed-in timestamp.""" + # XXX w/o being able to marshal longs, we need to use py_compile. + with contextlib.closing(bytecode_file): + source_file = self.find_source_to_read(bytecode_file) + with contextlib.closing(source_file): + source_location = self.get_location(source_file) + bytecode_location = self.get_location(bytecode_file) + py_compile.compile(source_location, bytecode_location, doraise=True) \ No newline at end of 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 Tue Oct 17 21:20:50 2006 @@ -1,13 +1,18 @@ from __future__ import with_statement +import importer + import unittest from test import test_support -import importer -import sys -import StringIO -import os -import tempfile + +import contextlib +import imp +import marshal import new +import os import py_compile +import StringIO +import sys +import tempfile class BuiltinFrozen_Tester(unittest.TestCase): @@ -121,78 +126,87 @@ del sys.modules[self.module] except KeyError: pass + self.gen_source_and_bytecode() + self.module_object = new.module(self.module) + + + def tearDown(self): + """If the temporary path was used, make sure to clean up.""" + if os.path.exists(self.source_path): + os.remove(self.source_path) + if os.path.exists(self.bytecode_path): + os.remove(self.bytecode_path) + + def gen_source(self): + """Generate a source code file.""" self.directory = tempfile.gettempdir() - self.source_path = os.path.join(self.directory, self.module+'.py') self.attr_name = 'test_attr' self.attr_value = None + self.source_path = os.path.join(self.directory, self.module+'.py') + self.source = '%s = %r' % (self.attr_name, self.attr_value) 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) + py_file.write(self.source) + + def gen_source_and_bytecode(self): + """Generate a bytecode file, which implicitly generates source file.""" + self.gen_source() 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.source_path) - os.remove(self.bytecode_path) + py_compile.compile(self.source_path, doraise=True) + self.code_object = compile(self.source, self.bytecode_path, 'exec') + self.bytecode = marshal.dumps(self.code_object) - def verify_module(self, module, file_path): + def verify_module(self, module, file_path=None): """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__, file_path) + if file_path: + self.failUnlessEqual(module.__name__, self.module) + 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(PyPycFileHelper): +class FileSystemImporterTests(PyPycFileHelper): + + """Test the filesystem importer.""" - """Test the Python source code handler.""" - def setUp(self): - """Create a handler to use for each test.""" - super(self.__class__, self).setUp() - self.handler = importer.PySourceHandler() - - def test_handle(self): - # Should claim it handles 'py' data. - self.failUnlessEqual(self.handler.handles, ('.py',)) + """Create a basic importer.""" + super(FileSystemImporterTests, self).setUp() + source_handler = importer.PyPycFileHandler(bytecode_handles=False) + self.importer = importer.FileSystemImporter(self.directory, + source_handler) - def test_handle_file_module(self): - # 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.source_path) - self.verify_module(new_module, self.source_path) + 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.PyPycFileHandler)) + 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) -class BytecodeHandlerTests(PyPycFileHelper): - - """Tests for the bytecode handler.""" - - def setUp(self): - """Make sure that the module has its bytecode generated.""" - super(self.__class__, self).setUp() - self.handler = importer.PyBytecodeHandler() - - def test_handles_attr(self): - # 'handles' should return 'pyc' or 'pyo' depending on __debug__. - try: - importer.__debug__ = True - handler = importer.PyBytecodeHandler() - self.failUnlessEqual(handler.handles, ('.pyc',)) - importer.__debug__ = False - handler = importer.PyBytecodeHandler() - self.failUnlessEqual(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.bytecode_path) - self.verify_module(new_module, self.bytecode_path) + def test_find_module_multiple_handlers(self): + # Modules should be found based on the order of the handlers. + source_handler = importer.PyPycFileHandler(bytecode_handles=False) + bytecode_handler = importer.PyPycFileHandler(source_handles=False) + fs_importer = importer.FileSystemImporter(self.directory, + bytecode_handler, source_handler) + 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.PyPycFileHandler)) + + 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]) class FileSystemLoaderTests(PyPycFileHelper): @@ -201,9 +215,11 @@ def setUp(self): """Create a fresh loader per run.""" - super(self.__class__, self).setUp() + super(FileSystemLoaderTests, self).setUp() + source_handler = importer.PyPycFileHandler(bytecode_handles=False) self.loader = importer.FileSystemLoader(self.source_path, - importer.PySourceHandler()) + source_handler, + source_handler.handles[0]) def test_load_module_fresh(self): # Test a basic module load where there is no sys.modules entry. @@ -214,62 +230,367 @@ 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 + sys.modules[self.module] = self.module_object loaded_module = self.loader.load_module(self.module) - self.failUnless(loaded_module is new_module) + self.failUnless(loaded_module is self.module_object) - -class FileSystemImporterTests(PyPycFileHelper): + def test_sys_module_cleared_on_error(self): + # Any entry made for module into sys.modules should be cleared upon error. + class RaiseErrorHandler(object): + def handle_code(*args): + raise ImportError + + loader = importer.FileSystemLoader(self.source_path, RaiseErrorHandler(), 'A') + try: + loader.load_module(self.module) + except ImportError: + self.failUnless(self.module not in sys.modules) + + +class PyPycBaseHandlerTests(PyPycFileHelper): - """Test the filesystem importer.""" + """Test py/pyc base handler class.""" def setUp(self): - """Create a basic importer.""" - super(self.__class__, self).setUp() - self.importer = importer.FileSystemImporter(self.directory, - importer.PySourceHandler()) + """Create a basic handler instance.""" + super(PyPycBaseHandlerTests, self).setUp() + self.handler = importer.PyPycBaseHandler(False, False) - 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_init(self): + # Make sure initialization does what it needs to do. + self.failUnlessEqual(self.handler.handles, tuple()) + handler = importer.PyPycBaseHandler(('B',), ('A',)) + self.failUnlessEqual(handler.handles, ('A', 'B')) + handler= importer.PyPycBaseHandler(('A',), False) + self.failUnlessEqual(handler.handles, ('A',)) + handler = importer.PyPycBaseHandler(False, ('A',)) + self.failUnlessEqual(handler.handles, ('A',)) - 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_not_implemented(self): + # The test methods should all raise NotImplementedError + one_argument = (self.handler.get_location, self.handler.get_bytecode, + self.handler.get_code_from_source) + for method in one_argument: + self.failUnlessRaises(NotImplementedError, method, None) + self.failUnlessRaises(NotImplementedError, + self.handler.verify_timestamp, None, None) + self.failUnlessRaises(NotImplementedError, + self.handler.write_bytecode, None, None, 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_source_to_read(self): + # Should return None no matter what the arguments. + self.failUnlessEqual(self.handler.find_source_to_read(None), None) - 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_find_bytecode_to_write(self): + # Should return None regardless of its argument. + self.failUnlessEqual(self.handler.find_bytecode_to_write(None), None) + + def test_get_code_from_bytecode(self): + # Make sure you can parse a bytecode file. + handler = importer.PyPycBaseHandler(False, False) + code_object = handler.get_code_from_bytecode(self.bytecode) + exec code_object in self.module_object.__dict__ + self.verify_module(self.module_object) + + def test_verify_magic(self): + # Test checking the magic number for bytecode. + return # XXX + self.failUnless(self.handler.verify_magic(imp.get_magic())) + self.failUnless(not self.handler.verify_magic(imp.get_magic()-1)) + + def test_invalid_handler(self): + # If handle_code is called with a handler that is not registered, + # ImportError should be raised. + self.failUnlessRaises(ImportError, self.handler.handle_code, + None, None, 'A') + + def test_source_only_API(self): + # If only a source handle is registered, make sure bytecode-related + # methods are not called. + class SourceOnlyAPITester(importer.PyPycBaseHandler): + def __init__(self, tester, source_handles, bytecode_handles): + super(SourceOnlyAPITester, self).__init__(source_handles, + bytecode_handles) + self.tester = tester + def verify_magic(self, ignore): + """Normally implemented, but should not be called.""" + raise NotImplementedError + def find_bytecode_to_write(self, ignore): + """Normally returns None, but should not be called.""" + raise NotImplementedError + def get_code_from_bytecode(self, ignore): + """Normally implemented, but should not be called.""" + raise NotImplementedError + def get_code_from_source(self, ignore): + return self.tester.code_object, 0 + + handler = SourceOnlyAPITester(self, ('A',), False) + handler.handle_code(self.module_object, None, 'A') + self.verify_module(self.module_object) + + def test_bytecode_only_API(self): + # If only bytecode handle registered then only bytecode-related + # methods should be called. + class BytecodeOnlyAPITester(importer.PyPycBaseHandler): + def verify_timestamp(self, ignore, ignore2): + return True + def get_bytecode(self, bytecode): + return imp.get_magic(), 0, bytecode + + handler = BytecodeOnlyAPITester(False, ('A',)) + handler.handle_code(self.module_object, self.bytecode, 'A') + self.verify_module(self.module_object) + + def test_bad_magic(self): + # If bytecode returns a bad magic number and there is no corresponding + # source, then ImportError should be raised. + class Tester(importer.PyPycBaseHandler): + def get_bytecode(self, bytecode): + return 0, 0, bytecode + def verify_magic(self, ignore): + return False + + handler = Tester(False, ('A',)) + self.failUnlessRaises(ImportError, handler.handle_code, + self.module_object, self.bytecode, 'A') + + def test_bad_timestamp(self): + # If bytecode fails timestamp, source should be used. + class Tester(importer.PyPycBaseHandler): + def get_bytecode(self, ignore): + return 0, 0, 0 + def verify_magic(self, ignore): + return True + def verify_timestamp(self, ignore, ignore2): + return False + def find_source_to_read(self, ignore): + """Assign code_object after instantiation.""" + return self.code_object + def find_bytecode_to_write(self, ignore): + return 'bytecode found' + def get_code_from_source(self, code_object): + return code_object, 0 + def write_bytecode(self, code_object, bytecode, timestamp): + if bytecode != 'bytecode found': + raise ValueError + if self.code_object is not code_object: + raise ValueError + if timestamp != 0: + raise ValueError + + handler = Tester(('B',), ('A',)) + handler.code_object = self.code_object + handler.handle_code(self.module_object, None, 'A') + self.verify_module(self.module_object) + + # Test that if bytecode cannot be found, write_bytecode is not called. + # Also verify that get_location is called and result is used for + # module.__file__ . + Tester.find_bytecode_to_write = lambda ignore, ignore2: None + Tester.write_bytecode = lambda ignore, ignore2, ignore3, ignore4: 1 / 0 + Tester.get_location = lambda ignore, ignore2: 'get_location' + new_module = new.module(self.module) + handler.handle_code(new_module, None, 'A') + self.failUnlessEqual(new_module.__file__, 'get_location') + self.verify_module(new_module) + + def test_write_bytecode(self): + # If source is passed in, then bytecode should be written out. + # Writing out of bytecode when it was invalid is tested in + # test_bad_timestamp. + class Tester(importer.PyPycBaseHandler): + def find_bytecode_to_write(self, ignore): + return 'find_bytecode' + def get_code_from_source(self, code_object): + """Knowing that this method's return value is passed to + write_bytecode, store away for later comparison.""" + self.code_object = code_object + return code_object, 0 + def write_bytecode(self, code_object, bytecode_loc, timestamp): + if bytecode_loc != 'find_bytecode': + raise ValueError + if code_object is not self.code_object: + raise ValueError + if timestamp != 0: + raise ValueError + + handler = Tester(('A',), ('B',)) + handler.handle_code(self.module_object, self.code_object, 'A') + self.verify_module(self.module_object) + + +class PyPycFileHandlerTests(PyPycFileHelper): + + """Test the py/pyc filesystem handler.""" + + def setUp(self): + """Create an instance that can handle source and bytecode.""" + super(PyPycFileHandlerTests, self).setUp() + self.handler = importer.PyPycFileHandler() + + def test_init(self): + # Make sure 'handles' ends up being set properly. + expected_bytecode_ext = '.pyc' if __debug__ else '.pyo' + self.failUnlessEqual(self.handler.handles, + (expected_bytecode_ext, '.py')) + handler = importer.PyPycFileHandler(('A',)) + self.failUnlessEqual(handler.handles, + (expected_bytecode_ext, 'A')) + handler = importer.PyPycFileHandler(bytecode_handles=('A',)) + self.failUnlessEqual(handler.handles, ('A', '.py')) + handler = importer.PyPycFileHandler(('A',), ('B',)) + self.failUnlessEqual(handler.handles, ('B', 'A')) + + def test_get_location(self): + # Should return the value on the 'name' attribute of its argument. + class Tester(object): + name = 42 + self.failUnlessEqual(self.handler.get_location(Tester), Tester.name) + + def test_get_code_from_source(self): + # Should be able to read from a file object and return a code object. + with open(self.source_path, 'rU') as source_file: + result = self.handler.get_code_from_source(source_file) + code_object, timestamp = result + exec code_object in self.module_object.__dict__ + self.verify_module(self.module_object) + source_timestamp = os.stat(self.source_path).st_mtime + self.failUnlessEqual(timestamp. source_timestamp) + + def test_find_source_to_read(self): + # Should be able to deduce .py file from .pyc file. + with open(self.bytecode_path, 'rb') as bytecode_file: + source_file = self.handler.find_source_to_read(bytecode_file) + with contextlib.closing(source_file): + source_file_path = source_file.name + self.failUnlessEqual(source_file_path, self.source_path) + + def test_find_bytecode_to_write(self): + # Should be able to deduce .pyc file from .py file. + with open(self.source_path, 'U') as source_file: + bytecode_file = self.handler.find_bytecode_to_write(source_file) + with contextlib.closing(bytecode_file): + bytecode_file_path = bytecode_file.name + self.failUnlessEqual(bytecode_file_path, self.bytecode_path) + + def test_get_bytecode(self): + # Magic number should be good + with open(self.bytecode_path, 'rb') as bytecode_file: + result = self.handler.get_bytecode(bytecode_file) + magic, timestamp, bytecode = result + # XXX self.failUnlessEqual(magic, imp.get_magic()) + source_timestamp = os.stat(self.source_path).st_mtime + # XXX self.failUnlessEqual(timestamp, source_timestamp) + code_object = marshal.loads(bytecode) + exec code_object in self.module_object.__dict__ + self.verify_module(self.module_object) + + def test_verify_timestamp(self): + source_timestamp = os.stat(self.source_path).st_mtime + with open(self.source_path, 'U') as source_file: + result = self.handler.verify_timestamp(source_timestamp, + source_file) + self.failUnless(result) + + def test_get_code_from_source(self): + with open(self.source_path, 'U') as source_file: + result = self.handler.get_code_from_source(source_file) + code_object, timestamp = result + exec code_object in self.module_object.__dict__ + self.verify_module(self.module_object) + source_timestamp = os.stat(self.source_path).st_mtime + self.failUnlessEqual(timestamp, source_timestamp) + + def test_write_bytecode(self): + # Writing out the bytecode file should have the current magic number, + # a timestamp of the source file, and correct bytecode. + os.remove(self.bytecode_path) + timestamp = os.stat(self.source_path).st_mtime + with open(self.bytecode_path, 'wb') as bytecode_file: + self.handler.write_bytecode(self.code_object, bytecode_file, + timestamp) + # Verify bytecode file was created. + self.failUnless(os.path.exists(self.bytecode_path)) + with open(self.bytecode_path, 'rb') as bytecode_file: + result = self.handler.get_bytecode(bytecode_file) + magic, timestamp, bytecode = result + # Verify magic number. + self.failUnless(self.handler.verify_magic(magic)) + # Verify timestamp. + with open(self.source_path, 'U') as source_file: + self.failUnless(self.handler.verify_timestamp(timestamp, + source_file)) + # Verify bytecode. + code_object = self.handler.get_code_from_bytecode(bytecode) + exec code_object in self.module_object.__dict__ + self.verify_module(self.module_object) + + def test_handle_code_source(self): + # Should be able to initialize the module from just using the source. + os.remove(self.bytecode_path) + handler = importer.PyPycFileHandler(bytecode_handles=False) + with open(self.source_path, 'U') as source_file: + handler.handle_code(self.module_object, source_file, '.py') + self.verify_module(self.module_object) + self.failUnless(not os.path.exists(self.bytecode_path)) + + def test_handle_code_bytecode(self): + # Should be able to initialize the module with just the bytecode. + os.remove(self.source_path) + bytecode_extension = os.path.splitext(self.bytecode_path)[1] + handler = importer.PyPycFileHandler(source_handles=False) + with open(self.bytecode_path, 'rb') as bytecode_file: + handler.handle_code(self.module_object, bytecode_file, + bytecode_extension) + self.verify_module(self.module_object) + + def test_handle_code_bad_bytecode_timestamp_good_source(self): + # If the timestamp fails on the bytecode, use the source and recreate + # the bytecode. + class Tester(importer.PyPycFileHandler): + """On some platforms the resolution of the last modification time + can be too coarse for rewriting the source to pick it up. Thus + force a fail timestamp check.""" + def verify_timestamp(self, ignore, ignore2): + return False + + handler = Tester() + bytecode_extension = os.path.splitext(self.bytecode_path)[1] + with open(self.bytecode_path, 'rb') as bytecode_file: + bytecode_stringio = StringIO.StringIO(bytecode_file.read()) + bytecode_stringio.name = self.bytecode_path + # Once bytecode has been read, don't need the file. Deleting it + # allows for easy detection that the bytecode was recreated. + os.remove(self.bytecode_path) + handler.handle_code(self.module_object, bytecode_stringio, + bytecode_extension) + self.verify_module(self.module_object) + self.failUnless(os.path.exists(self.bytecode_path)) + + with open(self.bytecode_path) as bytecode_file: + self.handler.handle_code(self.module_object, bytecode_file, + bytecode_extension) + self.verify_module(self.module_object) + self.failUnless(os.path.exists(self.bytecode_path)) + + def test_handle_code_good_source_write_bytecode(self): + # If the handler is requested to handle source code and bytecode can + # be written, then do so. + os.remove(self.bytecode_path) + with open(self.source_path, 'U') as source_file: + self.handler.handle_code(self.module_object, source_file, '.py') + self.verify_module(self.module_object) + self.failUnless(os.path.exists(self.bytecode_path)) + def test_main(): test_support.run_unittest( BuiltinImporterTests, FrozenImporterTests, - SourceHandlerTests, - BytecodeHandlerTests, FileSystemLoaderTests, FileSystemImporterTests, + PyPycBaseHandlerTests, + PyPycFileHandlerTests, ) From python-checkins at python.org Tue Oct 17 21:30:49 2006 From: python-checkins at python.org (thomas.heller) Date: Tue, 17 Oct 2006 21:30:49 +0200 (CEST) Subject: [Python-checkins] r52365 - in python/trunk: Lib/ctypes/test/test_callbacks.py Misc/NEWS Modules/_ctypes/callbacks.c Message-ID: <20061017193049.46B181E400A@bag.python.org> Author: thomas.heller Date: Tue Oct 17 21:30:48 2006 New Revision: 52365 Modified: python/trunk/Lib/ctypes/test/test_callbacks.py python/trunk/Misc/NEWS python/trunk/Modules/_ctypes/callbacks.c Log: ctypes callback functions only support 'fundamental' result types. Check this and raise an error when something else is used - before this change ctypes would hang or crash when such a callback was called. This is a partial fix for #1574584. Will backport to release25-maint. Modified: python/trunk/Lib/ctypes/test/test_callbacks.py ============================================================================== --- python/trunk/Lib/ctypes/test/test_callbacks.py (original) +++ python/trunk/Lib/ctypes/test/test_callbacks.py Tue Oct 17 21:30:48 2006 @@ -101,6 +101,19 @@ after = grc(o) self.failUnlessEqual((after, o), (before, o)) + def test_unsupported_restype_1(self): + # Only "fundamental" result types are supported for callback + # functions, the type must have a non-NULL stgdict->setfunc. + # POINTER(c_double), for example, is not supported. + + prototype = self.functype.im_func(POINTER(c_double)) + # The type is checked when the prototype is called + self.assertRaises(TypeError, prototype, lambda: None) + + def test_unsupported_restype_2(self): + prototype = self.functype.im_func(object) + self.assertRaises(TypeError, prototype, lambda: None) + try: WINFUNCTYPE except NameError: Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Oct 17 21:30:48 2006 @@ -81,6 +81,10 @@ Library ------- +- ctypes callback functions only support 'fundamental' data types as + result type. Raise an error when something else is used. This is a + partial fix for Bug #1574584. + - Fix turtle so that time.sleep is imported for the entire library. Allows the demo2 function to be executed on its own instead of only when the module is run as a script. Modified: python/trunk/Modules/_ctypes/callbacks.c ============================================================================== --- python/trunk/Modules/_ctypes/callbacks.c (original) +++ python/trunk/Modules/_ctypes/callbacks.c Tue Oct 17 21:30:48 2006 @@ -293,8 +293,11 @@ p->restype = &ffi_type_void; } else { StgDictObject *dict = PyType_stgdict(restype); - if (dict == NULL) - goto error; + if (dict == NULL || dict->setfunc == NULL) { + PyErr_SetString(PyExc_TypeError, + "invalid result type for callback function"); + goto error; + } p->setfunc = dict->setfunc; p->restype = &dict->ffi_type_pointer; } From python-checkins at python.org Tue Oct 17 21:38:39 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 17 Oct 2006 21:38:39 +0200 (CEST) Subject: [Python-checkins] r52366 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061017193839.A28831E4018@bag.python.org> Author: brett.cannon Date: Tue Oct 17 21:38:39 2006 New Revision: 52366 Modified: sandbox/trunk/import_in_py/importer.py Log: Note how one could implement a sqlite3 back-end. 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 17 21:38:39 2006 @@ -60,10 +60,54 @@ + XXX sqlite3 importer use-case: -* Simple way - + XXX +* Simple way (only support just bytecode or source) + + DB + - For source just a column for module name and another containing the + source. + - For bytecode, a column for module name, another containing .pyc + output. + + Importer + - Query DB to see if module name is there. + + Loader + - Read entry in DB for module into a StringIO instance. + - Set 'name' attribute on StringIO instance to be DB path plus module name. + + Use the py/pyc file handler set for just source or bytecode. * Feature-rich way - + XXX + + DB + - Module name. + - Source code. + - Marshalled code of the source. + * Set to NULL when source code is modified, which removes need of + storing the bytecode's timestamp. + - Magic number for bytecode. + + Importer + - Query DB to see if module is listed. + - Whether it is in bytecode or source form is irrelevant. + + Loader + - See if bytecode is in DB; if so then have that used, otherwise source. + - Pass in tuple of DB instance and requested module. + + Subclass PyPycBaseHandler + - Have both source and bytecode opaque objects be a tuple of the DB + instance and the module name that is being handled. + - get_bytecode() + * Reads DB and returns magic number, 0 for timestamp, and bytecode. + * Timestamp is unneeded as existence of bytecode implicitly means + that it is not outdated. + - find_source() + * Can return same tuple as passed into handle_code(). + - verify_timestamp() + * ``return True``. + - get_code_from_source() + * Get source from DB. + * compile. + * return code object and 0 for timestamp. + - write_bytecode() + * Get marshalled string from code object. + * Write marshalled string to DB. + * Write current magic number to DB. + - get_location() + * Return the path to the DB and the module name. + * Could even return SQL statement to get module if one cared. """ from __future__ import with_statement From python-checkins at python.org Tue Oct 17 21:41:11 2006 From: python-checkins at python.org (thomas.heller) Date: Tue, 17 Oct 2006 21:41:11 +0200 (CEST) Subject: [Python-checkins] r52367 - in python/branches/release25-maint: Lib/ctypes/test/test_callbacks.py Misc/NEWS Modules/_ctypes/callbacks.c Message-ID: <20061017194111.ECB951E4012@bag.python.org> Author: thomas.heller Date: Tue Oct 17 21:41:10 2006 New Revision: 52367 Modified: python/branches/release25-maint/Lib/ctypes/test/test_callbacks.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/_ctypes/callbacks.c Log: ctypes callback functions only support 'fundamental' result types. Check this and raise an error when something else is used - before this change ctypes would hang or crash when such a callback was called. This is a partial fix for #1574584. Backported from trunk. Modified: python/branches/release25-maint/Lib/ctypes/test/test_callbacks.py ============================================================================== --- python/branches/release25-maint/Lib/ctypes/test/test_callbacks.py (original) +++ python/branches/release25-maint/Lib/ctypes/test/test_callbacks.py Tue Oct 17 21:41:10 2006 @@ -101,6 +101,19 @@ after = grc(o) self.failUnlessEqual((after, o), (before, o)) + def test_unsupported_restype_1(self): + # Only "fundamental" result types are supported for callback + # functions, the type must have a non-NULL stgdict->setfunc. + # POINTER(c_double), for example, is not supported. + + prototype = self.functype.im_func(POINTER(c_double)) + # The type is checked when the prototype is called + self.assertRaises(TypeError, prototype, lambda: None) + + def test_unsupported_restype_2(self): + prototype = self.functype.im_func(object) + self.assertRaises(TypeError, prototype, lambda: None) + try: WINFUNCTYPE except NameError: Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Tue Oct 17 21:41:10 2006 @@ -75,6 +75,10 @@ Library ------- +- ctypes callback functions only support 'fundamental' data types as + result type. Raise an error when something else is used. This is a + partial fix for Bug #1574584. + - Bug #813342: Start the IDLE subprocess with -Qnew if the parent is started with that option. Modified: python/branches/release25-maint/Modules/_ctypes/callbacks.c ============================================================================== --- python/branches/release25-maint/Modules/_ctypes/callbacks.c (original) +++ python/branches/release25-maint/Modules/_ctypes/callbacks.c Tue Oct 17 21:41:10 2006 @@ -293,8 +293,11 @@ p->restype = &ffi_type_void; } else { StgDictObject *dict = PyType_stgdict(restype); - if (dict == NULL) - goto error; + if (dict == NULL || dict->setfunc == NULL) { + PyErr_SetString(PyExc_TypeError, + "invalid result type for callback function"); + goto error; + } p->setfunc = dict->setfunc; p->restype = &dict->ffi_type_pointer; } From python-checkins at python.org Tue Oct 17 21:45:54 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 17 Oct 2006 21:45:54 +0200 (CEST) Subject: [Python-checkins] r52368 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061017194554.A5ED81E400B@bag.python.org> Author: brett.cannon Date: Tue Oct 17 21:45:54 2006 New Revision: 52368 Modified: sandbox/trunk/import_in_py/importer.py Log: Add notes on how one could add support for PTL files. Also note how to re-implement zipimport easily. 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 17 21:45:54 2006 @@ -51,14 +51,26 @@ type of object. PTL use-case: -* XXX +* Use filesystem importer and loader. +* Subclass PyPycFileHandler + + Set source_handles to '.ptl' and bytecode to '.ptlc'. + + get_code_from_source() + - Handle transforming source to pure Python source. + - Return code object and timestamp. zipimport use-case: -* Simple way - + XXX -* Feature-rich way - + XXX - +* Importer + + Check if .pyc file exists for module in zip file. +* Loader + + Read .pyc file into a StringIO instance. + + Set 'name' attribute to zip file plus file name. +* Use PyPycFileHandler +* Adding support for all-source zip files. + + Modify importer to detect if zip file is all .pyc of .py files. + + Create separate instances of PyPycFileHandler for source and + bytecode. + - Suppresses attempts to read other code type. + sqlite3 importer use-case: * Simple way (only support just bytecode or source) + DB From buildbot at python.org Tue Oct 17 22:07:37 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 20:07:37 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20061017200738.1BC221E4004@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/73 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 python-checkins at python.org Tue Oct 17 22:18:38 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 17 Oct 2006 22:18:38 +0200 (CEST) Subject: [Python-checkins] r52369 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061017201838.50ADE1E4006@bag.python.org> Author: brett.cannon Date: Tue Oct 17 22:18:37 2006 New Revision: 52369 Modified: sandbox/trunk/import_in_py/importer.py Log: Correct zipimport comments. 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 17 22:18:37 2006 @@ -60,16 +60,12 @@ zipimport use-case: * Importer - + Check if .pyc file exists for module in zip file. + + Check if .py or .pyc file exists for module in zip file. * Loader - + Read .pyc file into a StringIO instance. + + Read .py or .pyc file into a StringIO instance. + Set 'name' attribute to zip file plus file name. * Use PyPycFileHandler -* Adding support for all-source zip files. - + Modify importer to detect if zip file is all .pyc of .py files. - + Create separate instances of PyPycFileHandler for source and - bytecode. - - Suppresses attempts to read other code type. + sqlite3 importer use-case: * Simple way (only support just bytecode or source) From buildbot at python.org Tue Oct 17 22:57:38 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 20:57:38 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061017205738.658341E4004@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/1226 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 17 23:54:50 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 17 Oct 2006 23:54:50 +0200 (CEST) Subject: [Python-checkins] r52370 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061017215450.AB4391E4004@bag.python.org> Author: brett.cannon Date: Tue Oct 17 23:54:50 2006 New Revision: 52370 Modified: sandbox/trunk/import_in_py/importer.py Log: Remove notes on simple DB and zipimport rewrite. It's a waste of time to use PyPycBaseHandler and friends since they are geared towards the situation where bytecode regeneration is a possibility. For simple situations like zipimport or a DB that only has source or bytecode it is easier to just either inline reading the source/bytecode and making the code object or a simple handler that just takes in a string and just does the compile/exec step immediately. 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 17 23:54:50 2006 @@ -57,65 +57,43 @@ + get_code_from_source() - Handle transforming source to pure Python source. - Return code object and timestamp. - -zipimport use-case: -* Importer - + Check if .py or .pyc file exists for module in zip file. -* Loader - + Read .py or .pyc file into a StringIO instance. - + Set 'name' attribute to zip file plus file name. -* Use PyPycFileHandler - - + sqlite3 importer use-case: -* Simple way (only support just bytecode or source) - + DB - - For source just a column for module name and another containing the - source. - - For bytecode, a column for module name, another containing .pyc - output. - + Importer - - Query DB to see if module name is there. - + Loader - - Read entry in DB for module into a StringIO instance. - - Set 'name' attribute on StringIO instance to be DB path plus module name. - + Use the py/pyc file handler set for just source or bytecode. -* Feature-rich way - + DB - - Module name. - - Source code. - - Marshalled code of the source. - * Set to NULL when source code is modified, which removes need of - storing the bytecode's timestamp. - - Magic number for bytecode. - + Importer - - Query DB to see if module is listed. - - Whether it is in bytecode or source form is irrelevant. - + Loader - - See if bytecode is in DB; if so then have that used, otherwise source. - - Pass in tuple of DB instance and requested module. - + Subclass PyPycBaseHandler - - Have both source and bytecode opaque objects be a tuple of the DB - instance and the module name that is being handled. - - get_bytecode() - * Reads DB and returns magic number, 0 for timestamp, and bytecode. - * Timestamp is unneeded as existence of bytecode implicitly means - that it is not outdated. - - find_source() - * Can return same tuple as passed into handle_code(). - - verify_timestamp() - * ``return True``. - - get_code_from_source() - * Get source from DB. - * compile. - * return code object and 0 for timestamp. - - write_bytecode() - * Get marshalled string from code object. - * Write marshalled string to DB. - * Write current magic number to DB. - - get_location() - * Return the path to the DB and the module name. - * Could even return SQL statement to get module if one cared. ++ DB + - Module name. + - Source code. + - Marshalled code of the source. + * Set to NULL when source code is modified, which removes need of + storing the bytecode's timestamp. + - Magic number for bytecode. ++ Importer + - Query DB to see if module is listed. + - Whether it is in bytecode or source form is irrelevant. ++ Loader + - See if bytecode is in DB; if so then have that used, otherwise source. + - Pass in tuple of DB instance and requested module. ++ Subclass PyPycBaseHandler + - Have both source and bytecode opaque objects be a tuple of the DB + instance and the module name that is being handled. + - get_bytecode() + * Reads DB and returns magic number, 0 for timestamp, and bytecode. + * Timestamp is unneeded as existence of bytecode implicitly means + that it is not outdated. + - find_source() + * Can return same tuple as passed into handle_code(). + - verify_timestamp() + * ``return True``. + - get_code_from_source() + * Get source from DB. + * compile. + * return code object and 0 for timestamp. + - write_bytecode() + * Get marshalled string from code object. + * Write marshalled string to DB. + * Write current magic number to DB. + - get_location() + * Return the path to the DB and the module name. + * Could even return SQL statement to get module if one cared. """ from __future__ import with_statement @@ -546,4 +524,4 @@ with contextlib.closing(source_file): source_location = self.get_location(source_file) bytecode_location = self.get_location(bytecode_file) - py_compile.compile(source_location, bytecode_location, doraise=True) \ No newline at end of file + py_compile.compile(source_location, bytecode_location, doraise=True) From buildbot at python.org Tue Oct 17 23:58:54 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 21:58:54 +0000 Subject: [Python-checkins] buildbot warnings in x86 Ubuntu edgy (icc) trunk Message-ID: <20061017215854.E989A1E4004@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu edgy (icc) trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520edgy%2520%2528icc%2529%2520trunk/builds/1017 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 18 00:42:16 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 18 Oct 2006 00:42:16 +0200 (CEST) Subject: [Python-checkins] r52371 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061017224216.7D2B81E4004@bag.python.org> Author: brett.cannon Date: Wed Oct 18 00:42:15 2006 New Revision: 52371 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Implement an extension module file handler. 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 18 00:42:15 2006 @@ -525,3 +525,18 @@ source_location = self.get_location(source_file) bytecode_location = self.get_location(bytecode_file) py_compile.compile(source_location, bytecode_location, doraise=True) + + +class ExtensionFileHandler(object): + + """A handler for loading extension modules.""" + + def __init__(self): + """Set 'handles'.""" + self.handles = tuple(suffix[0] for suffix in imp.get_suffixes() + if suffix[2] == imp.C_EXTENSION) + + def handle_code(self, module, extension_file, to_handle): + """Import an extension module.""" + return imp.load_dynamic(module.__name__, extension_file.name, + extension_file) \ No newline at end of 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 Wed Oct 18 00:42:15 2006 @@ -581,6 +581,37 @@ self.handler.handle_code(self.module_object, source_file, '.py') self.verify_module(self.module_object) self.failUnless(os.path.exists(self.bytecode_path)) + + +class ExtensionHandlerTests(unittest.TestCase): + + """Test that extension modules can be loaded.""" + + def setUp(self): + """Find an extension module to test against.""" + self.handler = importer.ExtensionFileHandler() + for entry in sys.path: + if not os.path.isdir(entry): + continue + ext_paths = [ext for ext in os.listdir(entry) + if any(True for suffix in self.handler.handles + if ext.endswith(suffix))] + if ext_paths: + break + else: + raise test_support.TestSkipped("not extension modules found") + self.ext_path = os.path.join(entry, ext_paths[0]) + self.module_name = os.path.splitext(os.path.split(self.ext_path)[1])[0] + + def test_handle_code(self): + # Make sure an extension module can be loaded. + new_module = new.module(self.module_name) + with open(self.ext_path, 'rb') as ext_file: + module = self.handler.handle_code(new_module, ext_file, + self.handler.handles[0]) + # There should be at least one attribute that does not start with '_'. + self.failUnless(any(True for attr in dir(module) + if not attr.startswith('_'))) def test_main(): @@ -591,6 +622,7 @@ FileSystemImporterTests, PyPycBaseHandlerTests, PyPycFileHandlerTests, + ExtensionHandlerTests, ) From buildbot at python.org Wed Oct 18 01:35:15 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 17 Oct 2006 23:35:15 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061017233515.5BDA51E400A@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/156 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 18 03:28:22 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 18 Oct 2006 03:28:22 +0200 (CEST) Subject: [Python-checkins] r52372 - python/branches/bcannon-objcap/securing_python.txt Message-ID: <20061018012822.2EE251E4004@bag.python.org> Author: brett.cannon Date: Wed Oct 18 03:28:20 2006 New Revision: 52372 Modified: python/branches/bcannon-objcap/securing_python.txt Log: Add some notes about ways to protect import machinery from nefarious introspection. Modified: python/branches/bcannon-objcap/securing_python.txt ============================================================================== --- python/branches/bcannon-objcap/securing_python.txt (original) +++ python/branches/bcannon-objcap/securing_python.txt Wed Oct 18 03:28:20 2006 @@ -33,6 +33,17 @@ + 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. + * Could make __import__ self-contained such that 'sys' is not + directly referenced. + + Allows hiding sys.path by storing in the self-contained + object. + + Could expose other objects if desired. + + Could make it so that there is only exposure of certain + functions that allow removal from a whitelist but no + additions. + + Other things can be options that can only be turned off. + + Importers could be made like this with the one-way + narrowing of abilities. - execfile() * Force to go through open() + Prevents opening unauthorized files. From python-checkins at python.org Wed Oct 18 03:30:31 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 18 Oct 2006 03:30:31 +0200 (CEST) Subject: [Python-checkins] r52373 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061018013031.208F11E4004@bag.python.org> Author: brett.cannon Date: Wed Oct 18 03:30:30 2006 New Revision: 52373 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Rework FileSystemLoader to pass in a path instead of a file object. This is because different handlers want to open paths differently (e.g., 'rb' compared to 'U'). Change PyPycFileHandler accordingly. Also have rough version of import object. Tests are not flushed out. Hope is that once tests are done (and the subsequent bugs have been worked out) Python 1.4 semantics (i.e., import without packages) will be working. 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 18 03:30:30 2006 @@ -44,19 +44,21 @@ + Importing the module being imported in a circular import dependency requires that module added to sys.modules stay consistent from the point it is added to initialization. +* Remove any idea of default importer. + + Removes None entries from sys.path_importer_cache. + + Rely on default importers being in sys.path_hooks or sys.meta_path. Rejected Py3K improvements: * Passing in new module to loaders Creating a new module is minimal and loader might want to use a different type of object. - + PTL use-case: * Use filesystem importer and loader. * Subclass PyPycFileHandler + Set source_handles to '.ptl' and bytecode to '.ptlc'. + get_code_from_source() - - Handle transforming source to pure Python source. - - Return code object and timestamp. + - Handle transforming to pure Python code here. sqlite3 importer use-case: + DB @@ -246,18 +248,21 @@ try: return sys.modules[fullname] except KeyError: - module = imp.new_module(fullname) - sys.modules[fullname] = module - module.__loader__ = self - module.__file__ = self.file_path - module.__name__ = fullname + new_module = imp.new_module(fullname) + sys.modules[fullname] = new_module + # If handler returns a different module these should already be + # set. + new_module.__file__ = self.file_path + new_module.__name__ = fullname try: - with open(self.file_path) as code_file: - self.handler.handle_code(module, code_file, - self.chosen_handle) + module = self.handler.handle_code(new_module, self.file_path, + self.chosen_handle) except: del sys.modules[fullname] raise + # Needs to be set regardless of whether passed-in module was used + # or not. + module.__loader__ = self return module @@ -440,19 +445,7 @@ """Handler for source code and bytecode files. - All methods that work with opaque objects expect a file-like interface: - * read(n=-1) - Read n bytes from the file, or all bytes if no argument is given. - * close() - Close the file. It is a no-op if called previously. - * name - Attribute with the location to the file. If source and bytecode are - not both used by an instance of this class then the values does not - need to be a valid path, otherwise care needs to be taken to make sure - the value is reasonable. - - The file type by default implements the required interface. StringIO - objects require the 'name' attribute to be set. + All methods that work with opaque objects expect file paths. """ @@ -473,21 +466,21 @@ def find_source_to_read(self, bytecode_file): """Return the file object to the corresponding source code.""" base, ext = os.path.splitext(self.get_location(bytecode_file)) - return open(base + self.source_handles[-1], 'U') + return base + self.source_handles[-1] def find_bytecode_to_write(self, source_file): """Return the file object to the corresponding bytecode.""" base, ext = os.path.splitext(self.get_location(source_file)) - return open(base + self.bytecode_handles[-1], 'wb') + return base + self.bytecode_handles[-1] - def get_location(self, file_object): + def get_location(self, file_path): """Return the path to the file object.""" - return file_object.name + return file_path - def get_bytecode(self, bytecode_file): + def get_bytecode(self, bytecode_path): """Return the magic number, timestamp, and bytecode from the bytecode - file.""" - with contextlib.closing(bytecode_file): + file path.""" + with open(bytecode_path, 'rb') as bytecode_file: magic = bytecode_file.read(4) timestamp = bytecode_file.read(4) bytecode = bytecode_file.read() @@ -495,36 +488,30 @@ # and timestamp. return magic, timestamp, bytecode - def verify_timestamp(self, bytecode_timestamp, source_file): + def verify_timestamp(self, bytecode_timestamp, source_path): """Verify that 'timestamp' is newer than the modification time for 'source_path'.""" return True # XXX Won't work until can unmarshal longs. - source_path = self.get_location(source_file) source_timestamp = os.stat(source_path).st_mtime return source_timestamp <= bytecode_timestamp - def get_code_from_source(self, source_file): - """Return the code object created from the source code file and the + def get_code_from_source(self, source_path): + """Return the code object created from the source code path and the timestamp on the source file.""" - with contextlib.closing(source_file): + with open(source_path, 'U') as source_file: source_code = source_file.read() - source_location = self.get_location(source_file) - timestamp = os.stat(source_location).st_mtime - code_object = compile(source_code, self.get_location(source_file), + timestamp = os.stat(source_path).st_mtime + code_object = compile(source_code, source_path, 'exec') return code_object, timestamp - def write_bytecode(self, code_object, bytecode_file, timestamp): + def write_bytecode(self, code_object, bytecode_path, timestamp): """Write out code_object to the file location bytecode_path with the passed-in timestamp.""" # XXX w/o being able to marshal longs, we need to use py_compile. - with contextlib.closing(bytecode_file): - source_file = self.find_source_to_read(bytecode_file) - with contextlib.closing(source_file): - source_location = self.get_location(source_file) - bytecode_location = self.get_location(bytecode_file) - py_compile.compile(source_location, bytecode_location, doraise=True) + source_path = self.find_source_to_read(bytecode_path) + py_compile.compile(source_path, bytecode_path, doraise=True) class ExtensionFileHandler(object): @@ -536,7 +523,114 @@ self.handles = tuple(suffix[0] for suffix in imp.get_suffixes() if suffix[2] == imp.C_EXTENSION) - def handle_code(self, module, extension_file, to_handle): + def handle_code(self, module, extension_path, to_handle): """Import an extension module.""" - return imp.load_dynamic(module.__name__, extension_file.name, - extension_file) \ No newline at end of file + return imp.load_dynamic(module.__name__, extension_path) + + +class Importer(object): + + """Class that re-implements __import__.""" + #XXX How to handle None entries in sys.path_importer_cache? + + def __init__(self, default_importer_factory=None, + default_meta_path=(BuiltinImporter, FrozenImporter)): + """Store the built-in importer factory to use when + sys.path_importer_cache has a None entry. + + The importer factory should act just like an object that was put on + sys.path_hooks. + + """ + if default_importer_factory: + self.default_importer_factory = default_importer_factory + else: + # Create a handler to deal with extension modules, .py, and .pyc + # files. Built-in and frozen modules are handled by sys.meta_path + # entries. + handlers = ExtensionFileHandler(), PyPycFileHandler() + self.default_importer_factory = FileSystemFactory(*handlers) + self.default_meta_path = default_meta_path + + def search_meta_path(self, name): + """Check the importers on sys.meta_path for a loader.""" + for entry in (tuple(sys.meta_path) + tuple(self.default_meta_path)): + loader = entry.find_module(name) + if loader: + return loader + else: + raise ImportError("%s not found on meta path" % name) + + def sys_path_importer(self, path_entry): + """Return the importer for the entry on sys.path.""" + try: + # See if an importer is cached. + importer = sys.path_importer_cache[path_entry] + # If None was stored, use default importer factory. + if importer is None: + return self.default_importer_factory(path_entry) + else: + return importer + except KeyError: + # No cached importer found; try to get a new one from + # sys.path_hooks. + for importer_factory in sys.path_hooks: + try: + importer = importer_factory(path_entry) + sys.path_importer_cache[path_entry] = importer + return importer + except ImportError: + continue + else: + # No importer factory on sys.path_hooks works; use the default + # importer factory. + sys.path_importer_cache[path_entry] = None + try: + return self.default_importer_factory(path_entry) + except ImportError: + raise ImportError("no importer found for %s" % path_entry) + + def search_sys_path(self, name): + """Check sys.path for the module and return a loader if found.""" + for entry in sys.path: + try: + importer = self.sys_path_importer(entry) + except ImportError: + continue + loader = importer.find_module(name) + if loader: + return loader + else: + raise ImportError("%s not found on sys.path" % name) + + def __call__(self, name, globals={}, locals={}, fromlist=[], level=-1): + """Import a module. + + 'name' is the dotted name of the module/package to import. 'globals' and + 'locals' are the global and local namespace dictionaries of the caller + (only 'globals' is used to introspect the __path__ attribute of the calling + module). fromlist is any specific objects that are to eventually be put + into the namespace (e.g., ``from for.bar import baz`` would have baz in the + fromlist). 'level' is set to -1 if both relative and absolute imports are + supported, 0 if only for absolute, and positive values represent the number + of levels up from the directory the calling module is in. + + When 'name' is a dotted name, there are two different situations to + consider. One is when the fromlist is empty. In this situation the import + imports and returns the name up to the first dot. All subsequent names are + imported but set at attributes as needed. When fromlist is not empty then + the module represented by the full dotted name is returned. + + """ + # XXX Does not handle packages yet, which means no absolute/relative imports + # or fromlist worries. + # Try meta_path entries. + try: + # Attempt to find a loader on sys.meta_path. + loader = self.search_meta_path(name) + except ImportError: + # sys.meta_path search failed. Attempt to find a loader on + # sys.path. If this fails then module cannot be found. + loader = self.search_sys_path(name) + # A loader was found. + return loader.load_module(name) \ No newline at end of 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 Wed Oct 18 03:30:30 2006 @@ -443,14 +443,11 @@ def test_get_location(self): # Should return the value on the 'name' attribute of its argument. - class Tester(object): - name = 42 - self.failUnlessEqual(self.handler.get_location(Tester), Tester.name) + self.failUnlessEqual(self.handler.get_location('path'), 'path') def test_get_code_from_source(self): # Should be able to read from a file object and return a code object. - with open(self.source_path, 'rU') as source_file: - result = self.handler.get_code_from_source(source_file) + result = self.handler.get_code_from_source(self.source_path) code_object, timestamp = result exec code_object in self.module_object.__dict__ self.verify_module(self.module_object) @@ -459,24 +456,17 @@ def test_find_source_to_read(self): # Should be able to deduce .py file from .pyc file. - with open(self.bytecode_path, 'rb') as bytecode_file: - source_file = self.handler.find_source_to_read(bytecode_file) - with contextlib.closing(source_file): - source_file_path = source_file.name + source_file_path = self.handler.find_source_to_read(self.bytecode_path) self.failUnlessEqual(source_file_path, self.source_path) def test_find_bytecode_to_write(self): # Should be able to deduce .pyc file from .py file. - with open(self.source_path, 'U') as source_file: - bytecode_file = self.handler.find_bytecode_to_write(source_file) - with contextlib.closing(bytecode_file): - bytecode_file_path = bytecode_file.name - self.failUnlessEqual(bytecode_file_path, self.bytecode_path) + bytecode_path = self.handler.find_bytecode_to_write(self.source_path) + self.failUnlessEqual(bytecode_path, self.bytecode_path) def test_get_bytecode(self): # Magic number should be good - with open(self.bytecode_path, 'rb') as bytecode_file: - result = self.handler.get_bytecode(bytecode_file) + result = self.handler.get_bytecode(self.bytecode_path) magic, timestamp, bytecode = result # XXX self.failUnlessEqual(magic, imp.get_magic()) source_timestamp = os.stat(self.source_path).st_mtime @@ -487,14 +477,12 @@ def test_verify_timestamp(self): source_timestamp = os.stat(self.source_path).st_mtime - with open(self.source_path, 'U') as source_file: - result = self.handler.verify_timestamp(source_timestamp, - source_file) - self.failUnless(result) + result = self.handler.verify_timestamp(source_timestamp, + self.source_path) + self.failUnless(result) def test_get_code_from_source(self): - with open(self.source_path, 'U') as source_file: - result = self.handler.get_code_from_source(source_file) + result = self.handler.get_code_from_source(self.source_path) code_object, timestamp = result exec code_object in self.module_object.__dict__ self.verify_module(self.module_object) @@ -506,20 +494,17 @@ # a timestamp of the source file, and correct bytecode. os.remove(self.bytecode_path) timestamp = os.stat(self.source_path).st_mtime - with open(self.bytecode_path, 'wb') as bytecode_file: - self.handler.write_bytecode(self.code_object, bytecode_file, - timestamp) + self.handler.write_bytecode(self.code_object, self.bytecode_path, + timestamp) # Verify bytecode file was created. self.failUnless(os.path.exists(self.bytecode_path)) - with open(self.bytecode_path, 'rb') as bytecode_file: - result = self.handler.get_bytecode(bytecode_file) + result = self.handler.get_bytecode(self.bytecode_path) magic, timestamp, bytecode = result # Verify magic number. self.failUnless(self.handler.verify_magic(magic)) # Verify timestamp. - with open(self.source_path, 'U') as source_file: - self.failUnless(self.handler.verify_timestamp(timestamp, - source_file)) + self.failUnless(self.handler.verify_timestamp(timestamp, + self.source_path)) # Verify bytecode. code_object = self.handler.get_code_from_bytecode(bytecode) exec code_object in self.module_object.__dict__ @@ -529,8 +514,7 @@ # Should be able to initialize the module from just using the source. os.remove(self.bytecode_path) handler = importer.PyPycFileHandler(bytecode_handles=False) - with open(self.source_path, 'U') as source_file: - handler.handle_code(self.module_object, source_file, '.py') + handler.handle_code(self.module_object, self.source_path, '.py') self.verify_module(self.module_object) self.failUnless(not os.path.exists(self.bytecode_path)) @@ -539,46 +523,29 @@ os.remove(self.source_path) bytecode_extension = os.path.splitext(self.bytecode_path)[1] handler = importer.PyPycFileHandler(source_handles=False) - with open(self.bytecode_path, 'rb') as bytecode_file: - handler.handle_code(self.module_object, bytecode_file, - bytecode_extension) + handler.handle_code(self.module_object, self.bytecode_path, + bytecode_extension) self.verify_module(self.module_object) def test_handle_code_bad_bytecode_timestamp_good_source(self): # If the timestamp fails on the bytecode, use the source and recreate # the bytecode. class Tester(importer.PyPycFileHandler): - """On some platforms the resolution of the last modification time - can be too coarse for rewriting the source to pick it up. Thus - force a fail timestamp check.""" - def verify_timestamp(self, ignore, ignore2): + def verify_timestamp(self, timestamp, source_path): + bytecode_path = self.find_bytecode_to_write(source_path) + os.remove(bytecode_path) return False - + handler = Tester() bytecode_extension = os.path.splitext(self.bytecode_path)[1] - with open(self.bytecode_path, 'rb') as bytecode_file: - bytecode_stringio = StringIO.StringIO(bytecode_file.read()) - bytecode_stringio.name = self.bytecode_path - # Once bytecode has been read, don't need the file. Deleting it - # allows for easy detection that the bytecode was recreated. - os.remove(self.bytecode_path) - handler.handle_code(self.module_object, bytecode_stringio, + handler.handle_code(self.module_object, self.bytecode_path, bytecode_extension) - self.verify_module(self.module_object) - self.failUnless(os.path.exists(self.bytecode_path)) - - with open(self.bytecode_path) as bytecode_file: - self.handler.handle_code(self.module_object, bytecode_file, - bytecode_extension) - self.verify_module(self.module_object) - self.failUnless(os.path.exists(self.bytecode_path)) def test_handle_code_good_source_write_bytecode(self): # If the handler is requested to handle source code and bytecode can # be written, then do so. os.remove(self.bytecode_path) - with open(self.source_path, 'U') as source_file: - self.handler.handle_code(self.module_object, source_file, '.py') + self.handler.handle_code(self.module_object, self.source_path, '.py') self.verify_module(self.module_object) self.failUnless(os.path.exists(self.bytecode_path)) @@ -606,12 +573,99 @@ def test_handle_code(self): # Make sure an extension module can be loaded. new_module = new.module(self.module_name) - with open(self.ext_path, 'rb') as ext_file: - module = self.handler.handle_code(new_module, ext_file, - self.handler.handles[0]) + module = self.handler.handle_code(new_module, self.ext_path, + self.handler.handles[0]) # There should be at least one attribute that does not start with '_'. self.failUnless(any(True for attr in dir(module) if not attr.startswith('_'))) + + +class SimpleImportTests(unittest.TestCase): + + """Test Importer class with only direct module imports; no packages.""" + + def setUp(self): + """Store a copy of the 'sys' attribute pertaining to imports.""" + self.old_sys_modules = sys.modules.copy() + self.old_meta_path = sys.meta_path[:] + self.old_sys_path = sys.path[:] + self.old_path_hooks = sys.path_hooks[:] + self.old_path_importer_cache = sys.path_importer_cache.copy() + self.import_ = importer.Importer() + + def tearDown(self): + """Restore backup of import-related attributes in 'sys'.""" + sys.modules = self.old_sys_modules + sys.meta_path = self.old_meta_path + sys.path = self.old_sys_path + sys.path_hooks = self.old_path_hooks + sys.path_importer_cache = self.old_path_importer_cache + + def test_default_importer_factory(self): + # Make sure that the object passed in during initialization is used + # when sys.path_importer_cache has a value of None. + pass + + def test_default_meta_path(self): + # Default meta_path entries set during initialization should be + # queried after sys.meta_path. + pass + + def test_default_init(self): + # The default initialization should work with a None entry for every + # sys.path entry in sys.path_importer_cache. It should also lead to + # built-in, frozen, extension, .pyc, and .py files being imported if + # desired. + sys.path_importer_cache = dict((entry, None) for entry in sys.path) + sys.modules = {} + # Built-ins. + module = self.import_('sys') + self.failUnlessEqual(module.__name__, 'sys') + self.failUnless(hasattr(sys, 'version')) + # Frozen modules. + try: + sys.stdout = StringIO.StringIO() + module = self.import_('__hello__') + finally: + sys.stdout = sys.__stdout__ + self.failUnlessEqual(module.__name__, '__hello__') + # Extension modules. + module = self.import_('time') + self.failUnlessEqual(module.__name__, 'time') + self.failUnless(hasattr(module, 'sleep')) + # .py/.pyc files. + module = self.import_('token') + self.failUnlessEqual(module.__name__, 'token') + self.failUnless(hasattr(module, 'ISTERMINAL')) + + def test_meta_path(self): + # Test meta_path searching for a loader. + pass + + def test_sys_path(self): + # Test sys.path searching for a loader. + pass + + def test_importer_cache_preexisting(self): + # A pre-existing importer should be returned if it exists in + # sys.path_importer_cache. + pass + + def test_importer_cache_None(self): + # A entry of None in sys.path_importer_cache should get one back an + # importer from the default importer factory. + pass + + def test_importer_cache_from_path_hooks(self): + # If an entry does not exist for a sys.path entry in the importer cache + # then sys.path_hooks should be searched and if one is found then cache + # it. + pass + + def test_importer_cache_no_path_hooks(self): + # If an entry does not exist for a sys.path entry in the importer cache + # and sys.path_hooks has nothing for the entry, None should be set. + pass def test_main(): @@ -623,6 +677,7 @@ PyPycBaseHandlerTests, PyPycFileHandlerTests, ExtensionHandlerTests, + SimpleImportTests, ) From python-checkins at python.org Wed Oct 18 03:32:02 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 18 Oct 2006 03:32:02 +0200 (CEST) Subject: [Python-checkins] r52374 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061018013202.70E261E4004@bag.python.org> Author: brett.cannon Date: Wed Oct 18 03:32:02 2006 New Revision: 52374 Modified: sandbox/trunk/import_in_py/importer.py Log: Add a comment as to why the filesystem loader needs to return what the the handler returns instead of the new module that the loader hands off. 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 18 03:32:02 2006 @@ -263,6 +263,8 @@ # Needs to be set regardless of whether passed-in module was used # or not. module.__loader__ = self + # Need to return what the handler gave us back as they may not have + # used the module we gave them. return module From python-checkins at python.org Wed Oct 18 03:33:00 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 18 Oct 2006 03:33:00 +0200 (CEST) Subject: [Python-checkins] r52375 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061018013300.9B8F21E4004@bag.python.org> Author: brett.cannon Date: Wed Oct 18 03:33:00 2006 New Revision: 52375 Modified: sandbox/trunk/import_in_py/importer.py Log: Add a comment about why an entry needs to be put into sys.modules before the handler is called. 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 18 03:33:00 2006 @@ -249,6 +249,8 @@ return sys.modules[fullname] except KeyError: new_module = imp.new_module(fullname) + # Need an entry in sys.modules in order to prevent any problems + # with circular imports. sys.modules[fullname] = new_module # If handler returns a different module these should already be # set. From python-checkins at python.org Wed Oct 18 03:33:50 2006 From: python-checkins at python.org (brett.cannon) Date: Wed, 18 Oct 2006 03:33:50 +0200 (CEST) Subject: [Python-checkins] r52376 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061018013350.B018D1E4004@bag.python.org> Author: brett.cannon Date: Wed Oct 18 03:33:50 2006 New Revision: 52376 Modified: sandbox/trunk/import_in_py/importer.py Log: Remove spurious comment. 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 18 03:33:50 2006 @@ -535,7 +535,6 @@ class Importer(object): """Class that re-implements __import__.""" - #XXX How to handle None entries in sys.path_importer_cache? def __init__(self, default_importer_factory=None, default_meta_path=(BuiltinImporter, FrozenImporter)): From buildbot at python.org Wed Oct 18 06:54:23 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 18 Oct 2006 04:54:23 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-2 trunk Message-ID: <20061018045423.BB2361E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%2520trunk/builds/927 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis,thomas.heller Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Wed Oct 18 06:55:34 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 18 Oct 2006 04:55:34 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-2 2.5 Message-ID: <20061018045535.1D41A1E4010@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%25202.5/builds/30 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: martin.v.loewis,thomas.heller BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Wed Oct 18 06:56:17 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 18 Oct 2006 04:56:17 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-2 2.4 Message-ID: <20061018045618.024531E4006@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/180 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release24-maint] HEAD Blamelist: anthony.baxter BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Wed Oct 18 07:06:06 2006 From: python-checkins at python.org (tim.peters) Date: Wed, 18 Oct 2006 07:06:06 +0200 (CEST) Subject: [Python-checkins] r52377 - python/trunk/Modules/cStringIO.c Message-ID: <20061018050606.F084C1E4010@bag.python.org> Author: tim.peters Date: Wed Oct 18 07:06:06 2006 New Revision: 52377 Modified: python/trunk/Modules/cStringIO.c Log: newIobject(): repaired incorrect cast to quiet MSVC warning. Modified: python/trunk/Modules/cStringIO.c ============================================================================== --- python/trunk/Modules/cStringIO.c (original) +++ python/trunk/Modules/cStringIO.c Wed Oct 18 07:06:06 2006 @@ -657,7 +657,7 @@ char *buf; Py_ssize_t size; - if (PyObject_AsCharBuffer(s, (const void **)&buf, &size) != 0) + if (PyObject_AsCharBuffer(s, (const char **)&buf, &size) != 0) return NULL; self = PyObject_New(Iobject, &Itype); From python-checkins at python.org Wed Oct 18 07:09:13 2006 From: python-checkins at python.org (tim.peters) Date: Wed, 18 Oct 2006 07:09:13 +0200 (CEST) Subject: [Python-checkins] r52378 - in python/trunk: Lib/distutils/unixccompiler.py Lib/test/test_import.py Mac/BuildScript/build-installer.py Message-ID: <20061018050913.97ECA1E4004@bag.python.org> Author: tim.peters Date: Wed Oct 18 07:09:12 2006 New Revision: 52378 Modified: python/trunk/Lib/distutils/unixccompiler.py python/trunk/Lib/test/test_import.py python/trunk/Mac/BuildScript/build-installer.py Log: Whitespace normalization. Modified: python/trunk/Lib/distutils/unixccompiler.py ============================================================================== --- python/trunk/Lib/distutils/unixccompiler.py (original) +++ python/trunk/Lib/distutils/unixccompiler.py Wed Oct 18 07:09:12 2006 @@ -82,7 +82,7 @@ except ValueError: pass - # Check if the SDK that is used during compilation actually exists, + # 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 Modified: python/trunk/Lib/test/test_import.py ============================================================================== --- python/trunk/Lib/test/test_import.py (original) +++ python/trunk/Lib/test/test_import.py Wed Oct 18 07:09:12 2006 @@ -18,7 +18,7 @@ class ImportTest(unittest.TestCase): - + def testCaseSensitivity(self): # Brief digression to test that import is case-sensitive: if we got this # far, we know for sure that "random" exists. @@ -56,7 +56,7 @@ mod = __import__(TESTFN) except ImportError, err: self.fail("import from %s failed: %s" % (ext, err)) - + self.assertEquals(mod.a, a, "module loaded (%s) but contents invalid" % mod) self.assertEquals(mod.b, b, Modified: python/trunk/Mac/BuildScript/build-installer.py ============================================================================== --- python/trunk/Mac/BuildScript/build-installer.py (original) +++ python/trunk/Mac/BuildScript/build-installer.py Wed Oct 18 07:09:12 2006 @@ -664,7 +664,7 @@ 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): From python-checkins at python.org Wed Oct 18 07:10:29 2006 From: python-checkins at python.org (tim.peters) Date: Wed, 18 Oct 2006 07:10:29 +0200 (CEST) Subject: [Python-checkins] r52379 - python/trunk/PC/bdist_wininst/wininst-8.sln python/trunk/PC/bdist_wininst/wininst-8.vcproj Message-ID: <20061018051029.625431E4004@bag.python.org> Author: tim.peters Date: Wed Oct 18 07:10:28 2006 New Revision: 52379 Modified: python/trunk/PC/bdist_wininst/wininst-8.sln (contents, props changed) python/trunk/PC/bdist_wininst/wininst-8.vcproj (contents, props changed) Log: Add missing svn:eol-style to text files. Modified: python/trunk/PC/bdist_wininst/wininst-8.sln ============================================================================== --- python/trunk/PC/bdist_wininst/wininst-8.sln (original) +++ python/trunk/PC/bdist_wininst/wininst-8.sln Wed Oct 18 07:10:28 2006 @@ -1,19 +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 +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 Modified: python/trunk/PC/bdist_wininst/wininst-8.vcproj ============================================================================== --- python/trunk/PC/bdist_wininst/wininst-8.vcproj (original) +++ python/trunk/PC/bdist_wininst/wininst-8.vcproj Wed Oct 18 07:10:28 2006 @@ -1,320 +1,320 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From python-checkins at python.org Wed Oct 18 07:13:30 2006 From: python-checkins at python.org (anthony.baxter) Date: Wed, 18 Oct 2006 07:13:30 +0200 (CEST) Subject: [Python-checkins] r52380 - python/tags/r244 Message-ID: <20061018051330.5C51E1E4006@bag.python.org> Author: anthony.baxter Date: Wed Oct 18 07:13:30 2006 New Revision: 52380 Added: python/tags/r244/ - copied from r52379, python/branches/release24-maint/ Log: Tagging for release of Python 2.4.4 From python-checkins at python.org Wed Oct 18 07:30:25 2006 From: python-checkins at python.org (tim.peters) Date: Wed, 18 Oct 2006 07:30:25 +0200 (CEST) Subject: [Python-checkins] r52381 - python/branches/release25-maint/Modules/cStringIO.c Message-ID: <20061018053025.E47911E4004@bag.python.org> Author: tim.peters Date: Wed Oct 18 07:30:25 2006 New Revision: 52381 Modified: python/branches/release25-maint/Modules/cStringIO.c Log: C:\Code\python>type c.txt Merge rev 52377 from trunk: newIobject(): repaired incorrect cast to quiet MSVC warning. Modified: python/branches/release25-maint/Modules/cStringIO.c ============================================================================== --- python/branches/release25-maint/Modules/cStringIO.c (original) +++ python/branches/release25-maint/Modules/cStringIO.c Wed Oct 18 07:30:25 2006 @@ -657,7 +657,7 @@ char *buf; Py_ssize_t size; - if (PyObject_AsCharBuffer(s, (const void **)&buf, &size) != 0) + if (PyObject_AsCharBuffer(s, (const char **)&buf, &size) != 0) return NULL; self = PyObject_New(Iobject, &Itype); From buildbot at python.org Wed Oct 18 08:30:00 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 18 Oct 2006 06:30:00 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20061018063001.15DA61E4004@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/71 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: tim.peters Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Wed Oct 18 08:50:23 2006 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 18 Oct 2006 08:50:23 +0200 (CEST) Subject: [Python-checkins] r52382 - python/branches/release24-maint/PCbuild/BUILDno.txt python/branches/release24-maint/PCbuild/pythoncore.vcproj Message-ID: <20061018065023.332741E4009@bag.python.org> Author: martin.v.loewis Date: Wed Oct 18 08:50:22 2006 New Revision: 52382 Modified: python/branches/release24-maint/PCbuild/BUILDno.txt python/branches/release24-maint/PCbuild/pythoncore.vcproj Log: Bump buildno for 2.4.4. Modified: python/branches/release24-maint/PCbuild/BUILDno.txt ============================================================================== --- python/branches/release24-maint/PCbuild/BUILDno.txt (original) +++ python/branches/release24-maint/PCbuild/BUILDno.txt Wed Oct 18 08:50:22 2006 @@ -33,6 +33,8 @@ Windows Python BUILD numbers ---------------------------- + 71 2.4.4 + 18-Oct-2006 70 2.4.4c1 11-Oct-2006 69 2.4.3 Modified: python/branches/release24-maint/PCbuild/pythoncore.vcproj ============================================================================== --- python/branches/release24-maint/PCbuild/pythoncore.vcproj (original) +++ python/branches/release24-maint/PCbuild/pythoncore.vcproj Wed Oct 18 08:50:22 2006 @@ -1385,7 +1385,7 @@ Name="VCCLCompilerTool" Optimization="2" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=70"/> + PreprocessorDefinitions="BUILD=71"/> @@ -1393,7 +1393,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="" - PreprocessorDefinitions="BUILD=70"/> + PreprocessorDefinitions="BUILD=71"/> From python-checkins at python.org Wed Oct 18 09:02:37 2006 From: python-checkins at python.org (anthony.baxter) Date: Wed, 18 Oct 2006 09:02:37 +0200 (CEST) Subject: [Python-checkins] r52383 - python/tags/r244 Message-ID: <20061018070237.0BFCB1E4004@bag.python.org> Author: anthony.baxter Date: Wed Oct 18 09:02:36 2006 New Revision: 52383 Removed: python/tags/r244/ Log: regenerating tag. From python-checkins at python.org Wed Oct 18 09:03:14 2006 From: python-checkins at python.org (anthony.baxter) Date: Wed, 18 Oct 2006 09:03:14 +0200 (CEST) Subject: [Python-checkins] r52384 - python/tags/r244 Message-ID: <20061018070314.7DEB31E4004@bag.python.org> Author: anthony.baxter Date: Wed Oct 18 09:03:14 2006 New Revision: 52384 Added: python/tags/r244/ - copied from r52383, python/branches/release24-maint/ Log: Tagging for release of Python 2.4.4 From buildbot at python.org Wed Oct 18 09:10:49 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 18 Oct 2006 07:10:49 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.4 Message-ID: <20061018071049.34FBB1E4013@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/225 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 Wed Oct 18 09:23:27 2006 From: buildbot at python.org (buildbot at python.org) Date: Wed, 18 Oct 2006 07:23:27 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20061018072327.5A9A51E4004@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/75 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: tim.peters Build Had Warnings: warnings test sincerely, -The Buildbot From neal at metaslash.com Wed Oct 18 23:27:34 2006 From: neal at metaslash.com (Neal Norwitz) Date: Wed, 18 Oct 2006 17:27:34 -0400 Subject: [Python-checkins] Python Regression Test Failures all (1) Message-ID: <20061018212734.GA6263@python.psfb.org> test_grammar test_opcodes test_operations test_builtin test_exceptions test_types test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_dict test_difflib test_dircache test_dis test_distutils test_dl test_doctest test_doctest2 test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_nis skipped -- Local domain name not set test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7229 refs] [7229 refs] [7229 refs] test_popen2 test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7604 refs] [7604 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_socket test_socket_ssl test_socketserver test_softspace test_sort test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structseq test_subprocess [7224 refs] [7225 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7225 refs] [8775 refs] [7440 refs] [7225 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] . [7224 refs] [7224 refs] this bit of output is from a test of stdout in a different process ... [7224 refs] [7224 refs] [7440 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7224 refs] [7224 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_tempfile [7231 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_unittest test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test test_urllib2net failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_urllib2net.py", line 193, in test_http self._test_urls(urls, self._extra_handlers()) File "/tmp/python-test/local/lib/python2.6/test/test_urllib2net.py", line 238, in _test_urls f = urllib2.urlopen(url, req) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 121, in urlopen return _opener.open(url, data) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 380, in open response = meth(req, response) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 491, in http_response 'http', request, response, code, msg, hdrs) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 412, in error result = self._call_chain(*args) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 353, in _call_chain result = func(*args) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 575, in http_error_302 return self.parent.open(new) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 374, in open response = self._open(req, data) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 392, in _open '_open', req) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 353, in _call_chain result = func(*args) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 1101, in http_open return self.do_open(httplib.HTTPConnection, req) File "/tmp/python-test/local/lib/python2.6/urllib2.py", line 1074, in do_open r = h.getresponse() File "/tmp/python-test/local/lib/python2.6/httplib.py", line 924, in getresponse response.begin() File "/tmp/python-test/local/lib/python2.6/httplib.py", line 385, in begin version, status, reason = self._read_status() File "/tmp/python-test/local/lib/python2.6/httplib.py", line 349, in _read_status raise BadStatusLine(line) BadStatusLine test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 295 tests OK. 1 test failed: test_urllib2net 22 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_gl test_imgfile test_ioctl test_macfs test_macostools test_nis test_pep277 test_plistlib test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [449936 refs] From python-checkins at python.org Thu Oct 19 00:48:53 2006 From: python-checkins at python.org (brett.cannon) Date: Thu, 19 Oct 2006 00:48:53 +0200 (CEST) Subject: [Python-checkins] r52385 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061018224853.DA2C01E4004@bag.python.org> Author: brett.cannon Date: Thu Oct 19 00:48:52 2006 New Revision: 52385 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Complete initial tests for an __import__ replacement. Packages are not supported yet, but backwards-compatibility for the search order and entries of None in sys.path_importer_cache. 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 19 00:48:52 2006 @@ -16,15 +16,20 @@ * 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 - raising an exception. - * Is module returned by load_module() actually used for anything? - -Things to be exposed at the Python level: - * Python/marshal.c:r_long()/w_long() - -Possible Py3K improvements: +Clarifications for PEP 302 +========================== +* Raise ImportError when load_module() fails to load a module without + raising an exception. +* Is module returned by load_module() actually used for anything? + +Things to be exposed at the Python level +======================================== +* Python/marshal.c:r_long()/w_long() + +Py3K +==== +Improvements +------------ * Have a meta_path entry for checking sys.modules to remove need for loaders to do it. * Put importer objects directly into sys.path to remove need for @@ -48,19 +53,24 @@ + Removes None entries from sys.path_importer_cache. + Rely on default importers being in sys.path_hooks or sys.meta_path. -Rejected Py3K improvements: +Rejected Ideas +-------------- * Passing in new module to loaders Creating a new module is minimal and loader might want to use a different type of object. -PTL use-case: +Use Cases +========= +PTL +--- * Use filesystem importer and loader. * Subclass PyPycFileHandler + Set source_handles to '.ptl' and bytecode to '.ptlc'. + get_code_from_source() - Handle transforming to pure Python code here. -sqlite3 importer use-case: +sqlite3 +------- + DB - Module name. - Source code. @@ -534,30 +544,38 @@ class Importer(object): - """Class that re-implements __import__.""" - - def __init__(self, default_importer_factory=None, - default_meta_path=(BuiltinImporter, FrozenImporter)): - """Store the built-in importer factory to use when - sys.path_importer_cache has a None entry. - - The importer factory should act just like an object that was put on - sys.path_hooks. + """Class that re-implements __import__. + + Backwards compatibility is maintained by extending sys.meta_path + interally (for handling built-in and frozen modules) and providing a + default path hooks entry (for extension modules, .py, and .pyc + files). Both are controlled during instance initialization. + + """ + # XXX Packages not supported. - """ - if default_importer_factory: - self.default_importer_factory = default_importer_factory - else: + def __init__(self, default_path_hook=None, + extended_meta_path=(BuiltinImporter, FrozenImporter)): + """Store a default path hook entry and a sequence to internally extend + sys.meta_path by.""" + self.extended_meta_path = extended_meta_path + self.default_path_hook = default_path_hook + if not self.default_path_hook: # Create a handler to deal with extension modules, .py, and .pyc # files. Built-in and frozen modules are handled by sys.meta_path # entries. handlers = ExtensionFileHandler(), PyPycFileHandler() - self.default_importer_factory = FileSystemFactory(*handlers) - self.default_meta_path = default_meta_path + self.default_path_hook = FileSystemFactory(*handlers) def search_meta_path(self, name): - """Check the importers on sys.meta_path for a loader.""" - for entry in (tuple(sys.meta_path) + tuple(self.default_meta_path)): + """Check the importers on sys.meta_path for a loader along with the + extended meta path sequence stored within this instance. + + The extended sys.meta_path entries are searched after the entries on + sys.meta_path. + + """ + for entry in (tuple(sys.meta_path) + self.extended_meta_path): loader = entry.find_module(name) if loader: return loader @@ -565,13 +583,20 @@ raise ImportError("%s not found on meta path" % name) def sys_path_importer(self, path_entry): - """Return the importer for the entry on sys.path.""" + """Return the importer for the entry on sys.path. + + If an entry on sys.path has None stored in sys.path_importer_cache + then use the default path hook. + + """ try: # See if an importer is cached. importer = sys.path_importer_cache[path_entry] - # If None was stored, use default importer factory. + # If None was returned, use default importer factory. if importer is None: - return self.default_importer_factory(path_entry) + # XXX Would it break backwards-compatibility to set the importer + # in sys.path_importer_cache, replacing the None entry? + return self.default_path_hook(path_entry) else: return importer except KeyError: @@ -580,6 +605,10 @@ for importer_factory in sys.path_hooks: try: importer = importer_factory(path_entry) + # XXX Going to break backwards-compatibility by storing + # an instance of the default importer? None still handled + # properly so shouldn't be any different than some other + # importer being stored. sys.path_importer_cache[path_entry] = importer return importer except ImportError: @@ -587,10 +616,12 @@ else: # No importer factory on sys.path_hooks works; use the default # importer factory. - sys.path_importer_cache[path_entry] = None try: - return self.default_importer_factory(path_entry) + importer = self.default_path_hook(path_entry) + sys.path_importer_cache[path_entry] = importer + return importer except ImportError: + sys.path_importer_cache[path_entry] = None raise ImportError("no importer found for %s" % path_entry) def search_sys_path(self, name): 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 19 00:48:52 2006 @@ -577,8 +577,66 @@ self.handler.handles[0]) # There should be at least one attribute that does not start with '_'. self.failUnless(any(True for attr in dir(module) - if not attr.startswith('_'))) - + if not attr.startswith('_'))) + + +class ErrorImporter(object): + + """Helper class to have a guaranteed error point.""" + + def find_module(self, fullname, path=None): + self.find_request = fullname, path + raise ImportError + + @classmethod + def set_on_sys_path(cls): + error_entry = '' + sys.path.append(error_entry) + ins = cls() + sys.path_importer_cache[error_entry] = ins + return ins + +class PassImporter(object): + + """Always pass on importing a module.""" + + def find_module(self, fullname, path=None): + self.find_request = fullname, path + return None + + @classmethod + def set_on_sys_path(cls): + pass_entry = '' + sys.path.append(pass_entry) + ins = cls() + sys.path_importer_cache[pass_entry] = ins + return ins + +class SucceedImporter(object): + + """Always succeed by returning 'self'.""" + + module = 42 + + def __call__(self, path_entry): + return self + + def find_module(self, fullname, path=None): + self.find_request = fullname, path + return self + + def load_module(self, fullname, path=None): + self.load_request = fullname, path + return self.module + + @classmethod + def set_on_sys_path(cls): + succeed_entry = '' + sys.path.append(succeed_entry) + ins = cls() + sys.path_importer_cache[succeed_entry] = ins + return ins + class SimpleImportTests(unittest.TestCase): @@ -586,6 +644,8 @@ def setUp(self): """Store a copy of the 'sys' attribute pertaining to imports.""" + # Don't backup sys.modules since dict is cached and losing the cache + # is not that severe. self.old_sys_modules = sys.modules.copy() self.old_meta_path = sys.meta_path[:] self.old_sys_path = sys.path[:] @@ -595,7 +655,8 @@ def tearDown(self): """Restore backup of import-related attributes in 'sys'.""" - sys.modules = self.old_sys_modules + sys.modules.clear() + sys.modules.update(self.old_sys_modules) sys.meta_path = self.old_meta_path sys.path = self.old_sys_path sys.path_hooks = self.old_path_hooks @@ -604,12 +665,26 @@ def test_default_importer_factory(self): # Make sure that the object passed in during initialization is used # when sys.path_importer_cache has a value of None. - pass + succeed_importer = SucceedImporter() + import_ = importer.Importer(succeed_importer, ()) + sys.meta_path = [] + sys.path = [''] + sys.path_importer_cache[''] = None + module = import_('sys') + self.failUnlessEqual(succeed_importer.find_request, ('sys', None)) + self.failUnless(module is SucceedImporter.module) - def test_default_meta_path(self): + def test_extended_meta_path(self): # Default meta_path entries set during initialization should be # queried after sys.meta_path. - pass + pass_importer = PassImporter() + sys.meta_path = [pass_importer] + succeed_importer = SucceedImporter() + import_ = importer.Importer(extended_meta_path=(succeed_importer,)) + module = import_('sys') + for meta_importer in (pass_importer, succeed_importer): + self.failUnlessEqual(meta_importer.find_request, ('sys', None)) + self.failUnless(module is SucceedImporter.module) def test_default_init(self): # The default initialization should work with a None entry for every @@ -637,35 +712,65 @@ module = self.import_('token') self.failUnlessEqual(module.__name__, 'token') self.failUnless(hasattr(module, 'ISTERMINAL')) - - def test_meta_path(self): - # Test meta_path searching for a loader. - pass + + def test_search_meta_path(self): + # Test search method of sys.meta_path. + # Should raise ImportError on error. + import_ = importer.Importer(extended_meta_path=()) + sys.meta_path = [] + self.failUnlessRaises(ImportError, import_.search_meta_path, + 'sys') + # Verify call order. + meta_path = PassImporter(), SucceedImporter() + sys.meta_path = meta_path + loader = import_.search_meta_path('sys') + for entry in meta_path: + self.failUnlessEqual(entry.find_request, ('sys', None)) + self.failUnless(loader is meta_path[-1]) - def test_sys_path(self): + def test_search_sys_path(self): # Test sys.path searching for a loader. - pass - + sys.meta_path = [] + import_ = importer.Importer(extended_meta_path=()) + sys.path = [] + sys_path = (PassImporter.set_on_sys_path(), + SucceedImporter.set_on_sys_path()) + module = import_('token') + for entry in sys_path: + self.failUnlessEqual(entry.find_request, ('token', None)) + self.failUnless(module is SucceedImporter.module) + def test_importer_cache_preexisting(self): # A pre-existing importer should be returned if it exists in # sys.path_importer_cache. - pass - - def test_importer_cache_None(self): - # A entry of None in sys.path_importer_cache should get one back an - # importer from the default importer factory. - pass + sys.path = [] + succeed_importer = SucceedImporter.set_on_sys_path() + loader = self.import_.search_sys_path('sys') + self.failUnless(loader is succeed_importer) def test_importer_cache_from_path_hooks(self): # If an entry does not exist for a sys.path entry in the importer cache # then sys.path_hooks should be searched and if one is found then cache # it. - pass + path_entry = '' + succeed_importer = SucceedImporter() + sys.path = [path_entry] + sys.path_importer_cache.clear() + sys.path_hooks = [succeed_importer] + loader = self.import_.search_sys_path('sys') + self.failUnless(loader is succeed_importer) + self.failUnless(sys.path_importer_cache[path_entry] is + succeed_importer) def test_importer_cache_no_path_hooks(self): # If an entry does not exist for a sys.path entry in the importer cache # and sys.path_hooks has nothing for the entry, None should be set. - pass + path_entry = '' + sys.path = [path_entry] + sys.path_hooks = [] + sys.path_importer_cache.clear() + self.failUnlessRaises(ImportError, self.import_.search_sys_path, 'sys') + self.failUnless(sys.path_importer_cache[path_entry] is None) def test_main(): From python-checkins at python.org Thu Oct 19 12:58:48 2006 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 19 Oct 2006 12:58:48 +0200 (CEST) Subject: [Python-checkins] r52387 - in python/trunk: Include/modsupport.h Include/pyport.h Misc/NEWS configure configure.in pyconfig.h.in Message-ID: <20061019105848.B41701E400E@bag.python.org> Author: martin.v.loewis Date: Thu Oct 19 12:58:46 2006 New Revision: 52387 Modified: python/trunk/Include/modsupport.h python/trunk/Include/pyport.h python/trunk/Misc/NEWS python/trunk/configure python/trunk/configure.in python/trunk/pyconfig.h.in Log: Add check for the PyArg_ParseTuple format, and declare it if it is supported. Modified: python/trunk/Include/modsupport.h ============================================================================== --- python/trunk/Include/modsupport.h (original) +++ python/trunk/Include/modsupport.h Thu Oct 19 12:58:46 2006 @@ -24,7 +24,7 @@ #endif PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...); -PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...); +PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3); PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, const char *, char **, ...); PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...); Modified: python/trunk/Include/pyport.h ============================================================================== --- python/trunk/Include/pyport.h (original) +++ python/trunk/Include/pyport.h Thu Oct 19 12:58:46 2006 @@ -749,6 +749,15 @@ #define Py_GCC_ATTRIBUTE(x) __attribute__(x) #endif +/* + * Add PyArg_ParseTuple format where available. + */ +#ifdef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE +#define Py_FORMAT_PARSETUPLE(func,p1,p2) __attribute__((format(func,p1,p2))) +#else +#define Py_FORMAT_PARSETUPLE(func,p1,p2) +#endif + /* Eliminate end-of-loop code not reached warnings from SunPro C * when using do{...}while(0) macros */ Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Oct 19 12:58:46 2006 @@ -223,6 +223,9 @@ Build ----- +- configure now checks whether gcc supports the PyArg_ParseTuple format + attribute. + - Bug #1578513: Cross compilation was broken by a change to configure. Repair so that it's back to how it was in 2.4.3. Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Thu Oct 19 12:58:46 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52089 . +# From configure.in Revision: 52363 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.6. # @@ -4036,6 +4036,70 @@ fi fi +# Check whether GCC supports PyArg_ParseTuple format +if test "$GCC" = "yes" +then + echo "$as_me:$LINENO: checking whether gcc supports ParseTuple __format__" >&5 +echo $ECHO_N "checking whether gcc supports ParseTuple __format__... $ECHO_C" >&6 + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2))); + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ATTRIBUTE_FORMAT_PARSETUPLE 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + # On some compilers, pthreads are available without further options # (e.g. MacOS X). On some of these systems, the compiler will not # complain if unaccepted options are passed (e.g. gcc on Mac OS X). Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Thu Oct 19 12:58:46 2006 @@ -890,6 +890,21 @@ fi fi +# Check whether GCC supports PyArg_ParseTuple format +if test "$GCC" = "yes" +then + AC_MSG_CHECKING(whether gcc supports ParseTuple __format__) + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Werror" + AC_TRY_COMPILE([ + void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2))); + ],, + AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + ) +fi + # On some compilers, pthreads are available without further options # (e.g. MacOS X). On some of these systems, the compiler will not # complain if unaccepted options are passed (e.g. gcc on Mac OS X). Modified: python/trunk/pyconfig.h.in ============================================================================== --- python/trunk/pyconfig.h.in (original) +++ python/trunk/pyconfig.h.in Thu Oct 19 12:58:46 2006 @@ -40,6 +40,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ASM_TYPES_H +/* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */ +#undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE + /* Define to 1 if you have the `bind_textdomain_codeset' function. */ #undef HAVE_BIND_TEXTDOMAIN_CODESET From python-checkins at python.org Thu Oct 19 13:00:38 2006 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 19 Oct 2006 13:00:38 +0200 (CEST) Subject: [Python-checkins] r52388 - in python/trunk/Modules: _ctypes/callproc.c _ssl.c audioop.c dbmmodule.c Message-ID: <20061019110038.A94A81E4002@bag.python.org> Author: martin.v.loewis Date: Thu Oct 19 13:00:37 2006 New Revision: 52388 Modified: python/trunk/Modules/_ctypes/callproc.c python/trunk/Modules/_ssl.c python/trunk/Modules/audioop.c python/trunk/Modules/dbmmodule.c Log: Fix various minor errors in passing arguments to PyArg_ParseTuple. Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Thu Oct 19 13:00:37 2006 @@ -1247,11 +1247,11 @@ static PyObject *py_dl_close(PyObject *self, PyObject *args) { - void * handle; + int handle; if (!PyArg_ParseTuple(args, "i:dlclose", &handle)) return NULL; - if (dlclose(handle)) { + if (dlclose((void*)handle)) { PyErr_SetString(PyExc_OSError, ctypes_dlerror()); return NULL; @@ -1263,12 +1263,12 @@ static PyObject *py_dl_sym(PyObject *self, PyObject *args) { char *name; - void *handle; + int handle; void *ptr; if (!PyArg_ParseTuple(args, "is:dlsym", &handle, &name)) return NULL; - ptr = ctypes_dlsym(handle, name); + ptr = ctypes_dlsym((void*)handle, name); if (!ptr) { PyErr_SetString(PyExc_OSError, ctypes_dlerror()); @@ -1286,7 +1286,7 @@ static PyObject * call_function(PyObject *self, PyObject *args) { - PPROC func; + int func; PyObject *arguments; PyObject *result; @@ -1296,7 +1296,7 @@ &PyTuple_Type, &arguments)) return NULL; - result = _CallProc(func, + result = _CallProc((PPROC)func, arguments, #ifdef MS_WIN32 NULL, @@ -1317,7 +1317,7 @@ static PyObject * call_cdeclfunction(PyObject *self, PyObject *args) { - PPROC func; + int func; PyObject *arguments; PyObject *result; @@ -1327,7 +1327,7 @@ &PyTuple_Type, &arguments)) return NULL; - result = _CallProc(func, + result = _CallProc((PPROC)func, arguments, #ifdef MS_WIN32 NULL, @@ -1510,7 +1510,7 @@ #else "On:resize", #endif - (PyObject *)&obj, &size)) + &obj, &size)) return NULL; dict = PyObject_stgdict((PyObject *)obj); Modified: python/trunk/Modules/_ssl.c ============================================================================== --- python/trunk/Modules/_ssl.c (original) +++ python/trunk/Modules/_ssl.c Thu Oct 19 13:00:37 2006 @@ -317,7 +317,7 @@ if (!PyArg_ParseTuple(args, "O!|zz:ssl", PySocketModule.Sock_Type, - (PyObject*)&Sock, + &Sock, &key_file, &cert_file)) return NULL; Modified: python/trunk/Modules/audioop.c ============================================================================== --- python/trunk/Modules/audioop.c (original) +++ python/trunk/Modules/audioop.c Thu Oct 19 13:00:37 2006 @@ -472,8 +472,12 @@ double aj_m1, aj_lm1; double sum_ri_2, sum_aij_2, sum_aij_ri, result, best_result, factor; + /* Passing a short** for an 's' argument is correct only + if the string contents is aligned for interpretation + as short[]. Due to the definition of PyStringObject, + this is currently (Python 2.6) the case. */ if ( !PyArg_ParseTuple(args, "s#s#:findfit", - &cp1, &len1, &cp2, &len2) ) + (char**)&cp1, &len1, (char**)&cp2, &len2) ) return 0; if ( len1 & 1 || len2 & 1 ) { PyErr_SetString(AudioopError, "Strings should be even-sized"); @@ -530,7 +534,7 @@ double sum_ri_2, sum_aij_ri, result; if ( !PyArg_ParseTuple(args, "s#s#:findfactor", - &cp1, &len1, &cp2, &len2) ) + (char**)&cp1, &len1, (char**)&cp2, &len2) ) return 0; if ( len1 & 1 || len2 & 1 ) { PyErr_SetString(AudioopError, "Strings should be even-sized"); @@ -562,7 +566,8 @@ double aj_m1, aj_lm1; double result, best_result; - if ( !PyArg_ParseTuple(args, "s#i:findmax", &cp1, &len1, &len2) ) + if ( !PyArg_ParseTuple(args, "s#i:findmax", + (char**)&cp1, &len1, &len2) ) return 0; if ( len1 & 1 ) { PyErr_SetString(AudioopError, "Strings should be even-sized"); Modified: python/trunk/Modules/dbmmodule.c ============================================================================== --- python/trunk/Modules/dbmmodule.c (original) +++ python/trunk/Modules/dbmmodule.c Thu Oct 19 13:00:37 2006 @@ -208,11 +208,13 @@ static PyObject * dbm_has_key(register dbmobject *dp, PyObject *args) { + char *tmp_ptr; datum key, val; int tmp_size; - if (!PyArg_ParseTuple(args, "s#:has_key", &key.dptr, &tmp_size)) + if (!PyArg_ParseTuple(args, "s#:has_key", &tmp_ptr, &tmp_size)) return NULL; + key.dptr = tmp_ptr; key.dsize = tmp_size; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); @@ -224,11 +226,13 @@ { datum key, val; PyObject *defvalue = Py_None; + char *tmp_ptr; int tmp_size; if (!PyArg_ParseTuple(args, "s#|O:get", - &key.dptr, &tmp_size, &defvalue)) + &tmp_ptr, &tmp_size, &defvalue)) return NULL; + key.dptr = tmp_ptr; key.dsize = tmp_size; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); @@ -245,11 +249,13 @@ { datum key, val; PyObject *defvalue = NULL; + char *tmp_ptr; int tmp_size; if (!PyArg_ParseTuple(args, "s#|S:setdefault", - &key.dptr, &tmp_size, &defvalue)) + &tmp_ptr, &tmp_size, &defvalue)) return NULL; + key.dptr = tmp_ptr; key.dsize = tmp_size; check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); From buildbot at python.org Thu Oct 19 13:07:15 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 11:07:15 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu dapper trunk Message-ID: <20061019110715.69C661E4003@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/748 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Thu Oct 19 13:08:29 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 11:08:29 +0000 Subject: [Python-checkins] buildbot failure in x86 Ubuntu edgy (icc) trunk Message-ID: <20061019110829.CC9E31E4002@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu edgy (icc) trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520edgy%2520%2528icc%2529%2520trunk/builds/1020 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 Thu Oct 19 13:14:45 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 11:14:45 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061019111445.1747C1E4002@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/158 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 buildbot at python.org Thu Oct 19 13:24:15 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 11:24:15 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20061019112415.7E9591E4002@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/1676 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 buildbot at python.org Thu Oct 19 13:24:32 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 11:24:32 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20061019112432.84CBC1E4002@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/1591 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 buildbot at python.org Thu Oct 19 13:45:25 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 11:45:25 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20061019114526.018E21E4002@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/1523 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 buildbot at python.org Thu Oct 19 13:49:55 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 11:49:55 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20061019114955.837831E4002@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/1508 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 buildbot at python.org Thu Oct 19 13:52:31 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 11:52:31 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20061019115231.B8F671E4002@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/166 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 buildbot at python.org Thu Oct 19 13:54:52 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 11:54:52 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061019115452.91FBC1E400A@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/1229 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 buildbot at python.org Thu Oct 19 14:02:33 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 12:02:33 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20061019120233.81BD21E4002@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/452 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 buildbot at python.org Thu Oct 19 16:45:09 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 19 Oct 2006 14:45:09 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian trunk Message-ID: <20061019144509.5B6771E4003@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/453 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 Thu Oct 19 18:01:39 2006 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 19 Oct 2006 18:01:39 +0200 (CEST) Subject: [Python-checkins] r52389 - python/trunk/configure python/trunk/configure.in Message-ID: <20061019160139.1E7B11E4006@bag.python.org> Author: martin.v.loewis Date: Thu Oct 19 18:01:37 2006 New Revision: 52389 Modified: python/trunk/configure python/trunk/configure.in Log: Restore CFLAGS after checking for __attribute__ Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Thu Oct 19 18:01:37 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52363 . +# From configure.in Revision: 52387 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.6. # @@ -4098,6 +4098,7 @@ fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$save_CFLAGS fi # On some compilers, pthreads are available without further options Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Thu Oct 19 18:01:37 2006 @@ -903,6 +903,7 @@ AC_MSG_RESULT(yes), AC_MSG_RESULT(no) ) + CFLAGS=$save_CFLAGS fi # On some compilers, pthreads are available without further options From python-checkins at python.org Thu Oct 19 23:55:55 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 19 Oct 2006 23:55:55 +0200 (CEST) Subject: [Python-checkins] r52390 - python/trunk/Doc/inst/inst.tex Message-ID: <20061019215555.B8AE11E4002@bag.python.org> Author: andrew.kuchling Date: Thu Oct 19 23:55:55 2006 New Revision: 52390 Modified: python/trunk/Doc/inst/inst.tex Log: [Bug #1576348] Fix typo in example Modified: python/trunk/Doc/inst/inst.tex ============================================================================== --- python/trunk/Doc/inst/inst.tex (original) +++ python/trunk/Doc/inst/inst.tex Thu Oct 19 23:55:55 2006 @@ -632,7 +632,7 @@ installation base directory when you run the setup script. For example, \begin{verbatim} -python setup.py --install-base=/tmp +python setup.py install --install-base=/tmp \end{verbatim} would install pure modules to \filevar{/tmp/python/lib} in the first From python-checkins at python.org Thu Oct 19 23:56:15 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 19 Oct 2006 23:56:15 +0200 (CEST) Subject: [Python-checkins] r52391 - python/branches/release25-maint/Doc/inst/inst.tex Message-ID: <20061019215615.229A61E4002@bag.python.org> Author: andrew.kuchling Date: Thu Oct 19 23:56:14 2006 New Revision: 52391 Modified: python/branches/release25-maint/Doc/inst/inst.tex Log: [Bug #1576348] Fix typo in example Modified: python/branches/release25-maint/Doc/inst/inst.tex ============================================================================== --- python/branches/release25-maint/Doc/inst/inst.tex (original) +++ python/branches/release25-maint/Doc/inst/inst.tex Thu Oct 19 23:56:14 2006 @@ -632,7 +632,7 @@ installation base directory when you run the setup script. For example, \begin{verbatim} -python setup.py --install-base=/tmp +python setup.py install --install-base=/tmp \end{verbatim} would install pure modules to \filevar{/tmp/python/lib} in the first From python-checkins at python.org Fri Oct 20 04:07:01 2006 From: python-checkins at python.org (brett.cannon) Date: Fri, 20 Oct 2006 04:07:01 +0200 (CEST) Subject: [Python-checkins] r52392 - peps/trunk/pep-0302.txt Message-ID: <20061020020701.44ECE1E4002@bag.python.org> Author: brett.cannon Date: Fri Oct 20 04:07:00 2006 New Revision: 52392 Modified: peps/trunk/pep-0302.txt Log: Fix a minor grammar error. Modified: peps/trunk/pep-0302.txt ============================================================================== --- peps/trunk/pep-0302.txt (original) +++ peps/trunk/pep-0302.txt Fri Oct 20 04:07:00 2006 @@ -396,7 +396,7 @@ The loader.get_code(fullname) method should return the code object associated with the module, or None if it's a built-in or extension module. If the loader doesn't have the code object but it _does_ - have the source code, it should return the compiled the source code. + have the source code, it should return the compiled source code. (This is so that our caller doesn't also need to check get_source() if all it needs is the code object.) From python-checkins at python.org Fri Oct 20 04:08:38 2006 From: python-checkins at python.org (brett.cannon) Date: Fri, 20 Oct 2006 04:08:38 +0200 (CEST) Subject: [Python-checkins] r52393 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061020020838.215811E4002@bag.python.org> Author: brett.cannon Date: Fri Oct 20 04:08:37 2006 New Revision: 52393 Modified: sandbox/trunk/import_in_py/importer.py Log: Add notes about what packages entail. Also add notes about possible API changes for this code. Starting with tweaking PEP 302 optional APIs so that most of what PyPycFileHandler can be gotten from that and some additions and thus be just a function that takes a loader and uses that to perform its queries. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Fri Oct 20 04:08:37 2006 @@ -16,17 +16,55 @@ * PEP 328: Imports: Multi-line and Absolute/Relative http://www.python.org/dev/peps/pep-0328 -Clarifications for PEP 302 -========================== +Clarifications +============== * Raise ImportError when load_module() fails to load a module without raising an exception. * Is module returned by load_module() actually used for anything? + +Package notes +============= +* __path__ is set to the deepest package directory, not the top package + directory [introspection]. +* __path__ is not inherited in any way [introspection]. +* sys.path_importer_cache has an entry for each package directory that was + successfully imported [introspection]. + +* Packages take precedence over modules with the same name in the same sys.path + entry [package essay]. +* __path__ can be a list that must be used for searching other locations + [package essay]. +* ``from ... import ...`` first checks that fromlist is from module specified + or is a list of modules to import [package essay]. +* ``import ...`` can only be a package or module [package essay]. +* ``from ... import *`` for packages uses __all__ as a list of modules to be + imported; if no __all__ is defined then the attributes on the packages are + bound in the namespace (including previously imported modules) + [package essay]. +* Must make sure that importing submodules later on have the proper attributes + for modules with the submodule in its path (e.g., inheriting A.B.C and A.B.D + need to have A.B having C and D as attributes) [package essay]. +* Submodules must be imported first (e.g., importing A.B requires A to be + imported first) [package essay]. +* __path__ is always initialized to a list with a single item [package essay]. +* __path__ is the directory of the package (a subdirectory of an entry on + sys.path) [package essay]. +* Modules in sys.modules with a value of None are for redirection to a + top-level module that was imported in a submodule [pacakge essay]. + +* for modules in packages, __path__ is used instead of sys.path for searching; + this means that the usual path_hooks/path_importer_cache dance is done for + entries in __path__ instead of sys.path (meta_path is still searched + regardless of the value of __path__) [PEP 302]. + + Things to be exposed at the Python level ======================================== * Python/marshal.c:r_long()/w_long() -Py3K + +Py3Kk ==== Improvements ------------ @@ -51,7 +89,7 @@ point it is added to initialization. * Remove any idea of default importer. + Removes None entries from sys.path_importer_cache. - + Rely on default importers being in sys.path_hooks or sys.meta_path. + + Rely on default importers being in sys.path_hooks or sys.meta_path. Rejected Ideas -------------- @@ -59,6 +97,16 @@ Creating a new module is minimal and loader might want to use a different type of object. + +API Ideas +========= +* Move most of API out of handlers and into loaders. + + Most of the methods in PyPycFileHandler are to deal with files which is a + loader thing. + + Basic ideas already there in optional API for loaders from PEP 302, just + not enough for .pyc regeneration and verification. + + Use Cases ========= PTL @@ -176,6 +224,8 @@ class FrozenImporter(BuiltinFrozenBaseImporter): """sys.meta_path class for importing frozen modules.""" + + # XXX Frozen packages seem to exist. _find = imp.is_frozen _load = imp.init_frozen @@ -553,6 +603,7 @@ """ # XXX Packages not supported. + # XXX Import lock not used. def __init__(self, default_path_hook=None, extended_meta_path=(BuiltinImporter, FrozenImporter)): @@ -640,7 +691,7 @@ def __call__(self, name, globals={}, locals={}, fromlist=[], level=-1): """Import a module. - 'name' is the dotted name of the module/package to import. 'globals' and + 'name' is the dotted name of the module/package to import. 'globals'and 'locals' are the global and local namespace dictionaries of the caller (only 'globals' is used to introspect the __path__ attribute of the calling module). fromlist is any specific objects that are to eventually be put @@ -658,6 +709,15 @@ """ # XXX Does not handle packages yet, which means no absolute/relative imports # or fromlist worries. + + # Check for a relative import; if it is one make it absolute to try to import that, + # otherwise import as a top-level module. + # XXX + + # Import submodules. + # XXX + + # Try meta_path entries. try: # Attempt to find a loader on sys.meta_path. @@ -667,4 +727,4 @@ # sys.path. If this fails then module cannot be found. loader = self.search_sys_path(name) # A loader was found. - return loader.load_module(name) \ No newline at end of file + return loader.load_module(name) From python-checkins at python.org Fri Oct 20 09:21:27 2006 From: python-checkins at python.org (thomas.heller) Date: Fri, 20 Oct 2006 09:21:27 +0200 (CEST) Subject: [Python-checkins] r52394 - python/branches/release25-maint/Modules/_ctypes Message-ID: <20061020072127.6B6011E4002@bag.python.org> Author: thomas.heller Date: Fri Oct 20 09:21:26 2006 New Revision: 52394 Modified: python/branches/release25-maint/Modules/_ctypes/ (props changed) Log: Initialized merge tracking via "svnmerge" with revisions "1-51333" from svn+ssh://pythondev at svn.python.org/python/trunk/Modules/_ctypes (This had to be done with the command line: svnmerge init -r 1:51333 -F c:\svn\trunk\Modules\_ctypes because svnmerge isn't able to deduce the branch point r51333 and the HEAD URL automatically in a subdirectory.) From anthony at interlink.com.au Fri Oct 20 09:29:04 2006 From: anthony at interlink.com.au (Anthony Baxter) Date: Fri, 20 Oct 2006 17:29:04 +1000 Subject: [Python-checkins] r52394 - python/branches/release25-maint/Modules/_ctypes In-Reply-To: <20061020072127.6B6011E4002@bag.python.org> References: <20061020072127.6B6011E4002@bag.python.org> Message-ID: <200610201729.05434.anthony@interlink.com.au> On Friday 20 October 2006 17:21, thomas.heller wrote: > Author: thomas.heller > Date: Fri Oct 20 09:21:26 2006 > New Revision: 52394 > > Modified: > python/branches/release25-maint/Modules/_ctypes/ (props changed) > Log: > Initialized merge tracking via "svnmerge" with revisions "1-51333" from > svn+ssh://pythondev at svn.python.org/python/trunk/Modules/_ctypes Is this such a good plan? Not all patches to the trunk ctypes are going to be suitable for merging into the maintenance branch - new features, for instance, are right out. Or can svnmerge handle only merging some patches and not others? -- Anthony Baxter It's never too late to have a happy childhood. From theller at ctypes.org Fri Oct 20 09:50:32 2006 From: theller at ctypes.org (Thomas Heller) Date: Fri, 20 Oct 2006 09:50:32 +0200 Subject: [Python-checkins] r52394 - python/branches/release25-maint/Modules/_ctypes In-Reply-To: <200610201729.05434.anthony@interlink.com.au> References: <20061020072127.6B6011E4002@bag.python.org> <200610201729.05434.anthony@interlink.com.au> Message-ID: Anthony Baxter schrieb: > On Friday 20 October 2006 17:21, thomas.heller wrote: >> Author: thomas.heller >> Date: Fri Oct 20 09:21:26 2006 >> New Revision: 52394 >> >> Modified: >> python/branches/release25-maint/Modules/_ctypes/ (props changed) >> Log: >> Initialized merge tracking via "svnmerge" with revisions "1-51333" from >> svn+ssh://pythondev at svn.python.org/python/trunk/Modules/_ctypes > > Is this such a good plan? Not all patches to the trunk ctypes are going to be > suitable for merging into the maintenance branch - new features, for > instance, are right out. Or can svnmerge handle only merging some patches and > not others? > Yes, it can. 'svnmerge avail' lists available patches as revision numbers. 'svnmerge avail -l' lists the commit messages of the available patches. 'svnmerge block' allows to remove patches from the 'avail' list (because they are new features). As I understand so far, it removes the need for the developer to read the output of 'svn log' in the trunk and in the branch to find out which changes have been integrated or not. All in all, svnmerge is simply a tools that makes merging changes (or NOT merging changes) easier. For example, I see that this change: ------------------------------------------------------------------------ r51379 | thomas.heller | 2006-08-18 16:38:46 +0200 (Fr, 18 Aug 2006) | 6 lines Changed paths: M /python/trunk/Modules/_ctypes/_ctypes.c Add asserts to check for 'impossible' NULL values, with comments. In one place where I'n not 1000% sure about the non-NULL, raise a RuntimeError for safety. This should fix the klocwork issues that Neal sent me. If so, it should be applied to the release25-maint branch also. ------------------------------------------------------------------------ is a candidate for merging, while this one maybe not (see the other message on python-dev): ------------------------------------------------------------------------ r51604 | thomas.heller | 2006-08-25 09:27:33 +0200 (Fr, 25 Aug 2006) | 3 lines Changed paths: M /python/trunk/Lib/ctypes/__init__.py M /python/trunk/Lib/ctypes/test/test_win32.py M /python/trunk/Modules/_ctypes/_ctypes.c M /python/trunk/Modules/_ctypes/_ctypes_test.c M /python/trunk/Modules/_ctypes/callbacks.c M /python/trunk/Modules/_ctypes/callproc.c M /python/trunk/Modules/_ctypes/cfield.c M /python/trunk/Modules/_ctypes/libffi_msvc/ffi.c M /python/trunk/Modules/_ctypes/libffi_msvc/ffi.h M /python/trunk/Modules/_ctypes/libffi_msvc/ffitarget.h Port _ctypes.pyd to win64 on AMD64. ------------------------------------------------------------------------ Thomas From buildbot at python.org Fri Oct 20 13:26:05 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 20 Oct 2006 11:26:05 +0000 Subject: [Python-checkins] buildbot failure in x86 mvlgcc trunk Message-ID: <20061020112605.9D8371E4003@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: The web-page 'force build' button was pressed by 'Martin v. L??wis': test installation Build Source Stamp: [branch trunk] HEAD Blamelist: BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Oct 20 13:52:44 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 20 Oct 2006 11:52:44 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20061020115244.F01061E4002@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/1 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: The web-page 'rebuild' button was pressed by 'Martin v. L??wis': Try again with fixed compiler Build Source Stamp: [branch trunk] HEAD Blamelist: Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Fri Oct 20 21:59:34 2006 From: python-checkins at python.org (thomas.heller) Date: Fri, 20 Oct 2006 21:59:34 +0200 (CEST) Subject: [Python-checkins] r52405 - python/branches/release25-maint/Modules/_ctypes Message-ID: <20061020195934.40F141E4002@bag.python.org> Author: thomas.heller Date: Fri Oct 20 21:59:33 2006 New Revision: 52405 Modified: python/branches/release25-maint/Modules/_ctypes/ (props changed) Log: Recorded merge of revisions 51379-51603,51606-52365 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk/Modules/_ctypes ........ r51379 | thomas.heller | 2006-08-18 16:38:46 +0200 (Fr, 18 Aug 2006) | 6 lines Add asserts to check for 'impossible' NULL values, with comments. In one place where I'n not 1000% sure about the non-NULL, raise a RuntimeError for safety. This should fix the klocwork issues that Neal sent me. If so, it should be applied to the release25-maint branch also. ........ r51401 | neal.norwitz | 2006-08-19 06:23:04 +0200 (Sa, 19 Aug 2006) | 4 lines Move assert to after NULL check, otherwise we deref NULL in the assert. Klocwork #307 ........ r51819 | thomas.heller | 2006-09-07 20:56:28 +0200 (Do, 07 Sep 2006) | 5 lines Anonymous structure fields that have a bit-width specified did not work, and they gave a strange error message from PyArg_ParseTuple: function takes exactly 2 arguments (3 given). With tests. ........ r51820 | thomas.heller | 2006-09-07 21:09:54 +0200 (Do, 07 Sep 2006) | 4 lines The cast function did not accept c_char_p or c_wchar_p instances as first argument, and failed with a 'bad argument to internal function' error message. ........ r52365 | thomas.heller | 2006-10-17 21:30:48 +0200 (Di, 17 Okt 2006) | 6 lines ctypes callback functions only support 'fundamental' result types. Check this and raise an error when something else is used - before this change ctypes would hang or crash when such a callback was called. This is a partial fix for #1574584. Will backport to release25-maint. ........ From python-checkins at python.org Sun Oct 22 10:59:42 2006 From: python-checkins at python.org (walter.doerwald) Date: Sun, 22 Oct 2006 10:59:42 +0200 (CEST) Subject: [Python-checkins] r52414 - python/trunk/Lib/test/test___future__.py Message-ID: <20061022085942.7AD751E4004@bag.python.org> Author: walter.doerwald Date: Sun Oct 22 10:59:41 2006 New Revision: 52414 Modified: python/trunk/Lib/test/test___future__.py Log: Port test___future__ to unittest. Modified: python/trunk/Lib/test/test___future__.py ============================================================================== --- python/trunk/Lib/test/test___future__.py (original) +++ python/trunk/Lib/test/test___future__.py Sun Oct 22 10:59:41 2006 @@ -1,59 +1,63 @@ #! /usr/bin/env python -from test.test_support import verbose, verify -from types import TupleType, StringType, IntType +import unittest +from test import test_support import __future__ GOOD_SERIALS = ("alpha", "beta", "candidate", "final") features = __future__.all_feature_names -# Verify that all_feature_names appears correct. -given_feature_names = features[:] -for name in dir(__future__): - obj = getattr(__future__, name, None) - if obj is not None and isinstance(obj, __future__._Feature): - verify(name in given_feature_names, - "%r should have been in all_feature_names" % name) - given_feature_names.remove(name) -verify(len(given_feature_names) == 0, - "all_feature_names has too much: %r" % given_feature_names) -del given_feature_names - -for feature in features: - value = getattr(__future__, feature) - if verbose: - print "Checking __future__ ", feature, "value", value - - optional = value.getOptionalRelease() - mandatory = value.getMandatoryRelease() - - verify(type(optional) is TupleType, "optional isn't tuple") - verify(len(optional) == 5, "optional isn't 5-tuple") - major, minor, micro, level, serial = optional - verify(type(major) is IntType, "optional major isn't int") - verify(type(minor) is IntType, "optional minor isn't int") - verify(type(micro) is IntType, "optional micro isn't int") - verify(isinstance(level, basestring), "optional level isn't string") - verify(level in GOOD_SERIALS, - "optional level string has unknown value") - verify(type(serial) is IntType, "optional serial isn't int") - - verify(type(mandatory) is TupleType or - mandatory is None, "mandatory isn't tuple or None") - if mandatory is not None: - verify(len(mandatory) == 5, "mandatory isn't 5-tuple") - major, minor, micro, level, serial = mandatory - verify(type(major) is IntType, "mandatory major isn't int") - verify(type(minor) is IntType, "mandatory minor isn't int") - verify(type(micro) is IntType, "mandatory micro isn't int") - verify(isinstance(level, basestring), "mandatory level isn't string") - verify(level in GOOD_SERIALS, - "mandatory serial string has unknown value") - verify(type(serial) is IntType, "mandatory serial isn't int") - verify(optional < mandatory, - "optional not less than mandatory, and mandatory not None") - - verify(hasattr(value, "compiler_flag"), - "feature is missing a .compiler_flag attr") - verify(type(getattr(value, "compiler_flag")) is IntType, - ".compiler_flag isn't int") +class FutureTest(unittest.TestCase): + + def test_names(self): + # Verify that all_feature_names appears correct. + given_feature_names = features[:] + for name in dir(__future__): + obj = getattr(__future__, name, None) + if obj is not None and isinstance(obj, __future__._Feature): + self.assert_( + name in given_feature_names, + "%r should have been in all_feature_names" % name + ) + given_feature_names.remove(name) + self.assertEqual(len(given_feature_names), 0, + "all_feature_names has too much: %r" % given_feature_names) + + def test_attributes(self): + for feature in features: + value = getattr(__future__, feature) + + optional = value.getOptionalRelease() + mandatory = value.getMandatoryRelease() + + a = self.assert_ + e = self.assertEqual + def check(t, name): + a(isinstance(t, tuple), "%s isn't tuple" % name) + e(len(t), 5, "%s isn't 5-tuple" % name) + (major, minor, micro, level, serial) = t + a(isinstance(major, int), "%s major isn't int" % name) + a(isinstance(minor, int), "%s minor isn't int" % name) + a(isinstance(micro, int), "%s micro isn't int" % name) + a(isinstance(level, basestring), + "%s level isn't string" % name) + a(level in GOOD_SERIALS, + "%s level string has unknown value" % name) + a(isinstance(serial, int), "%s serial isn't int" % name) + + check(optional, "optional") + if mandatory is not None: + check(mandatory, "mandatory") + a(optional < mandatory, + "optional not less than mandatory, and mandatory not None") + + a(hasattr(value, "compiler_flag"), + "feature is missing a .compiler_flag attr") + a(isinstance(getattr(value, "compiler_flag"), int), + ".compiler_flag isn't int") + +def test_main(): + test_support.run_unittest(FutureTest) + +if __name__ == "__main__": + test_main() From python-checkins at python.org Sun Oct 22 12:45:19 2006 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 22 Oct 2006 12:45:19 +0200 (CEST) Subject: [Python-checkins] r52415 - in python/trunk: Doc/lib/libos.tex Modules/posixmodule.c Message-ID: <20061022104519.889AB1E4004@bag.python.org> Author: ronald.oussoren Date: Sun Oct 22 12:45:18 2006 New Revision: 52415 Modified: python/trunk/Doc/lib/libos.tex python/trunk/Modules/posixmodule.c Log: Patch #1580674: with this patch os.readlink uses the filesystem encoding to decode unicode objects and returns an unicode object when the argument is one. Modified: python/trunk/Doc/lib/libos.tex ============================================================================== --- python/trunk/Doc/lib/libos.tex (original) +++ python/trunk/Doc/lib/libos.tex Sun Oct 22 12:45:18 2006 @@ -920,6 +920,8 @@ points. The result may be either an absolute or relative pathname; if it is relative, it may be converted to an absolute pathname using \code{os.path.join(os.path.dirname(\var{path}), \var{result})}. +\versionchanged [If the \var{path} is a Unicode object the result will also +be a Unicode object]{2.6} Availability: Macintosh, \UNIX. \end{funcdesc} Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Sun Oct 22 12:45:18 2006 @@ -5687,17 +5687,53 @@ static PyObject * posix_readlink(PyObject *self, PyObject *args) { + PyObject* v; char buf[MAXPATHLEN]; char *path; int n; - if (!PyArg_ParseTuple(args, "s:readlink", &path)) +#ifdef Py_USING_UNICODE + int arg_is_unicode = 0; +#endif + + if (!PyArg_ParseTuple(args, "et:readlink", + Py_FileSystemDefaultEncoding, &path)) return NULL; +#ifdef Py_USING_UNICODE + v = PySequence_GetItem(args, 0); + if (v == NULL) return NULL; + + if (PyUnicode_Check(v)) { + arg_is_unicode = 1; + } + Py_DECREF(v); +#endif + Py_BEGIN_ALLOW_THREADS n = readlink(path, buf, (int) sizeof buf); Py_END_ALLOW_THREADS if (n < 0) return posix_error_with_filename(path); - return PyString_FromStringAndSize(buf, n); + + v = PyString_FromStringAndSize(buf, n); +#ifdef Py_USING_UNICODE + if (arg_is_unicode) { + PyObject *w; + + w = PyUnicode_FromEncodedObject(v, + Py_FileSystemDefaultEncoding, + "strict"); + if (w != NULL) { + Py_DECREF(v); + v = w; + } + else { + /* fall back to the original byte string, as + discussed in patch #683592 */ + PyErr_Clear(); + } + } +#endif + return v; } #endif /* HAVE_READLINK */ From python-checkins at python.org Sun Oct 22 12:46:19 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 22 Oct 2006 12:46:19 +0200 (CEST) Subject: [Python-checkins] r52416 - python/trunk/Include/abstract.h Message-ID: <20061022104619.50E4A1E4004@bag.python.org> Author: martin.v.loewis Date: Sun Oct 22 12:46:18 2006 New Revision: 52416 Modified: python/trunk/Include/abstract.h Log: Patch #1580872: Remove duplicate declaration of PyCallable_Check. Will backport to 2.5. Modified: python/trunk/Include/abstract.h ============================================================================== --- python/trunk/Include/abstract.h (original) +++ python/trunk/Include/abstract.h Sun Oct 22 12:46:18 2006 @@ -288,9 +288,10 @@ */ + /* Declared elsewhere + PyAPI_FUNC(int) PyCallable_Check(PyObject *o); - /* Determine if the object, o, is callable. Return 1 if the object is callable and 0 otherwise. From python-checkins at python.org Sun Oct 22 12:47:29 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 22 Oct 2006 12:47:29 +0200 (CEST) Subject: [Python-checkins] r52417 - python/branches/release25-maint/Include/abstract.h Message-ID: <20061022104729.0FB4C1E4004@bag.python.org> Author: martin.v.loewis Date: Sun Oct 22 12:47:28 2006 New Revision: 52417 Modified: python/branches/release25-maint/Include/abstract.h Log: Patch #1580872: Remove duplicate declaration of PyCallable_Check. Modified: python/branches/release25-maint/Include/abstract.h ============================================================================== --- python/branches/release25-maint/Include/abstract.h (original) +++ python/branches/release25-maint/Include/abstract.h Sun Oct 22 12:47:28 2006 @@ -288,9 +288,10 @@ */ + /* Declared elsewhere + PyAPI_FUNC(int) PyCallable_Check(PyObject *o); - /* Determine if the object, o, is callable. Return 1 if the object is callable and 0 otherwise. From buildbot at python.org Sun Oct 22 12:52:29 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 22 Oct 2006 10:52:29 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20061022105229.8A3D91E4004@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/1230 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Sun Oct 22 12:52:29 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 22 Oct 2006 10:52:29 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian trunk Message-ID: <20061022105229.8EDB61E4005@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/527 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Sun Oct 22 12:55:15 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 22 Oct 2006 12:55:15 +0200 (CEST) Subject: [Python-checkins] r52418 - in python/trunk: Misc/NEWS Modules/_ctypes/libffi/src/x86/sysv.S Message-ID: <20061022105515.D1E811E4005@bag.python.org> Author: martin.v.loewis Date: Sun Oct 22 12:55:15 2006 New Revision: 52418 Modified: python/trunk/Misc/NEWS python/trunk/Modules/_ctypes/libffi/src/x86/sysv.S Log: - Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that ctypes isn't considered as requiring executable stacks. Will backport to 2.5. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 22 12:55:15 2006 @@ -81,6 +81,9 @@ Library ------- +- Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that + ctypes isn't considered as requiring executable stacks. + - ctypes callback functions only support 'fundamental' data types as result type. Raise an error when something else is used. This is a partial fix for Bug #1574584. Modified: python/trunk/Modules/_ctypes/libffi/src/x86/sysv.S ============================================================================== --- python/trunk/Modules/_ctypes/libffi/src/x86/sysv.S (original) +++ python/trunk/Modules/_ctypes/libffi/src/x86/sysv.S Sun Oct 22 12:55:15 2006 @@ -376,3 +376,7 @@ #endif #endif /* ifndef __x86_64__ */ + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif From python-checkins at python.org Sun Oct 22 12:55:26 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 22 Oct 2006 12:55:26 +0200 (CEST) Subject: [Python-checkins] r52419 - in python/branches/release25-maint: Misc/NEWS Modules/_ctypes/libffi/src/x86/sysv.S Message-ID: <20061022105526.708341E4011@bag.python.org> Author: martin.v.loewis Date: Sun Oct 22 12:55:25 2006 New Revision: 52419 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/_ctypes/libffi/src/x86/sysv.S Log: - Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that ctypes isn't considered as requiring executable stacks. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 22 12:55:25 2006 @@ -52,6 +52,9 @@ Extension Modules ----------------- +- Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that + ctypes isn't considered as requiring executable stacks. + - Bug #1567666: Emulate GetFileAttributesExA for Win95. - Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode Modified: python/branches/release25-maint/Modules/_ctypes/libffi/src/x86/sysv.S ============================================================================== --- python/branches/release25-maint/Modules/_ctypes/libffi/src/x86/sysv.S (original) +++ python/branches/release25-maint/Modules/_ctypes/libffi/src/x86/sysv.S Sun Oct 22 12:55:25 2006 @@ -376,3 +376,7 @@ #endif #endif /* ifndef __x86_64__ */ + +#ifdef __ELF__ +.section .note.GNU-stack,"",%progbits +#endif From buildbot at python.org Sun Oct 22 13:32:07 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 22 Oct 2006 11:32:07 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc 2.5 Message-ID: <20061022113207.EDDCA1E4004@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%25202.5/builds/0 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 Sun Oct 22 13:39:43 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 22 Oct 2006 11:39:43 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061022113943.A15F31E4004@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/1232 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis,ronald.oussoren Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 22 14:01:42 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 22 Oct 2006 12:01:42 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP 2.5 Message-ID: <20061022120142.CD1061E4005@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/4 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 python-checkins at python.org Sun Oct 22 15:45:13 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 22 Oct 2006 15:45:13 +0200 (CEST) Subject: [Python-checkins] r52420 - python/trunk/Lib/test/test_nis.py Message-ID: <20061022134513.9BA881E4004@bag.python.org> Author: martin.v.loewis Date: Sun Oct 22 15:45:13 2006 New Revision: 52420 Modified: python/trunk/Lib/test/test_nis.py Log: Remove passwd.adjunct.byname from list of maps for test_nis. Will backport to 2.5. Modified: python/trunk/Lib/test/test_nis.py ============================================================================== --- python/trunk/Lib/test/test_nis.py (original) +++ python/trunk/Lib/test/test_nis.py Sun Oct 22 15:45:13 2006 @@ -11,6 +11,13 @@ # only do this if running under the regression suite raise TestSkipped, msg +try: + # On some systems, this map is only accessible to the + # super user + maps.remove("passwd.adjunct.byname") +except ValueError: + pass + done = 0 for nismap in maps: if verbose: From python-checkins at python.org Sun Oct 22 15:46:23 2006 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 22 Oct 2006 15:46:23 +0200 (CEST) Subject: [Python-checkins] r52421 - in python/branches/release25-maint: Lib/test/test_nis.py Misc/NEWS Message-ID: <20061022134623.D18451E4004@bag.python.org> Author: martin.v.loewis Date: Sun Oct 22 15:46:23 2006 New Revision: 52421 Modified: python/branches/release25-maint/Lib/test/test_nis.py python/branches/release25-maint/Misc/NEWS Log: Remove passwd.adjunct.byname from list of maps for test_nis. Modified: python/branches/release25-maint/Lib/test/test_nis.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_nis.py (original) +++ python/branches/release25-maint/Lib/test/test_nis.py Sun Oct 22 15:46:23 2006 @@ -11,6 +11,13 @@ # only do this if running under the regression suite raise TestSkipped, msg +try: + # On some systems, this map is only accessible to the + # super user + maps.remove("passwd.adjunct.byname") +except ValueError: + pass + done = 0 for nismap in maps: if verbose: Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 22 15:46:23 2006 @@ -108,6 +108,13 @@ the close_fds arg to subprocess.Popen is not supported). +Tests +----- + +- Remove passwd.adjunct.byname from list of maps + for test_nis. + + Build ----- From buildbot at python.org Sun Oct 22 17:33:39 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 22 Oct 2006 15:33:39 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061022153339.C354A1E4004@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/1234 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 buildbot at python.org Sun Oct 22 18:01:15 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 22 Oct 2006 16:01:15 +0000 Subject: [Python-checkins] buildbot warnings in x86 Ubuntu edgy (icc) trunk Message-ID: <20061022160115.90E0F1E4004@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu edgy (icc) trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520edgy%2520%2528icc%2529%2520trunk/builds/1025 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 buildbot at python.org Sun Oct 22 18:22:12 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 22 Oct 2006 16:22:12 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20061022162212.E85031E4012@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/78 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 Sun Oct 22 19:12:15 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 22 Oct 2006 17:12:15 +0000 Subject: [Python-checkins] buildbot warnings in x86 Ubuntu edgy (icc) 2.5 Message-ID: <20061022171215.B6FE61E4005@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu edgy (icc) 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520edgy%2520%2528icc%2529%25202.5/builds/74 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 python-checkins at python.org Mon Oct 23 17:23:23 2006 From: python-checkins at python.org (anthony.baxter) Date: Mon, 23 Oct 2006 17:23:23 +0200 (CEST) Subject: [Python-checkins] r52423 - in python/branches/release23-maint: Misc/NEWS Objects/unicodeobject.c Message-ID: <20061023152323.5494E1E4006@bag.python.org> Author: anthony.baxter Date: Mon Oct 23 17:23:22 2006 New Revision: 52423 Modified: python/branches/release23-maint/Misc/NEWS python/branches/release23-maint/Objects/unicodeobject.c Log: patch for PSF-2006-001. Modified: python/branches/release23-maint/Misc/NEWS ============================================================================== --- python/branches/release23-maint/Misc/NEWS (original) +++ python/branches/release23-maint/Misc/NEWS Mon Oct 23 17:23:22 2006 @@ -4,26 +4,22 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) -What's New in Python 2.3.6rc1? -============================== +What's New in Python 2.3.6c1? +============================= -*Release date: XX-XXX-200X* +*Release date: 25-OCT-2006* -Extension modules +Core and builtins ----------------- -- Apply fix for potential heap overflow in PCRE code (CAN-2005-2491). - - -What's New in Python 2.3.5? -============================== - -*Release date: 08-FEB-2005* +- Patch #1541585: fix buffer overrun when performing repr() on + a unicode string in a build with wide unicode (UCS-4) support. + This is the problem described in security advisory PSF-2006-001. -Core and builtins +Extension modules ----------------- -- Partially revert the fix for #1074011; don't try to fflush stdin anymore. +- Apply fix for potential heap overflow in PCRE code (CAN-2005-2491). Library ------- @@ -40,6 +36,19 @@ Also, whereas % values were decoded in all parameter continuations, they are now only decoded in encoded parameter parts. +What's New in Python 2.3.5? +============================== + +*Release date: 08-FEB-2005* + +Core and builtins +----------------- + +- Partially revert the fix for #1074011; don't try to fflush stdin anymore. + +Library +------- + - Applied a security fix to SimpleXMLRPCserver (PSF-2005-001). This disables recursive traversal through instance attributes, which can be exploited in various ways. Modified: python/branches/release23-maint/Objects/unicodeobject.c ============================================================================== --- python/branches/release23-maint/Objects/unicodeobject.c (original) +++ python/branches/release23-maint/Objects/unicodeobject.c Mon Oct 23 17:23:22 2006 @@ -1888,7 +1888,28 @@ static const char *hexdigit = "0123456789abcdef"; - repr = PyString_FromStringAndSize(NULL, 2 + 6*size + 1); + /* Initial allocation is based on the longest-possible unichr + escape. + + In wide (UTF-32) builds '\U00xxxxxx' is 10 chars per source + unichr, so in this case it's the longest unichr escape. In + narrow (UTF-16) builds this is five chars per source unichr + since there are two unichrs in the surrogate pair, so in narrow + (UTF-16) builds it's not the longest unichr escape. + + In wide or narrow builds '\uxxxx' is 6 chars per source unichr, + so in the narrow (UTF-16) build case it's the longest unichr + escape. + */ + + repr = PyString_FromStringAndSize(NULL, + 2 +#ifdef Py_UNICODE_WIDE + + 10*size +#else + + 6*size +#endif + + 1); if (repr == NULL) return NULL; @@ -1913,15 +1934,6 @@ #ifdef Py_UNICODE_WIDE /* Map 21-bit characters to '\U00xxxxxx' */ else if (ch >= 0x10000) { - int offset = p - PyString_AS_STRING(repr); - - /* Resize the string if necessary */ - if (offset + 12 > PyString_GET_SIZE(repr)) { - if (_PyString_Resize(&repr, PyString_GET_SIZE(repr) + 100)) - return NULL; - p = PyString_AS_STRING(repr) + offset; - } - *p++ = '\\'; *p++ = 'U'; *p++ = hexdigit[(ch >> 28) & 0x0000000F]; @@ -1934,8 +1946,8 @@ *p++ = hexdigit[ch & 0x0000000F]; continue; } -#endif - /* Map UTF-16 surrogate pairs to Unicode \UXXXXXXXX escapes */ +#else + /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */ else if (ch >= 0xD800 && ch < 0xDC00) { Py_UNICODE ch2; Py_UCS4 ucs; @@ -1960,6 +1972,7 @@ s--; size++; } +#endif /* Map 16-bit characters to '\uxxxx' */ if (ch >= 256) { From python-checkins at python.org Mon Oct 23 17:27:23 2006 From: python-checkins at python.org (anthony.baxter) Date: Mon, 23 Oct 2006 17:27:23 +0200 (CEST) Subject: [Python-checkins] r52424 - in python/branches/release23-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.3.spec README Message-ID: <20061023152723.1D4B71E4006@bag.python.org> Author: anthony.baxter Date: Mon Oct 23 17:27:22 2006 New Revision: 52424 Modified: python/branches/release23-maint/Doc/commontex/boilerplate.tex python/branches/release23-maint/Doc/commontex/license.tex python/branches/release23-maint/Include/patchlevel.h python/branches/release23-maint/LICENSE python/branches/release23-maint/Lib/idlelib/NEWS.txt python/branches/release23-maint/Lib/idlelib/idlever.py python/branches/release23-maint/Misc/RPM/python-2.3.spec python/branches/release23-maint/README Log: preparing for 2.3.6c1 Modified: python/branches/release23-maint/Doc/commontex/boilerplate.tex ============================================================================== --- python/branches/release23-maint/Doc/commontex/boilerplate.tex (original) +++ python/branches/release23-maint/Doc/commontex/boilerplate.tex Mon Oct 23 17:27:22 2006 @@ -6,5 +6,5 @@ } %\date{\today} -\date{February 8, 2005} % XXX update before final release! +\date{October 25, 2006} % XXX update before final release! \input{patchlevel} % include Python version information Modified: python/branches/release23-maint/Doc/commontex/license.tex ============================================================================== --- python/branches/release23-maint/Doc/commontex/license.tex (original) +++ python/branches/release23-maint/Doc/commontex/license.tex Mon Oct 23 17:27:22 2006 @@ -46,6 +46,7 @@ \linev{2.3.3}{2.3.2}{2003}{PSF}{yes} \linev{2.3.4}{2.3.3}{2004}{PSF}{yes} \linev{2.3.5}{2.3.4}{2005}{PSF}{yes} + \linev{2.3.6}{2.3.5}{2006}{PSF}{yes} \end{tablev} \note{GPL-compatible doesn't mean that we're distributing Modified: python/branches/release23-maint/Include/patchlevel.h ============================================================================== --- python/branches/release23-maint/Include/patchlevel.h (original) +++ python/branches/release23-maint/Include/patchlevel.h Mon Oct 23 17:27:22 2006 @@ -21,12 +21,12 @@ /* Version parsed out into numeric values */ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 3 -#define PY_MICRO_VERSION 5 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 6 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "2.3.5" +#define PY_VERSION "2.3.6c1" /* 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/release23-maint/LICENSE ============================================================================== --- python/branches/release23-maint/LICENSE (original) +++ python/branches/release23-maint/LICENSE Mon Oct 23 17:27:22 2006 @@ -48,6 +48,7 @@ 2.3.3 2.3.2 2002-2003 PSF yes 2.3.4 2.3.3 2004 PSF yes 2.3.5 2.3.4 2004-2005 PSF yes + 2.3.6 2.3.5 2006 PSF yes Footnotes: Modified: python/branches/release23-maint/Lib/idlelib/NEWS.txt ============================================================================== --- python/branches/release23-maint/Lib/idlelib/NEWS.txt (original) +++ python/branches/release23-maint/Lib/idlelib/NEWS.txt Mon Oct 23 17:27:22 2006 @@ -1,3 +1,8 @@ +What's New in IDLE 1.0.6c1? +=========================== + +*Release date: 25-Oct-2006* + What's New in IDLE 1.0.5? ========================= Modified: python/branches/release23-maint/Lib/idlelib/idlever.py ============================================================================== --- python/branches/release23-maint/Lib/idlelib/idlever.py (original) +++ python/branches/release23-maint/Lib/idlelib/idlever.py Mon Oct 23 17:27:22 2006 @@ -1 +1 @@ -IDLE_VERSION = "1.0.5" +IDLE_VERSION = "1.0.6c1" Modified: python/branches/release23-maint/Misc/RPM/python-2.3.spec ============================================================================== --- python/branches/release23-maint/Misc/RPM/python-2.3.spec (original) +++ python/branches/release23-maint/Misc/RPM/python-2.3.spec Mon Oct 23 17:27:22 2006 @@ -33,7 +33,7 @@ ################################# %define name python -%define version 2.3.5 +%define version 2.3.6 %define libvers 2.3 %define release 4pydotorg %define __prefix /usr Modified: python/branches/release23-maint/README ============================================================================== --- python/branches/release23-maint/README (original) +++ python/branches/release23-maint/README Mon Oct 23 17:27:22 2006 @@ -1,7 +1,7 @@ -This is Python version 2.3.5 +This is Python version 2.3.6 ============================ -Copyright (c) 2001, 2002, 2003, 2004, 2005 Python Software Foundation. +Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation. All rights reserved. Copyright (c) 2000 BeOpen.com. From python-checkins at python.org Mon Oct 23 17:39:00 2006 From: python-checkins at python.org (anthony.baxter) Date: Mon, 23 Oct 2006 17:39:00 +0200 (CEST) Subject: [Python-checkins] r52425 - in python/branches/release23-maint: Lib Lib/bsddb Lib/compiler Lib/curses Lib/distutils Lib/email Lib/email/test Lib/encodings Lib/hotshot Lib/idlelib Lib/lib-old Lib/lib-tk Lib/logging Lib/plat-aix3 Lib/plat-aix4 Lib/plat-atheos Lib/plat-beos5 Lib/plat-darwin Lib/plat-freebsd2 Lib/plat-freebsd3 Lib/plat-freebsd4 Lib/plat-freebsd5 Lib/plat-generic Lib/plat-irix5 Lib/plat-irix6 Lib/plat-linux1 Lib/plat-linux2 Lib/plat-mac Lib/plat-netbsd1 Lib/plat-next3 Lib/plat-os2emx Lib/plat-riscos Lib/plat-sunos4 Lib/plat-sunos5 Lib/plat-unixware7 Lib/site-packages Lib/test Lib/xml Lib/xml/dom Lib/xml/parsers Lib/xml/sax Message-ID: <20061023153900.C49F51E4006@bag.python.org> Author: anthony.baxter Date: Mon Oct 23 17:38:59 2006 New Revision: 52425 Modified: python/branches/release23-maint/ (props changed) python/branches/release23-maint/Lib/ (props changed) python/branches/release23-maint/Lib/bsddb/ (props changed) python/branches/release23-maint/Lib/compiler/ (props changed) python/branches/release23-maint/Lib/curses/ (props changed) python/branches/release23-maint/Lib/distutils/ (props changed) python/branches/release23-maint/Lib/email/ (props changed) python/branches/release23-maint/Lib/email/test/ (props changed) python/branches/release23-maint/Lib/encodings/ (props changed) python/branches/release23-maint/Lib/hotshot/ (props changed) python/branches/release23-maint/Lib/idlelib/ (props changed) python/branches/release23-maint/Lib/lib-old/ (props changed) python/branches/release23-maint/Lib/lib-tk/ (props changed) python/branches/release23-maint/Lib/logging/ (props changed) python/branches/release23-maint/Lib/plat-aix3/ (props changed) python/branches/release23-maint/Lib/plat-aix4/ (props changed) python/branches/release23-maint/Lib/plat-atheos/ (props changed) python/branches/release23-maint/Lib/plat-beos5/ (props changed) python/branches/release23-maint/Lib/plat-darwin/ (props changed) python/branches/release23-maint/Lib/plat-freebsd2/ (props changed) python/branches/release23-maint/Lib/plat-freebsd3/ (props changed) python/branches/release23-maint/Lib/plat-freebsd4/ (props changed) python/branches/release23-maint/Lib/plat-freebsd5/ (props changed) python/branches/release23-maint/Lib/plat-generic/ (props changed) python/branches/release23-maint/Lib/plat-irix5/ (props changed) python/branches/release23-maint/Lib/plat-irix6/ (props changed) python/branches/release23-maint/Lib/plat-linux1/ (props changed) python/branches/release23-maint/Lib/plat-linux2/ (props changed) python/branches/release23-maint/Lib/plat-mac/ (props changed) python/branches/release23-maint/Lib/plat-netbsd1/ (props changed) python/branches/release23-maint/Lib/plat-next3/ (props changed) python/branches/release23-maint/Lib/plat-os2emx/ (props changed) python/branches/release23-maint/Lib/plat-riscos/ (props changed) python/branches/release23-maint/Lib/plat-sunos4/ (props changed) python/branches/release23-maint/Lib/plat-sunos5/ (props changed) python/branches/release23-maint/Lib/plat-unixware7/ (props changed) python/branches/release23-maint/Lib/site-packages/ (props changed) python/branches/release23-maint/Lib/test/ (props changed) python/branches/release23-maint/Lib/xml/ (props changed) python/branches/release23-maint/Lib/xml/dom/ (props changed) python/branches/release23-maint/Lib/xml/parsers/ (props changed) python/branches/release23-maint/Lib/xml/sax/ (props changed) Log: set svn:ignore. anal retentiveness, makes it easier to spot actual problems From python-checkins at python.org Mon Oct 23 17:46:02 2006 From: python-checkins at python.org (anthony.baxter) Date: Mon, 23 Oct 2006 17:46:02 +0200 (CEST) Subject: [Python-checkins] r52426 - python/tags/r236c1 Message-ID: <20061023154602.21C2F1E4006@bag.python.org> Author: anthony.baxter Date: Mon Oct 23 17:46:01 2006 New Revision: 52426 Added: python/tags/r236c1/ - copied from r52425, python/branches/release23-maint/ Log: Tagging for release of Python 2.3.6c1 From python-checkins at python.org Tue Oct 24 18:54:20 2006 From: python-checkins at python.org (georg.brandl) Date: Tue, 24 Oct 2006 18:54:20 +0200 (CEST) Subject: [Python-checkins] r52431 - in python/trunk/Lib: tarfile.py test/test_tarfile.py Message-ID: <20061024165420.966111E400A@bag.python.org> Author: georg.brandl Date: Tue Oct 24 18:54:16 2006 New Revision: 52431 Modified: python/trunk/Lib/tarfile.py python/trunk/Lib/test/test_tarfile.py Log: Patch [ 1583506 ] tarfile.py: 100-char filenames are truncated Modified: python/trunk/Lib/tarfile.py ============================================================================== --- python/trunk/Lib/tarfile.py (original) +++ python/trunk/Lib/tarfile.py Tue Oct 24 18:54:16 2006 @@ -136,7 +136,7 @@ def stn(s, length): """Convert a python string to a null-terminated string buffer. """ - return s[:length-1] + (length - len(s) - 1) * NUL + NUL + return s[:length] + (length - len(s)) * NUL def nti(s): """Convert a number field to a python number. Modified: python/trunk/Lib/test/test_tarfile.py ============================================================================== --- python/trunk/Lib/test/test_tarfile.py (original) +++ python/trunk/Lib/test/test_tarfile.py Tue Oct 24 18:54:16 2006 @@ -280,6 +280,32 @@ else: self.dst.addfile(tarinfo, f) + +class Write100Test(BaseTest): + # The name field in a tar header stores strings of at most 100 chars. + # If a string is shorter than 100 chars it has to be padded with '\0', + # which implies that a string of exactly 100 chars is stored without + # a trailing '\0'. + + def setUp(self): + self.name = "01234567890123456789012345678901234567890123456789" + self.name += "01234567890123456789012345678901234567890123456789" + + self.tar = tarfile.open(tmpname(), "w") + t = tarfile.TarInfo(self.name) + self.tar.addfile(t) + self.tar.close() + + self.tar = tarfile.open(tmpname()) + + def tearDown(self): + self.tar.close() + + def test(self): + self.assertEqual(self.tar.getnames()[0], self.name, + "failed to store 100 char filename") + + class WriteSize0Test(BaseTest): mode = 'w' @@ -623,6 +649,7 @@ ReadAsteriskTest, ReadStreamAsteriskTest, WriteTest, + Write100Test, WriteSize0Test, WriteStreamTest, WriteGNULongTest, From python-checkins at python.org Tue Oct 24 18:54:26 2006 From: python-checkins at python.org (georg.brandl) Date: Tue, 24 Oct 2006 18:54:26 +0200 (CEST) Subject: [Python-checkins] r52432 - in python/branches/release25-maint/Lib: tarfile.py test/test_tarfile.py Message-ID: <20061024165426.D5A951E4008@bag.python.org> Author: georg.brandl Date: Tue Oct 24 18:54:23 2006 New Revision: 52432 Modified: python/branches/release25-maint/Lib/tarfile.py python/branches/release25-maint/Lib/test/test_tarfile.py Log: Patch [ 1583506 ] tarfile.py: 100-char filenames are truncated (backport from rev. 52431) Modified: python/branches/release25-maint/Lib/tarfile.py ============================================================================== --- python/branches/release25-maint/Lib/tarfile.py (original) +++ python/branches/release25-maint/Lib/tarfile.py Tue Oct 24 18:54:23 2006 @@ -136,7 +136,7 @@ def stn(s, length): """Convert a python string to a null-terminated string buffer. """ - return s[:length-1] + (length - len(s) - 1) * NUL + NUL + return s[:length] + (length - len(s)) * NUL def nti(s): """Convert a number field to a python number. Modified: python/branches/release25-maint/Lib/test/test_tarfile.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_tarfile.py (original) +++ python/branches/release25-maint/Lib/test/test_tarfile.py Tue Oct 24 18:54:23 2006 @@ -280,6 +280,32 @@ else: self.dst.addfile(tarinfo, f) + +class Write100Test(BaseTest): + # The name field in a tar header stores strings of at most 100 chars. + # If a string is shorter than 100 chars it has to be padded with '\0', + # which implies that a string of exactly 100 chars is stored without + # a trailing '\0'. + + def setUp(self): + self.name = "01234567890123456789012345678901234567890123456789" + self.name += "01234567890123456789012345678901234567890123456789" + + self.tar = tarfile.open(tmpname(), "w") + t = tarfile.TarInfo(self.name) + self.tar.addfile(t) + self.tar.close() + + self.tar = tarfile.open(tmpname()) + + def tearDown(self): + self.tar.close() + + def test(self): + self.assertEqual(self.tar.getnames()[0], self.name, + "failed to store 100 char filename") + + class WriteSize0Test(BaseTest): mode = 'w' @@ -623,6 +649,7 @@ ReadAsteriskTest, ReadStreamAsteriskTest, WriteTest, + Write100Test, WriteSize0Test, WriteStreamTest, WriteGNULongTest, From buildbot at python.org Tue Oct 24 18:59:37 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 24 Oct 2006 16:59:37 +0000 Subject: [Python-checkins] buildbot failure in x86 cygwin trunk Message-ID: <20061024165937.7105F1E4006@bag.python.org> The Buildbot has detected a new failure of x86 cygwin trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520cygwin%2520trunk/builds/1238 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Tue Oct 24 18:59:37 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 24 Oct 2006 16:59:37 +0000 Subject: [Python-checkins] buildbot failure in x86 Ubuntu edgy (icc) trunk Message-ID: <20061024165937.746DE1E4007@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu edgy (icc) trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520edgy%2520%2528icc%2529%2520trunk/builds/1026 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Tue Oct 24 20:26:18 2006 From: buildbot at python.org (buildbot at python.org) Date: Tue, 24 Oct 2006 18:26:18 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20061024182618.915CB1E4006@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/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 python-checkins at python.org Tue Oct 24 20:29:36 2006 From: python-checkins at python.org (phillip.eby) Date: Tue, 24 Oct 2006 20:29:36 +0200 (CEST) Subject: [Python-checkins] r52437 - sandbox/trunk/setuptools/setuptools/sandbox.py Message-ID: <20061024182936.3216B1E4006@bag.python.org> Author: phillip.eby Date: Tue Oct 24 20:29:35 2006 New Revision: 52437 Modified: sandbox/trunk/setuptools/setuptools/sandbox.py Log: Fixed not allowing os.open() of paths outside the sandbox, even if they are opened read-only (e.g. /dev/urandom). Modified: sandbox/trunk/setuptools/setuptools/sandbox.py ============================================================================== --- sandbox/trunk/setuptools/setuptools/sandbox.py (original) +++ sandbox/trunk/setuptools/setuptools/sandbox.py Tue Oct 24 20:29:35 2006 @@ -1,4 +1,4 @@ -import os, sys, __builtin__, tempfile +import os, sys, __builtin__, tempfile, operator _os = sys.modules[os.name] _open = open from distutils.errors import DistutilsError @@ -187,6 +187,21 @@ self._violation(operation, src, dst, *args, **kw) return (src,dst) + def open(self, file, flags, mode=0777): + """Called for low-level os.open()""" + if flags & WRITE_FLAGS: + self._violation("open", file, flags, mode) + return _os.open(file,flags,mode) + + +WRITE_FLAGS = reduce( + operator.or_, + [getattr(_os, a, 0) for a in + "O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY".split()] +) + + + class SandboxViolation(DistutilsError): """A setup script attempted to modify the filesystem outside the sandbox""" @@ -201,3 +216,31 @@ support alternate installation locations even if you run its setup script by hand. Please inform the package's author and the EasyInstall maintainers to find out if a fix or workaround is available.""" % self.args + + + + + + + + + + + + + + + + + + + + + + + + + + + +# From python-checkins at python.org Tue Oct 24 20:37:04 2006 From: python-checkins at python.org (phillip.eby) Date: Tue, 24 Oct 2006 20:37:04 +0200 (CEST) Subject: [Python-checkins] r52438 - in sandbox/branches/setuptools-0.6: EasyInstall.txt setuptools/sandbox.py Message-ID: <20061024183704.ED0E71E4006@bag.python.org> Author: phillip.eby Date: Tue Oct 24 20:37:04 2006 New Revision: 52438 Modified: sandbox/branches/setuptools-0.6/EasyInstall.txt sandbox/branches/setuptools-0.6/setuptools/sandbox.py Log: Fixed not allowing ``os.open()`` of paths outside the sandbox, even if they are opened read-only (e.g. reading ``/dev/urandom`` for random numbers, as is done by ``os.urandom()`` on some platforms). (backport from trunk) Modified: sandbox/branches/setuptools-0.6/EasyInstall.txt ============================================================================== --- sandbox/branches/setuptools-0.6/EasyInstall.txt (original) +++ sandbox/branches/setuptools-0.6/EasyInstall.txt Tue Oct 24 20:37:04 2006 @@ -1265,6 +1265,10 @@ * Allow explicit selection of Sourceforge mirror(s) with ``--sf-mirror``, and further refine download/retry algorithm. + * Fixed not allowing ``os.open()`` of paths outside the sandbox, even if they + are opened read-only (e.g. reading ``/dev/urandom`` for random numbers, as + is done by ``os.urandom()`` on some platforms). + 0.6c3 * You once again use "python -m easy_install" with Python 2.4 and above. Modified: sandbox/branches/setuptools-0.6/setuptools/sandbox.py ============================================================================== --- sandbox/branches/setuptools-0.6/setuptools/sandbox.py (original) +++ sandbox/branches/setuptools-0.6/setuptools/sandbox.py Tue Oct 24 20:37:04 2006 @@ -1,4 +1,4 @@ -import os, sys, __builtin__, tempfile +import os, sys, __builtin__, tempfile, operator _os = sys.modules[os.name] _open = open from distutils.errors import DistutilsError @@ -187,6 +187,21 @@ self._violation(operation, src, dst, *args, **kw) return (src,dst) + def open(self, file, flags, mode=0777): + """Called for low-level os.open()""" + if flags & WRITE_FLAGS: + self._violation("open", file, flags, mode) + return _os.open(file,flags,mode) + + +WRITE_FLAGS = reduce( + operator.or_, + [getattr(_os, a, 0) for a in + "O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY".split()] +) + + + class SandboxViolation(DistutilsError): """A setup script attempted to modify the filesystem outside the sandbox""" @@ -203,3 +218,29 @@ maintainers to find out if a fix or workaround is available.""" % self.args + + + + + + + + + + + + + + + + + + + + + + + + + +# From python-checkins at python.org Wed Oct 25 06:15:40 2006 From: python-checkins at python.org (fred.drake) Date: Wed, 25 Oct 2006 06:15:40 +0200 (CEST) Subject: [Python-checkins] r52443 - peps/trunk/pep-0101.txt Message-ID: <20061025041540.548651E4007@bag.python.org> Author: fred.drake Date: Wed Oct 25 06:15:39 2006 New Revision: 52443 Modified: peps/trunk/pep-0101.txt Log: - update some of the documentation build/release steps - replace all occurances of "creosote" with "dinsdale" Modified: peps/trunk/pep-0101.txt ============================================================================== --- peps/trunk/pep-0101.txt (original) +++ peps/trunk/pep-0101.txt Wed Oct 25 06:15:39 2006 @@ -197,7 +197,7 @@ ___ Python/getcopyright.c - ___ Doc/README + ___ Doc/README (at the end) ___ Doc/commontex/copyright.tex @@ -251,8 +251,8 @@ $ scp *-$VERSION.* dinsdale.python.org:$TARGET ___ For final releases, publish the documentation on python.org. - This must be done by someone with write access to the python.org - CVS repository. + This must be done by someone with write access to the pydotorg + repository. Start by creating a new directory and filling it with the standard boilerplate. $VERSION is the same as for uploading the @@ -260,43 +260,30 @@ version on the site. $ cd .../pydotorg/doc/ - $ mkdir $VERSION - $ cvs add $VERSION + $ svn mkdir $VERSION $VERSION/download $ cd $OLDVERSION - $ cp .cvsignore Makefile index.ht download.ht ../$VERSION - $ cd ../$VERSION - $ cvs add .cvsignore Makefile *.ht - - Now make the following edits: - - - in Makefile, change the value of ROOT_OFFSET to doc/$VERSION - - - in index.ht, change: - - the version number to $VERSION in two places: the Title: - header, and the

at the top of the page - - the release date, in the

at the top of the page - - if the minor release number changed (for example, from 2.5 - to 2.6), the title and link to the "What's New" document - (search for "whatsnew") - - - in download.ht, change: - - the version number to $VERSION in two places: the Title: - header, and the

at the top of the page - - the release date, in the

at the top of the page - - if the minor release number changed (for example, from 2.5 - to 2.6), the title and link to the "What's New" document - (search for "whatsnew") - - replace the large table of downloads with the content of the - pkglist.html file generated by the documentation build - process - - Now, the web content has all been prepared, but there's still - some dancing to do to make it all work right. To be safe, we - can commit the new files to CVS, but we're *not* ready to - install them on the site yet: + $ svn cp content.{html,rst,yml} index.yml nav.yml ../$VERSION + $ cd download + $ svn cp content.{html,rst,yml} index.yml nav.yml ../$VERSION/download + $ cd ../../$VERSION + + In $VERSION/content.rst and $VERSION/download/content.rst, change: + + - in the header at the top of the page, update to reflect + the version number and release date + - if the minor release number changed (for example, from 2.5 + to 2.6), the title and link to the "What's New" document + (search for "whatsnew") + - make sure all the documents included in the package are listed - $ cvs commit -m \ - "Add website content for Python $VERSION documentation." + In $VERSION/index.yml and $VERSION/download/index.yml, change + the version number in the title. + + In versions/content.rst, add an entry for the new version near + the top. + + Use the "rst2html" command (commonly installed with docutils) to + ensure that the .rst files can be formatted without errors. Log into dinsdale.python.org using SSH and unpack a copy of the documentation into place: @@ -308,32 +295,21 @@ $ mv Python-Docs-$VERSION $VERSION $ find $VERSION -type d | xargs chmod g+s - Now head back to your pydotorg checkout on your workstation, and - push website content into place: + Now head back to your pydotorg checkout and commit the changes + so the site will be updated: - $ cd .../pydotorg/doc/$VERSION - $ make install + $ svn commit -m \ + "Add website content for Python $VERSION documentation." Point your browser at this URL and check it out: http://www.python.org/doc/$VERSION/ - There are three more changes that need to happen in the - top-level doc/ directory of the website content. The first of - these can happen any time after what's already happened in this - process, and the last two should happen as soon as the release - announcement has been made. Those are described in a separate - step of this checklist. - - At this time, edit the versions.ht file in doc/ to make add the - new release at the top. The previous latest release should drop - down to the top of the long list of released versions, and the - new release should replace the previous most recent release. - There should be a blank line between the link to the development - documentation and the most recent release, and another blank - line between the most recent release and the long list of older - releases. (Is should be fairly easy to figure this out while - looking at the file.) + There is one more change that may need to happen in the + top-level doc/ directory of the website content. This should + happen as soon as the release announcement has been made. The + required actions are described in a separate step of this + checklist. ___ Martin grabs the HTML to build the Windows helpfile. The HTML files are unpacked into a new src/html directory, and @@ -343,7 +319,7 @@ % python ..\Doc\tools\prechm.py -v 2.5 python25 HTML Workshop is then fired up on the created python25.hhp file, - finally resulting in an python25.chm file. He then copies the + finally resulting in an python25.chm file. He then copies the file into the Doc directories of the build trees (once for each target architecture). @@ -364,9 +340,8 @@ architecture in its path (VS 2003 for x86, the platform SDK for Itanium and AMD64). - Martin checksums the files (*.msi and *.chm), uploads them - to some place in the net, and emails you the location - and md5sums. + Martin checksums the files (*.msi and *.chm), uploads them to + some place in the net, and emails you the location and md5sums. ___ Sean Reifschneider grabs the HTML and uses this to build the Linux RPMs. Sean performs his Red Hat magic, generating a set @@ -447,7 +422,7 @@ freshly unpacked directory looks weird, you better stop now and figure out what the problem is. - ___ Upload the tgz file to creosote.python.org using scp. + ___ Upload the tgz file to dinsdale.python.org using scp. ___ While you're waiting, you can start twiddling the web pages to include the announcement. @@ -456,7 +431,7 @@ python.org sysadmins must set this up for you), check out the web site CVS tree by doing: - % cvs -d :ext:@creosote.python.org:/usr/local/cvsroot co pydotorg + % cvs -d :ext:@dinsdale.python.org:/usr/local/cvsroot co pydotorg ___ In the python.org web site CVS tree, cd to the X.Y subdirectory, and copy index.ht to new-index.ht. Be sure to @@ -491,10 +466,10 @@ correct. Update the links in the left-hand navigation sidebar. Still do NOT do a "make install"! - ___ Now we're waiting for the scp to creosote to finish. Da de da, + ___ Now we're waiting for the scp to dinsdale to finish. Da de da, da de dum, hmm, hmm, dum de dum. - ___ Now you need to go to creosote.python.org and move all the files + ___ Now you need to go to dinsdale.python.org and move all the files in place over there. Our policy is that every Python version gets its own directory, but each directory may contain several releases. We keep all old releases, moving them into a "prev" @@ -506,7 +481,7 @@ So... - ___ On creosote, cd to ~ftp/pub/python/X.Y creating it if + ___ On dinsdale, cd to ~ftp/pub/python/X.Y creating it if necessary. ___ Move the previous release files to a directory called "prev" @@ -559,27 +534,18 @@ Feel free to remove any old news items. - ___ Make the last two changes to the documentation area on + ___ Make the last change to the documentation area on python.org. (Remember those from the documentation items above? It's time now.) - In your pydotorg checkout, edit the file doc/index.ht to update - to the right version number and release date. Commit the - changes to CVS and push the file to the website: + The "current" symlink needs to be updated if this release is the + highest-versioned release. Log in to dinsdale.python.org, and + update a symlink in the doc/ tree: - $ cd .../pydotorg/doc/ - $ make install - - This will cause the doc/index.html file to claim to point to the - new docs, but they won't. Run (don't walk!) to - creosote.python.org, and update a symlink in the doc/ tree: - - # on creosote: - $ cd /ftp/www.python.org/doc/ + # on dinsdale: + $ cd /data/ftp.python.org/pub/www.python.org/doc/ $ rm current && ln -s $VERSION current - Good. Stop running. - Now it's time to do some cleaning up. These steps are very important! ___ If you made a non-maintenance branch, be sure to merge it into From python-checkins at python.org Thu Oct 26 21:10:47 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 26 Oct 2006 21:10:47 +0200 (CEST) Subject: [Python-checkins] r52446 - python/trunk/Doc/api/concrete.tex Message-ID: <20061026191047.514EF1E4003@bag.python.org> Author: andrew.kuchling Date: Thu Oct 26 21:10:46 2006 New Revision: 52446 Modified: python/trunk/Doc/api/concrete.tex Log: [Bug #1579796] Wrong syntax for PyDateTime_IMPORT in documentation. Reported by David Faure. Modified: python/trunk/Doc/api/concrete.tex ============================================================================== --- python/trunk/Doc/api/concrete.tex (original) +++ python/trunk/Doc/api/concrete.tex Thu Oct 26 21:10:46 2006 @@ -2879,10 +2879,10 @@ Various date and time objects are supplied by the \module{datetime} module. Before using any of these functions, the header file \file{datetime.h} must be included in your source (note that this is -not include by \file{Python.h}), and macro \cfunction{PyDateTime_IMPORT()} -must be invoked. The macro arranges to put a pointer to a C structure -in a static variable \code{PyDateTimeAPI}, which is used by the following -macros. +not included by \file{Python.h}), and the macro +\cfunction{PyDateTime_IMPORT} must be invoked. The macro puts a +pointer to a C structure into a static variable, +\code{PyDateTimeAPI}, that is used by the following macros. Type-check macros: From python-checkins at python.org Thu Oct 26 21:11:06 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 26 Oct 2006 21:11:06 +0200 (CEST) Subject: [Python-checkins] r52447 - python/branches/release25-maint/Doc/api/concrete.tex Message-ID: <20061026191106.CCF4D1E4003@bag.python.org> Author: andrew.kuchling Date: Thu Oct 26 21:11:06 2006 New Revision: 52447 Modified: python/branches/release25-maint/Doc/api/concrete.tex Log: [Bug #1579796] Wrong syntax for PyDateTime_IMPORT in documentation. Reported by David Faure. Modified: python/branches/release25-maint/Doc/api/concrete.tex ============================================================================== --- python/branches/release25-maint/Doc/api/concrete.tex (original) +++ python/branches/release25-maint/Doc/api/concrete.tex Thu Oct 26 21:11:06 2006 @@ -2879,10 +2879,10 @@ Various date and time objects are supplied by the \module{datetime} module. Before using any of these functions, the header file \file{datetime.h} must be included in your source (note that this is -not include by \file{Python.h}), and macro \cfunction{PyDateTime_IMPORT()} -must be invoked. The macro arranges to put a pointer to a C structure -in a static variable \code{PyDateTimeAPI}, which is used by the following -macros. +not included by \file{Python.h}), and the macro +\cfunction{PyDateTime_IMPORT} must be invoked. The macro puts a +pointer to a C structure into a static variable, +\code{PyDateTimeAPI}, that is used by the following macros. Type-check macros: From python-checkins at python.org Thu Oct 26 21:11:43 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 26 Oct 2006 21:11:43 +0200 (CEST) Subject: [Python-checkins] r52448 - python/branches/release24-maint/Doc/api/concrete.tex Message-ID: <20061026191143.09FB31E4003@bag.python.org> Author: andrew.kuchling Date: Thu Oct 26 21:11:42 2006 New Revision: 52448 Modified: python/branches/release24-maint/Doc/api/concrete.tex Log: [Bug #1579796] Wrong syntax for PyDateTime_IMPORT in documentation. Reported by David Faure. Modified: python/branches/release24-maint/Doc/api/concrete.tex ============================================================================== --- python/branches/release24-maint/Doc/api/concrete.tex (original) +++ python/branches/release24-maint/Doc/api/concrete.tex Thu Oct 26 21:11:42 2006 @@ -2730,10 +2730,10 @@ Various date and time objects are supplied by the \module{datetime} module. Before using any of these functions, the header file \file{datetime.h} must be included in your source (note that this is -not include by \file{Python.h}), and macro \cfunction{PyDateTime_IMPORT()} -must be invoked. The macro arranges to put a pointer to a C structure -in a static variable \code{PyDateTimeAPI}, which is used by the following -macros. +not included by \file{Python.h}), and the macro +\cfunction{PyDateTime_IMPORT} must be invoked. The macro puts a +pointer to a C structure into a static variable, +\code{PyDateTimeAPI}, that is used by the following macros. Type-check macros: From python-checkins at python.org Thu Oct 26 21:16:47 2006 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 26 Oct 2006 21:16:47 +0200 (CEST) Subject: [Python-checkins] r52449 - python/trunk/Lib/functools.py Message-ID: <20061026191647.1D3F31E4003@bag.python.org> Author: andrew.kuchling Date: Thu Oct 26 21:16:46 2006 New Revision: 52449 Modified: python/trunk/Lib/functools.py Log: Typo fix Modified: python/trunk/Lib/functools.py ============================================================================== --- python/trunk/Lib/functools.py (original) +++ python/trunk/Lib/functools.py Thu Oct 26 21:16:46 2006 @@ -25,7 +25,7 @@ assigned is a tuple naming the attributes assigned directly from the wrapped function to the wrapper function (defaults to functools.WRAPPER_ASSIGNMENTS) - updated is a tuple naming the attributes off the wrapper that + updated is a tuple naming the attributes of the wrapper that are updated with the corresponding attribute from the wrapped function (defaults to functools.WRAPPER_UPDATES) """ From buildbot at python.org Thu Oct 26 22:20:19 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Oct 2006 20:20:19 +0000 Subject: [Python-checkins] buildbot warnings in x86 cygwin trunk Message-ID: <20061026202019.DEAAE1E4018@bag.python.org> The Buildbot has detected a new failure of x86 cygwin trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520cygwin%2520trunk/builds/1239 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 buildbot at python.org Fri Oct 27 00:45:26 2006 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Oct 2006 22:45:26 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-2 trunk Message-ID: <20061026224526.469201E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%2520trunk/builds/929 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 Fri Oct 27 08:16:32 2006 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 27 Oct 2006 08:16:32 +0200 (CEST) Subject: [Python-checkins] r52452 - in python/trunk: Lib/test/test_structmembers.py Misc/ACKS Misc/NEWS Modules/_testcapimodule.c Python/structmember.c Message-ID: <20061027061632.996A51E4003@bag.python.org> Author: martin.v.loewis Date: Fri Oct 27 08:16:31 2006 New Revision: 52452 Added: python/trunk/Lib/test/test_structmembers.py (contents, props changed) Modified: python/trunk/Misc/ACKS python/trunk/Misc/NEWS python/trunk/Modules/_testcapimodule.c python/trunk/Python/structmember.c Log: Patch #1549049: Rewrite type conversion in structmember. Fixes #1545696 and #1566140. Will backport to 2.5. Added: python/trunk/Lib/test/test_structmembers.py ============================================================================== --- (empty file) +++ python/trunk/Lib/test/test_structmembers.py Fri Oct 27 08:16:31 2006 @@ -0,0 +1,80 @@ +from _testcapi import test_structmembersType, \ + CHAR_MAX, CHAR_MIN, UCHAR_MAX, \ + SHRT_MAX, SHRT_MIN, USHRT_MAX, \ + INT_MAX, INT_MIN, UINT_MAX, \ + LONG_MAX, LONG_MIN, ULONG_MAX + +import warnings, exceptions, unittest, test.test_warnings +from test import test_support + +ts=test_structmembersType(1,2,3,4,5,6,7,8,9.99999,10.1010101010) + +class ReadWriteTests(unittest.TestCase): + def test_types(self): + ts.T_BYTE=CHAR_MAX + self.assertEquals(ts.T_BYTE, CHAR_MAX) + ts.T_BYTE=CHAR_MIN + self.assertEquals(ts.T_BYTE, CHAR_MIN) + ts.T_UBYTE=UCHAR_MAX + self.assertEquals(ts.T_UBYTE, UCHAR_MAX) + + ts.T_SHORT=SHRT_MAX + self.assertEquals(ts.T_SHORT, SHRT_MAX) + ts.T_SHORT=SHRT_MIN + self.assertEquals(ts.T_SHORT, SHRT_MIN) + ts.T_USHORT=USHRT_MAX + self.assertEquals(ts.T_USHORT, USHRT_MAX) + + ts.T_INT=INT_MAX + self.assertEquals(ts.T_INT, INT_MAX) + ts.T_INT=INT_MIN + self.assertEquals(ts.T_INT, INT_MIN) + ts.T_UINT=UINT_MAX + self.assertEquals(ts.T_UINT, UINT_MAX) + + ts.T_LONG=LONG_MAX + self.assertEquals(ts.T_LONG, LONG_MAX) + ts.T_LONG=LONG_MIN + self.assertEquals(ts.T_LONG, LONG_MIN) + ts.T_ULONG=ULONG_MAX + self.assertEquals(ts.T_ULONG, ULONG_MAX) + +class TestWarnings(test.test_warnings.TestModule): + def has_warned(self): + self.assertEqual(test.test_warnings.msg.category, + exceptions.RuntimeWarning.__name__) + + def test_byte_max(self): + ts.T_BYTE=CHAR_MAX+1 + self.has_warned() + + def test_byte_min(self): + ts.T_BYTE=CHAR_MIN-1 + self.has_warned() + + def test_ubyte_max(self): + ts.T_UBYTE=UCHAR_MAX+1 + self.has_warned() + + def test_short_max(self): + ts.T_SHORT=SHRT_MAX+1 + self.has_warned() + + def test_short_min(self): + ts.T_SHORT=SHRT_MIN-1 + self.has_warned() + + def test_ushort_max(self): + ts.T_USHORT=USHRT_MAX+1 + self.has_warned() + + + +def test_main(verbose=None): + test_support.run_unittest( + ReadWriteTests, + TestWarnings + ) + +if __name__ == "__main__": + test_main(verbose=True) Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Fri Oct 27 08:16:31 2006 @@ -633,6 +633,7 @@ Bill Tutt Doobee R. Tzeck Lionel Ulmer +Roger Upole Michael Urman Hector Urtubia Dmitry Vasiliev Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Oct 27 08:16:31 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Patch #1549049: Support long values in structmember, issue warnings + if the assigned value for structmember fields gets truncated. + - Update the peephole optimizer to remove more dead code (jumps after returns) and inline unconditional jumps to returns. Modified: python/trunk/Modules/_testcapimodule.c ============================================================================== --- python/trunk/Modules/_testcapimodule.c (original) +++ python/trunk/Modules/_testcapimodule.c Fri Oct 27 08:16:31 2006 @@ -6,6 +6,8 @@ */ #include "Python.h" +#include +#include "structmember.h" #ifdef WITH_THREAD #include "pythread.h" @@ -35,13 +37,13 @@ platforms have these hardcoded. Better safe than sorry. */ static PyObject* -sizeof_error(const char* fatname, const char* typename, +sizeof_error(const char* fatname, const char* typname, int expected, int got) { char buf[1024]; PyOS_snprintf(buf, sizeof(buf), "%.200s #define == %d but sizeof(%.200s) == %d", - fatname, expected, typename, got); + fatname, expected, typname, got); PyErr_SetString(TestError, buf); return (PyObject*)NULL; } @@ -615,7 +617,7 @@ { PyObject *rc; PyGILState_STATE s = PyGILState_Ensure(); - rc = PyObject_CallFunction(callable, ""); + rc = PyObject_CallFunction((PyObject *)callable, ""); Py_XDECREF(rc); PyGILState_Release(s); } @@ -756,6 +758,105 @@ #define AddSym(d, n, f, v) {PyObject *o = f(v); PyDict_SetItemString(d, n, o); Py_DECREF(o);} +typedef struct { + char byte_member; + unsigned char ubyte_member; + short short_member; + unsigned short ushort_member; + int int_member; + unsigned int uint_member; + long long_member; + unsigned long ulong_member; + float float_member; + double double_member; +} all_structmembers; + +typedef struct { + PyObject_HEAD + all_structmembers structmembers; +} test_structmembers; + +static struct PyMemberDef test_members[] = { + {"T_BYTE", T_BYTE, offsetof(test_structmembers, structmembers.byte_member), 0, NULL}, + {"T_UBYTE", T_UBYTE, offsetof(test_structmembers, structmembers.ubyte_member), 0, NULL}, + {"T_SHORT", T_SHORT, offsetof(test_structmembers, structmembers.short_member), 0, NULL}, + {"T_USHORT", T_USHORT, offsetof(test_structmembers, structmembers.ushort_member), 0, NULL}, + {"T_INT", T_INT, offsetof(test_structmembers, structmembers.int_member), 0, NULL}, + {"T_UINT", T_UINT, offsetof(test_structmembers, structmembers.uint_member), 0, NULL}, + {"T_LONG", T_LONG, offsetof(test_structmembers, structmembers.long_member), 0, NULL}, + {"T_ULONG", T_ULONG, offsetof(test_structmembers, structmembers.ulong_member), 0, NULL}, + {"T_FLOAT", T_FLOAT, offsetof(test_structmembers, structmembers.float_member), 0, NULL}, + {"T_DOUBLE", T_DOUBLE, offsetof(test_structmembers, structmembers.double_member), 0, NULL}, + {NULL} +}; + + +static PyObject *test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs){ + static char *keywords[]={"T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT", "T_INT", "T_UINT", + "T_LONG", "T_ULONG", "T_FLOAT", "T_DOUBLE", NULL}; + test_structmembers *ob=PyObject_New(test_structmembers, type); + if (ob==NULL) + return NULL; + memset(&ob->structmembers, 0, sizeof(all_structmembers)); + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|bBhHiIlkfd", keywords, + &ob->structmembers.byte_member, &ob->structmembers.ubyte_member, + &ob->structmembers.short_member, &ob->structmembers.ushort_member, + &ob->structmembers.int_member, &ob->structmembers.uint_member, + &ob->structmembers.long_member, &ob->structmembers.ulong_member, + &ob->structmembers.float_member, &ob->structmembers.double_member)){ + Py_DECREF(ob); + return NULL; + } + return (PyObject *)ob; +} + +static void test_structmembers_free(PyObject *ob){ + PyObject_FREE(ob); +} + +static PyTypeObject test_structmembersType = { + PyObject_HEAD_INIT(NULL) + 0, + "test_structmembersType", + sizeof(test_structmembers), /* tp_basicsize */ + 0, /* tp_itemsize */ + test_structmembers_free, /* destructor 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 */ + PyObject_GenericGetAttr, + PyObject_GenericSetAttr, + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + "Type containing all structmember types", + 0, /* traverseproc tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + test_members, /* tp_members */ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + test_structmembers_new, /* tp_new */ +}; + + PyMODINIT_FUNC init_testcapi(void) { @@ -765,16 +866,28 @@ if (m == NULL) return; + test_structmembersType.ob_type=&PyType_Type; + Py_INCREF(&test_structmembersType); + PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType); + + PyModule_AddObject(m, "CHAR_MAX", PyInt_FromLong(CHAR_MAX)); + PyModule_AddObject(m, "CHAR_MIN", PyInt_FromLong(CHAR_MIN)); PyModule_AddObject(m, "UCHAR_MAX", PyInt_FromLong(UCHAR_MAX)); + PyModule_AddObject(m, "SHRT_MAX", PyInt_FromLong(SHRT_MAX)); + PyModule_AddObject(m, "SHRT_MIN", PyInt_FromLong(SHRT_MIN)); PyModule_AddObject(m, "USHRT_MAX", PyInt_FromLong(USHRT_MAX)); + PyModule_AddObject(m, "INT_MAX", PyLong_FromLong(INT_MAX)); + PyModule_AddObject(m, "INT_MIN", PyLong_FromLong(INT_MIN)); PyModule_AddObject(m, "UINT_MAX", PyLong_FromUnsignedLong(UINT_MAX)); - PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX)); - PyModule_AddObject(m, "INT_MIN", PyInt_FromLong(INT_MIN)); - PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN)); - PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN)); - PyModule_AddObject(m, "INT_MAX", PyInt_FromLong(INT_MAX)); PyModule_AddObject(m, "LONG_MAX", PyInt_FromLong(LONG_MAX)); + PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN)); + PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX)); + PyModule_AddObject(m, "FLT_MAX", PyFloat_FromDouble(FLT_MAX)); + PyModule_AddObject(m, "FLT_MIN", PyFloat_FromDouble(FLT_MIN)); + PyModule_AddObject(m, "DBL_MAX", PyFloat_FromDouble(DBL_MAX)); + PyModule_AddObject(m, "DBL_MIN", PyFloat_FromDouble(DBL_MIN)); PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyInt_FromSsize_t(PY_SSIZE_T_MAX)); + PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN)); TestError = PyErr_NewException("_testcapi.error", NULL, NULL); Py_INCREF(TestError); Modified: python/trunk/Python/structmember.c ============================================================================== --- python/trunk/Python/structmember.c (original) +++ python/trunk/Python/structmember.c Fri Oct 27 08:16:31 2006 @@ -62,29 +62,28 @@ addr += l->offset; switch (l->type) { case T_BYTE: - v = PyInt_FromLong( - (long) (((*(char*)addr & 0xff) ^ 0x80) - 0x80)); + v = PyInt_FromLong(*(char*)addr); break; case T_UBYTE: - v = PyInt_FromLong((long) *(char*)addr & 0xff); + v = PyLong_FromUnsignedLong(*(unsigned char*)addr); break; case T_SHORT: - v = PyInt_FromLong((long) *(short*)addr); + v = PyInt_FromLong(*(short*)addr); break; case T_USHORT: - v = PyInt_FromLong((long) *(unsigned short*)addr); + v = PyLong_FromUnsignedLong(*(unsigned short*)addr); break; case T_INT: - v = PyInt_FromLong((long) *(int*)addr); + v = PyInt_FromLong(*(int*)addr); break; case T_UINT: - v = PyInt_FromLong((long) *(unsigned int*)addr); + v = PyLong_FromUnsignedLong(*(unsigned int*)addr); break; case T_LONG: v = PyInt_FromLong(*(long*)addr); break; case T_ULONG: - v = PyLong_FromDouble((double) *(unsigned long*)addr); + v = PyLong_FromUnsignedLong(*(unsigned long*)addr); break; case T_FLOAT: v = PyFloat_FromDouble((double)*(float*)addr); @@ -175,68 +174,107 @@ } addr += l->offset; switch (l->type) { - case T_BYTE: - case T_UBYTE: - if (!PyInt_Check(v)) { - PyErr_BadArgument(); + case T_BYTE:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) return -1; - } - *(char*)addr = (char) PyInt_AsLong(v); + /* XXX: For compatibility, only warn about truncations + for now. */ + if ((long_val > CHAR_MAX) || (long_val < CHAR_MIN)) + PyErr_Warn(PyExc_RuntimeWarning, "Truncation of value to char"); + *(char*)addr = (char)long_val; break; - case T_SHORT: - case T_USHORT: - if (!PyInt_Check(v)) { - PyErr_BadArgument(); - return -1; } - *(short*)addr = (short) PyInt_AsLong(v); - break; - case T_UINT: - case T_INT: - if (!PyInt_Check(v)) { - PyErr_BadArgument(); + case T_UBYTE:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) return -1; - } - *(int*)addr = (int) PyInt_AsLong(v); + if ((long_val > UCHAR_MAX) || (long_val < 0)) + PyErr_Warn(PyExc_RuntimeWarning, "Truncation of value to unsigned char"); + *(unsigned char*)addr = (unsigned char)long_val; break; - case T_LONG: - if (!PyInt_Check(v)) { - PyErr_BadArgument(); + } + case T_SHORT:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) return -1; + if ((long_val > SHRT_MAX) || (long_val < SHRT_MIN)) + PyErr_Warn(PyExc_RuntimeWarning, "Truncation of value to short"); + *(short*)addr = (short)long_val; + break; } - *(long*)addr = PyInt_AsLong(v); + case T_USHORT:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) + return -1; + if ((long_val > USHRT_MAX) || (long_val < 0)) + PyErr_Warn(PyExc_RuntimeWarning, "Truncation of value to unsigned short"); + *(unsigned short*)addr = (unsigned short)long_val; break; - case T_ULONG: - if (PyInt_Check(v)) - *(long*)addr = PyInt_AsLong(v); - else if (PyLong_Check(v)) - *(long*)addr = PyLong_AsLong(v); - else { - PyErr_BadArgument(); + } + case T_INT:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) return -1; + if ((long_val > INT_MAX) || (long_val < INT_MIN)) + PyErr_Warn(PyExc_RuntimeWarning, "Truncation of value to int"); + *(int *)addr = (int)long_val; + break; + } + case T_UINT:{ + unsigned long ulong_val; + ulong_val = PyLong_AsUnsignedLong(v); + if ((ulong_val == (unsigned int)-1) && PyErr_Occurred()) { + /* XXX: For compatibility, accept negative int values + as well. */ + PyErr_Clear(); + ulong_val = PyLong_AsLong(v); + if ((ulong_val == (unsigned int)-1) && PyErr_Occurred()) + return -1; + PyErr_Warn(PyExc_RuntimeWarning, "Writing negative value into unsigned field"); + } + if (ulong_val > UINT_MAX) + PyErr_Warn(PyExc_RuntimeWarning, "Truncation of value to unsigned int"); + *(unsigned int *)addr = (unsigned int)ulong_val; + break; + } + case T_LONG:{ + *(long*)addr = PyLong_AsLong(v); + if ((*(long*)addr == -1) && PyErr_Occurred()) + return -1; + break; + } + case T_ULONG:{ + *(unsigned long*)addr = PyLong_AsUnsignedLong(v); + if ((*(unsigned long*)addr == (unsigned long)-1) + && PyErr_Occurred()) { + /* XXX: For compatibility, accept negative int values + as well. */ + PyErr_Clear(); + *(unsigned long*)addr = PyLong_AsLong(v); + if ((*(unsigned long*)addr == (unsigned int)-1) && PyErr_Occurred()) + return -1; + PyErr_Warn(PyExc_RuntimeWarning, "Writing negative value into unsigned field"); } break; - case T_FLOAT: - if (PyInt_Check(v)) - *(float*)addr = - (float) PyInt_AsLong(v); - else if (PyFloat_Check(v)) - *(float*)addr = - (float) PyFloat_AsDouble(v); - else { - PyErr_BadArgument(); - return -1; } + case T_FLOAT:{ + double double_val; + double_val = PyFloat_AsDouble(v); + if ((double_val == -1) && PyErr_Occurred()) + return -1; + *(float*)addr = (float)double_val; break; + } case T_DOUBLE: - if (PyInt_Check(v)) - *(double*)addr = (double) PyInt_AsLong(v); - else if (PyFloat_Check(v)) - *(double*)addr = PyFloat_AsDouble(v); - else { - PyErr_BadArgument(); + *(double*)addr = PyFloat_AsDouble(v); + if ((*(double*)addr == -1) && PyErr_Occurred()) return -1; - } break; case T_OBJECT: case T_OBJECT_EX: From python-checkins at python.org Fri Oct 27 08:17:22 2006 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 27 Oct 2006 08:17:22 +0200 (CEST) Subject: [Python-checkins] r52453 - in python/branches/release25-maint: Lib/test/test_structmembers.py Misc/NEWS Modules/_testcapimodule.c Python/structmember.c Message-ID: <20061027061722.935751E4003@bag.python.org> Author: martin.v.loewis Date: Fri Oct 27 08:17:21 2006 New Revision: 52453 Added: python/branches/release25-maint/Lib/test/test_structmembers.py (contents, props changed) Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/_testcapimodule.c python/branches/release25-maint/Python/structmember.c Log: [Backport of r52452] Patch #1549049: Rewrite type conversion in structmember. Fixes #1545696 and #1566140. The new warnings have been omitted in the backport. Added: python/branches/release25-maint/Lib/test/test_structmembers.py ============================================================================== --- (empty file) +++ python/branches/release25-maint/Lib/test/test_structmembers.py Fri Oct 27 08:17:21 2006 @@ -0,0 +1,48 @@ +from _testcapi import test_structmembersType, \ + CHAR_MAX, CHAR_MIN, UCHAR_MAX, \ + SHRT_MAX, SHRT_MIN, USHRT_MAX, \ + INT_MAX, INT_MIN, UINT_MAX, \ + LONG_MAX, LONG_MIN, ULONG_MAX + +import warnings, exceptions, unittest, test.test_warnings +from test import test_support + +ts=test_structmembersType(1,2,3,4,5,6,7,8,9.99999,10.1010101010) + +class ReadWriteTests(unittest.TestCase): + def test_types(self): + ts.T_BYTE=CHAR_MAX + self.assertEquals(ts.T_BYTE, CHAR_MAX) + ts.T_BYTE=CHAR_MIN + self.assertEquals(ts.T_BYTE, CHAR_MIN) + ts.T_UBYTE=UCHAR_MAX + self.assertEquals(ts.T_UBYTE, UCHAR_MAX) + + ts.T_SHORT=SHRT_MAX + self.assertEquals(ts.T_SHORT, SHRT_MAX) + ts.T_SHORT=SHRT_MIN + self.assertEquals(ts.T_SHORT, SHRT_MIN) + ts.T_USHORT=USHRT_MAX + self.assertEquals(ts.T_USHORT, USHRT_MAX) + + ts.T_INT=INT_MAX + self.assertEquals(ts.T_INT, INT_MAX) + ts.T_INT=INT_MIN + self.assertEquals(ts.T_INT, INT_MIN) + ts.T_UINT=UINT_MAX + self.assertEquals(ts.T_UINT, UINT_MAX) + + ts.T_LONG=LONG_MAX + self.assertEquals(ts.T_LONG, LONG_MAX) + ts.T_LONG=LONG_MIN + self.assertEquals(ts.T_LONG, LONG_MIN) + ts.T_ULONG=ULONG_MAX + self.assertEquals(ts.T_ULONG, ULONG_MAX) + +def test_main(verbose=None): + test_support.run_unittest( + ReadWriteTests + ) + +if __name__ == "__main__": + test_main(verbose=True) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Fri Oct 27 08:17:21 2006 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Patch #1549049: Support long values in structmember. + - Bug #1545497: when given an explicit base, int() did ignore NULs embedded in the string to convert. Modified: python/branches/release25-maint/Modules/_testcapimodule.c ============================================================================== --- python/branches/release25-maint/Modules/_testcapimodule.c (original) +++ python/branches/release25-maint/Modules/_testcapimodule.c Fri Oct 27 08:17:21 2006 @@ -6,6 +6,8 @@ */ #include "Python.h" +#include +#include "structmember.h" #ifdef WITH_THREAD #include "pythread.h" @@ -35,13 +37,13 @@ platforms have these hardcoded. Better safe than sorry. */ static PyObject* -sizeof_error(const char* fatname, const char* typename, +sizeof_error(const char* fatname, const char* typname, int expected, int got) { char buf[1024]; PyOS_snprintf(buf, sizeof(buf), "%.200s #define == %d but sizeof(%.200s) == %d", - fatname, expected, typename, got); + fatname, expected, typname, got); PyErr_SetString(TestError, buf); return (PyObject*)NULL; } @@ -615,7 +617,7 @@ { PyObject *rc; PyGILState_STATE s = PyGILState_Ensure(); - rc = PyObject_CallFunction(callable, ""); + rc = PyObject_CallFunction((PyObject *)callable, ""); Py_XDECREF(rc); PyGILState_Release(s); } @@ -756,6 +758,105 @@ #define AddSym(d, n, f, v) {PyObject *o = f(v); PyDict_SetItemString(d, n, o); Py_DECREF(o);} +typedef struct { + char byte_member; + unsigned char ubyte_member; + short short_member; + unsigned short ushort_member; + int int_member; + unsigned int uint_member; + long long_member; + unsigned long ulong_member; + float float_member; + double double_member; +} all_structmembers; + +typedef struct { + PyObject_HEAD + all_structmembers structmembers; +} test_structmembers; + +static struct PyMemberDef test_members[] = { + {"T_BYTE", T_BYTE, offsetof(test_structmembers, structmembers.byte_member), 0, NULL}, + {"T_UBYTE", T_UBYTE, offsetof(test_structmembers, structmembers.ubyte_member), 0, NULL}, + {"T_SHORT", T_SHORT, offsetof(test_structmembers, structmembers.short_member), 0, NULL}, + {"T_USHORT", T_USHORT, offsetof(test_structmembers, structmembers.ushort_member), 0, NULL}, + {"T_INT", T_INT, offsetof(test_structmembers, structmembers.int_member), 0, NULL}, + {"T_UINT", T_UINT, offsetof(test_structmembers, structmembers.uint_member), 0, NULL}, + {"T_LONG", T_LONG, offsetof(test_structmembers, structmembers.long_member), 0, NULL}, + {"T_ULONG", T_ULONG, offsetof(test_structmembers, structmembers.ulong_member), 0, NULL}, + {"T_FLOAT", T_FLOAT, offsetof(test_structmembers, structmembers.float_member), 0, NULL}, + {"T_DOUBLE", T_DOUBLE, offsetof(test_structmembers, structmembers.double_member), 0, NULL}, + {NULL} +}; + + +static PyObject *test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs){ + static char *keywords[]={"T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT", "T_INT", "T_UINT", + "T_LONG", "T_ULONG", "T_FLOAT", "T_DOUBLE", NULL}; + test_structmembers *ob=PyObject_New(test_structmembers, type); + if (ob==NULL) + return NULL; + memset(&ob->structmembers, 0, sizeof(all_structmembers)); + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|bBhHiIlkfd", keywords, + &ob->structmembers.byte_member, &ob->structmembers.ubyte_member, + &ob->structmembers.short_member, &ob->structmembers.ushort_member, + &ob->structmembers.int_member, &ob->structmembers.uint_member, + &ob->structmembers.long_member, &ob->structmembers.ulong_member, + &ob->structmembers.float_member, &ob->structmembers.double_member)){ + Py_DECREF(ob); + return NULL; + } + return (PyObject *)ob; +} + +static void test_structmembers_free(PyObject *ob){ + PyObject_FREE(ob); +} + +static PyTypeObject test_structmembersType = { + PyObject_HEAD_INIT(NULL) + 0, + "test_structmembersType", + sizeof(test_structmembers), /* tp_basicsize */ + 0, /* tp_itemsize */ + test_structmembers_free, /* destructor 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 */ + PyObject_GenericGetAttr, + PyObject_GenericSetAttr, + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + "Type containing all structmember types", + 0, /* traverseproc tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + test_members, /* tp_members */ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + test_structmembers_new, /* tp_new */ +}; + + PyMODINIT_FUNC init_testcapi(void) { @@ -765,16 +866,28 @@ if (m == NULL) return; + test_structmembersType.ob_type=&PyType_Type; + Py_INCREF(&test_structmembersType); + PyModule_AddObject(m, "test_structmembersType", (PyObject *)&test_structmembersType); + + PyModule_AddObject(m, "CHAR_MAX", PyInt_FromLong(CHAR_MAX)); + PyModule_AddObject(m, "CHAR_MIN", PyInt_FromLong(CHAR_MIN)); PyModule_AddObject(m, "UCHAR_MAX", PyInt_FromLong(UCHAR_MAX)); + PyModule_AddObject(m, "SHRT_MAX", PyInt_FromLong(SHRT_MAX)); + PyModule_AddObject(m, "SHRT_MIN", PyInt_FromLong(SHRT_MIN)); PyModule_AddObject(m, "USHRT_MAX", PyInt_FromLong(USHRT_MAX)); + PyModule_AddObject(m, "INT_MAX", PyLong_FromLong(INT_MAX)); + PyModule_AddObject(m, "INT_MIN", PyLong_FromLong(INT_MIN)); PyModule_AddObject(m, "UINT_MAX", PyLong_FromUnsignedLong(UINT_MAX)); - PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX)); - PyModule_AddObject(m, "INT_MIN", PyInt_FromLong(INT_MIN)); - PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN)); - PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN)); - PyModule_AddObject(m, "INT_MAX", PyInt_FromLong(INT_MAX)); PyModule_AddObject(m, "LONG_MAX", PyInt_FromLong(LONG_MAX)); + PyModule_AddObject(m, "LONG_MIN", PyInt_FromLong(LONG_MIN)); + PyModule_AddObject(m, "ULONG_MAX", PyLong_FromUnsignedLong(ULONG_MAX)); + PyModule_AddObject(m, "FLT_MAX", PyFloat_FromDouble(FLT_MAX)); + PyModule_AddObject(m, "FLT_MIN", PyFloat_FromDouble(FLT_MIN)); + PyModule_AddObject(m, "DBL_MAX", PyFloat_FromDouble(DBL_MAX)); + PyModule_AddObject(m, "DBL_MIN", PyFloat_FromDouble(DBL_MIN)); PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyInt_FromSsize_t(PY_SSIZE_T_MAX)); + PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN)); TestError = PyErr_NewException("_testcapi.error", NULL, NULL); Py_INCREF(TestError); Modified: python/branches/release25-maint/Python/structmember.c ============================================================================== --- python/branches/release25-maint/Python/structmember.c (original) +++ python/branches/release25-maint/Python/structmember.c Fri Oct 27 08:17:21 2006 @@ -62,29 +62,28 @@ addr += l->offset; switch (l->type) { case T_BYTE: - v = PyInt_FromLong( - (long) (((*(char*)addr & 0xff) ^ 0x80) - 0x80)); + v = PyInt_FromLong(*(char*)addr); break; case T_UBYTE: - v = PyInt_FromLong((long) *(char*)addr & 0xff); + v = PyLong_FromUnsignedLong(*(unsigned char*)addr); break; case T_SHORT: - v = PyInt_FromLong((long) *(short*)addr); + v = PyInt_FromLong(*(short*)addr); break; case T_USHORT: - v = PyInt_FromLong((long) *(unsigned short*)addr); + v = PyLong_FromUnsignedLong(*(unsigned short*)addr); break; case T_INT: - v = PyInt_FromLong((long) *(int*)addr); + v = PyInt_FromLong(*(int*)addr); break; case T_UINT: - v = PyInt_FromLong((long) *(unsigned int*)addr); + v = PyLong_FromUnsignedLong(*(unsigned int*)addr); break; case T_LONG: v = PyInt_FromLong(*(long*)addr); break; case T_ULONG: - v = PyLong_FromDouble((double) *(unsigned long*)addr); + v = PyLong_FromUnsignedLong(*(unsigned long*)addr); break; case T_FLOAT: v = PyFloat_FromDouble((double)*(float*)addr); @@ -175,68 +174,91 @@ } addr += l->offset; switch (l->type) { - case T_BYTE: - case T_UBYTE: - if (!PyInt_Check(v)) { - PyErr_BadArgument(); + case T_BYTE:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) return -1; - } - *(char*)addr = (char) PyInt_AsLong(v); + *(char*)addr = (char)long_val; break; - case T_SHORT: - case T_USHORT: - if (!PyInt_Check(v)) { - PyErr_BadArgument(); - return -1; } - *(short*)addr = (short) PyInt_AsLong(v); + case T_UBYTE:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) + return -1; + *(unsigned char*)addr = (unsigned char)long_val; break; - case T_UINT: - case T_INT: - if (!PyInt_Check(v)) { - PyErr_BadArgument(); + } + case T_SHORT:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) return -1; + *(short*)addr = (short)long_val; + break; } - *(int*)addr = (int) PyInt_AsLong(v); + case T_USHORT:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) + return -1; + *(unsigned short*)addr = (unsigned short)long_val; break; - case T_LONG: - if (!PyInt_Check(v)) { - PyErr_BadArgument(); + } + case T_INT:{ + long long_val; + long_val = PyInt_AsLong(v); + if ((long_val == -1) && PyErr_Occurred()) return -1; + *(int *)addr = (int)long_val; + break; + } + case T_UINT:{ + unsigned long ulong_val; + ulong_val = PyLong_AsUnsignedLong(v); + if ((ulong_val == (unsigned int)-1) && PyErr_Occurred()) { + /* XXX: For compatibility, accept negative int values + as well. */ + PyErr_Clear(); + ulong_val = PyLong_AsLong(v); + if ((ulong_val == (unsigned int)-1) && PyErr_Occurred()) + return -1; } - *(long*)addr = PyInt_AsLong(v); + *(unsigned int *)addr = (unsigned int)ulong_val; break; - case T_ULONG: - if (PyInt_Check(v)) - *(long*)addr = PyInt_AsLong(v); - else if (PyLong_Check(v)) - *(long*)addr = PyLong_AsLong(v); - else { - PyErr_BadArgument(); + } + case T_LONG:{ + *(long*)addr = PyLong_AsLong(v); + if ((*(long*)addr == -1) && PyErr_Occurred()) return -1; + break; + } + case T_ULONG:{ + *(unsigned long*)addr = PyLong_AsUnsignedLong(v); + if ((*(unsigned long*)addr == (unsigned long)-1) + && PyErr_Occurred()) { + /* XXX: For compatibility, accept negative int values + as well. */ + PyErr_Clear(); + *(unsigned long*)addr = PyLong_AsLong(v); + if ((*(unsigned long*)addr == (unsigned int)-1) && PyErr_Occurred()) + return -1; } break; - case T_FLOAT: - if (PyInt_Check(v)) - *(float*)addr = - (float) PyInt_AsLong(v); - else if (PyFloat_Check(v)) - *(float*)addr = - (float) PyFloat_AsDouble(v); - else { - PyErr_BadArgument(); - return -1; } + case T_FLOAT:{ + double double_val; + double_val = PyFloat_AsDouble(v); + if ((double_val == -1) && PyErr_Occurred()) + return -1; + *(float*)addr = (float)double_val; break; + } case T_DOUBLE: - if (PyInt_Check(v)) - *(double*)addr = (double) PyInt_AsLong(v); - else if (PyFloat_Check(v)) - *(double*)addr = PyFloat_AsDouble(v); - else { - PyErr_BadArgument(); + *(double*)addr = PyFloat_AsDouble(v); + if ((*(double*)addr == -1) && PyErr_Occurred()) return -1; - } break; case T_OBJECT: case T_OBJECT_EX: From buildbot at python.org Fri Oct 27 08:23:09 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 06:23:09 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k trunk Message-ID: <20061027062309.6B2CD1E4003@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/1588 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 Fri Oct 27 08:24:51 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 06:24:51 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k 2.5 Message-ID: <20061027062451.2B3C21E4003@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/92 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Oct 27 08:25:02 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 06:25:02 +0000 Subject: [Python-checkins] buildbot failure in x86 XP trunk Message-ID: <20061027062503.259AF1E4009@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/16 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 Fri Oct 27 08:28:35 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 06:28:35 +0000 Subject: [Python-checkins] buildbot failure in x86 XP 2.5 Message-ID: <20061027062835.C511F1E4009@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/8 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Oct 27 08:41:07 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 06:41:07 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD trunk Message-ID: <20061027064107.EFF831E4013@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/1355 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 Fri Oct 27 08:42:29 2006 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 27 Oct 2006 08:42:29 +0200 (CEST) Subject: [Python-checkins] r52454 - in python/trunk: Modules/_testcapimodule.c configure configure.in pyconfig.h.in Message-ID: <20061027064229.4C0741E4009@bag.python.org> Author: martin.v.loewis Date: Fri Oct 27 08:42:27 2006 New Revision: 52454 Modified: python/trunk/Modules/_testcapimodule.c python/trunk/configure python/trunk/configure.in python/trunk/pyconfig.h.in Log: Check for values.h. Will backport. Modified: python/trunk/Modules/_testcapimodule.c ============================================================================== --- python/trunk/Modules/_testcapimodule.c (original) +++ python/trunk/Modules/_testcapimodule.c Fri Oct 27 08:42:27 2006 @@ -6,7 +6,9 @@ */ #include "Python.h" +#ifdef HAVE_VALUES_H #include +#endif #include "structmember.h" #ifdef WITH_THREAD Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Fri Oct 27 08:42:27 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52387 . +# From configure.in Revision: 52389 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.6. # @@ -4697,6 +4697,7 @@ + for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ @@ -4707,7 +4708,7 @@ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ -sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ +sys/resource.h netpacket/packet.h sysexits.h values.h bluetooth.h \ bluetooth/bluetooth.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Fri Oct 27 08:42:27 2006 @@ -1092,7 +1092,7 @@ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ -sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ +sys/resource.h netpacket/packet.h sysexits.h values.h bluetooth.h \ bluetooth/bluetooth.h) AC_HEADER_DIRENT AC_HEADER_MAJOR Modified: python/trunk/pyconfig.h.in ============================================================================== --- python/trunk/pyconfig.h.in (original) +++ python/trunk/pyconfig.h.in Fri Oct 27 08:42:27 2006 @@ -703,6 +703,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UTIME_H +/* Define to 1 if you have the header file. */ +#undef HAVE_VALUES_H + /* Define to 1 if you have the `wait3' function. */ #undef HAVE_WAIT3 From python-checkins at python.org Fri Oct 27 08:43:02 2006 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 27 Oct 2006 08:43:02 +0200 (CEST) Subject: [Python-checkins] r52455 - in python/branches/release25-maint: Modules/_testcapimodule.c configure configure.in pyconfig.h.in Message-ID: <20061027064302.2E38E1E4003@bag.python.org> Author: martin.v.loewis Date: Fri Oct 27 08:43:00 2006 New Revision: 52455 Modified: python/branches/release25-maint/Modules/_testcapimodule.c python/branches/release25-maint/configure python/branches/release25-maint/configure.in python/branches/release25-maint/pyconfig.h.in Log: Check for values.h. Modified: python/branches/release25-maint/Modules/_testcapimodule.c ============================================================================== --- python/branches/release25-maint/Modules/_testcapimodule.c (original) +++ python/branches/release25-maint/Modules/_testcapimodule.c Fri Oct 27 08:43:00 2006 @@ -6,7 +6,9 @@ */ #include "Python.h" +#ifdef HAVE_VALUES_H #include +#endif #include "structmember.h" #ifdef WITH_THREAD Modified: python/branches/release25-maint/configure ============================================================================== --- python/branches/release25-maint/configure (original) +++ python/branches/release25-maint/configure Fri Oct 27 08:43:00 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52090 . +# From configure.in Revision: 52362 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.5. # @@ -4632,6 +4632,7 @@ + for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ @@ -4642,7 +4643,7 @@ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ -sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ +sys/resource.h netpacket/packet.h sysexits.h values.h bluetooth.h \ bluetooth/bluetooth.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` Modified: python/branches/release25-maint/configure.in ============================================================================== --- python/branches/release25-maint/configure.in (original) +++ python/branches/release25-maint/configure.in Fri Oct 27 08:43:00 2006 @@ -1076,7 +1076,7 @@ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ -sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ +sys/resource.h netpacket/packet.h sysexits.h values.h bluetooth.h \ bluetooth/bluetooth.h) AC_HEADER_DIRENT AC_HEADER_MAJOR Modified: python/branches/release25-maint/pyconfig.h.in ============================================================================== --- python/branches/release25-maint/pyconfig.h.in (original) +++ python/branches/release25-maint/pyconfig.h.in Fri Oct 27 08:43:00 2006 @@ -700,6 +700,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UTIME_H +/* Define to 1 if you have the header file. */ +#undef HAVE_VALUES_H + /* Define to 1 if you have the `wait3' function. */ #undef HAVE_WAIT3 From buildbot at python.org Fri Oct 27 08:59:34 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 06:59:34 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20061027065935.2224F1E4009@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/1532 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 buildbot at python.org Fri Oct 27 09:00:34 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 07:00:34 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20061027070035.25D531E4003@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/1516 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 Fri Oct 27 09:06:54 2006 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 27 Oct 2006 09:06:54 +0200 (CEST) Subject: [Python-checkins] r52456 - in python/trunk: Modules/_testcapimodule.c configure configure.in pyconfig.h.in Message-ID: <20061027070654.123521E4003@bag.python.org> Author: martin.v.loewis Date: Fri Oct 27 09:06:52 2006 New Revision: 52456 Modified: python/trunk/Modules/_testcapimodule.c python/trunk/configure python/trunk/configure.in python/trunk/pyconfig.h.in Log: Get DBL_MAX from float.h not values.h. Will backport. Modified: python/trunk/Modules/_testcapimodule.c ============================================================================== --- python/trunk/Modules/_testcapimodule.c (original) +++ python/trunk/Modules/_testcapimodule.c Fri Oct 27 09:06:52 2006 @@ -6,9 +6,7 @@ */ #include "Python.h" -#ifdef HAVE_VALUES_H -#include -#endif +#include #include "structmember.h" #ifdef WITH_THREAD Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Fri Oct 27 09:06:52 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52389 . +# From configure.in Revision: 52454 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.6. # @@ -4697,7 +4697,6 @@ - for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ @@ -4708,7 +4707,7 @@ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ -sys/resource.h netpacket/packet.h sysexits.h values.h bluetooth.h \ +sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Fri Oct 27 09:06:52 2006 @@ -1092,7 +1092,7 @@ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ -sys/resource.h netpacket/packet.h sysexits.h values.h bluetooth.h \ +sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h) AC_HEADER_DIRENT AC_HEADER_MAJOR Modified: python/trunk/pyconfig.h.in ============================================================================== --- python/trunk/pyconfig.h.in (original) +++ python/trunk/pyconfig.h.in Fri Oct 27 09:06:52 2006 @@ -703,9 +703,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UTIME_H -/* Define to 1 if you have the header file. */ -#undef HAVE_VALUES_H - /* Define to 1 if you have the `wait3' function. */ #undef HAVE_WAIT3 From python-checkins at python.org Fri Oct 27 09:07:00 2006 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 27 Oct 2006 09:07:00 +0200 (CEST) Subject: [Python-checkins] r52457 - in python/branches/release25-maint: Modules/_testcapimodule.c configure configure.in pyconfig.h.in Message-ID: <20061027070700.B755D1E4003@bag.python.org> Author: martin.v.loewis Date: Fri Oct 27 09:06:59 2006 New Revision: 52457 Modified: python/branches/release25-maint/Modules/_testcapimodule.c python/branches/release25-maint/configure python/branches/release25-maint/configure.in python/branches/release25-maint/pyconfig.h.in Log: Get DBL_MAX from float.h not values.h. Modified: python/branches/release25-maint/Modules/_testcapimodule.c ============================================================================== --- python/branches/release25-maint/Modules/_testcapimodule.c (original) +++ python/branches/release25-maint/Modules/_testcapimodule.c Fri Oct 27 09:06:59 2006 @@ -6,9 +6,7 @@ */ #include "Python.h" -#ifdef HAVE_VALUES_H -#include -#endif +#include #include "structmember.h" #ifdef WITH_THREAD Modified: python/branches/release25-maint/configure ============================================================================== --- python/branches/release25-maint/configure (original) +++ python/branches/release25-maint/configure Fri Oct 27 09:06:59 2006 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 52362 . +# From configure.in Revision: 52455 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.5. # @@ -4632,7 +4632,6 @@ - for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ @@ -4643,7 +4642,7 @@ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ -sys/resource.h netpacket/packet.h sysexits.h values.h bluetooth.h \ +sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` Modified: python/branches/release25-maint/configure.in ============================================================================== --- python/branches/release25-maint/configure.in (original) +++ python/branches/release25-maint/configure.in Fri Oct 27 09:06:59 2006 @@ -1076,7 +1076,7 @@ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ -sys/resource.h netpacket/packet.h sysexits.h values.h bluetooth.h \ +sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h) AC_HEADER_DIRENT AC_HEADER_MAJOR Modified: python/branches/release25-maint/pyconfig.h.in ============================================================================== --- python/branches/release25-maint/pyconfig.h.in (original) +++ python/branches/release25-maint/pyconfig.h.in Fri Oct 27 09:06:59 2006 @@ -700,9 +700,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UTIME_H -/* Define to 1 if you have the header file. */ -#undef HAVE_VALUES_H - /* Define to 1 if you have the `wait3' function. */ #undef HAVE_WAIT3 From python-checkins at python.org Fri Oct 27 09:13:29 2006 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 27 Oct 2006 09:13:29 +0200 (CEST) Subject: [Python-checkins] r52458 - in python/trunk: Doc/lib/libsmtplib.tex Lib/smtplib.py Misc/ACKS Misc/NEWS Message-ID: <20061027071329.D66F41E4009@bag.python.org> Author: martin.v.loewis Date: Fri Oct 27 09:13:28 2006 New Revision: 52458 Modified: python/trunk/Doc/lib/libsmtplib.tex python/trunk/Lib/smtplib.py python/trunk/Misc/ACKS python/trunk/Misc/NEWS Log: Patch #1567274: Support SMTP over TLS. Modified: python/trunk/Doc/lib/libsmtplib.tex ============================================================================== --- python/trunk/Doc/lib/libsmtplib.tex (original) +++ python/trunk/Doc/lib/libsmtplib.tex Fri Oct 27 09:13:28 2006 @@ -28,6 +28,18 @@ included below. \end{classdesc} +\begin{classdesc}{SMTP_SSL}{\optional{host\optional{, port\optional{, + local_hostname\optional{, + keyfile\optional{, + certfile}}}}}} +A \class{SMTP_SSL} instance behaves exactly the same as instance \class{SMTP}. +\class{SMTP_SSL} should be used for the situations where SSL is required from +the beginning of the connection and \method{starttls()} is not appropriate. +If host is not specified, the local host is used. If port is +omitted, the standard SMTP-over-SSL port (465) is used. keyfile and certfile +are also optional - they can contain a PEM formatted private key and +certificate chain file for the SSL connection. +\end{classdesc} A nice selection of exceptions is defined as well: Modified: python/trunk/Lib/smtplib.py ============================================================================== --- python/trunk/Lib/smtplib.py (original) +++ python/trunk/Lib/smtplib.py Fri Oct 27 09:13:28 2006 @@ -52,9 +52,10 @@ __all__ = ["SMTPException","SMTPServerDisconnected","SMTPResponseException", "SMTPSenderRefused","SMTPRecipientsRefused","SMTPDataError", "SMTPConnectError","SMTPHeloError","SMTPAuthenticationError", - "quoteaddr","quotedata","SMTP"] + "quoteaddr","quotedata","SMTP","SMTP_SSL"] SMTP_PORT = 25 +SMTP_SSL_PORT = 465 CRLF="\r\n" OLDSTYLE_AUTH = re.compile(r"auth=(.*)", re.I) @@ -240,6 +241,7 @@ """ self.esmtp_features = {} + self.default_port = SMTP_PORT if host: (code, msg) = self.connect(host, port) if code != 220: @@ -271,6 +273,13 @@ """ self.debuglevel = debuglevel + def _get_socket(self,af, socktype, proto,sa): + # This makes it simpler for SMTP_SSL to use the SMTP connect code + # and just alter the socket connection bit. + self.sock = socket.socket(af, socktype, proto) + if self.debuglevel > 0: print>>stderr, 'connect:', (host, port) + self.sock.connect(sa) + def connect(self, host='localhost', port = 0): """Connect to a host on a given port. @@ -289,16 +298,14 @@ try: port = int(port) except ValueError: raise socket.error, "nonnumeric port" - if not port: port = SMTP_PORT + if not port: port = self.default_port if self.debuglevel > 0: print>>stderr, 'connect:', (host, port) msg = "getaddrinfo returns an empty list" self.sock = None for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res try: - self.sock = socket.socket(af, socktype, proto) - if self.debuglevel > 0: print>>stderr, 'connect:', sa - self.sock.connect(sa) + self._get_socket(af,socktype,proto,sa) except socket.error, msg: if self.debuglevel > 0: print>>stderr, 'connect fail:', msg if self.sock: @@ -716,6 +723,28 @@ self.docmd("quit") self.close() +class SMTP_SSL(SMTP): + """ This is a subclass derived from SMTP that connects over an SSL encrypted + socket (to use this class you need a socket module that was compiled with SSL + support). If host is not specified, '' (the local host) is used. If port is + omitted, the standard SMTP-over-SSL port (465) is used. keyfile and certfile + are also optional - they can contain a PEM formatted private key and + certificate chain file for the SSL connection. + """ + def __init__(self, host = '', port = 0, local_hostname = None, + keyfile = None, certfile = None): + self.keyfile = keyfile + self.certfile = certfile + SMTP.__init__(self,host,port,local_hostname) + self.default_port = SMTP_SSL_PORT + + def _get_socket(self,af, socktype, proto,sa): + self.sock = socket.socket(af, socktype, proto) + if self.debuglevel > 0: print>>stderr, 'connect:', (host, port) + self.sock.connect(sa) + sslobj = socket.ssl(self.sock, self.keyfile, self.certfile) + self.sock = SSLFakeSocket(self.sock, sslobj) + self.file = SSLFakeFile(sslobj) # Test the sendmail method, which tests most of the others. # Note: This always sends to localhost. Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Fri Oct 27 09:13:28 2006 @@ -613,6 +613,7 @@ Christian Tanzer Steven Taschuk Amy Taylor +Monty Taylor Tobias Thelen Robin Thomas Eric Tiedemann Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Oct 27 09:13:28 2006 @@ -84,6 +84,8 @@ Library ------- +- Patch #1567274: Support SMTP over TLS. + - Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that ctypes isn't considered as requiring executable stacks. From buildbot at python.org Fri Oct 27 09:17:13 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 07:17:13 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD 2.5 Message-ID: <20061027071713.E29371E4003@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/89 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling,martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Fri Oct 27 09:37:36 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 07:37:36 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc 2.5 Message-ID: <20061027073736.00FC41E4003@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/88 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling,martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Fri Oct 27 09:40:24 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 07:40:24 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 2.5 Message-ID: <20061027074024.8A6E01E4003@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/87 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling,martin.v.loewis Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Fri Oct 27 11:15:23 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 09:15:23 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061027091523.48B721E4003@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/1238 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 Fri Oct 27 13:33:29 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 13:33:29 +0200 (CEST) Subject: [Python-checkins] r52459 - python/trunk/Doc/whatsnew/whatsnew26.tex Message-ID: <20061027113329.01A1A1E4015@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 13:33:29 2006 New Revision: 52459 Modified: python/trunk/Doc/whatsnew/whatsnew26.tex (contents, props changed) Log: Set svn:keywords property Modified: python/trunk/Doc/whatsnew/whatsnew26.tex ============================================================================== --- python/trunk/Doc/whatsnew/whatsnew26.tex (original) +++ python/trunk/Doc/whatsnew/whatsnew26.tex Fri Oct 27 13:33:29 2006 @@ -1,6 +1,6 @@ \documentclass{howto} \usepackage{distutils} -% $Id: whatsnew25.tex 37952 2004-12-03 13:54:09Z akuchling $ +% $Id$ \title{What's New in Python 2.6} From python-checkins at python.org Fri Oct 27 13:36:41 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 13:36:41 +0200 (CEST) Subject: [Python-checkins] r52460 - python/trunk/Doc/whatsnew/whatsnew26.tex Message-ID: <20061027113641.ED0121E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 13:36:41 2006 New Revision: 52460 Modified: python/trunk/Doc/whatsnew/whatsnew26.tex Log: Add item Modified: python/trunk/Doc/whatsnew/whatsnew26.tex ============================================================================== --- python/trunk/Doc/whatsnew/whatsnew26.tex (original) +++ python/trunk/Doc/whatsnew/whatsnew26.tex Fri Oct 27 13:36:41 2006 @@ -67,7 +67,10 @@ \begin{itemize} -\item Descriptions go here. +\item The \module{smtplib} module now supports SMTP over +SSL thanks to the addition of the \class{SMTP_SSL} class. +This class supports an interface identical to the existing \class{SMTP} +class. (Contributed by Monty Taylor.) \end{itemize} From python-checkins at python.org Fri Oct 27 13:37:01 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 13:37:01 +0200 (CEST) Subject: [Python-checkins] r52461 - python/trunk/Doc/lib/libsmtplib.tex Message-ID: <20061027113701.C7E4E1E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 13:37:01 2006 New Revision: 52461 Modified: python/trunk/Doc/lib/libsmtplib.tex Log: Some wording changes and markup fixes Modified: python/trunk/Doc/lib/libsmtplib.tex ============================================================================== --- python/trunk/Doc/lib/libsmtplib.tex (original) +++ python/trunk/Doc/lib/libsmtplib.tex Fri Oct 27 13:37:01 2006 @@ -32,12 +32,12 @@ local_hostname\optional{, keyfile\optional{, certfile}}}}}} -A \class{SMTP_SSL} instance behaves exactly the same as instance \class{SMTP}. -\class{SMTP_SSL} should be used for the situations where SSL is required from -the beginning of the connection and \method{starttls()} is not appropriate. -If host is not specified, the local host is used. If port is -omitted, the standard SMTP-over-SSL port (465) is used. keyfile and certfile -are also optional - they can contain a PEM formatted private key and +A \class{SMTP_SSL} instance behaves exactly the same as instances of \class{SMTP}. +\class{SMTP_SSL} should be used for situations where SSL is required from +the beginning of the connection and using \method{starttls()} is not appropriate. +If \var{host} is not specified, the local host is used. If \var{port} is +omitted, the standard SMTP-over-SSL port (465) is used. \var{keyfile} and \var{certfile} +are also optional, and can contain a PEM formatted private key and certificate chain file for the SSL connection. \end{classdesc} From python-checkins at python.org Fri Oct 27 14:18:38 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 14:18:38 +0200 (CEST) Subject: [Python-checkins] r52462 - python/trunk/Doc/lib/libcsv.tex Message-ID: <20061027121838.C63691E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 14:18:38 2006 New Revision: 52462 Modified: python/trunk/Doc/lib/libcsv.tex Log: [Bug #1585690] Note that line_num was added in Python 2.5 Modified: python/trunk/Doc/lib/libcsv.tex ============================================================================== --- python/trunk/Doc/lib/libcsv.tex (original) +++ python/trunk/Doc/lib/libcsv.tex Fri Oct 27 14:18:38 2006 @@ -345,6 +345,7 @@ \begin{memberdesc}[csv reader]{line_num} The number of lines read from the source iterator. This is not the same as the number of records returned, as records can span multiple lines. + \versionadded{2.5} \end{memberdesc} From python-checkins at python.org Fri Oct 27 14:18:58 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 14:18:58 +0200 (CEST) Subject: [Python-checkins] r52463 - python/branches/release25-maint/Doc/lib/libcsv.tex Message-ID: <20061027121858.B4DA01E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 14:18:58 2006 New Revision: 52463 Modified: python/branches/release25-maint/Doc/lib/libcsv.tex Log: [Bug #1585690] Note that line_num was added in Python 2.5 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 Fri Oct 27 14:18:58 2006 @@ -345,6 +345,7 @@ \begin{memberdesc}[csv reader]{line_num} The number of lines read from the source iterator. This is not the same as the number of records returned, as records can span multiple lines. + \versionadded{2.5} \end{memberdesc} From python-checkins at python.org Fri Oct 27 14:50:39 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 14:50:39 +0200 (CEST) Subject: [Python-checkins] r52464 - python/trunk/Doc/lib/libsocket.tex Message-ID: <20061027125039.2BAEC1E400E@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 14:50:38 2006 New Revision: 52464 Modified: python/trunk/Doc/lib/libsocket.tex Log: [Bug #1583946] Reword description of server and issuer Modified: python/trunk/Doc/lib/libsocket.tex ============================================================================== --- python/trunk/Doc/lib/libsocket.tex (original) +++ python/trunk/Doc/lib/libsocket.tex Fri Oct 27 14:50:38 2006 @@ -712,14 +712,15 @@ \end{methoddesc} \begin{methoddesc}{server}{} -Returns a string containing the ASN.1 distinguished name identifying the -server's certificate. (See below for an example -showing what distinguished names look like.) +Returns a string describing the server's certificate. +Useful for debugging purposes; do not parse the content of this string +because its format can't be parsed unambiguously. \end{methoddesc} \begin{methoddesc}{issuer}{} -Returns a string containing the ASN.1 distinguished name identifying the -issuer of the server's certificate. +Returns a string describing the issuer of the server's certificate. +Useful for debugging purposes; do not parse the content of this string +because its format can't be parsed unambiguously. \end{methoddesc} \subsection{Example \label{socket-example}} From python-checkins at python.org Fri Oct 27 14:50:55 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 14:50:55 +0200 (CEST) Subject: [Python-checkins] r52465 - python/branches/release25-maint/Doc/lib/libsocket.tex Message-ID: <20061027125055.8ECD81E4039@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 14:50:55 2006 New Revision: 52465 Modified: python/branches/release25-maint/Doc/lib/libsocket.tex Log: [Bug #1583946] Reword description of server and issuer Modified: python/branches/release25-maint/Doc/lib/libsocket.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libsocket.tex (original) +++ python/branches/release25-maint/Doc/lib/libsocket.tex Fri Oct 27 14:50:55 2006 @@ -712,14 +712,15 @@ \end{methoddesc} \begin{methoddesc}{server}{} -Returns a string containing the ASN.1 distinguished name identifying the -server's certificate. (See below for an example -showing what distinguished names look like.) +Returns a string describing the server's certificate. +Useful for debugging purposes; do not parse the content of this string +because its format can't be parsed unambiguously. \end{methoddesc} \begin{methoddesc}{issuer}{} -Returns a string containing the ASN.1 distinguished name identifying the -issuer of the server's certificate. +Returns a string describing the issuer of the server's certificate. +Useful for debugging purposes; do not parse the content of this string +because its format can't be parsed unambiguously. \end{methoddesc} \subsection{Example \label{socket-example}} From python-checkins at python.org Fri Oct 27 15:06:25 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 15:06:25 +0200 (CEST) Subject: [Python-checkins] r52466 - python/trunk/Doc/lib/libasyncore.tex Message-ID: <20061027130625.E8ED31E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 15:06:25 2006 New Revision: 52466 Modified: python/trunk/Doc/lib/libasyncore.tex Log: [Bug #1562583] Mention the set_reuse_addr() method Modified: python/trunk/Doc/lib/libasyncore.tex ============================================================================== --- python/trunk/Doc/lib/libasyncore.tex (original) +++ python/trunk/Doc/lib/libasyncore.tex Fri Oct 27 15:06:25 2006 @@ -198,9 +198,11 @@ \end{methoddesc} \begin{methoddesc}{bind}{address} - Bind the socket to \var{address}. The socket must not already - be bound. (The format of \var{address} depends on the address - family --- see above.) + Bind the socket to \var{address}. The socket must not already be + bound. (The format of \var{address} depends on the address family + --- see above.) To mark the socket as re-usable (setting the + \constant{SO_REUSEADDR} option), call the \class{dispatcher} + object's \method{set_reuse_addr()} method. \end{methoddesc} \begin{methoddesc}{accept}{} From python-checkins at python.org Fri Oct 27 15:06:42 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 15:06:42 +0200 (CEST) Subject: [Python-checkins] r52467 - python/branches/release25-maint/Doc/lib/libasyncore.tex Message-ID: <20061027130642.0D8ED1E4009@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 15:06:41 2006 New Revision: 52467 Modified: python/branches/release25-maint/Doc/lib/libasyncore.tex Log: [Bug #1562583] Mention the set_reuse_addr() method Modified: python/branches/release25-maint/Doc/lib/libasyncore.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libasyncore.tex (original) +++ python/branches/release25-maint/Doc/lib/libasyncore.tex Fri Oct 27 15:06:41 2006 @@ -198,9 +198,11 @@ \end{methoddesc} \begin{methoddesc}{bind}{address} - Bind the socket to \var{address}. The socket must not already - be bound. (The format of \var{address} depends on the address - family --- see above.) + Bind the socket to \var{address}. The socket must not already be + bound. (The format of \var{address} depends on the address family + --- see above.) To mark the socket as re-usable (setting the + \constant{SO_REUSEADDR} option), call the \class{dispatcher} + object's \method{set_reuse_addr()} method. \end{methoddesc} \begin{methoddesc}{accept}{} From python-checkins at python.org Fri Oct 27 15:07:10 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 15:07:10 +0200 (CEST) Subject: [Python-checkins] r52468 - python/branches/release24-maint/Doc/lib/libasyncore.tex Message-ID: <20061027130710.9C0AB1E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 15:07:10 2006 New Revision: 52468 Modified: python/branches/release24-maint/Doc/lib/libasyncore.tex Log: [Bug #1562583] Mention the set_reuse_addr() method Modified: python/branches/release24-maint/Doc/lib/libasyncore.tex ============================================================================== --- python/branches/release24-maint/Doc/lib/libasyncore.tex (original) +++ python/branches/release24-maint/Doc/lib/libasyncore.tex Fri Oct 27 15:07:10 2006 @@ -199,9 +199,11 @@ \end{methoddesc} \begin{methoddesc}{bind}{address} - Bind the socket to \var{address}. The socket must not already - be bound. (The format of \var{address} depends on the address - family --- see above.) + Bind the socket to \var{address}. The socket must not already be + bound. (The format of \var{address} depends on the address family + --- see above.) To mark the socket as re-usable (setting the + \constant{SO_REUSEADDR} option), call the \class{dispatcher} + object's \method{set_reuse_addr()} method. \end{methoddesc} \begin{methoddesc}{accept}{} From python-checkins at python.org Fri Oct 27 15:22:47 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 15:22:47 +0200 (CEST) Subject: [Python-checkins] r52469 - python/trunk/Python/ceval.c Message-ID: <20061027132247.63C3F1E400E@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 15:22:46 2006 New Revision: 52469 Modified: python/trunk/Python/ceval.c Log: [Bug #1542016] Report PCALL_POP value. This makes the return value of sys.callstats() match its docstring. Backport candidate. Though it's an API change, this is a pretty obscure portion of the API. Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Fri Oct 27 15:22:46 2006 @@ -186,10 +186,10 @@ PyObject * PyEval_GetCallStats(PyObject *self) { - return Py_BuildValue("iiiiiiiiii", + return Py_BuildValue("iiiiiiiiiii", pcall[0], pcall[1], pcall[2], pcall[3], pcall[4], pcall[5], pcall[6], pcall[7], - pcall[8], pcall[9]); + pcall[8], pcall[9], pcall[10]); } #else #define PCALL(O) From python-checkins at python.org Fri Oct 27 15:29:42 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 15:29:42 +0200 (CEST) Subject: [Python-checkins] r52470 - in python/branches/release25-maint: Misc/NEWS Python/ceval.c Message-ID: <20061027132942.9E46B1E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 15:29:41 2006 New Revision: 52470 Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Python/ceval.c Log: [Bug #1542016] Report PCALL_POP value. This makes the return value of sys.callstats() match its docstring. Backport candidate. Though it's an API change, this is a pretty obscure portion of the API. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Fri Oct 27 15:29:41 2006 @@ -14,6 +14,9 @@ - Patch #1549049: Support long values in structmember. +- Bug #1542016: make sys.callstats() match its docstring and return an + 11-tuple (only relevant when Python is compiled with -DCALL_PROFILE). + - Bug #1545497: when given an explicit base, int() did ignore NULs embedded in the string to convert. Modified: python/branches/release25-maint/Python/ceval.c ============================================================================== --- python/branches/release25-maint/Python/ceval.c (original) +++ python/branches/release25-maint/Python/ceval.c Fri Oct 27 15:29:41 2006 @@ -186,10 +186,10 @@ PyObject * PyEval_GetCallStats(PyObject *self) { - return Py_BuildValue("iiiiiiiiii", + return Py_BuildValue("iiiiiiiiiii", pcall[0], pcall[1], pcall[2], pcall[3], pcall[4], pcall[5], pcall[6], pcall[7], - pcall[8], pcall[9]); + pcall[8], pcall[9], pcall[10]); } #else #define PCALL(O) From python-checkins at python.org Fri Oct 27 15:34:06 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 15:34:06 +0200 (CEST) Subject: [Python-checkins] r52471 - python/branches/release24-maint/Misc/NEWS Message-ID: <20061027133406.C0D731E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 15:34:05 2006 New Revision: 52471 Modified: python/branches/release24-maint/Misc/NEWS Log: Add sections for a hypothetical future 2.4.5 release Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Fri Oct 27 15:34:05 2006 @@ -4,6 +4,28 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) +What's New in Python 2.4.5c1? +============================= + +*Release date: XX-XXX-XXXX* + + +Core and builtins +----------------- + +Extension Modules +----------------- + +Library +------- + +Tests +----- + +Build +----- + + What's New in Python 2.4.4? =========================== From python-checkins at python.org Fri Oct 27 15:36:17 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 15:36:17 +0200 (CEST) Subject: [Python-checkins] r52472 - in python/branches/release24-maint: Misc/NEWS Python/ceval.c Message-ID: <20061027133617.7FC6E1E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 15:36:16 2006 New Revision: 52472 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Python/ceval.c Log: [Bug #1542016] Report PCALL_POP value. This makes the return value of sys.callstats() match its docstring. Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Fri Oct 27 15:36:16 2006 @@ -13,6 +13,9 @@ Core and builtins ----------------- +- Bug #1542016: make sys.callstats() match its docstring and return an + 11-tuple (only relevant when Python is compiled with -DCALL_PROFILE). + Extension Modules ----------------- 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 27 15:36:16 2006 @@ -179,10 +179,10 @@ PyObject * PyEval_GetCallStats(PyObject *self) { - return Py_BuildValue("iiiiiiiiii", + return Py_BuildValue("iiiiiiiiiii", pcall[0], pcall[1], pcall[2], pcall[3], pcall[4], pcall[5], pcall[6], pcall[7], - pcall[8], pcall[9]); + pcall[8], pcall[9], pcall[10]); } #else #define PCALL(O) From python-checkins at python.org Fri Oct 27 16:53:42 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 16:53:42 +0200 (CEST) Subject: [Python-checkins] r52473 - python/trunk/Doc/lib/libcommands.tex python/trunk/Doc/lib/libos.tex python/trunk/Doc/lib/libpopen2.tex python/trunk/Doc/lib/libsubprocess.tex Message-ID: <20061027145342.9B04D1E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 16:53:41 2006 New Revision: 52473 Modified: python/trunk/Doc/lib/libcommands.tex python/trunk/Doc/lib/libos.tex python/trunk/Doc/lib/libpopen2.tex python/trunk/Doc/lib/libsubprocess.tex Log: Point users to the subprocess module in the docs for os.system, os.spawn*, os.popen2, and the popen2 and commands modules Modified: python/trunk/Doc/lib/libcommands.tex ============================================================================== --- python/trunk/Doc/lib/libcommands.tex (original) +++ python/trunk/Doc/lib/libcommands.tex Fri Oct 27 16:53:41 2006 @@ -12,6 +12,11 @@ return any output generated by the command and, optionally, the exit status. +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results. Using the +\module{subprocess} module is preferable to using the \module{commands} +module. + The \module{commands} module defines the following functions: @@ -51,3 +56,7 @@ >>> commands.getstatus('/bin/ls') '-rwxr-xr-x 1 root 13352 Oct 14 1994 /bin/ls' \end{verbatim} + +\begin{seealso} + \seemodule{subprocess}{Module for spawning and managing subprocesses.} +\end{seealso} Modified: python/trunk/Doc/lib/libos.tex ============================================================================== --- python/trunk/Doc/lib/libos.tex (original) +++ python/trunk/Doc/lib/libos.tex Fri Oct 27 16:53:41 2006 @@ -361,6 +361,10 @@ errors), \code{None} is returned. Availability: Macintosh, \UNIX, Windows. +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results; using that module +is preferable to using this function. + \versionchanged[This function worked unreliably under Windows in earlier versions of Python. This was due to the use of the \cfunction{_popen()} function from the libraries provided with @@ -375,8 +379,13 @@ Availability: Macintosh, \UNIX, Windows. \end{funcdesc} +There are a number of different \function{popen*()} functions that +provide slightly different ways to create subprocesses. Note that the +\module{subprocess} module is easier to use and more powerful; +consider using that module before writing code using the +lower-level \function{popen*()} functions. -For each of the following \function{popen()} variants, if \var{bufsize} is +For each of the \function{popen*()} variants, if \var{bufsize} is specified, it specifies the buffer size for the I/O pipes. \var{mode}, if provided, should be the string \code{'b'} or \code{'t'}; on Windows this is needed to determine whether the file @@ -1547,7 +1556,13 @@ \funcline{spawnve}{mode, path, args, env} \funcline{spawnvp}{mode, file, args} \funcline{spawnvpe}{mode, file, args, env} -Execute the program \var{path} in a new process. If \var{mode} is +Execute the program \var{path} in a new process. + +(Note that the \module{subprocess} module provides more powerful +facilities for spawning new processes and retrieving their results; +using that module is preferable to using these functions.) + +If \var{mode} is \constant{P_NOWAIT}, this function returns the process ID of the new process; if \var{mode} is \constant{P_WAIT}, returns the process's exit code if it exits normally, or \code{-\var{signal}}, where @@ -1684,6 +1699,10 @@ a non-native shell, consult your shell documentation. Availability: Macintosh, \UNIX, Windows. + +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results; using that module +is preferable to using this function. \end{funcdesc} \begin{funcdesc}{times}{} Modified: python/trunk/Doc/lib/libpopen2.tex ============================================================================== --- python/trunk/Doc/lib/libpopen2.tex (original) +++ python/trunk/Doc/lib/libpopen2.tex Fri Oct 27 16:53:41 2006 @@ -11,10 +11,10 @@ input/output/error pipes and obtain their return codes under \UNIX{} and Windows. -Note that starting with Python 2.0, this functionality is available -using functions from the \refmodule{os} module which have the same -names as the factory functions here, but the order of the return -values is more intuitive in the \refmodule{os} module variants. +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results. Using the +\module{subprocess} module is preferable to using the \module{popen2} +module. The primary interface offered by this module is a trio of factory functions. For each of these, if \var{bufsize} is specified, @@ -184,3 +184,7 @@ separate threads to read each of the individual files provided by whichever \function{popen*()} function or \class{Popen*} class was used. + +\begin{seealso} + \seemodule{subprocess}{Module for spawning and managing subprocesses.} +\end{seealso} Modified: python/trunk/Doc/lib/libsubprocess.tex ============================================================================== --- python/trunk/Doc/lib/libsubprocess.tex (original) +++ python/trunk/Doc/lib/libsubprocess.tex Fri Oct 27 16:53:41 2006 @@ -12,9 +12,6 @@ codes. This module intends to replace several other, older modules and functions, such as: -% XXX Should add pointers to this module to at least the popen2 -% and commands sections. - \begin{verbatim} os.system os.spawn* From python-checkins at python.org Fri Oct 27 16:54:44 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 16:54:44 +0200 (CEST) Subject: [Python-checkins] r52474 - python/branches/release25-maint/Doc/lib/libcommands.tex python/branches/release25-maint/Doc/lib/libos.tex python/branches/release25-maint/Doc/lib/libpopen2.tex python/branches/release25-maint/Doc/lib/libsubprocess.tex Message-ID: <20061027145444.0A36F1E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 16:54:43 2006 New Revision: 52474 Modified: python/branches/release25-maint/Doc/lib/libcommands.tex python/branches/release25-maint/Doc/lib/libos.tex python/branches/release25-maint/Doc/lib/libpopen2.tex python/branches/release25-maint/Doc/lib/libsubprocess.tex Log: Point users to the subprocess module in the docs for os.system, os.spawn*, os.popen2, and the popen2 and commands modules Modified: python/branches/release25-maint/Doc/lib/libcommands.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libcommands.tex (original) +++ python/branches/release25-maint/Doc/lib/libcommands.tex Fri Oct 27 16:54:43 2006 @@ -12,6 +12,11 @@ return any output generated by the command and, optionally, the exit status. +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results. Using the +\module{subprocess} module is preferable to using the \module{commands} +module. + The \module{commands} module defines the following functions: @@ -51,3 +56,7 @@ >>> commands.getstatus('/bin/ls') '-rwxr-xr-x 1 root 13352 Oct 14 1994 /bin/ls' \end{verbatim} + +\begin{seealso} + \seemodule{subprocess}{Module for spawning and managing subprocesses.} +\end{seealso} Modified: python/branches/release25-maint/Doc/lib/libos.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libos.tex (original) +++ python/branches/release25-maint/Doc/lib/libos.tex Fri Oct 27 16:54:43 2006 @@ -361,6 +361,10 @@ errors), \code{None} is returned. Availability: Macintosh, \UNIX, Windows. +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results; using that module +is preferable to using this function. + \versionchanged[This function worked unreliably under Windows in earlier versions of Python. This was due to the use of the \cfunction{_popen()} function from the libraries provided with @@ -375,8 +379,13 @@ Availability: Macintosh, \UNIX, Windows. \end{funcdesc} +There are a number of different \function{popen*()} functions that +provide slightly different ways to create subprocesses. Note that the +\module{subprocess} module is easier to use and more powerful; +consider using that module before writing code using the +lower-level \function{popen*()} functions. -For each of the following \function{popen()} variants, if \var{bufsize} is +For each of the \function{popen*()} variants, if \var{bufsize} is specified, it specifies the buffer size for the I/O pipes. \var{mode}, if provided, should be the string \code{'b'} or \code{'t'}; on Windows this is needed to determine whether the file @@ -1545,7 +1554,13 @@ \funcline{spawnve}{mode, path, args, env} \funcline{spawnvp}{mode, file, args} \funcline{spawnvpe}{mode, file, args, env} -Execute the program \var{path} in a new process. If \var{mode} is +Execute the program \var{path} in a new process. + +(Note that the \module{subprocess} module provides more powerful +facilities for spawning new processes and retrieving their results; +using that module is preferable to using these functions.) + +If \var{mode} is \constant{P_NOWAIT}, this function returns the process ID of the new process; if \var{mode} is \constant{P_WAIT}, returns the process's exit code if it exits normally, or \code{-\var{signal}}, where @@ -1682,6 +1697,10 @@ a non-native shell, consult your shell documentation. Availability: Macintosh, \UNIX, Windows. + +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results; using that module +is preferable to using this function. \end{funcdesc} \begin{funcdesc}{times}{} Modified: python/branches/release25-maint/Doc/lib/libpopen2.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libpopen2.tex (original) +++ python/branches/release25-maint/Doc/lib/libpopen2.tex Fri Oct 27 16:54:43 2006 @@ -11,10 +11,10 @@ input/output/error pipes and obtain their return codes under \UNIX{} and Windows. -Note that starting with Python 2.0, this functionality is available -using functions from the \refmodule{os} module which have the same -names as the factory functions here, but the order of the return -values is more intuitive in the \refmodule{os} module variants. +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results. Using the +\module{subprocess} module is preferable to using the \module{popen2} +module. The primary interface offered by this module is a trio of factory functions. For each of these, if \var{bufsize} is specified, @@ -184,3 +184,7 @@ separate threads to read each of the individual files provided by whichever \function{popen*()} function or \class{Popen*} class was used. + +\begin{seealso} + \seemodule{subprocess}{Module for spawning and managing subprocesses.} +\end{seealso} Modified: python/branches/release25-maint/Doc/lib/libsubprocess.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libsubprocess.tex (original) +++ python/branches/release25-maint/Doc/lib/libsubprocess.tex Fri Oct 27 16:54:43 2006 @@ -12,9 +12,6 @@ codes. This module intends to replace several other, older modules and functions, such as: -% XXX Should add pointers to this module to at least the popen2 -% and commands sections. - \begin{verbatim} os.system os.spawn* From python-checkins at python.org Fri Oct 27 16:55:12 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 16:55:12 +0200 (CEST) Subject: [Python-checkins] r52475 - python/branches/release24-maint/Doc/lib/libcommands.tex python/branches/release24-maint/Doc/lib/libos.tex python/branches/release24-maint/Doc/lib/libpopen2.tex python/branches/release24-maint/Doc/lib/libsubprocess.tex Message-ID: <20061027145512.31EA81E4013@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 16:55:11 2006 New Revision: 52475 Modified: python/branches/release24-maint/Doc/lib/libcommands.tex python/branches/release24-maint/Doc/lib/libos.tex python/branches/release24-maint/Doc/lib/libpopen2.tex python/branches/release24-maint/Doc/lib/libsubprocess.tex Log: Point users to the subprocess module in the docs for os.system, os.spawn*, os.popen2, and the popen2 and commands modules Modified: python/branches/release24-maint/Doc/lib/libcommands.tex ============================================================================== --- python/branches/release24-maint/Doc/lib/libcommands.tex (original) +++ python/branches/release24-maint/Doc/lib/libcommands.tex Fri Oct 27 16:55:11 2006 @@ -12,6 +12,11 @@ return any output generated by the command and, optionally, the exit status. +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results. Using the +\module{subprocess} module is preferable to using the \module{commands} +module. + The \module{commands} module defines the following functions: @@ -51,3 +56,7 @@ >>> commands.getstatus('/bin/ls') '-rwxr-xr-x 1 root 13352 Oct 14 1994 /bin/ls' \end{verbatim} + +\begin{seealso} + \seemodule{subprocess}{Module for spawning and managing subprocesses.} +\end{seealso} 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 Fri Oct 27 16:55:11 2006 @@ -357,6 +357,10 @@ errors), \code{None} is returned. Availability: Macintosh, \UNIX, Windows. +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results; using that module +is preferable to using this function. + \versionchanged[This function worked unreliably under Windows in earlier versions of Python. This was due to the use of the \cfunction{_popen()} function from the libraries provided with @@ -371,8 +375,13 @@ Availability: Macintosh, \UNIX, Windows. \end{funcdesc} +There are a number of different \function{popen*()} functions that +provide slightly different ways to create subprocesses. Note that the +\module{subprocess} module is easier to use and more powerful; +consider using that module before writing code using the +lower-level \function{popen*()} functions. -For each of the following \function{popen()} variants, if \var{bufsize} is +For each of the \function{popen*()} variants, if \var{bufsize} is specified, it specifies the buffer size for the I/O pipes. \var{mode}, if provided, should be the string \code{'b'} or \code{'t'}; on Windows this is needed to determine whether the file @@ -1504,7 +1513,13 @@ \funcline{spawnve}{mode, path, args, env} \funcline{spawnvp}{mode, file, args} \funcline{spawnvpe}{mode, file, args, env} -Execute the program \var{path} in a new process. If \var{mode} is +Execute the program \var{path} in a new process. + +(Note that the \module{subprocess} module provides more powerful +facilities for spawning new processes and retrieving their results; +using that module is preferable to using these functions.) + +If \var{mode} is \constant{P_NOWAIT}, this function returns the process ID of the new process; if \var{mode} is \constant{P_WAIT}, returns the process's exit code if it exits normally, or \code{-\var{signal}}, where @@ -1632,6 +1647,10 @@ a non-native shell, consult your shell documentation. Availability: Macintosh, \UNIX, Windows. + +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results; using that module +is preferable to using this function. \end{funcdesc} \begin{funcdesc}{times}{} Modified: python/branches/release24-maint/Doc/lib/libpopen2.tex ============================================================================== --- python/branches/release24-maint/Doc/lib/libpopen2.tex (original) +++ python/branches/release24-maint/Doc/lib/libpopen2.tex Fri Oct 27 16:55:11 2006 @@ -11,10 +11,10 @@ input/output/error pipes and obtain their return codes under \UNIX{} and Windows. -Note that starting with Python 2.0, this functionality is available -using functions from the \refmodule{os} module which have the same -names as the factory functions here, but the order of the return -values is more intuitive in the \refmodule{os} module variants. +The \module{subprocess} module provides more powerful facilities for +spawning new processes and retrieving their results. Using the +\module{subprocess} module is preferable to using the \module{popen2} +module. The primary interface offered by this module is a trio of factory functions. For each of these, if \var{bufsize} is specified, @@ -184,3 +184,7 @@ separate threads to read each of the individual files provided by whichever \function{popen*()} function or \class{Popen*} class was used. + +\begin{seealso} + \seemodule{subprocess}{Module for spawning and managing subprocesses.} +\end{seealso} Modified: python/branches/release24-maint/Doc/lib/libsubprocess.tex ============================================================================== --- python/branches/release24-maint/Doc/lib/libsubprocess.tex (original) +++ python/branches/release24-maint/Doc/lib/libsubprocess.tex Fri Oct 27 16:55:11 2006 @@ -12,9 +12,6 @@ codes. This module intends to replace several other, older modules and functions, such as: -% XXX Should add pointers to this module to at least the popen2 -% and commands sections. - \begin{verbatim} os.system os.spawn* From python-checkins at python.org Fri Oct 27 18:39:11 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 18:39:11 +0200 (CEST) Subject: [Python-checkins] r52476 - in python/trunk/Lib: functools.py test/test_functools.py Message-ID: <20061027163911.54CC51E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 18:39:10 2006 New Revision: 52476 Modified: python/trunk/Lib/functools.py python/trunk/Lib/test/test_functools.py Log: [Bug #1576241] Let functools.wraps work with built-in functions Modified: python/trunk/Lib/functools.py ============================================================================== --- python/trunk/Lib/functools.py (original) +++ python/trunk/Lib/functools.py Fri Oct 27 18:39:10 2006 @@ -32,7 +32,7 @@ for attr in assigned: setattr(wrapper, attr, getattr(wrapped, attr)) for attr in updated: - getattr(wrapper, attr).update(getattr(wrapped, attr)) + getattr(wrapper, attr).update(getattr(wrapped, attr, {})) # Return the wrapper so this can be used as a decorator via partial() return wrapper Modified: python/trunk/Lib/test/test_functools.py ============================================================================== --- python/trunk/Lib/test/test_functools.py (original) +++ python/trunk/Lib/test/test_functools.py Fri Oct 27 18:39:10 2006 @@ -210,6 +210,13 @@ self.assertEqual(wrapper.attr, 'This is a different test') self.assertEqual(wrapper.dict_attr, f.dict_attr) + def test_builtin_update(self): + # Test for bug #1576241 + def wrapper(): + pass + functools.update_wrapper(wrapper, max) + self.assertEqual(wrapper.__name__, 'max') + self.assert_(wrapper.__doc__.startswith('max(')) class TestWraps(TestUpdateWrapper): From python-checkins at python.org Fri Oct 27 18:42:20 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 18:42:20 +0200 (CEST) Subject: [Python-checkins] r52477 - in python/branches/release25-maint: Lib/functools.py Lib/test/test_functools.py Misc/NEWS Message-ID: <20061027164220.C688D1E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 18:42:19 2006 New Revision: 52477 Modified: python/branches/release25-maint/Lib/functools.py python/branches/release25-maint/Lib/test/test_functools.py python/branches/release25-maint/Misc/NEWS Log: [Bug #1576241] Let functools.wraps work with built-in functions Modified: python/branches/release25-maint/Lib/functools.py ============================================================================== --- python/branches/release25-maint/Lib/functools.py (original) +++ python/branches/release25-maint/Lib/functools.py Fri Oct 27 18:42:19 2006 @@ -32,7 +32,7 @@ for attr in assigned: setattr(wrapper, attr, getattr(wrapped, attr)) for attr in updated: - getattr(wrapper, attr).update(getattr(wrapped, attr)) + getattr(wrapper, attr).update(getattr(wrapped, attr, {})) # Return the wrapper so this can be used as a decorator via partial() return wrapper Modified: python/branches/release25-maint/Lib/test/test_functools.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_functools.py (original) +++ python/branches/release25-maint/Lib/test/test_functools.py Fri Oct 27 18:42:19 2006 @@ -210,6 +210,13 @@ self.assertEqual(wrapper.attr, 'This is a different test') self.assertEqual(wrapper.dict_attr, f.dict_attr) + def test_builtin_update(self): + # Test for bug #1576241 + def wrapper(): + pass + functools.update_wrapper(wrapper, max) + self.assertEqual(wrapper.__name__, 'max') + self.assert_(wrapper.__doc__.startswith('max(')) class TestWraps(TestUpdateWrapper): Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Fri Oct 27 18:42:19 2006 @@ -105,6 +105,8 @@ - Bug #1565661: in webbrowser, split() the command for the default GNOME browser in case it is a command with args. +- Bug #1576241: fix functools.wraps() to work on built-in functions. + - Fix a bug in traceback.format_exception_only() that led to an error being raised when print_exc() was called without an exception set. In version 2.4, this printed "None", restored that behavior. From buildbot at python.org Fri Oct 27 18:51:04 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 16:51:04 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20061027165105.0E3551E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/20 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 27 18:55:34 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 18:55:34 +0200 (CEST) Subject: [Python-checkins] r52478 - in python/trunk/Lib: mailbox.py test/test_mailbox.py Message-ID: <20061027165534.DF9621E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 18:55:34 2006 New Revision: 52478 Modified: python/trunk/Lib/mailbox.py python/trunk/Lib/test/test_mailbox.py Log: [Bug #1575506] The _singlefileMailbox class was using the wrong file object in its flush() method, causing an error Modified: python/trunk/Lib/mailbox.py ============================================================================== --- python/trunk/Lib/mailbox.py (original) +++ python/trunk/Lib/mailbox.py Fri Oct 27 18:55:34 2006 @@ -578,7 +578,7 @@ self._toc = new_toc self._pending = False if self._locked: - _lock_file(new_file, dotlock=False) + _lock_file(self._file, dotlock=False) def _pre_mailbox_hook(self, f): """Called before writing the mailbox to file f.""" Modified: python/trunk/Lib/test/test_mailbox.py ============================================================================== --- python/trunk/Lib/test/test_mailbox.py (original) +++ python/trunk/Lib/test/test_mailbox.py Fri Oct 27 18:55:34 2006 @@ -747,6 +747,22 @@ self._box.lock() self._box.unlock() + def test_relock(self): + # Test case for bug #1575506: the mailbox class was locking the + # wrong file object in its flush() method. + msg = "Subject: sub\n\nbody\n" + key1 = self._box.add(msg) + self._box.flush() + self._box.close() + + self._box = self._factory(self._path) + self._box.lock() + key2 = self._box.add(msg) + self._box.flush() + self.assert_(self._box._locked) + self._box.close() + + class TestMbox(_TestMboxMMDF): From python-checkins at python.org Fri Oct 27 18:57:45 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 18:57:45 +0200 (CEST) Subject: [Python-checkins] r52479 - in python/branches/release25-maint: Lib/mailbox.py Lib/test/test_mailbox.py Misc/NEWS Message-ID: <20061027165745.888E01E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 18:57:44 2006 New Revision: 52479 Modified: python/branches/release25-maint/Lib/mailbox.py python/branches/release25-maint/Lib/test/test_mailbox.py python/branches/release25-maint/Misc/NEWS Log: [Bug #1575506] The _singlefileMailbox class was using the wrong file object in its flush() method, causing an error Modified: python/branches/release25-maint/Lib/mailbox.py ============================================================================== --- python/branches/release25-maint/Lib/mailbox.py (original) +++ python/branches/release25-maint/Lib/mailbox.py Fri Oct 27 18:57:44 2006 @@ -578,7 +578,7 @@ self._toc = new_toc self._pending = False if self._locked: - _lock_file(new_file, dotlock=False) + _lock_file(self._file, dotlock=False) def _pre_mailbox_hook(self, f): """Called before writing the mailbox to file f.""" Modified: python/branches/release25-maint/Lib/test/test_mailbox.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_mailbox.py (original) +++ python/branches/release25-maint/Lib/test/test_mailbox.py Fri Oct 27 18:57:44 2006 @@ -747,6 +747,22 @@ self._box.lock() self._box.unlock() + def test_relock(self): + # Test case for bug #1575506: the mailbox class was locking the + # wrong file object in its flush() method. + msg = "Subject: sub\n\nbody\n" + key1 = self._box.add(msg) + self._box.flush() + self._box.close() + + self._box = self._factory(self._path) + self._box.lock() + key2 = self._box.add(msg) + self._box.flush() + self.assert_(self._box._locked) + self._box.close() + + class TestMbox(_TestMboxMMDF): Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Fri Oct 27 18:57:44 2006 @@ -105,6 +105,9 @@ - Bug #1565661: in webbrowser, split() the command for the default GNOME browser in case it is a command with args. +- Bug #1575506: Single-file mailboxes didn't re-lock properly in + their flush() method. + - Bug #1576241: fix functools.wraps() to work on built-in functions. - Fix a bug in traceback.format_exception_only() that led to an error From python-checkins at python.org Fri Oct 27 19:06:17 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 19:06:17 +0200 (CEST) Subject: [Python-checkins] r52480 - python/trunk/Lib/base64.py Message-ID: <20061027170617.622361E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 19:06:16 2006 New Revision: 52480 Modified: python/trunk/Lib/base64.py Log: Clarify docstring Modified: python/trunk/Lib/base64.py ============================================================================== --- python/trunk/Lib/base64.py (original) +++ python/trunk/Lib/base64.py Fri Oct 27 19:06:16 2006 @@ -308,7 +308,7 @@ def encodestring(s): - """Encode a string.""" + """Encode a string into multiple lines of base-64 data.""" pieces = [] for i in range(0, len(s), MAXBINSIZE): chunk = s[i : i + MAXBINSIZE] From python-checkins at python.org Fri Oct 27 19:11:23 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 19:11:23 +0200 (CEST) Subject: [Python-checkins] r52481 - python/trunk/Lib/urllib.py python/trunk/Lib/urllib2.py Message-ID: <20061027171123.E53E31E411D@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 19:11:23 2006 New Revision: 52481 Modified: python/trunk/Lib/urllib.py python/trunk/Lib/urllib2.py Log: [Patch #1574068 by Scott Dial] urllib and urllib2 were using base64.encodestring() for encoding authentication data. encodestring() can include newlines for very long input, which produced broken HTTP headers. Modified: python/trunk/Lib/urllib.py ============================================================================== --- python/trunk/Lib/urllib.py (original) +++ python/trunk/Lib/urllib.py Fri Oct 27 19:11:23 2006 @@ -302,13 +302,13 @@ if proxy_passwd: import base64 - proxy_auth = base64.encodestring(proxy_passwd).strip() + proxy_auth = base64.b64encode(proxy_passwd).strip() else: proxy_auth = None if user_passwd: import base64 - auth = base64.encodestring(user_passwd).strip() + auth = base64.b64encode(user_passwd).strip() else: auth = None h = httplib.HTTP(host) @@ -387,12 +387,12 @@ if not host: raise IOError, ('https error', 'no host given') if proxy_passwd: import base64 - proxy_auth = base64.encodestring(proxy_passwd).strip() + proxy_auth = base64.b64encode(proxy_passwd).strip() else: proxy_auth = None if user_passwd: import base64 - auth = base64.encodestring(user_passwd).strip() + auth = base64.b64encode(user_passwd).strip() else: auth = None h = httplib.HTTPS(host, 0, Modified: python/trunk/Lib/urllib2.py ============================================================================== --- python/trunk/Lib/urllib2.py (original) +++ python/trunk/Lib/urllib2.py Fri Oct 27 19:11:23 2006 @@ -674,7 +674,7 @@ proxy_type = orig_type if user and password: user_pass = '%s:%s' % (unquote(user), unquote(password)) - creds = base64.encodestring(user_pass).strip() + creds = base64.b64encode(user_pass).strip() req.add_header('Proxy-authorization', 'Basic ' + creds) hostport = unquote(hostport) req.set_proxy(hostport, proxy_type) @@ -798,7 +798,7 @@ user, pw = self.passwd.find_user_password(realm, host) if pw is not None: raw = "%s:%s" % (user, pw) - auth = 'Basic %s' % base64.encodestring(raw).strip() + auth = 'Basic %s' % base64.b64encode(raw).strip() if req.headers.get(self.auth_header, None) == auth: return None req.add_header(self.auth_header, auth) From python-checkins at python.org Fri Oct 27 19:13:34 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 19:13:34 +0200 (CEST) Subject: [Python-checkins] r52482 - in python/branches/release25-maint: Lib/urllib.py Lib/urllib2.py Misc/NEWS Message-ID: <20061027171334.28AD01E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 19:13:33 2006 New Revision: 52482 Modified: python/branches/release25-maint/Lib/urllib.py python/branches/release25-maint/Lib/urllib2.py python/branches/release25-maint/Misc/NEWS Log: [Patch #1574068 by Scott Dial] urllib and urllib2 were using base64.encodestring() for encoding authentication data. encodestring() can include newlines for very long input, which produced broken HTTP headers. 2.4 backport candidate, probably. Modified: python/branches/release25-maint/Lib/urllib.py ============================================================================== --- python/branches/release25-maint/Lib/urllib.py (original) +++ python/branches/release25-maint/Lib/urllib.py Fri Oct 27 19:13:33 2006 @@ -302,13 +302,13 @@ if proxy_passwd: import base64 - proxy_auth = base64.encodestring(proxy_passwd).strip() + proxy_auth = base64.b64encode(proxy_passwd).strip() else: proxy_auth = None if user_passwd: import base64 - auth = base64.encodestring(user_passwd).strip() + auth = base64.b64encode(user_passwd).strip() else: auth = None h = httplib.HTTP(host) @@ -387,12 +387,12 @@ if not host: raise IOError, ('https error', 'no host given') if proxy_passwd: import base64 - proxy_auth = base64.encodestring(proxy_passwd).strip() + proxy_auth = base64.b64encode(proxy_passwd).strip() else: proxy_auth = None if user_passwd: import base64 - auth = base64.encodestring(user_passwd).strip() + auth = base64.b64encode(user_passwd).strip() else: auth = None h = httplib.HTTPS(host, 0, Modified: python/branches/release25-maint/Lib/urllib2.py ============================================================================== --- python/branches/release25-maint/Lib/urllib2.py (original) +++ python/branches/release25-maint/Lib/urllib2.py Fri Oct 27 19:13:33 2006 @@ -674,7 +674,7 @@ proxy_type = orig_type if user and password: user_pass = '%s:%s' % (unquote(user), unquote(password)) - creds = base64.encodestring(user_pass).strip() + creds = base64.b64encode(user_pass).strip() req.add_header('Proxy-authorization', 'Basic ' + creds) hostport = unquote(hostport) req.set_proxy(hostport, proxy_type) @@ -798,7 +798,7 @@ user, pw = self.passwd.find_user_password(realm, host) if pw is not None: raw = "%s:%s" % (user, pw) - auth = 'Basic %s' % base64.encodestring(raw).strip() + auth = 'Basic %s' % base64.b64encode(raw).strip() if req.headers.get(self.auth_header, None) == auth: return None req.add_header(self.auth_header, auth) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Fri Oct 27 19:13:33 2006 @@ -110,6 +110,9 @@ - Bug #1576241: fix functools.wraps() to work on built-in functions. +- Patch #1574068: fix urllib/urllib2 to not insert line breaks when + HTTP authentication data was very long. + - Fix a bug in traceback.format_exception_only() that led to an error being raised when print_exc() was called without an exception set. In version 2.4, this printed "None", restored that behavior. From buildbot at python.org Fri Oct 27 19:32:45 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 17:32:45 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061027173245.3AAAC1E4003@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/1241 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 Fri Oct 27 20:13:47 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 20:13:47 +0200 (CEST) Subject: [Python-checkins] r52483 - python/trunk/setup.py Message-ID: <20061027181347.468F71E4004@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 20:13:46 2006 New Revision: 52483 Modified: python/trunk/setup.py Log: Check db_setup_debug for a few print statements; change sqlite_setup_debug to False Modified: python/trunk/setup.py ============================================================================== --- python/trunk/setup.py (original) +++ python/trunk/setup.py Fri Oct 27 20:13:46 2006 @@ -679,7 +679,8 @@ # save the include directory with the db.h version # (first occurrance only) db_ver_inc_map[db_ver] = d - print "db.h: found", db_ver, "in", d + if db_setup_debug: + print "db.h: found", db_ver, "in", d else: # we already found a header for this library version if db_setup_debug: print "db.h: ignoring", d @@ -719,8 +720,9 @@ if db_setup_debug: print "db lib: ", dblib, "not found" except db_found: - print "db lib: using", db_ver, dblib - if db_setup_debug: print "db: lib dir", dblib_dir, "inc dir", db_incdir + if db_setup_debug: + print "db lib: using", db_ver, dblib + print "db: lib dir", dblib_dir, "inc dir", db_incdir db_incs = [db_incdir] dblibs = [dblib] # We add the runtime_library_dirs argument because the @@ -741,7 +743,7 @@ dblib_dir = None # The sqlite interface - sqlite_setup_debug = True # verbose debug prints from this script? + sqlite_setup_debug = False # verbose debug prints from this script? # We hunt for #define SQLITE_VERSION "n.n.n" # We need to find >= sqlite version 3.0.8 @@ -773,7 +775,8 @@ for x in sqlite_version.split(".")]) if sqlite_version_tuple >= MIN_SQLITE_VERSION_NUMBER: # we win! - print "%s/sqlite3.h: version %s"%(d, sqlite_version) + if sqlite_setup_debug: + print "%s/sqlite3.h: version %s"%(d, sqlite_version) sqlite_incdir = d break else: From python-checkins at python.org Fri Oct 27 20:15:02 2006 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 27 Oct 2006 20:15:02 +0200 (CEST) Subject: [Python-checkins] r52484 - python/trunk/Makefile.pre.in Message-ID: <20061027181502.9E3101E4003@bag.python.org> Author: andrew.kuchling Date: Fri Oct 27 20:15:02 2006 New Revision: 52484 Modified: python/trunk/Makefile.pre.in Log: [Patch #1503717] Tiny patch from Chris AtLee to stop a lengthy line from being printed Modified: python/trunk/Makefile.pre.in ============================================================================== --- python/trunk/Makefile.pre.in (original) +++ python/trunk/Makefile.pre.in Fri Oct 27 20:15:02 2006 @@ -345,7 +345,7 @@ # Build the shared modules sharedmods: $(BUILDPYTHON) - case $$MAKEFLAGS in \ + @case $$MAKEFLAGS in \ *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ esac From python-checkins at python.org Fri Oct 27 20:31:37 2006 From: python-checkins at python.org (thomas.heller) Date: Fri, 27 Oct 2006 20:31:37 +0200 (CEST) Subject: [Python-checkins] r52485 - in python/trunk: Lib/test/test_exceptions.py Misc/NEWS Objects/exceptions.c Message-ID: <20061027183137.4D4B11E4012@bag.python.org> Author: thomas.heller Date: Fri Oct 27 20:31:36 2006 New Revision: 52485 Modified: python/trunk/Lib/test/test_exceptions.py python/trunk/Misc/NEWS python/trunk/Objects/exceptions.c Log: WindowsError.str should display the windows error code, not the posix error code; with test. Fixes #1576174. Will backport to release25-maint. Modified: python/trunk/Lib/test/test_exceptions.py ============================================================================== --- python/trunk/Lib/test/test_exceptions.py (original) +++ python/trunk/Lib/test/test_exceptions.py Fri Oct 27 20:31:36 2006 @@ -183,6 +183,19 @@ test_capi1() test_capi2() + def test_WindowsError(self): + try: + WindowsError + except NameError: + pass + else: + self.failUnlessEqual(str(WindowsError(1001)), + "1001") + self.failUnlessEqual(str(WindowsError(1001, "message")), + "[Error 1001] message") + self.failUnlessEqual(WindowsError(1001, "message").errno, 22) + self.failUnlessEqual(WindowsError(1001, "message").winerror, 1001) + def testAttributes(self): # test that exception attributes are happy Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Oct 27 20:31:36 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Bug #1576174: WindowsError now displays the windows error code + again, no longer the posix error code. + - Patch #1549049: Support long values in structmember, issue warnings if the assigned value for structmember fields gets truncated. Modified: python/trunk/Objects/exceptions.c ============================================================================== --- python/trunk/Objects/exceptions.c (original) +++ python/trunk/Objects/exceptions.c Fri Oct 27 20:31:36 2006 @@ -828,9 +828,9 @@ return NULL; } - if (self->myerrno) { - Py_INCREF(self->myerrno); - PyTuple_SET_ITEM(tuple, 0, self->myerrno); + if (self->winerror) { + Py_INCREF(self->winerror); + PyTuple_SET_ITEM(tuple, 0, self->winerror); } else { Py_INCREF(Py_None); @@ -852,7 +852,7 @@ Py_DECREF(fmt); Py_DECREF(tuple); } - else if (self->myerrno && self->strerror) { + else if (self->winerror && self->strerror) { PyObject *fmt; PyObject *tuple; @@ -866,9 +866,9 @@ return NULL; } - if (self->myerrno) { - Py_INCREF(self->myerrno); - PyTuple_SET_ITEM(tuple, 0, self->myerrno); + if (self->winerror) { + Py_INCREF(self->winerror); + PyTuple_SET_ITEM(tuple, 0, self->winerror); } else { Py_INCREF(Py_None); From python-checkins at python.org Fri Oct 27 20:47:33 2006 From: python-checkins at python.org (thomas.heller) Date: Fri, 27 Oct 2006 20:47:33 +0200 (CEST) Subject: [Python-checkins] r52486 - in python/branches/release25-maint: Lib/test/test_exceptions.py Misc/NEWS Objects/exceptions.c Message-ID: <20061027184733.A6D421E4003@bag.python.org> Author: thomas.heller Date: Fri Oct 27 20:47:29 2006 New Revision: 52486 Modified: python/branches/release25-maint/Lib/test/test_exceptions.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Objects/exceptions.c Log: WindowsError.str should display the windows error code, not the posix error code; with test. Fixes #1576174. Backported from trunk, revision 52485. Modified: python/branches/release25-maint/Lib/test/test_exceptions.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_exceptions.py (original) +++ python/branches/release25-maint/Lib/test/test_exceptions.py Fri Oct 27 20:47:29 2006 @@ -183,6 +183,19 @@ test_capi1() test_capi2() + def test_WindowsError(self): + try: + WindowsError + except NameError: + pass + else: + self.failUnlessEqual(str(WindowsError(1001)), + "1001") + self.failUnlessEqual(str(WindowsError(1001, "message")), + "[Error 1001] message") + self.failUnlessEqual(WindowsError(1001, "message").errno, 22) + self.failUnlessEqual(WindowsError(1001, "message").winerror, 1001) + def testAttributes(self): # test that exception attributes are happy Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Fri Oct 27 20:47:29 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Bug #1576174: WindowsError now displays the windows error code + again, no longer the posix error code. + - Patch #1549049: Support long values in structmember. - Bug #1542016: make sys.callstats() match its docstring and return an Modified: python/branches/release25-maint/Objects/exceptions.c ============================================================================== --- python/branches/release25-maint/Objects/exceptions.c (original) +++ python/branches/release25-maint/Objects/exceptions.c Fri Oct 27 20:47:29 2006 @@ -828,9 +828,9 @@ return NULL; } - if (self->myerrno) { - Py_INCREF(self->myerrno); - PyTuple_SET_ITEM(tuple, 0, self->myerrno); + if (self->winerror) { + Py_INCREF(self->winerror); + PyTuple_SET_ITEM(tuple, 0, self->winerror); } else { Py_INCREF(Py_None); @@ -852,7 +852,7 @@ Py_DECREF(fmt); Py_DECREF(tuple); } - else if (self->myerrno && self->strerror) { + else if (self->winerror && self->strerror) { PyObject *fmt; PyObject *tuple; @@ -866,9 +866,9 @@ return NULL; } - if (self->myerrno) { - Py_INCREF(self->myerrno); - PyTuple_SET_ITEM(tuple, 0, self->myerrno); + if (self->winerror) { + Py_INCREF(self->winerror); + PyTuple_SET_ITEM(tuple, 0, self->winerror); } else { Py_INCREF(Py_None); From python-checkins at python.org Fri Oct 27 21:05:54 2006 From: python-checkins at python.org (thomas.heller) Date: Fri, 27 Oct 2006 21:05:54 +0200 (CEST) Subject: [Python-checkins] r52487 - in python/trunk: Lib/modulefinder.py Lib/test/test_modulefinder.py Misc/NEWS Message-ID: <20061027190554.721C51E4003@bag.python.org> Author: thomas.heller Date: Fri Oct 27 21:05:53 2006 New Revision: 52487 Added: python/trunk/Lib/test/test_modulefinder.py - copied unchanged from r52320, python/branches/theller_modulefinder/Lib/test/test_modulefinder.py Modified: python/trunk/Lib/modulefinder.py python/trunk/Misc/NEWS Log: Modulefinder now handles absolute and relative imports, including tests. Will backport to release25-maint. Modified: python/trunk/Lib/modulefinder.py ============================================================================== --- python/trunk/Lib/modulefinder.py (original) +++ python/trunk/Lib/modulefinder.py Fri Oct 27 21:05:53 2006 @@ -1,13 +1,14 @@ """Find modules used by a script, using introspection.""" - # This module should be kept compatible with Python 2.2, see PEP 291. +from __future__ import generators import dis import imp import marshal import os import sys import new +import struct if hasattr(sys.__stdout__, "newlines"): READ_MODE = "U" # universal line endings @@ -15,11 +16,12 @@ # remain compatible with Python < 2.3 READ_MODE = "r" -LOAD_CONST = dis.opname.index('LOAD_CONST') -IMPORT_NAME = dis.opname.index('IMPORT_NAME') -STORE_NAME = dis.opname.index('STORE_NAME') -STORE_GLOBAL = dis.opname.index('STORE_GLOBAL') +LOAD_CONST = chr(dis.opname.index('LOAD_CONST')) +IMPORT_NAME = chr(dis.opname.index('IMPORT_NAME')) +STORE_NAME = chr(dis.opname.index('STORE_NAME')) +STORE_GLOBAL = chr(dis.opname.index('STORE_GLOBAL')) STORE_OPS = [STORE_NAME, STORE_GLOBAL] +HAVE_ARGUMENT = chr(dis.HAVE_ARGUMENT) # Modulefinder does a good job at simulating Python's, but it can not # handle __path__ modifications packages make at runtime. Therefore there @@ -118,9 +120,9 @@ stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) - def import_hook(self, name, caller=None, fromlist=None): - self.msg(3, "import_hook", name, caller, fromlist) - parent = self.determine_parent(caller) + def import_hook(self, name, caller=None, fromlist=None, level=-1): + self.msg(3, "import_hook", name, caller, fromlist, level) + parent = self.determine_parent(caller, level=level) q, tail = self.find_head_package(parent, name) m = self.load_tail(q, tail) if not fromlist: @@ -129,12 +131,26 @@ self.ensure_fromlist(m, fromlist) return None - def determine_parent(self, caller): - self.msgin(4, "determine_parent", caller) - if not caller: + def determine_parent(self, caller, level=-1): + self.msgin(4, "determine_parent", caller, level) + if not caller or level == 0: self.msgout(4, "determine_parent -> None") return None pname = caller.__name__ + if level >= 1: # relative import + if caller.__path__: + level -= 1 + if level == 0: + parent = self.modules[pname] + assert parent is caller + self.msgout(4, "determine_parent ->", parent) + return parent + if pname.count(".") < level: + raise ImportError, "relative importpath too deep" + pname = ".".join(pname.split(".")[:-level]) + parent = self.modules[pname] + self.msgout(4, "determine_parent ->", parent) + return parent if caller.__path__: parent = self.modules[pname] assert caller is parent @@ -294,13 +310,13 @@ self.badmodules[name] = {} self.badmodules[name][caller.__name__] = 1 - def _safe_import_hook(self, name, caller, fromlist): + def _safe_import_hook(self, name, caller, fromlist, level=-1): # wrapper for self.import_hook() that won't raise ImportError if name in self.badmodules: self._add_badmodule(name, caller) return try: - self.import_hook(name, caller) + self.import_hook(name, caller, level=level) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) self._add_badmodule(name, caller) @@ -311,38 +327,87 @@ self._add_badmodule(sub, caller) continue try: - self.import_hook(name, caller, [sub]) + self.import_hook(name, caller, [sub], level=level) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) fullname = name + "." + sub self._add_badmodule(fullname, caller) + def scan_opcodes(self, co, + unpack = struct.unpack): + # Scan the code, and yield 'interesting' opcode combinations + # Version for Python 2.4 and older + code = co.co_code + names = co.co_names + consts = co.co_consts + while code: + c = code[0] + if c in STORE_OPS: + oparg, = unpack('= HAVE_ARGUMENT: + code = code[3:] + else: + code = code[1:] + + def scan_opcodes_25(self, co, + unpack = struct.unpack): + # Scan the code, and yield 'interesting' opcode combinations + # Python 2.5 version (has absolute and relative imports) + code = co.co_code + names = co.co_names + consts = co.co_consts + LOAD_LOAD_AND_IMPORT = LOAD_CONST + LOAD_CONST + IMPORT_NAME + while code: + c = code[0] + if c in STORE_OPS: + oparg, = unpack('= HAVE_ARGUMENT: + code = code[3:] + else: + code = code[1:] + def scan_code(self, co, m): code = co.co_code - n = len(code) - i = 0 - fromlist = None - while i < n: - c = code[i] - i = i+1 - op = ord(c) - if op >= dis.HAVE_ARGUMENT: - oparg = ord(code[i]) + ord(code[i+1])*256 - i = i+2 - if op == LOAD_CONST: - # An IMPORT_NAME is always preceded by a LOAD_CONST, it's - # a tuple of "from" names, or None for a regular import. - # The tuple may contain "*" for "from import *" - fromlist = co.co_consts[oparg] - elif op == IMPORT_NAME: - assert fromlist is None or type(fromlist) is tuple - name = co.co_names[oparg] + if sys.version_info >= (2, 5): + scanner = self.scan_opcodes_25 + else: + scanner = self.scan_opcodes + for what, args in scanner(co): + if what == "store": + name, = args + m.globalnames[name] = 1 + 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 @@ -362,10 +427,17 @@ m.starimports[name] = 1 else: m.starimports[name] = 1 - elif op in STORE_OPS: - # keep track of all global names that are assigned to - name = co.co_names[oparg] - m.globalnames[name] = 1 + elif what == "relative_import": + level, fromlist, name = args + if name: + self._safe_import_hook(name, m, fromlist, level=level) + else: + parent = self.determine_parent(m, level=level) + self._safe_import_hook(parent.__name__, None, fromlist, level=0) + else: + # We don't expect anything else from the generator. + raise RuntimeError(what) + for c in co.co_consts: if isinstance(c, type(co)): self.scan_code(c, m) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Oct 27 21:05:53 2006 @@ -87,6 +87,9 @@ Library ------- +- Lib/modulefinder.py now handles absolute and relative imports + correctly. + - Patch #1567274: Support SMTP over TLS. - Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that @@ -199,6 +202,8 @@ Tests ----- +- Added some tests for modulefinder. + - Converted test_imp to use unittest. - Fix bsddb test_basics.test06_Transactions to check the version From buildbot at python.org Fri Oct 27 21:32:38 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 19:32:38 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20061027193238.3EB0E1E4005@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/1694 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Fri Oct 27 21:34:37 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 19:34:37 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20061027193437.92C351E4004@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/1609 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Fri Oct 27 21:37:53 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 19:37:53 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20061027193753.E5B621E402D@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/17 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build Had Warnings: warnings test sincerely, -The Buildbot From theller at ctypes.org Fri Oct 27 22:01:02 2006 From: theller at ctypes.org (Thomas Heller) Date: Fri, 27 Oct 2006 22:01:02 +0200 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk In-Reply-To: <20061027193238.3EB0E1E4005@bag.python.org> References: <20061027193238.3EB0E1E4005@bag.python.org> Message-ID: <4542657E.6030209@ctypes.org> buildbot at python.org schrieb: > 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/1694 > > Buildbot URL: http://www.python.org/dev/buildbot/all/ > > Build Reason: > Build Source Stamp: [branch trunk] HEAD > Blamelist: thomas.heller > > Build Had Warnings: warnings test Lib/test/test_modulefinder creates some directories and files, and removes them afterwards again. For whatever reasons, running this test on the buildbots appear to create some output that isn't expected: See http://www.python.org/dev/buildbot/trunk/x86%20gentoo%20trunk/builds/1694/step-test/0 for example: [...] test_modulefinder test test_modulefinder produced unexpected output: ********************************************************************** *** lines 2-26 of actual output doesn't appear in expected output after line 1: + creating /tmp/tmpnyhaBg/a + creating /tmp/tmpnyhaBg/a/b + creating /tmp/tmpnyhaBg/b + removing '/tmp/tmpnyhaBg' (and everything under it) + creating /tmp/tmpnyhaBg + creating /tmp/tmpnyhaBg/a + creating /tmp/tmpnyhaBg/b + removing '/tmp/tmpnyhaBg' (and everything under it) + creating /tmp/tmpnyhaBg + creating /tmp/tmpnyhaBg/a + creating /tmp/tmpnyhaBg/b + removing '/tmp/tmpnyhaBg' (and everything under it) + creating /tmp/tmpnyhaBg + creating /tmp/tmpnyhaBg/a + removing '/tmp/tmpnyhaBg' (and everything under it) + creating /tmp/tmpnyhaBg + creating /tmp/tmpnyhaBg/a + creating /tmp/tmpnyhaBg/a/b + creating /tmp/tmpnyhaBg/a/b/c + removing '/tmp/tmpnyhaBg' (and everything under it) + creating /tmp/tmpnyhaBg + creating /tmp/tmpnyhaBg/a + creating /tmp/tmpnyhaBg/a/b + creating /tmp/tmpnyhaBg/a/b/c + removing '/tmp/tmpnyhaBg' (and everything under it) ********************************************************************** test_multibytecodec_support [...] Why is this happening, and how can it be avoided? Thanks, Thomas From python-checkins at python.org Fri Oct 27 22:39:44 2006 From: python-checkins at python.org (georg.brandl) Date: Fri, 27 Oct 2006 22:39:44 +0200 (CEST) Subject: [Python-checkins] r52488 - in python/trunk: Demo/parser/unparse.py Misc/NEWS Message-ID: <20061027203944.BC3511E4003@bag.python.org> Author: georg.brandl Date: Fri Oct 27 22:39:43 2006 New Revision: 52488 Modified: python/trunk/Demo/parser/unparse.py python/trunk/Misc/NEWS Log: Patch #1552024: add decorator support to unparse.py demo script. Modified: python/trunk/Demo/parser/unparse.py ============================================================================== --- python/trunk/Demo/parser/unparse.py (original) +++ python/trunk/Demo/parser/unparse.py Fri Oct 27 22:39:43 2006 @@ -223,6 +223,9 @@ def _FunctionDef(self, t): self.write("\n") + for deco in t.decorators: + self.fill("@") + self.dispatch(deco) self.fill("def "+t.name + "(") self.dispatch(t.args) self.write(")") Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Oct 27 22:39:43 2006 @@ -156,6 +156,7 @@ - fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments were transposed. + Extension Modules ----------------- @@ -225,8 +226,10 @@ to a newly created list object and add notes that this isn't a good idea. -Tools ------ +Tools/Demos +----------- + +- Patch #1552024: add decorator support to unparse.py demo script. - Make auto-generated python.vim file list built-ins and exceptions in alphatbetical order. Makes output more deterministic and easier to tell if From python-checkins at python.org Fri Oct 27 22:39:48 2006 From: python-checkins at python.org (georg.brandl) Date: Fri, 27 Oct 2006 22:39:48 +0200 (CEST) Subject: [Python-checkins] r52489 - in python/branches/release25-maint: Demo/parser/unparse.py Misc/NEWS Message-ID: <20061027203948.918421E4003@bag.python.org> Author: georg.brandl Date: Fri Oct 27 22:39:47 2006 New Revision: 52489 Modified: python/branches/release25-maint/Demo/parser/unparse.py python/branches/release25-maint/Misc/NEWS Log: Patch #1552024: add decorator support to unparse.py demo script. (backport from rev. 52488) Modified: python/branches/release25-maint/Demo/parser/unparse.py ============================================================================== --- python/branches/release25-maint/Demo/parser/unparse.py (original) +++ python/branches/release25-maint/Demo/parser/unparse.py Fri Oct 27 22:39:47 2006 @@ -223,6 +223,9 @@ def _FunctionDef(self, t): self.write("\n") + for deco in t.decorators: + self.fill("@") + self.dispatch(deco) self.fill("def "+t.name + "(") self.dispatch(t.args) self.write(")") Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Fri Oct 27 22:39:47 2006 @@ -57,6 +57,7 @@ - fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments were transposed. + Extension Modules ----------------- @@ -83,6 +84,7 @@ - Make regex engine raise MemoryError if allocating memory fails. + Library ------- @@ -124,6 +126,12 @@ the close_fds arg to subprocess.Popen is not supported). +Tools/Demos +----------- + +- Patch #1552024: add decorator support to unparse.py demo script. + + Tests ----- From buildbot at python.org Fri Oct 27 23:13:17 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 21:13:17 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20061027211317.485961E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/24 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Fri Oct 27 23:26:24 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 21:26:24 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20061027212624.7A1F11E4003@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/1523 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sat Oct 28 00:11:17 2006 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Oct 2006 22:11:17 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20061027221117.3653E1E4004@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/181 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: thomas.heller Build Had Warnings: warnings test sincerely, -The Buildbot From anthony at interlink.com.au Sat Oct 28 01:48:44 2006 From: anthony at interlink.com.au (Anthony Baxter) Date: Sat, 28 Oct 2006 09:48:44 +1000 Subject: [Python-checkins] r52482 - in python/branches/release25-maint: Lib/urllib.py Lib/urllib2.py Misc/NEWS In-Reply-To: <20061027171334.28AD01E4003@bag.python.org> References: <20061027171334.28AD01E4003@bag.python.org> Message-ID: <200610280948.45016.anthony@interlink.com.au> On Saturday 28 October 2006 03:13, andrew.kuchling wrote: > 2.4 backport candidate, probably. FWIW, I'm not planning on doing any more "collect all the bugfixes" releases of 2.4. It's now in the same category as 2.3 - that is, only really serious bugs (in particular, security related bugs) will get a new release, and then only with the serious bugfixes applied. One active maintenance branch is quite enough to deal with, IMHO. -- Anthony Baxter It's never too late to have a happy childhood. From buildbot at python.org Sat Oct 28 05:51:33 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 03:51:33 +0000 Subject: [Python-checkins] buildbot warnings in sparc Ubuntu dapper trunk Message-ID: <20061028035133.3AE011E4005@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/758 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,thomas.heller Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sat Oct 28 12:47:13 2006 From: python-checkins at python.org (walter.doerwald) Date: Sat, 28 Oct 2006 12:47:13 +0200 (CEST) Subject: [Python-checkins] r52492 - python/trunk/Lib/test/test_bufio.py Message-ID: <20061028104713.5FB321E4004@bag.python.org> Author: walter.doerwald Date: Sat Oct 28 12:47:12 2006 New Revision: 52492 Modified: python/trunk/Lib/test/test_bufio.py Log: Port test_bufio to unittest. Modified: python/trunk/Lib/test/test_bufio.py ============================================================================== --- python/trunk/Lib/test/test_bufio.py (original) +++ python/trunk/Lib/test/test_bufio.py Sat Oct 28 12:47:12 2006 @@ -1,60 +1,66 @@ -from test.test_support import verify, TestFailed, TESTFN +import unittest +from test import test_support # Simple test to ensure that optimizations in fileobject.c deliver # the expected results. For best testing, run this under a debug-build # Python too (to exercise asserts in the C code). -# Repeat string 'pattern' as often as needed to reach total length -# 'length'. Then call try_one with that string, a string one larger -# than that, and a string one smaller than that. The main driver -# feeds this all small sizes and various powers of 2, so we exercise -# all likely stdio buffer sizes, and "off by one" errors on both -# sides. -def drive_one(pattern, length): - q, r = divmod(length, len(pattern)) - teststring = pattern * q + pattern[:r] - verify(len(teststring) == length) - try_one(teststring) - try_one(teststring + "x") - try_one(teststring[:-1]) - -# Write s + "\n" + s to file, then open it and ensure that successive -# .readline()s deliver what we wrote. -def try_one(s): - # Since C doesn't guarantee we can write/read arbitrary bytes in text - # files, use binary mode. - f = open(TESTFN, "wb") - # write once with \n and once without - f.write(s) - f.write("\n") - f.write(s) - f.close() - f = open(TESTFN, "rb") - line = f.readline() - if line != s + "\n": - raise TestFailed("Expected %r got %r" % (s + "\n", line)) - line = f.readline() - if line != s: - raise TestFailed("Expected %r got %r" % (s, line)) - line = f.readline() - if line: - raise TestFailed("Expected EOF but got %r" % line) - f.close() - -# A pattern with prime length, to avoid simple relationships with -# stdio buffer sizes. -primepat = "1234567890\00\01\02\03\04\05\06" - -nullpat = "\0" * 1000 - -try: - for size in range(1, 257) + [512, 1000, 1024, 2048, 4096, 8192, 10000, - 16384, 32768, 65536, 1000000]: - drive_one(primepat, size) - drive_one(nullpat, size) -finally: - try: - import os - os.unlink(TESTFN) - except: - pass +lengths = range(1, 257) + [512, 1000, 1024, 2048, 4096, 8192, 10000, + 16384, 32768, 65536, 1000000] + +class BufferSizeTest(unittest.TestCase): + def try_one(self, s): + # Write s + "\n" + s to file, then open it and ensure that successive + # .readline()s deliver what we wrote. + + # Since C doesn't guarantee we can write/read arbitrary bytes in text + # files, use binary mode. + f = open(test_support.TESTFN, "wb") + try: + # write once with \n and once without + f.write(s) + f.write("\n") + f.write(s) + f.close() + f = open(test_support.TESTFN, "rb") + line = f.readline() + self.assertEqual(line, s + "\n") + line = f.readline() + self.assertEqual(line, s) + line = f.readline() + self.assert_(not line) # Must be at EOF + f.close() + finally: + try: + import os + os.unlink(test_support.TESTFN) + except: + pass + + def drive_one(self, pattern): + for length in lengths: + # Repeat string 'pattern' as often as needed to reach total length + # 'length'. Then call try_one with that string, a string one larger + # than that, and a string one smaller than that. Try this with all + # small sizes and various powers of 2, so we exercise all likely + # stdio buffer sizes, and "off by one" errors on both sides. + q, r = divmod(length, len(pattern)) + teststring = pattern * q + pattern[:r] + self.assertEqual(len(teststring), length) + self.try_one(teststring) + self.try_one(teststring + "x") + self.try_one(teststring[:-1]) + + def test_primepat(self): + # A pattern with prime length, to avoid simple relationships with + # stdio buffer sizes. + self.drive_one("1234567890\00\01\02\03\04\05\06") + + def test_nullpat(self): + self.drive_one("\0" * 1000) + +def test_main(): + test_support.run_unittest(BufferSizeTest) + +if __name__ == "__main__": + test_main() From buildbot at python.org Sat Oct 28 13:31:06 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 11:31:06 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20061028113106.8CBD91E4004@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/1540 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,walter.doerwald Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sat Oct 28 13:42:44 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 11:42:44 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061028114244.63CD11E401B@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/1244 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,walter.doerwald Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sat Oct 28 13:46:36 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 11:46:36 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20061028114636.0158F1E400C@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/462 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,walter.doerwald Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sat Oct 28 15:10:21 2006 From: python-checkins at python.org (georg.brandl) Date: Sat, 28 Oct 2006 15:10:21 +0200 (CEST) Subject: [Python-checkins] r52493 - in python/trunk/Lib/test: README output/test_global output/test_grammar output/test_scope test_global.py test_grammar.py test_scope.py test_support.py Message-ID: <20061028131021.075981E4004@bag.python.org> Author: georg.brandl Date: Sat Oct 28 15:10:17 2006 New Revision: 52493 Removed: python/trunk/Lib/test/output/test_global python/trunk/Lib/test/output/test_grammar python/trunk/Lib/test/output/test_scope Modified: python/trunk/Lib/test/README python/trunk/Lib/test/test_global.py python/trunk/Lib/test/test_grammar.py python/trunk/Lib/test/test_scope.py python/trunk/Lib/test/test_support.py Log: Convert test_global, test_scope and test_grammar to unittest. I tried to enclose all tests which must be run at the toplevel (instead of inside a method) in exec statements. Modified: python/trunk/Lib/test/README ============================================================================== --- python/trunk/Lib/test/README (original) +++ python/trunk/Lib/test/README Sat Oct 28 15:10:17 2006 @@ -379,8 +379,8 @@ point numbers when you expect them to only be approximately equal withing a fuzz factor (``test_support.FUZZ``, which defaults to 1e-6). - * ``check_syntax(statement)`` - make sure that the statement is *not* - correct Python syntax. + * ``check_syntax_error(testcase, statement)`` - make sure that the + statement is *not* correct Python syntax. Python and C statement coverage results are currently available at Deleted: /python/trunk/Lib/test/output/test_global ============================================================================== --- /python/trunk/Lib/test/output/test_global Sat Oct 28 15:10:17 2006 +++ (empty file) @@ -1,5 +0,0 @@ -test_global -got SyntaxError as expected -got SyntaxError as expected -got SyntaxError as expected -as expected, no SyntaxError Deleted: /python/trunk/Lib/test/output/test_grammar ============================================================================== --- /python/trunk/Lib/test/output/test_grammar Sat Oct 28 15:10:17 2006 +++ (empty file) @@ -1,69 +0,0 @@ -test_grammar -1. Parser -1.1 Tokens -1.1.1 Backslashes -1.1.2 Numeric literals -1.1.2.1 Plain integers -1.1.2.2 Long integers -1.1.2.3 Floating point -1.1.3 String literals -1.2 Grammar -single_input -file_input -expr_input -eval_input -funcdef -lambdef -simple_stmt -expr_stmt -print_stmt -1 2 3 -1 2 3 -1 1 1 -extended print_stmt -1 2 3 -1 2 3 -1 1 1 -hello world -del_stmt -pass_stmt -flow_stmt -break_stmt -continue_stmt -continue + try/except ok -continue + try/finally ok -testing continue and break in try/except in loop -return_stmt -yield_stmt -raise_stmt -import_name -import_from -global_stmt -exec_stmt -assert_stmt -if_stmt -while_stmt -for_stmt -try_stmt -suite -test -comparison -binary mask ops -shift ops -additive ops -multiplicative ops -unary ops -selectors - -[1, (1,), (1, 2), (1, 2, 3)] -atoms -classdef -['Apple', 'Banana', 'Coco nut'] -[3, 6, 9, 12, 15] -[3, 4, 5] -[(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] -[(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] -[[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]] -[False, False, False] -[[1, 2], [3, 4], [5, 6]] -[('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), ('Macdonalds', 'Cheeseburger')] Deleted: /python/trunk/Lib/test/output/test_scope ============================================================================== --- /python/trunk/Lib/test/output/test_scope Sat Oct 28 15:10:17 2006 +++ (empty file) @@ -1,24 +0,0 @@ -test_scope -1. simple nesting -2. extra nesting -3. simple nesting + rebinding -4. nesting with global but no free -5. nesting through class -6. nesting plus free ref to global -7. nearest enclosing scope -8. mixed freevars and cellvars -9. free variable in method -10. recursion -11. unoptimized namespaces -12. lambdas -13. UnboundLocal -14. complex definitions -15. scope of global statements -16. check leaks -17. class and global -18. verify that locals() works -19. var is bound and free in class -20. interaction with trace function -20. eval and exec with free variables -21. list comprehension with local variables -22. eval with free variables Modified: python/trunk/Lib/test/test_global.py ============================================================================== --- python/trunk/Lib/test/test_global.py (original) +++ python/trunk/Lib/test/test_global.py Sat Oct 28 15:10:17 2006 @@ -1,51 +1,51 @@ """Verify that warnings are issued for global statements following use.""" -from test.test_support import check_syntax +from test.test_support import run_unittest, check_syntax_error +import unittest import warnings +warnings.filterwarnings("error", module="") -warnings.filterwarnings("error", module="") +class GlobalTests(unittest.TestCase): -def compile_and_check(text, should_fail=1): - try: - compile(text, "", "exec") - except SyntaxError, msg: - if should_fail: - print "got SyntaxError as expected" - else: - print "raised unexpected SyntaxError:", text - else: - if should_fail: - print "should have raised SyntaxError:", text - else: - print "as expected, no SyntaxError" - -prog_text_1 = """ + def test1(self): + prog_text_1 = """\ def wrong1(): a = 1 b = 2 global a global b """ -compile_and_check(prog_text_1) + check_syntax_error(self, prog_text_1) -prog_text_2 = """ + def test2(self): + prog_text_2 = """\ def wrong2(): print x global x """ -compile_and_check(prog_text_2) + check_syntax_error(self, prog_text_2) -prog_text_3 = """ + def test3(self): + prog_text_3 = """\ def wrong3(): print x x = 2 global x """ -compile_and_check(prog_text_3) + check_syntax_error(self, prog_text_3) -prog_text_4 = """ + def test4(self): + prog_text_4 = """\ global x x = 2 """ -compile_and_check(prog_text_4, 0) + # this should work + compile(prog_text_4, "", "exec") + + +def test_main(): + run_unittest(GlobalTests) + +if __name__ == "__main__": + test_main() Modified: python/trunk/Lib/test/test_grammar.py ============================================================================== --- python/trunk/Lib/test/test_grammar.py (original) +++ python/trunk/Lib/test/test_grammar.py Sat Oct 28 15:10:17 2006 @@ -8,848 +8,910 @@ # regression test, the filterwarnings() call has been added to # regrtest.py. -from test.test_support import TestFailed, verify, vereq, check_syntax +from test.test_support import run_unittest, check_syntax_error +import unittest import sys +# testing import * +from sys import * -print '1. Parser' - -print '1.1 Tokens' - -print '1.1.1 Backslashes' +class TokenTests(unittest.TestCase): -# Backslash means line continuation: -x = 1 \ -+ 1 -if x != 2: raise TestFailed, 'backslash for line continuation' - -# Backslash does not means continuation in comments :\ -x = 0 -if x != 0: raise TestFailed, 'backslash ending comment' - -print '1.1.2 Numeric literals' - -print '1.1.2.1 Plain integers' -if 0xff != 255: raise TestFailed, 'hex int' -if 0377 != 255: raise TestFailed, 'octal int' -if 2147483647 != 017777777777: raise TestFailed, 'large positive int' -try: - from sys import maxint -except ImportError: - maxint = 2147483647 -if maxint == 2147483647: - # The following test will start to fail in Python 2.4; - # change the 020000000000 to -020000000000 - if -2147483647-1 != -020000000000: raise TestFailed, 'max negative int' - # XXX -2147483648 - if 037777777777 < 0: raise TestFailed, 'large oct' - if 0xffffffff < 0: raise TestFailed, 'large hex' - for s in '2147483648', '040000000000', '0x100000000': - try: - x = eval(s) - except OverflowError: - print "OverflowError on huge integer literal " + repr(s) -elif eval('maxint == 9223372036854775807'): - if eval('-9223372036854775807-1 != -01000000000000000000000'): - raise TestFailed, 'max negative int' - if eval('01777777777777777777777') < 0: raise TestFailed, 'large oct' - if eval('0xffffffffffffffff') < 0: raise TestFailed, 'large hex' - for s in '9223372036854775808', '02000000000000000000000', \ - '0x10000000000000000': - try: - x = eval(s) - except OverflowError: - print "OverflowError on huge integer literal " + repr(s) -else: - print 'Weird maxint value', maxint - -print '1.1.2.2 Long integers' -x = 0L -x = 0l -x = 0xffffffffffffffffL -x = 0xffffffffffffffffl -x = 077777777777777777L -x = 077777777777777777l -x = 123456789012345678901234567890L -x = 123456789012345678901234567890l - -print '1.1.2.3 Floating point' -x = 3.14 -x = 314. -x = 0.314 -# XXX x = 000.314 -x = .314 -x = 3e14 -x = 3E14 -x = 3e-14 -x = 3e+14 -x = 3.e14 -x = .3e14 -x = 3.1e4 - -print '1.1.3 String literals' - -x = ''; y = ""; verify(len(x) == 0 and x == y) -x = '\''; y = "'"; verify(len(x) == 1 and x == y and ord(x) == 39) -x = '"'; y = "\""; verify(len(x) == 1 and x == y and ord(x) == 34) -x = "doesn't \"shrink\" does it" -y = 'doesn\'t "shrink" does it' -verify(len(x) == 24 and x == y) -x = "does \"shrink\" doesn't it" -y = 'does "shrink" doesn\'t it' -verify(len(x) == 24 and x == y) -x = """ + def testBackslash(self): + # Backslash means line continuation: + x = 1 \ + + 1 + self.assertEquals(x, 2, 'backslash for line continuation') + + # Backslash does not means continuation in comments :\ + x = 0 + self.assertEquals(x, 0, 'backslash ending comment') + + def testPlainIntegers(self): + self.assertEquals(0xff, 255) + self.assertEquals(0377, 255) + self.assertEquals(2147483647, 017777777777) + from sys import maxint + if maxint == 2147483647: + self.assertEquals(-2147483647-1, -020000000000) + # XXX -2147483648 + self.assert_(037777777777 > 0) + self.assert_(0xffffffff > 0) + for s in '2147483648', '040000000000', '0x100000000': + try: + x = eval(s) + except OverflowError: + self.fail("OverflowError on huge integer literal %r" % s) + elif maxint == 9223372036854775807: + self.assertEquals(-9223372036854775807-1, -01000000000000000000000) + self.assert_(01777777777777777777777 > 0) + self.assert_(0xffffffffffffffff > 0) + for s in '9223372036854775808', '02000000000000000000000', \ + '0x10000000000000000': + try: + x = eval(s) + except OverflowError: + self.fail("OverflowError on huge integer literal %r" % s) + else: + self.fail('Weird maxint value %r' % maxint) + + def testLongIntegers(self): + x = 0L + x = 0l + x = 0xffffffffffffffffL + x = 0xffffffffffffffffl + x = 077777777777777777L + x = 077777777777777777l + x = 123456789012345678901234567890L + x = 123456789012345678901234567890l + + def testFloats(self): + x = 3.14 + x = 314. + x = 0.314 + # XXX x = 000.314 + x = .314 + x = 3e14 + x = 3E14 + x = 3e-14 + x = 3e+14 + x = 3.e14 + x = .3e14 + x = 3.1e4 + + def testStringLiterals(self): + x = ''; y = ""; self.assert_(len(x) == 0 and x == y) + x = '\''; y = "'"; self.assert_(len(x) == 1 and x == y and ord(x) == 39) + x = '"'; y = "\""; self.assert_(len(x) == 1 and x == y and ord(x) == 34) + x = "doesn't \"shrink\" does it" + y = 'doesn\'t "shrink" does it' + self.assert_(len(x) == 24 and x == y) + x = "does \"shrink\" doesn't it" + y = 'does "shrink" doesn\'t it' + self.assert_(len(x) == 24 and x == y) + x = """ The "quick" brown fox jumps over the 'lazy' dog. """ -y = '\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n' -verify(x == y) -y = ''' + y = '\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n' + self.assertEquals(x, y) + y = ''' The "quick" brown fox jumps over the 'lazy' dog. -'''; verify(x == y) -y = "\n\ +''' + self.assertEquals(x, y) + y = "\n\ The \"quick\"\n\ brown fox\n\ jumps over\n\ the 'lazy' dog.\n\ -"; verify(x == y) -y = '\n\ +" + self.assertEquals(x, y) + y = '\n\ The \"quick\"\n\ brown fox\n\ jumps over\n\ the \'lazy\' dog.\n\ -'; verify(x == y) - +' + self.assertEquals(x, y) -print '1.2 Grammar' -print 'single_input' # NEWLINE | simple_stmt | compound_stmt NEWLINE -# XXX can't test in a script -- this rule is only used when interactive +class GrammarTests(unittest.TestCase): -print 'file_input' # (NEWLINE | stmt)* ENDMARKER -# Being tested as this very moment this very module - -print 'expr_input' # testlist NEWLINE -# XXX Hard to test -- used only in calls to input() - -print 'eval_input' # testlist ENDMARKER -x = eval('1, 0 or 1') - -print 'funcdef' -### 'def' NAME parameters ':' suite -### parameters: '(' [varargslist] ')' -### varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME] -### | ('**'|'*' '*') NAME) -### | fpdef ['=' test] (',' fpdef ['=' test])* [','] -### fpdef: NAME | '(' fplist ')' -### fplist: fpdef (',' fpdef)* [','] -### arglist: (argument ',')* (argument | *' test [',' '**' test] | '**' test) -### argument: [test '='] test # Really [keyword '='] test -def f1(): pass -f1() -f1(*()) -f1(*(), **{}) -def f2(one_argument): pass -def f3(two, arguments): pass -def f4(two, (compound, (argument, list))): pass -def f5((compound, first), two): pass -vereq(f2.func_code.co_varnames, ('one_argument',)) -vereq(f3.func_code.co_varnames, ('two', 'arguments')) -if sys.platform.startswith('java'): - vereq(f4.func_code.co_varnames, - ('two', '(compound, (argument, list))', 'compound', 'argument', - 'list',)) - vereq(f5.func_code.co_varnames, - ('(compound, first)', 'two', 'compound', 'first')) -else: - vereq(f4.func_code.co_varnames, - ('two', '.1', 'compound', 'argument', 'list')) - vereq(f5.func_code.co_varnames, - ('.0', 'two', 'compound', 'first')) -def a1(one_arg,): pass -def a2(two, args,): pass -def v0(*rest): pass -def v1(a, *rest): pass -def v2(a, b, *rest): pass -def v3(a, (b, c), *rest): return a, b, c, rest -# ceval unpacks the formal arguments into the first argcount names; -# thus, the names nested inside tuples must appear after these names. -if sys.platform.startswith('java'): - verify(v3.func_code.co_varnames == ('a', '(b, c)', 'rest', 'b', 'c')) -else: - vereq(v3.func_code.co_varnames, ('a', '.1', 'rest', 'b', 'c')) -verify(v3(1, (2, 3), 4) == (1, 2, 3, (4,))) -def d01(a=1): pass -d01() -d01(1) -d01(*(1,)) -d01(**{'a':2}) -def d11(a, b=1): pass -d11(1) -d11(1, 2) -d11(1, **{'b':2}) -def d21(a, b, c=1): pass -d21(1, 2) -d21(1, 2, 3) -d21(*(1, 2, 3)) -d21(1, *(2, 3)) -d21(1, 2, *(3,)) -d21(1, 2, **{'c':3}) -def d02(a=1, b=2): pass -d02() -d02(1) -d02(1, 2) -d02(*(1, 2)) -d02(1, *(2,)) -d02(1, **{'b':2}) -d02(**{'a': 1, 'b': 2}) -def d12(a, b=1, c=2): pass -d12(1) -d12(1, 2) -d12(1, 2, 3) -def d22(a, b, c=1, d=2): pass -d22(1, 2) -d22(1, 2, 3) -d22(1, 2, 3, 4) -def d01v(a=1, *rest): pass -d01v() -d01v(1) -d01v(1, 2) -d01v(*(1, 2, 3, 4)) -d01v(*(1,)) -d01v(**{'a':2}) -def d11v(a, b=1, *rest): pass -d11v(1) -d11v(1, 2) -d11v(1, 2, 3) -def d21v(a, b, c=1, *rest): pass -d21v(1, 2) -d21v(1, 2, 3) -d21v(1, 2, 3, 4) -d21v(*(1, 2, 3, 4)) -d21v(1, 2, **{'c': 3}) -def d02v(a=1, b=2, *rest): pass -d02v() -d02v(1) -d02v(1, 2) -d02v(1, 2, 3) -d02v(1, *(2, 3, 4)) -d02v(**{'a': 1, 'b': 2}) -def d12v(a, b=1, c=2, *rest): pass -d12v(1) -d12v(1, 2) -d12v(1, 2, 3) -d12v(1, 2, 3, 4) -d12v(*(1, 2, 3, 4)) -d12v(1, 2, *(3, 4, 5)) -d12v(1, *(2,), **{'c': 3}) -def d22v(a, b, c=1, d=2, *rest): pass -d22v(1, 2) -d22v(1, 2, 3) -d22v(1, 2, 3, 4) -d22v(1, 2, 3, 4, 5) -d22v(*(1, 2, 3, 4)) -d22v(1, 2, *(3, 4, 5)) -d22v(1, *(2, 3), **{'d': 4}) -def d31v((x)): pass -d31v(1) -def d32v((x,)): pass -d32v((1,)) - -### lambdef: 'lambda' [varargslist] ':' test -print 'lambdef' -l1 = lambda : 0 -verify(l1() == 0) -l2 = lambda : a[d] # XXX just testing the expression -l3 = lambda : [2 < x for x in [-1, 3, 0L]] -verify(l3() == [0, 1, 0]) -l4 = lambda x = lambda y = lambda z=1 : z : y() : x() -verify(l4() == 1) -l5 = lambda x, y, z=2: x + y + z -verify(l5(1, 2) == 5) -verify(l5(1, 2, 3) == 6) -check_syntax("lambda x: x = 2") - -### stmt: simple_stmt | compound_stmt -# Tested below - -### simple_stmt: small_stmt (';' small_stmt)* [';'] -print 'simple_stmt' -x = 1; pass; del x -def foo(): - # verify statments that end with semi-colons - x = 1; pass; del x; -foo() - -### small_stmt: expr_stmt | print_stmt | pass_stmt | del_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt -# Tested below - -print 'expr_stmt' # (exprlist '=')* exprlist -1 -1, 2, 3 -x = 1 -x = 1, 2, 3 -x = y = z = 1, 2, 3 -x, y, z = 1, 2, 3 -abc = a, b, c = x, y, z = xyz = 1, 2, (3, 4) -# NB these variables are deleted below - -check_syntax("x + 1 = 1") -check_syntax("a + 1 = b + 2") - -print 'print_stmt' # 'print' (test ',')* [test] -print 1, 2, 3 -print 1, 2, 3, -print -print 0 or 1, 0 or 1, -print 0 or 1 + # single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE + # XXX can't test in a script -- this rule is only used when interactive + + # file_input: (NEWLINE | stmt)* ENDMARKER + # Being tested as this very moment this very module + + # expr_input: testlist NEWLINE + # XXX Hard to test -- used only in calls to input() + + def testEvalInput(self): + # testlist ENDMARKER + x = eval('1, 0 or 1') + + def testFuncdef(self): + ### 'def' NAME parameters ':' suite + ### parameters: '(' [varargslist] ')' + ### varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' ('**'|'*' '*') NAME] + ### | ('**'|'*' '*') NAME) + ### | fpdef ['=' test] (',' fpdef ['=' test])* [','] + ### fpdef: NAME | '(' fplist ')' + ### fplist: fpdef (',' fpdef)* [','] + ### arglist: (argument ',')* (argument | *' test [',' '**' test] | '**' test) + ### argument: [test '='] test # Really [keyword '='] test + def f1(): pass + f1() + f1(*()) + f1(*(), **{}) + def f2(one_argument): pass + def f3(two, arguments): pass + def f4(two, (compound, (argument, list))): pass + def f5((compound, first), two): pass + self.assertEquals(f2.func_code.co_varnames, ('one_argument',)) + self.assertEquals(f3.func_code.co_varnames, ('two', 'arguments')) + if sys.platform.startswith('java'): + self.assertEquals(f4.func_code.co_varnames, + ('two', '(compound, (argument, list))', 'compound', 'argument', + 'list',)) + self.assertEquals(f5.func_code.co_varnames, + ('(compound, first)', 'two', 'compound', 'first')) + else: + self.assertEquals(f4.func_code.co_varnames, + ('two', '.1', 'compound', 'argument', 'list')) + self.assertEquals(f5.func_code.co_varnames, + ('.0', 'two', 'compound', 'first')) + def a1(one_arg,): pass + def a2(two, args,): pass + def v0(*rest): pass + def v1(a, *rest): pass + def v2(a, b, *rest): pass + def v3(a, (b, c), *rest): return a, b, c, rest + + f1() + f2(1) + f2(1,) + f3(1, 2) + f3(1, 2,) + f4(1, (2, (3, 4))) + v0() + v0(1) + v0(1,) + v0(1,2) + v0(1,2,3,4,5,6,7,8,9,0) + v1(1) + v1(1,) + v1(1,2) + v1(1,2,3) + v1(1,2,3,4,5,6,7,8,9,0) + v2(1,2) + v2(1,2,3) + v2(1,2,3,4) + v2(1,2,3,4,5,6,7,8,9,0) + v3(1,(2,3)) + v3(1,(2,3),4) + v3(1,(2,3),4,5,6,7,8,9,0) + + # ceval unpacks the formal arguments into the first argcount names; + # thus, the names nested inside tuples must appear after these names. + if sys.platform.startswith('java'): + self.assertEquals(v3.func_code.co_varnames, ('a', '(b, c)', 'rest', 'b', 'c')) + else: + self.assertEquals(v3.func_code.co_varnames, ('a', '.1', 'rest', 'b', 'c')) + self.assertEquals(v3(1, (2, 3), 4), (1, 2, 3, (4,))) + def d01(a=1): pass + d01() + d01(1) + d01(*(1,)) + d01(**{'a':2}) + def d11(a, b=1): pass + d11(1) + d11(1, 2) + d11(1, **{'b':2}) + def d21(a, b, c=1): pass + d21(1, 2) + d21(1, 2, 3) + d21(*(1, 2, 3)) + d21(1, *(2, 3)) + d21(1, 2, *(3,)) + d21(1, 2, **{'c':3}) + def d02(a=1, b=2): pass + d02() + d02(1) + d02(1, 2) + d02(*(1, 2)) + d02(1, *(2,)) + d02(1, **{'b':2}) + d02(**{'a': 1, 'b': 2}) + def d12(a, b=1, c=2): pass + d12(1) + d12(1, 2) + d12(1, 2, 3) + def d22(a, b, c=1, d=2): pass + d22(1, 2) + d22(1, 2, 3) + d22(1, 2, 3, 4) + def d01v(a=1, *rest): pass + d01v() + d01v(1) + d01v(1, 2) + d01v(*(1, 2, 3, 4)) + d01v(*(1,)) + d01v(**{'a':2}) + def d11v(a, b=1, *rest): pass + d11v(1) + d11v(1, 2) + d11v(1, 2, 3) + def d21v(a, b, c=1, *rest): pass + d21v(1, 2) + d21v(1, 2, 3) + d21v(1, 2, 3, 4) + d21v(*(1, 2, 3, 4)) + d21v(1, 2, **{'c': 3}) + def d02v(a=1, b=2, *rest): pass + d02v() + d02v(1) + d02v(1, 2) + d02v(1, 2, 3) + d02v(1, *(2, 3, 4)) + d02v(**{'a': 1, 'b': 2}) + def d12v(a, b=1, c=2, *rest): pass + d12v(1) + d12v(1, 2) + d12v(1, 2, 3) + d12v(1, 2, 3, 4) + d12v(*(1, 2, 3, 4)) + d12v(1, 2, *(3, 4, 5)) + d12v(1, *(2,), **{'c': 3}) + def d22v(a, b, c=1, d=2, *rest): pass + d22v(1, 2) + d22v(1, 2, 3) + d22v(1, 2, 3, 4) + d22v(1, 2, 3, 4, 5) + d22v(*(1, 2, 3, 4)) + d22v(1, 2, *(3, 4, 5)) + d22v(1, *(2, 3), **{'d': 4}) + def d31v((x)): pass + d31v(1) + def d32v((x,)): pass + d32v((1,)) + + def testLambdef(self): + ### lambdef: 'lambda' [varargslist] ':' test + l1 = lambda : 0 + self.assertEquals(l1(), 0) + l2 = lambda : a[d] # XXX just testing the expression + l3 = lambda : [2 < x for x in [-1, 3, 0L]] + self.assertEquals(l3(), [0, 1, 0]) + l4 = lambda x = lambda y = lambda z=1 : z : y() : x() + self.assertEquals(l4(), 1) + l5 = lambda x, y, z=2: x + y + z + self.assertEquals(l5(1, 2), 5) + self.assertEquals(l5(1, 2, 3), 6) + check_syntax_error(self, "lambda x: x = 2") + + ### stmt: simple_stmt | compound_stmt + # Tested below + + def testSimpleStmt(self): + ### simple_stmt: small_stmt (';' small_stmt)* [';'] + x = 1; pass; del x + def foo(): + # verify statments that end with semi-colons + x = 1; pass; del x; + foo() + + ### small_stmt: expr_stmt | print_stmt | pass_stmt | del_stmt | flow_stmt | import_stmt | global_stmt | access_stmt | exec_stmt + # Tested below + + def testExprStmt(self): + # (exprlist '=')* exprlist + 1 + 1, 2, 3 + x = 1 + x = 1, 2, 3 + x = y = z = 1, 2, 3 + x, y, z = 1, 2, 3 + abc = a, b, c = x, y, z = xyz = 1, 2, (3, 4) + + check_syntax_error(self, "x + 1 = 1") + check_syntax_error(self, "a + 1 = b + 2") + + def testPrintStmt(self): + # 'print' (test ',')* [test] + import StringIO + + # Can't test printing to real stdout without comparing output + # which is not available in unittest. + save_stdout = sys.stdout + sys.stdout = StringIO.StringIO() + + print 1, 2, 3 + print 1, 2, 3, + print + print 0 or 1, 0 or 1, + print 0 or 1 + + # 'print' '>>' test ',' + print >> sys.stdout, 1, 2, 3 + print >> sys.stdout, 1, 2, 3, + print >> sys.stdout + print >> sys.stdout, 0 or 1, 0 or 1, + print >> sys.stdout, 0 or 1 + + # test printing to an instance + class Gulp: + def write(self, msg): pass + + gulp = Gulp() + print >> gulp, 1, 2, 3 + print >> gulp, 1, 2, 3, + print >> gulp + print >> gulp, 0 or 1, 0 or 1, + print >> gulp, 0 or 1 + + # test print >> None + def driver(): + oldstdout = sys.stdout + sys.stdout = Gulp() + try: + tellme(Gulp()) + tellme() + finally: + sys.stdout = oldstdout + + # we should see this once + def tellme(file=sys.stdout): + print >> file, 'hello world' + + driver() + + # we should not see this at all + def tellme(file=None): + print >> file, 'goodbye universe' + + driver() + + self.assertEqual(sys.stdout.getvalue(), '''\ +1 2 3 +1 2 3 +1 1 1 +1 2 3 +1 2 3 +1 1 1 +hello world +''') + sys.stdout = save_stdout + + # syntax errors + check_syntax_error(self, 'print ,') + check_syntax_error(self, 'print >> x,') + + def testDelStmt(self): + # 'del' exprlist + abc = [1,2,3] + x, y, z = abc + xyz = x, y, z + + del abc + del x, y, (z, xyz) + + def testPassStmt(self): + # 'pass' + pass + + # flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt + # Tested below + + def testBreakStmt(self): + # 'break' + while 1: break + + def testContinueStmt(self): + # 'continue' + i = 1 + while i: i = 0; continue + + msg = "" + while not msg: + msg = "ok" + try: + continue + msg = "continue failed to continue inside try" + except: + msg = "continue inside try called except block" + if msg != "ok": + self.fail(msg) + + msg = "" + while not msg: + msg = "finally block not called" + try: + continue + finally: + msg = "ok" + if msg != "ok": + self.fail(msg) + + def test_break_continue_loop(self): + # This test warrants an explanation. It is a test specifically for SF bugs + # #463359 and #462937. The bug is that a 'break' statement executed or + # exception raised inside a try/except inside a loop, *after* a continue + # statement has been executed in that loop, will cause the wrong number of + # arguments to be popped off the stack and the instruction pointer reset to + # a very small number (usually 0.) Because of this, the following test + # *must* written as a function, and the tracking vars *must* be function + # arguments with default values. Otherwise, the test will loop and loop. + + def test_inner(extra_burning_oil = 1, count=0): + big_hippo = 2 + while big_hippo: + count += 1 + try: + if extra_burning_oil and big_hippo == 1: + extra_burning_oil -= 1 + break + big_hippo -= 1 + continue + except: + raise + if count > 2 or big_hippo <> 1: + self.fail("continue then break in try/except in loop broken!") + test_inner() + + def testReturn(self): + # 'return' [testlist] + def g1(): return + def g2(): return 1 + g1() + x = g2() + check_syntax_error(self, "class foo:return 1") + + def testYield(self): + check_syntax_error(self, "class foo:yield 1") + + def testRaise(self): + # 'raise' test [',' test] + try: raise RuntimeError, 'just testing' + except RuntimeError: pass + try: raise KeyboardInterrupt + except KeyboardInterrupt: pass + + def testImport(self): + # 'import' dotted_as_names + import sys + import time, sys + # 'from' dotted_name 'import' ('*' | '(' import_as_names ')' | import_as_names) + from time import time + from time import (time) + # not testable inside a function, but already done at top of the module + # from sys import * + from sys import path, argv + from sys import (path, argv) + from sys import (path, argv,) + + def testGlobal(self): + # 'global' NAME (',' NAME)* + global a + global a, b + global one, two, three, four, five, six, seven, eight, nine, ten + + def testExec(self): + # 'exec' expr ['in' expr [',' expr]] + z = None + del z + exec 'z=1+1\n' + if z != 2: self.fail('exec \'z=1+1\'\\n') + del z + exec 'z=1+1' + if z != 2: self.fail('exec \'z=1+1\'') + z = None + del z + import types + if hasattr(types, "UnicodeType"): + exec r"""if 1: + exec u'z=1+1\n' + if z != 2: self.fail('exec u\'z=1+1\'\\n') + del z + exec u'z=1+1' + if z != 2: self.fail('exec u\'z=1+1\'')""" + g = {} + exec 'z = 1' in g + if g.has_key('__builtins__'): del g['__builtins__'] + if g != {'z': 1}: self.fail('exec \'z = 1\' in g') + g = {} + l = {} + + import warnings + warnings.filterwarnings("ignore", "global statement", module="") + exec 'global a; a = 1; b = 2' in g, l + if g.has_key('__builtins__'): del g['__builtins__'] + if l.has_key('__builtins__'): del l['__builtins__'] + if (g, l) != ({'a':1}, {'b':2}): + self.fail('exec ... in g (%s), l (%s)' %(g,l)) + + def testAssert(self): + # assert_stmt: 'assert' test [',' test] + assert 1 + assert 1, 1 + assert lambda x:x + assert 1, lambda x:x+1 + try: + assert 0, "msg" + except AssertionError, e: + self.assertEquals(e.args[0], "msg") + else: + self.fail("AssertionError not raised by assert 0") + + ### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef + # Tested below + + def testIf(self): + # 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] + if 1: pass + if 1: pass + else: pass + if 0: pass + elif 0: pass + if 0: pass + elif 0: pass + elif 0: pass + elif 0: pass + else: pass + + def testWhile(self): + # 'while' test ':' suite ['else' ':' suite] + while 0: pass + while 0: pass + else: pass + + def testFor(self): + # 'for' exprlist 'in' exprlist ':' suite ['else' ':' suite] + for i in 1, 2, 3: pass + for i, j, k in (): pass + else: pass + class Squares: + def __init__(self, max): + self.max = max + self.sofar = [] + def __len__(self): return len(self.sofar) + def __getitem__(self, i): + if not 0 <= i < self.max: raise IndexError + n = len(self.sofar) + while n <= i: + self.sofar.append(n*n) + n = n+1 + return self.sofar[i] + n = 0 + for x in Squares(10): n = n+x + if n != 285: + self.fail('for over growing sequence') + + result = [] + for x, in [(1,), (2,), (3,)]: + result.append(x) + self.assertEqual(result, [1, 2, 3]) + + def testTry(self): + ### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] + ### | 'try' ':' suite 'finally' ':' suite + ### except_clause: 'except' [expr [',' expr]] + try: + 1/0 + except ZeroDivisionError: + pass + else: + pass + try: 1/0 + except EOFError: pass + except TypeError, msg: pass + except RuntimeError, msg: pass + except: pass + else: pass + try: 1/0 + except (EOFError, TypeError, ZeroDivisionError): pass + try: 1/0 + except (EOFError, TypeError, ZeroDivisionError), msg: pass + try: pass + finally: pass + + def testSuite(self): + # simple_stmt | NEWLINE INDENT NEWLINE* (stmt NEWLINE*)+ DEDENT + if 1: pass + if 1: + pass + if 1: + # + # + # + pass + pass + # + pass + # + + def testTest(self): + ### and_test ('or' and_test)* + ### and_test: not_test ('and' not_test)* + ### not_test: 'not' not_test | comparison + if not 1: pass + if 1 and 1: pass + if 1 or 1: pass + if not not not 1: pass + if not 1 and 1 and 1: pass + if 1 and 1 or 1 and 1 and 1 or not 1 and 1: pass + + def testComparison(self): + ### comparison: expr (comp_op expr)* + ### comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not' + if 1: pass + x = (1 == 1) + if 1 == 1: pass + if 1 != 1: pass + if 1 <> 1: pass + if 1 < 1: pass + if 1 > 1: pass + if 1 <= 1: pass + if 1 >= 1: pass + if 1 is 1: pass + if 1 is not 1: pass + if 1 in (): pass + if 1 not in (): pass + if 1 < 1 > 1 == 1 >= 1 <= 1 <> 1 != 1 in 1 not in 1 is 1 is not 1: pass + + def testBinaryMaskOps(self): + x = 1 & 1 + x = 1 ^ 1 + x = 1 | 1 + + def testShiftOps(self): + x = 1 << 1 + x = 1 >> 1 + x = 1 << 1 >> 1 + + def testAdditiveOps(self): + x = 1 + x = 1 + 1 + x = 1 - 1 - 1 + x = 1 - 1 + 1 - 1 + 1 + + def testMultiplicativeOps(self): + x = 1 * 1 + x = 1 / 1 + x = 1 % 1 + x = 1 / 1 * 1 % 1 + + def testUnaryOps(self): + x = +1 + x = -1 + x = ~1 + x = ~1 ^ 1 & 1 | 1 & 1 ^ -1 + x = -1*1/1 + 1*1 - ---1*1 + + def testSelectors(self): + ### trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME + ### subscript: expr | [expr] ':' [expr] + + import sys, time + c = sys.path[0] + x = time.time() + x = sys.modules['time'].time() + a = '01234' + c = a[0] + c = a[-1] + s = a[0:5] + s = a[:5] + s = a[0:] + s = a[:] + s = a[-5:] + s = a[:-1] + s = a[-4:-3] + # A rough test of SF bug 1333982. http://python.org/sf/1333982 + # The testing here is fairly incomplete. + # Test cases should include: commas with 1 and 2 colons + d = {} + d[1] = 1 + d[1,] = 2 + d[1,2] = 3 + d[1,2,3] = 4 + L = list(d) + L.sort() + self.assertEquals(str(L), '[1, (1,), (1, 2), (1, 2, 3)]') + + def testAtoms(self): + ### atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING + ### dictmaker: test ':' test (',' test ':' test)* [','] + + x = (1) + x = (1 or 2 or 3) + x = (1 or 2 or 3, 2, 3) + + x = [] + x = [1] + x = [1 or 2 or 3] + x = [1 or 2 or 3, 2, 3] + x = [] + + x = {} + x = {'one': 1} + x = {'one': 1,} + x = {'one' or 'two': 1 or 2} + x = {'one': 1, 'two': 2} + x = {'one': 1, 'two': 2,} + x = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6} + + x = `x` + x = `1 or 2 or 3` + x = x + x = 'x' + x = 123 + + ### exprlist: expr (',' expr)* [','] + ### testlist: test (',' test)* [','] + # These have been exercised enough above + + def testClassdef(self): + # 'class' NAME ['(' [testlist] ')'] ':' suite + class B: pass + class B2(): pass + class C1(B): pass + class C2(B): pass + class D(C1, C2, B): pass + class C: + def meth1(self): pass + def meth2(self, arg): pass + def meth3(self, a1, a2): pass + + def testListcomps(self): + # list comprehension tests + nums = [1, 2, 3, 4, 5] + strs = ["Apple", "Banana", "Coconut"] + spcs = [" Apple", " Banana ", "Coco nut "] + + self.assertEqual([s.strip() for s in spcs], ['Apple', 'Banana', 'Coco nut']) + self.assertEqual([3 * x for x in nums], [3, 6, 9, 12, 15]) + self.assertEqual([x for x in nums if x > 2], [3, 4, 5]) + self.assertEqual([(i, s) for i in nums for s in strs], + [(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), + (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), + (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), + (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), + (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')]) + self.assertEqual([(i, s) for i in nums for s in [f for f in strs if "n" in f]], + [(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), + (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), + (5, 'Banana'), (5, 'Coconut')]) + self.assertEqual([(lambda a:[a**i for i in range(a+1)])(j) for j in range(5)], + [[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]]) + + def test_in_func(l): + return [None < x < 3 for x in l if x > 2] + + self.assertEqual(test_in_func(nums), [False, False, False]) + + def test_nested_front(): + self.assertEqual([[y for y in [x, x + 1]] for x in [1,3,5]], + [[1, 2], [3, 4], [5, 6]]) + + test_nested_front() + + check_syntax_error(self, "[i, s for i in nums for s in strs]") + check_syntax_error(self, "[x if y]") + + suppliers = [ + (1, "Boeing"), + (2, "Ford"), + (3, "Macdonalds") + ] + + parts = [ + (10, "Airliner"), + (20, "Engine"), + (30, "Cheeseburger") + ] + + suppart = [ + (1, 10), (1, 20), (2, 20), (3, 30) + ] + + x = [ + (sname, pname) + for (sno, sname) in suppliers + for (pno, pname) in parts + for (sp_sno, sp_pno) in suppart + if sno == sp_sno and pno == sp_pno + ] + + self.assertEqual(x, [('Boeing', 'Airliner'), ('Boeing', 'Engine'), ('Ford', 'Engine'), + ('Macdonalds', 'Cheeseburger')]) + + def testGenexps(self): + # generator expression tests + g = ([x for x in range(10)] for x in range(1)) + self.assertEqual(g.next(), [x for x in range(10)]) + try: + g.next() + self.fail('should produce StopIteration exception') + except StopIteration: + pass -print 'extended print_stmt' # 'print' '>>' test ',' -import sys -print >> sys.stdout, 1, 2, 3 -print >> sys.stdout, 1, 2, 3, -print >> sys.stdout -print >> sys.stdout, 0 or 1, 0 or 1, -print >> sys.stdout, 0 or 1 - -# test printing to an instance -class Gulp: - def write(self, msg): pass - -gulp = Gulp() -print >> gulp, 1, 2, 3 -print >> gulp, 1, 2, 3, -print >> gulp -print >> gulp, 0 or 1, 0 or 1, -print >> gulp, 0 or 1 - -# test print >> None -def driver(): - oldstdout = sys.stdout - sys.stdout = Gulp() - try: - tellme(Gulp()) - tellme() - finally: - sys.stdout = oldstdout - -# we should see this once -def tellme(file=sys.stdout): - print >> file, 'hello world' - -driver() - -# we should not see this at all -def tellme(file=None): - print >> file, 'goodbye universe' - -driver() - -# syntax errors -check_syntax('print ,') -check_syntax('print >> x,') - -print 'del_stmt' # 'del' exprlist -del abc -del x, y, (z, xyz) - -print 'pass_stmt' # 'pass' -pass - -print 'flow_stmt' # break_stmt | continue_stmt | return_stmt | raise_stmt -# Tested below - -print 'break_stmt' # 'break' -while 1: break - -print 'continue_stmt' # 'continue' -i = 1 -while i: i = 0; continue - -msg = "" -while not msg: - msg = "continue + try/except ok" - try: - continue - msg = "continue failed to continue inside try" - except: - msg = "continue inside try called except block" -print msg - -msg = "" -while not msg: - msg = "finally block not called" - try: - continue - finally: - msg = "continue + try/finally ok" -print msg - - -# This test warrants an explanation. It is a test specifically for SF bugs -# #463359 and #462937. The bug is that a 'break' statement executed or -# exception raised inside a try/except inside a loop, *after* a continue -# statement has been executed in that loop, will cause the wrong number of -# arguments to be popped off the stack and the instruction pointer reset to -# a very small number (usually 0.) Because of this, the following test -# *must* written as a function, and the tracking vars *must* be function -# arguments with default values. Otherwise, the test will loop and loop. - -print "testing continue and break in try/except in loop" -def test_break_continue_loop(extra_burning_oil = 1, count=0): - big_hippo = 2 - while big_hippo: - count += 1 + a = 1 try: - if extra_burning_oil and big_hippo == 1: - extra_burning_oil -= 1 - break - big_hippo -= 1 - continue - except: - raise - if count > 2 or big_hippo <> 1: - print "continue then break in try/except in loop broken!" -test_break_continue_loop() - -print 'return_stmt' # 'return' [testlist] -def g1(): return -def g2(): return 1 -g1() -x = g2() -check_syntax("class foo:return 1") - -print 'yield_stmt' -check_syntax("class foo:yield 1") - -print 'raise_stmt' # 'raise' test [',' test] -try: raise RuntimeError, 'just testing' -except RuntimeError: pass -try: raise KeyboardInterrupt -except KeyboardInterrupt: pass + g = (a for d in a) + g.next() + self.fail('should produce TypeError') + except TypeError: + pass + + self.assertEqual(list((x, y) for x in 'abcd' for y in 'abcd'), [(x, y) for x in 'abcd' for y in 'abcd']) + self.assertEqual(list((x, y) for x in 'ab' for y in 'xy'), [(x, y) for x in 'ab' for y in 'xy']) + + a = [x for x in range(10)] + b = (x for x in (y for y in a)) + self.assertEqual(sum(b), sum([x for x in range(10)])) + + self.assertEqual(sum(x**2 for x in range(10)), sum([x**2 for x in range(10)])) + self.assertEqual(sum(x*x for x in range(10) if x%2), sum([x*x for x in range(10) if x%2])) + self.assertEqual(sum(x for x in (y for y in range(10))), sum([x for x in range(10)])) + self.assertEqual(sum(x for x in (y for y in (z for z in range(10)))), sum([x for x in range(10)])) + self.assertEqual(sum(x for x in [y for y in (z for z in range(10))]), sum([x for x in range(10)])) + self.assertEqual(sum(x for x in (y for y in (z for z in range(10) if True)) if True), sum([x for x in range(10)])) + self.assertEqual(sum(x for x in (y for y in (z for z in range(10) if True) if False) if True), 0) + check_syntax_error(self, "foo(x for x in range(10), 100)") + check_syntax_error(self, "foo(100, x for x in range(10))") + + def testComprehensionSpecials(self): + # test for outmost iterable precomputation + x = 10; g = (i for i in range(x)); x = 5 + self.assertEqual(len(list(g)), 10) + + # This should hold, since we're only precomputing outmost iterable. + x = 10; t = False; g = ((i,j) for i in range(x) if t for j in range(x)) + x = 5; t = True; + self.assertEqual([(i,j) for i in range(10) for j in range(5)], list(g)) + + # Grammar allows multiple adjacent 'if's in listcomps and genexps, + # even though it's silly. Make sure it works (ifelse broke this.) + self.assertEqual([ x for x in range(10) if x % 2 if x % 3 ], [1, 5, 7]) + self.assertEqual(list(x for x in range(10) if x % 2 if x % 3), [1, 5, 7]) + + # verify unpacking single element tuples in listcomp/genexp. + self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) + self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) + + def testIfElseExpr(self): + # Test ifelse expressions in various cases + def _checkeval(msg, ret): + "helper to check that evaluation of expressions is done correctly" + print x + return ret + + self.assertEqual([ x() for x in lambda: True, lambda: False if x() ], [True]) + self.assertEqual([ x() for x in (lambda: True, lambda: False) if x() ], [True]) + self.assertEqual([ x(False) for x in (lambda x: False if x else True, lambda x: True if x else False) if x(False) ], [True]) + self.assertEqual((5 if 1 else _checkeval("check 1", 0)), 5) + self.assertEqual((_checkeval("check 2", 0) if 0 else 5), 5) + self.assertEqual((5 and 6 if 0 else 1), 1) + self.assertEqual(((5 and 6) if 0 else 1), 1) + self.assertEqual((5 and (6 if 1 else 1)), 6) + self.assertEqual((0 or _checkeval("check 3", 2) if 0 else 3), 3) + self.assertEqual((1 or _checkeval("check 4", 2) if 1 else _checkeval("check 5", 3)), 1) + self.assertEqual((0 or 5 if 1 else _checkeval("check 6", 3)), 5) + self.assertEqual((not 5 if 1 else 1), False) + self.assertEqual((not 5 if 0 else 1), 1) + self.assertEqual((6 + 1 if 1 else 2), 7) + self.assertEqual((6 - 1 if 1 else 2), 5) + self.assertEqual((6 * 2 if 1 else 4), 12) + self.assertEqual((6 / 2 if 1 else 3), 3) + self.assertEqual((6 < 4 if 0 else 2), 2) -print 'import_name' # 'import' dotted_as_names -import sys -import time, sys -print 'import_from' # 'from' dotted_name 'import' ('*' | '(' import_as_names ')' | import_as_names) -from time import time -from time import (time) -from sys import * -from sys import path, argv -from sys import (path, argv) -from sys import (path, argv,) - -print 'global_stmt' # 'global' NAME (',' NAME)* -def f(): - global a - global a, b - global one, two, three, four, five, six, seven, eight, nine, ten - -print 'exec_stmt' # 'exec' expr ['in' expr [',' expr]] -def f(): - z = None - del z - exec 'z=1+1\n' - if z != 2: raise TestFailed, 'exec \'z=1+1\'\\n' - del z - exec 'z=1+1' - if z != 2: raise TestFailed, 'exec \'z=1+1\'' - z = None - del z - import types - if hasattr(types, "UnicodeType"): - exec r"""if 1: - exec u'z=1+1\n' - if z != 2: raise TestFailed, 'exec u\'z=1+1\'\\n' - del z - exec u'z=1+1' - if z != 2: raise TestFailed, 'exec u\'z=1+1\'' -""" -f() -g = {} -exec 'z = 1' in g -if g.has_key('__builtins__'): del g['__builtins__'] -if g != {'z': 1}: raise TestFailed, 'exec \'z = 1\' in g' -g = {} -l = {} - -import warnings -warnings.filterwarnings("ignore", "global statement", module="") -exec 'global a; a = 1; b = 2' in g, l -if g.has_key('__builtins__'): del g['__builtins__'] -if l.has_key('__builtins__'): del l['__builtins__'] -if (g, l) != ({'a':1}, {'b':2}): raise TestFailed, 'exec ... in g (%s), l (%s)' %(g,l) - - -print "assert_stmt" # assert_stmt: 'assert' test [',' test] -assert 1 -assert 1, 1 -assert lambda x:x -assert 1, lambda x:x+1 - -### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef -# Tested below - -print 'if_stmt' # 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] -if 1: pass -if 1: pass -else: pass -if 0: pass -elif 0: pass -if 0: pass -elif 0: pass -elif 0: pass -elif 0: pass -else: pass - -print 'while_stmt' # 'while' test ':' suite ['else' ':' suite] -while 0: pass -while 0: pass -else: pass - -print 'for_stmt' # 'for' exprlist 'in' exprlist ':' suite ['else' ':' suite] -for i in 1, 2, 3: pass -for i, j, k in (): pass -else: pass -class Squares: - def __init__(self, max): - self.max = max - self.sofar = [] - def __len__(self): return len(self.sofar) - def __getitem__(self, i): - if not 0 <= i < self.max: raise IndexError - n = len(self.sofar) - while n <= i: - self.sofar.append(n*n) - n = n+1 - return self.sofar[i] -n = 0 -for x in Squares(10): n = n+x -if n != 285: raise TestFailed, 'for over growing sequence' - -result = [] -for x, in [(1,), (2,), (3,)]: - result.append(x) -vereq(result, [1, 2, 3]) - -print 'try_stmt' -### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] -### | 'try' ':' suite 'finally' ':' suite -### except_clause: 'except' [expr [',' expr]] -try: - 1/0 -except ZeroDivisionError: - pass -else: - pass -try: 1/0 -except EOFError: pass -except TypeError, msg: pass -except RuntimeError, msg: pass -except: pass -else: pass -try: 1/0 -except (EOFError, TypeError, ZeroDivisionError): pass -try: 1/0 -except (EOFError, TypeError, ZeroDivisionError), msg: pass -try: pass -finally: pass - -print 'suite' # simple_stmt | NEWLINE INDENT NEWLINE* (stmt NEWLINE*)+ DEDENT -if 1: pass -if 1: - pass -if 1: - # - # - # - pass - pass - # - pass - # - -print 'test' -### and_test ('or' and_test)* -### and_test: not_test ('and' not_test)* -### not_test: 'not' not_test | comparison -if not 1: pass -if 1 and 1: pass -if 1 or 1: pass -if not not not 1: pass -if not 1 and 1 and 1: pass -if 1 and 1 or 1 and 1 and 1 or not 1 and 1: pass - -print 'comparison' -### comparison: expr (comp_op expr)* -### comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not' -if 1: pass -x = (1 == 1) -if 1 == 1: pass -if 1 != 1: pass -if 1 <> 1: pass -if 1 < 1: pass -if 1 > 1: pass -if 1 <= 1: pass -if 1 >= 1: pass -if 1 is 1: pass -if 1 is not 1: pass -if 1 in (): pass -if 1 not in (): pass -if 1 < 1 > 1 == 1 >= 1 <= 1 <> 1 != 1 in 1 not in 1 is 1 is not 1: pass - -print 'binary mask ops' -x = 1 & 1 -x = 1 ^ 1 -x = 1 | 1 - -print 'shift ops' -x = 1 << 1 -x = 1 >> 1 -x = 1 << 1 >> 1 - -print 'additive ops' -x = 1 -x = 1 + 1 -x = 1 - 1 - 1 -x = 1 - 1 + 1 - 1 + 1 - -print 'multiplicative ops' -x = 1 * 1 -x = 1 / 1 -x = 1 % 1 -x = 1 / 1 * 1 % 1 - -print 'unary ops' -x = +1 -x = -1 -x = ~1 -x = ~1 ^ 1 & 1 | 1 & 1 ^ -1 -x = -1*1/1 + 1*1 - ---1*1 - -print 'selectors' -### trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME -### subscript: expr | [expr] ':' [expr] -f1() -f2(1) -f2(1,) -f3(1, 2) -f3(1, 2,) -f4(1, (2, (3, 4))) -v0() -v0(1) -v0(1,) -v0(1,2) -v0(1,2,3,4,5,6,7,8,9,0) -v1(1) -v1(1,) -v1(1,2) -v1(1,2,3) -v1(1,2,3,4,5,6,7,8,9,0) -v2(1,2) -v2(1,2,3) -v2(1,2,3,4) -v2(1,2,3,4,5,6,7,8,9,0) -v3(1,(2,3)) -v3(1,(2,3),4) -v3(1,(2,3),4,5,6,7,8,9,0) -print -import sys, time -c = sys.path[0] -x = time.time() -x = sys.modules['time'].time() -a = '01234' -c = a[0] -c = a[-1] -s = a[0:5] -s = a[:5] -s = a[0:] -s = a[:] -s = a[-5:] -s = a[:-1] -s = a[-4:-3] -# A rough test of SF bug 1333982. http://python.org/sf/1333982 -# The testing here is fairly incomplete. -# Test cases should include: commas with 1 and 2 colons -d = {} -d[1] = 1 -d[1,] = 2 -d[1,2] = 3 -d[1,2,3] = 4 -L = list(d) -L.sort() -print L - - -print 'atoms' -### atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING -### dictmaker: test ':' test (',' test ':' test)* [','] - -x = (1) -x = (1 or 2 or 3) -x = (1 or 2 or 3, 2, 3) - -x = [] -x = [1] -x = [1 or 2 or 3] -x = [1 or 2 or 3, 2, 3] -x = [] - -x = {} -x = {'one': 1} -x = {'one': 1,} -x = {'one' or 'two': 1 or 2} -x = {'one': 1, 'two': 2} -x = {'one': 1, 'two': 2,} -x = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5, 'six': 6} - -x = `x` -x = `1 or 2 or 3` -x = x -x = 'x' -x = 123 - -### exprlist: expr (',' expr)* [','] -### testlist: test (',' test)* [','] -# These have been exercised enough above - -print 'classdef' # 'class' NAME ['(' [testlist] ')'] ':' suite -class B: pass -class B2(): pass -class C1(B): pass -class C2(B): pass -class D(C1, C2, B): pass -class C: - def meth1(self): pass - def meth2(self, arg): pass - def meth3(self, a1, a2): pass - -# list comprehension tests -nums = [1, 2, 3, 4, 5] -strs = ["Apple", "Banana", "Coconut"] -spcs = [" Apple", " Banana ", "Coco nut "] - -print [s.strip() for s in spcs] -print [3 * x for x in nums] -print [x for x in nums if x > 2] -print [(i, s) for i in nums for s in strs] -print [(i, s) for i in nums for s in [f for f in strs if "n" in f]] -print [(lambda a:[a**i for i in range(a+1)])(j) for j in range(5)] - -def test_in_func(l): - return [None < x < 3 for x in l if x > 2] - -print test_in_func(nums) - -def test_nested_front(): - print [[y for y in [x, x + 1]] for x in [1,3,5]] - -test_nested_front() - -check_syntax("[i, s for i in nums for s in strs]") -check_syntax("[x if y]") - -suppliers = [ - (1, "Boeing"), - (2, "Ford"), - (3, "Macdonalds") -] - -parts = [ - (10, "Airliner"), - (20, "Engine"), - (30, "Cheeseburger") -] - -suppart = [ - (1, 10), (1, 20), (2, 20), (3, 30) -] - -print [ - (sname, pname) - for (sno, sname) in suppliers - for (pno, pname) in parts - for (sp_sno, sp_pno) in suppart - if sno == sp_sno and pno == sp_pno -] - -# generator expression tests -g = ([x for x in range(10)] for x in range(1)) -verify(g.next() == [x for x in range(10)]) -try: - g.next() - raise TestFailed, 'should produce StopIteration exception' -except StopIteration: - pass - -a = 1 -try: - g = (a for d in a) - g.next() - raise TestFailed, 'should produce TypeError' -except TypeError: - pass - -verify(list((x, y) for x in 'abcd' for y in 'abcd') == [(x, y) for x in 'abcd' for y in 'abcd']) -verify(list((x, y) for x in 'ab' for y in 'xy') == [(x, y) for x in 'ab' for y in 'xy']) - -a = [x for x in range(10)] -b = (x for x in (y for y in a)) -verify(sum(b) == sum([x for x in range(10)])) - -verify(sum(x**2 for x in range(10)) == sum([x**2 for x in range(10)])) -verify(sum(x*x for x in range(10) if x%2) == sum([x*x for x in range(10) if x%2])) -verify(sum(x for x in (y for y in range(10))) == sum([x for x in range(10)])) -verify(sum(x for x in (y for y in (z for z in range(10)))) == sum([x for x in range(10)])) -verify(sum(x for x in [y for y in (z for z in range(10))]) == sum([x for x in range(10)])) -verify(sum(x for x in (y for y in (z for z in range(10) if True)) if True) == sum([x for x in range(10)])) -verify(sum(x for x in (y for y in (z for z in range(10) if True) if False) if True) == 0) -check_syntax("foo(x for x in range(10), 100)") -check_syntax("foo(100, x for x in range(10))") - -# test for outmost iterable precomputation -x = 10; g = (i for i in range(x)); x = 5 -verify(len(list(g)) == 10) - -# This should hold, since we're only precomputing outmost iterable. -x = 10; t = False; g = ((i,j) for i in range(x) if t for j in range(x)) -x = 5; t = True; -verify([(i,j) for i in range(10) for j in range(5)] == list(g)) - -# Grammar allows multiple adjacent 'if's in listcomps and genexps, -# even though it's silly. Make sure it works (ifelse broke this.) -verify([ x for x in range(10) if x % 2 if x % 3 ], [1, 5, 7]) -verify((x for x in range(10) if x % 2 if x % 3), [1, 5, 7]) - -# Verify unpacking single element tuples in listcomp/genexp. -vereq([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) -vereq(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) - -# Test ifelse expressions in various cases -def _checkeval(msg, ret): - "helper to check that evaluation of expressions is done correctly" - print x - return ret - -verify([ x() for x in lambda: True, lambda: False if x() ] == [True]) -verify([ x() for x in (lambda: True, lambda: False) if x() ] == [True]) -verify([ x(False) for x in (lambda x: False if x else True, lambda x: True if x else False) if x(False) ] == [True]) -verify((5 if 1 else _checkeval("check 1", 0)) == 5) -verify((_checkeval("check 2", 0) if 0 else 5) == 5) -verify((5 and 6 if 0 else 1) == 1) -verify(((5 and 6) if 0 else 1) == 1) -verify((5 and (6 if 1 else 1)) == 6) -verify((0 or _checkeval("check 3", 2) if 0 else 3) == 3) -verify((1 or _checkeval("check 4", 2) if 1 else _checkeval("check 5", 3)) == 1) -verify((0 or 5 if 1 else _checkeval("check 6", 3)) == 5) -verify((not 5 if 1 else 1) == False) -verify((not 5 if 0 else 1) == 1) -verify((6 + 1 if 1 else 2) == 7) -verify((6 - 1 if 1 else 2) == 5) -verify((6 * 2 if 1 else 4) == 12) -verify((6 / 2 if 1 else 3) == 3) -verify((6 < 4 if 0 else 2) == 2) + +def test_main(): + run_unittest(TokenTests, GrammarTests) + +if __name__ == '__main__': + test_main() Modified: python/trunk/Lib/test/test_scope.py ============================================================================== --- python/trunk/Lib/test/test_scope.py (original) +++ python/trunk/Lib/test/test_scope.py Sat Oct 28 15:10:17 2006 @@ -1,186 +1,190 @@ -from test.test_support import verify, TestFailed, check_syntax, vereq +import unittest +from test.test_support import check_syntax_error, run_unittest import warnings +warnings.filterwarnings("ignore", r"import \*", SyntaxWarning, "") warnings.filterwarnings("ignore", r"import \*", SyntaxWarning, "") -print "1. simple nesting" +class ScopeTests(unittest.TestCase): -def make_adder(x): - def adder(y): - return x + y - return adder + def testSimpleNesting(self): + + def make_adder(x): + def adder(y): + return x + y + return adder -inc = make_adder(1) -plus10 = make_adder(10) + inc = make_adder(1) + plus10 = make_adder(10) -vereq(inc(1), 2) -vereq(plus10(-2), 8) + self.assertEqual(inc(1), 2) + self.assertEqual(plus10(-2), 8) -print "2. extra nesting" + def testExtraNesting(self): -def make_adder2(x): - def extra(): # check freevars passing through non-use scopes - def adder(y): - return x + y - return adder - return extra() + def make_adder2(x): + def extra(): # check freevars passing through non-use scopes + def adder(y): + return x + y + return adder + return extra() -inc = make_adder2(1) -plus10 = make_adder2(10) + inc = make_adder2(1) + plus10 = make_adder2(10) -vereq(inc(1), 2) -vereq(plus10(-2), 8) + self.assertEqual(inc(1), 2) + self.assertEqual(plus10(-2), 8) -print "3. simple nesting + rebinding" + def testSimpleAndRebinding(self): -def make_adder3(x): - def adder(y): - return x + y - x = x + 1 # check tracking of assignment to x in defining scope - return adder + def make_adder3(x): + def adder(y): + return x + y + x = x + 1 # check tracking of assignment to x in defining scope + return adder -inc = make_adder3(0) -plus10 = make_adder3(9) + inc = make_adder3(0) + plus10 = make_adder3(9) -vereq(inc(1), 2) -vereq(plus10(-2), 8) + self.assertEqual(inc(1), 2) + self.assertEqual(plus10(-2), 8) -print "4. nesting with global but no free" + def testNestingGlobalNoFree(self): -def make_adder4(): # XXX add exta level of indirection - def nest(): - def nest(): - def adder(y): - return global_x + y # check that plain old globals work - return adder - return nest() - return nest() + def make_adder4(): # XXX add exta level of indirection + def nest(): + def nest(): + def adder(y): + return global_x + y # check that plain old globals work + return adder + return nest() + return nest() -global_x = 1 -adder = make_adder4() -vereq(adder(1), 2) + global_x = 1 + adder = make_adder4() + self.assertEqual(adder(1), 2) -global_x = 10 -vereq(adder(-2), 8) + global_x = 10 + self.assertEqual(adder(-2), 8) -print "5. nesting through class" + def testNestingThroughClass(self): -def make_adder5(x): - class Adder: - def __call__(self, y): - return x + y - return Adder() + def make_adder5(x): + class Adder: + def __call__(self, y): + return x + y + return Adder() -inc = make_adder5(1) -plus10 = make_adder5(10) + inc = make_adder5(1) + plus10 = make_adder5(10) -vereq(inc(1), 2) -vereq(plus10(-2), 8) + self.assertEqual(inc(1), 2) + self.assertEqual(plus10(-2), 8) -print "6. nesting plus free ref to global" + def testNestingPlusFreeRefToGlobal(self): -def make_adder6(x): - global global_nest_x - def adder(y): - return global_nest_x + y - global_nest_x = x - return adder + def make_adder6(x): + global global_nest_x + def adder(y): + return global_nest_x + y + global_nest_x = x + return adder -inc = make_adder6(1) -plus10 = make_adder6(10) + inc = make_adder6(1) + plus10 = make_adder6(10) -vereq(inc(1), 11) # there's only one global -vereq(plus10(-2), 8) + self.assertEqual(inc(1), 11) # there's only one global + self.assertEqual(plus10(-2), 8) -print "7. nearest enclosing scope" + def testNearestEnclosingScope(self): -def f(x): - def g(y): - x = 42 # check that this masks binding in f() - def h(z): - return x + z - return h - return g(2) - -test_func = f(10) -vereq(test_func(5), 47) - -print "8. mixed freevars and cellvars" - -def identity(x): - return x - -def f(x, y, z): - def g(a, b, c): - a = a + x # 3 - def h(): - # z * (4 + 9) - # 3 * 13 - return identity(z * (b + y)) - y = c + z # 9 - return h - return g - -g = f(1, 2, 3) -h = g(2, 4, 6) -vereq(h(), 39) - -print "9. free variable in method" - -def test(): - method_and_var = "var" - class Test: - def method_and_var(self): - return "method" - def test(self): - return method_and_var - def actual_global(self): - return str("global") - def str(self): - return str(self) - return Test() - -t = test() -vereq(t.test(), "var") -vereq(t.method_and_var(), "method") -vereq(t.actual_global(), "global") - -method_and_var = "var" -class Test: - # this class is not nested, so the rules are different - def method_and_var(self): - return "method" - def test(self): - return method_and_var - def actual_global(self): - return str("global") - def str(self): - return str(self) - -t = Test() -vereq(t.test(), "var") -vereq(t.method_and_var(), "method") -vereq(t.actual_global(), "global") + def f(x): + def g(y): + x = 42 # check that this masks binding in f() + def h(z): + return x + z + return h + return g(2) -print "10. recursion" + test_func = f(10) + self.assertEqual(test_func(5), 47) -def f(x): - def fact(n): - if n == 0: - return 1 - else: - return n * fact(n - 1) - if x >= 0: - return fact(x) - else: - raise ValueError, "x must be >= 0" + def testMixedFreevarsAndCellvars(self): -vereq(f(6), 720) + def identity(x): + return x + + def f(x, y, z): + def g(a, b, c): + a = a + x # 3 + def h(): + # z * (4 + 9) + # 3 * 13 + return identity(z * (b + y)) + y = c + z # 9 + return h + return g + + g = f(1, 2, 3) + h = g(2, 4, 6) + self.assertEqual(h(), 39) + + def testFreeVarInMethod(self): + + def test(): + method_and_var = "var" + class Test: + def method_and_var(self): + return "method" + def test(self): + return method_and_var + def actual_global(self): + return str("global") + def str(self): + return str(self) + return Test() + + t = test() + self.assertEqual(t.test(), "var") + self.assertEqual(t.method_and_var(), "method") + self.assertEqual(t.actual_global(), "global") + + method_and_var = "var" + class Test: + # this class is not nested, so the rules are different + def method_and_var(self): + return "method" + def test(self): + return method_and_var + def actual_global(self): + return str("global") + def str(self): + return str(self) + + t = Test() + self.assertEqual(t.test(), "var") + self.assertEqual(t.method_and_var(), "method") + self.assertEqual(t.actual_global(), "global") + + def testRecursion(self): + + def f(x): + def fact(n): + if n == 0: + return 1 + else: + return n * fact(n - 1) + if x >= 0: + return fact(x) + else: + raise ValueError, "x must be >= 0" + self.assertEqual(f(6), 720) -print "11. unoptimized namespaces" -check_syntax("""\ + def testUnoptimizedNamespaces(self): + + check_syntax_error(self, """\ def unoptimized_clash1(strip): def f(s): from string import * @@ -188,7 +192,7 @@ return f """) -check_syntax("""\ + check_syntax_error(self, """\ def unoptimized_clash2(): from string import * def f(s): @@ -196,7 +200,7 @@ return f """) -check_syntax("""\ + check_syntax_error(self, """\ def unoptimized_clash2(): from string import * def g(): @@ -205,8 +209,8 @@ return f """) -# XXX could allow this for exec with const argument, but what's the point -check_syntax("""\ + # XXX could allow this for exec with const argument, but what's the point + check_syntax_error(self, """\ def error(y): exec "a = 1" def f(x): @@ -214,23 +218,23 @@ return f """) -check_syntax("""\ + check_syntax_error(self, """\ def f(x): def g(): return x del x # can't del name """) -check_syntax("""\ + check_syntax_error(self, """\ def f(): def g(): - from string import * - return strip # global or local? + from string import * + return strip # global or local? """) -# and verify a few cases that should work + # and verify a few cases that should work -exec """ + exec """ def noproblem1(): from string import * f = lambda x:x @@ -247,59 +251,60 @@ y = x """ -print "12. lambdas" - -f1 = lambda x: lambda y: x + y -inc = f1(1) -plus10 = f1(10) -vereq(inc(1), 2) -vereq(plus10(5), 15) - -f2 = lambda x: (lambda : lambda y: x + y)() -inc = f2(1) -plus10 = f2(10) -vereq(inc(1), 2) -vereq(plus10(5), 15) - -f3 = lambda x: lambda y: global_x + y -global_x = 1 -inc = f3(None) -vereq(inc(2), 3) - -f8 = lambda x, y, z: lambda a, b, c: lambda : z * (b + y) -g = f8(1, 2, 3) -h = g(2, 4, 6) -vereq(h(), 18) - -print "13. UnboundLocal" - -def errorInOuter(): - print y - def inner(): - return y - y = 1 - -def errorInInner(): - def inner(): - return y - inner() - y = 1 + def testLambdas(self): -try: - errorInOuter() -except UnboundLocalError: - pass -else: - raise TestFailed + f1 = lambda x: lambda y: x + y + inc = f1(1) + plus10 = f1(10) + self.assertEqual(inc(1), 2) + self.assertEqual(plus10(5), 15) + + f2 = lambda x: (lambda : lambda y: x + y)() + inc = f2(1) + plus10 = f2(10) + self.assertEqual(inc(1), 2) + self.assertEqual(plus10(5), 15) + + f3 = lambda x: lambda y: global_x + y + global_x = 1 + inc = f3(None) + self.assertEqual(inc(2), 3) + + f8 = lambda x, y, z: lambda a, b, c: lambda : z * (b + y) + g = f8(1, 2, 3) + h = g(2, 4, 6) + self.assertEqual(h(), 18) + + def testUnboundLocal(self): + + def errorInOuter(): + print y + def inner(): + return y + y = 1 + + def errorInInner(): + def inner(): + return y + inner() + y = 1 + + try: + errorInOuter() + except UnboundLocalError: + pass + else: + self.fail() -try: - errorInInner() -except NameError: - pass -else: - raise TestFailed + try: + errorInInner() + except NameError: + pass + else: + self.fail() -# test for bug #1501934: incorrect LOAD/STORE_GLOBAL generation + # test for bug #1501934: incorrect LOAD/STORE_GLOBAL generation + exec """ global_x = 1 def f(): global_x += 1 @@ -308,34 +313,36 @@ except UnboundLocalError: pass else: - raise TestFailed, 'scope of global_x not correctly determined' + fail('scope of global_x not correctly determined') +""" in {'fail': self.fail} -print "14. complex definitions" + def testComplexDefinitions(self): -def makeReturner(*lst): - def returner(): - return lst - return returner + def makeReturner(*lst): + def returner(): + return lst + return returner -vereq(makeReturner(1,2,3)(), (1,2,3)) + self.assertEqual(makeReturner(1,2,3)(), (1,2,3)) -def makeReturner2(**kwargs): - def returner(): - return kwargs - return returner + def makeReturner2(**kwargs): + def returner(): + return kwargs + return returner -vereq(makeReturner2(a=11)()['a'], 11) + self.assertEqual(makeReturner2(a=11)()['a'], 11) -def makeAddPair((a, b)): - def addPair((c, d)): - return (a + c, b + d) - return addPair + def makeAddPair((a, b)): + def addPair((c, d)): + return (a + c, b + d) + return addPair -vereq(makeAddPair((1, 2))((100, 200)), (101,202)) + self.assertEqual(makeAddPair((1, 2))((100, 200)), (101,202)) -print "15. scope of global statements" + def testScopeOfGlobalStmt(self): # Examples posted by Samuele Pedroni to python-dev on 3/1/2001 + exec """\ # I x = 7 def f(): @@ -348,8 +355,8 @@ return h() return i() return g() -vereq(f(), 7) -vereq(x, 7) +self.assertEqual(f(), 7) +self.assertEqual(x, 7) # II x = 7 @@ -363,8 +370,8 @@ return h() return i() return g() -vereq(f(), 2) -vereq(x, 7) +self.assertEqual(f(), 2) +self.assertEqual(x, 7) # III x = 7 @@ -379,8 +386,8 @@ return h() return i() return g() -vereq(f(), 2) -vereq(x, 2) +self.assertEqual(f(), 2) +self.assertEqual(x, 2) # IV x = 7 @@ -395,8 +402,8 @@ return h() return i() return g() -vereq(f(), 2) -vereq(x, 2) +self.assertEqual(f(), 2) +self.assertEqual(x, 2) # XXX what about global statements in class blocks? # do they affect methods? @@ -411,34 +418,36 @@ return x g = Global() -vereq(g.get(), 13) +self.assertEqual(g.get(), 13) g.set(15) -vereq(g.get(), 13) +self.assertEqual(g.get(), 13) +""" -print "16. check leaks" + def testLeaks(self): -class Foo: - count = 0 + class Foo: + count = 0 - def __init__(self): - Foo.count += 1 + def __init__(self): + Foo.count += 1 - def __del__(self): - Foo.count -= 1 + def __del__(self): + Foo.count -= 1 -def f1(): - x = Foo() - def f2(): - return x - f2() + def f1(): + x = Foo() + def f2(): + return x + f2() -for i in range(100): - f1() + for i in range(100): + f1() -vereq(Foo.count, 0) + self.assertEqual(Foo.count, 0) -print "17. class and global" + def testClassAndGlobal(self): + exec """\ def test(x): class Foo: global x @@ -447,9 +456,9 @@ return Foo() x = 0 -vereq(test(6)(2), 8) +self.assertEqual(test(6)(2), 8) x = -1 -vereq(test(3)(2), 5) +self.assertEqual(test(3)(2), 5) looked_up_by_load_name = False class X: @@ -458,104 +467,106 @@ locals()['looked_up_by_load_name'] = True passed = looked_up_by_load_name -verify(X.passed) - -print "18. verify that locals() works" - -def f(x): - def g(y): - def h(z): - return y + z - w = x + y - y += 3 - return locals() - return g - -d = f(2)(4) -verify(d.has_key('h')) -del d['h'] -vereq(d, {'x': 2, 'y': 7, 'w': 6}) - -print "19. var is bound and free in class" - -def f(x): - class C: - def m(self): - return x - a = x - return C - -inst = f(3)() -vereq(inst.a, inst.m()) - -print "20. interaction with trace function" - -import sys -def tracer(a,b,c): - return tracer - -def adaptgetter(name, klass, getter): - kind, des = getter - if kind == 1: # AV happens when stepping from this line to next - if des == "": - des = "_%s__%s" % (klass.__name__, name) - return lambda obj: getattr(obj, des) - -class TestClass: - pass +self.assert_(X.passed) +""" -sys.settrace(tracer) -adaptgetter("foo", TestClass, (1, "")) -sys.settrace(None) - -try: sys.settrace() -except TypeError: pass -else: raise TestFailed, 'sys.settrace() did not raise TypeError' + def testLocalsFunction(self): -print "20. eval and exec with free variables" + def f(x): + def g(y): + def h(z): + return y + z + w = x + y + y += 3 + return locals() + return g + + d = f(2)(4) + self.assert_(d.has_key('h')) + del d['h'] + self.assertEqual(d, {'x': 2, 'y': 7, 'w': 6}) + + def testBoundAndFree(self): + # var is bound and free in class + + def f(x): + class C: + def m(self): + return x + a = x + return C + + inst = f(3)() + self.assertEqual(inst.a, inst.m()) + + def testInteractionWithTraceFunc(self): + + import sys + def tracer(a,b,c): + return tracer + + def adaptgetter(name, klass, getter): + kind, des = getter + if kind == 1: # AV happens when stepping from this line to next + if des == "": + des = "_%s__%s" % (klass.__name__, name) + return lambda obj: getattr(obj, des) + + class TestClass: + pass + + sys.settrace(tracer) + adaptgetter("foo", TestClass, (1, "")) + sys.settrace(None) + + self.assertRaises(TypeError, sys.settrace) + + def testEvalExecFreeVars(self): + + def f(x): + return lambda: x + 1 + + g = f(3) + self.assertRaises(TypeError, eval, g.func_code) + + try: + exec g.func_code in {} + except TypeError: + pass + else: + self.fail("exec should have failed, because code contained free vars") -def f(x): - return lambda: x + 1 + def testListCompLocalVars(self): -g = f(3) -try: - eval(g.func_code) -except TypeError: - pass -else: - print "eval() should have failed, because code contained free vars" + try: + print bad + except NameError: + pass + else: + print "bad should not be defined" -try: - exec g.func_code -except TypeError: - pass -else: - print "exec should have failed, because code contained free vars" + def x(): + [bad for s in 'a b' for bad in s.split()] -print "21. list comprehension with local variables" + x() + try: + print bad + except NameError: + pass -try: - print bad -except NameError: - pass -else: - print "bad should not be defined" + def testEvalFreeVars(self): -def x(): - [bad for s in 'a b' for bad in s.split()] + def f(x): + def g(): + x + eval("x + 1") + return g -x() -try: - print bad -except NameError: - pass + f(4)() -print "22. eval with free variables" -def f(x): - def g(): - x - eval("x + 1") - return g +def test_main(): + run_unittest(ScopeTests) -f(4)() +if __name__ == '__main__': + test_main() Modified: python/trunk/Lib/test/test_support.py ============================================================================== --- python/trunk/Lib/test/test_support.py (original) +++ python/trunk/Lib/test/test_support.py Sat Oct 28 15:10:17 2006 @@ -245,13 +245,13 @@ withcommas = ", ".join(reprpairs) return "{%s}" % withcommas -def check_syntax(statement): +def check_syntax_error(testcase, statement): try: - compile(statement, '', 'exec') + compile(statement, '', 'exec') except SyntaxError: pass else: - print 'Missing SyntaxError: "%s"' % statement + testcase.fail('Missing SyntaxError: "%s"' % statement) def open_urlresource(url): import urllib, urlparse From python-checkins at python.org Sat Oct 28 15:11:41 2006 From: python-checkins at python.org (georg.brandl) Date: Sat, 28 Oct 2006 15:11:41 +0200 (CEST) Subject: [Python-checkins] r52494 - python/trunk/Lib/test/outstanding_bugs.py Message-ID: <20061028131141.ED7B81E4004@bag.python.org> Author: georg.brandl Date: Sat Oct 28 15:11:41 2006 New Revision: 52494 Modified: python/trunk/Lib/test/outstanding_bugs.py Log: Update outstanding bugs test file. Modified: python/trunk/Lib/test/outstanding_bugs.py ============================================================================== --- python/trunk/Lib/test/outstanding_bugs.py (original) +++ python/trunk/Lib/test/outstanding_bugs.py Sat Oct 28 15:11:41 2006 @@ -9,19 +9,14 @@ import unittest from test import test_support -class TestBug1385040(unittest.TestCase): - def testSyntaxError(self): - import compiler - - # The following snippet gives a SyntaxError in the interpreter - # - # If you compile and exec it, the call foo(7) returns (7, 1) - self.assertRaises(SyntaxError, compiler.compile, - "def foo(a=1, b): return a, b\n\n", "", "exec") +# +# No test cases for outstanding bugs at the moment. +# def test_main(): - test_support.run_unittest(TestBug1385040) + #test_support.run_unittest() + pass if __name__ == "__main__": test_main() From buildbot at python.org Sat Oct 28 15:23:49 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 13:23:49 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061028132349.A903F1E4004@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/173 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 Sat Oct 28 15:37:50 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 13:37:50 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20061028133751.2115F1E4004@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/1600 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 Sat Oct 28 15:51:50 2006 From: python-checkins at python.org (georg.brandl) Date: Sat, 28 Oct 2006 15:51:50 +0200 (CEST) Subject: [Python-checkins] r52495 - in python/trunk/Lib/test: output/test_math test_math.py Message-ID: <20061028135150.C66081E4004@bag.python.org> Author: georg.brandl Date: Sat Oct 28 15:51:49 2006 New Revision: 52495 Removed: python/trunk/Lib/test/output/test_math Modified: python/trunk/Lib/test/test_math.py Log: Convert test_math to unittest. Deleted: /python/trunk/Lib/test/output/test_math ============================================================================== --- /python/trunk/Lib/test/output/test_math Sat Oct 28 15:51:49 2006 +++ (empty file) @@ -1,28 +0,0 @@ -test_math -math module, testing with eps 1e-05 -constants -acos -asin -atan -atan2 -ceil -cos -cosh -degrees -exp -fabs -floor -fmod -frexp -hypot -ldexp -log -log10 -modf -pow -radians -sin -sinh -sqrt -tan -tanh Modified: python/trunk/Lib/test/test_math.py ============================================================================== --- python/trunk/Lib/test/test_math.py (original) +++ python/trunk/Lib/test/test_math.py Sat Oct 28 15:51:49 2006 @@ -1,208 +1,214 @@ # Python test set -- math module # XXXX Should not do tests around zero only -from test.test_support import TestFailed, verbose +from test.test_support import run_unittest, verbose +import unittest +import math seps='1e-05' eps = eval(seps) -print 'math module, testing with eps', seps -import math -def testit(name, value, expected): - if abs(value-expected) > eps: - raise TestFailed, '%s returned %f, expected %f'%\ - (name, value, expected) - -print 'constants' -testit('pi', math.pi, 3.1415926) -testit('e', math.e, 2.7182818) - -print 'acos' -testit('acos(-1)', math.acos(-1), math.pi) -testit('acos(0)', math.acos(0), math.pi/2) -testit('acos(1)', math.acos(1), 0) - -print 'asin' -testit('asin(-1)', math.asin(-1), -math.pi/2) -testit('asin(0)', math.asin(0), 0) -testit('asin(1)', math.asin(1), math.pi/2) - -print 'atan' -testit('atan(-1)', math.atan(-1), -math.pi/4) -testit('atan(0)', math.atan(0), 0) -testit('atan(1)', math.atan(1), math.pi/4) - -print 'atan2' -testit('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2) -testit('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4) -testit('atan2(0, 1)', math.atan2(0, 1), 0) -testit('atan2(1, 1)', math.atan2(1, 1), math.pi/4) -testit('atan2(1, 0)', math.atan2(1, 0), math.pi/2) - -print 'ceil' -testit('ceil(0.5)', math.ceil(0.5), 1) -testit('ceil(1.0)', math.ceil(1.0), 1) -testit('ceil(1.5)', math.ceil(1.5), 2) -testit('ceil(-0.5)', math.ceil(-0.5), 0) -testit('ceil(-1.0)', math.ceil(-1.0), -1) -testit('ceil(-1.5)', math.ceil(-1.5), -1) - -print 'cos' -testit('cos(-pi/2)', math.cos(-math.pi/2), 0) -testit('cos(0)', math.cos(0), 1) -testit('cos(pi/2)', math.cos(math.pi/2), 0) -testit('cos(pi)', math.cos(math.pi), -1) - -print 'cosh' -testit('cosh(0)', math.cosh(0), 1) -testit('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert - -print 'degrees' -testit('degrees(pi)', math.degrees(math.pi), 180.0) -testit('degrees(pi/2)', math.degrees(math.pi/2), 90.0) -testit('degrees(-pi/4)', math.degrees(-math.pi/4), -45.0) - -print 'exp' -testit('exp(-1)', math.exp(-1), 1/math.e) -testit('exp(0)', math.exp(0), 1) -testit('exp(1)', math.exp(1), math.e) - -print 'fabs' -testit('fabs(-1)', math.fabs(-1), 1) -testit('fabs(0)', math.fabs(0), 0) -testit('fabs(1)', math.fabs(1), 1) - -print 'floor' -testit('floor(0.5)', math.floor(0.5), 0) -testit('floor(1.0)', math.floor(1.0), 1) -testit('floor(1.5)', math.floor(1.5), 1) -testit('floor(-0.5)', math.floor(-0.5), -1) -testit('floor(-1.0)', math.floor(-1.0), -1) -testit('floor(-1.5)', math.floor(-1.5), -2) - -print 'fmod' -testit('fmod(10,1)', math.fmod(10,1), 0) -testit('fmod(10,0.5)', math.fmod(10,0.5), 0) -testit('fmod(10,1.5)', math.fmod(10,1.5), 1) -testit('fmod(-10,1)', math.fmod(-10,1), 0) -testit('fmod(-10,0.5)', math.fmod(-10,0.5), 0) -testit('fmod(-10,1.5)', math.fmod(-10,1.5), -1) - -print 'frexp' -def testfrexp(name, (mant, exp), (emant, eexp)): - if abs(mant-emant) > eps or exp != eexp: - raise TestFailed, '%s returned %r, expected %r'%\ - (name, (mant, exp), (emant,eexp)) - -testfrexp('frexp(-1)', math.frexp(-1), (-0.5, 1)) -testfrexp('frexp(0)', math.frexp(0), (0, 0)) -testfrexp('frexp(1)', math.frexp(1), (0.5, 1)) -testfrexp('frexp(2)', math.frexp(2), (0.5, 2)) - -print 'hypot' -testit('hypot(0,0)', math.hypot(0,0), 0) -testit('hypot(3,4)', math.hypot(3,4), 5) - -print 'ldexp' -testit('ldexp(0,1)', math.ldexp(0,1), 0) -testit('ldexp(1,1)', math.ldexp(1,1), 2) -testit('ldexp(1,-1)', math.ldexp(1,-1), 0.5) -testit('ldexp(-1,1)', math.ldexp(-1,1), -2) - -print 'log' -testit('log(1/e)', math.log(1/math.e), -1) -testit('log(1)', math.log(1), 0) -testit('log(e)', math.log(math.e), 1) -testit('log(32,2)', math.log(32,2), 5) -testit('log(10**40, 10)', math.log(10**40, 10), 40) -testit('log(10**40, 10**20)', math.log(10**40, 10**20), 2) - -print 'log10' -testit('log10(0.1)', math.log10(0.1), -1) -testit('log10(1)', math.log10(1), 0) -testit('log10(10)', math.log10(10), 1) - -print 'modf' -def testmodf(name, (v1, v2), (e1, e2)): - if abs(v1-e1) > eps or abs(v2-e2): - raise TestFailed, '%s returned %r, expected %r'%\ - (name, (v1,v2), (e1,e2)) - -testmodf('modf(1.5)', math.modf(1.5), (0.5, 1.0)) -testmodf('modf(-1.5)', math.modf(-1.5), (-0.5, -1.0)) - -print 'pow' -testit('pow(0,1)', math.pow(0,1), 0) -testit('pow(1,0)', math.pow(1,0), 1) -testit('pow(2,1)', math.pow(2,1), 2) -testit('pow(2,-1)', math.pow(2,-1), 0.5) - -print 'radians' -testit('radians(180)', math.radians(180), math.pi) -testit('radians(90)', math.radians(90), math.pi/2) -testit('radians(-45)', math.radians(-45), -math.pi/4) - -print 'sin' -testit('sin(0)', math.sin(0), 0) -testit('sin(pi/2)', math.sin(math.pi/2), 1) -testit('sin(-pi/2)', math.sin(-math.pi/2), -1) - -print 'sinh' -testit('sinh(0)', math.sinh(0), 0) -testit('sinh(1)**2-cosh(1)**2', math.sinh(1)**2-math.cosh(1)**2, -1) -testit('sinh(1)+sinh(-1)', math.sinh(1)+math.sinh(-1), 0) - -print 'sqrt' -testit('sqrt(0)', math.sqrt(0), 0) -testit('sqrt(1)', math.sqrt(1), 1) -testit('sqrt(4)', math.sqrt(4), 2) - -print 'tan' -testit('tan(0)', math.tan(0), 0) -testit('tan(pi/4)', math.tan(math.pi/4), 1) -testit('tan(-pi/4)', math.tan(-math.pi/4), -1) - -print 'tanh' -testit('tanh(0)', math.tanh(0), 0) -testit('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0) - -# RED_FLAG 16-Oct-2000 Tim -# While 2.0 is more consistent about exceptions than previous releases, it -# still fails this part of the test on some platforms. For now, we only -# *run* test_exceptions() in verbose mode, so that this isn't normally -# tested. - -def test_exceptions(): - print 'exceptions' - try: - x = math.exp(-1000000000) - except: - # mathmodule.c is failing to weed out underflows from libm, or - # we've got an fp format with huge dynamic range - raise TestFailed("underflowing exp() should not have raised " - "an exception") - if x != 0: - raise TestFailed("underflowing exp() should have returned 0") - - # If this fails, probably using a strict IEEE-754 conforming libm, and x - # is +Inf afterwards. But Python wants overflows detected by default. - try: - x = math.exp(1000000000) - except OverflowError: - pass - else: - raise TestFailed("overflowing exp() didn't trigger OverflowError") - - # If this fails, it could be a puzzle. One odd possibility is that - # mathmodule.c's macros are getting confused while comparing - # Inf (HUGE_VAL) to a NaN, and artificially setting errno to ERANGE - # as a result (and so raising OverflowError instead). - try: - x = math.sqrt(-1.0) - except ValueError: - pass - else: - raise TestFailed("sqrt(-1) didn't raise ValueError") +class MathTests(unittest.TestCase): + + def ftest(self, name, value, expected): + if abs(value-expected) > eps: + self.fail('%s returned %f, expected %f'%\ + (name, value, expected)) + + def testConstants(self): + self.ftest('pi', math.pi, 3.1415926) + self.ftest('e', math.e, 2.7182818) + + def testAcos(self): + self.ftest('acos(-1)', math.acos(-1), math.pi) + self.ftest('acos(0)', math.acos(0), math.pi/2) + self.ftest('acos(1)', math.acos(1), 0) + + def testAsin(self): + self.ftest('asin(-1)', math.asin(-1), -math.pi/2) + self.ftest('asin(0)', math.asin(0), 0) + self.ftest('asin(1)', math.asin(1), math.pi/2) + + def testAtan(self): + self.ftest('atan(-1)', math.atan(-1), -math.pi/4) + self.ftest('atan(0)', math.atan(0), 0) + self.ftest('atan(1)', math.atan(1), math.pi/4) + + def testAtan2(self): + self.ftest('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2) + self.ftest('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4) + self.ftest('atan2(0, 1)', math.atan2(0, 1), 0) + self.ftest('atan2(1, 1)', math.atan2(1, 1), math.pi/4) + self.ftest('atan2(1, 0)', math.atan2(1, 0), math.pi/2) + + def testCeil(self): + self.ftest('ceil(0.5)', math.ceil(0.5), 1) + self.ftest('ceil(1.0)', math.ceil(1.0), 1) + self.ftest('ceil(1.5)', math.ceil(1.5), 2) + self.ftest('ceil(-0.5)', math.ceil(-0.5), 0) + self.ftest('ceil(-1.0)', math.ceil(-1.0), -1) + self.ftest('ceil(-1.5)', math.ceil(-1.5), -1) + + def testCos(self): + self.ftest('cos(-pi/2)', math.cos(-math.pi/2), 0) + self.ftest('cos(0)', math.cos(0), 1) + self.ftest('cos(pi/2)', math.cos(math.pi/2), 0) + self.ftest('cos(pi)', math.cos(math.pi), -1) + + def testCosh(self): + self.ftest('cosh(0)', math.cosh(0), 1) + self.ftest('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert + + def testDegrees(self): + self.ftest('degrees(pi)', math.degrees(math.pi), 180.0) + self.ftest('degrees(pi/2)', math.degrees(math.pi/2), 90.0) + self.ftest('degrees(-pi/4)', math.degrees(-math.pi/4), -45.0) + + def testExp(self): + self.ftest('exp(-1)', math.exp(-1), 1/math.e) + self.ftest('exp(0)', math.exp(0), 1) + self.ftest('exp(1)', math.exp(1), math.e) + + def testFabs(self): + self.ftest('fabs(-1)', math.fabs(-1), 1) + self.ftest('fabs(0)', math.fabs(0), 0) + self.ftest('fabs(1)', math.fabs(1), 1) + + def testFloor(self): + self.ftest('floor(0.5)', math.floor(0.5), 0) + self.ftest('floor(1.0)', math.floor(1.0), 1) + self.ftest('floor(1.5)', math.floor(1.5), 1) + self.ftest('floor(-0.5)', math.floor(-0.5), -1) + self.ftest('floor(-1.0)', math.floor(-1.0), -1) + self.ftest('floor(-1.5)', math.floor(-1.5), -2) + + def testFmod(self): + self.ftest('fmod(10,1)', math.fmod(10,1), 0) + self.ftest('fmod(10,0.5)', math.fmod(10,0.5), 0) + self.ftest('fmod(10,1.5)', math.fmod(10,1.5), 1) + self.ftest('fmod(-10,1)', math.fmod(-10,1), 0) + self.ftest('fmod(-10,0.5)', math.fmod(-10,0.5), 0) + self.ftest('fmod(-10,1.5)', math.fmod(-10,1.5), -1) + + def testFrexp(self): + def testfrexp(name, (mant, exp), (emant, eexp)): + if abs(mant-emant) > eps or exp != eexp: + self.fail('%s returned %r, expected %r'%\ + (name, (mant, exp), (emant,eexp))) + + testfrexp('frexp(-1)', math.frexp(-1), (-0.5, 1)) + testfrexp('frexp(0)', math.frexp(0), (0, 0)) + testfrexp('frexp(1)', math.frexp(1), (0.5, 1)) + testfrexp('frexp(2)', math.frexp(2), (0.5, 2)) + + def testHypot(self): + self.ftest('hypot(0,0)', math.hypot(0,0), 0) + self.ftest('hypot(3,4)', math.hypot(3,4), 5) + + def testLdexp(self): + self.ftest('ldexp(0,1)', math.ldexp(0,1), 0) + self.ftest('ldexp(1,1)', math.ldexp(1,1), 2) + self.ftest('ldexp(1,-1)', math.ldexp(1,-1), 0.5) + self.ftest('ldexp(-1,1)', math.ldexp(-1,1), -2) + + def testLog(self): + self.ftest('log(1/e)', math.log(1/math.e), -1) + self.ftest('log(1)', math.log(1), 0) + self.ftest('log(e)', math.log(math.e), 1) + self.ftest('log(32,2)', math.log(32,2), 5) + self.ftest('log(10**40, 10)', math.log(10**40, 10), 40) + self.ftest('log(10**40, 10**20)', math.log(10**40, 10**20), 2) + + def testLog10(self): + self.ftest('log10(0.1)', math.log10(0.1), -1) + self.ftest('log10(1)', math.log10(1), 0) + self.ftest('log10(10)', math.log10(10), 1) + + def testModf(self): + def testmodf(name, (v1, v2), (e1, e2)): + if abs(v1-e1) > eps or abs(v2-e2): + self.fail('%s returned %r, expected %r'%\ + (name, (v1,v2), (e1,e2))) + + testmodf('modf(1.5)', math.modf(1.5), (0.5, 1.0)) + testmodf('modf(-1.5)', math.modf(-1.5), (-0.5, -1.0)) + + def testPow(self): + self.ftest('pow(0,1)', math.pow(0,1), 0) + self.ftest('pow(1,0)', math.pow(1,0), 1) + self.ftest('pow(2,1)', math.pow(2,1), 2) + self.ftest('pow(2,-1)', math.pow(2,-1), 0.5) + + def testRadians(self): + self.ftest('radians(180)', math.radians(180), math.pi) + self.ftest('radians(90)', math.radians(90), math.pi/2) + self.ftest('radians(-45)', math.radians(-45), -math.pi/4) + + def testSin(self): + self.ftest('sin(0)', math.sin(0), 0) + self.ftest('sin(pi/2)', math.sin(math.pi/2), 1) + self.ftest('sin(-pi/2)', math.sin(-math.pi/2), -1) + + def testSinh(self): + self.ftest('sinh(0)', math.sinh(0), 0) + self.ftest('sinh(1)**2-cosh(1)**2', math.sinh(1)**2-math.cosh(1)**2, -1) + self.ftest('sinh(1)+sinh(-1)', math.sinh(1)+math.sinh(-1), 0) + + def testSqrt(self): + self.ftest('sqrt(0)', math.sqrt(0), 0) + self.ftest('sqrt(1)', math.sqrt(1), 1) + self.ftest('sqrt(4)', math.sqrt(4), 2) + + def testTan(self): + self.ftest('tan(0)', math.tan(0), 0) + self.ftest('tan(pi/4)', math.tan(math.pi/4), 1) + self.ftest('tan(-pi/4)', math.tan(-math.pi/4), -1) + + def testTanh(self): + self.ftest('tanh(0)', math.tanh(0), 0) + self.ftest('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0) + + # RED_FLAG 16-Oct-2000 Tim + # While 2.0 is more consistent about exceptions than previous releases, it + # still fails this part of the test on some platforms. For now, we only + # *run* test_exceptions() in verbose mode, so that this isn't normally + # tested. + + if verbose: + def test_exceptions(self): + try: + x = math.exp(-1000000000) + except: + # mathmodule.c is failing to weed out underflows from libm, or + # we've got an fp format with huge dynamic range + self.fail("underflowing exp() should not have raised " + "an exception") + if x != 0: + self.fail("underflowing exp() should have returned 0") + + # If this fails, probably using a strict IEEE-754 conforming libm, and x + # is +Inf afterwards. But Python wants overflows detected by default. + try: + x = math.exp(1000000000) + except OverflowError: + pass + else: + self.fail("overflowing exp() didn't trigger OverflowError") + + # If this fails, it could be a puzzle. One odd possibility is that + # mathmodule.c's macros are getting confused while comparing + # Inf (HUGE_VAL) to a NaN, and artificially setting errno to ERANGE + # as a result (and so raising OverflowError instead). + try: + x = math.sqrt(-1.0) + except ValueError: + pass + else: + self.fail("sqrt(-1) didn't raise ValueError") + + +def test_main(): + run_unittest(MathTests) -if verbose: - test_exceptions() +if __name__ == '__main__': + test_main() From python-checkins at python.org Sat Oct 28 15:56:58 2006 From: python-checkins at python.org (georg.brandl) Date: Sat, 28 Oct 2006 15:56:58 +0200 (CEST) Subject: [Python-checkins] r52496 - in python/trunk/Lib/test: output/test_opcodes test_opcodes.py Message-ID: <20061028135658.E290A1E4004@bag.python.org> Author: georg.brandl Date: Sat Oct 28 15:56:58 2006 New Revision: 52496 Removed: python/trunk/Lib/test/output/test_opcodes Modified: python/trunk/Lib/test/test_opcodes.py Log: Convert test_opcodes to unittest. Deleted: /python/trunk/Lib/test/output/test_opcodes ============================================================================== --- /python/trunk/Lib/test/output/test_opcodes Sat Oct 28 15:56:58 2006 +++ (empty file) @@ -1,6 +0,0 @@ -test_opcodes -2. Opcodes -XXX Not yet fully implemented -2.1 try inside for loop -2.2 raise class exceptions -2.3 comparing function objects Modified: python/trunk/Lib/test/test_opcodes.py ============================================================================== --- python/trunk/Lib/test/test_opcodes.py (original) +++ python/trunk/Lib/test/test_opcodes.py Sat Oct 28 15:56:58 2006 @@ -1,101 +1,110 @@ # Python test set -- part 2, opcodes -from test.test_support import TestFailed +from test.test_support import run_unittest +import unittest +class OpcodeTest(unittest.TestCase): -print '2. Opcodes' -print 'XXX Not yet fully implemented' + def test_try_inside_for_loop(self): + n = 0 + for i in range(10): + n = n+i + try: 1/0 + except NameError: pass + except ZeroDivisionError: pass + except TypeError: pass + try: pass + except: pass + try: pass + finally: pass + n = n+i + if n != 90: + self.fail('try inside for') + + def test_raise_class_exceptions(self): + + class AClass: pass + class BClass(AClass): pass + class CClass: pass + class DClass(AClass): + def __init__(self, ignore): + pass + + try: raise AClass() + except: pass + + try: raise AClass() + except AClass: pass + + try: raise BClass() + except AClass: pass + + try: raise BClass() + except CClass: self.fail() + except: pass + + a = AClass() + b = BClass() + + try: raise AClass, b + except BClass, v: + if v != b: self.fail("v!=b") + else: self.fail("no exception") + + try: raise b + except AClass, v: + if v != b: self.fail("v!=b AClass") + else: + self.fail("no exception") + + # not enough arguments + try: raise BClass, a + except TypeError: pass + else: self.fail("no exception") + + try: raise DClass, a + except DClass, v: + self.assert_(isinstance(v, DClass)) + else: + self.fail("no exception") + + def test_compare_function_objects(self): + + f = eval('lambda: None') + g = eval('lambda: None') + self.failIf(f == g) + + f = eval('lambda a: a') + g = eval('lambda a: a') + self.failIf(f == g) + + f = eval('lambda a=1: a') + g = eval('lambda a=1: a') + self.failIf(f == g) + + f = eval('lambda: 0') + g = eval('lambda: 1') + self.failIf(f == g) + + f = eval('lambda: None') + g = eval('lambda a: None') + self.failIf(f == g) + + f = eval('lambda a: None') + g = eval('lambda b: None') + self.failIf(f == g) + + f = eval('lambda a: None') + g = eval('lambda a=None: None') + self.failIf(f == g) + + f = eval('lambda a=0: None') + g = eval('lambda a=1: None') + self.failIf(f == g) -print '2.1 try inside for loop' -n = 0 -for i in range(10): - n = n+i - try: 1/0 - except NameError: pass - except ZeroDivisionError: pass - except TypeError: pass - try: pass - except: pass - try: pass - finally: pass - n = n+i -if n != 90: - raise TestFailed, 'try inside for' - - -print '2.2 raise class exceptions' - -class AClass: pass -class BClass(AClass): pass -class CClass: pass -class DClass(AClass): - def __init__(self, ignore): - pass - -try: raise AClass() -except: pass - -try: raise AClass() -except AClass: pass - -try: raise BClass() -except AClass: pass - -try: raise BClass() -except CClass: raise TestFailed -except: pass - -a = AClass() -b = BClass() - -try: raise AClass, b -except BClass, v: - if v != b: raise TestFailed, "v!=b" -else: raise TestFailed, "no exception" - -try: raise b -except AClass, v: - if v != b: raise TestFailed, "v!=b AClass" - -# not enough arguments -try: raise BClass, a -except TypeError: pass - -try: raise DClass, a -except DClass, v: - if not isinstance(v, DClass): - raise TestFailed, "v not DClass" - -print '2.3 comparing function objects' - -f = eval('lambda: None') -g = eval('lambda: None') -if f == g: raise TestFailed, "functions should not be same" - -f = eval('lambda a: a') -g = eval('lambda a: a') -if f == g: raise TestFailed, "functions should not be same" - -f = eval('lambda a=1: a') -g = eval('lambda a=1: a') -if f == g: raise TestFailed, "functions should not be same" - -f = eval('lambda: 0') -g = eval('lambda: 1') -if f == g: raise TestFailed - -f = eval('lambda: None') -g = eval('lambda a: None') -if f == g: raise TestFailed - -f = eval('lambda a: None') -g = eval('lambda b: None') -if f == g: raise TestFailed - -f = eval('lambda a: None') -g = eval('lambda a=None: None') -if f == g: raise TestFailed - -f = eval('lambda a=0: None') -g = eval('lambda a=1: None') -if f == g: raise TestFailed + +def test_main(): + run_unittest(OpcodeTest) + +if __name__ == '__main__': + test_main() From buildbot at python.org Sat Oct 28 16:22:30 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 14:22:30 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD trunk Message-ID: <20061028142230.CCCDF1E4004@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/1365 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 Sat Oct 28 16:33:59 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 14:33:59 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20061028143359.229411E4004@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/1613 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 Sat Oct 28 16:40:00 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 14:40:00 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20061028144000.B878A1E4004@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/1602 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 Sat Oct 28 16:57:16 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 14:57:16 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061028145716.E9BE51E4005@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/1246 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 Sat Oct 28 17:19:26 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 15:19:26 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061028151926.B79461E4004@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/175 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 Sat Oct 28 17:20:12 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 15:20:12 +0000 Subject: [Python-checkins] buildbot warnings in x86 Ubuntu edgy (icc) trunk Message-ID: <20061028152012.BABCE1E4013@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu edgy (icc) trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520edgy%2520%2528icc%2529%2520trunk/builds/1036 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 Sat Oct 28 18:04:05 2006 From: python-checkins at python.org (georg.brandl) Date: Sat, 28 Oct 2006 18:04:05 +0200 (CEST) Subject: [Python-checkins] r52497 - python/trunk/Doc/lib/libitertools.tex Message-ID: <20061028160405.154BD1E4004@bag.python.org> Author: georg.brandl Date: Sat Oct 28 18:04:04 2006 New Revision: 52497 Modified: python/trunk/Doc/lib/libitertools.tex Log: Fix nth() itertool recipe. Modified: python/trunk/Doc/lib/libitertools.tex ============================================================================== --- python/trunk/Doc/lib/libitertools.tex (original) +++ python/trunk/Doc/lib/libitertools.tex Sat Oct 28 18:04:04 2006 @@ -474,8 +474,8 @@ return izip(mapping.iterkeys(), mapping.itervalues()) def nth(iterable, n): - "Returns the nth item" - return list(islice(iterable, n, n+1)) + "Returns the nth item or raise IndexError" + return list(islice(iterable, n, n+1))[0] def all(seq, pred=None): "Returns True if pred(x) is true for every element in the iterable" From python-checkins at python.org Sat Oct 28 18:04:08 2006 From: python-checkins at python.org (georg.brandl) Date: Sat, 28 Oct 2006 18:04:08 +0200 (CEST) Subject: [Python-checkins] r52498 - python/branches/release25-maint/Doc/lib/libitertools.tex Message-ID: <20061028160408.04C551E4004@bag.python.org> Author: georg.brandl Date: Sat Oct 28 18:04:07 2006 New Revision: 52498 Modified: python/branches/release25-maint/Doc/lib/libitertools.tex Log: Fix nth() itertool recipe. (backport from rev. 52497) Modified: python/branches/release25-maint/Doc/lib/libitertools.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libitertools.tex (original) +++ python/branches/release25-maint/Doc/lib/libitertools.tex Sat Oct 28 18:04:07 2006 @@ -474,8 +474,8 @@ return izip(mapping.iterkeys(), mapping.itervalues()) def nth(iterable, n): - "Returns the nth item" - return list(islice(iterable, n, n+1)) + "Returns the nth item or raise IndexError" + return list(islice(iterable, n, n+1))[0] def all(seq, pred=None): "Returns True if pred(x) is true for every element in the iterable" From python-checkins at python.org Sat Oct 28 21:03:00 2006 From: python-checkins at python.org (brett.cannon) Date: Sat, 28 Oct 2006 21:03:00 +0200 (CEST) Subject: [Python-checkins] r52499 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061028190300.BF9141E4025@bag.python.org> Author: brett.cannon Date: Sat Oct 28 21:03:00 2006 New Revision: 52499 Modified: sandbox/trunk/import_in_py/importer.py Log: Expand on a comment. 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 28 21:03:00 2006 @@ -714,7 +714,8 @@ # otherwise import as a top-level module. # XXX - # Import submodules. + # Import submodules; short-circuits search if module is already + # in sys.modules. # XXX From buildbot at python.org Sat Oct 28 21:42:28 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 19:42:28 +0000 Subject: [Python-checkins] buildbot warnings in sparc Ubuntu dapper trunk Message-ID: <20061028194229.048ED1E4004@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/761 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 neal at metaslash.com Sat Oct 28 22:13:21 2006 From: neal at metaslash.com (Neal Norwitz) Date: Sat, 28 Oct 2006 16:13:21 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20061028201321.GA5378@python.psfb.org> test_grammar test test_grammar failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_grammar.py", line 548, in testAssert self.fail("AssertionError not raised by assert 0") AssertionError: AssertionError not raised by assert 0 test_opcodes test_operations test_builtin test_exceptions test_types test_MimeWriter test_StringIO test___all__ test___future__ test__locale test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat WARNING: failed to listen on port 54322, trying another test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_bufio test_bz2 test_cProfile test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd_line test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_dict test_difflib test_dircache test_dis test_distutils [8912 refs] test_dl test_doctest test_doctest2 test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_frozen test_funcattrs test_functools test_future test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hexoct test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_imageop test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_largefile test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macfs test_macfs skipped -- No module named macfs test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_netrc test_new test_nis test_nis skipped -- Local domain name not set test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pkg test_pkgimport test_platform test_plistlib test_plistlib skipped -- No module named plistlib test_poll test_popen [7229 refs] [7229 refs] [7229 refs] test_popen2 test_posix test_posixpath test_pow test_pprint test_profile test_profilehooks test_pty test_pwd test_pyclbr test_pyexpat test_queue test_quopri [7604 refs] [7604 refs] test_random test_re test_repr test_resource test_rfc822 test_rgbimg test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site test_slice test_socket test_socket_ssl test_socket_ssl skipped -- Use of the `network' resource not enabled test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort test_sqlite test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [7224 refs] [7225 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7225 refs] [8775 refs] [7440 refs] [7225 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] [7224 refs] . [7224 refs] [7224 refs] this bit of output is from a test of stdout in a different process ... [7224 refs] [7224 refs] [7440 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [7224 refs] [7224 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_tempfile [7231 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_ucn test_unary test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_unittest test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 291 tests OK. 1 test failed: test_grammar 31 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_gl test_imgfile test_ioctl test_linuxaudiodev test_macfs test_macostools test_nis test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socket_ssl test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on linux2: test_ioctl [446297 refs] From python-checkins at python.org Sat Oct 28 22:25:10 2006 From: python-checkins at python.org (georg.brandl) Date: Sat, 28 Oct 2006 22:25:10 +0200 (CEST) Subject: [Python-checkins] r52500 - python/trunk/Lib/test/test_grammar.py Message-ID: <20061028202510.86C441E4004@bag.python.org> Author: georg.brandl Date: Sat Oct 28 22:25:09 2006 New Revision: 52500 Modified: python/trunk/Lib/test/test_grammar.py Log: make test_grammar pass with python -O Modified: python/trunk/Lib/test/test_grammar.py ============================================================================== --- python/trunk/Lib/test/test_grammar.py (original) +++ python/trunk/Lib/test/test_grammar.py Sat Oct 28 22:25:09 2006 @@ -544,8 +544,10 @@ assert 0, "msg" except AssertionError, e: self.assertEquals(e.args[0], "msg") - else: - self.fail("AssertionError not raised by assert 0") + # we can not expect an assertion error to be raised + # if the tests are run in an optimized python + #else: + # self.fail("AssertionError not raised by assert 0") ### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef # Tested below From buildbot at python.org Sat Oct 28 22:49:36 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 20:49:36 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc trunk Message-ID: <20061028204936.7E7501E4004@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%2520trunk/builds/22 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 Sat Oct 28 23:15:31 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:15:31 +0200 (CEST) Subject: [Python-checkins] r52501 - in python/trunk: Modules/threadmodule.c Python/sysmodule.c Message-ID: <20061028211531.958EE1E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:15:30 2006 New Revision: 52501 Modified: python/trunk/Modules/threadmodule.c python/trunk/Python/sysmodule.c Log: Add some asserts. In sysmodule, I think these were to try to silence some warnings from Klokwork. They verify the assumptions of the format of svn version output. The assert in the thread module helped debug a problem on HP-UX. Modified: python/trunk/Modules/threadmodule.c ============================================================================== --- python/trunk/Modules/threadmodule.c (original) +++ python/trunk/Modules/threadmodule.c Sat Oct 28 23:15:30 2006 @@ -25,6 +25,7 @@ static void lock_dealloc(lockobject *self) { + assert(self->lock_lock); /* Unlock the lock so it's safe to free it */ PyThread_acquire_lock(self->lock_lock, 0); PyThread_release_lock(self->lock_lock); Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Sat Oct 28 23:15:30 2006 @@ -983,6 +983,8 @@ br_start = python + 8; br_end = strchr(br_start, '/'); + assert(br_end); + /* Works even for trunk, as we are in trunk/Python/sysmodule.c */ br_end2 = strchr(br_end+1, '/'); @@ -995,6 +997,8 @@ } else if (istag || strncmp(br_start, "branches", 8) == 0) { len = br_end2 - br_start; + assert(len >= 13); + assert(len < (sizeof(patchlevel_revision) - 13)); strncpy(branch, br_start, len); branch[len] = '\0'; From python-checkins at python.org Sat Oct 28 23:16:55 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:16:55 +0200 (CEST) Subject: [Python-checkins] r52502 - python/trunk/Objects/dictobject.c python/trunk/Objects/setobject.c Message-ID: <20061028211655.7B5731E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:16:54 2006 New Revision: 52502 Modified: python/trunk/Objects/dictobject.c python/trunk/Objects/setobject.c Log: Fix warnings with HP's C compiler. It doesn't recognize that infinite loops are, um, infinite. These conditions should not be able to happen. Will backport. Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Sat Oct 28 23:16:54 2006 @@ -307,6 +307,8 @@ else if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; } + assert(0); /* NOT REACHED */ + return 0; } /* @@ -366,6 +368,8 @@ if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; } + assert(0); /* NOT REACHED */ + return 0; } /* Modified: python/trunk/Objects/setobject.c ============================================================================== --- python/trunk/Objects/setobject.c (original) +++ python/trunk/Objects/setobject.c Sat Oct 28 23:16:54 2006 @@ -179,6 +179,8 @@ if (entry->key == dummy && freeslot == NULL) freeslot = entry; } + assert(0); /* NOT REACHED */ + return 0; } /* From python-checkins at python.org Sat Oct 28 23:17:51 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:17:51 +0200 (CEST) Subject: [Python-checkins] r52503 - python/trunk/Modules/_testcapimodule.c Message-ID: <20061028211751.AA8161E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:17:51 2006 New Revision: 52503 Modified: python/trunk/Modules/_testcapimodule.c Log: Fix crash in test on HP-UX. Apparently, it's not possible to delete a lock if it's held (even by the current thread). Will backport. Modified: python/trunk/Modules/_testcapimodule.c ============================================================================== --- python/trunk/Modules/_testcapimodule.c (original) +++ python/trunk/Modules/_testcapimodule.c Sat Oct 28 23:17:51 2006 @@ -667,6 +667,9 @@ PyThread_acquire_lock(thread_done, 1); /* wait for thread to finish */ Py_END_ALLOW_THREADS + /* Release lock we acquired above. This is required on HP-UX. */ + PyThread_release_lock(thread_done); + PyThread_free_lock(thread_done); Py_RETURN_NONE; } From python-checkins at python.org Sat Oct 28 23:19:08 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:19:08 +0200 (CEST) Subject: [Python-checkins] r52504 - in python/trunk: Lib/test/test_syntax.py Misc/NEWS Python/compile.c Message-ID: <20061028211908.7C4031E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:19:07 2006 New Revision: 52504 Modified: python/trunk/Lib/test/test_syntax.py python/trunk/Misc/NEWS python/trunk/Python/compile.c Log: Fix bug #1565514, SystemError not raised on too many nested blocks. It seems like this should be a different error than SystemError, but I don't have any great ideas and SystemError was raised in 2.4 and earlier. Will backport. Modified: python/trunk/Lib/test/test_syntax.py ============================================================================== --- python/trunk/Lib/test/test_syntax.py (original) +++ python/trunk/Lib/test/test_syntax.py Sat Oct 28 23:19:07 2006 @@ -336,6 +336,37 @@ Traceback (most recent call last): ... SyntaxError: 'break' outside loop (, line 3) + +This should probably raise a better error than a SystemError (or none at all). +In 2.5 there was a missing exception and an assert was triggered in a debug +build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514 + + >>> while 1: + ... while 2: + ... while 3: + ... while 4: + ... while 5: + ... while 6: + ... while 8: + ... while 9: + ... while 10: + ... while 11: + ... while 12: + ... while 13: + ... while 14: + ... while 15: + ... while 16: + ... while 17: + ... while 18: + ... while 19: + ... while 20: + ... while 21: + ... while 22: + ... break + Traceback (most recent call last): + ... + SystemError: too many statically nested blocks + """ import re Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Oct 28 23:19:07 2006 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Bug #1565514, SystemError not raised on too many nested blocks. + - Bug #1576174: WindowsError now displays the windows error code again, no longer the posix error code. Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Sat Oct 28 23:19:07 2006 @@ -3131,8 +3131,11 @@ compiler_push_fblock(struct compiler *c, enum fblocktype t, basicblock *b) { struct fblockinfo *f; - if (c->u->u_nfblocks >= CO_MAXBLOCKS) + if (c->u->u_nfblocks >= CO_MAXBLOCKS) { + PyErr_SetString(PyExc_SystemError, + "too many statically nested blocks"); return 0; + } f = &c->u->u_fblock[c->u->u_nfblocks++]; f->fb_type = t; f->fb_block = b; From python-checkins at python.org Sat Oct 28 23:20:12 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:20:12 +0200 (CEST) Subject: [Python-checkins] r52505 - python/trunk/Objects/listobject.c Message-ID: <20061028212012.EA08C1E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:20:12 2006 New Revision: 52505 Modified: python/trunk/Objects/listobject.c Log: Prevent crash if alloc of garbage fails. Found by Typo.pl. Will backport. Modified: python/trunk/Objects/listobject.c ============================================================================== --- python/trunk/Objects/listobject.c (original) +++ python/trunk/Objects/listobject.c Sat Oct 28 23:20:12 2006 @@ -2608,6 +2608,11 @@ garbage = (PyObject**) PyMem_MALLOC(slicelength*sizeof(PyObject*)); + if (!garbage) { + Py_DECREF(seq); + PyErr_NoMemory(); + return -1; + } selfitems = self->ob_item; seqitems = PySequence_Fast_ITEMS(seq); From python-checkins at python.org Sat Oct 28 23:21:00 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:21:00 +0200 (CEST) Subject: [Python-checkins] r52506 - python/trunk/Objects/obmalloc.c Message-ID: <20061028212100.847F61E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:21:00 2006 New Revision: 52506 Modified: python/trunk/Objects/obmalloc.c Log: Don't inline Py_ADDRESS_IN_RANGE with gcc 4+ either. Will backport. Modified: python/trunk/Objects/obmalloc.c ============================================================================== --- python/trunk/Objects/obmalloc.c (original) +++ python/trunk/Objects/obmalloc.c Sat Oct 28 23:21:00 2006 @@ -691,7 +691,8 @@ #undef Py_ADDRESS_IN_RANGE -#if defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) +#if defined(__GNUC__) && ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) || \ + (__GNUC__ >= 4)) #define Py_NO_INLINE __attribute__((__noinline__)) #else #define Py_NO_INLINE From buildbot at python.org Sat Oct 28 23:25:23 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 21:25:23 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20061028212523.EA09E1E4004@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/465 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 Sat Oct 28 23:36:37 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:36:37 +0200 (CEST) Subject: [Python-checkins] r52507 - in python/branches/release25-maint: Modules/threadmodule.c Python/sysmodule.c Message-ID: <20061028213637.AB7681E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:36:37 2006 New Revision: 52507 Modified: python/branches/release25-maint/Modules/threadmodule.c python/branches/release25-maint/Python/sysmodule.c Log: Backport 52501: Add some asserts. In sysmodule, I think these were to try to silence some warnings from Klokwork. They verify the assumptions of the format of svn version output. The assert in the thread module helped debug a problem on HP-UX. Modified: python/branches/release25-maint/Modules/threadmodule.c ============================================================================== --- python/branches/release25-maint/Modules/threadmodule.c (original) +++ python/branches/release25-maint/Modules/threadmodule.c Sat Oct 28 23:36:37 2006 @@ -25,6 +25,7 @@ static void lock_dealloc(lockobject *self) { + assert(self->lock_lock); /* Unlock the lock so it's safe to free it */ PyThread_acquire_lock(self->lock_lock, 0); PyThread_release_lock(self->lock_lock); Modified: python/branches/release25-maint/Python/sysmodule.c ============================================================================== --- python/branches/release25-maint/Python/sysmodule.c (original) +++ python/branches/release25-maint/Python/sysmodule.c Sat Oct 28 23:36:37 2006 @@ -983,6 +983,8 @@ br_start = python + 8; br_end = strchr(br_start, '/'); + assert(br_end); + /* Works even for trunk, as we are in trunk/Python/sysmodule.c */ br_end2 = strchr(br_end+1, '/'); @@ -995,6 +997,8 @@ } else if (istag || strncmp(br_start, "branches", 8) == 0) { len = br_end2 - br_start; + assert(len >= 13); + assert(len < (sizeof(patchlevel_revision) - 13)); strncpy(branch, br_start, len); branch[len] = '\0'; From python-checkins at python.org Sat Oct 28 23:37:17 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:37:17 +0200 (CEST) Subject: [Python-checkins] r52508 - python/branches/release25-maint/Objects/dictobject.c python/branches/release25-maint/Objects/setobject.c Message-ID: <20061028213717.11FD11E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:37:16 2006 New Revision: 52508 Modified: python/branches/release25-maint/Objects/dictobject.c python/branches/release25-maint/Objects/setobject.c Log: Backport 52502: Fix warnings with HP's C compiler. It doesn't recognize that infinite loops are, um, infinite. These conditions should not be able to happen. Modified: python/branches/release25-maint/Objects/dictobject.c ============================================================================== --- python/branches/release25-maint/Objects/dictobject.c (original) +++ python/branches/release25-maint/Objects/dictobject.c Sat Oct 28 23:37:16 2006 @@ -307,6 +307,8 @@ else if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; } + assert(0); /* NOT REACHED */ + return 0; } /* @@ -366,6 +368,8 @@ if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; } + assert(0); /* NOT REACHED */ + return 0; } /* Modified: python/branches/release25-maint/Objects/setobject.c ============================================================================== --- python/branches/release25-maint/Objects/setobject.c (original) +++ python/branches/release25-maint/Objects/setobject.c Sat Oct 28 23:37:16 2006 @@ -179,6 +179,8 @@ if (entry->key == dummy && freeslot == NULL) freeslot = entry; } + assert(0); /* NOT REACHED */ + return 0; } /* From python-checkins at python.org Sat Oct 28 23:37:43 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:37:43 +0200 (CEST) Subject: [Python-checkins] r52509 - python/branches/release25-maint/Modules/_testcapimodule.c Message-ID: <20061028213743.1871F1E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:37:42 2006 New Revision: 52509 Modified: python/branches/release25-maint/Modules/_testcapimodule.c Log: Backport 52503: Fix crash in test on HP-UX. Apparently, it's not possible to delete a lock if it's held (even by the current thread). Modified: python/branches/release25-maint/Modules/_testcapimodule.c ============================================================================== --- python/branches/release25-maint/Modules/_testcapimodule.c (original) +++ python/branches/release25-maint/Modules/_testcapimodule.c Sat Oct 28 23:37:42 2006 @@ -667,6 +667,9 @@ PyThread_acquire_lock(thread_done, 1); /* wait for thread to finish */ Py_END_ALLOW_THREADS + /* Release lock we acquired above. This is required on HP-UX. */ + PyThread_release_lock(thread_done); + PyThread_free_lock(thread_done); Py_RETURN_NONE; } From python-checkins at python.org Sat Oct 28 23:38:44 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:38:44 +0200 (CEST) Subject: [Python-checkins] r52510 - in python/branches/release25-maint: Lib/test/test_syntax.py Misc/NEWS Python/compile.c Message-ID: <20061028213844.54DA31E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:38:43 2006 New Revision: 52510 Modified: python/branches/release25-maint/Lib/test/test_syntax.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Python/compile.c Log: Backport 52504: Fix bug #1565514, SystemError not raised on too many nested blocks. It seems like this should be a different error than SystemError, but I don't have any great ideas and SystemError was raised in 2.4 and earlier. 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 Sat Oct 28 23:38:43 2006 @@ -333,6 +333,37 @@ Traceback (most recent call last): ... SyntaxError: 'break' outside loop (, line 3) + +This should probably raise a better error than a SystemError (or none at all). +In 2.5 there was a missing exception and an assert was triggered in a debug +build. The number of blocks must be greater than CO_MAXBLOCKS. SF #1565514 + + >>> while 1: + ... while 2: + ... while 3: + ... while 4: + ... while 5: + ... while 6: + ... while 8: + ... while 9: + ... while 10: + ... while 11: + ... while 12: + ... while 13: + ... while 14: + ... while 15: + ... while 16: + ... while 17: + ... while 18: + ... while 19: + ... while 20: + ... while 21: + ... while 22: + ... break + Traceback (most recent call last): + ... + SystemError: too many statically nested blocks + """ import re Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sat Oct 28 23:38:43 2006 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Bug #1565514, SystemError not raised on too many nested blocks. + - Bug #1576174: WindowsError now displays the windows error code again, no longer the posix error code. Modified: python/branches/release25-maint/Python/compile.c ============================================================================== --- python/branches/release25-maint/Python/compile.c (original) +++ python/branches/release25-maint/Python/compile.c Sat Oct 28 23:38:43 2006 @@ -3738,8 +3738,11 @@ compiler_push_fblock(struct compiler *c, enum fblocktype t, basicblock *b) { struct fblockinfo *f; - if (c->u->u_nfblocks >= CO_MAXBLOCKS) + if (c->u->u_nfblocks >= CO_MAXBLOCKS) { + PyErr_SetString(PyExc_SystemError, + "too many statically nested blocks"); return 0; + } f = &c->u->u_fblock[c->u->u_nfblocks++]; f->fb_type = t; f->fb_block = b; From python-checkins at python.org Sat Oct 28 23:39:11 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:39:11 +0200 (CEST) Subject: [Python-checkins] r52511 - python/branches/release25-maint/Objects/listobject.c Message-ID: <20061028213911.042DB1E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:39:10 2006 New Revision: 52511 Modified: python/branches/release25-maint/Objects/listobject.c Log: Backport 52505: Prevent crash if alloc of garbage fails. Found by Typo.pl. Modified: python/branches/release25-maint/Objects/listobject.c ============================================================================== --- python/branches/release25-maint/Objects/listobject.c (original) +++ python/branches/release25-maint/Objects/listobject.c Sat Oct 28 23:39:10 2006 @@ -2606,6 +2606,11 @@ garbage = (PyObject**) PyMem_MALLOC(slicelength*sizeof(PyObject*)); + if (!garbage) { + Py_DECREF(seq); + PyErr_NoMemory(); + return -1; + } selfitems = self->ob_item; seqitems = PySequence_Fast_ITEMS(seq); From python-checkins at python.org Sat Oct 28 23:39:31 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:39:31 +0200 (CEST) Subject: [Python-checkins] r52512 - python/branches/release25-maint/Objects/obmalloc.c Message-ID: <20061028213931.BAED41E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:39:31 2006 New Revision: 52512 Modified: python/branches/release25-maint/Objects/obmalloc.c Log: Backport 52506: Don't inline Py_ADDRESS_IN_RANGE with gcc 4+ either. Modified: python/branches/release25-maint/Objects/obmalloc.c ============================================================================== --- python/branches/release25-maint/Objects/obmalloc.c (original) +++ python/branches/release25-maint/Objects/obmalloc.c Sat Oct 28 23:39:31 2006 @@ -691,7 +691,8 @@ #undef Py_ADDRESS_IN_RANGE -#if defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) +#if defined(__GNUC__) && ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) || \ + (__GNUC__ >= 4)) #define Py_NO_INLINE __attribute__((__noinline__)) #else #define Py_NO_INLINE From buildbot at python.org Sat Oct 28 23:43:43 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 21:43:43 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20061028214343.213871E4005@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/1700 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sat Oct 28 23:47:00 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 21:47:00 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20061028214700.5CA771E4035@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/1604 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sat Oct 28 23:56:50 2006 From: python-checkins at python.org (neal.norwitz) Date: Sat, 28 Oct 2006 23:56:50 +0200 (CEST) Subject: [Python-checkins] r52513 - python/trunk/Lib/test/test_modulefinder.py Message-ID: <20061028215650.8FB341E4004@bag.python.org> Author: neal.norwitz Date: Sat Oct 28 23:56:49 2006 New Revision: 52513 Modified: python/trunk/Lib/test/test_modulefinder.py Log: Fix test_modulefinder so it doesn't fail when run after test_distutils. Modified: python/trunk/Lib/test/test_modulefinder.py ============================================================================== --- python/trunk/Lib/test/test_modulefinder.py (original) +++ python/trunk/Lib/test/test_modulefinder.py Sat Oct 28 23:56:49 2006 @@ -257,6 +257,7 @@ self._do_test(relative_import_test_2) def test_main(): + distutils.log.set_threshold(distutils.log.WARN) test_support.run_unittest(ModuleFinderTest) if __name__ == "__main__": From buildbot at python.org Sun Oct 29 00:05:51 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 22:05:51 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20061028220552.071941E4004@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/1529 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 00:12:27 2006 From: python-checkins at python.org (neal.norwitz) Date: Sun, 29 Oct 2006 00:12:27 +0200 (CEST) Subject: [Python-checkins] r52514 - python/trunk/Doc/lib/libctypes.tex Message-ID: <20061028221227.EBC0C1E4005@bag.python.org> Author: neal.norwitz Date: Sun Oct 29 00:12:26 2006 New Revision: 52514 Modified: python/trunk/Doc/lib/libctypes.tex Log: >From SF 1557890, fix problem of using wrong type in example. Will backport. Modified: python/trunk/Doc/lib/libctypes.tex ============================================================================== --- python/trunk/Doc/lib/libctypes.tex (original) +++ python/trunk/Doc/lib/libctypes.tex Sun Oct 29 00:12:26 2006 @@ -1821,7 +1821,7 @@ \begin{quote} \begin{verbatim}>>> from ctypes import c_int, WINFUNCTYPE, windll >>> from ctypes.wintypes import HWND, LPCSTR, UINT ->>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, c_uint) +>>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT) >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0) >>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags) >>>\end{verbatim} From python-checkins at python.org Sun Oct 29 00:13:23 2006 From: python-checkins at python.org (neal.norwitz) Date: Sun, 29 Oct 2006 00:13:23 +0200 (CEST) Subject: [Python-checkins] r52515 - python/branches/release25-maint/Doc/lib/libctypes.tex Message-ID: <20061028221323.587731E4004@bag.python.org> Author: neal.norwitz Date: Sun Oct 29 00:13:22 2006 New Revision: 52515 Modified: python/branches/release25-maint/Doc/lib/libctypes.tex Log: >From SF 1557890, fix problem of using wrong type in example. Modified: python/branches/release25-maint/Doc/lib/libctypes.tex ============================================================================== --- python/branches/release25-maint/Doc/lib/libctypes.tex (original) +++ python/branches/release25-maint/Doc/lib/libctypes.tex Sun Oct 29 00:13:22 2006 @@ -1821,7 +1821,7 @@ \begin{quote} \begin{verbatim}>>> from ctypes import c_int, WINFUNCTYPE, windll >>> from ctypes.wintypes import HWND, LPCSTR, UINT ->>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, c_uint) +>>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT) >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0) >>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags) >>>\end{verbatim} From buildbot at python.org Sun Oct 29 01:46:11 2006 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Oct 2006 23:46:11 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian trunk Message-ID: <20061028234611.46C361E4004@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/466 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 Sun Oct 29 02:47:20 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 00:47:20 +0000 Subject: [Python-checkins] buildbot warnings in x86 Ubuntu edgy (icc) trunk Message-ID: <20061029004720.9B45F1E4004@bag.python.org> The Buildbot has detected a new failure of x86 Ubuntu edgy (icc) trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520Ubuntu%2520edgy%2520%2528icc%2529%2520trunk/builds/1039 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From ncoghlan at gmail.com Sun Oct 29 02:43:55 2006 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 29 Oct 2006 11:43:55 +1000 Subject: [Python-checkins] r52500 - python/trunk/Lib/test/test_grammar.py In-Reply-To: <20061028202510.86C441E4004@bag.python.org> References: <20061028202510.86C441E4004@bag.python.org> Message-ID: <4544075B.7080308@gmail.com> georg.brandl wrote: > Author: georg.brandl > Date: Sat Oct 28 22:25:09 2006 > New Revision: 52500 > > Modified: > python/trunk/Lib/test/test_grammar.py > Log: > make test_grammar pass with python -O > > > Modified: python/trunk/Lib/test/test_grammar.py > ============================================================================== > --- python/trunk/Lib/test/test_grammar.py (original) > +++ python/trunk/Lib/test/test_grammar.py Sat Oct 28 22:25:09 2006 > @@ -544,8 +544,10 @@ > assert 0, "msg" > except AssertionError, e: > self.assertEquals(e.args[0], "msg") > - else: > - self.fail("AssertionError not raised by assert 0") > + # we can not expect an assertion error to be raised > + # if the tests are run in an optimized python > + #else: > + # self.fail("AssertionError not raised by assert 0") Wouldn't a __debug__ check be a better option here, instead of commenting the test out completely?: else: # we cannot expect an assertion error to be raised # if the tests are run in an optimized python if __debug__: self.fail("AssertionError not raised by assert 0") Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From python-checkins at python.org Sun Oct 29 02:46:09 2006 From: python-checkins at python.org (brett.cannon) Date: Sun, 29 Oct 2006 02:46:09 +0100 (CET) Subject: [Python-checkins] r52516 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061029014609.BD9271E4017@bag.python.org> Author: brett.cannon Date: Sun Oct 29 02:46:08 2006 New Revision: 52516 Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Rework the loader/handler API once more. Now all loading of data is done through the loader. The handler handles calling the loader as needed to get the information it needs. Allows their to be a clear separation between loaders and handlers in terms of who touches the storage back-end that code is fetched from and the handling of that code. Tests are not complete yet (will be soon). Beyond the usual thanks to Paul Moore for this project, Nick Coghlan gets a "thank you" tossed his way for helping to flesh all of this out. Modified: sandbox/trunk/import_in_py/importer.py ============================================================================== --- sandbox/trunk/import_in_py/importer.py (original) +++ sandbox/trunk/import_in_py/importer.py Sun Oct 29 02:46:08 2006 @@ -64,7 +64,7 @@ * Python/marshal.c:r_long()/w_long() -Py3Kk +Py3k ==== Improvements ------------ @@ -98,23 +98,14 @@ type of object. -API Ideas -========= -* Move most of API out of handlers and into loaders. - + Most of the methods in PyPycFileHandler are to deal with files which is a - loader thing. - + Basic ideas already there in optional API for loaders from PEP 302, just - not enough for .pyc regeneration and verification. - - Use Cases ========= PTL --- * Use filesystem importer and loader. -* Subclass PyPycFileHandler +* Subclass PyPycHandler + Set source_handles to '.ptl' and bytecode to '.ptlc'. - + get_code_from_source() + + code_from_source() - Handle transforming to pure Python code here. sqlite3 @@ -126,34 +117,14 @@ * Set to NULL when source code is modified, which removes need of storing the bytecode's timestamp. - Magic number for bytecode. + - Anything about handling packages? + Importer - Query DB to see if module is listed. - Whether it is in bytecode or source form is irrelevant. + Loader - See if bytecode is in DB; if so then have that used, otherwise source. - - Pass in tuple of DB instance and requested module. -+ Subclass PyPycBaseHandler - - Have both source and bytecode opaque objects be a tuple of the DB - instance and the module name that is being handled. - - get_bytecode() - * Reads DB and returns magic number, 0 for timestamp, and bytecode. - * Timestamp is unneeded as existence of bytecode implicitly means - that it is not outdated. - - find_source() - * Can return same tuple as passed into handle_code(). - - verify_timestamp() - * ``return True``. - - get_code_from_source() - * Get source from DB. - * compile. - * return code object and 0 for timestamp. - - write_bytecode() - * Get marshalled string from code object. - * Write marshalled string to DB. - * Write current magic number to DB. - - get_location() - * Return the path to the DB and the module name. - * Could even return SQL statement to get module if one cared. + - Implement API needed by PyPycHandler for free bytecode recreation. ++ Use PyPycHandler. """ from __future__ import with_statement @@ -282,20 +253,23 @@ if os.path.isfile(file_path): raise StopIteration("file found") except StopIteration: - return FileSystemLoader(file_path, handler, file_ext) + return FileSystemLoader(file_path, handler) else: return None class FileSystemLoader(object): - """Loader for the filesystem.""" + """Loader for the filesystem. + + It implements the needed API for the PyPycHandler. + + """ - def __init__(self, file_path, handler, chosen_handle): + def __init__(self, file_path, handler): """Store arguments on to the instance.""" self.file_path = file_path self.handler = handler - self.chosen_handle = chosen_handle def load_module(self, fullname, path=None): """Load the module from self.path using self.handler. @@ -308,51 +282,55 @@ try: return sys.modules[fullname] except KeyError: - new_module = imp.new_module(fullname) - # Need an entry in sys.modules in order to prevent any problems - # with circular imports. - sys.modules[fullname] = new_module - # If handler returns a different module these should already be - # set. - new_module.__file__ = self.file_path - new_module.__name__ = fullname try: - module = self.handler.handle_code(new_module, self.file_path, - self.chosen_handle) + module = self.handler.handle_code(self, fullname, self.file_path) except: - del sys.modules[fullname] + if fullname in sys.modules: + del sys.modules[fullname] raise - # Needs to be set regardless of whether passed-in module was used - # or not. - module.__loader__ = self - # Need to return what the handler gave us back as they may not have - # used the module we gave them. return module + + def mod_time(self, path): + """Return the modification time for the specified path.""" + return os.stat(path).st_mtime + + def split_path(self, path): + """Split the specified path into a base path and the type of the + path.""" + return os.path.splitext(path) + + def create_path(self, base_path, type_): + """Create a new path based on a base path and requested path type. + + If the created path does not exist, return None. + + """ + path = base_path + type_ + return path if os.path.exists(path) else None + + def read_data(self, path, binary=False): + """Open the path and return the data read from it in the specified + format.""" + with open(path, 'rb' if binary else 'U') as data_file: + data = data_file.read() + return data + + def write_data(self, data, path, binary=False): + """Write data to a specified path as either binary or textual data.""" + with open(path, 'wb' if binary else 'w') as data_file: + data_file.write(data) -class PyPycBaseHandler(object): +class PyPycHandler(object): - """Superclass for reading bytecode and/or source code for initializing a - module (with optional recreating of bytecode as needed). + """Handle reading Python bytecode/source with writing out of bytecode as + needed. - The entry point of the class is handle_code(). All other methods are - provided for overriding to control how bytecode/source handling algorithm - gets what it needs. handle_code() treats source code and bytecode as - opaque objects that are passed around to the proper methods for handling. - This allows storage back-ends to use the algorithm in handle_code() while - not having to worry about any assumptions about how source or bytecode are - dealt with. It also allows for possible source or bytecode translations - before a code object is expected for initializing the module. - - To suppress the implicit use of source code when handling bytecode (or to - suppress writing new bytecode when handling source code), set the proper - argument passed to the object initializer to a False value. This allows - for subclasses to skip having to implement support for handling source code - (or bytecode) if it is not needed/desired. + The handle_code method is the key entry point for this class. """ - def __init__(self, source_handles, bytecode_handles): + def __init__(self, source_handles=None, bytecode_handles=None): """Specify the handles for source and bytecode to be handled by this handler and set 'handles' appropriately. @@ -360,222 +338,134 @@ value for the appropriate argument. """ - if not source_handles: - self.source_handles = tuple() + if source_handles is None: + self.source_handles = ('.py',) else: self.source_handles = source_handles - if not bytecode_handles: - self.bytecode_handles = tuple() + if bytecode_handles is None: + self.bytecode_handles = ('.pyc',) if __debug__ else ('.pyo',) else: self.bytecode_handles = bytecode_handles self.handles = self.bytecode_handles + self.source_handles - def find_source_to_read(self, opaque_bytecode): - """Return the opaque source object corresponding to the opaque - bytecode object for reading, or None if no corresponding source exists. - - Meant to be overridden as needed (always returns None otherwise). - - """ - return None - - def find_bytecode_to_write(self, opaque_source): - """Return the opaque bytecode object that corresponds to the opaque - source object for writing, or None if no corresponding bytecode exists. - - Meant to be overridden as needed (always returns None otherwise). - - """ - return None - - def get_location(self, opaque_code): - """Return the "location" of the opaque object.""" - raise NotImplementedError - - def get_bytecode(self, opaque_bytecode): - """Return the magic number, timestamp, and bytecode from the opaque - bytecode object.""" - raise NotImplementedError - - def get_code_from_bytecode(self, bytecode): - """Return the code object created from the bytecode.""" - return marshal.loads(bytecode) + def new_module(self, name): + """Retun a new module to be initialized (with __name__ set).""" + return imp.new_module(name) + + def parse_pyc(self, data): + """Split data into magic number, timestamp, and bytecode.""" + # XXX Does not work properly until unmarshaling longs works. + #return int(data[:4]), int(data[4:8]), data[8:] + return imp.get_magic(), 0, data[8:] - def verify_magic(self, magic_number): - """Compare the given magic_number against the one the interpreter - uses.""" + def check_magic(self, magic): + """Check whether the magic number is valid or not.""" return True - # XXX Won't work until can unmarshal longs. - return True if magic_number == imp.get_magic() else False + # XXX cannot work until can unmarshal long. + #return imp.get_magic() == magic - def verify_timestamp(self, timestamp, opaque_source): - """Verify the timestamp against the opaque source object.""" - raise NotImplementedError - - def get_code_from_source(self, opaque_source): - """Return a code object created from the opaque source object along - with the timestamp of the opaque object. - - The timestamp needs to be returned for possible recreation of the - bytecode. This is to prevent the possible race condition where the - bytecode's timestamp is used; if the source is modified between reading - it and the writing out of the bytecode then the bytecode would not be - recreated. - - """ - raise NotImplementedError + def code_from_bytecode(self, bytecode): + """Create a code object from bytecode.""" + return marshal.loads(bytecode) - def write_bytecode(self, code_object, opaque_bytecode, timestamp): - """Dump the code object on to the opaque bytecode object using the - specified timestamp.""" - raise NotImplementedError - - def handle_code(self, module, opaque_code, handle_this): - """Initialize the module using the opaque code object (treating it as - specified by the passed-in handle). - - If an opaque bytecode object was passed in, first verify its magic - number and timestamp. If it checks out, it will be used to initialize - the module. If the bytecode is invalid, then try to fetch the - corresponding source code. If it can be found, use it and recreate - the bytecode if possible (if bytecode cannot be recreated, assign the - proper value to __file__). If no source can be found, raise - ImportError. - - If an opaque source object was given, use it to initialize the module. - Also recreate the bytecode (if desired based on whether any bytecode - handles are listed) since either it does not exist yet (based - on the fact that bytecode are listed to be handled first) or it - was found to be invalid. - - """ - if handle_this in self.bytecode_handles: - # Asked to handle bytecode. + def code_from_source(self, source, path): + """Create a code object from source.""" + return compile(source, path, 'exec') + + def create_pyc(self, bytecode, timestamp): + """Create data for a .pyc file.""" + #XXX Does not work properly until direct marshaling of longs is possible. + data = imp.get_magic() + data += str(timestamp) + data += marshal.dumps(bytecode) + return data + + def handle_code(self, loader, mod_name, path): + """Handle creating a new module object that is initialized from Python + bytecode or source. + + The loader needs to implement several methods in order to this handler + to be able to load needed data. A key point with some of these methods + is the idea of opaque code objects which are not directly touched by + the handler but are passed back to the loader so as to allow for a way + to keep state for the loader: + * split_path(path) + Take in an opaque path object and split it into a base path and a + string representing the type of the path (which should be in the + 'handles' attribute of the handler). + * create_path(base_path, type_) + Create an opaque path object from a base path and the type of path + that is desired. + * mod_time(path) + Return the last modification time for a path. + * read_data(path, binary) + Read the data from the specified path. 'binary' is a boolean that + flags whether the data should be read as binary data or text data. + * write_data(data, path, binary) + Write data to a path. 'binary' flags whether the data should be + written as binary or textual data. + + """ + # XXX Does not worry about packages. + source_path = None + source_timstamp = None + bytecode_path = None + module = self.new_module(mod_name) + module.__loader__ = loader + sys.modules[mod_name] = module + base_path, type_ = loader.split_path(path) + if type_ in self.bytecode_handles: + # Attempt to use bytecode. + bytecode_path = path + source_path = None + pyc_data = loader.read_data(path, True) + magic, pyc_timestamp, bytecode = self.parse_pyc(pyc_data) + # Try to find corresponding source code. + for source_handle in self.source_handles: + source_path = loader.create_path(base_path, source_handle) + if source_path: + break try: - magic, timestamp, bytecode = self.get_bytecode(opaque_code) - # Need source code no matter what (if source code is supported - # by handler); for timestamp check or to see if source can be - # used if magic number check failed. - if self.source_handles: - opaque_source = self.find_source_to_read(opaque_code) - else: - opaque_source = None - if not self.verify_magic(magic): + # Verify that the magic number is valid. + if not self.check_magic(magic): raise ImportError("bad magic number") - if (opaque_source and - not self.verify_timestamp(timestamp, opaque_source)): - raise ImportError("outdated timestamp") - except ImportError, exc: - if not self.source_handles or not opaque_source: - # Bytecode invalid and no source to recreate from, so error - # out. - raise - else: - # Bytecode invalid, but source exists to work from. - pass - else: + # Verify that the bytecode is not stale. + if source_path: + source_timestamp = loader.mod_time(source_path) + # XXX Check does not work until long (un)marshaling. + # XXX if pyc_timestamp < source_timestamp: + if False: + raise ImportError("bytcode is stale") # Bytecode is valid. - code_object = self.get_code_from_bytecode(bytecode) + module.__file__ = path + code_object = self.code_from_bytecode(bytecode) exec code_object in module.__dict__ return module - # Either the handler was requested to handle source or the bytecode was - # found to be stale. Regardless, source code was already fetched. - if handle_this in self.source_handles: - # Requested to handle source. - opaque_source = opaque_code - code_object, timestamp = self.get_code_from_source(opaque_source) - elif self.bytecode_handles: - # Bytecode was invalid. - code_object, timestamp = self.get_code_from_source(opaque_source) - else: - # Should never be reached; importer should have stated that module - # could not be imported. - raise ImportError("no source or bytecode handles specified") - exec code_object in module.__dict__ - if self.bytecode_handles: - opaque_bytecode = self.find_bytecode_to_write(opaque_source) - if opaque_bytecode: - # Recreate bytecode. - self.write_bytecode(code_object, opaque_bytecode, timestamp) - else: - # Need to reassign __name__ since bytecode that was supposed - # to use was bad and we could not update to make it as if we - # has used it. - module.__file__ = self.get_location(opaque_source) + except ImportError: + # No source code to use to recover from bad bytecode. + if not source_path: + raise + if type_ in self.source_handles: + # Asked directly to handle source code. + source_path = path + # Get the source code. + source = loader.read_data(source_path, False) + module.__file__ = source_path + code = self.code_from_source(source, source_path) + # See if there is a corresponding path to bytecode. + if not bytecode_path: + for bytecode_handle in self.bytecode_handles: + bytecode_path = loader.create_path(base_path, + bytecode_handle) + if bytecode_path: + source_timestamp = loader.mod_time(source_path) + break + # If there is a possible path to bytecode, generate .pyc file. + if bytecode_path: + pyc = self.create_pyc(code, source_timestamp) + loader.write_data(pyc, path, True) + exec code in module.__dict__ return module - - -class PyPycFileHandler(PyPycBaseHandler): - - """Handler for source code and bytecode files. - - All methods that work with opaque objects expect file paths. - - """ - - def __init__(self, source_handles=None, bytecode_handles=None): - """Set the file extensions to be handled. - - Not passing an argument (or setting to None) for either type of file - extension will lead to default values being used. - - """ - if source_handles is None: - source_handles = ('.py',) - if bytecode_handles is None: - bytecode_handles = ('.pyc',) if __debug__ else ('.pyo',) - super(PyPycFileHandler, self).__init__(source_handles, - bytecode_handles) - - def find_source_to_read(self, bytecode_file): - """Return the file object to the corresponding source code.""" - base, ext = os.path.splitext(self.get_location(bytecode_file)) - return base + self.source_handles[-1] - - def find_bytecode_to_write(self, source_file): - """Return the file object to the corresponding bytecode.""" - base, ext = os.path.splitext(self.get_location(source_file)) - return base + self.bytecode_handles[-1] - - def get_location(self, file_path): - """Return the path to the file object.""" - return file_path - - def get_bytecode(self, bytecode_path): - """Return the magic number, timestamp, and bytecode from the bytecode - file path.""" - with open(bytecode_path, 'rb') as bytecode_file: - magic = bytecode_file.read(4) - timestamp = bytecode_file.read(4) - bytecode = bytecode_file.read() - # XXX Need Python/marshal.c:r_long() to properly convert magic number - # and timestamp. - return magic, timestamp, bytecode - - def verify_timestamp(self, bytecode_timestamp, source_path): - """Verify that 'timestamp' is newer than the modification time for - 'source_path'.""" - return True - # XXX Won't work until can unmarshal longs. - source_timestamp = os.stat(source_path).st_mtime - return source_timestamp <= bytecode_timestamp - - def get_code_from_source(self, source_path): - """Return the code object created from the source code path and the - timestamp on the source file.""" - with open(source_path, 'U') as source_file: - source_code = source_file.read() - timestamp = os.stat(source_path).st_mtime - code_object = compile(source_code, source_path, - 'exec') - return code_object, timestamp - - def write_bytecode(self, code_object, bytecode_path, timestamp): - """Write out code_object to the file location bytecode_path with the - passed-in timestamp.""" - # XXX w/o being able to marshal longs, we need to use py_compile. - source_path = self.find_source_to_read(bytecode_path) - py_compile.compile(source_path, bytecode_path, doraise=True) class ExtensionFileHandler(object): @@ -587,9 +477,9 @@ self.handles = tuple(suffix[0] for suffix in imp.get_suffixes() if suffix[2] == imp.C_EXTENSION) - def handle_code(self, module, extension_path, to_handle): + def handle_code(self, loader, mod_name, extension_path): """Import an extension module.""" - return imp.load_dynamic(module.__name__, extension_path) + return imp.load_dynamic(mod_name, extension_path) class Importer(object): @@ -615,7 +505,7 @@ # Create a handler to deal with extension modules, .py, and .pyc # files. Built-in and frozen modules are handled by sys.meta_path # entries. - handlers = ExtensionFileHandler(), PyPycFileHandler() + handlers = ExtensionFileHandler(), PyPycHandler() self.default_path_hook = FileSystemFactory(*handlers) def search_meta_path(self, name): 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 Sun Oct 29 02:46:08 2006 @@ -172,7 +172,7 @@ def setUp(self): """Create a basic importer.""" super(FileSystemImporterTests, self).setUp() - source_handler = importer.PyPycFileHandler(bytecode_handles=False) + source_handler = importer.PyPycHandler(bytecode_handles=tuple()) self.importer = importer.FileSystemImporter(self.directory, source_handler) @@ -181,7 +181,7 @@ 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.PyPycFileHandler)) + self.failUnless(isinstance(loader.handler, importer.PyPycHandler)) def test_find_module_cannot_find(self): # Should return None if it can't find the module. @@ -190,14 +190,14 @@ def test_find_module_multiple_handlers(self): # Modules should be found based on the order of the handlers. - source_handler = importer.PyPycFileHandler(bytecode_handles=False) - bytecode_handler = importer.PyPycFileHandler(source_handles=False) + source_handler = importer.PyPycHandler(bytecode_handles=tuple()) + bytecode_handler = importer.PyPycHandler(source_handles=tuple()) fs_importer = importer.FileSystemImporter(self.directory, bytecode_handler, source_handler) 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.PyPycFileHandler)) + self.failUnless(isinstance(loader.handler, importer.PyPycHandler)) def test_find_to_load(self): # Make sure that one can go from find_module() to getting a module @@ -209,17 +209,16 @@ self.failUnlessEqual(module, sys.modules[self.module]) -class FileSystemLoaderTests(PyPycFileHelper): +class FileSystemLoaderBlackBoxTests(PyPycFileHelper): - """Test the filesystem loader.""" + """Test the filesystem loader's PEP 302 API compliance.""" def setUp(self): """Create a fresh loader per run.""" - super(FileSystemLoaderTests, self).setUp() - source_handler = importer.PyPycFileHandler(bytecode_handles=False) + super(FileSystemLoaderBlackBoxTests, self).setUp() + source_handler = importer.PyPycHandler(bytecode_handles=tuple()) self.loader = importer.FileSystemLoader(self.source_path, - source_handler, - source_handler.handles[0]) + source_handler) def test_load_module_fresh(self): # Test a basic module load where there is no sys.modules entry. @@ -240,316 +239,129 @@ def handle_code(*args): raise ImportError - loader = importer.FileSystemLoader(self.source_path, RaiseErrorHandler(), 'A') + loader = importer.FileSystemLoader(self.source_path, RaiseErrorHandler()) try: loader.load_module(self.module) except ImportError: self.failUnless(self.module not in sys.modules) - - -class PyPycBaseHandlerTests(PyPycFileHelper): + + +class FileSystemLoaderWhiteBoxTests(PyPycFileHelper): - """Test py/pyc base handler class.""" + """Test the filesystem loader's non-PEP 302 API.""" def setUp(self): - """Create a basic handler instance.""" - super(PyPycBaseHandlerTests, self).setUp() - self.handler = importer.PyPycBaseHandler(False, False) - - def test_init(self): - # Make sure initialization does what it needs to do. - self.failUnlessEqual(self.handler.handles, tuple()) - handler = importer.PyPycBaseHandler(('B',), ('A',)) - self.failUnlessEqual(handler.handles, ('A', 'B')) - handler= importer.PyPycBaseHandler(('A',), False) - self.failUnlessEqual(handler.handles, ('A',)) - handler = importer.PyPycBaseHandler(False, ('A',)) - self.failUnlessEqual(handler.handles, ('A',)) - - def test_not_implemented(self): - # The test methods should all raise NotImplementedError - one_argument = (self.handler.get_location, self.handler.get_bytecode, - self.handler.get_code_from_source) - for method in one_argument: - self.failUnlessRaises(NotImplementedError, method, None) - self.failUnlessRaises(NotImplementedError, - self.handler.verify_timestamp, None, None) - self.failUnlessRaises(NotImplementedError, - self.handler.write_bytecode, None, None, None) - - def test_find_source_to_read(self): - # Should return None no matter what the arguments. - self.failUnlessEqual(self.handler.find_source_to_read(None), None) - - def test_find_bytecode_to_write(self): - # Should return None regardless of its argument. - self.failUnlessEqual(self.handler.find_bytecode_to_write(None), None) - - def test_get_code_from_bytecode(self): - # Make sure you can parse a bytecode file. - handler = importer.PyPycBaseHandler(False, False) - code_object = handler.get_code_from_bytecode(self.bytecode) - exec code_object in self.module_object.__dict__ - self.verify_module(self.module_object) - - def test_verify_magic(self): - # Test checking the magic number for bytecode. - return # XXX - self.failUnless(self.handler.verify_magic(imp.get_magic())) - self.failUnless(not self.handler.verify_magic(imp.get_magic()-1)) - - def test_invalid_handler(self): - # If handle_code is called with a handler that is not registered, - # ImportError should be raised. - self.failUnlessRaises(ImportError, self.handler.handle_code, - None, None, 'A') - - def test_source_only_API(self): - # If only a source handle is registered, make sure bytecode-related - # methods are not called. - class SourceOnlyAPITester(importer.PyPycBaseHandler): - def __init__(self, tester, source_handles, bytecode_handles): - super(SourceOnlyAPITester, self).__init__(source_handles, - bytecode_handles) - self.tester = tester - def verify_magic(self, ignore): - """Normally implemented, but should not be called.""" - raise NotImplementedError - def find_bytecode_to_write(self, ignore): - """Normally returns None, but should not be called.""" - raise NotImplementedError - def get_code_from_bytecode(self, ignore): - """Normally implemented, but should not be called.""" - raise NotImplementedError - def get_code_from_source(self, ignore): - return self.tester.code_object, 0 - - handler = SourceOnlyAPITester(self, ('A',), False) - handler.handle_code(self.module_object, None, 'A') - self.verify_module(self.module_object) - - def test_bytecode_only_API(self): - # If only bytecode handle registered then only bytecode-related - # methods should be called. - class BytecodeOnlyAPITester(importer.PyPycBaseHandler): - def verify_timestamp(self, ignore, ignore2): - return True - def get_bytecode(self, bytecode): - return imp.get_magic(), 0, bytecode - - handler = BytecodeOnlyAPITester(False, ('A',)) - handler.handle_code(self.module_object, self.bytecode, 'A') - self.verify_module(self.module_object) - - def test_bad_magic(self): - # If bytecode returns a bad magic number and there is no corresponding - # source, then ImportError should be raised. - class Tester(importer.PyPycBaseHandler): - def get_bytecode(self, bytecode): - return 0, 0, bytecode - def verify_magic(self, ignore): - return False - - handler = Tester(False, ('A',)) - self.failUnlessRaises(ImportError, handler.handle_code, - self.module_object, self.bytecode, 'A') - - def test_bad_timestamp(self): - # If bytecode fails timestamp, source should be used. - class Tester(importer.PyPycBaseHandler): - def get_bytecode(self, ignore): - return 0, 0, 0 - def verify_magic(self, ignore): - return True - def verify_timestamp(self, ignore, ignore2): - return False - def find_source_to_read(self, ignore): - """Assign code_object after instantiation.""" - return self.code_object - def find_bytecode_to_write(self, ignore): - return 'bytecode found' - def get_code_from_source(self, code_object): - return code_object, 0 - def write_bytecode(self, code_object, bytecode, timestamp): - if bytecode != 'bytecode found': - raise ValueError - if self.code_object is not code_object: - raise ValueError - if timestamp != 0: - raise ValueError - - handler = Tester(('B',), ('A',)) - handler.code_object = self.code_object - handler.handle_code(self.module_object, None, 'A') - self.verify_module(self.module_object) - - # Test that if bytecode cannot be found, write_bytecode is not called. - # Also verify that get_location is called and result is used for - # module.__file__ . - Tester.find_bytecode_to_write = lambda ignore, ignore2: None - Tester.write_bytecode = lambda ignore, ignore2, ignore3, ignore4: 1 / 0 - Tester.get_location = lambda ignore, ignore2: 'get_location' - new_module = new.module(self.module) - handler.handle_code(new_module, None, 'A') - self.failUnlessEqual(new_module.__file__, 'get_location') - self.verify_module(new_module) - - def test_write_bytecode(self): - # If source is passed in, then bytecode should be written out. - # Writing out of bytecode when it was invalid is tested in - # test_bad_timestamp. - class Tester(importer.PyPycBaseHandler): - def find_bytecode_to_write(self, ignore): - return 'find_bytecode' - def get_code_from_source(self, code_object): - """Knowing that this method's return value is passed to - write_bytecode, store away for later comparison.""" - self.code_object = code_object - return code_object, 0 - def write_bytecode(self, code_object, bytecode_loc, timestamp): - if bytecode_loc != 'find_bytecode': - raise ValueError - if code_object is not self.code_object: - raise ValueError - if timestamp != 0: - raise ValueError - - handler = Tester(('A',), ('B',)) - handler.handle_code(self.module_object, self.code_object, 'A') - self.verify_module(self.module_object) + """Create a loader.""" + super(FileSystemLoaderWhiteBoxTests, self).setUp() + source_handler = importer.PyPycHandler(bytecode_handles=tuple()) + self.loader = importer.FileSystemLoader(self.source_path, + source_handler) + + def test_mod_time(self): + # Modification time for the passed-in path should match the file. + true_mod_time = os.stat(self.source_path).st_mtime + mod_time = self.loader.mod_time(self.source_path) + self.failUnlessEqual(mod_time, true_mod_time) + + def test_split_path(self): + # Should split a path just like os.path.splitext(). + true_split_path = os.path.splitext(self.source_path) + split_path = self.loader.split_path(self.source_path) + self.failUnlessEqual(split_path, true_split_path) + + def test_create_path(self): + # Should work like concatenating two strings. + true_path = ''.join(self.loader.split_path(self.source_path)) + path = self.loader.create_path(*self.loader.split_path( + self.source_path)) + self.failUnlessEqual(path, true_path) + + def test_read_data(self): + # Should be able to read a file. + source = self.loader.read_data(self.source_path, False) + self.failUnlessEqual(source, self.source) + # XXX Binary reads. + + def test_write_data(self): + # Should be able to write a file. + self.loader.write_data(self.source, self.source_path, False) + read_source = self.loader.read_data(self.source_path, False) + self.failUnlessEqual(read_source, self.source) + # XXX Binary writes. -class PyPycFileHandlerTests(PyPycFileHelper): +class PyPycHandlerSupportingMethodTests(PyPycFileHelper): - """Test the py/pyc filesystem handler.""" + """Test the py/pyc handler.""" def setUp(self): - """Create an instance that can handle source and bytecode.""" - super(PyPycFileHandlerTests, self).setUp() - self.handler = importer.PyPycFileHandler() + super(PyPycHandlerSupportingMethodTests, self).setUp() + self.handler = importer.PyPycHandler() def test_init(self): - # Make sure 'handles' ends up being set properly. - expected_bytecode_ext = '.pyc' if __debug__ else '.pyo' - self.failUnlessEqual(self.handler.handles, - (expected_bytecode_ext, '.py')) - handler = importer.PyPycFileHandler(('A',)) - self.failUnlessEqual(handler.handles, - (expected_bytecode_ext, 'A')) - handler = importer.PyPycFileHandler(bytecode_handles=('A',)) - self.failUnlessEqual(handler.handles, ('A', '.py')) - handler = importer.PyPycFileHandler(('A',), ('B',)) - self.failUnlessEqual(handler.handles, ('B', 'A')) - - def test_get_location(self): - # Should return the value on the 'name' attribute of its argument. - self.failUnlessEqual(self.handler.get_location('path'), 'path') - - def test_get_code_from_source(self): - # Should be able to read from a file object and return a code object. - result = self.handler.get_code_from_source(self.source_path) - code_object, timestamp = result - exec code_object in self.module_object.__dict__ - self.verify_module(self.module_object) - source_timestamp = os.stat(self.source_path).st_mtime - self.failUnlessEqual(timestamp. source_timestamp) - - def test_find_source_to_read(self): - # Should be able to deduce .py file from .pyc file. - source_file_path = self.handler.find_source_to_read(self.bytecode_path) - self.failUnlessEqual(source_file_path, self.source_path) - - def test_find_bytecode_to_write(self): - # Should be able to deduce .pyc file from .py file. - bytecode_path = self.handler.find_bytecode_to_write(self.source_path) - self.failUnlessEqual(bytecode_path, self.bytecode_path) - - def test_get_bytecode(self): - # Magic number should be good - result = self.handler.get_bytecode(self.bytecode_path) - magic, timestamp, bytecode = result - # XXX self.failUnlessEqual(magic, imp.get_magic()) - source_timestamp = os.stat(self.source_path).st_mtime - # XXX self.failUnlessEqual(timestamp, source_timestamp) - code_object = marshal.loads(bytecode) - exec code_object in self.module_object.__dict__ - self.verify_module(self.module_object) - - def test_verify_timestamp(self): - source_timestamp = os.stat(self.source_path).st_mtime - result = self.handler.verify_timestamp(source_timestamp, - self.source_path) - self.failUnless(result) - - def test_get_code_from_source(self): - result = self.handler.get_code_from_source(self.source_path) - code_object, timestamp = result - exec code_object in self.module_object.__dict__ - self.verify_module(self.module_object) - source_timestamp = os.stat(self.source_path).st_mtime - self.failUnlessEqual(timestamp, source_timestamp) - - def test_write_bytecode(self): - # Writing out the bytecode file should have the current magic number, - # a timestamp of the source file, and correct bytecode. - os.remove(self.bytecode_path) - timestamp = os.stat(self.source_path).st_mtime - self.handler.write_bytecode(self.code_object, self.bytecode_path, - timestamp) - # Verify bytecode file was created. - self.failUnless(os.path.exists(self.bytecode_path)) - result = self.handler.get_bytecode(self.bytecode_path) - magic, timestamp, bytecode = result - # Verify magic number. - self.failUnless(self.handler.verify_magic(magic)) - # Verify timestamp. - self.failUnless(self.handler.verify_timestamp(timestamp, - self.source_path)) - # Verify bytecode. - code_object = self.handler.get_code_from_bytecode(bytecode) - exec code_object in self.module_object.__dict__ - self.verify_module(self.module_object) - - def test_handle_code_source(self): - # Should be able to initialize the module from just using the source. - os.remove(self.bytecode_path) - handler = importer.PyPycFileHandler(bytecode_handles=False) - handler.handle_code(self.module_object, self.source_path, '.py') - self.verify_module(self.module_object) - self.failUnless(not os.path.exists(self.bytecode_path)) - - def test_handle_code_bytecode(self): - # Should be able to initialize the module with just the bytecode. - os.remove(self.source_path) - bytecode_extension = os.path.splitext(self.bytecode_path)[1] - handler = importer.PyPycFileHandler(source_handles=False) - handler.handle_code(self.module_object, self.bytecode_path, - bytecode_extension) - self.verify_module(self.module_object) - - def test_handle_code_bad_bytecode_timestamp_good_source(self): - # If the timestamp fails on the bytecode, use the source and recreate - # the bytecode. - class Tester(importer.PyPycFileHandler): - def verify_timestamp(self, timestamp, source_path): - bytecode_path = self.find_bytecode_to_write(source_path) - os.remove(bytecode_path) - return False - - handler = Tester() - bytecode_extension = os.path.splitext(self.bytecode_path)[1] - handler.handle_code(self.module_object, self.bytecode_path, - bytecode_extension) - - def test_handle_code_good_source_write_bytecode(self): - # If the handler is requested to handle source code and bytecode can - # be written, then do so. - os.remove(self.bytecode_path) - self.handler.handle_code(self.module_object, self.source_path, '.py') - self.verify_module(self.module_object) - self.failUnless(os.path.exists(self.bytecode_path)) + # Test __init__ usage. + proper_bytecode_ext = '.pyc' if __debug__ else '.pyo' + for source_ext, bytecode_ext in ((None, None), (('A',), None), + (None, ('A',)), (('A',), ('B',))): + handler = importer.PyPycHandler(source_ext, bytecode_ext) + if source_ext is None: + source = ('.py',) + if bytecode_ext is None: + bytecode = (proper_bytecode_ext,) + self.failUnlessEqual(self.handler.source_handles, source) + self.failUnlessEqual(self.handler.bytecode_handles, bytecode) + self.failUnlessEqual(self.handler.handles, bytecode + source) + + def test_new_module(self): + # Should return a new module with the proper value for __name__. + module = self.handler.new_module('test') + self.failUnlessEqual('test', module.__name__) + self.failUnless(isinstance(module, importer.__class__)) + + def test_parse_pyc(self): + # Split up data from .pyc file for the magic number, timestamp, + # and bytecode. + pass + # XXX + + def test_check_magic(self): + # Compare a number against the magic number. + # XXX Cannot properly test until can unmarshal numbers. + #magic_number = imp.get_magic() + #self.failUnless(self.handler.check_magic(magic_number)) + #self.failUnless(not self.handler.check_magic(magic_number-1)) + #self.failUnless(not self.handler.check_magic(magic_number+1)) + pass + + def test_code_from_bytecode(self): + # Create a code object from bytecode. + code_object = self.handler.code_from_bytecode(self.bytecode) + module = self.handler.new_module(self.module) + exec code_object in module.__dict__ + self.verify_module(module) + + def test_code_from_source(self): + # Create a code object from source. + code = self.handler.code_from_source(self.source, self.source_path) + module = self.handler.new_module(self.module) + exec code in module.__dict__ + self.verify_module(module) + + def test_create_pyc(self): + # Test creating bytes for creating a .pyc file. + # XXX Cannot test until marshaling longs is possible. + pass + +class PyPycHandlerHandleCodeTests(unittest.TestCase): + + """Test PyPycHandler.handle_code().""" + + # XXX + pass + + class ExtensionHandlerTests(unittest.TestCase): """Test that extension modules can be loaded.""" @@ -569,12 +381,12 @@ raise test_support.TestSkipped("not extension modules found") self.ext_path = os.path.join(entry, ext_paths[0]) self.module_name = os.path.splitext(os.path.split(self.ext_path)[1])[0] + self.loader = importer.FileSystemLoader(self.ext_path, self.handler) def test_handle_code(self): # Make sure an extension module can be loaded. - new_module = new.module(self.module_name) - module = self.handler.handle_code(new_module, self.ext_path, - self.handler.handles[0]) + module = self.handler.handle_code(self.loader, self.module_name, + self.ext_path) # There should be at least one attribute that does not start with '_'. self.failUnless(any(True for attr in dir(module) if not attr.startswith('_'))) @@ -774,16 +586,10 @@ def test_main(): - test_support.run_unittest( - BuiltinImporterTests, - FrozenImporterTests, - FileSystemLoaderTests, - FileSystemImporterTests, - PyPycBaseHandlerTests, - PyPycFileHandlerTests, - ExtensionHandlerTests, - SimpleImportTests, - ) + test_classes = [cls for cls in globals().itervalues() + if isinstance(cls, type) and + cls.__name__.endswith('Tests')] + test_support.run_unittest(*test_classes) if __name__ == '__main__': From python-checkins at python.org Sun Oct 29 09:39:24 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 09:39:24 +0100 (CET) Subject: [Python-checkins] r52517 - in python/trunk: Lib/codecs.py Lib/test/test_codecs.py Misc/NEWS Message-ID: <20061029083924.17CF41E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 09:39:22 2006 New Revision: 52517 Modified: python/trunk/Lib/codecs.py python/trunk/Lib/test/test_codecs.py python/trunk/Misc/NEWS Log: Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and fix all codecs file wrappers to work correctly with the "with" statement (bug #1586513). Modified: python/trunk/Lib/codecs.py ============================================================================== --- python/trunk/Lib/codecs.py (original) +++ python/trunk/Lib/codecs.py Sun Oct 29 09:39:22 2006 @@ -329,6 +329,12 @@ """ return getattr(self.stream, name) + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + ### class StreamReader(Codec): @@ -568,6 +574,12 @@ """ return getattr(self.stream, name) + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + ### class StreamReaderWriter: @@ -641,6 +653,14 @@ """ return getattr(self.stream, name) + # these are needed to make "with codecs.open(...)" work properly + + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + ### class StreamRecoder: @@ -751,6 +771,12 @@ """ return getattr(self.stream, name) + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + ### Shortcuts def open(filename, mode='rb', encoding=None, errors='strict', buffering=1): @@ -824,9 +850,10 @@ """ if file_encoding is None: file_encoding = data_encoding - info = lookup(data_encoding) - sr = StreamRecoder(file, info.encode, info.decode, - info.streamreader, info.streamwriter, errors) + data_info = lookup(data_encoding) + file_info = lookup(file_encoding) + sr = StreamRecoder(file, data_info.encode, data_info.decode, + file_info.streamreader, file_info.streamwriter, errors) # Add attributes to simplify introspection sr.data_encoding = data_encoding sr.file_encoding = file_encoding Modified: python/trunk/Lib/test/test_codecs.py ============================================================================== --- python/trunk/Lib/test/test_codecs.py (original) +++ python/trunk/Lib/test/test_codecs.py Sun Oct 29 09:39:22 2006 @@ -910,6 +910,18 @@ f = self.reader(self.stream) self.assertEquals(f.readlines(), [u'\ud55c\n', u'\uae00']) +class EncodedFileTest(unittest.TestCase): + + def test_basic(self): + f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') + ef = codecs.EncodedFile(f, 'utf-16', 'utf-8') + self.assertEquals(ef.read(), '\xff\xfe\\\xd5\n\x00\x00\xae') + + f = StringIO.StringIO() + ef = codecs.EncodedFile(f, 'utf-8', 'latin1') + ef.write('\xc3\xbc') + self.assertEquals(f.getvalue(), '\xfc') + class Str2StrTest(unittest.TestCase): def test_read(self): @@ -1214,6 +1226,19 @@ (u"", len(allbytes)) ) +class WithStmtTest(unittest.TestCase): + def test_encodedfile(self): + f = StringIO.StringIO("\xc3\xbc") + with codecs.EncodedFile(f, "latin-1", "utf-8") as ef: + self.assertEquals(ef.read(), "\xfc") + + def test_streamreaderwriter(self): + f = StringIO.StringIO("\xc3\xbc") + info = codecs.lookup("utf-8") + with codecs.StreamReaderWriter(f, info.streamreader, + info.streamwriter, 'strict') as srw: + self.assertEquals(srw.read(), u"\xfc") + def test_main(): test_support.run_unittest( @@ -1234,10 +1259,12 @@ IDNACodecTest, CodecsModuleTest, StreamReaderTest, + EncodedFileTest, Str2StrTest, BasicUnicodeTest, BasicStrTest, - CharmapTest + CharmapTest, + WithStmtTest, ) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 29 09:39:22 2006 @@ -89,6 +89,10 @@ Library ------- +- Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and + fix all codecs file wrappers to work correctly with the "with" + statement (bug #1586513). + - Lib/modulefinder.py now handles absolute and relative imports correctly. From python-checkins at python.org Sun Oct 29 09:39:28 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 09:39:28 +0100 (CET) Subject: [Python-checkins] r52518 - in python/branches/release25-maint: Lib/codecs.py Lib/test/test_codecs.py Misc/NEWS Message-ID: <20061029083928.1ED841E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 09:39:27 2006 New Revision: 52518 Modified: python/branches/release25-maint/Lib/codecs.py python/branches/release25-maint/Lib/test/test_codecs.py python/branches/release25-maint/Misc/NEWS Log: Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and fix all codecs file wrappers to work correctly with the "with" statement (bug #1586513). (backport from rev. 52517) Modified: python/branches/release25-maint/Lib/codecs.py ============================================================================== --- python/branches/release25-maint/Lib/codecs.py (original) +++ python/branches/release25-maint/Lib/codecs.py Sun Oct 29 09:39:27 2006 @@ -329,6 +329,12 @@ """ return getattr(self.stream, name) + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + ### class StreamReader(Codec): @@ -568,6 +574,12 @@ """ return getattr(self.stream, name) + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + ### class StreamReaderWriter: @@ -641,6 +653,14 @@ """ return getattr(self.stream, name) + # these are needed to make "with codecs.open(...)" work properly + + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + ### class StreamRecoder: @@ -751,6 +771,12 @@ """ return getattr(self.stream, name) + def __enter__(self): + return self + + def __exit__(self, type, value, tb): + self.stream.close() + ### Shortcuts def open(filename, mode='rb', encoding=None, errors='strict', buffering=1): @@ -824,9 +850,10 @@ """ if file_encoding is None: file_encoding = data_encoding - info = lookup(data_encoding) - sr = StreamRecoder(file, info.encode, info.decode, - info.streamreader, info.streamwriter, errors) + data_info = lookup(data_encoding) + file_info = lookup(file_encoding) + sr = StreamRecoder(file, data_info.encode, data_info.decode, + file_info.streamreader, file_info.streamwriter, errors) # Add attributes to simplify introspection sr.data_encoding = data_encoding sr.file_encoding = file_encoding Modified: python/branches/release25-maint/Lib/test/test_codecs.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_codecs.py (original) +++ python/branches/release25-maint/Lib/test/test_codecs.py Sun Oct 29 09:39:27 2006 @@ -1,3 +1,4 @@ +from __future__ import with_statement from test import test_support import unittest import codecs @@ -910,6 +911,18 @@ f = self.reader(self.stream) self.assertEquals(f.readlines(), [u'\ud55c\n', u'\uae00']) +class EncodedFileTest(unittest.TestCase): + + def test_basic(self): + f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') + ef = codecs.EncodedFile(f, 'utf-16', 'utf-8') + self.assertEquals(ef.read(), '\xff\xfe\\\xd5\n\x00\x00\xae') + + f = StringIO.StringIO() + ef = codecs.EncodedFile(f, 'utf-8', 'latin1') + ef.write('\xc3\xbc') + self.assertEquals(f.getvalue(), '\xfc') + class Str2StrTest(unittest.TestCase): def test_read(self): @@ -1214,6 +1227,19 @@ (u"", len(allbytes)) ) +class WithStmtTest(unittest.TestCase): + def test_encodedfile(self): + f = StringIO.StringIO("\xc3\xbc") + with codecs.EncodedFile(f, "latin-1", "utf-8") as ef: + self.assertEquals(ef.read(), "\xfc") + + def test_streamreaderwriter(self): + f = StringIO.StringIO("\xc3\xbc") + info = codecs.lookup("utf-8") + with codecs.StreamReaderWriter(f, info.streamreader, + info.streamwriter, 'strict') as srw: + self.assertEquals(srw.read(), u"\xfc") + def test_main(): test_support.run_unittest( @@ -1234,10 +1260,12 @@ IDNACodecTest, CodecsModuleTest, StreamReaderTest, + EncodedFileTest, Str2StrTest, BasicUnicodeTest, BasicStrTest, - CharmapTest + CharmapTest, + WithStmtTest, ) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 29 09:39:27 2006 @@ -90,6 +90,10 @@ Library ------- +- Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and + fix all codecs file wrappers to work correctly with the "with" + statement (bug #1586513). + - ctypes callback functions only support 'fundamental' data types as result type. Raise an error when something else is used. This is a partial fix for Bug #1574584. From python-checkins at python.org Sun Oct 29 09:47:08 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 09:47:08 +0100 (CET) Subject: [Python-checkins] r52519 - python/trunk/Python/compile.c Message-ID: <20061029084708.A665A1E4009@bag.python.org> Author: georg.brandl Date: Sun Oct 29 09:47:08 2006 New Revision: 52519 Modified: python/trunk/Python/compile.c Log: Clean up a leftover from old listcomp generation code. Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Sun Oct 29 09:47:08 2006 @@ -2619,7 +2619,7 @@ } ADDOP_JABS(c, JUMP_ABSOLUTE, start); compiler_use_next_block(c, anchor); - /* delete the append method added to locals */ + /* delete the temporary list name added to locals */ if (gen_index == 1) if (!compiler_nameop(c, tmpname, Del)) return 0; @@ -2632,15 +2632,9 @@ { identifier tmp; int rc = 0; - static identifier append; asdl_seq *generators = e->v.ListComp.generators; assert(e->kind == ListComp_kind); - if (!append) { - append = PyString_InternFromString("append"); - if (!append) - return 0; - } tmp = compiler_new_tmpname(c); if (!tmp) return 0; From python-checkins at python.org Sun Oct 29 09:53:06 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 09:53:06 +0100 (CET) Subject: [Python-checkins] r52520 - in python/trunk: Lib/compiler/pycodegen.py Misc/NEWS Message-ID: <20061029085306.91D9C1E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 09:53:06 2006 New Revision: 52520 Modified: python/trunk/Lib/compiler/pycodegen.py python/trunk/Misc/NEWS Log: Bug #1586448: the compiler module now emits the same bytecode for list comprehensions as the builtin compiler, using the LIST_APPEND opcode. Modified: python/trunk/Lib/compiler/pycodegen.py ============================================================================== --- python/trunk/Lib/compiler/pycodegen.py (original) +++ python/trunk/Lib/compiler/pycodegen.py Sun Oct 29 09:53:06 2006 @@ -573,12 +573,11 @@ def visitListComp(self, node): self.set_lineno(node) # setup list - append = "$append%d" % self.__list_count + tmpname = "$list%d" % self.__list_count self.__list_count = self.__list_count + 1 self.emit('BUILD_LIST', 0) self.emit('DUP_TOP') - self.emit('LOAD_ATTR', 'append') - self._implicitNameOp('STORE', append) + self._implicitNameOp('STORE', tmpname) stack = [] for i, for_ in zip(range(len(node.quals)), node.quals): @@ -590,10 +589,9 @@ self.visit(if_, cont) stack.insert(0, (start, cont, anchor)) - self._implicitNameOp('LOAD', append) + self._implicitNameOp('LOAD', tmpname) self.visit(node.expr) - self.emit('CALL_FUNCTION', 1) - self.emit('POP_TOP') + self.emit('LIST_APPEND',) for start, cont, anchor in stack: if cont: @@ -604,7 +602,7 @@ self.nextBlock(skip_one) self.emit('JUMP_ABSOLUTE', start) self.startBlock(anchor) - self._implicitNameOp('DELETE', append) + self._implicitNameOp('DELETE', tmpname) self.__list_count = self.__list_count - 1 Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 29 09:53:06 2006 @@ -89,6 +89,10 @@ Library ------- +- Bug #1586448: the compiler module now emits the same bytecode for + list comprehensions as the builtin compiler, using the LIST_APPEND + opcode. + - Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and fix all codecs file wrappers to work correctly with the "with" statement (bug #1586513). From python-checkins at python.org Sun Oct 29 10:01:01 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 10:01:01 +0100 (CET) Subject: [Python-checkins] r52521 - python/trunk/Lib/compiler/pycodegen.py Message-ID: <20061029090101.C01881E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 10:01:01 2006 New Revision: 52521 Modified: python/trunk/Lib/compiler/pycodegen.py Log: Remove trailing comma. Modified: python/trunk/Lib/compiler/pycodegen.py ============================================================================== --- python/trunk/Lib/compiler/pycodegen.py (original) +++ python/trunk/Lib/compiler/pycodegen.py Sun Oct 29 10:01:01 2006 @@ -591,7 +591,7 @@ self._implicitNameOp('LOAD', tmpname) self.visit(node.expr) - self.emit('LIST_APPEND',) + self.emit('LIST_APPEND') for start, cont, anchor in stack: if cont: From buildbot at python.org Sun Oct 29 10:02:48 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 09:02:48 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20061029090248.D2CDC1E4005@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/1617 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 10:05:05 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 10:05:05 +0100 (CET) Subject: [Python-checkins] r52522 - python/trunk/Lib/subprocess.py Message-ID: <20061029090505.576621E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 10:05:04 2006 New Revision: 52522 Modified: python/trunk/Lib/subprocess.py Log: Bug #1357915: allow all sequence types for shell arguments in subprocess. Modified: python/trunk/Lib/subprocess.py ============================================================================== --- python/trunk/Lib/subprocess.py (original) +++ python/trunk/Lib/subprocess.py Sun Oct 29 10:05:04 2006 @@ -965,6 +965,8 @@ if isinstance(args, types.StringTypes): args = [args] + else: + args = list(args) if shell: args = ["/bin/sh", "-c"] + args From python-checkins at python.org Sun Oct 29 10:05:08 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 10:05:08 +0100 (CET) Subject: [Python-checkins] r52523 - python/branches/release25-maint/Lib/subprocess.py Message-ID: <20061029090508.B56AD1E400E@bag.python.org> Author: georg.brandl Date: Sun Oct 29 10:05:08 2006 New Revision: 52523 Modified: python/branches/release25-maint/Lib/subprocess.py Log: Bug #1357915: allow all sequence types for shell arguments in subprocess. (backport from rev. 52522) Modified: python/branches/release25-maint/Lib/subprocess.py ============================================================================== --- python/branches/release25-maint/Lib/subprocess.py (original) +++ python/branches/release25-maint/Lib/subprocess.py Sun Oct 29 10:05:08 2006 @@ -965,6 +965,8 @@ if isinstance(args, types.StringTypes): args = [args] + else: + args = list(args) if shell: args = ["/bin/sh", "-c"] + args From buildbot at python.org Sun Oct 29 10:05:29 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 09:05:29 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20061029090529.848471E4005@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/1606 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 10:16:12 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 10:16:12 +0100 (CET) Subject: [Python-checkins] r52524 - in python/trunk: Lib/tarfile.py Misc/NEWS Message-ID: <20061029091612.DB2CD1E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 10:16:12 2006 New Revision: 52524 Modified: python/trunk/Lib/tarfile.py python/trunk/Misc/NEWS Log: Patch #1583880: fix tarfile's problems with long names and posix/ GNU modes. Modified: python/trunk/Lib/tarfile.py ============================================================================== --- python/trunk/Lib/tarfile.py (original) +++ python/trunk/Lib/tarfile.py Sun Oct 29 10:16:12 2006 @@ -49,6 +49,7 @@ import errno import time import struct +import copy if sys.platform == 'mac': # This module needs work for MacOS9, especially in the area of pathname @@ -793,7 +794,6 @@ """Construct a TarInfo object. name is the optional name of the member. """ - self.name = name # member name (dirnames must end with '/') self.mode = 0666 # file permissions self.uid = 0 # user id @@ -807,8 +807,6 @@ self.gname = "group" # group name self.devmajor = 0 # device major number self.devminor = 0 # device minor number - self.prefix = "" # prefix to filename or information - # about sparse files self.offset = 0 # the tar header starts here self.offset_data = 0 # the file's data starts here @@ -840,24 +838,70 @@ tarinfo.gname = buf[297:329].rstrip(NUL) tarinfo.devmajor = nti(buf[329:337]) tarinfo.devminor = nti(buf[337:345]) - tarinfo.prefix = buf[345:500] + prefix = buf[345:500].rstrip(NUL) + + if prefix and not tarinfo.issparse(): + tarinfo.name = prefix + "/" + tarinfo.name if tarinfo.chksum not in calc_chksums(buf): raise ValueError("invalid header") return tarinfo def tobuf(self, posix=False): - """Return a tar header block as a 512 byte string. + """Return a tar header as a string of 512 byte blocks. """ + buf = "" + type = self.type + prefix = "" + + if self.name.endswith("/"): + type = DIRTYPE + + name = normpath(self.name) + + if type == DIRTYPE: + # directories should end with '/' + name += "/" + + linkname = self.linkname + if linkname: + # if linkname is empty we end up with a '.' + linkname = normpath(linkname) + + if posix: + if self.size > MAXSIZE_MEMBER: + raise ValueError("file is too large (>= 8 GB)") + + if len(self.linkname) > LENGTH_LINK: + raise ValueError("linkname is too long (>%d)" % (LENGTH_LINK)) + + if len(name) > LENGTH_NAME: + prefix = name[:LENGTH_PREFIX + 1] + while prefix and prefix[-1] != "/": + prefix = prefix[:-1] + + name = name[len(prefix):] + prefix = prefix[:-1] + + if not prefix or len(name) > LENGTH_NAME: + raise ValueError("name is too long") + + else: + if len(self.linkname) > LENGTH_LINK: + buf += self._create_gnulong(self.linkname, GNUTYPE_LONGLINK) + + if len(name) > LENGTH_NAME: + buf += self._create_gnulong(name, GNUTYPE_LONGNAME) + parts = [ - stn(self.name, 100), + stn(name, 100), itn(self.mode & 07777, 8, posix), itn(self.uid, 8, posix), itn(self.gid, 8, posix), itn(self.size, 12, posix), itn(self.mtime, 12, posix), " ", # checksum field - self.type, + type, stn(self.linkname, 100), stn(MAGIC, 6), stn(VERSION, 2), @@ -865,15 +909,38 @@ stn(self.gname, 32), itn(self.devmajor, 8, posix), itn(self.devminor, 8, posix), - stn(self.prefix, 155) + stn(prefix, 155) ] - buf = struct.pack("%ds" % BLOCKSIZE, "".join(parts)) + buf += struct.pack("%ds" % BLOCKSIZE, "".join(parts)) chksum = calc_chksums(buf)[0] - buf = buf[:148] + "%06o\0" % chksum + buf[155:] + buf = buf[:-364] + "%06o\0" % chksum + buf[-357:] self.buf = buf return buf + def _create_gnulong(self, name, type): + """Create a GNU longname/longlink header from name. + It consists of an extended tar header, with the length + of the longname as size, followed by data blocks, + which contain the longname as a null terminated string. + """ + name += NUL + + tarinfo = self.__class__() + tarinfo.name = "././@LongLink" + tarinfo.type = type + tarinfo.mode = 0 + tarinfo.size = len(name) + + # create extended header + buf = tarinfo.tobuf() + # create name blocks + buf += name + blocks, remainder = divmod(len(name), BLOCKSIZE) + if remainder > 0: + buf += (BLOCKSIZE - remainder) * NUL + return buf + def isreg(self): return self.type in REGULAR_TYPES def isfile(self): @@ -1377,50 +1444,11 @@ """ self._check("aw") - tarinfo.name = normpath(tarinfo.name) - if tarinfo.isdir(): - # directories should end with '/' - tarinfo.name += "/" - - if tarinfo.linkname: - tarinfo.linkname = normpath(tarinfo.linkname) - - if tarinfo.size > MAXSIZE_MEMBER: - if self.posix: - raise ValueError("file is too large (>= 8 GB)") - else: - self._dbg(2, "tarfile: Created GNU tar largefile header") - - - if len(tarinfo.linkname) > LENGTH_LINK: - if self.posix: - raise ValueError("linkname is too long (>%d)" % (LENGTH_LINK)) - else: - self._create_gnulong(tarinfo.linkname, GNUTYPE_LONGLINK) - tarinfo.linkname = tarinfo.linkname[:LENGTH_LINK -1] - self._dbg(2, "tarfile: Created GNU tar extension LONGLINK") - - if len(tarinfo.name) > LENGTH_NAME: - if self.posix: - prefix = tarinfo.name[:LENGTH_PREFIX + 1] - while prefix and prefix[-1] != "/": - prefix = prefix[:-1] - - name = tarinfo.name[len(prefix):] - prefix = prefix[:-1] + tarinfo = copy.copy(tarinfo) - if not prefix or len(name) > LENGTH_NAME: - raise ValueError("name is too long (>%d)" % (LENGTH_NAME)) - - tarinfo.name = name - tarinfo.prefix = prefix - else: - self._create_gnulong(tarinfo.name, GNUTYPE_LONGNAME) - tarinfo.name = tarinfo.name[:LENGTH_NAME - 1] - self._dbg(2, "tarfile: Created GNU tar extension LONGNAME") - - self.fileobj.write(tarinfo.tobuf(self.posix)) - self.offset += BLOCKSIZE + buf = tarinfo.tobuf(self.posix) + self.fileobj.write(buf) + self.offset += len(buf) # If there's data to follow, append it. if fileobj is not None: @@ -1779,12 +1807,6 @@ if tarinfo.isreg() and tarinfo.name.endswith("/"): tarinfo.type = DIRTYPE - # The prefix field is used for filenames > 100 in - # the POSIX standard. - # name = prefix + '/' + name - tarinfo.name = normpath(os.path.join(tarinfo.prefix.rstrip(NUL), - tarinfo.name)) - # Directory names should have a '/' at the end. if tarinfo.isdir(): tarinfo.name += "/" @@ -1909,10 +1931,6 @@ self.offset += self._block(tarinfo.size) tarinfo.size = origsize - # Clear the prefix field so that it is not used - # as a pathname in next(). - tarinfo.prefix = "" - return tarinfo #-------------------------------------------------------------------------- @@ -1970,31 +1988,6 @@ else: return TarIter(self) - def _create_gnulong(self, name, type): - """Write a GNU longname/longlink member to the TarFile. - It consists of an extended tar header, with the length - of the longname as size, followed by data blocks, - which contain the longname as a null terminated string. - """ - name += NUL - - tarinfo = TarInfo() - tarinfo.name = "././@LongLink" - tarinfo.type = type - tarinfo.mode = 0 - tarinfo.size = len(name) - - # write extended header - self.fileobj.write(tarinfo.tobuf()) - self.offset += BLOCKSIZE - # write name blocks - self.fileobj.write(name) - blocks, remainder = divmod(tarinfo.size, BLOCKSIZE) - if remainder > 0: - self.fileobj.write(NUL * (BLOCKSIZE - remainder)) - blocks += 1 - self.offset += blocks * BLOCKSIZE - def _dbg(self, level, msg): """Write debugging output to sys.stderr. """ Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 29 10:16:12 2006 @@ -89,6 +89,9 @@ Library ------- +- Patch #1583880: fix tarfile's problems with long names and posix/ + GNU modes. + - Bug #1586448: the compiler module now emits the same bytecode for list comprehensions as the builtin compiler, using the LIST_APPEND opcode. From python-checkins at python.org Sun Oct 29 10:16:16 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 10:16:16 +0100 (CET) Subject: [Python-checkins] r52525 - in python/branches/release25-maint: Lib/tarfile.py Misc/NEWS Message-ID: <20061029091616.616401E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 10:16:15 2006 New Revision: 52525 Modified: python/branches/release25-maint/Lib/tarfile.py python/branches/release25-maint/Misc/NEWS Log: Patch #1583880: fix tarfile's problems with long names and posix/ GNU modes. (backport from rev. 52524) Modified: python/branches/release25-maint/Lib/tarfile.py ============================================================================== --- python/branches/release25-maint/Lib/tarfile.py (original) +++ python/branches/release25-maint/Lib/tarfile.py Sun Oct 29 10:16:15 2006 @@ -49,6 +49,7 @@ import errno import time import struct +import copy if sys.platform == 'mac': # This module needs work for MacOS9, especially in the area of pathname @@ -793,7 +794,6 @@ """Construct a TarInfo object. name is the optional name of the member. """ - self.name = name # member name (dirnames must end with '/') self.mode = 0666 # file permissions self.uid = 0 # user id @@ -807,8 +807,6 @@ self.gname = "group" # group name self.devmajor = 0 # device major number self.devminor = 0 # device minor number - self.prefix = "" # prefix to filename or information - # about sparse files self.offset = 0 # the tar header starts here self.offset_data = 0 # the file's data starts here @@ -840,24 +838,70 @@ tarinfo.gname = buf[297:329].rstrip(NUL) tarinfo.devmajor = nti(buf[329:337]) tarinfo.devminor = nti(buf[337:345]) - tarinfo.prefix = buf[345:500] + prefix = buf[345:500].rstrip(NUL) + + if prefix and not tarinfo.issparse(): + tarinfo.name = prefix + "/" + tarinfo.name if tarinfo.chksum not in calc_chksums(buf): raise ValueError("invalid header") return tarinfo def tobuf(self, posix=False): - """Return a tar header block as a 512 byte string. + """Return a tar header as a string of 512 byte blocks. """ + buf = "" + type = self.type + prefix = "" + + if self.name.endswith("/"): + type = DIRTYPE + + name = normpath(self.name) + + if type == DIRTYPE: + # directories should end with '/' + name += "/" + + linkname = self.linkname + if linkname: + # if linkname is empty we end up with a '.' + linkname = normpath(linkname) + + if posix: + if self.size > MAXSIZE_MEMBER: + raise ValueError("file is too large (>= 8 GB)") + + if len(self.linkname) > LENGTH_LINK: + raise ValueError("linkname is too long (>%d)" % (LENGTH_LINK)) + + if len(name) > LENGTH_NAME: + prefix = name[:LENGTH_PREFIX + 1] + while prefix and prefix[-1] != "/": + prefix = prefix[:-1] + + name = name[len(prefix):] + prefix = prefix[:-1] + + if not prefix or len(name) > LENGTH_NAME: + raise ValueError("name is too long") + + else: + if len(self.linkname) > LENGTH_LINK: + buf += self._create_gnulong(self.linkname, GNUTYPE_LONGLINK) + + if len(name) > LENGTH_NAME: + buf += self._create_gnulong(name, GNUTYPE_LONGNAME) + parts = [ - stn(self.name, 100), + stn(name, 100), itn(self.mode & 07777, 8, posix), itn(self.uid, 8, posix), itn(self.gid, 8, posix), itn(self.size, 12, posix), itn(self.mtime, 12, posix), " ", # checksum field - self.type, + type, stn(self.linkname, 100), stn(MAGIC, 6), stn(VERSION, 2), @@ -865,15 +909,38 @@ stn(self.gname, 32), itn(self.devmajor, 8, posix), itn(self.devminor, 8, posix), - stn(self.prefix, 155) + stn(prefix, 155) ] - buf = struct.pack("%ds" % BLOCKSIZE, "".join(parts)) + buf += struct.pack("%ds" % BLOCKSIZE, "".join(parts)) chksum = calc_chksums(buf)[0] - buf = buf[:148] + "%06o\0" % chksum + buf[155:] + buf = buf[:-364] + "%06o\0" % chksum + buf[-357:] self.buf = buf return buf + def _create_gnulong(self, name, type): + """Create a GNU longname/longlink header from name. + It consists of an extended tar header, with the length + of the longname as size, followed by data blocks, + which contain the longname as a null terminated string. + """ + name += NUL + + tarinfo = self.__class__() + tarinfo.name = "././@LongLink" + tarinfo.type = type + tarinfo.mode = 0 + tarinfo.size = len(name) + + # create extended header + buf = tarinfo.tobuf() + # create name blocks + buf += name + blocks, remainder = divmod(len(name), BLOCKSIZE) + if remainder > 0: + buf += (BLOCKSIZE - remainder) * NUL + return buf + def isreg(self): return self.type in REGULAR_TYPES def isfile(self): @@ -1377,50 +1444,11 @@ """ self._check("aw") - tarinfo.name = normpath(tarinfo.name) - if tarinfo.isdir(): - # directories should end with '/' - tarinfo.name += "/" - - if tarinfo.linkname: - tarinfo.linkname = normpath(tarinfo.linkname) - - if tarinfo.size > MAXSIZE_MEMBER: - if self.posix: - raise ValueError("file is too large (>= 8 GB)") - else: - self._dbg(2, "tarfile: Created GNU tar largefile header") - - - if len(tarinfo.linkname) > LENGTH_LINK: - if self.posix: - raise ValueError("linkname is too long (>%d)" % (LENGTH_LINK)) - else: - self._create_gnulong(tarinfo.linkname, GNUTYPE_LONGLINK) - tarinfo.linkname = tarinfo.linkname[:LENGTH_LINK -1] - self._dbg(2, "tarfile: Created GNU tar extension LONGLINK") - - if len(tarinfo.name) > LENGTH_NAME: - if self.posix: - prefix = tarinfo.name[:LENGTH_PREFIX + 1] - while prefix and prefix[-1] != "/": - prefix = prefix[:-1] - - name = tarinfo.name[len(prefix):] - prefix = prefix[:-1] + tarinfo = copy.copy(tarinfo) - if not prefix or len(name) > LENGTH_NAME: - raise ValueError("name is too long (>%d)" % (LENGTH_NAME)) - - tarinfo.name = name - tarinfo.prefix = prefix - else: - self._create_gnulong(tarinfo.name, GNUTYPE_LONGNAME) - tarinfo.name = tarinfo.name[:LENGTH_NAME - 1] - self._dbg(2, "tarfile: Created GNU tar extension LONGNAME") - - self.fileobj.write(tarinfo.tobuf(self.posix)) - self.offset += BLOCKSIZE + buf = tarinfo.tobuf(self.posix) + self.fileobj.write(buf) + self.offset += len(buf) # If there's data to follow, append it. if fileobj is not None: @@ -1779,12 +1807,6 @@ if tarinfo.isreg() and tarinfo.name.endswith("/"): tarinfo.type = DIRTYPE - # The prefix field is used for filenames > 100 in - # the POSIX standard. - # name = prefix + '/' + name - tarinfo.name = normpath(os.path.join(tarinfo.prefix.rstrip(NUL), - tarinfo.name)) - # Directory names should have a '/' at the end. if tarinfo.isdir(): tarinfo.name += "/" @@ -1909,10 +1931,6 @@ self.offset += self._block(tarinfo.size) tarinfo.size = origsize - # Clear the prefix field so that it is not used - # as a pathname in next(). - tarinfo.prefix = "" - return tarinfo #-------------------------------------------------------------------------- @@ -1970,31 +1988,6 @@ else: return TarIter(self) - def _create_gnulong(self, name, type): - """Write a GNU longname/longlink member to the TarFile. - It consists of an extended tar header, with the length - of the longname as size, followed by data blocks, - which contain the longname as a null terminated string. - """ - name += NUL - - tarinfo = TarInfo() - tarinfo.name = "././@LongLink" - tarinfo.type = type - tarinfo.mode = 0 - tarinfo.size = len(name) - - # write extended header - self.fileobj.write(tarinfo.tobuf()) - self.offset += BLOCKSIZE - # write name blocks - self.fileobj.write(name) - blocks, remainder = divmod(tarinfo.size, BLOCKSIZE) - if remainder > 0: - self.fileobj.write(NUL * (BLOCKSIZE - remainder)) - blocks += 1 - self.offset += blocks * BLOCKSIZE - def _dbg(self, level, msg): """Write debugging output to sys.stderr. """ Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 29 10:16:15 2006 @@ -90,6 +90,9 @@ Library ------- +- Patch #1583880: fix tarfile's problems with long names and posix/ + GNU modes. + - Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and fix all codecs file wrappers to work correctly with the "with" statement (bug #1586513). From python-checkins at python.org Sun Oct 29 10:18:01 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 10:18:01 +0100 (CET) Subject: [Python-checkins] r52526 - python/trunk/Lib/test/test_grammar.py Message-ID: <20061029091801.0E4831E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 10:18:00 2006 New Revision: 52526 Modified: python/trunk/Lib/test/test_grammar.py Log: Test assert if __debug__ is true. Modified: python/trunk/Lib/test/test_grammar.py ============================================================================== --- python/trunk/Lib/test/test_grammar.py (original) +++ python/trunk/Lib/test/test_grammar.py Sun Oct 29 10:18:00 2006 @@ -544,10 +544,9 @@ assert 0, "msg" except AssertionError, e: self.assertEquals(e.args[0], "msg") - # we can not expect an assertion error to be raised - # if the tests are run in an optimized python - #else: - # self.fail("AssertionError not raised by assert 0") + else: + if __debug__: + self.fail("AssertionError not raised by assert 0") ### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef # Tested below From g.brandl at gmx.net Sun Oct 29 10:18:00 2006 From: g.brandl at gmx.net (Georg Brandl) Date: Sun, 29 Oct 2006 10:18:00 +0100 Subject: [Python-checkins] r52500 - python/trunk/Lib/test/test_grammar.py In-Reply-To: <4544075B.7080308@gmail.com> References: <20061028202510.86C441E4004@bag.python.org> <4544075B.7080308@gmail.com> Message-ID: Nick Coghlan wrote: > georg.brandl wrote: >> Author: georg.brandl >> Date: Sat Oct 28 22:25:09 2006 >> New Revision: 52500 >> >> Modified: >> python/trunk/Lib/test/test_grammar.py >> Log: >> make test_grammar pass with python -O >> >> >> Modified: python/trunk/Lib/test/test_grammar.py >> ============================================================================== >> --- python/trunk/Lib/test/test_grammar.py (original) >> +++ python/trunk/Lib/test/test_grammar.py Sat Oct 28 22:25:09 2006 >> @@ -544,8 +544,10 @@ >> assert 0, "msg" >> except AssertionError, e: >> self.assertEquals(e.args[0], "msg") >> - else: >> - self.fail("AssertionError not raised by assert 0") >> + # we can not expect an assertion error to be raised >> + # if the tests are run in an optimized python >> + #else: >> + # self.fail("AssertionError not raised by assert 0") > > Wouldn't a __debug__ check be a better option here, instead of commenting the > test out completely?: > > else: > # we cannot expect an assertion error to be raised > # if the tests are run in an optimized python > if __debug__: > self.fail("AssertionError not raised by assert 0") Yep, it surely would. Georg From buildbot at python.org Sun Oct 29 10:22:00 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 09:22:00 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20061029092200.D0C2D1E400C@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/1547 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 10:22:04 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 09:22:04 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo 2.5 Message-ID: <20061029092204.9F3E41E400C@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/101 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 10:24:41 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 09:24:41 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20061029092441.8D3331E4005@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/1531 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 10:32:17 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 10:32:17 +0100 (CET) Subject: [Python-checkins] r52527 - python/trunk/Lib/test/test_codecs.py Message-ID: <20061029093217.3855C1E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 10:32:16 2006 New Revision: 52527 Modified: python/trunk/Lib/test/test_codecs.py Log: Fix the new EncodedFile test to work with big endian platforms. Modified: python/trunk/Lib/test/test_codecs.py ============================================================================== --- python/trunk/Lib/test/test_codecs.py (original) +++ python/trunk/Lib/test/test_codecs.py Sun Oct 29 10:32:16 2006 @@ -914,8 +914,8 @@ def test_basic(self): f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') - ef = codecs.EncodedFile(f, 'utf-16', 'utf-8') - self.assertEquals(ef.read(), '\xff\xfe\\\xd5\n\x00\x00\xae') + ef = codecs.EncodedFile(f, 'utf-16-le', 'utf-8') + self.assertEquals(ef.read(), '\\\xd5\n\x00\x00\xae') f = StringIO.StringIO() ef = codecs.EncodedFile(f, 'utf-8', 'latin1') From python-checkins at python.org Sun Oct 29 10:32:19 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 10:32:19 +0100 (CET) Subject: [Python-checkins] r52528 - python/branches/release25-maint/Lib/test/test_codecs.py Message-ID: <20061029093219.C8B8F1E400A@bag.python.org> Author: georg.brandl Date: Sun Oct 29 10:32:19 2006 New Revision: 52528 Modified: python/branches/release25-maint/Lib/test/test_codecs.py Log: Fix the new EncodedFile test to work with big endian platforms. (backport from rev. 52527) Modified: python/branches/release25-maint/Lib/test/test_codecs.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_codecs.py (original) +++ python/branches/release25-maint/Lib/test/test_codecs.py Sun Oct 29 10:32:19 2006 @@ -915,7 +915,7 @@ def test_basic(self): f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') - ef = codecs.EncodedFile(f, 'utf-16', 'utf-8') + ef = codecs.EncodedFile(f, 'utf-16-le', 'utf-8') self.assertEquals(ef.read(), '\xff\xfe\\\xd5\n\x00\x00\xae') f = StringIO.StringIO() From buildbot at python.org Sun Oct 29 10:38:50 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 09:38:50 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20061029093850.AF52D1E4005@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/468 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 10:49:47 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 09:49:47 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061029094947.69EF11E4005@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/1250 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 11:00:19 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 10:00:19 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc 2.5 Message-ID: <20061029100019.4FB221E4005@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/95 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 11:05:56 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 10:05:56 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 2.5 Message-ID: <20061029100556.2976D1E4005@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/94 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 11:08:13 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 10:08:13 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20061029100813.8D3881E4005@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/82 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,neal.norwitz Build Had Warnings: warnings test sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 12:15:10 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 11:15:10 +0000 Subject: [Python-checkins] buildbot warnings in x86 cygwin trunk Message-ID: <20061029111510.8F8231E4005@bag.python.org> The Buildbot has detected a new failure of x86 cygwin trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520cygwin%2520trunk/builds/1255 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: The web-page 'force build' button was pressed by 'Georg Brandl': test new notification system Build Source Stamp: [branch trunk] HEAD Blamelist: Build had warnings: warnings test sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 15:39:10 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 15:39:10 +0100 (CET) Subject: [Python-checkins] r52529 - in python/trunk: Lib/encodings/bz2_codec.py Lib/encodings/zlib_codec.py Lib/test/test_codecs.py Misc/NEWS Message-ID: <20061029143910.ACD071E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 15:39:09 2006 New Revision: 52529 Modified: python/trunk/Lib/encodings/bz2_codec.py python/trunk/Lib/encodings/zlib_codec.py python/trunk/Lib/test/test_codecs.py python/trunk/Misc/NEWS Log: Bug #1586613: fix zlib and bz2 codecs' incremental en/decoders. Modified: python/trunk/Lib/encodings/bz2_codec.py ============================================================================== --- python/trunk/Lib/encodings/bz2_codec.py (original) +++ python/trunk/Lib/encodings/bz2_codec.py Sun Oct 29 15:39:09 2006 @@ -52,14 +52,35 @@ return bz2_decode(input, errors) class IncrementalEncoder(codecs.IncrementalEncoder): + def __init__(self, errors='strict'): + assert errors == 'strict' + self.errors = errors + self.compressobj = bz2.BZ2Compressor() + def encode(self, input, final=False): - assert self.errors == 'strict' - return bz2.compress(input) + if final: + c = self.compressobj.compress(input) + return c + self.compressobj.flush() + else: + return self.compressobj.compress(input) + + def reset(self): + self.compressobj = bz2.BZ2Compressor() class IncrementalDecoder(codecs.IncrementalDecoder): + def __init__(self, errors='strict'): + assert errors == 'strict' + self.errors = errors + self.decompressobj = bz2.BZ2Decompressor() + def decode(self, input, final=False): - assert self.errors == 'strict' - return bz2.decompress(input) + try: + return self.decompressobj.decompress(input) + except EOFError: + return '' + + def reset(self): + self.decompressobj = bz2.BZ2Decompressor() class StreamWriter(Codec,codecs.StreamWriter): pass Modified: python/trunk/Lib/encodings/zlib_codec.py ============================================================================== --- python/trunk/Lib/encodings/zlib_codec.py (original) +++ python/trunk/Lib/encodings/zlib_codec.py Sun Oct 29 15:39:09 2006 @@ -51,14 +51,36 @@ return zlib_decode(input, errors) class IncrementalEncoder(codecs.IncrementalEncoder): + def __init__(self, errors='strict'): + assert errors == 'strict' + self.errors = errors + self.compressobj = zlib.compressobj() + def encode(self, input, final=False): - assert self.errors == 'strict' - return zlib.compress(input) + if final: + c = self.compressobj.compress(input) + return c + self.compressobj.flush() + else: + return self.compressobj.compress(input) + + def reset(self): + self.compressobj = zlib.compressobj() class IncrementalDecoder(codecs.IncrementalDecoder): + def __init__(self, errors='strict'): + assert errors == 'strict' + self.errors = errors + self.decompressobj = zlib.decompressobj() + def decode(self, input, final=False): - assert self.errors == 'strict' - return zlib.decompress(input) + if final: + c = self.decompressobj.decompress(input) + return c + self.decompressobj.flush() + else: + return self.decompressobj.decompress(input) + + def reset(self): + self.decompressobj = zlib.decompressobj() class StreamWriter(Codec,codecs.StreamWriter): pass Modified: python/trunk/Lib/test/test_codecs.py ============================================================================== --- python/trunk/Lib/test/test_codecs.py (original) +++ python/trunk/Lib/test/test_codecs.py Sun Oct 29 15:39:09 2006 @@ -1062,6 +1062,7 @@ "punycode", "unicode_internal" ] +broken_incremental_coders = broken_unicode_with_streams[:] try: import bz2 @@ -1111,6 +1112,7 @@ decodedresult += reader.read() self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) + if encoding not in broken_incremental_coders: # check incremental decoder/encoder (fetched via the Python # and C API) and iterencode()/iterdecode() try: Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 29 15:39:09 2006 @@ -89,6 +89,8 @@ Library ------- +- Bug #1586613: fix zlib and bz2 codecs' incremental en/decoders. + - Patch #1583880: fix tarfile's problems with long names and posix/ GNU modes. From python-checkins at python.org Sun Oct 29 15:39:14 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 15:39:14 +0100 (CET) Subject: [Python-checkins] r52530 - in python/branches/release25-maint: Lib/encodings/bz2_codec.py Lib/encodings/zlib_codec.py Lib/test/test_codecs.py Misc/NEWS Message-ID: <20061029143914.DFF401E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 15:39:13 2006 New Revision: 52530 Modified: python/branches/release25-maint/Lib/encodings/bz2_codec.py python/branches/release25-maint/Lib/encodings/zlib_codec.py python/branches/release25-maint/Lib/test/test_codecs.py python/branches/release25-maint/Misc/NEWS Log: Bug #1586613: fix zlib and bz2 codecs' incremental en/decoders. (backport from rev. 52529) Modified: python/branches/release25-maint/Lib/encodings/bz2_codec.py ============================================================================== --- python/branches/release25-maint/Lib/encodings/bz2_codec.py (original) +++ python/branches/release25-maint/Lib/encodings/bz2_codec.py Sun Oct 29 15:39:13 2006 @@ -52,14 +52,35 @@ return bz2_decode(input, errors) class IncrementalEncoder(codecs.IncrementalEncoder): + def __init__(self, errors='strict'): + assert errors == 'strict' + self.errors = errors + self.compressobj = bz2.BZ2Compressor() + def encode(self, input, final=False): - assert self.errors == 'strict' - return bz2.compress(input) + if final: + c = self.compressobj.compress(input) + return c + self.compressobj.flush() + else: + return self.compressobj.compress(input) + + def reset(self): + self.compressobj = bz2.BZ2Compressor() class IncrementalDecoder(codecs.IncrementalDecoder): + def __init__(self, errors='strict'): + assert errors == 'strict' + self.errors = errors + self.decompressobj = bz2.BZ2Decompressor() + def decode(self, input, final=False): - assert self.errors == 'strict' - return bz2.decompress(input) + try: + return self.decompressobj.decompress(input) + except EOFError: + return '' + + def reset(self): + self.decompressobj = bz2.BZ2Decompressor() class StreamWriter(Codec,codecs.StreamWriter): pass Modified: python/branches/release25-maint/Lib/encodings/zlib_codec.py ============================================================================== --- python/branches/release25-maint/Lib/encodings/zlib_codec.py (original) +++ python/branches/release25-maint/Lib/encodings/zlib_codec.py Sun Oct 29 15:39:13 2006 @@ -51,14 +51,36 @@ return zlib_decode(input, errors) class IncrementalEncoder(codecs.IncrementalEncoder): + def __init__(self, errors='strict'): + assert errors == 'strict' + self.errors = errors + self.compressobj = zlib.compressobj() + def encode(self, input, final=False): - assert self.errors == 'strict' - return zlib.compress(input) + if final: + c = self.compressobj.compress(input) + return c + self.compressobj.flush() + else: + return self.compressobj.compress(input) + + def reset(self): + self.compressobj = zlib.compressobj() class IncrementalDecoder(codecs.IncrementalDecoder): + def __init__(self, errors='strict'): + assert errors == 'strict' + self.errors = errors + self.decompressobj = zlib.decompressobj() + def decode(self, input, final=False): - assert self.errors == 'strict' - return zlib.decompress(input) + if final: + c = self.decompressobj.decompress(input) + return c + self.decompressobj.flush() + else: + return self.decompressobj.decompress(input) + + def reset(self): + self.decompressobj = zlib.decompressobj() class StreamWriter(Codec,codecs.StreamWriter): pass Modified: python/branches/release25-maint/Lib/test/test_codecs.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_codecs.py (original) +++ python/branches/release25-maint/Lib/test/test_codecs.py Sun Oct 29 15:39:13 2006 @@ -1063,6 +1063,7 @@ "punycode", "unicode_internal" ] +broken_incremental_coders = broken_unicode_with_streams[:] try: import bz2 @@ -1112,6 +1113,7 @@ decodedresult += reader.read() self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) + if encoding not in broken_incremental_coders: # check incremental decoder/encoder (fetched via the Python # and C API) and iterencode()/iterdecode() try: Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 29 15:39:13 2006 @@ -90,6 +90,8 @@ Library ------- +- Bug #1586613: fix zlib and bz2 codecs' incremental en/decoders. + - Patch #1583880: fix tarfile's problems with long names and posix/ GNU modes. From buildbot at python.org Sun Oct 29 16:20:05 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 15:20:05 +0000 Subject: [Python-checkins] buildbot warnings in x86 mvlgcc 2.5 Message-ID: <20061029152005.E248F1E4005@bag.python.org> The Buildbot has detected a new failure of x86 mvlgcc 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520mvlgcc%25202.5/builds/15 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 Sun Oct 29 16:21:26 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 15:21:26 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo 2.5 Message-ID: <20061029152126.98AF71E4005@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/104 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 Sun Oct 29 16:22:44 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 16:22:44 +0100 (CET) Subject: [Python-checkins] r52531 - python/branches/release25-maint/Lib/test/test_codecs.py Message-ID: <20061029152244.034E71E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 16:22:43 2006 New Revision: 52531 Modified: python/branches/release25-maint/Lib/test/test_codecs.py Log: I thought I had already fixed this error in the test. Modified: python/branches/release25-maint/Lib/test/test_codecs.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_codecs.py (original) +++ python/branches/release25-maint/Lib/test/test_codecs.py Sun Oct 29 16:22:43 2006 @@ -916,7 +916,7 @@ def test_basic(self): f = StringIO.StringIO('\xed\x95\x9c\n\xea\xb8\x80') ef = codecs.EncodedFile(f, 'utf-16-le', 'utf-8') - self.assertEquals(ef.read(), '\xff\xfe\\\xd5\n\x00\x00\xae') + self.assertEquals(ef.read(), '\\\xd5\n\x00\x00\xae') f = StringIO.StringIO() ef = codecs.EncodedFile(f, 'utf-8', 'latin1') From buildbot at python.org Sun Oct 29 16:26:57 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 15:26:57 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k 2.5 Message-ID: <20061029152658.0B7001E4005@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/103 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 Sun Oct 29 16:39:11 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 15:39:11 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061029153911.6E5301E4005@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/182 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 Sun Oct 29 16:56:14 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 15:56:14 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP 2.5 Message-ID: <20061029155615.0CD411E4005@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/19 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 Sun Oct 29 16:57:04 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 15:57:04 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc 2.5 Message-ID: <20061029155704.43CDD1E4005@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/97 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 Sun Oct 29 16:57:54 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 15:57:54 +0000 Subject: [Python-checkins] buildbot failure in x86 XP 2.5 Message-ID: <20061029155754.E26EA1E4010@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/20 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 buildbot at python.org Sun Oct 29 17:00:40 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 16:00:40 +0000 Subject: [Python-checkins] buildbot failure in hppa Ubuntu dapper 2.5 Message-ID: <20061029160040.D0EDD1E4005@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/84 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 configure sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 17:04:24 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 16:04:24 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 2.5 Message-ID: <20061029160424.82EA51E4005@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/96 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 Sun Oct 29 18:13:54 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 17:13:54 +0000 Subject: [Python-checkins] buildbot failure in x86 cygwin 2.5 Message-ID: <20061029171354.9E5E11E4005@bag.python.org> The Buildbot has detected a new failure of x86 cygwin 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520cygwin%25202.5/builds/68 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: The web-page 'force build' button was pressed by 'john': for test Build Source Stamp: [branch 2.5] HEAD Blamelist: BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 19:01:08 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 19:01:08 +0100 (CET) Subject: [Python-checkins] r52532 - python/trunk/Lib/hashlib.py Message-ID: <20061029180108.D8F7C1E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 19:01:08 2006 New Revision: 52532 Modified: python/trunk/Lib/hashlib.py Log: Bug #1586773: extend hashlib docstring. Modified: python/trunk/Lib/hashlib.py ============================================================================== --- python/trunk/Lib/hashlib.py (original) +++ python/trunk/Lib/hashlib.py Sun Oct 29 19:01:08 2006 @@ -18,8 +18,37 @@ More algorithms may be available on your platform but the above are guaranteed to exist. -Choose your hash function wisely. Some have known weaknesses. +Choose your hash function wisely. Some have known collision weaknesses. sha384 and sha512 will be slow on 32 bit platforms. + +Hash objects have these methods: + - update(arg): Update the hash object with the string arg. Repeated calls + are equivalent to a single call with the concatenation of all + the arguments. + - digest(): Return the digest of the strings passed to the update() method + so far. This may contain non-ASCII characters, including + NUL bytes. + - hexdigest(): Like digest() except the digest is returned as a string of + double length, containing only hexadecimal digits. + - copy(): Return a copy (clone) of the hash object. This can be used to + efficiently compute the digests of strings that share a common + initial substring. + +For example, to obtain the digest of the string 'Nobody inspects the +spammish repetition': + + >>> import hashlib + >>> m = hashlib.md5() + >>> m.update("Nobody inspects") + >>> m.update(" the spammish repetition") + >>> m.digest() + '\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9' + +More condensed: + + >>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest() + 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' + """ From python-checkins at python.org Sun Oct 29 19:01:12 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 19:01:12 +0100 (CET) Subject: [Python-checkins] r52533 - python/branches/release25-maint/Lib/hashlib.py Message-ID: <20061029180112.E355E1E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 19:01:12 2006 New Revision: 52533 Modified: python/branches/release25-maint/Lib/hashlib.py Log: Bug #1586773: extend hashlib docstring. (backport from rev. 52532) Modified: python/branches/release25-maint/Lib/hashlib.py ============================================================================== --- python/branches/release25-maint/Lib/hashlib.py (original) +++ python/branches/release25-maint/Lib/hashlib.py Sun Oct 29 19:01:12 2006 @@ -18,8 +18,37 @@ More algorithms may be available on your platform but the above are guaranteed to exist. -Choose your hash function wisely. Some have known weaknesses. +Choose your hash function wisely. Some have known collision weaknesses. sha384 and sha512 will be slow on 32 bit platforms. + +Hash objects have these methods: + - update(arg): Update the hash object with the string arg. Repeated calls + are equivalent to a single call with the concatenation of all + the arguments. + - digest(): Return the digest of the strings passed to the update() method + so far. This may contain non-ASCII characters, including + NUL bytes. + - hexdigest(): Like digest() except the digest is returned as a string of + double length, containing only hexadecimal digits. + - copy(): Return a copy (clone) of the hash object. This can be used to + efficiently compute the digests of strings that share a common + initial substring. + +For example, to obtain the digest of the string 'Nobody inspects the +spammish repetition': + + >>> import hashlib + >>> m = hashlib.md5() + >>> m.update("Nobody inspects") + >>> m.update(" the spammish repetition") + >>> m.digest() + '\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9' + +More condensed: + + >>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest() + 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' + """ From python-checkins at python.org Sun Oct 29 19:30:11 2006 From: python-checkins at python.org (neal.norwitz) Date: Sun, 29 Oct 2006 19:30:11 +0100 (CET) Subject: [Python-checkins] r52534 - python/trunk/Python/compile.c Message-ID: <20061029183011.3D4481E4005@bag.python.org> Author: neal.norwitz Date: Sun Oct 29 19:30:10 2006 New Revision: 52534 Modified: python/trunk/Python/compile.c Log: Update comments, remove commented out code. Move assembler structure next to assembler code to make it easier to move it to a separate file. Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Sun Oct 29 19:30:10 2006 @@ -6,9 +6,10 @@ * object: * 1. Checks for future statements. See future.c * 2. Builds a symbol table. See symtable.c. - * 3. Generate code for basic blocks. See compiler_mod() in this file. + * 3. Generate code for basic blocks. See compiler_mod() in this file. * 4. Assemble the basic blocks into final code. See assemble() in - * this file. + * this file. + * 5. Optimize the byte code (peephole optimizations). See peephole.c * * Note that compiler_mod() suggests module, but the module ast type * (mod_ty) has cases for expressions and interactive statements. @@ -16,7 +17,8 @@ * CAUTION: The VISIT_* macros abort the current function when they * encounter a problem. So don't invoke them when there is memory * which needs to be released. Code blocks are OK, as the compiler - * structure takes care of releasing those. + * structure takes care of releasing those. Use the arena to manage + * objects. */ #include "Python.h" @@ -32,16 +34,6 @@ int Py_OptimizeFlag = 0; -/* - ISSUES: - - opcode_stack_effect() function should be reviewed since stack depth bugs - could be really hard to find later. - - Dead code is being generated (i.e. after unconditional jumps). - XXX(nnorwitz): not sure this is still true -*/ - #define DEFAULT_BLOCK_SIZE 16 #define DEFAULT_BLOCKS 8 #define DEFAULT_CODE_SIZE 128 @@ -115,11 +107,11 @@ PyObject *u_private; /* for private name mangling */ int u_argcount; /* number of arguments for block */ - /* Pointer to the most recently allocated block. By following b_list - members, you can reach all early allocated blocks. */ + /* Pointer to the most recently allocated block. By following b_list + members, you can reach all early allocated blocks. */ basicblock *u_blocks; basicblock *u_curblock; /* pointer to current block */ - int u_tmpname; /* temporary variables for list comps */ + int u_tmpname; /* temporary variables for list comps */ int u_nfblocks; struct fblockinfo u_fblock[CO_MAXBLOCKS]; @@ -152,17 +144,6 @@ PyArena *c_arena; /* pointer to memory allocation arena */ }; -struct assembler { - PyObject *a_bytecode; /* string containing bytecode */ - int a_offset; /* offset into bytecode */ - int a_nblocks; /* number of reachable blocks */ - basicblock **a_postorder; /* list of blocks in dfs postorder */ - PyObject *a_lnotab; /* string containing lnotab */ - int a_lnotab_off; /* offset into lnotab */ - int a_lineno; /* last lineno of emitted instruction */ - int a_lineno_off; /* bytecode offset of last lineno */ -}; - static int compiler_enter_scope(struct compiler *, identifier, void *, int); static void compiler_free(struct compiler *); static basicblock *compiler_new_block(struct compiler *); @@ -396,47 +377,6 @@ return dest; } -/* - -Leave this debugging code for just a little longer. - -static void -compiler_display_symbols(PyObject *name, PyObject *symbols) -{ -PyObject *key, *value; -int flags; -Py_ssize_t pos = 0; - -fprintf(stderr, "block %s\n", PyString_AS_STRING(name)); -while (PyDict_Next(symbols, &pos, &key, &value)) { -flags = PyInt_AsLong(value); -fprintf(stderr, "var %s:", PyString_AS_STRING(key)); -if (flags & DEF_GLOBAL) -fprintf(stderr, " declared_global"); -if (flags & DEF_LOCAL) -fprintf(stderr, " local"); -if (flags & DEF_PARAM) -fprintf(stderr, " param"); -if (flags & DEF_STAR) -fprintf(stderr, " stararg"); -if (flags & DEF_DOUBLESTAR) -fprintf(stderr, " starstar"); -if (flags & DEF_INTUPLE) -fprintf(stderr, " tuple"); -if (flags & DEF_FREE) -fprintf(stderr, " free"); -if (flags & DEF_FREE_GLOBAL) -fprintf(stderr, " global"); -if (flags & DEF_FREE_CLASS) -fprintf(stderr, " free/class"); -if (flags & DEF_IMPORT) -fprintf(stderr, " import"); -fprintf(stderr, "\n"); -} - fprintf(stderr, "\n"); -} -*/ - static void compiler_unit_check(struct compiler_unit *u) { @@ -610,7 +550,7 @@ return NULL; } memset((void *)b, 0, sizeof(basicblock)); - /* Extend the singly linked list of blocks with new block. */ + /* Extend the singly linked list of blocks with new block. */ b->b_list = u->u_blocks; u->u_blocks = b; return b; @@ -649,7 +589,7 @@ /* Returns the offset of the next instruction in the current block's b_instr array. Resizes the b_instr as necessary. Returns -1 on failure. - */ +*/ static int compiler_next_instr(struct compiler *c, basicblock *b) @@ -693,7 +633,7 @@ already been set. If it has been set, the call has no effect. Every time a new node is b - */ +*/ static void compiler_set_lineno(struct compiler *c, int off) @@ -1055,8 +995,8 @@ from the current block to the new block. */ -/* XXX The returns inside these macros make it impossible to decref - objects created in the local function. +/* The returns inside these macros make it impossible to decref objects + created in the local function. Local objects should use the arena. */ @@ -2060,7 +2000,7 @@ { int i, n; - /* Always assign a lineno to the next instruction for a stmt. */ + /* Always assign a lineno to the next instruction for a stmt. */ c->u->u_lineno = s->lineno; c->u->u_lineno_set = false; @@ -2519,7 +2459,6 @@ } return 1; } -#undef CMPCAST static int compiler_call(struct compiler *c, expr_ty e) @@ -2933,9 +2872,9 @@ { int i, n; - /* If expr e has a different line number than the last expr/stmt, - set a new line number for the next instruction. - */ + /* If expr e has a different line number than the last expr/stmt, + set a new line number for the next instruction. + */ if (e->lineno > c->u->u_lineno) { c->u->u_lineno = e->lineno; c->u->u_lineno_set = false; @@ -2979,14 +2918,6 @@ case Yield_kind: if (c->u->u_ste->ste_type != FunctionBlock) return compiler_error(c, "'yield' outside function"); - /* - for (i = 0; i < c->u->u_nfblocks; i++) { - if (c->u->u_fblock[i].fb_type == FINALLY_TRY) - return compiler_error( - c, "'yield' not allowed in a 'try' " - "block with a 'finally' clause"); - } - */ if (e->v.Yield.value) { VISIT(c, expr, e->v.Yield.value); } @@ -3317,7 +3248,6 @@ return 1; } - static int compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx) { @@ -3365,12 +3295,26 @@ return compiler_handle_subscr(c, kindname, ctx); } + +/* End of the compiler section, beginning of the assembler section */ + /* do depth-first search of basic block graph, starting with block. post records the block indices in post-order. XXX must handle implicit jumps from one block to next */ +struct assembler { + PyObject *a_bytecode; /* string containing bytecode */ + int a_offset; /* offset into bytecode */ + int a_nblocks; /* number of reachable blocks */ + basicblock **a_postorder; /* list of blocks in dfs postorder */ + PyObject *a_lnotab; /* string containing lnotab */ + int a_lnotab_off; /* offset into lnotab */ + int a_lineno; /* last lineno of emitted instruction */ + int a_lineno_off; /* bytecode offset of last lineno */ +}; + static void dfs(struct compiler *c, basicblock *b, struct assembler *a) { From python-checkins at python.org Sun Oct 29 19:31:42 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 19:31:42 +0100 (CET) Subject: [Python-checkins] r52535 - in python/trunk: Lib/test/test_dict.py Misc/NEWS Objects/dictobject.c Message-ID: <20061029183142.EBFC71E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 19:31:42 2006 New Revision: 52535 Modified: python/trunk/Lib/test/test_dict.py python/trunk/Misc/NEWS python/trunk/Objects/dictobject.c Log: Bug #1576657: when setting a KeyError for a tuple key, make sure that the tuple isn't used as the "exception arguments tuple". Modified: python/trunk/Lib/test/test_dict.py ============================================================================== --- python/trunk/Lib/test/test_dict.py (original) +++ python/trunk/Lib/test/test_dict.py Sun Oct 29 19:31:42 2006 @@ -444,6 +444,16 @@ else: self.fail_("g[42] didn't raise KeyError") + def test_tuple_keyerror(self): + # SF #1576657 + d = {} + try: + d[(1,)] + except KeyError, e: + self.assertEqual(e.args, ((1,),)) + else: + self.fail("missing KeyError") + from test import mapping_tests Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Oct 29 19:31:42 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Bug #1576657: when setting a KeyError for a tuple key, make sure that + the tuple isn't used as the "exception arguments tuple". + - Bug #1565514, SystemError not raised on too many nested blocks. - Bug #1576174: WindowsError now displays the windows error code Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Sun Oct 29 19:31:42 2006 @@ -12,6 +12,19 @@ typedef PyDictEntry dictentry; typedef PyDictObject dictobject; +/* Set a key error with the specified argument, wrapping it in a + * tuple automatically so that tuple keys are not unpacked as the + * exception arguments. */ +static void +set_key_error(PyObject *arg) +{ + PyObject *tup; + tup = PyTuple_Pack(1, arg); + if (!tup) + return; /* caller will expect error to be set anyway */ + PyErr_SetObject(PyExc_KeyError, tup); +} + /* Define this out if you don't want conversion statistics on exit. */ #undef SHOW_CONVERSION_COUNTS @@ -665,7 +678,7 @@ if (ep == NULL) return -1; if (ep->me_value == NULL) { - PyErr_SetObject(PyExc_KeyError, key); + set_key_error(key); return -1; } old_key = ep->me_key; @@ -974,7 +987,7 @@ return PyObject_CallFunctionObjArgs(missing, (PyObject *)mp, key, NULL); } - PyErr_SetObject(PyExc_KeyError, key); + set_key_error(key); return NULL; } else @@ -1746,7 +1759,7 @@ Py_INCREF(deflt); return deflt; } - PyErr_SetObject(PyExc_KeyError, key); + set_key_error(key); return NULL; } old_key = ep->me_key; From python-checkins at python.org Sun Oct 29 19:31:46 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 19:31:46 +0100 (CET) Subject: [Python-checkins] r52536 - in python/branches/release25-maint: Lib/test/test_dict.py Misc/NEWS Objects/dictobject.c Message-ID: <20061029183146.6C2381E400C@bag.python.org> Author: georg.brandl Date: Sun Oct 29 19:31:45 2006 New Revision: 52536 Modified: python/branches/release25-maint/Lib/test/test_dict.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Objects/dictobject.c Log: Bug #1576657: when setting a KeyError for a tuple key, make sure that the tuple isn't used as the "exception arguments tuple". (backport from rev. 52535) Modified: python/branches/release25-maint/Lib/test/test_dict.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_dict.py (original) +++ python/branches/release25-maint/Lib/test/test_dict.py Sun Oct 29 19:31:45 2006 @@ -444,6 +444,16 @@ else: self.fail_("g[42] didn't raise KeyError") + def test_tuple_keyerror(self): + # SF #1576657 + d = {} + try: + d[(1,)] + except KeyError, e: + self.assertEqual(e.args, ((1,),)) + else: + self.fail("missing KeyError") + from test import mapping_tests Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Oct 29 19:31:45 2006 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Bug #1576657: when setting a KeyError for a tuple key, make sure that + the tuple isn't used as the "exception arguments tuple". + - Bug #1565514, SystemError not raised on too many nested blocks. - Bug #1576174: WindowsError now displays the windows error code Modified: python/branches/release25-maint/Objects/dictobject.c ============================================================================== --- python/branches/release25-maint/Objects/dictobject.c (original) +++ python/branches/release25-maint/Objects/dictobject.c Sun Oct 29 19:31:45 2006 @@ -12,6 +12,19 @@ typedef PyDictEntry dictentry; typedef PyDictObject dictobject; +/* Set a key error with the specified argument, wrapping it in a + * tuple automatically so that tuple keys are not unpacked as the + * exception arguments. */ +static void +set_key_error(PyObject *arg) +{ + PyObject *tup; + tup = PyTuple_Pack(1, arg); + if (!tup) + return; /* caller will expect error to be set anyway */ + PyErr_SetObject(PyExc_KeyError, tup); +} + /* Define this out if you don't want conversion statistics on exit. */ #undef SHOW_CONVERSION_COUNTS @@ -665,7 +678,7 @@ if (ep == NULL) return -1; if (ep->me_value == NULL) { - PyErr_SetObject(PyExc_KeyError, key); + set_key_error(key); return -1; } old_key = ep->me_key; @@ -974,7 +987,7 @@ return PyObject_CallFunctionObjArgs(missing, (PyObject *)mp, key, NULL); } - PyErr_SetObject(PyExc_KeyError, key); + set_key_error(key); return NULL; } else @@ -1746,7 +1759,7 @@ Py_INCREF(deflt); return deflt; } - PyErr_SetObject(PyExc_KeyError, key); + set_key_error(key); return NULL; } old_key = ep->me_key; From python-checkins at python.org Sun Oct 29 20:13:41 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 20:13:41 +0100 (CET) Subject: [Python-checkins] r52537 - in python/trunk/Lib/test: output/test_mmap test_mmap.py Message-ID: <20061029191341.8C1A41E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 20:13:40 2006 New Revision: 52537 Removed: python/trunk/Lib/test/output/test_mmap Modified: python/trunk/Lib/test/test_mmap.py Log: Convert test_mmap to unittest. Deleted: /python/trunk/Lib/test/output/test_mmap ============================================================================== --- /python/trunk/Lib/test/output/test_mmap Sun Oct 29 20:13:40 2006 +++ (empty file) @@ -1,38 +0,0 @@ -test_mmap - - Position of foo: 1.0 pages - Length of file: 2.0 pages - Contents of byte 0: '\x00' - Contents of first 3 bytes: '\x00\x00\x00' - - Modifying file's content... - Contents of byte 0: '3' - Contents of first 3 bytes: '3\x00\x00' - Contents of second page: '\x00foobar\x00' - Regex match on mmap (page start, length of match): 1.0 6 - Seek to zeroth byte - Seek to 42nd byte - Seek to last byte - Try to seek to negative position... - Try to seek beyond end of mmap... - Try to seek to negative position... - Attempting resize() - Creating 10 byte test data file. - Opening mmap with access=ACCESS_READ - Ensuring that readonly mmap can't be slice assigned. - Ensuring that readonly mmap can't be item assigned. - Ensuring that readonly mmap can't be write() to. - Ensuring that readonly mmap can't be write_byte() to. - Ensuring that readonly mmap can't be resized. - Opening mmap with size too big - Opening mmap with access=ACCESS_WRITE - Modifying write-through memory map. - Opening mmap with access=ACCESS_COPY - Modifying copy-on-write memory map. - Ensuring copy-on-write maps cannot be resized. - Ensuring invalid access parameter raises exception. - Try opening a bad file descriptor... - Ensuring that passing 0 as map length sets map size to current file size. - Ensuring that passing 0 as map length sets map size to current file size. - anonymous mmap.mmap(-1, PAGESIZE)... - Test passed Modified: python/trunk/Lib/test/test_mmap.py ============================================================================== --- python/trunk/Lib/test/test_mmap.py (original) +++ python/trunk/Lib/test/test_mmap.py Sun Oct 29 20:13:40 2006 @@ -1,190 +1,158 @@ -from test.test_support import verify, vereq, TESTFN +from test.test_support import TESTFN, run_unittest import mmap +import unittest import os, re PAGESIZE = mmap.PAGESIZE -def test_both(): - "Test mmap module on Unix systems and Windows" +class MmapTests(unittest.TestCase): - # Create a file to be mmap'ed. - if os.path.exists(TESTFN): - os.unlink(TESTFN) - f = open(TESTFN, 'w+') - - try: # unlink TESTFN no matter what - # Write 2 pages worth of data to the file - f.write('\0'* PAGESIZE) - f.write('foo') - f.write('\0'* (PAGESIZE-3) ) - f.flush() - m = mmap.mmap(f.fileno(), 2 * PAGESIZE) - f.close() + def setUp(self): + if os.path.exists(TESTFN): + os.unlink(TESTFN) - # Simple sanity checks + def tearDown(self): + try: + os.unlink(TESTFN) + except OSError: + pass - print type(m) # SF bug 128713: segfaulted on Linux - print ' Position of foo:', m.find('foo') / float(PAGESIZE), 'pages' - vereq(m.find('foo'), PAGESIZE) - - print ' Length of file:', len(m) / float(PAGESIZE), 'pages' - vereq(len(m), 2*PAGESIZE) - - print ' Contents of byte 0:', repr(m[0]) - vereq(m[0], '\0') - print ' Contents of first 3 bytes:', repr(m[0:3]) - vereq(m[0:3], '\0\0\0') - - # Modify the file's content - print "\n Modifying file's content..." - m[0] = '3' - m[PAGESIZE +3: PAGESIZE +3+3] = 'bar' - - # Check that the modification worked - print ' Contents of byte 0:', repr(m[0]) - vereq(m[0], '3') - print ' Contents of first 3 bytes:', repr(m[0:3]) - vereq(m[0:3], '3\0\0') - print ' Contents of second page:', repr(m[PAGESIZE-1 : PAGESIZE + 7]) - vereq(m[PAGESIZE-1 : PAGESIZE + 7], '\0foobar\0') + def test_basic(self): + # Test mmap module on Unix systems and Windows - m.flush() + # Create a file to be mmap'ed. + f = open(TESTFN, 'w+') + try: + # Write 2 pages worth of data to the file + f.write('\0'* PAGESIZE) + f.write('foo') + f.write('\0'* (PAGESIZE-3) ) + f.flush() + m = mmap.mmap(f.fileno(), 2 * PAGESIZE) + f.close() - # Test doing a regular expression match in an mmap'ed file - match = re.search('[A-Za-z]+', m) - if match is None: - print ' ERROR: regex match on mmap failed!' - else: - start, end = match.span(0) - length = end - start + # Simple sanity checks - print ' Regex match on mmap (page start, length of match):', - print start / float(PAGESIZE), length + tp = str(type(m)) # SF bug 128713: segfaulted on Linux + self.assertEqual(m.find('foo'), PAGESIZE) - vereq(start, PAGESIZE) - vereq(end, PAGESIZE + 6) + self.assertEqual(len(m), 2*PAGESIZE) - # test seeking around (try to overflow the seek implementation) - m.seek(0,0) - print ' Seek to zeroth byte' - vereq(m.tell(), 0) - m.seek(42,1) - print ' Seek to 42nd byte' - vereq(m.tell(), 42) - m.seek(0,2) - print ' Seek to last byte' - vereq(m.tell(), len(m)) + self.assertEqual(m[0], '\0') + self.assertEqual(m[0:3], '\0\0\0') - print ' Try to seek to negative position...' - try: - m.seek(-1) - except ValueError: - pass - else: - verify(0, 'expected a ValueError but did not get it') + # Modify the file's content + m[0] = '3' + m[PAGESIZE +3: PAGESIZE +3+3] = 'bar' - print ' Try to seek beyond end of mmap...' - try: - m.seek(1,2) - except ValueError: - pass - else: - verify(0, 'expected a ValueError but did not get it') + # Check that the modification worked + self.assertEqual(m[0], '3') + self.assertEqual(m[0:3], '3\0\0') + self.assertEqual(m[PAGESIZE-1 : PAGESIZE + 7], '\0foobar\0') - print ' Try to seek to negative position...' - try: - m.seek(-len(m)-1,2) - except ValueError: - pass - else: - verify(0, 'expected a ValueError but did not get it') + m.flush() - # Try resizing map - print ' Attempting resize()' - try: - m.resize(512) - except SystemError: - # resize() not supported - # No messages are printed, since the output of this test suite - # would then be different across platforms. - pass - else: - # resize() is supported - verify(len(m) == 512, - "len(m) is %d, but expecting 512" % (len(m),) ) - # Check that we can no longer seek beyond the new size. + # Test doing a regular expression match in an mmap'ed file + match = re.search('[A-Za-z]+', m) + if match is None: + self.fail('regex match on mmap failed!') + else: + start, end = match.span(0) + length = end - start + + self.assertEqual(start, PAGESIZE) + self.assertEqual(end, PAGESIZE + 6) + + # test seeking around (try to overflow the seek implementation) + m.seek(0,0) + self.assertEqual(m.tell(), 0) + m.seek(42,1) + self.assertEqual(m.tell(), 42) + m.seek(0,2) + self.assertEqual(m.tell(), len(m)) + + # Try to seek to negative position... + self.assertRaises(ValueError, m.seek, -1) + + # Try to seek beyond end of mmap... + self.assertRaises(ValueError, m.seek, 1, 2) + + # Try to seek to negative position... + self.assertRaises(ValueError, m.seek, -len(m)-1, 2) + + # Try resizing map try: - m.seek(513,0) - except ValueError: + m.resize(512) + except SystemError: + # resize() not supported + # No messages are printed, since the output of this test suite + # would then be different across platforms. pass else: - verify(0, 'Could seek beyond the new size') + # resize() is supported + self.assertEqual(len(m), 512) + # Check that we can no longer seek beyond the new size. + self.assertRaises(ValueError, m.seek, 513, 0) + + # Check that the underlying file is truncated too + # (bug #728515) + f = open(TESTFN) + f.seek(0, 2) + self.assertEqual(f.tell(), 512) + f.close() + self.assertEqual(m.size(), 512) - # Check that the underlying file is truncated too - # (bug #728515) - f = open(TESTFN) - f.seek(0, 2) - verify(f.tell() == 512, 'Underlying file not truncated') - f.close() - verify(m.size() == 512, 'New size not reflected in file') - - m.close() + m.close() - finally: - try: - f.close() - except OSError: - pass - try: - os.unlink(TESTFN) - except OSError: - pass + finally: + try: + f.close() + except OSError: + pass - # Test for "access" keyword parameter - try: + def test_access_parameter(self): + # Test for "access" keyword parameter mapsize = 10 - print " Creating", mapsize, "byte test data file." open(TESTFN, "wb").write("a"*mapsize) - print " Opening mmap with access=ACCESS_READ" f = open(TESTFN, "rb") m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_READ) - verify(m[:] == 'a'*mapsize, "Readonly memory map data incorrect.") + self.assertEqual(m[:], 'a'*mapsize, "Readonly memory map data incorrect.") - print " Ensuring that readonly mmap can't be slice assigned." + # Ensuring that readonly mmap can't be slice assigned try: m[:] = 'b'*mapsize except TypeError: pass else: - verify(0, "Able to write to readonly memory map") + self.fail("Able to write to readonly memory map") - print " Ensuring that readonly mmap can't be item assigned." + # Ensuring that readonly mmap can't be item assigned try: m[0] = 'b' except TypeError: pass else: - verify(0, "Able to write to readonly memory map") + self.fail("Able to write to readonly memory map") - print " Ensuring that readonly mmap can't be write() to." + # Ensuring that readonly mmap can't be write() to try: m.seek(0,0) m.write('abc') except TypeError: pass else: - verify(0, "Able to write to readonly memory map") + self.fail("Able to write to readonly memory map") - print " Ensuring that readonly mmap can't be write_byte() to." + # Ensuring that readonly mmap can't be write_byte() to try: m.seek(0,0) m.write_byte('d') except TypeError: pass else: - verify(0, "Able to write to readonly memory map") + self.fail("Able to write to readonly memory map") - print " Ensuring that readonly mmap can't be resized." + # Ensuring that readonly mmap can't be resized try: m.resize(2*mapsize) except SystemError: # resize is not universally supported @@ -192,12 +160,12 @@ except TypeError: pass else: - verify(0, "Able to resize readonly memory map") + self.fail("Able to resize readonly memory map") del m, f - verify(open(TESTFN, "rb").read() == 'a'*mapsize, + self.assertEqual(open(TESTFN, "rb").read(), 'a'*mapsize, "Readonly memory map data file was modified") - print " Opening mmap with size too big" + # Opening mmap with size too big import sys f = open(TESTFN, "r+b") try: @@ -208,11 +176,11 @@ # later tests assume that the length hasn't changed. We need to # repair that. if sys.platform.startswith('win'): - verify(0, "Opening mmap with size+1 should work on Windows.") + self.fail("Opening mmap with size+1 should work on Windows.") else: # we expect a ValueError on Unix, but not on Windows if not sys.platform.startswith('win'): - verify(0, "Opening mmap with size+1 should raise ValueError.") + self.fail("Opening mmap with size+1 should raise ValueError.") m.close() f.close() if sys.platform.startswith('win'): @@ -221,12 +189,12 @@ f.truncate(mapsize) f.close() - print " Opening mmap with access=ACCESS_WRITE" + # Opening mmap with access=ACCESS_WRITE f = open(TESTFN, "r+b") m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_WRITE) - print " Modifying write-through memory map." + # Modifying write-through memory map m[:] = 'c'*mapsize - verify(m[:] == 'c'*mapsize, + self.assertEqual(m[:], 'c'*mapsize, "Write-through memory map memory not updated properly.") m.flush() m.close() @@ -234,66 +202,45 @@ f = open(TESTFN, 'rb') stuff = f.read() f.close() - verify(stuff == 'c'*mapsize, + self.assertEqual(stuff, 'c'*mapsize, "Write-through memory map data file not updated properly.") - print " Opening mmap with access=ACCESS_COPY" + # Opening mmap with access=ACCESS_COPY f = open(TESTFN, "r+b") m = mmap.mmap(f.fileno(), mapsize, access=mmap.ACCESS_COPY) - print " Modifying copy-on-write memory map." + # Modifying copy-on-write memory map m[:] = 'd'*mapsize - verify(m[:] == 'd' * mapsize, + self.assertEqual(m[:], 'd' * mapsize, "Copy-on-write memory map data not written correctly.") m.flush() - verify(open(TESTFN, "rb").read() == 'c'*mapsize, + self.assertEqual(open(TESTFN, "rb").read(), 'c'*mapsize, "Copy-on-write test data file should not be modified.") - try: - print " Ensuring copy-on-write maps cannot be resized." - m.resize(2*mapsize) - except TypeError: - pass - else: - verify(0, "Copy-on-write mmap resize did not raise exception.") + # Ensuring copy-on-write maps cannot be resized + self.assertRaises(TypeError, m.resize, 2*mapsize) del m, f - try: - print " Ensuring invalid access parameter raises exception." - f = open(TESTFN, "r+b") - m = mmap.mmap(f.fileno(), mapsize, access=4) - except ValueError: - pass - else: - verify(0, "Invalid access code should have raised exception.") + + # Ensuring invalid access parameter raises exception + f = open(TESTFN, "r+b") + self.assertRaises(ValueError, mmap.mmap, f.fileno(), mapsize, access=4) + f.close() if os.name == "posix": # Try incompatible flags, prot and access parameters. f = open(TESTFN, "r+b") - try: - m = mmap.mmap(f.fileno(), mapsize, flags=mmap.MAP_PRIVATE, + self.assertRaises(ValueError, mmap.mmap, f.fileno(), mapsize, + flags=mmap.MAP_PRIVATE, prot=mmap.PROT_READ, access=mmap.ACCESS_WRITE) - except ValueError: - pass - else: - verify(0, "Incompatible parameters should raise ValueError.") f.close() - finally: - try: - os.unlink(TESTFN) - except OSError: - pass - print ' Try opening a bad file descriptor...' - try: - mmap.mmap(-2, 4096) - except mmap.error: - pass - else: - verify(0, 'expected a mmap.error but did not get it') - - # Do a tougher .find() test. SF bug 515943 pointed out that, in 2.2, - # searching for data with embedded \0 bytes didn't work. - f = open(TESTFN, 'w+') + def test_bad_file_desc(self): + # Try opening a bad file descriptor... + self.assertRaises(mmap.error, mmap.mmap, -2, 4096) + + def test_tougher_find(self): + # Do a tougher .find() test. SF bug 515943 pointed out that, in 2.2, + # searching for data with embedded \0 bytes didn't work. + f = open(TESTFN, 'w+') - try: # unlink TESTFN no matter what data = 'aabaac\x00deef\x00\x00aa\x00' n = len(data) f.write(data) @@ -304,17 +251,14 @@ for start in range(n+1): for finish in range(start, n+1): slice = data[start : finish] - vereq(m.find(slice), data.find(slice)) - vereq(m.find(slice + 'x'), -1) + self.assertEqual(m.find(slice), data.find(slice)) + self.assertEqual(m.find(slice + 'x'), -1) m.close() - finally: - os.unlink(TESTFN) - - # make sure a double close doesn't crash on Solaris (Bug# 665913) - f = open(TESTFN, 'w+') + def test_double_close(self): + # make sure a double close doesn't crash on Solaris (Bug# 665913) + f = open(TESTFN, 'w+') - try: # unlink TESTFN no matter what f.write(2**16 * 'a') # Arbitrary character f.close() @@ -324,72 +268,46 @@ mf.close() f.close() - finally: - os.unlink(TESTFN) + def test_entire_file(self): + # test mapping of entire file by passing 0 for map length + if hasattr(os, "stat"): + f = open(TESTFN, "w+") - # test mapping of entire file by passing 0 for map length - if hasattr(os, "stat"): - print " Ensuring that passing 0 as map length sets map size to current file size." - f = open(TESTFN, "w+") - - try: f.write(2**16 * 'm') # Arbitrary character f.close() f = open(TESTFN, "rb+") mf = mmap.mmap(f.fileno(), 0) - verify(len(mf) == 2**16, "Map size should equal file size.") - vereq(mf.read(2**16), 2**16 * "m") + self.assertEqual(len(mf), 2**16, "Map size should equal file size.") + self.assertEqual(mf.read(2**16), 2**16 * "m") mf.close() f.close() - finally: - os.unlink(TESTFN) - - # test mapping of entire file by passing 0 for map length - if hasattr(os, "stat"): - print " Ensuring that passing 0 as map length sets map size to current file size." - f = open(TESTFN, "w+") - try: - f.write(2**16 * 'm') # Arbitrary character - f.close() + def test_move(self): + # make move works everywhere (64-bit format problem earlier) + f = open(TESTFN, 'w+') - f = open(TESTFN, "rb+") - mf = mmap.mmap(f.fileno(), 0) - verify(len(mf) == 2**16, "Map size should equal file size.") - vereq(mf.read(2**16), 2**16 * "m") - mf.close() - f.close() - - finally: - os.unlink(TESTFN) - - # make move works everywhere (64-bit format problem earlier) - f = open(TESTFN, 'w+') - - try: # unlink TESTFN no matter what f.write("ABCDEabcde") # Arbitrary character f.flush() mf = mmap.mmap(f.fileno(), 10) mf.move(5, 0, 5) - verify(mf[:] == "ABCDEABCDE", "Map move should have duplicated front 5") + self.assertEqual(mf[:], "ABCDEABCDE", "Map move should have duplicated front 5") mf.close() f.close() - finally: - os.unlink(TESTFN) + def test_anonymous(self): + # anonymous mmap.mmap(-1, PAGE) + m = mmap.mmap(-1, PAGESIZE) + for x in xrange(PAGESIZE): + self.assertEqual(m[x], '\0', "anonymously mmap'ed contents should be zero") + + for x in xrange(PAGESIZE): + m[x] = ch = chr(x & 255) + self.assertEqual(m[x], ch) + +def test_main(): + run_unittest(MmapTests) -def test_anon(): - print " anonymous mmap.mmap(-1, PAGESIZE)..." - m = mmap.mmap(-1, PAGESIZE) - for x in xrange(PAGESIZE): - verify(m[x] == '\0', "anonymously mmap'ed contents should be zero") - - for x in xrange(PAGESIZE): - m[x] = ch = chr(x & 255) - vereq(m[x], ch) - -test_both() -test_anon() -print ' Test passed' +if __name__ == '__main__': + test_main() From python-checkins at python.org Sun Oct 29 20:20:45 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 20:20:45 +0100 (CET) Subject: [Python-checkins] r52538 - in python/trunk/Lib/test: output/test_poll test_poll.py Message-ID: <20061029192045.A3AC81E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 20:20:45 2006 New Revision: 52538 Removed: python/trunk/Lib/test/output/test_poll Modified: python/trunk/Lib/test/test_poll.py Log: Convert test_poll to unittest. Deleted: /python/trunk/Lib/test/output/test_poll ============================================================================== --- /python/trunk/Lib/test/output/test_poll Sun Oct 29 20:20:45 2006 +++ (empty file) @@ -1,19 +0,0 @@ -test_poll -Running poll test 1 - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. - This is a test. -Poll test 1 complete -Running poll test 2 -Poll test 2 complete -Running poll test 3 -Poll test 3 complete Modified: python/trunk/Lib/test/test_poll.py ============================================================================== --- python/trunk/Lib/test/test_poll.py (original) +++ python/trunk/Lib/test/test_poll.py Sun Oct 29 20:20:45 2006 @@ -1,7 +1,7 @@ # Test case for the os.poll() function -import sys, os, select, random -from test.test_support import verify, verbose, TestSkipped, TESTFN +import sys, os, select, random, unittest +from test.test_support import TestSkipped, TESTFN, run_unittest try: select.poll @@ -16,177 +16,141 @@ match.append(fd) return match -def test_poll1(): - """Basic functional test of poll object +class PollTests(unittest.TestCase): - Create a bunch of pipe and test that poll works with them. - """ - print 'Running poll test 1' - p = select.poll() - - NUM_PIPES = 12 - MSG = " This is a test." - MSG_LEN = len(MSG) - readers = [] - writers = [] - r2w = {} - w2r = {} - - for i in range(NUM_PIPES): - rd, wr = os.pipe() - p.register(rd, select.POLLIN) - p.register(wr, select.POLLOUT) - readers.append(rd) - writers.append(wr) - r2w[rd] = wr - w2r[wr] = rd - - while writers: - ready = p.poll() - ready_writers = find_ready_matching(ready, select.POLLOUT) - if not ready_writers: - raise RuntimeError, "no pipes ready for writing" - wr = random.choice(ready_writers) - os.write(wr, MSG) - - ready = p.poll() - ready_readers = find_ready_matching(ready, select.POLLIN) - if not ready_readers: - raise RuntimeError, "no pipes ready for reading" - rd = random.choice(ready_readers) - buf = os.read(rd, MSG_LEN) - verify(len(buf) == MSG_LEN) - print buf - os.close(r2w[rd]) ; os.close( rd ) - p.unregister( r2w[rd] ) - p.unregister( rd ) - writers.remove(r2w[rd]) - - poll_unit_tests() - print 'Poll test 1 complete' - -def poll_unit_tests(): - # returns NVAL for invalid file descriptor - FD = 42 - try: - os.close(FD) - except OSError: - pass - p = select.poll() - p.register(FD) - r = p.poll() - verify(r[0] == (FD, select.POLLNVAL)) - - f = open(TESTFN, 'w') - fd = f.fileno() - p = select.poll() - p.register(f) - r = p.poll() - verify(r[0][0] == fd) - f.close() - r = p.poll() - verify(r[0] == (fd, select.POLLNVAL)) - os.unlink(TESTFN) - - # type error for invalid arguments - p = select.poll() - try: - p.register(p) - except TypeError: - pass - else: - print "Bogus register call did not raise TypeError" - try: - p.unregister(p) - except TypeError: - pass - else: - print "Bogus unregister call did not raise TypeError" - - # can't unregister non-existent object - p = select.poll() - try: - p.unregister(3) - except KeyError: - pass - else: - print "Bogus unregister call did not raise KeyError" - - # Test error cases - pollster = select.poll() - class Nope: - pass - - class Almost: - def fileno(self): - return 'fileno' - - try: - pollster.register( Nope(), 0 ) - except TypeError: pass - else: print 'expected TypeError exception, not raised' - - try: - pollster.register( Almost(), 0 ) - except TypeError: pass - else: print 'expected TypeError exception, not raised' - - -# Another test case for poll(). This is copied from the test case for -# select(), modified to use poll() instead. - -def test_poll2(): - print 'Running poll test 2' - cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' - p = os.popen(cmd, 'r') - pollster = select.poll() - pollster.register( p, select.POLLIN ) - for tout in (0, 1000, 2000, 4000, 8000, 16000) + (-1,)*10: - if verbose: - print 'timeout =', tout - fdlist = pollster.poll(tout) - if (fdlist == []): - continue - fd, flags = fdlist[0] - if flags & select.POLLHUP: - line = p.readline() - if line != "": - print 'error: pipe seems to be closed, but still returns data' - continue - - elif flags & select.POLLIN: - line = p.readline() - if verbose: - print repr(line) - if not line: - if verbose: - print 'EOF' - break - continue - else: - print 'Unexpected return value from select.poll:', fdlist - p.close() - print 'Poll test 2 complete' - -def test_poll3(): - # test int overflow - print 'Running poll test 3' - pollster = select.poll() - pollster.register(1) - - try: - pollster.poll(1L << 64) - except OverflowError: - pass - else: - print 'Expected OverflowError with excessive timeout' - - x = 2 + 3 - if x != 5: - print 'Overflow must have occurred' - print 'Poll test 3 complete' - - -test_poll1() -test_poll2() -test_poll3() + def test_poll1(self): + # Basic functional test of poll object + # Create a bunch of pipe and test that poll works with them. + + p = select.poll() + + NUM_PIPES = 12 + MSG = " This is a test." + MSG_LEN = len(MSG) + readers = [] + writers = [] + r2w = {} + w2r = {} + + for i in range(NUM_PIPES): + rd, wr = os.pipe() + p.register(rd, select.POLLIN) + p.register(wr, select.POLLOUT) + readers.append(rd) + writers.append(wr) + r2w[rd] = wr + w2r[wr] = rd + + bufs = [] + + while writers: + ready = p.poll() + ready_writers = find_ready_matching(ready, select.POLLOUT) + if not ready_writers: + raise RuntimeError, "no pipes ready for writing" + wr = random.choice(ready_writers) + os.write(wr, MSG) + + ready = p.poll() + ready_readers = find_ready_matching(ready, select.POLLIN) + if not ready_readers: + raise RuntimeError, "no pipes ready for reading" + rd = random.choice(ready_readers) + buf = os.read(rd, MSG_LEN) + self.assertEqual(len(buf), MSG_LEN) + bufs.append(buf) + os.close(r2w[rd]) ; os.close( rd ) + p.unregister( r2w[rd] ) + p.unregister( rd ) + writers.remove(r2w[rd]) + + self.assertEqual(bufs, [MSG] * NUM_PIPES) + + def poll_unit_tests(self): + # returns NVAL for invalid file descriptor + FD = 42 + try: + os.close(FD) + except OSError: + pass + p = select.poll() + p.register(FD) + r = p.poll() + self.assertEqual(r[0], (FD, select.POLLNVAL)) + + f = open(TESTFN, 'w') + fd = f.fileno() + p = select.poll() + p.register(f) + r = p.poll() + self.assertEqual(r[0][0], fd) + f.close() + r = p.poll() + self.assertEqual(r[0], (fd, select.POLLNVAL)) + os.unlink(TESTFN) + + # type error for invalid arguments + p = select.poll() + self.assertRaises(TypeError, p.register, p) + self.assertRaises(TypeError, p.unregister, p) + + # can't unregister non-existent object + p = select.poll() + self.assertRaises(KeyError, p.unregister, 3) + + # Test error cases + pollster = select.poll() + class Nope: + pass + + class Almost: + def fileno(self): + return 'fileno' + + self.assertRaises(TypeError, pollster.register, Nope(), 0) + self.assertRaises(TypeError, pollster.register, Almost(), 0) + + # Another test case for poll(). This is copied from the test case for + # select(), modified to use poll() instead. + + def test_poll2(self): + cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' + p = os.popen(cmd, 'r') + pollster = select.poll() + pollster.register( p, select.POLLIN ) + for tout in (0, 1000, 2000, 4000, 8000, 16000) + (-1,)*10: + fdlist = pollster.poll(tout) + if (fdlist == []): + continue + fd, flags = fdlist[0] + if flags & select.POLLHUP: + line = p.readline() + if line != "": + self.fail('error: pipe seems to be closed, but still returns data') + continue + + elif flags & select.POLLIN: + line = p.readline() + if not line: + break + continue + else: + self.fail('Unexpected return value from select.poll: %s' % fdlist) + p.close() + + def test_poll3(self): + # test int overflow + pollster = select.poll() + pollster.register(1) + + self.assertRaises(OverflowError, pollster.poll, 1L << 64) + + x = 2 + 3 + if x != 5: + self.fail('Overflow must have occurred') + +def test_main(): + run_unittest(PollTests) + +if __name__ == '__main__': + test_main() From buildbot at python.org Sun Oct 29 20:21:28 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 19:21:28 +0000 Subject: [Python-checkins] buildbot warnings in x86 cygwin trunk Message-ID: <20061029192129.2A2F81E4005@bag.python.org> The Buildbot has detected a new failure of x86 cygwin trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520cygwin%2520trunk/builds/1259 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: 2 tests failed: test_mailbox test_mmap ====================================================================== ERROR: test_lock_conflict (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/test/test_mailbox.py", line 742, in test_lock_conflict self._box.lock) File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/unittest.py", line 320, in failUnlessRaises callableObj(*args, **kwargs) File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/mailbox.py", line 531, in lock _lock_file(self._file) File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/mailbox.py", line 1847, in _lock_file fcntl.lockf(f, fcntl.LOCK_UN) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_lock_conflict (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/test/test_mailbox.py", line 742, in test_lock_conflict self._box.lock) File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/unittest.py", line 320, in failUnlessRaises callableObj(*args, **kwargs) File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/mailbox.py", line 531, in lock _lock_file(self._file) File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/mailbox.py", line 1847, in _lock_file fcntl.lockf(f, fcntl.LOCK_UN) IOError: [Errno 13] Permission denied Traceback (most recent call last): File "./Lib/test/regrtest.py", line 546, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/test/test_mmap.py", line 393, in test_both() File "/home/anthony/Buildbot/trunk.baxter-cygwin/build/Lib/test/test_mmap.py", line 231, in test_both m.flush() EnvironmentError: [Errno 22] Invalid argument sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 20:24:43 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 20:24:43 +0100 (CET) Subject: [Python-checkins] r52539 - in python/trunk/Lib/test: output/test_nis test_nis.py Message-ID: <20061029192443.DA30B1E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 20:24:43 2006 New Revision: 52539 Removed: python/trunk/Lib/test/output/test_nis Modified: python/trunk/Lib/test/test_nis.py Log: Convert test_nis to unittest. Deleted: /python/trunk/Lib/test/output/test_nis ============================================================================== --- /python/trunk/Lib/test/output/test_nis Sun Oct 29 20:24:43 2006 +++ (empty file) @@ -1,2 +0,0 @@ -test_nis -nis.maps() Modified: python/trunk/Lib/test/test_nis.py ============================================================================== --- python/trunk/Lib/test/test_nis.py (original) +++ python/trunk/Lib/test/test_nis.py Sun Oct 29 20:24:43 2006 @@ -1,39 +1,41 @@ -from test.test_support import verbose, TestFailed, TestSkipped +from test.test_support import verbose, run_unittest +import unittest import nis -print 'nis.maps()' -try: - maps = nis.maps() -except nis.error, msg: - # NIS is probably not active, so this test isn't useful - if verbose: - raise TestFailed, msg - # only do this if running under the regression suite - raise TestSkipped, msg +class NisTests(unittest.TestCase): + def test_maps(self): + try: + maps = nis.maps() + except nis.error, msg: + # NIS is probably not active, so this test isn't useful + if verbose: + self.fail("(failing because of verbose mode) %s" % msg) + return + try: + # On some systems, this map is only accessible to the + # super user + maps.remove("passwd.adjunct.byname") + except ValueError: + pass -try: - # On some systems, this map is only accessible to the - # super user - maps.remove("passwd.adjunct.byname") -except ValueError: - pass + done = 0 + for nismap in maps: + mapping = nis.cat(nismap) + for k, v in mapping.items(): + if not k: + continue + if nis.match(k, nismap) != v: + self.fail("NIS match failed for key `%s' in map `%s'" % (k, nismap)) + else: + # just test the one key, otherwise this test could take a + # very long time + done = 1 + break + if done: + break -done = 0 -for nismap in maps: - if verbose: - print nismap - mapping = nis.cat(nismap) - for k, v in mapping.items(): - if verbose: - print ' ', k, v - if not k: - continue - if nis.match(k, nismap) != v: - print "NIS match failed for key `%s' in map `%s'" % (k, nismap) - else: - # just test the one key, otherwise this test could take a - # very long time - done = 1 - break - if done: - break +def test_main(): + run_unittest(NisTests) + +if __name__ == '__main__': + test_main() From python-checkins at python.org Sun Oct 29 20:35:05 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 20:35:05 +0100 (CET) Subject: [Python-checkins] r52540 - in python/trunk/Lib/test: output/test_types test_types.py Message-ID: <20061029193505.251341E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 20:35:03 2006 New Revision: 52540 Removed: python/trunk/Lib/test/output/test_types Modified: python/trunk/Lib/test/test_types.py Log: Convert test_types to unittest. Deleted: /python/trunk/Lib/test/output/test_types ============================================================================== --- /python/trunk/Lib/test/output/test_types Sun Oct 29 20:35:03 2006 +++ (empty file) @@ -1,15 +0,0 @@ -test_types -6. Built-in types -6.1 Truth value testing -6.2 Boolean operations -6.3 Comparisons -6.4 Numeric types (mostly conversions) -6.4.1 32-bit integers -6.4.2 Long integers -6.4.3 Floating point numbers -6.5 Sequence types -6.5.1 Strings -6.5.2 Tuples [see test_tuple.py] -6.5.3 Lists [see test_list.py] -6.6 Mappings == Dictionaries [see test_dict.py] -Buffers Modified: python/trunk/Lib/test/test_types.py ============================================================================== --- python/trunk/Lib/test/test_types.py (original) +++ python/trunk/Lib/test/test_types.py Sun Oct 29 20:35:03 2006 @@ -1,286 +1,273 @@ # Python test set -- part 6, built-in types -from test.test_support import * +from test.test_support import run_unittest, have_unicode +import unittest +import sys -print '6. Built-in types' +class TypesTests(unittest.TestCase): -print '6.1 Truth value testing' -if None: raise TestFailed, 'None is true instead of false' -if 0: raise TestFailed, '0 is true instead of false' -if 0L: raise TestFailed, '0L is true instead of false' -if 0.0: raise TestFailed, '0.0 is true instead of false' -if '': raise TestFailed, '\'\' is true instead of false' -if not 1: raise TestFailed, '1 is false instead of true' -if not 1L: raise TestFailed, '1L is false instead of true' -if not 1.0: raise TestFailed, '1.0 is false instead of true' -if not 'x': raise TestFailed, '\'x\' is false instead of true' -if not {'x': 1}: raise TestFailed, '{\'x\': 1} is false instead of true' -def f(): pass -class C: pass -import sys -x = C() -if not f: raise TestFailed, 'f is false instead of true' -if not C: raise TestFailed, 'C is false instead of true' -if not sys: raise TestFailed, 'sys is false instead of true' -if not x: raise TestFailed, 'x is false instead of true' - -print '6.2 Boolean operations' -if 0 or 0: raise TestFailed, '0 or 0 is true instead of false' -if 1 and 1: pass -else: raise TestFailed, '1 and 1 is false instead of true' -if not 1: raise TestFailed, 'not 1 is true instead of false' - -print '6.3 Comparisons' -if 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass -else: raise TestFailed, 'int comparisons failed' -if 0L < 1L <= 1L == 1L >= 1L > 0L != 1L: pass -else: raise TestFailed, 'long int comparisons failed' -if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0: pass -else: raise TestFailed, 'float comparisons failed' -if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass -else: raise TestFailed, 'string comparisons failed' -if None is None: pass -else: raise TestFailed, 'identity test failed' - -try: float('') -except ValueError: pass -else: raise TestFailed, "float('') didn't raise ValueError" - -try: float('5\0') -except ValueError: pass -else: raise TestFailed, "float('5\0') didn't raise ValueError" - -try: 5.0 / 0.0 -except ZeroDivisionError: pass -else: raise TestFailed, "5.0 / 0.0 didn't raise ZeroDivisionError" - -try: 5.0 // 0.0 -except ZeroDivisionError: pass -else: raise TestFailed, "5.0 // 0.0 didn't raise ZeroDivisionError" - -try: 5.0 % 0.0 -except ZeroDivisionError: pass -else: raise TestFailed, "5.0 % 0.0 didn't raise ZeroDivisionError" - -try: 5 / 0L -except ZeroDivisionError: pass -else: raise TestFailed, "5 / 0L didn't raise ZeroDivisionError" - -try: 5 // 0L -except ZeroDivisionError: pass -else: raise TestFailed, "5 // 0L didn't raise ZeroDivisionError" - -try: 5 % 0L -except ZeroDivisionError: pass -else: raise TestFailed, "5 % 0L didn't raise ZeroDivisionError" - -print '6.4 Numeric types (mostly conversions)' -if 0 != 0L or 0 != 0.0 or 0L != 0.0: raise TestFailed, 'mixed comparisons' -if 1 != 1L or 1 != 1.0 or 1L != 1.0: raise TestFailed, 'mixed comparisons' -if -1 != -1L or -1 != -1.0 or -1L != -1.0: - raise TestFailed, 'int/long/float value not equal' -# calling built-in types without argument must return 0 -if int() != 0: raise TestFailed, 'int() does not return 0' -if long() != 0L: raise TestFailed, 'long() does not return 0L' -if float() != 0.0: raise TestFailed, 'float() does not return 0.0' -if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass -else: raise TestFailed, 'int() does not round properly' -if long(1.9) == 1L == long(1.1) and long(-1.1) == -1L == long(-1.9): pass -else: raise TestFailed, 'long() does not round properly' -if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass -else: raise TestFailed, 'float() does not work properly' -print '6.4.1 32-bit integers' -# Ensure the first 256 integers are shared -a = 256 -b = 128*2 -if a is not b: raise TestFailed, '256 is not shared' -if 12 + 24 != 36: raise TestFailed, 'int op' -if 12 + (-24) != -12: raise TestFailed, 'int op' -if (-12) + 24 != 12: raise TestFailed, 'int op' -if (-12) + (-24) != -36: raise TestFailed, 'int op' -if not 12 < 24: raise TestFailed, 'int op' -if not -24 < -12: raise TestFailed, 'int op' -# Test for a particular bug in integer multiply -xsize, ysize, zsize = 238, 356, 4 -if not (xsize*ysize*zsize == zsize*xsize*ysize == 338912): - raise TestFailed, 'int mul commutativity' -# And another. -m = -sys.maxint - 1 -for divisor in 1, 2, 4, 8, 16, 32: - j = m // divisor - prod = divisor * j - if prod != m: - raise TestFailed, "%r * %r == %r != %r" % (divisor, j, prod, m) - if type(prod) is not int: - raise TestFailed, ("expected type(prod) to be int, not %r" % - type(prod)) -# Check for expected * overflow to long. -for divisor in 1, 2, 4, 8, 16, 32: - j = m // divisor - 1 - prod = divisor * j - if type(prod) is not long: - raise TestFailed, ("expected type(%r) to be long, not %r" % - (prod, type(prod))) -# Check for expected * overflow to long. -m = sys.maxint -for divisor in 1, 2, 4, 8, 16, 32: - j = m // divisor + 1 - prod = divisor * j - if type(prod) is not long: - raise TestFailed, ("expected type(%r) to be long, not %r" % - (prod, type(prod))) - -print '6.4.2 Long integers' -if 12L + 24L != 36L: raise TestFailed, 'long op' -if 12L + (-24L) != -12L: raise TestFailed, 'long op' -if (-12L) + 24L != 12L: raise TestFailed, 'long op' -if (-12L) + (-24L) != -36L: raise TestFailed, 'long op' -if not 12L < 24L: raise TestFailed, 'long op' -if not -24L < -12L: raise TestFailed, 'long op' -x = sys.maxint -if int(long(x)) != x: raise TestFailed, 'long op' -try: y = int(long(x)+1L) -except OverflowError: raise TestFailed, 'long op' -if not isinstance(y, long): raise TestFailed, 'long op' -x = -x -if int(long(x)) != x: raise TestFailed, 'long op' -x = x-1 -if int(long(x)) != x: raise TestFailed, 'long op' -try: y = int(long(x)-1L) -except OverflowError: raise TestFailed, 'long op' -if not isinstance(y, long): raise TestFailed, 'long op' - -try: 5 << -5 -except ValueError: pass -else: raise TestFailed, 'int negative shift <<' - -try: 5L << -5L -except ValueError: pass -else: raise TestFailed, 'long negative shift <<' - -try: 5 >> -5 -except ValueError: pass -else: raise TestFailed, 'int negative shift >>' - -try: 5L >> -5L -except ValueError: pass -else: raise TestFailed, 'long negative shift >>' - -print '6.4.3 Floating point numbers' -if 12.0 + 24.0 != 36.0: raise TestFailed, 'float op' -if 12.0 + (-24.0) != -12.0: raise TestFailed, 'float op' -if (-12.0) + 24.0 != 12.0: raise TestFailed, 'float op' -if (-12.0) + (-24.0) != -36.0: raise TestFailed, 'float op' -if not 12.0 < 24.0: raise TestFailed, 'float op' -if not -24.0 < -12.0: raise TestFailed, 'float op' - -print '6.5 Sequence types' - -print '6.5.1 Strings' -if len('') != 0: raise TestFailed, 'len(\'\')' -if len('a') != 1: raise TestFailed, 'len(\'a\')' -if len('abcdef') != 6: raise TestFailed, 'len(\'abcdef\')' -if 'xyz' + 'abcde' != 'xyzabcde': raise TestFailed, 'string concatenation' -if 'xyz'*3 != 'xyzxyzxyz': raise TestFailed, 'string repetition *3' -if 0*'abcde' != '': raise TestFailed, 'string repetition 0*' -if min('abc') != 'a' or max('abc') != 'c': raise TestFailed, 'min/max string' -if 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': pass -else: raise TestFailed, 'in/not in string' -x = 'x'*103 -if '%s!'%x != x+'!': raise TestFailed, 'nasty string formatting bug' - -#extended slices for strings -a = '0123456789' -vereq(a[::], a) -vereq(a[::2], '02468') -vereq(a[1::2], '13579') -vereq(a[::-1],'9876543210') -vereq(a[::-2], '97531') -vereq(a[3::-2], '31') -vereq(a[-100:100:], a) -vereq(a[100:-100:-1], a[::-1]) -vereq(a[-100L:100L:2L], '02468') - -if have_unicode: - a = unicode('0123456789', 'ascii') - vereq(a[::], a) - vereq(a[::2], unicode('02468', 'ascii')) - vereq(a[1::2], unicode('13579', 'ascii')) - vereq(a[::-1], unicode('9876543210', 'ascii')) - vereq(a[::-2], unicode('97531', 'ascii')) - vereq(a[3::-2], unicode('31', 'ascii')) - vereq(a[-100:100:], a) - vereq(a[100:-100:-1], a[::-1]) - vereq(a[-100L:100L:2L], unicode('02468', 'ascii')) - - -print '6.5.2 Tuples [see test_tuple.py]' - -print '6.5.3 Lists [see test_list.py]' - -print '6.6 Mappings == Dictionaries [see test_dict.py]' - - -try: type(1, 2) -except TypeError: pass -else: raise TestFailed, 'type(), w/2 args expected TypeError' - -try: type(1, 2, 3, 4) -except TypeError: pass -else: raise TestFailed, 'type(), w/4 args expected TypeError' - -print 'Buffers' -try: buffer('asdf', -1) -except ValueError: pass -else: raise TestFailed, "buffer('asdf', -1) should raise ValueError" -cmp(buffer("abc"), buffer("def")) # used to raise a warning: tp_compare didn't return -1, 0, or 1 - -try: buffer(None) -except TypeError: pass -else: raise TestFailed, "buffer(None) should raise TypeError" - -a = buffer('asdf') -hash(a) -b = a * 5 -if a == b: - raise TestFailed, 'buffers should not be equal' -if str(b) != ('asdf' * 5): - raise TestFailed, 'repeated buffer has wrong content' -if str(a * 0) != '': - raise TestFailed, 'repeated buffer zero times has wrong content' -if str(a + buffer('def')) != 'asdfdef': - raise TestFailed, 'concatenation of buffers yields wrong content' -if str(buffer(a)) != 'asdf': - raise TestFailed, 'composing buffers failed' -if str(buffer(a, 2)) != 'df': - raise TestFailed, 'specifying buffer offset failed' -if str(buffer(a, 0, 2)) != 'as': - raise TestFailed, 'specifying buffer size failed' -if str(buffer(a, 1, 2)) != 'sd': - raise TestFailed, 'specifying buffer offset and size failed' -try: buffer(buffer('asdf', 1), -1) -except ValueError: pass -else: raise TestFailed, "buffer(buffer('asdf', 1), -1) should raise ValueError" -if str(buffer(buffer('asdf', 0, 2), 0)) != 'as': - raise TestFailed, 'composing length-specified buffer failed' -if str(buffer(buffer('asdf', 0, 2), 0, 5000)) != 'as': - raise TestFailed, 'composing length-specified buffer failed' -if str(buffer(buffer('asdf', 0, 2), 0, -1)) != 'as': - raise TestFailed, 'composing length-specified buffer failed' -if str(buffer(buffer('asdf', 0, 2), 1, 2)) != 's': - raise TestFailed, 'composing length-specified buffer failed' - -try: a[1] = 'g' -except TypeError: pass -else: raise TestFailed, "buffer assignment should raise TypeError" - -try: a[0:1] = 'g' -except TypeError: pass -else: raise TestFailed, "buffer slice assignment should raise TypeError" - -# array.array() returns an object that does not implement a char buffer, -# something which int() uses for conversion. -import array -try: int(buffer(array.array('c'))) -except TypeError :pass -else: raise TestFailed, "char buffer (at C level) not working" + def test_truth_values(self): + if None: self.fail('None is true instead of false') + if 0: self.fail('0 is true instead of false') + if 0L: self.fail('0L is true instead of false') + if 0.0: self.fail('0.0 is true instead of false') + if '': self.fail('\'\' is true instead of false') + if not 1: self.fail('1 is false instead of true') + if not 1L: self.fail('1L is false instead of true') + if not 1.0: self.fail('1.0 is false instead of true') + if not 'x': self.fail('\'x\' is false instead of true') + if not {'x': 1}: self.fail('{\'x\': 1} is false instead of true') + def f(): pass + class C: pass + import sys + x = C() + if not f: self.fail('f is false instead of true') + if not C: self.fail('C is false instead of true') + if not sys: self.fail('sys is false instead of true') + if not x: self.fail('x is false instead of true') + + def test_boolean_ops(self): + if 0 or 0: self.fail('0 or 0 is true instead of false') + if 1 and 1: pass + else: self.fail('1 and 1 is false instead of true') + if not 1: self.fail('not 1 is true instead of false') + + def test_comparisons(self): + if 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass + else: self.fail('int comparisons failed') + if 0L < 1L <= 1L == 1L >= 1L > 0L != 1L: pass + else: self.fail('long int comparisons failed') + if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0: pass + else: self.fail('float comparisons failed') + if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass + else: self.fail('string comparisons failed') + if None is None: pass + else: self.fail('identity test failed') + + def test_float_constructor(self): + self.assertRaises(ValueError, float, '') + self.assertRaises(ValueError, float, '5\0') + + def test_zero_division(self): + try: 5.0 / 0.0 + except ZeroDivisionError: pass + else: self.fail("5.0 / 0.0 didn't raise ZeroDivisionError") + + try: 5.0 // 0.0 + except ZeroDivisionError: pass + else: self.fail("5.0 // 0.0 didn't raise ZeroDivisionError") + + try: 5.0 % 0.0 + except ZeroDivisionError: pass + else: self.fail("5.0 % 0.0 didn't raise ZeroDivisionError") + + try: 5 / 0L + except ZeroDivisionError: pass + else: self.fail("5 / 0L didn't raise ZeroDivisionError") + + try: 5 // 0L + except ZeroDivisionError: pass + else: self.fail("5 // 0L didn't raise ZeroDivisionError") + + try: 5 % 0L + except ZeroDivisionError: pass + else: self.fail("5 % 0L didn't raise ZeroDivisionError") + + def test_numeric_types(self): + if 0 != 0L or 0 != 0.0 or 0L != 0.0: self.fail('mixed comparisons') + if 1 != 1L or 1 != 1.0 or 1L != 1.0: self.fail('mixed comparisons') + if -1 != -1L or -1 != -1.0 or -1L != -1.0: + self.fail('int/long/float value not equal') + # calling built-in types without argument must return 0 + if int() != 0: self.fail('int() does not return 0') + if long() != 0L: self.fail('long() does not return 0L') + if float() != 0.0: self.fail('float() does not return 0.0') + if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass + else: self.fail('int() does not round properly') + if long(1.9) == 1L == long(1.1) and long(-1.1) == -1L == long(-1.9): pass + else: self.fail('long() does not round properly') + if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass + else: self.fail('float() does not work properly') + + def test_normal_integers(self): + # Ensure the first 256 integers are shared + a = 256 + b = 128*2 + if a is not b: self.fail('256 is not shared') + if 12 + 24 != 36: self.fail('int op') + if 12 + (-24) != -12: self.fail('int op') + if (-12) + 24 != 12: self.fail('int op') + if (-12) + (-24) != -36: self.fail('int op') + if not 12 < 24: self.fail('int op') + if not -24 < -12: self.fail('int op') + # Test for a particular bug in integer multiply + xsize, ysize, zsize = 238, 356, 4 + if not (xsize*ysize*zsize == zsize*xsize*ysize == 338912): + self.fail('int mul commutativity') + # And another. + m = -sys.maxint - 1 + for divisor in 1, 2, 4, 8, 16, 32: + j = m // divisor + prod = divisor * j + if prod != m: + self.fail("%r * %r == %r != %r" % (divisor, j, prod, m)) + if type(prod) is not int: + self.fail("expected type(prod) to be int, not %r" % + type(prod)) + # Check for expected * overflow to long. + for divisor in 1, 2, 4, 8, 16, 32: + j = m // divisor - 1 + prod = divisor * j + if type(prod) is not long: + self.fail("expected type(%r) to be long, not %r" % + (prod, type(prod))) + # Check for expected * overflow to long. + m = sys.maxint + for divisor in 1, 2, 4, 8, 16, 32: + j = m // divisor + 1 + prod = divisor * j + if type(prod) is not long: + self.fail("expected type(%r) to be long, not %r" % + (prod, type(prod))) + + def test_long_integers(self): + if 12L + 24L != 36L: self.fail('long op') + if 12L + (-24L) != -12L: self.fail('long op') + if (-12L) + 24L != 12L: self.fail('long op') + if (-12L) + (-24L) != -36L: self.fail('long op') + if not 12L < 24L: self.fail('long op') + if not -24L < -12L: self.fail('long op') + x = sys.maxint + if int(long(x)) != x: self.fail('long op') + try: y = int(long(x)+1L) + except OverflowError: self.fail('long op') + if not isinstance(y, long): self.fail('long op') + x = -x + if int(long(x)) != x: self.fail('long op') + x = x-1 + if int(long(x)) != x: self.fail('long op') + try: y = int(long(x)-1L) + except OverflowError: self.fail('long op') + if not isinstance(y, long): self.fail('long op') + + try: 5 << -5 + except ValueError: pass + else: self.fail('int negative shift <<') + + try: 5L << -5L + except ValueError: pass + else: self.fail('long negative shift <<') + + try: 5 >> -5 + except ValueError: pass + else: self.fail('int negative shift >>') + + try: 5L >> -5L + except ValueError: pass + else: self.fail('long negative shift >>') + + def test_floats(self): + if 12.0 + 24.0 != 36.0: self.fail('float op') + if 12.0 + (-24.0) != -12.0: self.fail('float op') + if (-12.0) + 24.0 != 12.0: self.fail('float op') + if (-12.0) + (-24.0) != -36.0: self.fail('float op') + if not 12.0 < 24.0: self.fail('float op') + if not -24.0 < -12.0: self.fail('float op') + + def test_strings(self): + if len('') != 0: self.fail('len(\'\')') + if len('a') != 1: self.fail('len(\'a\')') + if len('abcdef') != 6: self.fail('len(\'abcdef\')') + if 'xyz' + 'abcde' != 'xyzabcde': self.fail('string concatenation') + if 'xyz'*3 != 'xyzxyzxyz': self.fail('string repetition *3') + if 0*'abcde' != '': self.fail('string repetition 0*') + if min('abc') != 'a' or max('abc') != 'c': self.fail('min/max string') + if 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': pass + else: self.fail('in/not in string') + x = 'x'*103 + if '%s!'%x != x+'!': self.fail('nasty string formatting bug') + + #extended slices for strings + a = '0123456789' + self.assertEqual(a[::], a) + self.assertEqual(a[::2], '02468') + self.assertEqual(a[1::2], '13579') + self.assertEqual(a[::-1],'9876543210') + self.assertEqual(a[::-2], '97531') + self.assertEqual(a[3::-2], '31') + self.assertEqual(a[-100:100:], a) + self.assertEqual(a[100:-100:-1], a[::-1]) + self.assertEqual(a[-100L:100L:2L], '02468') + + if have_unicode: + a = unicode('0123456789', 'ascii') + self.assertEqual(a[::], a) + self.assertEqual(a[::2], unicode('02468', 'ascii')) + self.assertEqual(a[1::2], unicode('13579', 'ascii')) + self.assertEqual(a[::-1], unicode('9876543210', 'ascii')) + self.assertEqual(a[::-2], unicode('97531', 'ascii')) + self.assertEqual(a[3::-2], unicode('31', 'ascii')) + self.assertEqual(a[-100:100:], a) + self.assertEqual(a[100:-100:-1], a[::-1]) + self.assertEqual(a[-100L:100L:2L], unicode('02468', 'ascii')) + + + def test_type_function(self): + self.assertRaises(TypeError, type, 1, 2) + self.assertRaises(TypeError, type, 1, 2, 3, 4) + + def test_buffers(self): + self.assertRaises(ValueError, buffer, 'asdf', -1) + cmp(buffer("abc"), buffer("def")) # used to raise a warning: tp_compare didn't return -1, 0, or 1 + + self.assertRaises(TypeError, buffer, None) + + a = buffer('asdf') + hash(a) + b = a * 5 + if a == b: + self.fail('buffers should not be equal') + if str(b) != ('asdf' * 5): + self.fail('repeated buffer has wrong content') + if str(a * 0) != '': + self.fail('repeated buffer zero times has wrong content') + if str(a + buffer('def')) != 'asdfdef': + self.fail('concatenation of buffers yields wrong content') + if str(buffer(a)) != 'asdf': + self.fail('composing buffers failed') + if str(buffer(a, 2)) != 'df': + self.fail('specifying buffer offset failed') + if str(buffer(a, 0, 2)) != 'as': + self.fail('specifying buffer size failed') + if str(buffer(a, 1, 2)) != 'sd': + self.fail('specifying buffer offset and size failed') + self.assertRaises(ValueError, buffer, buffer('asdf', 1), -1) + if str(buffer(buffer('asdf', 0, 2), 0)) != 'as': + self.fail('composing length-specified buffer failed') + if str(buffer(buffer('asdf', 0, 2), 0, 5000)) != 'as': + self.fail('composing length-specified buffer failed') + if str(buffer(buffer('asdf', 0, 2), 0, -1)) != 'as': + self.fail('composing length-specified buffer failed') + if str(buffer(buffer('asdf', 0, 2), 1, 2)) != 's': + self.fail('composing length-specified buffer failed') + + try: a[1] = 'g' + except TypeError: pass + else: self.fail("buffer assignment should raise TypeError") + + try: a[0:1] = 'g' + except TypeError: pass + else: self.fail("buffer slice assignment should raise TypeError") + + # array.array() returns an object that does not implement a char buffer, + # something which int() uses for conversion. + import array + try: int(buffer(array.array('c'))) + except TypeError: pass + else: self.fail("char buffer (at C level) not working") + +def test_main(): + run_unittest(TypesTests) + +if __name__ == '__main__': + test_main() From python-checkins at python.org Sun Oct 29 20:51:17 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 20:51:17 +0100 (CET) Subject: [Python-checkins] r52541 - in python/trunk/Lib/test: output/test_cookie test_cookie.py Message-ID: <20061029195117.030401E400E@bag.python.org> Author: georg.brandl Date: Sun Oct 29 20:51:16 2006 New Revision: 52541 Removed: python/trunk/Lib/test/output/test_cookie Modified: python/trunk/Lib/test/test_cookie.py Log: Convert test_cookie to unittest. Deleted: /python/trunk/Lib/test/output/test_cookie ============================================================================== --- /python/trunk/Lib/test/output/test_cookie Sun Oct 29 20:51:16 2006 +++ (empty file) @@ -1,32 +0,0 @@ -test_cookie - -Set-Cookie: chips=ahoy -Set-Cookie: vienna=finger - chips 'ahoy' 'ahoy' -Set-Cookie: chips=ahoy - vienna 'finger' 'finger' -Set-Cookie: vienna=finger - -Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;" - keebler 'E=mc2; L="Loves"; fudge=\n;' 'E=mc2; L="Loves"; fudge=\n;' -Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;" - -Set-Cookie: keebler=E=mc2 - keebler 'E=mc2' 'E=mc2' -Set-Cookie: keebler=E=mc2 -Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme - - - - - - -If anything blows up after this line, it's from Cookie's doctest. Modified: python/trunk/Lib/test/test_cookie.py ============================================================================== --- python/trunk/Lib/test/test_cookie.py (original) +++ python/trunk/Lib/test/test_cookie.py Sun Oct 29 20:51:16 2006 @@ -1,6 +1,7 @@ # Simple test suite for Cookie.py -from test.test_support import verify, verbose, run_doctest +from test.test_support import run_unittest, run_doctest +import unittest import Cookie import warnings @@ -8,43 +9,74 @@ ".* class is insecure.*", DeprecationWarning) -# Currently this only tests SimpleCookie +class CookieTests(unittest.TestCase): + # Currently this only tests SimpleCookie + def test_basic(self): + cases = [ + { 'data': 'chips=ahoy; vienna=finger', + 'dict': {'chips':'ahoy', 'vienna':'finger'}, + 'repr': "", + 'output': 'Set-Cookie: chips=ahoy\nSet-Cookie: vienna=finger', + }, + + { 'data': 'keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"', + 'dict': {'keebler' : 'E=mc2; L="Loves"; fudge=\012;'}, + 'repr': '''''', + 'output': 'Set-Cookie: keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"', + }, + + # Check illegal cookies that have an '=' char in an unquoted value + { 'data': 'keebler=E=mc2', + 'dict': {'keebler' : 'E=mc2'}, + 'repr': "", + 'output': 'Set-Cookie: keebler=E=mc2', + } + ] + + for case in cases: + C = Cookie.SimpleCookie() + C.load(case['data']) + self.assertEqual(repr(C), case['repr']) + self.assertEqual(C.output(sep='\n'), case['output']) + for k, v in sorted(case['dict'].iteritems()): + self.assertEqual(C[k].value, v) + + def test_load(self): + C = Cookie.SimpleCookie() + C.load('Customer="WILE_E_COYOTE"; Version=1; Path=/acme') + + self.assertEqual(C['Customer'].value, 'WILE_E_COYOTE') + self.assertEqual(C['Customer']['version'], '1') + self.assertEqual(C['Customer']['path'], '/acme') + + self.assertEqual(C.output(['path']), + 'Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme') + self.assertEqual(C.js_output(), """ + + """) + self.assertEqual(C.js_output(['path']), """ + + """) + + def test_quoted_meta(self): + # Try cookie with quoted meta-data + C = Cookie.SimpleCookie() + C.load('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"') + self.assertEqual(C['Customer'].value, 'WILE_E_COYOTE') + self.assertEqual(C['Customer']['version'], '1') + self.assertEqual(C['Customer']['path'], '/acme') + +def test_main(): + run_unittest(CookieTests) + run_doctest(Cookie) -cases = [ - ('chips=ahoy; vienna=finger', {'chips':'ahoy', 'vienna':'finger'}), - ('keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"', - {'keebler' : 'E=mc2; L="Loves"; fudge=\012;'}), - - # Check illegal cookies that have an '=' char in an unquoted value - ('keebler=E=mc2', {'keebler' : 'E=mc2'}) - ] - -for data, dict in cases: - C = Cookie.SimpleCookie() ; C.load(data) - print repr(C) - print C.output(sep='\n') - for k, v in sorted(dict.iteritems()): - print ' ', k, repr( C[k].value ), repr(v) - verify(C[k].value == v) - print C[k] - -C = Cookie.SimpleCookie() -C.load('Customer="WILE_E_COYOTE"; Version=1; Path=/acme') - -verify(C['Customer'].value == 'WILE_E_COYOTE') -verify(C['Customer']['version'] == '1') -verify(C['Customer']['path'] == '/acme') - -print C.output(['path']) -print C.js_output() -print C.js_output(['path']) - -# Try cookie with quoted meta-data -C = Cookie.SimpleCookie() -C.load('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"') -verify(C['Customer'].value == 'WILE_E_COYOTE') -verify(C['Customer']['version'] == '1') -verify(C['Customer']['path'] == '/acme') - -print "If anything blows up after this line, it's from Cookie's doctest." -run_doctest(Cookie) +if __name__ == '__main__': + test_main() From python-checkins at python.org Sun Oct 29 21:09:13 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 21:09:13 +0100 (CET) Subject: [Python-checkins] r52542 - in python/trunk/Lib/test: output/test_cgi test_cgi.py Message-ID: <20061029200913.975031E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 21:09:12 2006 New Revision: 52542 Removed: python/trunk/Lib/test/output/test_cgi Modified: python/trunk/Lib/test/test_cgi.py Log: Convert test_cgi to unittest. Deleted: /python/trunk/Lib/test/output/test_cgi ============================================================================== --- /python/trunk/Lib/test/output/test_cgi Sun Oct 29 21:09:12 2006 +++ (empty file) @@ -1,42 +0,0 @@ -test_cgi -'' => [] -'&' => [] -'&&' => [] -'=' => [('', '')] -'=a' => [('', 'a')] -'a' => [('a', '')] -'a=' => [('a', '')] -'a=' => [('a', '')] -'&a=b' => [('a', 'b')] -'a=a+b&b=b+c' => [('a', 'a b'), ('b', 'b c')] -'a=1&a=2' => [('a', '1'), ('a', '2')] -'' -'&' -'&&' -';' -';&;' -'=' -'=&=' -'=;=' -'=a' -'&=a' -'=a&' -'=&a' -'b=a' -'b+=a' -'a=b=a' -'a=+b=a' -'&b=a' -'b&=a' -'a=a+b&b=b+c' -'a=a+b&a=b+a' -'x=1&y=2.0&z=2-3.%2b0' -'x=1;y=2.0&z=2-3.%2b0' -'x=1;y=2.0;z=2-3.%2b0' -'Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=env' -'group_id=5470&set=custom&_assigned_to=31392&_status=1&_category=100&SUBMIT=Browse' -Testing log -Testing initlog 1 -Testing log 2 -Test FieldStorage methods that use readline -Test basic FieldStorage multipart parsing Modified: python/trunk/Lib/test/test_cgi.py ============================================================================== --- python/trunk/Lib/test/test_cgi.py (original) +++ python/trunk/Lib/test/test_cgi.py Sun Oct 29 21:09:12 2006 @@ -1,8 +1,9 @@ -from test.test_support import verify, verbose +from test.test_support import run_unittest import cgi import os import sys import tempfile +import unittest from StringIO import StringIO class HackedSysModule: @@ -129,119 +130,124 @@ def first_second_elts(list): return map(lambda p:(p[0], p[1][0]), list) -def main(): - for orig, expect in parse_qsl_test_cases: - result = cgi.parse_qsl(orig, keep_blank_values=True) - print repr(orig), '=>', result - verify(result == expect, "Error parsing %s" % repr(orig)) - - for orig, expect in parse_strict_test_cases: - # Test basic parsing - print repr(orig) - d = do_test(orig, "GET") - verify(d == expect, "Error parsing %s" % repr(orig)) - d = do_test(orig, "POST") - verify(d == expect, "Error parsing %s" % repr(orig)) - - env = {'QUERY_STRING': orig} - fcd = cgi.FormContentDict(env) - sd = cgi.SvFormContentDict(env) - fs = cgi.FieldStorage(environ=env) - if type(expect) == type({}): - # test dict interface - verify(len(expect) == len(fcd)) - verify(norm(expect.keys()) == norm(fcd.keys())) - verify(norm(expect.values()) == norm(fcd.values())) - verify(norm(expect.items()) == norm(fcd.items())) - verify(fcd.get("nonexistent field", "default") == "default") - verify(len(sd) == len(fs)) - verify(norm(sd.keys()) == norm(fs.keys())) - verify(fs.getvalue("nonexistent field", "default") == "default") - # test individual fields - for key in expect.keys(): - expect_val = expect[key] - verify(fcd.has_key(key)) - verify(norm(fcd[key]) == norm(expect[key])) - verify(fcd.get(key, "default") == fcd[key]) - verify(fs.has_key(key)) - if len(expect_val) > 1: - single_value = 0 - else: - single_value = 1 - try: - val = sd[key] - except IndexError: - verify(not single_value) - verify(fs.getvalue(key) == expect_val) +class CgiTests(unittest.TestCase): + + def test_qsl(self): + for orig, expect in parse_qsl_test_cases: + result = cgi.parse_qsl(orig, keep_blank_values=True) + self.assertEqual(result, expect, "Error parsing %s" % repr(orig)) + + def test_strict(self): + for orig, expect in parse_strict_test_cases: + # Test basic parsing + d = do_test(orig, "GET") + self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) + d = do_test(orig, "POST") + self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) + + env = {'QUERY_STRING': orig} + fcd = cgi.FormContentDict(env) + sd = cgi.SvFormContentDict(env) + fs = cgi.FieldStorage(environ=env) + if type(expect) == type({}): + # test dict interface + self.assertEqual(len(expect), len(fcd)) + self.assertEqual(norm(expect.keys()), norm(fcd.keys())) + self.assertEqual(norm(expect.values()), norm(fcd.values())) + self.assertEqual(norm(expect.items()), norm(fcd.items())) + self.assertEqual(fcd.get("nonexistent field", "default"), "default") + self.assertEqual(len(sd), len(fs)) + self.assertEqual(norm(sd.keys()), norm(fs.keys())) + self.assertEqual(fs.getvalue("nonexistent field", "default"), "default") + # test individual fields + for key in expect.keys(): + expect_val = expect[key] + self.assert_(fcd.has_key(key)) + self.assertEqual(norm(fcd[key]), norm(expect[key])) + self.assertEqual(fcd.get(key, "default"), fcd[key]) + self.assert_(fs.has_key(key)) + if len(expect_val) > 1: + single_value = 0 + else: + single_value = 1 + try: + val = sd[key] + except IndexError: + self.failIf(single_value) + self.assertEqual(fs.getvalue(key), expect_val) + else: + self.assert_(single_value) + self.assertEqual(val, expect_val[0]) + self.assertEqual(fs.getvalue(key), expect_val[0]) + self.assertEqual(norm(sd.getlist(key)), norm(expect_val)) + if single_value: + self.assertEqual(norm(sd.values()), + first_elts(norm(expect.values()))) + self.assertEqual(norm(sd.items()), + first_second_elts(norm(expect.items()))) + + def test_weird_formcontentdict(self): + # Test the weird FormContentDict classes + env = {'QUERY_STRING': "x=1&y=2.0&z=2-3.%2b0&1=1abc"} + expect = {'x': 1, 'y': 2.0, 'z': '2-3.+0', '1': '1abc'} + d = cgi.InterpFormContentDict(env) + for k, v in expect.items(): + self.assertEqual(d[k], v) + for k, v in d.items(): + self.assertEqual(expect[k], v) + self.assertEqual(norm(expect.values()), norm(d.values())) + + def test_log(self): + cgi.log("Testing") + + cgi.logfp = StringIO() + cgi.initlog("%s", "Testing initlog 1") + cgi.log("%s", "Testing log 2") + self.assertEqual(cgi.logfp.getvalue(), "Testing initlog 1\nTesting log 2\n") + if os.path.exists("/dev/null"): + cgi.logfp = None + cgi.logfile = "/dev/null" + cgi.initlog("%s", "Testing log 3") + cgi.log("Testing log 4") + + def test_fieldstorage_readline(self): + # FieldStorage uses readline, which has the capacity to read all + # contents of the input file into memory; we use readline's size argument + # to prevent that for files that do not contain any newlines in + # non-GET/HEAD requests + class TestReadlineFile: + def __init__(self, file): + self.file = file + self.numcalls = 0 + + def readline(self, size=None): + self.numcalls += 1 + if size: + return self.file.readline(size) else: - verify(single_value) - verify(val == expect_val[0]) - verify(fs.getvalue(key) == expect_val[0]) - verify(norm(sd.getlist(key)) == norm(expect_val)) - if single_value: - verify(norm(sd.values()) == \ - first_elts(norm(expect.values()))) - verify(norm(sd.items()) == \ - first_second_elts(norm(expect.items()))) - - # Test the weird FormContentDict classes - env = {'QUERY_STRING': "x=1&y=2.0&z=2-3.%2b0&1=1abc"} - expect = {'x': 1, 'y': 2.0, 'z': '2-3.+0', '1': '1abc'} - d = cgi.InterpFormContentDict(env) - for k, v in expect.items(): - verify(d[k] == v) - for k, v in d.items(): - verify(expect[k] == v) - verify(norm(expect.values()) == norm(d.values())) - - print "Testing log" - cgi.log("Testing") - cgi.logfp = sys.stdout - cgi.initlog("%s", "Testing initlog 1") - cgi.log("%s", "Testing log 2") - if os.path.exists("/dev/null"): - cgi.logfp = None - cgi.logfile = "/dev/null" - cgi.initlog("%s", "Testing log 3") - cgi.log("Testing log 4") - - print "Test FieldStorage methods that use readline" - # FieldStorage uses readline, which has the capacity to read all - # contents of the input file into memory; we use readline's size argument - # to prevent that for files that do not contain any newlines in - # non-GET/HEAD requests - class TestReadlineFile: - def __init__(self, file): - self.file = file - self.numcalls = 0 - - def readline(self, size=None): - self.numcalls += 1 - if size: - return self.file.readline(size) - else: - return self.file.readline() - - def __getattr__(self, name): - file = self.__dict__['file'] - a = getattr(file, name) - if not isinstance(a, int): - setattr(self, name, a) - return a - - f = TestReadlineFile(tempfile.TemporaryFile()) - f.write('x' * 256 * 1024) - f.seek(0) - env = {'REQUEST_METHOD':'PUT'} - fs = cgi.FieldStorage(fp=f, environ=env) - # if we're not chunking properly, readline is only called twice - # (by read_binary); if we are chunking properly, it will be called 5 times - # as long as the chunksize is 1 << 16. - verify(f.numcalls > 2) - - print "Test basic FieldStorage multipart parsing" - env = {'REQUEST_METHOD':'POST', 'CONTENT_TYPE':'multipart/form-data; boundary=---------------------------721837373350705526688164684', 'CONTENT_LENGTH':'558'} - postdata = """-----------------------------721837373350705526688164684 + return self.file.readline() + + def __getattr__(self, name): + file = self.__dict__['file'] + a = getattr(file, name) + if not isinstance(a, int): + setattr(self, name, a) + return a + + f = TestReadlineFile(tempfile.TemporaryFile()) + f.write('x' * 256 * 1024) + f.seek(0) + env = {'REQUEST_METHOD':'PUT'} + fs = cgi.FieldStorage(fp=f, environ=env) + # if we're not chunking properly, readline is only called twice + # (by read_binary); if we are chunking properly, it will be called 5 times + # as long as the chunksize is 1 << 16. + self.assert_(f.numcalls > 2) + + def test_fieldstorage_multipart(self): + #Test basic FieldStorage multipart parsing + env = {'REQUEST_METHOD':'POST', 'CONTENT_TYPE':'multipart/form-data; boundary=---------------------------721837373350705526688164684', 'CONTENT_LENGTH':'558'} + postdata = """-----------------------------721837373350705526688164684 Content-Disposition: form-data; name="id" 1234 @@ -261,15 +267,19 @@ Add\x20 -----------------------------721837373350705526688164684-- """ - fs = cgi.FieldStorage(fp=StringIO(postdata), environ=env) - verify(len(fs.list) == 4) - expect = [{'name':'id', 'filename':None, 'value':'1234'}, - {'name':'title', 'filename':None, 'value':''}, - {'name':'file', 'filename':'test.txt','value':'Testing 123.\n'}, - {'name':'submit', 'filename':None, 'value':' Add '}] - for x in range(len(fs.list)): - for k, exp in expect[x].items(): - got = getattr(fs.list[x], k) - verify(got == exp) + fs = cgi.FieldStorage(fp=StringIO(postdata), environ=env) + self.assertEquals(len(fs.list), 4) + expect = [{'name':'id', 'filename':None, 'value':'1234'}, + {'name':'title', 'filename':None, 'value':''}, + {'name':'file', 'filename':'test.txt','value':'Testing 123.\n'}, + {'name':'submit', 'filename':None, 'value':' Add '}] + for x in range(len(fs.list)): + for k, exp in expect[x].items(): + got = getattr(fs.list[x], k) + self.assertEquals(got, exp) + +def test_main(): + run_unittest(CgiTests) -main() +if __name__ == '__main__': + test_main() From buildbot at python.org Sun Oct 29 21:19:27 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 20:19:27 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 2.5 Message-ID: <20061029201927.3A0711E4005@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/90 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 Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== FAIL: testInterruptedTimeout (test.test_socket.TCPTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/net/ringneck/scratch1/nnorwitz/buildbot/2.5.norwitz-tru64/build/Lib/test/test_socket.py", line 847, in testInterruptedTimeout self.fail("got Alarm in wrong place") AssertionError: got Alarm in wrong place sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 21:24:02 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 21:24:02 +0100 (CET) Subject: [Python-checkins] r52543 - in python/trunk/Lib/test: output/test_httplib test_httplib.py Message-ID: <20061029202402.6E4741E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 21:24:01 2006 New Revision: 52543 Removed: python/trunk/Lib/test/output/test_httplib Modified: python/trunk/Lib/test/test_httplib.py Log: Completely convert test_httplib to unittest. Deleted: /python/trunk/Lib/test/output/test_httplib ============================================================================== --- /python/trunk/Lib/test/output/test_httplib Sun Oct 29 21:24:01 2006 +++ (empty file) @@ -1,13 +0,0 @@ -test_httplib -reply: 'HTTP/1.1 200 Ok\r\n' -Text -reply: 'HTTP/1.1 400.100 Not Ok\r\n' -BadStatusLine raised as expected -InvalidURL raised as expected -InvalidURL raised as expected -reply: 'HTTP/1.1 200 OK\r\n' -header: Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme" -header: Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme" -reply: 'HTTP/1.1 200 OK\r\n' -header: Content-Length: 14432 - Modified: python/trunk/Lib/test/test_httplib.py ============================================================================== --- python/trunk/Lib/test/test_httplib.py (original) +++ python/trunk/Lib/test/test_httplib.py Sun Oct 29 21:24:01 2006 @@ -70,95 +70,68 @@ conn.request('POST', '/', body, headers) self.assertEqual(conn._buffer.count[header.lower()], 1) -# Collect output to a buffer so that we don't have to cope with line-ending -# issues across platforms. Specifically, the headers will have \r\n pairs -# and some platforms will strip them from the output file. - -def test(): - buf = StringIO.StringIO() - _stdout = sys.stdout - try: - sys.stdout = buf - _test() - finally: - sys.stdout = _stdout - - # print individual lines with endings stripped - s = buf.getvalue() - for line in s.split("\n"): - print line.strip() - -def _test(): - # Test HTTP status lines - - body = "HTTP/1.1 200 Ok\r\n\r\nText" - sock = FakeSocket(body) - resp = httplib.HTTPResponse(sock, 1) - resp.begin() - print resp.read() - resp.close() - - body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" - sock = FakeSocket(body) - resp = httplib.HTTPResponse(sock, 1) - try: +class BasicTest(TestCase): + def test_status_lines(self): + # Test HTTP status lines + + body = "HTTP/1.1 200 Ok\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) resp.begin() - except httplib.BadStatusLine: - print "BadStatusLine raised as expected" - else: - print "Expect BadStatusLine" - - # Check invalid host_port - - for hp in ("www.python.org:abc", "www.python.org:"): - try: - h = httplib.HTTP(hp) - except httplib.InvalidURL: - print "InvalidURL raised as expected" - else: - print "Expect InvalidURL" - - for hp,h,p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", 8000), - ("www.python.org:80", "www.python.org", 80), - ("www.python.org", "www.python.org", 80), - ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)): - try: + self.assertEqual(resp.read(), 'Text') + resp.close() + + body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) + self.assertRaises(httplib.BadStatusLine, resp.begin) + + def test_host_port(self): + # Check invalid host_port + + for hp in ("www.python.org:abc", "www.python.org:"): + self.assertRaises(httplib.InvalidURL, httplib.HTTP, hp) + + for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", 8000), + ("www.python.org:80", "www.python.org", 80), + ("www.python.org", "www.python.org", 80), + ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)): http = httplib.HTTP(hp) - except httplib.InvalidURL: - print "InvalidURL raised erroneously" - c = http._conn - if h != c.host: raise AssertionError, ("Host incorrectly parsed", h, c.host) - if p != c.port: raise AssertionError, ("Port incorrectly parsed", p, c.host) - - # test response with multiple message headers with the same field name. - text = ('HTTP/1.1 200 OK\r\n' - 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' - 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' - ' Path="/acme"\r\n' - '\r\n' - 'No body\r\n') - hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' - ', ' - 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') - s = FakeSocket(text) - r = httplib.HTTPResponse(s, 1) - r.begin() - cookies = r.getheader("Set-Cookie") - if cookies != hdr: - raise AssertionError, "multiple headers not combined properly" - - # Test that the library doesn't attempt to read any data - # from a HEAD request. (Tickles SF bug #622042.) - sock = FakeSocket( - 'HTTP/1.1 200 OK\r\n' - 'Content-Length: 14432\r\n' - '\r\n', - NoEOFStringIO) - resp = httplib.HTTPResponse(sock, 1, method="HEAD") - resp.begin() - if resp.read() != "": - raise AssertionError, "Did not expect response from HEAD request" - resp.close() + c = http._conn + if h != c.host: self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) + if p != c.port: self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) + + def test_response_headers(self): + # test response with multiple message headers with the same field name. + text = ('HTTP/1.1 200 OK\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' + ' Path="/acme"\r\n' + '\r\n' + 'No body\r\n') + hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' + ', ' + 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') + s = FakeSocket(text) + r = httplib.HTTPResponse(s) + r.begin() + cookies = r.getheader("Set-Cookie") + if cookies != hdr: + self.fail("multiple headers not combined properly") + + def test_read_head(self): + # Test that the library doesn't attempt to read any data + # from a HEAD request. (Tickles SF bug #622042.) + sock = FakeSocket( + 'HTTP/1.1 200 OK\r\n' + 'Content-Length: 14432\r\n' + '\r\n', + NoEOFStringIO) + resp = httplib.HTTPResponse(sock, method="HEAD") + resp.begin() + if resp.read() != "": + self.fail("Did not expect response from HEAD request") + resp.close() class OfflineTest(TestCase): @@ -166,7 +139,7 @@ self.assertEquals(httplib.responses[httplib.NOT_FOUND], "Not Found") def test_main(verbose=None): - tests = [HeaderTests,OfflineTest] - test_support.run_unittest(*tests) + test_support.run_unittest(HeaderTests, OfflineTest, BasicTest) -test() +if __name__ == '__main__': + test_main() From buildbot at python.org Sun Oct 29 21:28:19 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 20:28:19 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper 2.5 Message-ID: <20061029202820.212181E4005@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/87 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 Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 21:28:26 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 21:28:26 +0100 (CET) Subject: [Python-checkins] r52544 - in python/trunk/Lib/test: output/test_MimeWriter test_MimeWriter.py Message-ID: <20061029202826.90D241E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 21:28:26 2006 New Revision: 52544 Removed: python/trunk/Lib/test/output/test_MimeWriter Modified: python/trunk/Lib/test/test_MimeWriter.py Log: Convert test_MimeWriter to unittest. Deleted: /python/trunk/Lib/test/output/test_MimeWriter ============================================================================== --- /python/trunk/Lib/test/output/test_MimeWriter Sun Oct 29 21:28:26 2006 +++ (empty file) @@ -1,110 +0,0 @@ -test_MimeWriter -From: bwarsaw at cnri.reston.va.us -Date: Mon Feb 12 17:21:48 EST 1996 -To: kss-submit at cnri.reston.va.us -MIME-Version: 1.0 -Content-Type: multipart/knowbot; - boundary="801spam999"; - version="0.1" - -This is a multi-part message in MIME format. - ---801spam999 -Content-Type: multipart/knowbot-metadata; - boundary="802spam999" - - ---802spam999 -Content-Type: message/rfc822 -KP-Metadata-Type: simple -KP-Access: read-only - -KPMD-Interpreter: python -KPMD-Interpreter-Version: 1.3 -KPMD-Owner-Name: Barry Warsaw -KPMD-Owner-Rendezvous: bwarsaw at cnri.reston.va.us -KPMD-Home-KSS: kss.cnri.reston.va.us -KPMD-Identifier: hdl://cnri.kss/my_first_knowbot -KPMD-Launch-Date: Mon Feb 12 16:39:03 EST 1996 - ---802spam999 -Content-Type: text/isl -KP-Metadata-Type: complex -KP-Metadata-Key: connection -KP-Access: read-only -KP-Connection-Description: Barry's Big Bass Business -KP-Connection-Id: B4 -KP-Connection-Direction: client - -INTERFACE Seller-1; - -TYPE Seller = OBJECT - DOCUMENTATION "A simple Seller interface to test ILU" - METHODS - price():INTEGER, - END; - ---802spam999 -Content-Type: message/external-body; - access-type="URL"; - URL="hdl://cnri.kss/generic-knowbot" - -Content-Type: text/isl -KP-Metadata-Type: complex -KP-Metadata-Key: generic-interface -KP-Access: read-only -KP-Connection-Description: Generic Interface for All Knowbots -KP-Connection-Id: generic-kp -KP-Connection-Direction: client - - ---802spam999-- - ---801spam999 -Content-Type: multipart/knowbot-code; - boundary="803spam999" - - ---803spam999 -Content-Type: text/plain -KP-Module-Name: BuyerKP - -class Buyer: - def __setup__(self, maxprice): - self._maxprice = maxprice - - def __main__(self, kos): - """Entry point upon arrival at a new KOS.""" - broker = kos.broker() - # B4 == Barry's Big Bass Business :-) - seller = broker.lookup('Seller_1.Seller', 'B4') - if seller: - price = seller.price() - print 'Seller wants $', price, '... ' - if price > self._maxprice: - print 'too much!' - else: - print "I'll take it!" - else: - print 'no seller found here' - ---803spam999-- - ---801spam999 -Content-Type: multipart/knowbot-state; - boundary="804spam999" -KP-Main-Module: main - - ---804spam999 -Content-Type: text/plain -KP-Module-Name: main - -# instantiate a buyer instance and put it in a magic place for the KOS -# to find. -__kp__ = Buyer() -__kp__.__setup__(500) - ---804spam999-- - ---801spam999-- Modified: python/trunk/Lib/test/test_MimeWriter.py ============================================================================== --- python/trunk/Lib/test/test_MimeWriter.py (original) +++ python/trunk/Lib/test/test_MimeWriter.py Sun Oct 29 21:28:26 2006 @@ -7,6 +7,8 @@ """ +import unittest, sys, StringIO +from test.test_support import run_unittest from MimeWriter import MimeWriter @@ -77,94 +79,213 @@ ] -def main(): - import sys +OUTPUT = '''\ +From: bwarsaw at cnri.reston.va.us +Date: Mon Feb 12 17:21:48 EST 1996 +To: kss-submit at cnri.reston.va.us +MIME-Version: 1.0 +Content-Type: multipart/knowbot; + boundary="801spam999"; + version="0.1" + +This is a multi-part message in MIME format. + +--801spam999 +Content-Type: multipart/knowbot-metadata; + boundary="802spam999" + + +--802spam999 +Content-Type: message/rfc822 +KP-Metadata-Type: simple +KP-Access: read-only + +KPMD-Interpreter: python +KPMD-Interpreter-Version: 1.3 +KPMD-Owner-Name: Barry Warsaw +KPMD-Owner-Rendezvous: bwarsaw at cnri.reston.va.us +KPMD-Home-KSS: kss.cnri.reston.va.us +KPMD-Identifier: hdl://cnri.kss/my_first_knowbot +KPMD-Launch-Date: Mon Feb 12 16:39:03 EST 1996 + +--802spam999 +Content-Type: text/isl +KP-Metadata-Type: complex +KP-Metadata-Key: connection +KP-Access: read-only +KP-Connection-Description: Barry's Big Bass Business +KP-Connection-Id: B4 +KP-Connection-Direction: client - # Toplevel headers +INTERFACE Seller-1; + +TYPE Seller = OBJECT + DOCUMENTATION "A simple Seller interface to test ILU" + METHODS + price():INTEGER, + END; + +--802spam999 +Content-Type: message/external-body; + access-type="URL"; + URL="hdl://cnri.kss/generic-knowbot" + +Content-Type: text/isl +KP-Metadata-Type: complex +KP-Metadata-Key: generic-interface +KP-Access: read-only +KP-Connection-Description: Generic Interface for All Knowbots +KP-Connection-Id: generic-kp +KP-Connection-Direction: client + + +--802spam999-- + +--801spam999 +Content-Type: multipart/knowbot-code; + boundary="803spam999" + + +--803spam999 +Content-Type: text/plain +KP-Module-Name: BuyerKP + +class Buyer: + def __setup__(self, maxprice): + self._maxprice = maxprice + + def __main__(self, kos): + """Entry point upon arrival at a new KOS.""" + broker = kos.broker() + # B4 == Barry's Big Bass Business :-) + seller = broker.lookup('Seller_1.Seller', 'B4') + if seller: + price = seller.price() + print 'Seller wants $', price, '... ' + if price > self._maxprice: + print 'too much!' + else: + print "I'll take it!" + else: + print 'no seller found here' + +--803spam999-- + +--801spam999 +Content-Type: multipart/knowbot-state; + boundary="804spam999" +KP-Main-Module: main + + +--804spam999 +Content-Type: text/plain +KP-Module-Name: main + +# instantiate a buyer instance and put it in a magic place for the KOS +# to find. +__kp__ = Buyer() +__kp__.__setup__(500) + +--804spam999-- + +--801spam999-- +''' + +class MimewriterTest(unittest.TestCase): + + def test(self): + buf = StringIO.StringIO() + + # Toplevel headers + + toplevel = MimeWriter(buf) + toplevel.addheader("From", "bwarsaw at cnri.reston.va.us") + toplevel.addheader("Date", "Mon Feb 12 17:21:48 EST 1996") + toplevel.addheader("To", "kss-submit at cnri.reston.va.us") + toplevel.addheader("MIME-Version", "1.0") - toplevel = MimeWriter(sys.stdout) - toplevel.addheader("From", "bwarsaw at cnri.reston.va.us") - toplevel.addheader("Date", "Mon Feb 12 17:21:48 EST 1996") - toplevel.addheader("To", "kss-submit at cnri.reston.va.us") - toplevel.addheader("MIME-Version", "1.0") + # Toplevel body parts - # Toplevel body parts + f = toplevel.startmultipartbody("knowbot", "801spam999", + [("version", "0.1")], prefix=0) + f.write("This is a multi-part message in MIME format.\n") - f = toplevel.startmultipartbody("knowbot", "801spam999", - [("version", "0.1")], prefix=0) - f.write("This is a multi-part message in MIME format.\n") + # First toplevel body part: metadata - # First toplevel body part: metadata + md = toplevel.nextpart() + md.startmultipartbody("knowbot-metadata", "802spam999") - md = toplevel.nextpart() - md.startmultipartbody("knowbot-metadata", "802spam999") + # Metadata part 1 - # Metadata part 1 + md1 = md.nextpart() + md1.addheader("KP-Metadata-Type", "simple") + md1.addheader("KP-Access", "read-only") + m = MimeWriter(md1.startbody("message/rfc822")) + for key, value in SIMPLE_METADATA: + m.addheader("KPMD-" + key, value) + m.flushheaders() + del md1 - md1 = md.nextpart() - md1.addheader("KP-Metadata-Type", "simple") - md1.addheader("KP-Access", "read-only") - m = MimeWriter(md1.startbody("message/rfc822")) - for key, value in SIMPLE_METADATA: - m.addheader("KPMD-" + key, value) - m.flushheaders() - del md1 + # Metadata part 2 - # Metadata part 2 + md2 = md.nextpart() + for key, value in COMPLEX_METADATA: + md2.addheader("KP-" + key, value) + f = md2.startbody("text/isl") + f.write(SELLER) + del md2 - md2 = md.nextpart() - for key, value in COMPLEX_METADATA: - md2.addheader("KP-" + key, value) - f = md2.startbody("text/isl") - f.write(SELLER) - del md2 + # Metadata part 3 - # Metadata part 3 + md3 = md.nextpart() + f = md3.startbody("message/external-body", + [("access-type", "URL"), + ("URL", "hdl://cnri.kss/generic-knowbot")]) + m = MimeWriter(f) + for key, value in EXTERNAL_METADATA: + md3.addheader("KP-" + key, value) + md3.startbody("text/isl") + # Phantom body doesn't need to be written - md3 = md.nextpart() - f = md3.startbody("message/external-body", - [("access-type", "URL"), - ("URL", "hdl://cnri.kss/generic-knowbot")]) - m = MimeWriter(f) - for key, value in EXTERNAL_METADATA: - md3.addheader("KP-" + key, value) - md3.startbody("text/isl") - # Phantom body doesn't need to be written + md.lastpart() - md.lastpart() + # Second toplevel body part: code - # Second toplevel body part: code + code = toplevel.nextpart() + code.startmultipartbody("knowbot-code", "803spam999") - code = toplevel.nextpart() - code.startmultipartbody("knowbot-code", "803spam999") + # Code: buyer program source - # Code: buyer program source + buyer = code.nextpart() + buyer.addheader("KP-Module-Name", "BuyerKP") + f = buyer.startbody("text/plain") + f.write(BUYER) - buyer = code.nextpart() - buyer.addheader("KP-Module-Name", "BuyerKP") - f = buyer.startbody("text/plain") - f.write(BUYER) + code.lastpart() - code.lastpart() + # Third toplevel body part: state - # Third toplevel body part: state + state = toplevel.nextpart() + state.addheader("KP-Main-Module", "main") + state.startmultipartbody("knowbot-state", "804spam999") - state = toplevel.nextpart() - state.addheader("KP-Main-Module", "main") - state.startmultipartbody("knowbot-state", "804spam999") + # State: a bunch of assignments - # State: a bunch of assignments + st = state.nextpart() + st.addheader("KP-Module-Name", "main") + f = st.startbody("text/plain") + f.write(STATE) - st = state.nextpart() - st.addheader("KP-Module-Name", "main") - f = st.startbody("text/plain") - f.write(STATE) + state.lastpart() - state.lastpart() + # End toplevel body parts - # End toplevel body parts + toplevel.lastpart() - toplevel.lastpart() + self.assertEqual(buf.getvalue(), OUTPUT) +def test_main(): + run_unittest(MimewriterTest) -main() +if __name__ == '__main__': + test_main() From python-checkins at python.org Sun Oct 29 21:31:18 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 21:31:18 +0100 (CET) Subject: [Python-checkins] r52545 - in python/trunk/Lib/test: output/test_openpty test_openpty.py Message-ID: <20061029203118.56B181E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 21:31:17 2006 New Revision: 52545 Removed: python/trunk/Lib/test/output/test_openpty Modified: python/trunk/Lib/test/test_openpty.py Log: Convert test_openpty to unittest. Deleted: /python/trunk/Lib/test/output/test_openpty ============================================================================== --- /python/trunk/Lib/test/output/test_openpty Sun Oct 29 21:31:17 2006 +++ (empty file) @@ -1,2 +0,0 @@ -test_openpty -Ping! Modified: python/trunk/Lib/test/test_openpty.py ============================================================================== --- python/trunk/Lib/test/test_openpty.py (original) +++ python/trunk/Lib/test/test_openpty.py Sun Oct 29 21:31:17 2006 @@ -1,19 +1,23 @@ # Test to see if openpty works. (But don't worry if it isn't available.) -import os -from test.test_support import verbose, TestFailed, TestSkipped +import os, unittest +from test.test_support import run_unittest, TestSkipped -try: - if verbose: - print "Calling os.openpty()" - master, slave = os.openpty() - if verbose: - print "(master, slave) = (%d, %d)"%(master, slave) -except AttributeError: - raise TestSkipped, "No openpty() available." +class OpenptyTest(unittest.TestCase): + def test(self): + try: + master, slave = os.openpty() + except AttributeError: + raise TestSkipped, "No openpty() available." -if not os.isatty(slave): - raise TestFailed, "Slave-end of pty is not a terminal." + if not os.isatty(slave): + self.fail("Slave-end of pty is not a terminal.") -os.write(slave, 'Ping!') -print os.read(master, 1024) + os.write(slave, 'Ping!') + self.assertEqual(os.read(master, 1024), 'Ping!') + +def test_main(): + run_unittest(OpenptyTest) + +if __name__ == '__main__': + test_main() From python-checkins at python.org Sun Oct 29 21:35:12 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 21:35:12 +0100 (CET) Subject: [Python-checkins] r52546 - python/trunk/Lib/test/output/test_regex Message-ID: <20061029203512.9DB211E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 21:35:12 2006 New Revision: 52546 Removed: python/trunk/Lib/test/output/test_regex Log: Remove leftover test output file. Deleted: /python/trunk/Lib/test/output/test_regex ============================================================================== --- /python/trunk/Lib/test/output/test_regex Sun Oct 29 21:35:12 2006 +++ (empty file) @@ -1,29 +0,0 @@ -test_regex -no match: -1 -successful search: 6 -caught expected exception -failed awk syntax: -1 -successful awk syntax: 2 -failed awk syntax: -1 -matching with group names and compile() --1 -caught expected exception -matching with group names and symcomp() -7 -801 999 -801 -('801', '999') -('801', '999') -realpat: \([0-9]+\) *\([0-9]+\) -groupindex: {'one': 1, 'two': 2} -not case folded search: -1 -case folded search: 6 -__members__: ['last', 'regs', 'translate', 'groupindex', 'realpat', 'givenpat'] -regs: ((6, 11), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1), (-1, -1)) -last: HELLO WORLD -translate: 256 -givenpat: world -match with pos: -1 -search with pos: 18 -bogus group: ('world', None, None) -no name: caught expected exception From buildbot at python.org Sun Oct 29 21:38:33 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 20:38:33 +0000 Subject: [Python-checkins] buildbot warnings in x86 cygwin 2.5 Message-ID: <20061029203833.E80981E4005@bag.python.org> The Buildbot has detected a new failure of x86 cygwin 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520cygwin%25202.5/builds/70 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 Excerpt from the test logfile: 2 tests failed: test_mailbox test_mmap ====================================================================== ERROR: test_lock_conflict (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/test/test_mailbox.py", line 742, in test_lock_conflict self._box.lock) File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/unittest.py", line 320, in failUnlessRaises callableObj(*args, **kwargs) File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/mailbox.py", line 531, in lock _lock_file(self._file) File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/mailbox.py", line 1847, in _lock_file fcntl.lockf(f, fcntl.LOCK_UN) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_lock_conflict (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/test/test_mailbox.py", line 742, in test_lock_conflict self._box.lock) File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/unittest.py", line 320, in failUnlessRaises callableObj(*args, **kwargs) File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/mailbox.py", line 531, in lock _lock_file(self._file) File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/mailbox.py", line 1847, in _lock_file fcntl.lockf(f, fcntl.LOCK_UN) IOError: [Errno 13] Permission denied Traceback (most recent call last): File "./Lib/test/regrtest.py", line 546, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/test/test_mmap.py", line 393, in test_both() File "/home/anthony/Buildbot/2.5.baxter-cygwin/build/Lib/test/test_mmap.py", line 231, in test_both m.flush() EnvironmentError: [Errno 22] Invalid argument sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 22:06:08 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 21:06:08 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20061029210608.BCE281E4005@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/1617 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 Excerpt from the test logfile: 1 test failed: test_openpty ====================================================================== ERROR: test (test.test_openpty.OpenptyTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_openpty.py", line 11, in test raise TestSkipped, "No openpty() available." TestSkipped: No openpty() available. sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 22:18:31 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 21:18:31 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD trunk Message-ID: <20061029211831.91AAE1E4005@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/1379 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 Excerpt from the test logfile: 1 test failed: test_urllib2net sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 22:24:02 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 21:24:02 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061029212402.C23BF1E4005@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/185 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 Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sun Oct 29 22:36:51 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 21:36:51 +0000 Subject: [Python-checkins] buildbot warnings in MIPS Debian trunk Message-ID: <20061029213651.AC4191E4005@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/471 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,neal.norwitz Build had warnings: warnings test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Oct 29 22:54:19 2006 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Oct 2006 22:54:19 +0100 (CET) Subject: [Python-checkins] r52547 - python/trunk/Lib/test/test_openpty.py Message-ID: <20061029215419.DCC591E4005@bag.python.org> Author: georg.brandl Date: Sun Oct 29 22:54:18 2006 New Revision: 52547 Modified: python/trunk/Lib/test/test_openpty.py Log: Move the check for openpty to the beginning. Modified: python/trunk/Lib/test/test_openpty.py ============================================================================== --- python/trunk/Lib/test/test_openpty.py (original) +++ python/trunk/Lib/test/test_openpty.py Sun Oct 29 22:54:18 2006 @@ -3,13 +3,13 @@ import os, unittest from test.test_support import run_unittest, TestSkipped +if not hasattr(os, "openpty"): + raise TestSkipped, "No openpty() available." + + class OpenptyTest(unittest.TestCase): def test(self): - try: - master, slave = os.openpty() - except AttributeError: - raise TestSkipped, "No openpty() available." - + master, slave = os.openpty() if not os.isatty(slave): self.fail("Slave-end of pty is not a terminal.") From python-checkins at python.org Sun Oct 29 23:06:29 2006 From: python-checkins at python.org (walter.doerwald) Date: Sun, 29 Oct 2006 23:06:29 +0100 (CET) Subject: [Python-checkins] r52548 - python/trunk/Lib/test/test_math.py Message-ID: <20061029220629.50DE61E4005@bag.python.org> Author: walter.doerwald Date: Sun Oct 29 23:06:28 2006 New Revision: 52548 Modified: python/trunk/Lib/test/test_math.py Log: Add tests for basic argument errors. Modified: python/trunk/Lib/test/test_math.py ============================================================================== --- python/trunk/Lib/test/test_math.py (original) +++ python/trunk/Lib/test/test_math.py Sun Oct 29 23:06:28 2006 @@ -20,21 +20,25 @@ self.ftest('e', math.e, 2.7182818) def testAcos(self): + self.assertRaises(TypeError, math.acos) self.ftest('acos(-1)', math.acos(-1), math.pi) self.ftest('acos(0)', math.acos(0), math.pi/2) self.ftest('acos(1)', math.acos(1), 0) def testAsin(self): + self.assertRaises(TypeError, math.asin) self.ftest('asin(-1)', math.asin(-1), -math.pi/2) self.ftest('asin(0)', math.asin(0), 0) self.ftest('asin(1)', math.asin(1), math.pi/2) def testAtan(self): + self.assertRaises(TypeError, math.atan) self.ftest('atan(-1)', math.atan(-1), -math.pi/4) self.ftest('atan(0)', math.atan(0), 0) self.ftest('atan(1)', math.atan(1), math.pi/4) def testAtan2(self): + self.assertRaises(TypeError, math.atan2) self.ftest('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2) self.ftest('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4) self.ftest('atan2(0, 1)', math.atan2(0, 1), 0) @@ -42,6 +46,7 @@ self.ftest('atan2(1, 0)', math.atan2(1, 0), math.pi/2) def testCeil(self): + self.assertRaises(TypeError, math.ceil) self.ftest('ceil(0.5)', math.ceil(0.5), 1) self.ftest('ceil(1.0)', math.ceil(1.0), 1) self.ftest('ceil(1.5)', math.ceil(1.5), 2) @@ -50,31 +55,37 @@ self.ftest('ceil(-1.5)', math.ceil(-1.5), -1) def testCos(self): + self.assertRaises(TypeError, math.cos) self.ftest('cos(-pi/2)', math.cos(-math.pi/2), 0) self.ftest('cos(0)', math.cos(0), 1) self.ftest('cos(pi/2)', math.cos(math.pi/2), 0) self.ftest('cos(pi)', math.cos(math.pi), -1) def testCosh(self): + self.assertRaises(TypeError, math.cosh) self.ftest('cosh(0)', math.cosh(0), 1) self.ftest('cosh(2)-2*cosh(1)**2', math.cosh(2)-2*math.cosh(1)**2, -1) # Thanks to Lambert def testDegrees(self): + self.assertRaises(TypeError, math.degrees) self.ftest('degrees(pi)', math.degrees(math.pi), 180.0) self.ftest('degrees(pi/2)', math.degrees(math.pi/2), 90.0) self.ftest('degrees(-pi/4)', math.degrees(-math.pi/4), -45.0) def testExp(self): + self.assertRaises(TypeError, math.exp) self.ftest('exp(-1)', math.exp(-1), 1/math.e) self.ftest('exp(0)', math.exp(0), 1) self.ftest('exp(1)', math.exp(1), math.e) def testFabs(self): + self.assertRaises(TypeError, math.fabs) self.ftest('fabs(-1)', math.fabs(-1), 1) self.ftest('fabs(0)', math.fabs(0), 0) self.ftest('fabs(1)', math.fabs(1), 1) def testFloor(self): + self.assertRaises(TypeError, math.floor) self.ftest('floor(0.5)', math.floor(0.5), 0) self.ftest('floor(1.0)', math.floor(1.0), 1) self.ftest('floor(1.5)', math.floor(1.5), 1) @@ -83,6 +94,7 @@ self.ftest('floor(-1.5)', math.floor(-1.5), -2) def testFmod(self): + self.assertRaises(TypeError, math.fmod) self.ftest('fmod(10,1)', math.fmod(10,1), 0) self.ftest('fmod(10,0.5)', math.fmod(10,0.5), 0) self.ftest('fmod(10,1.5)', math.fmod(10,1.5), 1) @@ -91,6 +103,8 @@ self.ftest('fmod(-10,1.5)', math.fmod(-10,1.5), -1) def testFrexp(self): + self.assertRaises(TypeError, math.frexp) + def testfrexp(name, (mant, exp), (emant, eexp)): if abs(mant-emant) > eps or exp != eexp: self.fail('%s returned %r, expected %r'%\ @@ -102,16 +116,19 @@ testfrexp('frexp(2)', math.frexp(2), (0.5, 2)) def testHypot(self): + self.assertRaises(TypeError, math.hypot) self.ftest('hypot(0,0)', math.hypot(0,0), 0) self.ftest('hypot(3,4)', math.hypot(3,4), 5) def testLdexp(self): + self.assertRaises(TypeError, math.ldexp) self.ftest('ldexp(0,1)', math.ldexp(0,1), 0) self.ftest('ldexp(1,1)', math.ldexp(1,1), 2) self.ftest('ldexp(1,-1)', math.ldexp(1,-1), 0.5) self.ftest('ldexp(-1,1)', math.ldexp(-1,1), -2) def testLog(self): + self.assertRaises(TypeError, math.log) self.ftest('log(1/e)', math.log(1/math.e), -1) self.ftest('log(1)', math.log(1), 0) self.ftest('log(e)', math.log(math.e), 1) @@ -120,11 +137,14 @@ self.ftest('log(10**40, 10**20)', math.log(10**40, 10**20), 2) def testLog10(self): + self.assertRaises(TypeError, math.log10) self.ftest('log10(0.1)', math.log10(0.1), -1) self.ftest('log10(1)', math.log10(1), 0) self.ftest('log10(10)', math.log10(10), 1) def testModf(self): + self.assertRaises(TypeError, math.modf) + def testmodf(name, (v1, v2), (e1, e2)): if abs(v1-e1) > eps or abs(v2-e2): self.fail('%s returned %r, expected %r'%\ @@ -134,37 +154,44 @@ testmodf('modf(-1.5)', math.modf(-1.5), (-0.5, -1.0)) def testPow(self): + self.assertRaises(TypeError, math.pow) self.ftest('pow(0,1)', math.pow(0,1), 0) self.ftest('pow(1,0)', math.pow(1,0), 1) self.ftest('pow(2,1)', math.pow(2,1), 2) self.ftest('pow(2,-1)', math.pow(2,-1), 0.5) def testRadians(self): + self.assertRaises(TypeError, math.radians) self.ftest('radians(180)', math.radians(180), math.pi) self.ftest('radians(90)', math.radians(90), math.pi/2) self.ftest('radians(-45)', math.radians(-45), -math.pi/4) def testSin(self): + self.assertRaises(TypeError, math.sin) self.ftest('sin(0)', math.sin(0), 0) self.ftest('sin(pi/2)', math.sin(math.pi/2), 1) self.ftest('sin(-pi/2)', math.sin(-math.pi/2), -1) def testSinh(self): + self.assertRaises(TypeError, math.sinh) self.ftest('sinh(0)', math.sinh(0), 0) self.ftest('sinh(1)**2-cosh(1)**2', math.sinh(1)**2-math.cosh(1)**2, -1) self.ftest('sinh(1)+sinh(-1)', math.sinh(1)+math.sinh(-1), 0) def testSqrt(self): + self.assertRaises(TypeError, math.sqrt) self.ftest('sqrt(0)', math.sqrt(0), 0) self.ftest('sqrt(1)', math.sqrt(1), 1) self.ftest('sqrt(4)', math.sqrt(4), 2) def testTan(self): + self.assertRaises(TypeError, math.tan) self.ftest('tan(0)', math.tan(0), 0) self.ftest('tan(pi/4)', math.tan(math.pi/4), 1) self.ftest('tan(-pi/4)', math.tan(-math.pi/4), -1) def testTanh(self): + self.assertRaises(TypeError, math.tanh) self.ftest('tanh(0)', math.tanh(0), 0) self.ftest('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0) From buildbot at python.org Sun Oct 29 23:26:18 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 22:26:18 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20061029222618.4B0051E4013@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/195 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 neal at metaslash.com Sun Oct 29 23:28:57 2006 From: neal at metaslash.com (Neal Norwitz) Date: Sun, 29 Oct 2006 17:28:57 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (99) Message-ID: <20061029222857.GA30145@python.psfb.org> test_grammar leaked [50, 50, 50] references test_opcodes leaked [6, 6, 6] references test_builtin leaked [54, 54, 54] references test_exceptions leaked [8, 8, 8] references test_anydbm leaked [2, 2, 2] references test_array leaked [24, 24, 24] references test_audioop leaked [100, 100, 100] references test_base64 leaked [2, 2, 2] references test_binhex leaked [8, 8, 8] references test_cProfile leaked [2, 2, 2] references test_cfgparser leaked [38, 38, 38] references test_cmd_line leaked [-17, 17, -17] references test_codeccallbacks leaked [20036, 20036, 20036] references test_codecmaps_cn leaked [12, 12, 12] references test_codecmaps_hk leaked [6, 6, 6] references test_codecmaps_jp leaked [30, 30, 30] references test_codecmaps_kr leaked [18, 18, 18] references test_codecmaps_tw leaked [12, 12, 12] references test_codecs leaked [2, 2, 2] references test_coercion leaked [2, 2, 2] references test_compile leaked [30, 30, 30] references test_cookielib leaked [6, 6, 6] references test_copy leaked [130, 130, 130] references test_cpickle leaked [4, 4, 4] references test_csv leaked [4, 4, 4] references test_ctypes leaked [310, 310, 310] references test_datetime leaked [16, 16, 16] references test_decimal leaked [32280, 31480, 32930] references test_decorators leaked [6, 6, 6] references test_defaultdict leaked [8, 8, 8] references test_deque leaked [6, 6, 6] references test_descr leaked [120, 120, 120] references test_descrtut leaked [10, 10, 10] references test_dict leaked [30, 30, 30] references test_dircache leaked [4, 4, 4] references test_doctest leaked [56, 56, 56] references test_dumbdbm leaked [56, 56, 56] references test_dummy_threading leaked [20, 20, 20] references test_email leaked [4, 4, 4] references test_email_renamed leaked [4, 4, 4] references test_eof leaked [4, 4, 4] references test_fcntl leaked [2, 2, 2] references test_float leaked [8, 8, 8] references test_future leaked [6, 6, 6] references test_gettext leaked [42, 42, 42] references test_gzip leaked [4, 4, 4] references test_import leaked [8, 8, 8] references test_importhooks leaked [2, 2, 2] references test_inspect leaked [66, 66, 66] references test_longexp leaked [2, 2, 2] references test_mailbox leaked [7892, 7892, 7892] references test_minidom leaked [14, 14, 14] references test_modulefinder leaked [154, 154, 154] references test_mutants leaked [150, 150, 150] references test_ntpath leaked [156, 156, 156] references test_operator leaked [2, 2, 2] references test_optparse leaked [16, 16, 16] references test_os leaked [4, 4, 4] references test_pep292 leaked [30, 30, 30] references test_pickle leaked [22, 22, 22] references test_pickletools leaked [6, 6, 6] references test_platform leaked [2, 2, 2] references test_popen leaked [6, 6, 6] references test_profile leaked [146, 146, 146] references test_profilehooks leaked [64, 64, 64] references test_re leaked [22, 22, 22] references test_rfc822 leaked [12, 12, 12] references test_runpy leaked [8, 8, 8] references test_sax leaked [36, 36, 36] references test_scope leaked [18, 18, 18] references test_set leaked [134, 134, 134] references test_sets leaked [125, 125, 125] references test_shelve leaked [688, 688, 688] references test_sqlite leaked [2, 2, 2] references test_strptime leaked [6, 6, 6] references test_struct leaked [318, 318, 318] references test_symtable leaked [38, 38, 38] references test_sys leaked [4, 4, 4] references test_tarfile leaked [14, 14, 14] references test_textwrap leaked [208, 208, 208] references test_threading leaked [2, 2, 2] references test_threadsignals leaked [0, -8, 0] references test_time leaked [2, 2, 2] references test_trace leaked [88592, 88592, 88592] references test_transformer leaked [28, 28, 28] references test_ucn leaked [98, 98, 98] references test_unary leaked [16, 16, 16] references test_unicode leaked [30, 30, 30] references test_urllib2 leaked [22, 22, 22] references test_userdict leaked [6, 6, 6] references test_warnings leaked [10, 10, 10] references test_wave leaked [10, 10, 10] references test_weakref leaked [54, 54, 54] references test_whichdb leaked [2, 2, 2] references test_xdrlib leaked [8, 8, 8] references test_xml_etree leaked [90, 90, 90] references test_xmlrpc leaked [84, 84, 84] references test_xpickle leaked [14, 14, 14] references test_zipfile leaked [22, 22, 22] references test_zipimport leaked [260, 260, 260] references From buildbot at python.org Sun Oct 29 23:46:38 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 22:46:38 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP 2.5 Message-ID: <20061029224638.3343D1E4005@bag.python.org> The Buildbot has detected a new failure of x86 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%25202.5/builds/22 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 failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon Oct 30 00:02:28 2006 From: python-checkins at python.org (walter.doerwald) Date: Mon, 30 Oct 2006 00:02:28 +0100 (CET) Subject: [Python-checkins] r52549 - python/trunk/Lib/test/test_codecs.py Message-ID: <20061029230228.568AB1E4013@bag.python.org> Author: walter.doerwald Date: Mon Oct 30 00:02:27 2006 New Revision: 52549 Modified: python/trunk/Lib/test/test_codecs.py Log: Add tests for incremental codecs with an errors argument. Modified: python/trunk/Lib/test/test_codecs.py ============================================================================== --- python/trunk/Lib/test/test_codecs.py (original) +++ python/trunk/Lib/test/test_codecs.py Mon Oct 30 00:02:27 2006 @@ -1064,6 +1064,12 @@ ] broken_incremental_coders = broken_unicode_with_streams[:] +# The following encodings only support "strict" mode +only_strict_mode = [ + "idna", + "zlib_codec", +] + try: import bz2 except ImportError: @@ -1153,6 +1159,24 @@ result = u"".join(codecs.iterdecode(codecs.iterencode(u"", encoding), encoding)) self.assertEqual(result, u"") + if encoding not in only_strict_mode: + # check incremental decoder/encoder with errors argument + try: + encoder = codecs.getincrementalencoder(encoding)("ignore") + cencoder = _testcapi.codec_incrementalencoder(encoding, "ignore") + except LookupError: # no IncrementalEncoder + pass + else: + encodedresult = "".join(encoder.encode(c) for c in s) + decoder = codecs.getincrementaldecoder(encoding)("ignore") + decodedresult = u"".join(decoder.decode(c) for c in encodedresult) + self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) + + encodedresult = "".join(cencoder.encode(c) for c in s) + cdecoder = _testcapi.codec_incrementaldecoder(encoding, "ignore") + decodedresult = u"".join(cdecoder.decode(c) for c in encodedresult) + self.assertEqual(decodedresult, s, "%r != %r (encoding=%r)" % (decodedresult, s, encoding)) + def test_seek(self): # all codecs should be able to encode these s = u"%s\n%s\n" % (100*u"abc123", 100*u"def456") From buildbot at python.org Mon Oct 30 00:23:10 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 23:23:10 +0000 Subject: [Python-checkins] buildbot warnings in amd64 gentoo trunk Message-ID: <20061029232310.D99461E4005@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/1630 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon Oct 30 00:28:46 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 23:28:46 +0000 Subject: [Python-checkins] buildbot warnings in x86 W2k trunk Message-ID: <20061029232846.9E1B11E4005@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/1620 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_codecs ====================================================================== FAIL: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\test\test_codecs.py", line 1165, in test_basics encoder = codecs.getincrementalencoder(encoding)("ignore") File "C:\trentm\data\buildbot\python-slave\trunk.mick-windows\build\lib\encodings\bz2_codec.py", line 56, in __init__ assert errors == 'strict' AssertionError sincerely, -The Buildbot From python-checkins at python.org Mon Oct 30 00:39:04 2006 From: python-checkins at python.org (neal.norwitz) Date: Mon, 30 Oct 2006 00:39:04 +0100 (CET) Subject: [Python-checkins] r52550 - python/trunk/Objects/dictobject.c Message-ID: <20061029233904.CBDDC1E4005@bag.python.org> Author: neal.norwitz Date: Mon Oct 30 00:39:03 2006 New Revision: 52550 Modified: python/trunk/Objects/dictobject.c Log: Fix refleak Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Mon Oct 30 00:39:03 2006 @@ -23,6 +23,7 @@ if (!tup) return; /* caller will expect error to be set anyway */ PyErr_SetObject(PyExc_KeyError, tup); + Py_DECREF(tup); } /* Define this out if you don't want conversion statistics on exit. */ From python-checkins at python.org Mon Oct 30 00:42:59 2006 From: python-checkins at python.org (neal.norwitz) Date: Mon, 30 Oct 2006 00:42:59 +0100 (CET) Subject: [Python-checkins] r52551 - python/branches/release25-maint/Objects/dictobject.c Message-ID: <20061029234259.AA07F1E4005@bag.python.org> Author: neal.norwitz Date: Mon Oct 30 00:42:59 2006 New Revision: 52551 Modified: python/branches/release25-maint/Objects/dictobject.c Log: Fix refleak Modified: python/branches/release25-maint/Objects/dictobject.c ============================================================================== --- python/branches/release25-maint/Objects/dictobject.c (original) +++ python/branches/release25-maint/Objects/dictobject.c Mon Oct 30 00:42:59 2006 @@ -23,6 +23,7 @@ if (!tup) return; /* caller will expect error to be set anyway */ PyErr_SetObject(PyExc_KeyError, tup); + Py_DECREF(tup); } /* Define this out if you don't want conversion statistics on exit. */ From buildbot at python.org Mon Oct 30 00:48:10 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 23:48:10 +0000 Subject: [Python-checkins] buildbot warnings in x86 gentoo trunk Message-ID: <20061029234810.442BF1E4012@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/1715 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon Oct 30 00:48:10 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 23:48:10 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP trunk Message-ID: <20061029234810.4CD871E4015@bag.python.org> The Buildbot has detected a new failure of x86 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP%2520trunk/builds/38 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon Oct 30 00:53:22 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 23:53:22 +0000 Subject: [Python-checkins] buildbot warnings in x86 OpenBSD trunk Message-ID: <20061029235323.25F171E4005@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/1382 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_codecs ====================================================================== FAIL: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/python-trunk/trunk.cortesi/build/Lib/test/test_codecs.py", line 1165, in test_basics encoder = codecs.getincrementalencoder(encoding)("ignore") File "/home/buildbot/python-trunk/trunk.cortesi/build/Lib/encodings/bz2_codec.py", line 56, in __init__ assert errors == 'strict' AssertionError sincerely, -The Buildbot From buildbot at python.org Mon Oct 30 00:54:17 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 23:54:17 +0000 Subject: [Python-checkins] buildbot warnings in g4 osx.4 trunk Message-ID: <20061029235417.56E801E4005@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/1541 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_codecs ====================================================================== FAIL: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_codecs.py", line 1165, in test_basics encoder = codecs.getincrementalencoder(encoding)("ignore") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/encodings/bz2_codec.py", line 56, in __init__ assert errors == 'strict' AssertionError sincerely, -The Buildbot From python-checkins at python.org Mon Oct 30 00:58:37 2006 From: python-checkins at python.org (neal.norwitz) Date: Mon, 30 Oct 2006 00:58:37 +0100 (CET) Subject: [Python-checkins] r52552 - python/trunk/Lib/test/test_codecs.py Message-ID: <20061029235837.760B51E4005@bag.python.org> Author: neal.norwitz Date: Mon Oct 30 00:58:36 2006 New Revision: 52552 Modified: python/trunk/Lib/test/test_codecs.py Log: I'm assuming this is correct, it fixes the tests so they pass again Modified: python/trunk/Lib/test/test_codecs.py ============================================================================== --- python/trunk/Lib/test/test_codecs.py (original) +++ python/trunk/Lib/test/test_codecs.py Mon Oct 30 00:58:36 2006 @@ -1068,6 +1068,7 @@ only_strict_mode = [ "idna", "zlib_codec", + "bz2_codec", ] try: From buildbot at python.org Mon Oct 30 00:59:56 2006 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Oct 2006 23:59:56 +0000 Subject: [Python-checkins] buildbot warnings in sparc solaris10 gcc trunk Message-ID: <20061029235956.7E19D1E4005@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/1557 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_codecs ====================================================================== FAIL: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_codecs.py", line 1165, in test_basics encoder = codecs.getincrementalencoder(encoding)("ignore") File "/opt/users/buildbot/slave/trunk.loewis-sun/build/Lib/encodings/bz2_codec.py", line 56, in __init__ assert errors == 'strict' AssertionError sincerely, -The Buildbot From buildbot at python.org Mon Oct 30 01:16:05 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Oct 2006 00:16:05 +0000 Subject: [Python-checkins] buildbot warnings in ia64 Ubuntu trunk trunk Message-ID: <20061030001605.5F01F1E4005@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/197 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_codecs ====================================================================== FAIL: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_codecs.py", line 1165, in test_basics encoder = codecs.getincrementalencoder(encoding)("ignore") File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/encodings/bz2_codec.py", line 56, in __init__ assert errors == 'strict' AssertionError sincerely, -The Buildbot From buildbot at python.org Mon Oct 30 01:21:33 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Oct 2006 00:21:33 +0000 Subject: [Python-checkins] buildbot warnings in alpha Tru64 5.1 trunk Message-ID: <20061030002133.8CB961E4005@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/1258 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== FAIL: testInterruptedTimeout (test.test_socket.TCPTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/net/ringneck/scratch1/nnorwitz/buildbot/trunk.norwitz-tru64/build/Lib/test/test_socket.py", line 847, in testInterruptedTimeout self.fail("got Alarm in wrong place") AssertionError: got Alarm in wrong place sincerely, -The Buildbot From buildbot at python.org Mon Oct 30 01:45:31 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Oct 2006 00:45:31 +0000 Subject: [Python-checkins] buildbot warnings in x86 XP-2 trunk Message-ID: <20061030004531.E50451E4005@bag.python.org> The Buildbot has detected a new failure of x86 XP-2 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%2520XP-2%2520trunk/builds/933 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz,walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_codecs ====================================================================== FAIL: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Code\bb_slave\trunk.peters-windows\build\lib\test\test_codecs.py", line 1165, in test_basics encoder = codecs.getincrementalencoder(encoding)("ignore") File "C:\Code\bb_slave\trunk.peters-windows\build\lib\encodings\bz2_codec.py", line 56, in __init__ assert errors == 'strict' AssertionError sincerely, -The Buildbot From buildbot at python.org Mon Oct 30 02:57:26 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Oct 2006 01:57:26 +0000 Subject: [Python-checkins] buildbot warnings in hppa Ubuntu dapper trunk Message-ID: <20061030015726.002C01E4009@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/188 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz,walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_codecs ====================================================================== FAIL: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-hppa/build/Lib/test/test_codecs.py", line 1165, in test_basics encoder = codecs.getincrementalencoder(encoding)("ignore") File "/home/pybot/buildarea/trunk.klose-ubuntu-hppa/build/Lib/encodings/bz2_codec.py", line 56, in __init__ assert errors == 'strict' AssertionError sincerely, -The Buildbot From buildbot at python.org Mon Oct 30 02:58:43 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Oct 2006 01:58:43 +0000 Subject: [Python-checkins] buildbot warnings in S-390 Debian trunk Message-ID: <20061030015843.E02AC1E4005@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/477 Buildbot URL: http://www.python.org/dev/buildbot/all/ Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz,walter.doerwald Build had warnings: warnings test Excerpt from the test logfile: 1 test failed: test_codecs ====================================================================== FAIL: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/test/test_codecs.py", line 1165, in test_basics encoder = codecs.getincrementalencoder(encoding)("ignore") File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/encodings/bz2_codec.py", line 56, in __init__ assert errors == 'strict' AssertionError sincerely, -The Buildbot From python-checkins at python.org Mon Oct 30 03:21:22 2006 From: python-checkins at python.org (brett.cannon) Date: Mon, 30 Oct 2006 03:21:22 +0100 (CET) Subject: [Python-checkins] r52553 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/mock_importer.py sandbox/trunk/import_in_py/test_importer.py Message-ID: <20061030022122.97A531E4005@bag.python.org> Author: brett.cannon Date: Mon Oct 30 03:21:21 2006 New Revision: 52553 Added: sandbox/trunk/import_in_py/mock_importer.py (contents, props changed) Modified: sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/test_importer.py Log: Add substantive tests for PyPycHandler.handle_code(). This includes creating a mock object for the class and creating the mock_importer class to contain it. Also moved over other mock objects from test_importer into mock_importer. 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 30 03:21:21 2006 @@ -370,13 +370,13 @@ def code_from_source(self, source, path): """Create a code object from source.""" - return compile(source, path, 'exec') + return compile(source, str(path), 'exec') def create_pyc(self, bytecode, timestamp): """Create data for a .pyc file.""" #XXX Does not work properly until direct marshaling of longs is possible. - data = imp.get_magic() - data += str(timestamp) + data = imp.get_magic().zfill(4) + data += str(timestamp).zfill(4) data += marshal.dumps(bytecode) return data @@ -463,7 +463,7 @@ # If there is a possible path to bytecode, generate .pyc file. if bytecode_path: pyc = self.create_pyc(code, source_timestamp) - loader.write_data(pyc, path, True) + loader.write_data(pyc, bytecode_path, True) exec code in module.__dict__ return module Added: sandbox/trunk/import_in_py/mock_importer.py ============================================================================== --- (empty file) +++ sandbox/trunk/import_in_py/mock_importer.py Mon Oct 30 03:21:21 2006 @@ -0,0 +1,193 @@ +import sys +import marshal +import imp +from test import test_support + +def log_call(method): + """Log method calls to self.log.""" + def log_and_call(self, *args, **kwargs): + self.log.append(method.__name__) + return method(self, *args, **kwargs) + return log_and_call + + +class MockPyPycLoader(object): + + """Mock loader object for testing importer.PyPycHandler. + + Opaque path objects are two-item tuple consisting of a string representing + the base path and another string representing the type. + + """ + + def __init__(self, good_magic=True, good_timestamp=True, pyc_exists=True, + py_exists=True): + """Set up the mock loader based on possible scenarios of source and + bytecode combinations/issues.""" + self.module_name = 'test_module' + self.py_ext = "source" if py_exists else None + self.pyc_ext = "bytecode" if pyc_exists else None + self.base_path = "base path" + self.modification_time = 1 + # Needed for read_data on source path. + self.source = "test_attr = None" + code_object = compile(self.source, "", 'exec') + bytecode = marshal.dumps(code_object) + if good_magic: + pyc = str(imp.get_magic()) + else: + pyc += str(imp.get_magic()-1) + if good_timestamp: + pyc += str(1).zfill(4) + else: + pyc += str(0).zfill(4) + # XXX Not proper until can marshal longs. + # Needed for read_data on .pyc path. + self.pyc = pyc + bytecode + self.log = [] + + def _create_handler(self, handler): + if self.py_ext: + py_ext = (self.py_ext,) + else: + py_ext = tuple() + if self.pyc_ext: + pyc_ext = (self.pyc_ext,) + else: + pyc_ext = tuple() + return handler(py_ext, pyc_ext) + + def _handle_py(self, handler): + return handler.handle_code(self, self.module_name, + (self.base_path, self.py_ext)) + + def _handle_pyc(self, handler): + return handler.handle_code(self, self.module_name, + (self.base_path, self.pyc_ext)) + + def _verify_module(self, module): + if not hasattr(module, 'test_attr'): + raise test_support.TestFailed("test_attr attribute missing") + if not module.test_attr is None: + raise test_support.TestFailed("test_attr not set to None") + return True + + def load_module(self, fullname, path=None): + raise NotImplementedError + + @log_call + def split_path(self, path): + """'path' should be a two-item tuple, so just return it since the + caller expects two items back.""" + assert (path[0] == self.base_path and + path[1] in (self.py_ext, self.pyc_ext)) + + return path + + @log_call + def create_path(self, base, type_): + """Create a tuple from 'base' and type_.""" + assert base == self.base_path + assert type_ in (self.py_ext, self.pyc_ext) + + if type_ not in (self.py_ext, self.pyc_ext): + return None + else: + return (base, type_) + + @log_call + def mod_time(self, path): + """Consider self.modification_time the baseline modification time.""" + assert path[0] == self.base_path + assert path[1] == self.py_ext + + return self.modification_time + + @log_call + def read_data(self, path, binary): + """Return the proper source or binary data based on the path.""" + assert path[0] == self.base_path + assert path[1] in (self.py_ext, self.pyc_ext) + + if binary: + assert self.pyc_ext and path[1] == self.pyc_ext + return self.pyc + else: + assert self.py_ext and path[1] == self.py_ext + return self.source + + @log_call + def write_data(self, data, path, binary): + """Should only be requested to write to a bytecode path.""" + assert path[0] == self.base_path + assert self.pyc_ext + assert path[1] == self.pyc_ext, "%s != %s" % (path[1], self.pyc_ext) + assert binary + # XXX Assert proper magic number + # XXX Assert time stamp + module = imp.new_module(self.module_name) + code = marshal.loads(data[8:]) + exec code in module.__dict__ + assert self._verify_module(module) + + return None + + +class ErrorImporter(object): + + """Helper class to have a guaranteed error point.""" + + def find_module(self, fullname, path=None): + self.find_request = fullname, path + raise ImportError + + @classmethod + def set_on_sys_path(cls): + error_entry = '' + sys.path.append(error_entry) + ins = cls() + sys.path_importer_cache[error_entry] = ins + return ins + + +class PassImporter(object): + + """Always pass on importing a module.""" + + def find_module(self, fullname, path=None): + self.find_request = fullname, path + return None + + @classmethod + def set_on_sys_path(cls): + pass_entry = '' + sys.path.append(pass_entry) + ins = cls() + sys.path_importer_cache[pass_entry] = ins + return ins + + +class SucceedImporter(object): + + """Always succeed by returning 'self'.""" + + module = 42 + + def __call__(self, path_entry): + return self + + def find_module(self, fullname, path=None): + self.find_request = fullname, path + return self + + def load_module(self, fullname, path=None): + self.load_request = fullname, path + return self.module + + @classmethod + def set_on_sys_path(cls): + succeed_entry = '' + sys.path.append(succeed_entry) + ins = cls() + sys.path_importer_cache[succeed_entry] = ins + return ins \ No newline at end of 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 Mon Oct 30 03:21:21 2006 @@ -3,6 +3,7 @@ import unittest from test import test_support +import mock_importer import contextlib import imp @@ -351,15 +352,53 @@ # Test creating bytes for creating a .pyc file. # XXX Cannot test until marshaling longs is possible. pass - + class PyPycHandlerHandleCodeTests(unittest.TestCase): """Test PyPycHandler.handle_code().""" - # XXX - pass + def test_good_pyc_w_py(self): + loader = mock_importer.MockPyPycLoader() + handler = loader._create_handler(importer.PyPycHandler) + module = loader._handle_pyc(handler) + loader._verify_module(module) + # Source code should never be read, only bytecode. + self.failUnlessEqual(loader.log.count('read_data'), 1) + # Bytecode should not be written. + self.failUnless("write_data" not in loader.log) + + def test_bad_magic_no_py(self): + # XXX Can't test until can unmarshal magic number from pyc. + pass + + def test_bad_timestamp_no_py(self): + # XXX Can't test until can unmarshal timestamp from pyc. + pass + + def test_bad_magic_w_py(self): + # XXX Can't test until can unmarhsal magic number from pyc. + pass + + def test_bad_magic_w_py(self): + # XXX Can't test until can unmarshal timestamp from pyc. + pass + def test_py_no_pyc(self): + loader = mock_importer.MockPyPycLoader(pyc_exists=False) + handler = loader._create_handler(importer.PyPycHandler) + module = loader._handle_py(handler) + loader._verify_module(module) + self.failUnless('write_data' not in loader.log) + # No attempt should be made to read bytecode. + self.failUnlessEqual(loader.log.count('read_data'), 1) + + def test_py_w_pyc(self): + loader = mock_importer.MockPyPycLoader() + handler = loader._create_handler(importer.PyPycHandler) + module = loader._handle_py(handler) + loader._verify_module(module) + self.failUnless('write_data' in loader.log) class ExtensionHandlerTests(unittest.TestCase): @@ -392,64 +431,6 @@ if not attr.startswith('_'))) -class ErrorImporter(object): - - """Helper class to have a guaranteed error point.""" - - def find_module(self, fullname, path=None): - self.find_request = fullname, path - raise ImportError - - @classmethod - def set_on_sys_path(cls): - error_entry = '' - sys.path.append(error_entry) - ins = cls() - sys.path_importer_cache[error_entry] = ins - return ins - -class PassImporter(object): - - """Always pass on importing a module.""" - - def find_module(self, fullname, path=None): - self.find_request = fullname, path - return None - - @classmethod - def set_on_sys_path(cls): - pass_entry = '' - sys.path.append(pass_entry) - ins = cls() - sys.path_importer_cache[pass_entry] = ins - return ins - -class SucceedImporter(object): - - """Always succeed by returning 'self'.""" - - module = 42 - - def __call__(self, path_entry): - return self - - def find_module(self, fullname, path=None): - self.find_request = fullname, path - return self - - def load_module(self, fullname, path=None): - self.load_request = fullname, path - return self.module - - @classmethod - def set_on_sys_path(cls): - succeed_entry = '' - sys.path.append(succeed_entry) - ins = cls() - sys.path_importer_cache[succeed_entry] = ins - return ins - - class SimpleImportTests(unittest.TestCase): """Test Importer class with only direct module imports; no packages.""" @@ -477,26 +458,26 @@ def test_default_importer_factory(self): # Make sure that the object passed in during initialization is used # when sys.path_importer_cache has a value of None. - succeed_importer = SucceedImporter() + succeed_importer = mock_importer.SucceedImporter() import_ = importer.Importer(succeed_importer, ()) sys.meta_path = [] sys.path = [''] sys.path_importer_cache[''] = None module = import_('sys') self.failUnlessEqual(succeed_importer.find_request, ('sys', None)) - self.failUnless(module is SucceedImporter.module) + self.failUnless(module is mock_importer.SucceedImporter.module) def test_extended_meta_path(self): # Default meta_path entries set during initialization should be # queried after sys.meta_path. - pass_importer = PassImporter() + pass_importer = mock_importer.PassImporter() sys.meta_path = [pass_importer] - succeed_importer = SucceedImporter() + succeed_importer = mock_importer.SucceedImporter() import_ = importer.Importer(extended_meta_path=(succeed_importer,)) module = import_('sys') for meta_importer in (pass_importer, succeed_importer): self.failUnlessEqual(meta_importer.find_request, ('sys', None)) - self.failUnless(module is SucceedImporter.module) + self.failUnless(module is mock_importer.SucceedImporter.module) def test_default_init(self): # The default initialization should work with a None entry for every @@ -533,7 +514,8 @@ self.failUnlessRaises(ImportError, import_.search_meta_path, 'sys') # Verify call order. - meta_path = PassImporter(), SucceedImporter() + meta_path = (mock_importer.PassImporter(), + mock_importer.SucceedImporter()) sys.meta_path = meta_path loader = import_.search_meta_path('sys') for entry in meta_path: @@ -545,18 +527,18 @@ sys.meta_path = [] import_ = importer.Importer(extended_meta_path=()) sys.path = [] - sys_path = (PassImporter.set_on_sys_path(), - SucceedImporter.set_on_sys_path()) + sys_path = (mock_importer.PassImporter.set_on_sys_path(), + mock_importer.SucceedImporter.set_on_sys_path()) module = import_('token') for entry in sys_path: self.failUnlessEqual(entry.find_request, ('token', None)) - self.failUnless(module is SucceedImporter.module) + self.failUnless(module is mock_importer.SucceedImporter.module) def test_importer_cache_preexisting(self): # A pre-existing importer should be returned if it exists in # sys.path_importer_cache. sys.path = [] - succeed_importer = SucceedImporter.set_on_sys_path() + succeed_importer = mock_importer.SucceedImporter.set_on_sys_path() loader = self.import_.search_sys_path('sys') self.failUnless(loader is succeed_importer) @@ -565,7 +547,7 @@ # then sys.path_hooks should be searched and if one is found then cache # it. path_entry = '' - succeed_importer = SucceedImporter() + succeed_importer = mock_importer.SucceedImporter() sys.path = [path_entry] sys.path_importer_cache.clear() sys.path_hooks = [succeed_importer] From python-checkins at python.org Mon Oct 30 03:41:40 2006 From: python-checkins at python.org (brett.cannon) Date: Mon, 30 Oct 2006 03:41:40 +0100 (CET) Subject: [Python-checkins] r52554 - sandbox/trunk/import_in_py/mock_importer.py Message-ID: <20061030024140.A45D11E4005@bag.python.org> Author: brett.cannon Date: Mon Oct 30 03:41:39 2006 New Revision: 52554 Modified: sandbox/trunk/import_in_py/mock_importer.py Log: Add asserts for __name__, __file__, and __loader__ when verifying that a module is correct. Modified: sandbox/trunk/import_in_py/mock_importer.py ============================================================================== --- sandbox/trunk/import_in_py/mock_importer.py (original) +++ sandbox/trunk/import_in_py/mock_importer.py Mon Oct 30 03:41:39 2006 @@ -65,11 +65,18 @@ return handler.handle_code(self, self.module_name, (self.base_path, self.pyc_ext)) - def _verify_module(self, module): + def _verify_module(self, module, test_metadata=True): if not hasattr(module, 'test_attr'): raise test_support.TestFailed("test_attr attribute missing") if not module.test_attr is None: raise test_support.TestFailed("test_attr not set to None") + if test_metadata: + assert module.__name__ == self.module_name + assert module.__loader__ == self + assert self.base_path in module.__file__ + assert (self.pyc_ext in module.__file__ or + self.py_ext in module.__file__) + return True def load_module(self, fullname, path=None): @@ -128,7 +135,7 @@ module = imp.new_module(self.module_name) code = marshal.loads(data[8:]) exec code in module.__dict__ - assert self._verify_module(module) + assert self._verify_module(module, False) return None @@ -190,4 +197,4 @@ sys.path.append(succeed_entry) ins = cls() sys.path_importer_cache[succeed_entry] = ins - return ins \ No newline at end of file + return ins From buildbot at python.org Mon Oct 30 04:56:19 2006 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Oct 2006 03:56:19 +0000 Subject: [Python-checkins] buildbot warnings in sparc Ubuntu dapper trunk Message-ID: <20061030035620.219771E4005@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/769 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 Excerpt from the test logfile: 1 test failed: test_urllib2net sincerely, -The Buildbot From python-checkins at python.org Tue Oct 31 18:32:37 2006 From: python-checkins at python.org (vinay.sajip) Date: Tue, 31 Oct 2006 18:32:37 +0100 (CET) Subject: [Python-checkins] r52555 - python/trunk/Lib/logging/__init__.py Message-ID: <20061031173237.D3AC01E4002@bag.python.org> Author: vinay.sajip Date: Tue Oct 31 18:32:37 2006 New Revision: 52555 Modified: python/trunk/Lib/logging/__init__.py Log: Change to improve speed of _fixupChildren Modified: python/trunk/Lib/logging/__init__.py ============================================================================== --- python/trunk/Lib/logging/__init__.py (original) +++ python/trunk/Lib/logging/__init__.py Tue Oct 31 18:32:37 2006 @@ -910,9 +910,12 @@ Ensure that children of the placeholder ph are connected to the specified logger. """ - #for c in ph.loggers: + name = alogger.name + namelen = len(name) for c in ph.loggerMap.keys(): - if string.find(c.parent.name, alogger.name) <> 0: + #The if means ... if not c.parent.name.startswith(nm) + #if string.find(c.parent.name, nm) <> 0: + if c.parent.name[:namelen] != name: alogger.parent = c.parent c.parent = alogger From python-checkins at python.org Tue Oct 31 18:34:31 2006 From: python-checkins at python.org (vinay.sajip) Date: Tue, 31 Oct 2006 18:34:31 +0100 (CET) Subject: [Python-checkins] r52556 - python/trunk/Doc/lib/liblogging.tex Message-ID: <20061031173431.8F6441E4002@bag.python.org> Author: vinay.sajip Date: Tue Oct 31 18:34:31 2006 New Revision: 52556 Modified: python/trunk/Doc/lib/liblogging.tex Log: Added relativeCreated to Formatter doc (has been in the system for a long time - was unaccountably left out of the docs and not noticed until now). Modified: python/trunk/Doc/lib/liblogging.tex ============================================================================== --- python/trunk/Doc/lib/liblogging.tex (original) +++ python/trunk/Doc/lib/liblogging.tex Tue Oct 31 18:34:31 2006 @@ -1397,6 +1397,9 @@ (if available).} \lineii{\%(created)f} {Time when the \class{LogRecord} was created (as returned by \function{time.time()}).} +\lineii{\%(relativeCreated)d} {Time in milliseconds when the LogRecord was + created, relative to the time the logging module was + loaded.} \lineii{\%(asctime)s} {Human-readable time when the \class{LogRecord} was created. By default this is of the form ``2003-07-08 16:49:45,896'' (the numbers after the From python-checkins at python.org Tue Oct 31 23:46:25 2006 From: python-checkins at python.org (brett.cannon) Date: Tue, 31 Oct 2006 23:46:25 +0100 (CET) Subject: [Python-checkins] r52566 - sandbox/trunk/import_in_py/importer.py Message-ID: <20061031224625.D59DB1E4002@bag.python.org> Author: brett.cannon Date: Tue Oct 31 23:46:25 2006 New Revision: 52566 Modified: sandbox/trunk/import_in_py/importer.py Log: Tweak some comments. 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 31 23:46:25 2006 @@ -43,7 +43,7 @@ bound in the namespace (including previously imported modules) [package essay]. * Must make sure that importing submodules later on have the proper attributes - for modules with the submodule in its path (e.g., inheriting A.B.C and A.B.D + for modules with the submodule in its path (e.g., importing A.B.C and A.B.D need to have A.B having C and D as attributes) [package essay]. * Submodules must be imported first (e.g., importing A.B requires A to be imported first) [package essay]. @@ -69,7 +69,7 @@ Improvements ------------ * Have a meta_path entry for checking sys.modules to remove need for - loaders to do it. + loaders or __import__ to do it. * 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 so they can be re-checked the next time a new import @@ -86,9 +86,9 @@ no real need. + Importing the module being imported in a circular import dependency requires that module added to sys.modules stay consistent from the - point it is added to initialization. -* Remove any idea of default importer. - + Removes None entries from sys.path_importer_cache. + point it is added to initialization anyway. +* Remove any idea of a default importer. + + Removes support for None entries from sys.path_importer_cache. + Rely on default importers being in sys.path_hooks or sys.meta_path. Rejected Ideas @@ -196,7 +196,7 @@ """sys.meta_path class for importing frozen modules.""" - # XXX Frozen packages seem to exist. + # XXX Need to make sure frozen packages can be handled. _find = imp.is_frozen _load = imp.init_frozen