diff --git a/.gitignore b/.gitignore index 95c8574..43efa0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ libpython-36a517ef7848cbd0b3dcc7371f32e47ac4c87eba.tar.gz Python-3.1.2.tar.bz2 +Python-3.2a1.tar.bz2 diff --git a/autotool-intermediates.patch b/autotool-intermediates.patch new file mode 100644 index 0000000..efbf3bf --- /dev/null +++ b/autotool-intermediates.patch @@ -0,0 +1,243 @@ +diff -up ./configure.autotool-intermediates ./configure +--- ./configure.autotool-intermediates 2010-08-02 17:58:12.238002650 -0400 ++++ ./configure 2010-08-02 17:58:20.151000507 -0400 +@@ -1,5 +1,5 @@ + #! /bin/sh +-# From configure.in Revision: 82090 . ++# From configure.in Revision: 82962 . + # Guess values for system-dependent variables and create Makefiles. + # Generated by GNU Autoconf 2.65 for python 3.2. + # +@@ -610,6 +610,8 @@ TRUE + MACHDEP_OBJS + DYNLOADFILE + DLINCLDIR ++DTRACEHDRS ++DTRACEOBJS + THREADOBJ + LDLAST + USE_THREAD_MODULE +@@ -630,6 +632,8 @@ OTHER_LIBTOOL_OPT + UNIVERSAL_ARCH_FLAGS + BASECFLAGS + OPT ++DEBUG_SUFFIX ++DEBUG_EXT + LN + INSTALL_DATA + INSTALL_SCRIPT +@@ -743,8 +747,11 @@ with_thread + enable_ipv6 + with_doc_strings + with_tsc ++with_count_allocs ++with_call_profile + with_pymalloc + with_valgrind ++with_dtrace + with_wctype_functions + with_fpectl + with_libm +@@ -1414,8 +1421,11 @@ Optional Packages: + deprecated; use --with(out)-threads + --with(out)-doc-strings disable/enable documentation strings + --with(out)-tsc enable/disable timestamp counter profile ++ --with(out)count-allocs enable/disable per-type instance accounting ++ --with(out)-call-profile enable/disable statistics on function call invocation + --with(out)-pymalloc disable/enable specialized mallocs + --with-valgrind Enable Valgrind support ++ --with(out)-dtrace disable/enable dtrace support + --with-wctype-functions use wctype.h functions + --with-fpectl enable SIGFPE catching + --with-libm=STRING math library +@@ -1929,11 +1939,11 @@ else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + $ac_includes_default +- enum { N = $2 / 2 - 1 }; + int + main () + { +-static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; ++static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 }; ++ 0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; + test_array [0] = 0 + + ; +@@ -1944,11 +1954,11 @@ if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + $ac_includes_default +- enum { N = $2 / 2 - 1 }; + int + main () + { +-static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) ++static int test_array [1 - 2 * !(enum { N = $2 / 2 - 1 }; ++ ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) + < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; + test_array [0] = 0 + +@@ -4672,7 +4682,7 @@ esac + $as_echo_n "checking LIBRARY... " >&6; } + if test -z "$LIBRARY" + then +- LIBRARY='libpython$(VERSION).a' ++ LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a' + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBRARY" >&5 + $as_echo "$LIBRARY" >&6; } +@@ -4843,8 +4853,8 @@ $as_echo "#define Py_ENABLE_SHARED 1" >> + INSTSONAME="$LDLIBRARY".$SOVERSION + ;; + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) +- LDLIBRARY='libpython$(VERSION).so' +- BLDLIBRARY='-L. -lpython$(VERSION)' ++ LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so' ++ BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)' + RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} + case $ac_sys_system in + FreeBSD*) +@@ -5237,6 +5247,14 @@ $as_echo "no" >&6; } + fi + + ++if test "$Py_DEBUG" = 'true' ++then ++ DEBUG_EXT=_d ++ DEBUG_SUFFIX=-debug ++fi ++ ++ ++ + # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be + # merged with this chunk of code? + +@@ -8160,6 +8178,7 @@ fi + $as_echo "$with_system_expat" >&6; } + + # Check for use of the system libffi library ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-system-ffi" >&5 + $as_echo_n "checking for --with-system-ffi... " >&6; } + +@@ -9144,6 +9163,50 @@ $as_echo "no" >&6; } + fi + + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-count-allocs" >&5 ++$as_echo_n "checking for --with-count-allocs... " >&6; } ++ ++# Check whether --with-count-allocs was given. ++if test "${with_count_allocs+set}" = set; then : ++ withval=$with_count_allocs; ++if test "$withval" != no ++then ++ ++$as_echo "#define COUNT_ALLOCS 1" >>confdefs.h ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-call-profile" >&5 ++$as_echo_n "checking for --with-call-profile... " >&6; } ++ ++# Check whether --with-call-profile was given. ++if test "${with_call_profile+set}" = set; then : ++ withval=$with_call_profile; ++if test "$withval" != no ++then ++ ++$as_echo "#define CALL_PROFILE 1" >>confdefs.h ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ + # Check for Python-specific malloc support + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-pymalloc" >&5 + $as_echo_n "checking for --with-pymalloc... " >&6; } +@@ -9194,6 +9257,46 @@ fi + OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT" + fi + ++# Check for dtrace support ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-dtrace" >&5 ++$as_echo_n "checking for --with-dtrace... " >&6; } ++ ++# Check whether --with-dtrace was given. ++if test "${with_dtrace+set}" = set; then : ++ withval=$with_dtrace; ++fi ++ ++ ++if test ! -z "$with_dtrace" ++then ++ if dtrace -G -o /dev/null -s $srcdir/Include/pydtrace.d 2>/dev/null ++ then ++ ++$as_echo "#define WITH_DTRACE 1" >>confdefs.h ++ ++ with_dtrace="Sun" ++ DTRACEOBJS="Python/dtrace.o" ++ DTRADEHDRS="" ++ elif dtrace -h -o /dev/null -s $srcdir/Include/pydtrace.d ++ then ++ ++$as_echo "#define WITH_DTRACE 1" >>confdefs.h ++ ++ with_dtrace="Apple" ++ DTRACEOBJS="" ++ DTRADEHDRS="pydtrace.h" ++ else ++ with_dtrace="no" ++ fi ++else ++ with_dtrace="no" ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_dtrace" >&5 ++$as_echo "$with_dtrace" >&6; } ++ ++ ++ + # Check for --with-wctype-functions + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-wctype-functions" >&5 + $as_echo_n "checking for --with-wctype-functions... " >&6; } +diff -up ./pyconfig.h.in.autotool-intermediates ./pyconfig.h.in +--- ./pyconfig.h.in.autotool-intermediates 2010-08-02 17:58:12.236001348 -0400 ++++ ./pyconfig.h.in 2010-08-02 17:58:20.000000000 -0400 +@@ -12,15 +12,15 @@ + support for AIX C++ shared extension modules. */ + #undef AIX_GENUINE_CPLUSPLUS + +-/* Define if you have the Mach cthreads package */ +-#undef C_THREADS +- + /* Define to keep records on function call invocation */ + #undef CALL_PROFILE + + /* Define to keep records of the number of instances of each type */ + #undef COUNT_ALLOCS + ++/* Define if you have the Mach cthreads package */ ++#undef C_THREADS ++ + /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM + mixed-endian order (byte order 45670123) */ + #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 diff --git a/less-verbose-COUNT_ALLOCS.patch b/less-verbose-COUNT_ALLOCS.patch new file mode 100644 index 0000000..8cef015 --- /dev/null +++ b/less-verbose-COUNT_ALLOCS.patch @@ -0,0 +1,20 @@ +diff -up Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS Python-2.7/Python/pythonrun.c +--- Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS 2010-08-17 14:49:33.321913909 -0400 ++++ Python-2.7/Python/pythonrun.c 2010-08-17 14:54:48.750910403 -0400 +@@ -470,7 +470,15 @@ Py_Finalize(void) + + /* Debugging stuff */ + #ifdef COUNT_ALLOCS +- dump_counts(stdout); ++ /* This is a downstream Fedora modification. ++ The upstream default with COUNT_ALLOCS is to always dump the counts to ++ stdout on exit. For our debug builds its useful to have the info from ++ COUNT_ALLOCS available, but the stdout info here gets in the way, so ++ we make it optional, wrapping it in an environment variable (modelled ++ on the other PYTHONDUMP* env variables): ++ */ ++ if (Py_GETENV("PYTHONDUMPCOUNTS")) ++ dump_counts(stdout); + #endif + + PRINT_TOTAL_REFS(); diff --git a/python-2.6.5-statvfs-f_flag-constants.patch b/python-2.6.5-statvfs-f_flag-constants.patch deleted file mode 100644 index 4b3390d..0000000 --- a/python-2.6.5-statvfs-f_flag-constants.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 21fda4c78000d78cb1824fdf0373031d07f5325a Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Wed, 6 Jan 2010 15:22:38 -0500 -Subject: [PATCH] Add flags for statvfs.f_flag to constant list. - -You really need these to figure out what statvfs is trying to say to -you, so add them here. ---- - Modules/posixmodule.c | 37 +++++++++++++++++++++++++++++++++++++ - 1 files changed, 37 insertions(+), 0 deletions(-) - -diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c -index ebdbc8d..d79013b 100644 ---- a/Modules/posixmodule.c -+++ b/Modules/posixmodule.c -@@ -8990,6 +8990,43 @@ all_ins(PyObject *d) - #endif - #endif - -+ /* These came from statvfs.h */ -+#ifdef ST_RDONLY -+ if (ins(d, "ST_RDONLY", (long)ST_RDONLY)) return -1; -+#endif /* ST_RDONLY */ -+#ifdef ST_NOSUID -+ if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1; -+#endif /* ST_NOSUID */ -+ -+ /* GNU extensions */ -+#ifdef ST_NODEV -+ if (ins(d, "ST_NODEV", (long)ST_NODEV)) return -1; -+#endif /* ST_NODEV */ -+#ifdef ST_NOEXEC -+ if (ins(d, "ST_NOEXEC", (long)ST_NOEXEC)) return -1; -+#endif /* ST_NOEXEC */ -+#ifdef ST_SYNCHRONOUS -+ if (ins(d, "ST_SYNCHRONOUS", (long)ST_SYNCHRONOUS)) return -1; -+#endif /* ST_SYNCHRONOUS */ -+#ifdef ST_MANDLOCK -+ if (ins(d, "ST_MANDLOCK", (long)ST_MANDLOCK)) return -1; -+#endif /* ST_MANDLOCK */ -+#ifdef ST_WRITE -+ if (ins(d, "ST_WRITE", (long)ST_WRITE)) return -1; -+#endif /* ST_WRITE */ -+#ifdef ST_APPEND -+ if (ins(d, "ST_APPEND", (long)ST_APPEND)) return -1; -+#endif /* ST_APPEND */ -+#ifdef ST_NOATIME -+ if (ins(d, "ST_NOATIME", (long)ST_NOATIME)) return -1; -+#endif /* ST_NOATIME */ -+#ifdef ST_NODIRATIME -+ if (ins(d, "ST_NODIRATIME", (long)ST_NODIRATIME)) return -1; -+#endif /* ST_NODIRATIME */ -+#ifdef ST_RELATIME -+ if (ins(d, "ST_RELATIME", (long)ST_RELATIME)) return -1; -+#endif /* ST_RELATIME */ -+ - #if defined(PYOS_OS2) - if (insertvalues(d)) return -1; - #endif --- -1.6.6 - diff --git a/python-3.1-fix-parallel-make.patch b/python-3.1-fix-parallel-make.patch deleted file mode 100644 index 3c75b10..0000000 --- a/python-3.1-fix-parallel-make.patch +++ /dev/null @@ -1,38 +0,0 @@ -Index: Python-3.1.2/Makefile.pre.in -=================================================================== ---- Python-3.1.2.orig/Makefile.pre.in -+++ Python-3.1.2/Makefile.pre.in -@@ -215,6 +215,7 @@ IO_OBJS= \ - - ########################################################################## - # Grammar -+GRAMMAR_STAMP= $(srcdir)/grammar-stamp - GRAMMAR_H= $(srcdir)/Include/graminit.h - GRAMMAR_C= $(srcdir)/Python/graminit.c - GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar -@@ -535,9 +536,24 @@ Modules/python.o: $(srcdir)/Modules/pyth - - $(IO_OBJS): $(IO_H) - --$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) -+# GNU "make" interprets rules with two dependents as two copies of the rule. -+# -+# In a parallel build this can lead to pgen being run twice, once for each of -+# GRAMMAR_H and GRAMMAR_C, leading to race conditions in which the compiler -+# reads a partially-overwritten copy of one of these files, leading to syntax -+# errors (or linker errors if the fragment happens to be syntactically valid C) -+# -+# See http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html -+# for more information -+# -+# Introduce ".grammar-stamp" as a contrived single output from PGEN to avoid -+# this: -+$(GRAMMAR_H) $(GRAMMAR_C): $(GRAMMAR_STAMP) -+ -+$(GRAMMAR_STAMP): $(PGEN) $(GRAMMAR_INPUT) - -@$(INSTALL) -d Include - -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) -+ touch $(GRAMMAR_STAMP) - - $(PGEN): $(PGENOBJS) - $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) diff --git a/python-3.1.1-apply-our-changes-to-expected-shebang-for-test_imp.patch b/python-3.1.1-apply-our-changes-to-expected-shebang-for-test_imp.patch deleted file mode 100644 index 92c3e1f..0000000 --- a/python-3.1.1-apply-our-changes-to-expected-shebang-for-test_imp.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Python-3.1.1/Lib/test/test_imp.py.apply-our-changes-to-expected-shebang 2009-10-27 18:05:53.539540149 -0400 -+++ Python-3.1.1/Lib/test/test_imp.py 2009-10-27 18:06:12.138538965 -0400 -@@ -52,7 +52,7 @@ class ImportTests(unittest.TestCase): - self.assertNotEqual(fp, None) - self.assertEqual(fp.encoding, "iso-8859-1") - self.assertEqual(fp.tell(), 0) -- self.assertEqual(fp.readline(), '#!/usr/bin/env python\n') -+ self.assertEqual(fp.readline(), '#!/usr/bin/python3.1\n') - fp.close() - - fp, filename, info = imp.find_module("tokenize") diff --git a/python-3.1.1-config.patch b/python-3.1.1-config.patch deleted file mode 100644 index b9eec5b..0000000 --- a/python-3.1.1-config.patch +++ /dev/null @@ -1,226 +0,0 @@ -diff -up Python-3.1.1/Modules/Setup.dist.config Python-3.1.1/Modules/Setup.dist ---- Python-3.1.1/Modules/Setup.dist.config 2009-06-04 05:30:30.000000000 -0400 -+++ Python-3.1.1/Modules/Setup.dist 2010-01-25 23:08:55.179858352 -0500 -@@ -141,7 +141,7 @@ _symtable symtablemodule.c - # modules are to be built as shared libraries (see above for more - # detail; also note that *static* reverses this effect): - --#*shared* -+*shared* - - # GNU readline. Unlike previous Python incarnations, GNU readline is - # now incorporated in an optional module, configured in the Setup file -@@ -151,71 +151,71 @@ _symtable symtablemodule.c - # it, depending on your system -- see the GNU readline instructions. - # It's okay for this to be a shared library, too. - --#readline readline.c -lreadline -ltermcap -+readline readline.c -lreadline -ltermcap - - - # Modules that should always be present (non UNIX dependent): - --#array arraymodule.c # array objects --#cmath cmathmodule.c # -lm # complex math library functions --#math mathmodule.c # -lm # math library functions, e.g. sin() --#_struct _struct.c # binary structure packing/unpacking --#time timemodule.c # -lm # time operations and variables --#operator operator.c # operator.add() and similar goodies --#_weakref _weakref.c # basic weak reference support --#_testcapi _testcapimodule.c # Python C API test module --#_random _randommodule.c # Random number generator --#_collections _collectionsmodule.c # Container types --#itertools itertoolsmodule.c # Functions creating iterators for efficient looping --#atexit atexitmodule.c # Register functions to be run at interpreter-shutdown -+array arraymodule.c # array objects -+cmath cmathmodule.c # -lm # complex math library functions -+math mathmodule.c # -lm # math library functions, e.g. sin() -+_struct _struct.c # binary structure packing/unpacking -+time timemodule.c # -lm # time operations and variables -+operator operator.c # operator.add() and similar goodies -+_weakref _weakref.c # basic weak reference support -+_testcapi _testcapimodule.c # Python C API test module -+_random _randommodule.c # Random number generator -+_collections _collectionsmodule.c # Container types -+itertools itertoolsmodule.c # Functions creating iterators for efficient looping -+atexit atexitmodule.c # Register functions to be run at interpreter-shutdown - #_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator --#_pickle _pickle.c # pickle accelerator -+_pickle _pickle.c # pickle accelerator - #datetime datetimemodule.c # date/time type --#_bisect _bisectmodule.c # Bisection algorithms --#_heapq _heapqmodule.c # Heap queue algorithm -+_bisect _bisectmodule.c # Bisection algorithms -+_heapq _heapqmodule.c # Heap queue algorithm - --#unicodedata unicodedata.c # static Unicode character database -+unicodedata unicodedata.c # static Unicode character database - - - # Modules with some UNIX dependencies -- on by default: - # (If you have a really backward UNIX, select and socket may not be - # supported...) - --#fcntl fcntlmodule.c # fcntl(2) and ioctl(2) --#spwd spwdmodule.c # spwd(3) --#grp grpmodule.c # grp(3) --#select selectmodule.c # select(2); not on ancient System V -+fcntl fcntlmodule.c # fcntl(2) and ioctl(2) -+spwd spwdmodule.c # spwd(3) -+grp grpmodule.c # grp(3) -+select selectmodule.c # select(2); not on ancient System V - - # Memory-mapped files (also works on Win32). --#mmap mmapmodule.c -+mmap mmapmodule.c - - # CSV file helper --#_csv _csv.c -+_csv _csv.c - - # Socket module helper for socket(2) --#_socket socketmodule.c -+_socket socketmodule.c - - # Socket module helper for SSL support; you must comment out the other - # socket line above, and possibly edit the SSL variable: - #SSL=/usr/local/ssl --#_ssl _ssl.c \ --# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ --# -L$(SSL)/lib -lssl -lcrypto -+_ssl _ssl.c \ -+ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -+ -L$(SSL)/lib -lssl -lcrypto - - # The crypt module is now disabled by default because it breaks builds - # on many systems (where -lcrypt is needed), e.g. Linux (I believe). - # - # First, look at Setup.config; configure may have set this for you. - --#crypt cryptmodule.c # -lcrypt # crypt(3); needs -lcrypt on some systems -+crypt cryptmodule.c -lcrypt # crypt(3); needs -lcrypt on some systems - - - # Some more UNIX dependent modules -- off by default, since these - # are not supported by all UNIX systems: - --#nis nismodule.c -lnsl # Sun yellow pages -- not everywhere --#termios termios.c # Steen Lumholt's termios module --#resource resource.c # Jeremy Hylton's rlimit interface -+nis nismodule.c -lnsl # Sun yellow pages -- not everywhere -+termios termios.c # Steen Lumholt's termios module -+resource resource.c # Jeremy Hylton's rlimit interface - - - # Multimedia modules -- off by default. -@@ -223,7 +223,7 @@ _symtable symtablemodule.c - # #993173 says audioop works on 64-bit platforms, though. - # These represent audio samples or images as strings: - --#audioop audioop.c # Operations on audio samples -+audioop audioop.c # Operations on audio samples - - - # Note that the _md5 and _sha modules are normally only built if the -@@ -238,9 +238,9 @@ _symtable symtablemodule.c - - # The _sha module implements the SHA checksum algorithms. - # (NIST's Secure Hash Algorithms.) --#_sha shamodule.c --#_sha256 sha256module.c --#_sha512 sha512module.c -+_sha1 sha1module.c -+_sha256 sha256module.c -+_sha512 sha512module.c - - - # The _tkinter module. -@@ -255,7 +255,7 @@ _symtable symtablemodule.c - # every system. - - # *** Always uncomment this (leave the leading underscore in!): --# _tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ -+_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \ - # *** Uncomment and edit to reflect where your Tcl/Tk libraries are: - # -L/usr/local/lib \ - # *** Uncomment and edit to reflect where your Tcl/Tk headers are: -@@ -265,7 +265,7 @@ _symtable symtablemodule.c - # *** Or uncomment this for Solaris: - # -I/usr/openwin/include \ - # *** Uncomment and edit for Tix extension only: --# -DWITH_TIX -ltix8.1.8.2 \ -+ -DWITH_TIX -ltix \ - # *** Uncomment and edit for BLT extension only: - # -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \ - # *** Uncomment and edit for PIL (TkImaging) extension only: -@@ -274,7 +274,7 @@ _symtable symtablemodule.c - # *** Uncomment and edit for TOGL extension only: - # -DWITH_TOGL togl.c \ - # *** Uncomment and edit to reflect your Tcl/Tk versions: --# -ltk8.2 -ltcl8.2 \ -+ -ltk -ltcl \ - # *** Uncomment and edit to reflect where your X11 libraries are: - # -L/usr/X11R6/lib \ - # *** Or uncomment this for Solaris: -@@ -284,10 +284,10 @@ _symtable symtablemodule.c - # *** Uncomment for AIX: - # -lld \ - # *** Always uncomment this; X11 libraries to link with: --# -lX11 -+ -lX11 - - # Lance Ellinghaus's syslog module --#syslog syslogmodule.c # syslog daemon interface -+syslog syslogmodule.c # syslog daemon interface - - - # Curses support, requring the System V version of curses, often -@@ -321,14 +321,14 @@ _symtable symtablemodule.c - # - # First, look at Setup.config; configure may have set this for you. - --#_gdbm _gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm -+_gdbm _gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm - - - # Helper module for various ascii-encoders --#binascii binascii.c -+binascii binascii.c - - # Fred Drake's interface to the Python parser --#parser parsermodule.c -+parser parsermodule.c - - - # Lee Busby's SIGFPE modules. -@@ -351,7 +351,7 @@ _symtable symtablemodule.c - # Andrew Kuchling's zlib module. - # This require zlib 1.1.3 (or later). - # See http://www.gzip.org/zlib/ --#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz -+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz - - # Interface to the Expat XML parser - # -@@ -369,14 +369,14 @@ _symtable symtablemodule.c - # Hye-Shik Chang's CJKCodecs - - # multibytecodec is required for all the other CJK codec modules --#_multibytecodec cjkcodecs/multibytecodec.c -+_multibytecodec cjkcodecs/multibytecodec.c - --#_codecs_cn cjkcodecs/_codecs_cn.c --#_codecs_hk cjkcodecs/_codecs_hk.c --#_codecs_iso2022 cjkcodecs/_codecs_iso2022.c --#_codecs_jp cjkcodecs/_codecs_jp.c --#_codecs_kr cjkcodecs/_codecs_kr.c --#_codecs_tw cjkcodecs/_codecs_tw.c -+_codecs_cn cjkcodecs/_codecs_cn.c -+_codecs_hk cjkcodecs/_codecs_hk.c -+_codecs_iso2022 cjkcodecs/_codecs_iso2022.c -+_codecs_jp cjkcodecs/_codecs_jp.c -+_codecs_kr cjkcodecs/_codecs_kr.c -+_codecs_tw cjkcodecs/_codecs_tw.c - - # Example -- included for reference only: - # xx xxmodule.c diff --git a/python-3.1.1-lib64.patch b/python-3.1.1-lib64.patch deleted file mode 100644 index 3053a92..0000000 --- a/python-3.1.1-lib64.patch +++ /dev/null @@ -1,164 +0,0 @@ -diff -ur Python-3.1.1.orig/Lib/distutils/command/install.py Python-3.1.1/Lib/distutils/command/install.py ---- Python-3.1.1.orig/Lib/distutils/command/install.py 2009-09-24 15:28:57.000000000 -0600 -+++ Python-3.1.1/Lib/distutils/command/install.py 2009-09-24 15:34:18.000000000 -0600 -@@ -47,14 +47,14 @@ - INSTALL_SCHEMES = { - 'unix_prefix': { - 'purelib': '$base/lib/python$py_version_short/site-packages', -- 'platlib': '$platbase/lib/python$py_version_short/site-packages', -+ 'platlib': '$platbase/lib64/python$py_version_short/site-packages', - 'headers': '$base/include/python$py_version_short/$dist_name', - 'scripts': '$base/bin', - 'data' : '$base', - }, - 'unix_home': { - 'purelib': '$base/lib/python', -- 'platlib': '$base/lib/python', -+ 'platlib': '$base/lib64/python', - 'headers': '$base/include/python/$dist_name', - 'scripts': '$base/bin', - 'data' : '$base', -diff -ur Python-3.1.1.orig/Lib/distutils/sysconfig.py Python-3.1.1/Lib/distutils/sysconfig.py ---- Python-3.1.1.orig/Lib/distutils/sysconfig.py 2009-09-24 15:29:00.000000000 -0600 -+++ Python-3.1.1/Lib/distutils/sysconfig.py 2009-09-24 15:34:18.000000000 -0600 -@@ -117,8 +117,12 @@ - prefix = plat_specific and EXEC_PREFIX or PREFIX - - if os.name == "posix": -+ if plat_specific or standard_lib: -+ lib = "lib64" -+ else: -+ lib = "lib" - libpython = os.path.join(prefix, -- "lib", "python" + get_python_version()) -+ lib, "python" + get_python_version()) - if standard_lib: - return libpython - else: -diff -ur Python-3.1.1.orig/Lib/site.py Python-3.1.1/Lib/site.py ---- Python-3.1.1.orig/Lib/site.py 2009-09-24 15:28:56.000000000 -0600 -+++ Python-3.1.1/Lib/site.py 2009-09-24 15:34:18.000000000 -0600 -@@ -258,12 +258,16 @@ - if sys.platform in ('os2emx', 'riscos'): - sitedirs.append(os.path.join(prefix, "Lib", "site-packages")) - elif os.sep == '/': -+ sitedirs.append(os.path.join(prefix, "lib64", -+ "python" + sys.version[:3], -+ "site-packages")) - sitedirs.append(os.path.join(prefix, "lib", - "python" + sys.version[:3], - "site-packages")) - sitedirs.append(os.path.join(prefix, "lib", "site-python")) - else: - sitedirs.append(prefix) -+ sitedirs.append(os.path.join(prefix, "lib64", "site-packages")) - sitedirs.append(os.path.join(prefix, "lib", "site-packages")) - - if sys.platform == "darwin": -diff -ur Python-3.1.1.orig/Makefile.pre.in Python-3.1.1/Makefile.pre.in ---- Python-3.1.1.orig/Makefile.pre.in 2009-09-24 15:26:58.000000000 -0600 -+++ Python-3.1.1/Makefile.pre.in 2009-09-24 15:34:18.000000000 -0600 -@@ -90,11 +90,11 @@ - - # Expanded directories - BINDIR= $(exec_prefix)/bin --LIBDIR= $(exec_prefix)/lib -+LIBDIR= $(exec_prefix)/lib64 - MANDIR= @mandir@ - INCLUDEDIR= @includedir@ - CONFINCLUDEDIR= $(exec_prefix)/include --SCRIPTDIR= $(prefix)/lib -+SCRIPTDIR= $(prefix)/lib64 - - # Detailed destination directories - BINLIBDEST= $(LIBDIR)/python$(VERSION) -diff -ur Python-3.1.1.orig/Modules/getpath.c Python-3.1.1/Modules/getpath.c ---- Python-3.1.1.orig/Modules/getpath.c 2009-09-24 15:27:15.000000000 -0600 -+++ Python-3.1.1/Modules/getpath.c 2009-09-24 15:36:58.000000000 -0600 -@@ -117,8 +117,8 @@ - #endif - - #ifndef PYTHONPATH --#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \ -- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload" -+#define PYTHONPATH PREFIX "/lib64/python" VERSION ":" \ -+ EXEC_PREFIX "/lib64/python" VERSION "/lib-dynload" - #endif - - #ifndef LANDMARK -@@ -129,7 +129,7 @@ - static wchar_t exec_prefix[MAXPATHLEN+1]; - static wchar_t progpath[MAXPATHLEN+1]; - static wchar_t *module_search_path = NULL; --static wchar_t lib_python[] = L"lib/python" VERSION; -+static wchar_t lib_python[] = L"lib64/python" VERSION; - - /* In principle, this should use HAVE__WSTAT, and _wstat - should be detected by autoconf. However, no current -@@ -603,7 +603,7 @@ - } - else - wcsncpy(zip_path, L"" PREFIX, MAXPATHLEN); -- joinpath(zip_path, L"lib/python00.zip"); -+ joinpath(zip_path, L"lib64/python00.zip"); - bufsz = wcslen(zip_path); /* Replace "00" with version */ - zip_path[bufsz - 6] = VERSION[0]; - zip_path[bufsz - 5] = VERSION[2]; -@@ -613,7 +613,7 @@ - fprintf(stderr, - "Could not find platform dependent libraries \n"); - wcsncpy(exec_prefix, L"" EXEC_PREFIX, MAXPATHLEN); -- joinpath(exec_prefix, L"lib/lib-dynload"); -+ joinpath(exec_prefix, L"lib64/lib-dynload"); - } - /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ - -diff -ur Python-3.1.1.orig/Modules/Setup.dist Python-3.1.1/Modules/Setup.dist ---- Python-3.1.1.orig/Modules/Setup.dist 2009-09-24 15:27:30.000000000 -0600 -+++ Python-3.1.1/Modules/Setup.dist 2009-09-24 15:45:49.000000000 -0600 -@@ -351,7 +351,7 @@ - # Andrew Kuchling's zlib module. - # This require zlib 1.1.3 (or later). - # See http://www.gzip.org/zlib/ --zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz -+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib64 -lz - - # Interface to the Expat XML parser - # -diff -ur Python-3.1.1.orig/setup.py Python-3.1.1/setup.py ---- Python-3.1.1.orig/setup.py 2009-09-24 15:26:58.000000000 -0600 -+++ Python-3.1.1/setup.py 2009-09-24 15:34:18.000000000 -0600 -@@ -295,7 +295,7 @@ - - def detect_modules(self): - # Ensure that /usr/local is always used -- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') -+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64') - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') - - # Add paths specified in the environment variables LDFLAGS and -@@ -522,11 +522,11 @@ - elif self.compiler.find_library_file(lib_dirs, 'curses'): - readline_libs.append('curses') - elif self.compiler.find_library_file(lib_dirs + -- ['/usr/lib/termcap'], -+ ['/usr/lib64/termcap'], - 'termcap'): - readline_libs.append('termcap') - exts.append( Extension('readline', ['readline.c'], -- library_dirs=['/usr/lib/termcap'], -+ library_dirs=['/usr/lib64/termcap'], - extra_link_args=readline_extra_link_args, - libraries=readline_libs) ) - else: -@@ -563,8 +563,8 @@ - if krb5_h: - ssl_incs += krb5_h - ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, -- ['/usr/local/ssl/lib', -- '/usr/contrib/ssl/lib/' -+ ['/usr/local/ssl/lib64', -+ '/usr/contrib/ssl/lib64/' - ] ) - - if (ssl_incs is not None and diff --git a/python-3.1.1-no-static-lib.patch b/python-3.1.1-no-static-lib.patch deleted file mode 100644 index 325636e..0000000 --- a/python-3.1.1-no-static-lib.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -up Python-3.1.1/Makefile.pre.in.no-static-lib Python-3.1.1/Makefile.pre.in ---- Python-3.1.1/Makefile.pre.in.no-static-lib 2010-01-17 15:42:11.945858717 -0500 -+++ Python-3.1.1/Makefile.pre.in 2010-01-17 16:44:32.788859363 -0500 -@@ -405,7 +405,7 @@ coverage: - - - # Build the interpreter --$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) -+$(BUILDPYTHON): Modules/python.o $(LDLIBRARY) - $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \ - Modules/python.o \ - $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) -@@ -421,18 +421,6 @@ sharedmods: $(BUILDPYTHON) - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ - esac - --# Build static library --# avoid long command lines, same as LIBRARY_OBJS --$(LIBRARY): $(LIBRARY_OBJS) -- -rm -f $@ -- $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o -- $(AR) $(ARFLAGS) $@ $(PARSER_OBJS) -- $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS) -- $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) -- $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS) -- $(AR) $(ARFLAGS) $@ $(MODOBJS) -- $(RANLIB) $@ -- - libpython$(VERSION).so: $(LIBRARY_OBJS) - if test $(INSTSONAME) != $(LDLIBRARY); then \ - $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ -@@ -973,18 +961,6 @@ libainstall: all - else true; \ - fi; \ - done -- @if test -d $(LIBRARY); then :; else \ -- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ -- if test "$(SO)" = .dll; then \ -- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ -- else \ -- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ -- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ -- fi; \ -- else \ -- echo Skip install of $(LIBRARY) - use make frameworkinstall; \ -- fi; \ -- fi - $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c - $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o - $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in diff --git a/python-3.1.1-remove-mimeaudio-tests.patch b/python-3.1.1-remove-mimeaudio-tests.patch deleted file mode 100644 index 487ad3e..0000000 --- a/python-3.1.1-remove-mimeaudio-tests.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- Python-3.1.1/Lib/email/test/test_email.py.remove_mimeaudio_tests 2009-10-27 14:31:09.483539561 -0400 -+++ Python-3.1.1/Lib/email/test/test_email.py 2009-10-27 14:31:27.663548053 -0400 -@@ -926,52 +926,6 @@ Blah blah blah - - - --# Test the basic MIMEAudio class --class TestMIMEAudio(unittest.TestCase): -- def setUp(self): -- # Make sure we pick up the audiotest.au that lives in email/test/data. -- # In Python, there's an audiotest.au living in Lib/test but that isn't -- # included in some binary distros that don't include the test -- # package. The trailing empty string on the .join() is significant -- # since findfile() will do a dirname(). -- datadir = os.path.join(os.path.dirname(landmark), 'data', '') -- with open(findfile('audiotest.au', datadir), 'rb') as fp: -- self._audiodata = fp.read() -- self._au = MIMEAudio(self._audiodata) -- -- def test_guess_minor_type(self): -- self.assertEqual(self._au.get_content_type(), 'audio/basic') -- -- def test_encoding(self): -- payload = self._au.get_payload() -- self.assertEqual(base64.decodebytes(payload), self._audiodata) -- -- def test_checkSetMinor(self): -- au = MIMEAudio(self._audiodata, 'fish') -- self.assertEqual(au.get_content_type(), 'audio/fish') -- -- def test_add_header(self): -- eq = self.assertEqual -- unless = self.assertTrue -- self._au.add_header('Content-Disposition', 'attachment', -- filename='audiotest.au') -- eq(self._au['content-disposition'], -- 'attachment; filename="audiotest.au"') -- eq(self._au.get_params(header='content-disposition'), -- [('attachment', ''), ('filename', 'audiotest.au')]) -- eq(self._au.get_param('filename', header='content-disposition'), -- 'audiotest.au') -- missing = [] -- eq(self._au.get_param('attachment', header='content-disposition'), '') -- unless(self._au.get_param('foo', failobj=missing, -- header='content-disposition') is missing) -- # Try some missing stuff -- unless(self._au.get_param('foobar', missing) is missing) -- unless(self._au.get_param('attachment', missing, -- header='foobar') is missing) -- -- -- - # Test the basic MIMEImage class - class TestMIMEImage(unittest.TestCase): - def setUp(self): diff --git a/python-3.1.1-systemtap.patch b/python-3.1.1-systemtap.patch deleted file mode 100644 index 49c06f8..0000000 --- a/python-3.1.1-systemtap.patch +++ /dev/null @@ -1,322 +0,0 @@ -diff -up Python-3.1.1/configure.in.systemtap Python-3.1.1/configure.in ---- Python-3.1.1/configure.in.systemtap 2010-02-12 15:24:34.959845279 -0500 -+++ Python-3.1.1/configure.in 2010-02-12 15:24:34.965845345 -0500 -@@ -2359,6 +2359,38 @@ then - fi - AC_MSG_RESULT($with_pymalloc) - -+# Check for dtrace support -+AC_MSG_CHECKING(for --with-dtrace) -+AC_ARG_WITH(dtrace, -+ AC_HELP_STRING(--with(out)-dtrace, disable/enable dtrace support)) -+ -+if test ! -z "$with_dtrace" -+then -+ if dtrace -G -o /dev/null -s $srcdir/Include/pydtrace.d 2>/dev/null -+ then -+ AC_DEFINE(WITH_DTRACE, 1, -+ [Define if you want to compile in Dtrace support]) -+ with_dtrace="Sun" -+ DTRACEOBJS="Python/dtrace.o" -+ DTRADEHDRS="" -+ elif dtrace -h -o /dev/null -s $srcdir/Include/pydtrace.d -+ then -+ AC_DEFINE(WITH_DTRACE, 1, -+ [Define if you want to compile in Dtrace support]) -+ with_dtrace="Apple" -+ DTRACEOBJS="" -+ DTRADEHDRS="pydtrace.h" -+ else -+ with_dtrace="no" -+ fi -+else -+ with_dtrace="no" -+fi -+ -+AC_MSG_RESULT($with_dtrace) -+AC_SUBST(DTRACEOBJS) -+AC_SUBST(DTRACEHDRS) -+ - # Check for --with-wctype-functions - AC_MSG_CHECKING(for --with-wctype-functions) - AC_ARG_WITH(wctype-functions, -diff -up Python-3.1.1/Include/pydtrace.d.systemtap Python-3.1.1/Include/pydtrace.d ---- Python-3.1.1/Include/pydtrace.d.systemtap 2010-02-12 15:24:34.966844913 -0500 -+++ Python-3.1.1/Include/pydtrace.d 2010-02-12 15:24:34.966844913 -0500 -@@ -0,0 +1,10 @@ -+provider python { -+ probe function__entry(const char *, const char *, int); -+ probe function__return(const char *, const char *, int); -+}; -+ -+#pragma D attributes Evolving/Evolving/Common provider python provider -+#pragma D attributes Private/Private/Common provider python module -+#pragma D attributes Private/Private/Common provider python function -+#pragma D attributes Evolving/Evolving/Common provider python name -+#pragma D attributes Evolving/Evolving/Common provider python args -diff -up Python-3.1.1/Makefile.pre.in.systemtap Python-3.1.1/Makefile.pre.in ---- Python-3.1.1/Makefile.pre.in.systemtap 2010-02-12 15:24:34.953845073 -0500 -+++ Python-3.1.1/Makefile.pre.in 2010-02-12 15:24:34.990844336 -0500 -@@ -312,6 +312,7 @@ PYTHON_OBJS= \ - Python/dtoa.o \ - Python/formatter_unicode.o \ - Python/$(DYNLOADFILE) \ -+ @DTRACEOBJS@ \ - $(LIBOBJS) \ - $(MACHDEP_OBJS) \ - $(THREADOBJ) -@@ -592,6 +593,18 @@ Python/formatter_unicode.o: $(srcdir)/Py - $(srcdir)/Objects/stringlib/formatter.h - - -+# Only needed with --with-dtrace -+buildinclude: -+ mkdir -p Include -+ -+Include/pydtrace.h: buildinclude $(srcdir)/Include/pydtrace.d -+ dtrace -o $@ $(DFLAGS) -C -h -s $(srcdir)/Include/pydtrace.d -+ -+Python/ceval.o: Include/pydtrace.h -+ -+Python/dtrace.o: buildinclude $(srcdir)/Include/pydtrace.d Python/ceval.o -+ dtrace -o $@ $(DFLAGS) -C -G -s $(srcdir)/Include/pydtrace.d Python/ceval.o -+ - ############################################################################ - # Header files - -@@ -1224,6 +1237,6 @@ Python/thread.o: @THREADHEADERS@ - .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure - .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools - .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean --.PHONY: smelly funny patchcheck -+.PHONY: smelly funny patchcheck buildinclude - - # IF YOU PUT ANYTHING HERE IT WILL GO AWAY -diff -up Python-3.1.1/pyconfig.h.in.systemtap Python-3.1.1/pyconfig.h.in ---- Python-3.1.1/pyconfig.h.in.systemtap 2009-05-29 13:25:39.000000000 -0400 -+++ Python-3.1.1/pyconfig.h.in 2010-02-12 15:24:34.991845511 -0500 -@@ -5,6 +5,9 @@ - #define Py_PYCONFIG_H - - -+/* Define if building universal (internal helper macro) */ -+#undef AC_APPLE_UNIVERSAL_BUILD -+ - /* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want - support for AIX C++ shared extension modules. */ - #undef AIX_GENUINE_CPLUSPLUS -@@ -995,6 +998,28 @@ - /* Define if you want to use computed gotos in ceval.c. */ - #undef USE_COMPUTED_GOTOS - -+/* Enable extensions on AIX 3, Interix. */ -+#ifndef _ALL_SOURCE -+# undef _ALL_SOURCE -+#endif -+/* Enable GNU extensions on systems that have them. */ -+#ifndef _GNU_SOURCE -+# undef _GNU_SOURCE -+#endif -+/* Enable threading extensions on Solaris. */ -+#ifndef _POSIX_PTHREAD_SEMANTICS -+# undef _POSIX_PTHREAD_SEMANTICS -+#endif -+/* Enable extensions on HP NonStop. */ -+#ifndef _TANDEM_SOURCE -+# undef _TANDEM_SOURCE -+#endif -+/* Enable general extensions on Solaris. */ -+#ifndef __EXTENSIONS__ -+# undef __EXTENSIONS__ -+#endif -+ -+ - /* Define if a va_list is an array of some kind */ - #undef VA_LIST_IS_ARRAY - -@@ -1011,6 +1036,9 @@ - /* Define if you want documentation strings in extension modules */ - #undef WITH_DOC_STRINGS - -+/* Define if you want to compile in Dtrace support */ -+#undef WITH_DTRACE -+ - /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic - linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). - Dyld is necessary to support frameworks. */ -@@ -1032,20 +1060,21 @@ - /* 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). */ --#undef WORDS_BIGENDIAN -+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most -+ significant byte first (like Motorola and SPARC, unlike Intel). */ -+#if defined AC_APPLE_UNIVERSAL_BUILD -+# if defined __BIG_ENDIAN__ -+# define WORDS_BIGENDIAN 1 -+# endif -+#else -+# ifndef WORDS_BIGENDIAN -+# undef WORDS_BIGENDIAN -+# endif -+#endif - - /* Define if arithmetic is subject to x87-style double rounding issue */ - #undef X87_DOUBLE_ROUNDING - --/* Define to 1 if on AIX 3. -- System headers sometimes define this. -- We just want to avoid a redefinition error message. */ --#ifndef _ALL_SOURCE --# undef _ALL_SOURCE --#endif -- - /* Define on OpenBSD to activate all library features */ - #undef _BSD_SOURCE - -@@ -1064,15 +1093,25 @@ - /* This must be defined on some systems to enable large file support. */ - #undef _LARGEFILE_SOURCE - -+/* Define to 1 if on MINIX. */ -+#undef _MINIX -+ - /* Define on NetBSD to activate all library features */ - #undef _NETBSD_SOURCE - - /* Define _OSF_SOURCE to get the makedev macro. */ - #undef _OSF_SOURCE - -+/* Define to 2 if the system does not provide POSIX.1 features except with -+ this defined. */ -+#undef _POSIX_1_SOURCE -+ - /* Define to activate features from IEEE Stds 1003.1-2001 */ - #undef _POSIX_C_SOURCE - -+/* Define to 1 if you need to in order for `stat' and other things to work. */ -+#undef _POSIX_SOURCE -+ - /* Define if you have POSIX threads, and your system does not define that. */ - #undef _POSIX_THREADS - -@@ -1080,12 +1119,12 @@ - #undef _REENTRANT - - /* Define for Solaris 2.5.1 so the uint32_t typedef from , -- , or is not used. If the typedef was allowed, the -+ , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ - #undef _UINT32_T - - /* Define for Solaris 2.5.1 so the uint64_t typedef from , -- , or is not used. If the typedef was allowed, the -+ , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ - #undef _UINT64_T - -diff -up Python-3.1.1/Python/ceval.c.systemtap Python-3.1.1/Python/ceval.c ---- Python-3.1.1/Python/ceval.c.systemtap 2009-05-30 17:41:10.000000000 -0400 -+++ Python-3.1.1/Python/ceval.c 2010-02-12 15:24:54.075844169 -0500 -@@ -19,6 +19,10 @@ - - #include - -+#ifdef WITH_DTRACE -+#include "pydtrace.h" -+#endif -+ - #ifndef WITH_TSC - - #define READ_TIMESTAMP(var) -@@ -655,6 +659,69 @@ PyEval_EvalCode(PyCodeObject *co, PyObje - NULL, NULL); - } - -+#ifdef WITH_DTRACE -+struct frame_marker_info -+{ -+ char *filename; -+ char *name; -+ int lineno; -+ -+ PyObject *utf8_filename; -+ PyObject *utf8_name; -+}; -+ -+static void -+get_frame_marker_info(PyFrameObject *f, struct frame_marker_info *fmi) -+{ -+ fmi->utf8_filename = PyUnicode_AsUTF8String(f->f_code->co_filename); -+ if (fmi->utf8_filename) { -+ fmi->filename = PyBytes_AsString(fmi->utf8_filename); -+ } else { -+ fmi->filename = NULL; -+ /* FIXME: clear the exception? */ -+ } -+ -+ fmi->utf8_name = PyUnicode_AsUTF8String(f->f_code->co_name); -+ if (fmi->utf8_name) { -+ fmi->name = PyBytes_AsString(fmi->utf8_name); -+ } else { -+ fmi->name = NULL; -+ /* FIXME: clear the exception? */ -+ } -+ -+ fmi->lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); -+} -+ -+static void -+release_frame_marker_info(struct frame_marker_info *fmi) -+{ -+ Py_XDECREF(fmi->utf8_filename); -+ Py_XDECREF(fmi->utf8_name); -+} -+ -+static void -+dtrace_entry(PyFrameObject *f) -+{ -+ struct frame_marker_info fmi; -+ get_frame_marker_info(f, &fmi); -+ PYTHON_FUNCTION_ENTRY(fmi.filename, fmi.name, fmi.lineno); -+ release_frame_marker_info(&fmi); -+} -+ -+static void -+dtrace_return(PyFrameObject *f) -+{ -+ struct frame_marker_info fmi; -+ get_frame_marker_info(f, &fmi); -+ PYTHON_FUNCTION_RETURN(fmi.filename, fmi.name, fmi.lineno); -+ release_frame_marker_info(&fmi); -+} -+#else -+#define PYTHON_FUNCTION_ENTRY_ENABLED() 0 -+#define PYTHON_FUNCTION_RETURN_ENABLED() 0 -+#define dtrace_entry(f) -+#define dtrace_return(f) -+#endif - - /* Interpreter main loop */ - -@@ -1061,6 +1128,9 @@ PyEval_EvalFrameEx(PyFrameObject *f, int - } - } - -+ if (PYTHON_FUNCTION_ENTRY_ENABLED()) -+ dtrace_entry(f); -+ - co = f->f_code; - names = co->co_names; - consts = co->co_consts; -@@ -2907,6 +2977,8 @@ fast_yield: - - /* pop frame */ - exit_eval_frame: -+ if (PYTHON_FUNCTION_RETURN_ENABLED()) -+ dtrace_return(f); - Py_LeaveRecursiveCall(); - tstate->frame = f->f_back; - diff --git a/python-3.1.1-with-system-expat.patch b/python-3.1.1-with-system-expat.patch deleted file mode 100644 index 1c99bf9..0000000 --- a/python-3.1.1-with-system-expat.patch +++ /dev/null @@ -1,67 +0,0 @@ -diff -up Python-3.1.1/configure.in.expat Python-3.1.1/configure.in ---- Python-3.1.1/configure.in.expat 2010-01-25 23:02:05.488859572 -0500 -+++ Python-3.1.1/configure.in 2010-01-25 23:02:21.425857866 -0500 -@@ -1853,6 +1853,13 @@ LIBS="$withval $LIBS" - ], - [AC_MSG_RESULT(no)]) - -+# Check for use of the system expat library -+AC_MSG_CHECKING(for --with-system-expat) -+AC_ARG_WITH(system_expat, -+ AC_HELP_STRING(--with-system-expat, build pyexpat module using an installed expat library)) -+ -+AC_MSG_RESULT($with_system_expat) -+ - # Check for use of the system libffi library - AC_MSG_CHECKING(for --with-system-ffi) - AC_ARG_WITH(system_ffi, -diff -up Python-3.1.1/setup.py.expat Python-3.1.1/setup.py ---- Python-3.1.1/setup.py.expat 2010-01-25 23:02:11.254859198 -0500 -+++ Python-3.1.1/setup.py 2010-01-25 23:02:21.426857993 -0500 -@@ -1110,19 +1110,26 @@ class PyBuildExt(build_ext): - # - # More information on Expat can be found at www.libexpat.org. - # -- expatinc = os.path.join(os.getcwd(), srcdir, 'Modules', 'expat') -- define_macros = [ -- ('HAVE_EXPAT_CONFIG_H', '1'), -- ] -+ if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"): -+ expat_inc = [] -+ define_macros = [] -+ expat_lib = ['expat'] -+ expat_sources = [] -+ else: -+ expat_inc = [os.path.join(os.getcwd(), srcdir, 'Modules', 'expat')] -+ define_macros = [ -+ ('HAVE_EXPAT_CONFIG_H', '1'), -+ ] -+ expat_lib = [] -+ expat_sources = ['expat/xmlparse.c', -+ 'expat/xmlrole.c', -+ 'expat/xmltok.c'] - - exts.append(Extension('pyexpat', - define_macros = define_macros, -- include_dirs = [expatinc], -- sources = ['pyexpat.c', -- 'expat/xmlparse.c', -- 'expat/xmlrole.c', -- 'expat/xmltok.c', -- ], -+ include_dirs = expat_inc, -+ libraries = expat_lib, -+ sources = ['pyexpat.c'] + expat_sources - )) - - # Fredrik Lundh's cElementTree module. Note that this also -@@ -1132,7 +1139,8 @@ class PyBuildExt(build_ext): - define_macros.append(('USE_PYEXPAT_CAPI', None)) - exts.append(Extension('_elementtree', - define_macros = define_macros, -- include_dirs = [expatinc], -+ include_dirs = expat_inc, -+ libraries = expat_lib, - sources = ['_elementtree.c'], - )) - else: diff --git a/python-3.1.2-CVE-2008-5983.patch b/python-3.1.2-CVE-2008-5983.patch deleted file mode 100644 index f33cebb..0000000 --- a/python-3.1.2-CVE-2008-5983.patch +++ /dev/null @@ -1,120 +0,0 @@ -diff -up Python-3.1.2/Doc/c-api/init.rst.CVE-2008-5983 Python-3.1.2/Doc/c-api/init.rst ---- Python-3.1.2/Doc/c-api/init.rst.CVE-2008-5983 2010-01-09 13:48:46.000000000 -0500 -+++ Python-3.1.2/Doc/c-api/init.rst 2010-06-04 15:19:26.724089244 -0400 -@@ -22,6 +22,7 @@ Initialization, Finalization, and Thread - module: sys - triple: module; search; path - single: PySys_SetArgv() -+ single: PySys_SetArgvEx() - single: Py_Finalize() - - Initialize the Python interpreter. In an application embedding Python, this -@@ -31,7 +32,7 @@ Initialization, Finalization, and Thread - the table of loaded modules (``sys.modules``), and creates the fundamental - modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It also initializes - the module search path (``sys.path``). It does not set ``sys.argv``; use -- :cfunc:`PySys_SetArgv` for that. This is a no-op when called for a second time -+ :cfunc:`PySys_SetArgvEx` for that. This is a no-op when called for a second time - (without calling :cfunc:`Py_Finalize` first). There is no return value; it is a - fatal error if the initialization fails. - -@@ -344,7 +345,7 @@ Initialization, Finalization, and Thread - ``sys.version``. - - --.. cfunction:: void PySys_SetArgv(int argc, wchar_t **argv) -+.. cfunction:: void PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath) - - .. index:: - single: main() -@@ -359,14 +360,41 @@ Initialization, Finalization, and Thread - string. If this function fails to initialize :data:`sys.argv`, a fatal - condition is signalled using :cfunc:`Py_FatalError`. - -- This function also prepends the executed script's path to :data:`sys.path`. -- If no script is executed (in the case of calling ``python -c`` or just the -- interactive interpreter), the empty string is used instead. -+ If *updatepath* is zero, this is all the function does. If *updatepath* -+ is non-zero, the function also modifies :data:`sys.path` according to the -+ following algorithm: -+ -+ - If the name of an existing script is passed in ``argv[0]``, the absolute -+ path of the directory where the script is located is prepended to -+ :data:`sys.path`. -+ - Otherwise (that is, if *argc* is 0 or ``argv[0]`` doesn't point -+ to an existing file name), an empty string is prepended to -+ :data:`sys.path`, which is the same as prepending the current working -+ directory (``"."``). -+ -+ .. note:: -+ It is recommended that applications embedding the Python interpreter -+ for purposes other than executing a single script pass 0 as *updatepath*, -+ and update :data:`sys.path` themselves if desired. -+ See `CVE-2008-5983 `_. -+ -+ On versions before 3.1.3, you can achieve the same effect by manually -+ popping the first :data:`sys.path` element after having called -+ :cfunc:`PySys_SetArgv`, for example using:: -+ -+ PyRun_SimpleString("import sys; sys.path.pop(0)\n"); -+ -+ .. versionadded:: 3.1.3 - - .. XXX impl. doesn't seem consistent in allowing 0/NULL for the params; - check w/ Guido. - - -+.. cfunction:: void PySys_SetArgv(int argc, wchar_t **argv) -+ -+ This function works like :cfunc:`PySys_SetArgv` with *updatepath* set to 1. -+ -+ - .. cfunction:: void Py_SetPythonHome(wchar_t *home) - - Set the default "home" directory, that is, the location of the standard -diff -up Python-3.1.2/Include/sysmodule.h.CVE-2008-5983 Python-3.1.2/Include/sysmodule.h ---- Python-3.1.2/Include/sysmodule.h.CVE-2008-5983 2008-04-13 09:53:33.000000000 -0400 -+++ Python-3.1.2/Include/sysmodule.h 2010-06-04 15:19:26.721088968 -0400 -@@ -10,6 +10,7 @@ extern "C" { - PyAPI_FUNC(PyObject *) PySys_GetObject(const char *); - PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *); - PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **); -+PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int); - PyAPI_FUNC(void) PySys_SetPath(const wchar_t *); - - PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) -diff -up Python-3.1.2/Misc/NEWS.CVE-2008-5983 Python-3.1.2/Misc/NEWS -diff -up Python-3.1.2/Python/sysmodule.c.CVE-2008-5983 Python-3.1.2/Python/sysmodule.c ---- Python-3.1.2/Python/sysmodule.c.CVE-2008-5983 2010-06-04 15:19:26.000000000 -0400 -+++ Python-3.1.2/Python/sysmodule.c 2010-06-04 15:20:59.932964188 -0400 -@@ -1561,7 +1561,7 @@ _wrealpath(const wchar_t *path, wchar_t - #endif - - void --PySys_SetArgv(int argc, wchar_t **argv) -+PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath) - { - #if defined(HAVE_REALPATH) - wchar_t fullpath[MAXPATHLEN]; -@@ -1574,7 +1574,7 @@ PySys_SetArgv(int argc, wchar_t **argv) - Py_FatalError("no mem for sys.argv"); - if (PySys_SetObject("argv", av) != 0) - Py_FatalError("can't assign sys.argv"); -- if (path != NULL) { -+ if (updatepath && path != NULL) { - wchar_t *argv0 = argv[0]; - wchar_t *p = NULL; - Py_ssize_t n = 0; -@@ -1661,6 +1661,12 @@ PySys_SetArgv(int argc, wchar_t **argv) - Py_DECREF(av); - } - -+void -+PySys_SetArgv(int argc, wchar_t **argv) -+{ -+ PySys_SetArgvEx(argc, argv, 1); -+} -+ - - /* APIs to write to sys.stdout or sys.stderr using a printf-like interface. - Adapted from code submitted by Just van Rossum. diff --git a/python-3.1.2-CVE-2010-1634.patch b/python-3.1.2-CVE-2010-1634.patch deleted file mode 100644 index f3de6ea..0000000 --- a/python-3.1.2-CVE-2010-1634.patch +++ /dev/null @@ -1,209 +0,0 @@ ---- python/branches/py3k/Modules/audioop.c 2010/05/09 15:52:27 81032 -+++ python/branches/py3k/Modules/audioop.c 2010/05/11 13:09:58 81081 -@@ -834,7 +834,7 @@ - audioop_tostereo(PyObject *self, PyObject *args) - { - signed char *cp, *ncp; -- int len, new_len, size, val1, val2, val = 0; -+ int len, size, val1, val2, val = 0; - double fac1, fac2, fval, maxval; - PyObject *rv; - int i; -@@ -851,14 +851,13 @@ - return 0; - } - -- new_len = len*2; -- if (new_len < 0) { -+ if (len > INT_MAX/2) { - PyErr_SetString(PyExc_MemoryError, - "not enough memory for output buffer"); - return 0; - } - -- rv = PyBytes_FromStringAndSize(NULL, new_len); -+ rv = PyBytes_FromStringAndSize(NULL, len*2); - if ( rv == 0 ) - return 0; - ncp = (signed char *)PyBytes_AsString(rv); -@@ -1021,7 +1020,7 @@ - { - signed char *cp; - unsigned char *ncp; -- int len, new_len, size, size2, val = 0; -+ int len, size, size2, val = 0; - PyObject *rv; - int i, j; - -@@ -1035,13 +1034,12 @@ - return 0; - } - -- new_len = (len/size)*size2; -- if (new_len < 0) { -+ if (len/size > INT_MAX/size2) { - PyErr_SetString(PyExc_MemoryError, - "not enough memory for output buffer"); - return 0; - } -- rv = PyBytes_FromStringAndSize(NULL, new_len); -+ rv = PyBytes_FromStringAndSize(NULL, (len/size)*size2); - if ( rv == 0 ) - return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); -@@ -1077,7 +1075,6 @@ - int chan, d, *prev_i, *cur_i, cur_o; - PyObject *state, *samps, *str, *rv = NULL; - int bytes_per_frame; -- size_t alloc_size; - - weightA = 1; - weightB = 0; -@@ -1120,14 +1117,13 @@ - inrate /= d; - outrate /= d; - -- alloc_size = sizeof(int) * (unsigned)nchannels; -- if (alloc_size < (unsigned)nchannels) { -+ if ((size_t)nchannels > PY_SIZE_MAX/sizeof(int)) { - PyErr_SetString(PyExc_MemoryError, - "not enough memory for output buffer"); - return 0; - } -- prev_i = (int *) malloc(alloc_size); -- cur_i = (int *) malloc(alloc_size); -+ prev_i = (int *) malloc(nchannels * sizeof(int)); -+ cur_i = (int *) malloc(nchannels * sizeof(int)); - if (prev_i == NULL || cur_i == NULL) { - (void) PyErr_NoMemory(); - goto exit; -@@ -1164,25 +1160,16 @@ - ceiling(len*outrate/inrate) output frames, and each frame - requires bytes_per_frame bytes. Computing this - without spurious overflow is the challenge; we can -- settle for a reasonable upper bound, though. */ -- int ceiling; /* the number of output frames */ -- int nbytes; /* the number of output bytes needed */ -- int q = len / inrate; -- /* Now len = q * inrate + r exactly (with r = len % inrate), -- and this is less than q * inrate + inrate = (q+1)*inrate. -- So a reasonable upper bound on len*outrate/inrate is -- ((q+1)*inrate)*outrate/inrate = -- (q+1)*outrate. -- */ -- ceiling = (q+1) * outrate; -- nbytes = ceiling * bytes_per_frame; -- /* See whether anything overflowed; if not, get the space. */ -- if (q+1 < 0 || -- ceiling / outrate != q+1 || -- nbytes / bytes_per_frame != ceiling) -+ settle for a reasonable upper bound, though, in this -+ case ceiling(len/inrate) * outrate. */ -+ -+ /* compute ceiling(len/inrate) without overflow */ -+ int q = len > 0 ? 1 + (len - 1) / inrate : 0; -+ if (outrate > INT_MAX / q / bytes_per_frame) - str = NULL; - else -- str = PyBytes_FromStringAndSize(NULL, nbytes); -+ str = PyBytes_FromStringAndSize(NULL, -+ q * outrate * bytes_per_frame); - - if (str == NULL) { - PyErr_SetString(PyExc_MemoryError, -@@ -1300,7 +1287,7 @@ - unsigned char *cp; - unsigned char cval; - signed char *ncp; -- int len, new_len, size, val; -+ int len, size, val; - PyObject *rv; - int i; - -@@ -1313,18 +1300,17 @@ - return 0; - } - -- new_len = len*size; -- if (new_len < 0) { -+ if (len > INT_MAX/size) { - PyErr_SetString(PyExc_MemoryError, - "not enough memory for output buffer"); - return 0; - } -- rv = PyBytes_FromStringAndSize(NULL, new_len); -+ rv = PyBytes_FromStringAndSize(NULL, len*size); - if ( rv == 0 ) - return 0; - ncp = (signed char *)PyBytes_AsString(rv); - -- for ( i=0; i < new_len; i += size ) { -+ for ( i=0; i < len*size; i += size ) { - cval = *cp++; - val = st_ulaw2linear16(cval); - -@@ -1374,7 +1360,7 @@ - unsigned char *cp; - unsigned char cval; - signed char *ncp; -- int len, new_len, size, val; -+ int len, size, val; - PyObject *rv; - int i; - -@@ -1387,18 +1373,17 @@ - return 0; - } - -- new_len = len*size; -- if (new_len < 0) { -+ if (len > INT_MAX/size) { - PyErr_SetString(PyExc_MemoryError, - "not enough memory for output buffer"); - return 0; - } -- rv = PyBytes_FromStringAndSize(NULL, new_len); -+ rv = PyBytes_FromStringAndSize(NULL, len*size); - if ( rv == 0 ) - return 0; - ncp = (signed char *)PyBytes_AsString(rv); - -- for ( i=0; i < new_len; i += size ) { -+ for ( i=0; i < len*size; i += size ) { - cval = *cp++; - val = st_alaw2linear16(cval); - -@@ -1523,7 +1508,7 @@ - { - signed char *cp; - signed char *ncp; -- int len, new_len, size, valpred, step, delta, index, sign, vpdiff; -+ int len, size, valpred, step, delta, index, sign, vpdiff; - PyObject *rv, *str, *state; - int i, inputbuffer = 0, bufferstep; - -@@ -1545,13 +1530,12 @@ - } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) - return 0; - -- new_len = len*size*2; -- if (new_len < 0) { -+ if (len > (INT_MAX/2)/size) { - PyErr_SetString(PyExc_MemoryError, - "not enough memory for output buffer"); - return 0; - } -- str = PyBytes_FromStringAndSize(NULL, new_len); -+ str = PyBytes_FromStringAndSize(NULL, len*size*2); - if ( str == 0 ) - return 0; - ncp = (signed char *)PyBytes_AsString(str); -@@ -1559,7 +1543,7 @@ - step = stepsizeTable[index]; - bufferstep = 0; - -- for ( i=0; i < new_len; i += size ) { -+ for ( i=0; i < len*size*2; i += size ) { - /* Step 1 - get the delta value and compute next index */ - if ( bufferstep ) { - delta = inputbuffer & 0xf; diff --git a/python-3.1.2-CVE-2010-2089.patch b/python-3.1.2-CVE-2010-2089.patch deleted file mode 100644 index f0098c4..0000000 --- a/python-3.1.2-CVE-2010-2089.patch +++ /dev/null @@ -1,313 +0,0 @@ -diff -up Python-3.1.2/Modules/audioop.c.CVE-2010-2089 Python-3.1.2/Modules/audioop.c ---- Python-3.1.2/Modules/audioop.c.CVE-2010-2089 2010-06-04 14:55:04.281964205 -0400 -+++ Python-3.1.2/Modules/audioop.c 2010-06-04 15:04:32.896088959 -0400 -@@ -295,6 +295,29 @@ static int stepsizeTable[89] = { - - static PyObject *AudioopError; - -+static int -+audioop_check_size(int size) -+{ -+ if ( size != 1 && size != 2 && size != 4 ) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } else { -+ return 1; -+ } -+} -+ -+static int -+audioop_check_parameters(int len, int size) -+{ -+ if (!audioop_check_size(size)) -+ return 0; -+ if ( len % size != 0 ) { -+ PyErr_SetString(AudioopError, "not a whole number of frames"); -+ return 0; -+ } -+ return 1; -+} -+ - static PyObject * - audioop_getsample(PyObject *self, PyObject *args) - { -@@ -304,10 +327,8 @@ audioop_getsample(PyObject *self, PyObje - - if ( !PyArg_ParseTuple(args, "s#ii:getsample", &cp, &len, &size, &i) ) - return 0; -- if ( size != 1 && size != 2 && size != 4 ) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -+ if (!audioop_check_parameters(len, size)) -+ return NULL; - if ( i < 0 || i >= len/size ) { - PyErr_SetString(AudioopError, "Index out of range"); - return 0; -@@ -328,10 +349,8 @@ audioop_max(PyObject *self, PyObject *ar - - if ( !PyArg_ParseTuple(args, "s#i:max", &cp, &len, &size) ) - return 0; -- if ( size != 1 && size != 2 && size != 4 ) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -+ if (!audioop_check_parameters(len, size)) -+ return NULL; - for ( i=0; i 0,1 */ - for ( i=0; i INT_MAX/size2) { - PyErr_SetString(PyExc_MemoryError, -@@ -1082,10 +1101,8 @@ audioop_ratecv(PyObject *self, PyObject - &nchannels, &inrate, &outrate, &state, - &weightA, &weightB)) - return NULL; -- if (size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ if (!audioop_check_size(size)) - return NULL; -- } - if (nchannels < 1) { - PyErr_SetString(AudioopError, "# of channels should be >= 1"); - return NULL; -@@ -1261,10 +1278,8 @@ audioop_lin2ulaw(PyObject *self, PyObjec - &cp, &len, &size) ) - return 0 ; - -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -+ if (!audioop_check_parameters(len, size)) -+ return NULL; - - rv = PyBytes_FromStringAndSize(NULL, len/size); - if ( rv == 0 ) -@@ -1295,10 +1310,8 @@ audioop_ulaw2lin(PyObject *self, PyObjec - &cp, &len, &size) ) - return 0; - -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -+ if (!audioop_check_size(size)) -+ return NULL; - - if (len > INT_MAX/size) { - PyErr_SetString(PyExc_MemoryError, -@@ -1334,10 +1347,8 @@ audioop_lin2alaw(PyObject *self, PyObjec - &cp, &len, &size) ) - return 0; - -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -+ if (!audioop_check_parameters(len, size)) -+ return NULL; - - rv = PyBytes_FromStringAndSize(NULL, len/size); - if ( rv == 0 ) -@@ -1368,10 +1379,8 @@ audioop_alaw2lin(PyObject *self, PyObjec - &cp, &len, &size) ) - return 0; - -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -+ if (!audioop_check_size(size)) -+ return NULL; - - if (len > INT_MAX/size) { - PyErr_SetString(PyExc_MemoryError, -@@ -1409,10 +1418,8 @@ audioop_lin2adpcm(PyObject *self, PyObje - return 0; - - -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -+ if (!audioop_check_parameters(len, size)) -+ return NULL; - - str = PyBytes_FromStringAndSize(NULL, len/(size*2)); - if ( str == 0 ) -@@ -1516,10 +1523,8 @@ audioop_adpcm2lin(PyObject *self, PyObje - &cp, &len, &size, &state) ) - return 0; - -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -+ if (!audioop_check_size(size)) -+ return NULL; - - /* Decode state, should have (value, step) */ - if ( state == Py_None ) { diff --git a/python-3.1.2-debug-build.patch b/python-3.1.2-debug-build.patch deleted file mode 100644 index 2a71afe..0000000 --- a/python-3.1.2-debug-build.patch +++ /dev/null @@ -1,275 +0,0 @@ -diff -up Python-3.1.2/configure.in.debug-build Python-3.1.2/configure.in ---- Python-3.1.2/configure.in.debug-build 2010-05-20 22:48:14.573026391 -0400 -+++ Python-3.1.2/configure.in 2010-05-20 22:48:14.580902316 -0400 -@@ -569,7 +569,7 @@ AC_SUBST(LIBRARY) - AC_MSG_CHECKING(LIBRARY) - if test -z "$LIBRARY" - then -- LIBRARY='libpython$(VERSION).a' -+ LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a' - fi - AC_MSG_RESULT($LIBRARY) - -@@ -711,8 +711,8 @@ if test $enable_shared = "yes"; then - INSTSONAME="$LDLIBRARY".$SOVERSION - ;; - Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) -- LDLIBRARY='libpython$(VERSION).so' -- BLDLIBRARY='-L. -lpython$(VERSION)' -+ LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so' -+ BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)' - RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} - case $ac_sys_system in - FreeBSD*) -@@ -816,6 +816,14 @@ else AC_MSG_RESULT(no); Py_DEBUG='false' - fi], - [AC_MSG_RESULT(no)]) - -+if test "$Py_DEBUG" = 'true' -+then -+ DEBUG_EXT=_d -+ DEBUG_SUFFIX=-debug -+fi -+AC_SUBST(DEBUG_EXT) -+AC_SUBST(DEBUG_SUFFIX) -+ - # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be - # merged with this chunk of code? - -diff -up Python-3.1.2/Lib/distutils/command/build_ext.py.debug-build Python-3.1.2/Lib/distutils/command/build_ext.py ---- Python-3.1.2/Lib/distutils/command/build_ext.py.debug-build 2010-03-19 17:56:34.000000000 -0400 -+++ Python-3.1.2/Lib/distutils/command/build_ext.py 2010-05-20 22:48:14.581902928 -0400 -@@ -673,7 +673,10 @@ class build_ext(Command): - so_ext = get_config_var('SO') - if os.name == 'nt' and self.debug: - return os.path.join(*ext_path) + '_d' + so_ext -- return os.path.join(*ext_path) + so_ext -+ -+ # Similarly, extensions in debug mode are named 'module_d.so', to -+ # avoid adding the _d to the SO config variable: -+ return os.path.join(*ext_path) + (sys.pydebug and "_d" or "") + so_ext - - def get_export_symbols(self, ext): - """Return the list of symbols that a shared extension has to -@@ -754,6 +757,8 @@ class build_ext(Command): - template = "python%d.%d" - pythonlib = (template % - (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) -+ if sys.pydebug: -+ pythonlib += '_d' - return ext.libraries + [pythonlib] - else: - return ext.libraries -diff -up Python-3.1.2/Lib/distutils/sysconfig.py.debug-build Python-3.1.2/Lib/distutils/sysconfig.py ---- Python-3.1.2/Lib/distutils/sysconfig.py.debug-build 2010-05-20 22:48:14.577026372 -0400 -+++ Python-3.1.2/Lib/distutils/sysconfig.py 2010-05-20 22:48:14.581902928 -0400 -@@ -83,7 +83,8 @@ def get_python_inc(plat_specific=0, pref - else: - incdir = os.path.join(get_config_var('srcdir'), 'Include') - return os.path.normpath(incdir) -- return os.path.join(prefix, "include", "python" + get_python_version()) -+ return os.path.join(prefix, "include", -+ "python" + get_python_version() + (sys.pydebug and '-debug' or '')) - elif os.name == "nt": - return os.path.join(prefix, "include") - elif os.name == "mac": -@@ -229,7 +230,7 @@ def get_makefile_filename(): - if python_build: - return os.path.join(os.path.dirname(sys.executable), "Makefile") - lib_dir = get_python_lib(plat_specific=1, standard_lib=1) -- return os.path.join(lib_dir, "config", "Makefile") -+ return os.path.join(lib_dir, "config" + (sys.pydebug and "-debug" or ""), "Makefile") - - - def parse_config_h(fp, g=None): -diff -up Python-3.1.2/Makefile.pre.in.debug-build Python-3.1.2/Makefile.pre.in ---- Python-3.1.2/Makefile.pre.in.debug-build 2010-05-20 22:48:14.577901061 -0400 -+++ Python-3.1.2/Makefile.pre.in 2010-05-20 22:48:14.581902928 -0400 -@@ -99,8 +99,8 @@ SCRIPTDIR= $(prefix)/lib64 - # Detailed destination directories - BINLIBDEST= $(LIBDIR)/python$(VERSION) - LIBDEST= $(SCRIPTDIR)/python$(VERSION) --INCLUDEPY= $(INCLUDEDIR)/python$(VERSION) --CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION) -+INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX) -+CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX) - LIBP= $(LIBDIR)/python$(VERSION) - - # Symbols used for using shared libraries -@@ -113,6 +113,12 @@ DESTSHARED= $(BINLIBDEST)/lib-dynload - EXE= @EXEEXT@ - BUILDEXE= @BUILDEXEEXT@ - -+# DEBUG_EXT is used by ELF files (names and SONAMEs); it will be "_d" for a debug build -+# DEBUG_SUFFIX is used by filesystem paths; it will be "-debug" for a debug build -+# Both will be empty in an optimized build -+DEBUG_EXT= @DEBUG_EXT@ -+DEBUG_SUFFIX= @DEBUG_SUFFIX@ -+ - # Short name and location for Mac OS X Python framework - UNIVERSALSDK=@UNIVERSALSDK@ - PYTHONFRAMEWORK= @PYTHONFRAMEWORK@ -@@ -176,7 +182,7 @@ LIBOBJDIR= Python/ - LIBOBJS= @LIBOBJS@ - - PYTHON= python$(EXE) --BUILDPYTHON= python$(BUILDEXE) -+BUILDPYTHON= python$(BUILD_SUFFIX)$(BUILDEXE) - - # The task to run while instrument when building the profile-opt target - PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck -@@ -422,7 +428,7 @@ sharedmods: $(BUILDPYTHON) - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ - esac - --libpython$(VERSION).so: $(LIBRARY_OBJS) -+libpython$(VERSION)$(DEBUG_EXT).so: $(LIBRARY_OBJS) - if test $(INSTSONAME) != $(LDLIBRARY); then \ - $(LDSHARED) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ - $(LN) -f $(INSTSONAME) $@; \ -@@ -793,7 +799,7 @@ altbininstall: $(BUILDPYTHON) - else true; \ - fi; \ - done -- $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) -+ $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)$(EXE) - if test -f $(LDLIBRARY); then \ - if test -n "$(DLLLIBRARY)" ; then \ - $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \ -@@ -807,15 +813,15 @@ altbininstall: $(BUILDPYTHON) - fi - - bininstall: altbininstall -- -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE); \ -- then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE); \ -+ -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(DEBUG_SUFFIX)$(EXE) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON)3$(DEBUG_SUFFIX)$(EXE); \ -+ then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(DEBUG_SUFFIX)$(EXE); \ - else true; \ - fi -- (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)3$(EXE)) -- -rm -f $(DESTDIR)$(BINDIR)/python3-config -- (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config) -- -rm -f $(DESTDIR)$(LIBPC)/python3.pc -- (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc) -+ (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(DEBUG_SUFFIX)$(EXE) $(PYTHON)3$(DEBUG_SUFFIX)$(EXE)) -+ -rm -f $(DESTDIR)$(BINDIR)/python3$(DEBUG_SUFFIX)-config -+ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(DEBUG_SUFFIX)-config python3$(DEBUG_SUFFIX)-config) -+ -rm -f $(DESTDIR)$(LIBPC)/python3$(DEBUG_SUFFIX).pc -+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)$(DEBUG_SUFFIX).pc python3$(DEBUG_SUFFIX).pc) - - # Install the manual page - maninstall: -@@ -960,7 +966,7 @@ inclinstall: - - # Install the library and miscellaneous stuff needed for extending/embedding - # This goes into $(exec_prefix) --LIBPL= $(LIBP)/config -+LIBPL= $(LIBP)/config$(DEBUG_SUFFIX) - - # pkgconfig directory - LIBPC= $(LIBDIR)/pkgconfig -@@ -981,14 +987,14 @@ libainstall: all - $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup - $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local - $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config -- $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc -+ $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION)$(DEBUG_SUFFIX).pc - $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup - $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh - # Substitution happens here, as the completely-expanded BINDIR - # is not available in configure -- sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config -- $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config -- rm python-config -+ sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)$(EXE)," < $(srcdir)/Misc/python-config.in >python$(DEBUG_SUFFIX)-config -+ $(INSTALL_SCRIPT) python$(DEBUG_SUFFIX)-config $(DESTDIR)$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)-config -+ rm python$(DEBUG_SUFFIX)-config - @if [ -s Modules/python.exp -a \ - "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ - echo; echo "Installing support files for building shared extension modules on AIX:"; \ -diff -up Python-3.1.2/Misc/python-config.in.debug-build Python-3.1.2/Misc/python-config.in ---- Python-3.1.2/Misc/python-config.in.debug-build 2007-09-01 03:27:37.000000000 -0400 -+++ Python-3.1.2/Misc/python-config.in 2010-05-20 22:48:14.582902254 -0400 -@@ -44,7 +44,7 @@ elif opt in ('--includes', '--cflags'): - - elif opt in ('--libs', '--ldflags'): - libs = getvar('LIBS').split() + getvar('SYSLIBS').split() -- libs.append('-lpython'+pyver) -+ libs.append('-lpython' + pyver + (sys.pydebug and "_d" or "")) - # add the prefix/lib/pythonX.Y/config dir, but only if there is no - # shared library in prefix/lib/. - if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'): -diff -up Python-3.1.2/Modules/makesetup.debug-build Python-3.1.2/Modules/makesetup ---- Python-3.1.2/Modules/makesetup.debug-build 2008-06-11 01:26:20.000000000 -0400 -+++ Python-3.1.2/Modules/makesetup 2010-05-20 22:48:14.582902254 -0400 -@@ -233,7 +233,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | - *$mod.o*) base=$mod;; - *) base=${mod}module;; - esac -- file="$srcdir/$base\$(SO)" -+ file="$srcdir/$base\$(DEBUG_EXT)\$(SO)" - case $doconfig in - no) SHAREDMODS="$SHAREDMODS $file";; - esac -diff -up Python-3.1.2/Python/dynload_shlib.c.debug-build Python-3.1.2/Python/dynload_shlib.c ---- Python-3.1.2/Python/dynload_shlib.c.debug-build 2008-06-11 01:26:20.000000000 -0400 -+++ Python-3.1.2/Python/dynload_shlib.c 2010-05-20 22:48:14.582902254 -0400 -@@ -46,11 +46,16 @@ const struct filedescr _PyImport_DynLoad - {"module.exe", "rb", C_EXTENSION}, - {"MODULE.EXE", "rb", C_EXTENSION}, - #else -+#ifdef Py_DEBUG -+ {"_d.so", "rb", C_EXTENSION}, -+ {"module_d.so", "rb", C_EXTENSION}, -+#else - {".so", "rb", C_EXTENSION}, - {"module.so", "rb", C_EXTENSION}, --#endif --#endif --#endif -+#endif /* Py_DEBUG */ -+#endif /* __VMS */ -+#endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */ -+#endif /* __CYGWIN__ */ - {0, 0} - }; - -diff -up Python-3.1.2/Python/sysmodule.c.debug-build Python-3.1.2/Python/sysmodule.c ---- Python-3.1.2/Python/sysmodule.c.debug-build 2010-03-03 06:55:53.000000000 -0500 -+++ Python-3.1.2/Python/sysmodule.c 2010-05-20 22:48:14.582902254 -0400 -@@ -1429,6 +1429,12 @@ _PySys_Init(void) - FlagsType.tp_init = NULL; - FlagsType.tp_new = NULL; - -+#ifdef Py_DEBUG -+ PyDict_SetItemString(sysdict, "pydebug", Py_True); -+#else -+ PyDict_SetItemString(sysdict, "pydebug", Py_False); -+#endif -+ - /* float repr style: 0.03 (short) vs 0.029999999999999999 (legacy) */ - #ifndef PY_NO_SHORT_FLOAT_REPR - SET_SYS_FROM_STRING("float_repr_style", -diff -up Python-3.1.2/runtests.sh.debug-build Python-3.1.2/runtests.sh ---- Python-3.1.2/runtests.sh.debug-build 2010-05-22 00:42:41.950889054 -0400 -+++ Python-3.1.2/runtests.sh 2010-05-22 00:54:47.503851503 -0400 -@@ -16,11 +16,14 @@ Flags (arguments starting with '-') are - regrtest.py, except for -x, which is processed here." - - # Choose the Python binary. --case `uname` in --Darwin) PYTHON=./python.exe;; --CYGWIN*) PYTHON=./python.exe;; --*) PYTHON=./python;; --esac -+if [ -z $PYTHON ] -+then -+ case `uname` in -+ Darwin) PYTHON=./python.exe;; -+ CYGWIN*) PYTHON=./python.exe;; -+ *) PYTHON=./python;; -+ esac -+fi - - PYTHON="$PYTHON -bb" - diff --git a/python-3.1.2-reformat-audioop.c.patch b/python-3.1.2-reformat-audioop.c.patch deleted file mode 100644 index 8592650..0000000 --- a/python-3.1.2-reformat-audioop.c.patch +++ /dev/null @@ -1,2727 +0,0 @@ ---- python/branches/py3k/Modules/audioop.c 2009/05/16 01:46:11 72674 -+++ python/branches/py3k/Modules/audioop.c 2010/05/09 15:52:27 81032 -@@ -53,13 +53,13 @@ - static PyInt16 - search(PyInt16 val, PyInt16 *table, int size) - { -- int i; -+ int i; - -- for (i = 0; i < size; i++) { -- if (val <= *table++) -- return (i); -- } -- return (size); -+ for (i = 0; i < size; i++) { -+ if (val <= *table++) -+ return (i); -+ } -+ return (size); - } - #define st_ulaw2linear16(uc) (_st_ulaw2linear16[uc]) - #define st_alaw2linear16(uc) (_st_alaw2linear16[uc]) -@@ -83,7 +83,7 @@ - -228, -212, -196, -180, -164, -148, -132, - -120, -112, -104, -96, -88, -80, -72, - -64, -56, -48, -40, -32, -24, -16, -- -8, 0, 32124, 31100, 30076, 29052, 28028, -+ -8, 0, 32124, 31100, 30076, 29052, 28028, - 27004, 25980, 24956, 23932, 22908, 21884, 20860, - 19836, 18812, 17788, 16764, 15996, 15484, 14972, - 14460, 13948, 13436, 12924, 12412, 11900, 11388, -@@ -100,8 +100,8 @@ - 372, 356, 340, 324, 308, 292, 276, - 260, 244, 228, 212, 196, 180, 164, - 148, 132, 120, 112, 104, 96, 88, -- 80, 72, 64, 56, 48, 40, 32, -- 24, 16, 8, 0 -+ 80, 72, 64, 56, 48, 40, 32, -+ 24, 16, 8, 0 - }; - - /* -@@ -137,39 +137,39 @@ - * John Wiley & Sons, pps 98-111 and 472-476. - */ - static unsigned char --st_14linear2ulaw(PyInt16 pcm_val) /* 2's complement (14-bit range) */ -+st_14linear2ulaw(PyInt16 pcm_val) /* 2's complement (14-bit range) */ - { -- PyInt16 mask; -- PyInt16 seg; -- unsigned char uval; -- -- /* The original sox code does this in the calling function, not here */ -- pcm_val = pcm_val >> 2; -- -- /* u-law inverts all bits */ -- /* Get the sign and the magnitude of the value. */ -- if (pcm_val < 0) { -- pcm_val = -pcm_val; -- mask = 0x7F; -- } else { -- mask = 0xFF; -- } -- if ( pcm_val > CLIP ) pcm_val = CLIP; /* clip the magnitude */ -- pcm_val += (BIAS >> 2); -- -- /* Convert the scaled magnitude to segment number. */ -- seg = search(pcm_val, seg_uend, 8); -- -- /* -- * Combine the sign, segment, quantization bits; -- * and complement the code word. -- */ -- if (seg >= 8) /* out of range, return maximum value. */ -- return (unsigned char) (0x7F ^ mask); -- else { -- uval = (unsigned char) (seg << 4) | ((pcm_val >> (seg + 1)) & 0xF); -- return (uval ^ mask); -- } -+ PyInt16 mask; -+ PyInt16 seg; -+ unsigned char uval; -+ -+ /* The original sox code does this in the calling function, not here */ -+ pcm_val = pcm_val >> 2; -+ -+ /* u-law inverts all bits */ -+ /* Get the sign and the magnitude of the value. */ -+ if (pcm_val < 0) { -+ pcm_val = -pcm_val; -+ mask = 0x7F; -+ } else { -+ mask = 0xFF; -+ } -+ if ( pcm_val > CLIP ) pcm_val = CLIP; /* clip the magnitude */ -+ pcm_val += (BIAS >> 2); -+ -+ /* Convert the scaled magnitude to segment number. */ -+ seg = search(pcm_val, seg_uend, 8); -+ -+ /* -+ * Combine the sign, segment, quantization bits; -+ * and complement the code word. -+ */ -+ if (seg >= 8) /* out of range, return maximum value. */ -+ return (unsigned char) (0x7F ^ mask); -+ else { -+ uval = (unsigned char) (seg << 4) | ((pcm_val >> (seg + 1)) & 0xF); -+ return (uval ^ mask); -+ } - - } - -@@ -234,59 +234,59 @@ - * John Wiley & Sons, pps 98-111 and 472-476. - */ - static unsigned char --st_linear2alaw(PyInt16 pcm_val) /* 2's complement (13-bit range) */ -+st_linear2alaw(PyInt16 pcm_val) /* 2's complement (13-bit range) */ - { -- PyInt16 mask; -- short seg; -- unsigned char aval; -- -- /* The original sox code does this in the calling function, not here */ -- pcm_val = pcm_val >> 3; -- -- /* A-law using even bit inversion */ -- if (pcm_val >= 0) { -- mask = 0xD5; /* sign (7th) bit = 1 */ -- } else { -- mask = 0x55; /* sign bit = 0 */ -- pcm_val = -pcm_val - 1; -- } -- -- /* Convert the scaled magnitude to segment number. */ -- seg = search(pcm_val, seg_aend, 8); -- -- /* Combine the sign, segment, and quantization bits. */ -- -- if (seg >= 8) /* out of range, return maximum value. */ -- return (unsigned char) (0x7F ^ mask); -- else { -- aval = (unsigned char) seg << SEG_SHIFT; -- if (seg < 2) -- aval |= (pcm_val >> 1) & QUANT_MASK; -- else -- aval |= (pcm_val >> seg) & QUANT_MASK; -- return (aval ^ mask); -- } -+ PyInt16 mask; -+ short seg; -+ unsigned char aval; -+ -+ /* The original sox code does this in the calling function, not here */ -+ pcm_val = pcm_val >> 3; -+ -+ /* A-law using even bit inversion */ -+ if (pcm_val >= 0) { -+ mask = 0xD5; /* sign (7th) bit = 1 */ -+ } else { -+ mask = 0x55; /* sign bit = 0 */ -+ pcm_val = -pcm_val - 1; -+ } -+ -+ /* Convert the scaled magnitude to segment number. */ -+ seg = search(pcm_val, seg_aend, 8); -+ -+ /* Combine the sign, segment, and quantization bits. */ -+ -+ if (seg >= 8) /* out of range, return maximum value. */ -+ return (unsigned char) (0x7F ^ mask); -+ else { -+ aval = (unsigned char) seg << SEG_SHIFT; -+ if (seg < 2) -+ aval |= (pcm_val >> 1) & QUANT_MASK; -+ else -+ aval |= (pcm_val >> seg) & QUANT_MASK; -+ return (aval ^ mask); -+ } - } - /* End of code taken from sox */ - - /* Intel ADPCM step variation table */ - static int indexTable[16] = { -- -1, -1, -1, -1, 2, 4, 6, 8, -- -1, -1, -1, -1, 2, 4, 6, 8, -+ -1, -1, -1, -1, 2, 4, 6, 8, -+ -1, -1, -1, -1, 2, 4, 6, 8, - }; - - static int stepsizeTable[89] = { -- 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, -- 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, -- 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, -- 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, -- 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, -- 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, -- 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, -- 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, -- 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 -+ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, -+ 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, -+ 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, -+ 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, -+ 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, -+ 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, -+ 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, -+ 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, -+ 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 - }; -- -+ - #define CHARP(cp, i) ((signed char *)(cp+i)) - #define SHORTP(cp, i) ((short *)(cp+i)) - #define LONGP(cp, i) ((Py_Int32 *)(cp+i)) -@@ -298,137 +298,137 @@ - static PyObject * - audioop_getsample(PyObject *self, PyObject *args) - { -- signed char *cp; -- int len, size, val = 0; -- int i; -- -- if ( !PyArg_ParseTuple(args, "s#ii:getsample", &cp, &len, &size, &i) ) -- return 0; -- if ( size != 1 && size != 2 && size != 4 ) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- if ( i < 0 || i >= len/size ) { -- PyErr_SetString(AudioopError, "Index out of range"); -- return 0; -- } -- if ( size == 1 ) val = (int)*CHARP(cp, i); -- else if ( size == 2 ) val = (int)*SHORTP(cp, i*2); -- else if ( size == 4 ) val = (int)*LONGP(cp, i*4); -- return PyLong_FromLong(val); -+ signed char *cp; -+ int len, size, val = 0; -+ int i; -+ -+ if ( !PyArg_ParseTuple(args, "s#ii:getsample", &cp, &len, &size, &i) ) -+ return 0; -+ if ( size != 1 && size != 2 && size != 4 ) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ if ( i < 0 || i >= len/size ) { -+ PyErr_SetString(AudioopError, "Index out of range"); -+ return 0; -+ } -+ if ( size == 1 ) val = (int)*CHARP(cp, i); -+ else if ( size == 2 ) val = (int)*SHORTP(cp, i*2); -+ else if ( size == 4 ) val = (int)*LONGP(cp, i*4); -+ return PyLong_FromLong(val); - } - - static PyObject * - audioop_max(PyObject *self, PyObject *args) - { -- signed char *cp; -- int len, size, val = 0; -- int i; -- int max = 0; -- -- if ( !PyArg_ParseTuple(args, "s#i:max", &cp, &len, &size) ) -- return 0; -- if ( size != 1 && size != 2 && size != 4 ) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- for ( i=0; i max ) max = val; -- } -- return PyLong_FromLong(max); -+ signed char *cp; -+ int len, size, val = 0; -+ int i; -+ int max = 0; -+ -+ if ( !PyArg_ParseTuple(args, "s#i:max", &cp, &len, &size) ) -+ return 0; -+ if ( size != 1 && size != 2 && size != 4 ) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ for ( i=0; i max ) max = val; -+ } -+ return PyLong_FromLong(max); - } - - static PyObject * - audioop_minmax(PyObject *self, PyObject *args) - { -- signed char *cp; -- int len, size, val = 0; -- int i; -- int min = 0x7fffffff, max = -0x7fffffff; -- -- if (!PyArg_ParseTuple(args, "s#i:minmax", &cp, &len, &size)) -- return NULL; -- if (size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return NULL; -- } -- for (i = 0; i < len; i += size) { -- if (size == 1) val = (int) *CHARP(cp, i); -- else if (size == 2) val = (int) *SHORTP(cp, i); -- else if (size == 4) val = (int) *LONGP(cp, i); -- if (val > max) max = val; -- if (val < min) min = val; -- } -- return Py_BuildValue("(ii)", min, max); -+ signed char *cp; -+ int len, size, val = 0; -+ int i; -+ int min = 0x7fffffff, max = -0x7fffffff; -+ -+ if (!PyArg_ParseTuple(args, "s#i:minmax", &cp, &len, &size)) -+ return NULL; -+ if (size != 1 && size != 2 && size != 4) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return NULL; -+ } -+ for (i = 0; i < len; i += size) { -+ if (size == 1) val = (int) *CHARP(cp, i); -+ else if (size == 2) val = (int) *SHORTP(cp, i); -+ else if (size == 4) val = (int) *LONGP(cp, i); -+ if (val > max) max = val; -+ if (val < min) min = val; -+ } -+ return Py_BuildValue("(ii)", min, max); - } - - static PyObject * - audioop_avg(PyObject *self, PyObject *args) - { -- signed char *cp; -- int len, size, val = 0; -- int i; -- double avg = 0.0; -- -- if ( !PyArg_ParseTuple(args, "s#i:avg", &cp, &len, &size) ) -- return 0; -- if ( size != 1 && size != 2 && size != 4 ) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- for ( i=0; i>= 1; -- len2 >>= 1; -- -- if ( len1 < len2 ) { -- PyErr_SetString(AudioopError, "First sample should be longer"); -- return 0; -- } -- sum_ri_2 = _sum2(cp2, cp2, len2); -- sum_aij_2 = _sum2(cp1, cp1, len2); -- sum_aij_ri = _sum2(cp1, cp2, len2); -- -- result = (sum_ri_2*sum_aij_2 - sum_aij_ri*sum_aij_ri) / sum_aij_2; -- -- best_result = result; -- best_j = 0; -- j = 0; -- -- for ( j=1; j<=len1-len2; j++) { -- aj_m1 = (double)cp1[j-1]; -- aj_lm1 = (double)cp1[j+len2-1]; -- -- sum_aij_2 = sum_aij_2 + aj_lm1*aj_lm1 - aj_m1*aj_m1; -- sum_aij_ri = _sum2(cp1+j, cp2, len2); -- -- result = (sum_ri_2*sum_aij_2 - sum_aij_ri*sum_aij_ri) -- / sum_aij_2; -- -- if ( result < best_result ) { -- best_result = result; -- best_j = j; -- } -- -+ short *cp1, *cp2; -+ int len1, len2; -+ int j, best_j; -+ 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 PyBytesObject, -+ this is currently (Python 2.6) the case. */ -+ if ( !PyArg_ParseTuple(args, "s#s#:findfit", -+ (char**)&cp1, &len1, (char**)&cp2, &len2) ) -+ return 0; -+ if ( len1 & 1 || len2 & 1 ) { -+ PyErr_SetString(AudioopError, "Strings should be even-sized"); -+ return 0; -+ } -+ len1 >>= 1; -+ len2 >>= 1; -+ -+ if ( len1 < len2 ) { -+ PyErr_SetString(AudioopError, "First sample should be longer"); -+ return 0; -+ } -+ sum_ri_2 = _sum2(cp2, cp2, len2); -+ sum_aij_2 = _sum2(cp1, cp1, len2); -+ sum_aij_ri = _sum2(cp1, cp2, len2); -+ -+ result = (sum_ri_2*sum_aij_2 - sum_aij_ri*sum_aij_ri) / sum_aij_2; -+ -+ best_result = result; -+ best_j = 0; -+ j = 0; -+ -+ for ( j=1; j<=len1-len2; j++) { -+ aj_m1 = (double)cp1[j-1]; -+ aj_lm1 = (double)cp1[j+len2-1]; -+ -+ sum_aij_2 = sum_aij_2 + aj_lm1*aj_lm1 - aj_m1*aj_m1; -+ sum_aij_ri = _sum2(cp1+j, cp2, len2); -+ -+ result = (sum_ri_2*sum_aij_2 - sum_aij_ri*sum_aij_ri) -+ / sum_aij_2; -+ -+ if ( result < best_result ) { -+ best_result = result; -+ best_j = j; - } - -- factor = _sum2(cp1+best_j, cp2, len2) / sum_ri_2; -- -- return Py_BuildValue("(if)", best_j, factor); -+ } -+ -+ factor = _sum2(cp1+best_j, cp2, len2) / sum_ri_2; -+ -+ return Py_BuildValue("(if)", best_j, factor); - } - - /* -@@ -529,28 +529,28 @@ - static PyObject * - audioop_findfactor(PyObject *self, PyObject *args) - { -- short *cp1, *cp2; -- int len1, len2; -- double sum_ri_2, sum_aij_ri, result; -- -- if ( !PyArg_ParseTuple(args, "s#s#:findfactor", -- (char**)&cp1, &len1, (char**)&cp2, &len2) ) -- return 0; -- if ( len1 & 1 || len2 & 1 ) { -- PyErr_SetString(AudioopError, "Strings should be even-sized"); -- return 0; -- } -- if ( len1 != len2 ) { -- PyErr_SetString(AudioopError, "Samples should be same size"); -- return 0; -- } -- len2 >>= 1; -- sum_ri_2 = _sum2(cp2, cp2, len2); -- sum_aij_ri = _sum2(cp1, cp2, len2); -+ short *cp1, *cp2; -+ int len1, len2; -+ double sum_ri_2, sum_aij_ri, result; -+ -+ if ( !PyArg_ParseTuple(args, "s#s#:findfactor", -+ (char**)&cp1, &len1, (char**)&cp2, &len2) ) -+ return 0; -+ if ( len1 & 1 || len2 & 1 ) { -+ PyErr_SetString(AudioopError, "Strings should be even-sized"); -+ return 0; -+ } -+ if ( len1 != len2 ) { -+ PyErr_SetString(AudioopError, "Samples should be same size"); -+ return 0; -+ } -+ len2 >>= 1; -+ sum_ri_2 = _sum2(cp2, cp2, len2); -+ sum_aij_ri = _sum2(cp1, cp2, len2); - -- result = sum_aij_ri / sum_ri_2; -+ result = sum_aij_ri / sum_ri_2; - -- return PyFloat_FromDouble(result); -+ return PyFloat_FromDouble(result); - } - - /* -@@ -560,1114 +560,1114 @@ - static PyObject * - audioop_findmax(PyObject *self, PyObject *args) - { -- short *cp1; -- int len1, len2; -- int j, best_j; -- double aj_m1, aj_lm1; -- double result, best_result; -- -- if ( !PyArg_ParseTuple(args, "s#i:findmax", -- (char**)&cp1, &len1, &len2) ) -- return 0; -- if ( len1 & 1 ) { -- PyErr_SetString(AudioopError, "Strings should be even-sized"); -- return 0; -+ short *cp1; -+ int len1, len2; -+ int j, best_j; -+ double aj_m1, aj_lm1; -+ double result, best_result; -+ -+ if ( !PyArg_ParseTuple(args, "s#i:findmax", -+ (char**)&cp1, &len1, &len2) ) -+ return 0; -+ if ( len1 & 1 ) { -+ PyErr_SetString(AudioopError, "Strings should be even-sized"); -+ return 0; -+ } -+ len1 >>= 1; -+ -+ if ( len2 < 0 || len1 < len2 ) { -+ PyErr_SetString(AudioopError, "Input sample should be longer"); -+ return 0; -+ } -+ -+ result = _sum2(cp1, cp1, len2); -+ -+ best_result = result; -+ best_j = 0; -+ j = 0; -+ -+ for ( j=1; j<=len1-len2; j++) { -+ aj_m1 = (double)cp1[j-1]; -+ aj_lm1 = (double)cp1[j+len2-1]; -+ -+ result = result + aj_lm1*aj_lm1 - aj_m1*aj_m1; -+ -+ if ( result > best_result ) { -+ best_result = result; -+ best_j = j; - } -- len1 >>= 1; -- -- if ( len2 < 0 || len1 < len2 ) { -- PyErr_SetString(AudioopError, "Input sample should be longer"); -- return 0; -- } -- -- result = _sum2(cp1, cp1, len2); - -- best_result = result; -- best_j = 0; -- j = 0; -- -- for ( j=1; j<=len1-len2; j++) { -- aj_m1 = (double)cp1[j-1]; -- aj_lm1 = (double)cp1[j+len2-1]; -- -- result = result + aj_lm1*aj_lm1 - aj_m1*aj_m1; -- -- if ( result > best_result ) { -- best_result = result; -- best_j = j; -- } -- -- } -+ } - -- return PyLong_FromLong(best_j); -+ return PyLong_FromLong(best_j); - } - - static PyObject * - audioop_avgpp(PyObject *self, PyObject *args) - { -- signed char *cp; -- int len, size, val = 0, prevval = 0, prevextremevalid = 0, -- prevextreme = 0; -- int i; -- double avg = 0.0; -- int diff, prevdiff, extremediff, nextreme = 0; -- -- if ( !PyArg_ParseTuple(args, "s#i:avgpp", &cp, &len, &size) ) -- return 0; -- if ( size != 1 && size != 2 && size != 4 ) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- /* Compute first delta value ahead. Also automatically makes us -- ** skip the first extreme value -- */ -- if ( size == 1 ) prevval = (int)*CHARP(cp, 0); -- else if ( size == 2 ) prevval = (int)*SHORTP(cp, 0); -- else if ( size == 4 ) prevval = (int)*LONGP(cp, 0); -- if ( size == 1 ) val = (int)*CHARP(cp, size); -- else if ( size == 2 ) val = (int)*SHORTP(cp, size); -- else if ( size == 4 ) val = (int)*LONGP(cp, size); -- prevdiff = val - prevval; -- -- for ( i=size; i max ) -- max = extremediff; -- } -- prevextremevalid = 1; -- prevextreme = prevval; -- } -- prevval = val; -- if ( diff != 0 ) -- prevdiff = diff; -- } -- return PyLong_FromLong(max); -+ signed char *cp; -+ int len, size, val = 0, prevval = 0, prevextremevalid = 0, -+ prevextreme = 0; -+ int i; -+ int max = 0; -+ int diff, prevdiff, extremediff; -+ -+ if ( !PyArg_ParseTuple(args, "s#i:maxpp", &cp, &len, &size) ) -+ return 0; -+ if ( size != 1 && size != 2 && size != 4 ) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ /* Compute first delta value ahead. Also automatically makes us -+ ** skip the first extreme value -+ */ -+ if ( size == 1 ) prevval = (int)*CHARP(cp, 0); -+ else if ( size == 2 ) prevval = (int)*SHORTP(cp, 0); -+ else if ( size == 4 ) prevval = (int)*LONGP(cp, 0); -+ if ( size == 1 ) val = (int)*CHARP(cp, size); -+ else if ( size == 2 ) val = (int)*SHORTP(cp, size); -+ else if ( size == 4 ) val = (int)*LONGP(cp, size); -+ prevdiff = val - prevval; -+ -+ for ( i=size; i max ) -+ max = extremediff; -+ } -+ prevextremevalid = 1; -+ prevextreme = prevval; -+ } -+ prevval = val; -+ if ( diff != 0 ) -+ prevdiff = diff; -+ } -+ return PyLong_FromLong(max); - } - - static PyObject * - audioop_cross(PyObject *self, PyObject *args) - { -- signed char *cp; -- int len, size, val = 0; -- int i; -- int prevval, ncross; -- -- if ( !PyArg_ParseTuple(args, "s#i:cross", &cp, &len, &size) ) -- return 0; -- if ( size != 1 && size != 2 && size != 4 ) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- ncross = -1; -- prevval = 17; /* Anything <> 0,1 */ -- for ( i=0; i> 7; -- else if ( size == 2 ) val = ((int)*SHORTP(cp, i)) >> 15; -- else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 31; -- val = val & 1; -- if ( val != prevval ) ncross++; -- prevval = val; -- } -- return PyLong_FromLong(ncross); -+ signed char *cp; -+ int len, size, val = 0; -+ int i; -+ int prevval, ncross; -+ -+ if ( !PyArg_ParseTuple(args, "s#i:cross", &cp, &len, &size) ) -+ return 0; -+ if ( size != 1 && size != 2 && size != 4 ) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ ncross = -1; -+ prevval = 17; /* Anything <> 0,1 */ -+ for ( i=0; i> 7; -+ else if ( size == 2 ) val = ((int)*SHORTP(cp, i)) >> 15; -+ else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 31; -+ val = val & 1; -+ if ( val != prevval ) ncross++; -+ prevval = val; -+ } -+ return PyLong_FromLong(ncross); - } - - static PyObject * - audioop_mul(PyObject *self, PyObject *args) - { -- signed char *cp, *ncp; -- int len, size, val = 0; -- double factor, fval, maxval; -- PyObject *rv; -- int i; -- -- if ( !PyArg_ParseTuple(args, "s#id:mul", &cp, &len, &size, &factor ) ) -- return 0; -- -- if ( size == 1 ) maxval = (double) 0x7f; -- else if ( size == 2 ) maxval = (double) 0x7fff; -- else if ( size == 4 ) maxval = (double) 0x7fffffff; -- else { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- rv = PyBytes_FromStringAndSize(NULL, len); -- if ( rv == 0 ) -- return 0; -- ncp = (signed char *)PyBytes_AsString(rv); -- -- -- for ( i=0; i < len; i += size ) { -- if ( size == 1 ) val = (int)*CHARP(cp, i); -- else if ( size == 2 ) val = (int)*SHORTP(cp, i); -- else if ( size == 4 ) val = (int)*LONGP(cp, i); -- fval = (double)val*factor; -- if ( fval > maxval ) fval = maxval; -- else if ( fval < -maxval ) fval = -maxval; -- val = (int)fval; -- if ( size == 1 ) *CHARP(ncp, i) = (signed char)val; -- else if ( size == 2 ) *SHORTP(ncp, i) = (short)val; -- else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)val; -- } -- return rv; -+ signed char *cp, *ncp; -+ int len, size, val = 0; -+ double factor, fval, maxval; -+ PyObject *rv; -+ int i; -+ -+ if ( !PyArg_ParseTuple(args, "s#id:mul", &cp, &len, &size, &factor ) ) -+ return 0; -+ -+ if ( size == 1 ) maxval = (double) 0x7f; -+ else if ( size == 2 ) maxval = (double) 0x7fff; -+ else if ( size == 4 ) maxval = (double) 0x7fffffff; -+ else { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ rv = PyBytes_FromStringAndSize(NULL, len); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (signed char *)PyBytes_AsString(rv); -+ -+ -+ for ( i=0; i < len; i += size ) { -+ if ( size == 1 ) val = (int)*CHARP(cp, i); -+ else if ( size == 2 ) val = (int)*SHORTP(cp, i); -+ else if ( size == 4 ) val = (int)*LONGP(cp, i); -+ fval = (double)val*factor; -+ if ( fval > maxval ) fval = maxval; -+ else if ( fval < -maxval ) fval = -maxval; -+ val = (int)fval; -+ if ( size == 1 ) *CHARP(ncp, i) = (signed char)val; -+ else if ( size == 2 ) *SHORTP(ncp, i) = (short)val; -+ else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)val; -+ } -+ return rv; - } - - static PyObject * - audioop_tomono(PyObject *self, PyObject *args) - { -- Py_buffer pcp; -- signed char *cp, *ncp; -- int len, size, val1 = 0, val2 = 0; -- double fac1, fac2, fval, maxval; -- PyObject *rv; -- int i; -- -- if ( !PyArg_ParseTuple(args, "s*idd:tomono", -- &pcp, &size, &fac1, &fac2 ) ) -- return 0; -- cp = pcp.buf; -- len = pcp.len; -- -- if ( size == 1 ) maxval = (double) 0x7f; -- else if ( size == 2 ) maxval = (double) 0x7fff; -- else if ( size == 4 ) maxval = (double) 0x7fffffff; -- else { -- PyBuffer_Release(&pcp); -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- rv = PyBytes_FromStringAndSize(NULL, len/2); -- if ( rv == 0 ) -- return 0; -- ncp = (signed char *)PyBytes_AsString(rv); -- -- -- for ( i=0; i < len; i += size*2 ) { -- if ( size == 1 ) val1 = (int)*CHARP(cp, i); -- else if ( size == 2 ) val1 = (int)*SHORTP(cp, i); -- else if ( size == 4 ) val1 = (int)*LONGP(cp, i); -- if ( size == 1 ) val2 = (int)*CHARP(cp, i+1); -- else if ( size == 2 ) val2 = (int)*SHORTP(cp, i+2); -- else if ( size == 4 ) val2 = (int)*LONGP(cp, i+4); -- fval = (double)val1*fac1 + (double)val2*fac2; -- if ( fval > maxval ) fval = maxval; -- else if ( fval < -maxval ) fval = -maxval; -- val1 = (int)fval; -- if ( size == 1 ) *CHARP(ncp, i/2) = (signed char)val1; -- else if ( size == 2 ) *SHORTP(ncp, i/2) = (short)val1; -- else if ( size == 4 ) *LONGP(ncp, i/2)= (Py_Int32)val1; -- } -- PyBuffer_Release(&pcp); -- return rv; -+ Py_buffer pcp; -+ signed char *cp, *ncp; -+ int len, size, val1 = 0, val2 = 0; -+ double fac1, fac2, fval, maxval; -+ PyObject *rv; -+ int i; -+ -+ if ( !PyArg_ParseTuple(args, "s*idd:tomono", -+ &pcp, &size, &fac1, &fac2 ) ) -+ return 0; -+ cp = pcp.buf; -+ len = pcp.len; -+ -+ if ( size == 1 ) maxval = (double) 0x7f; -+ else if ( size == 2 ) maxval = (double) 0x7fff; -+ else if ( size == 4 ) maxval = (double) 0x7fffffff; -+ else { -+ PyBuffer_Release(&pcp); -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ rv = PyBytes_FromStringAndSize(NULL, len/2); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (signed char *)PyBytes_AsString(rv); -+ -+ -+ for ( i=0; i < len; i += size*2 ) { -+ if ( size == 1 ) val1 = (int)*CHARP(cp, i); -+ else if ( size == 2 ) val1 = (int)*SHORTP(cp, i); -+ else if ( size == 4 ) val1 = (int)*LONGP(cp, i); -+ if ( size == 1 ) val2 = (int)*CHARP(cp, i+1); -+ else if ( size == 2 ) val2 = (int)*SHORTP(cp, i+2); -+ else if ( size == 4 ) val2 = (int)*LONGP(cp, i+4); -+ fval = (double)val1*fac1 + (double)val2*fac2; -+ if ( fval > maxval ) fval = maxval; -+ else if ( fval < -maxval ) fval = -maxval; -+ val1 = (int)fval; -+ if ( size == 1 ) *CHARP(ncp, i/2) = (signed char)val1; -+ else if ( size == 2 ) *SHORTP(ncp, i/2) = (short)val1; -+ else if ( size == 4 ) *LONGP(ncp, i/2)= (Py_Int32)val1; -+ } -+ PyBuffer_Release(&pcp); -+ return rv; - } - - static PyObject * - audioop_tostereo(PyObject *self, PyObject *args) - { -- signed char *cp, *ncp; -- int len, new_len, size, val1, val2, val = 0; -- double fac1, fac2, fval, maxval; -- PyObject *rv; -- int i; -- -- if ( !PyArg_ParseTuple(args, "s#idd:tostereo", -- &cp, &len, &size, &fac1, &fac2 ) ) -- return 0; -- -- if ( size == 1 ) maxval = (double) 0x7f; -- else if ( size == 2 ) maxval = (double) 0x7fff; -- else if ( size == 4 ) maxval = (double) 0x7fffffff; -- else { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- new_len = len*2; -- if (new_len < 0) { -- PyErr_SetString(PyExc_MemoryError, -- "not enough memory for output buffer"); -- return 0; -- } -+ signed char *cp, *ncp; -+ int len, new_len, size, val1, val2, val = 0; -+ double fac1, fac2, fval, maxval; -+ PyObject *rv; -+ int i; -+ -+ if ( !PyArg_ParseTuple(args, "s#idd:tostereo", -+ &cp, &len, &size, &fac1, &fac2 ) ) -+ return 0; -+ -+ if ( size == 1 ) maxval = (double) 0x7f; -+ else if ( size == 2 ) maxval = (double) 0x7fff; -+ else if ( size == 4 ) maxval = (double) 0x7fffffff; -+ else { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ new_len = len*2; -+ if (new_len < 0) { -+ PyErr_SetString(PyExc_MemoryError, -+ "not enough memory for output buffer"); -+ return 0; -+ } -+ -+ rv = PyBytes_FromStringAndSize(NULL, new_len); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (signed char *)PyBytes_AsString(rv); - -- rv = PyBytes_FromStringAndSize(NULL, new_len); -- if ( rv == 0 ) -- return 0; -- ncp = (signed char *)PyBytes_AsString(rv); -- -- -- for ( i=0; i < len; i += size ) { -- if ( size == 1 ) val = (int)*CHARP(cp, i); -- else if ( size == 2 ) val = (int)*SHORTP(cp, i); -- else if ( size == 4 ) val = (int)*LONGP(cp, i); -- -- fval = (double)val*fac1; -- if ( fval > maxval ) fval = maxval; -- else if ( fval < -maxval ) fval = -maxval; -- val1 = (int)fval; -- -- fval = (double)val*fac2; -- if ( fval > maxval ) fval = maxval; -- else if ( fval < -maxval ) fval = -maxval; -- val2 = (int)fval; -- -- if ( size == 1 ) *CHARP(ncp, i*2) = (signed char)val1; -- else if ( size == 2 ) *SHORTP(ncp, i*2) = (short)val1; -- else if ( size == 4 ) *LONGP(ncp, i*2) = (Py_Int32)val1; -- -- if ( size == 1 ) *CHARP(ncp, i*2+1) = (signed char)val2; -- else if ( size == 2 ) *SHORTP(ncp, i*2+2) = (short)val2; -- else if ( size == 4 ) *LONGP(ncp, i*2+4) = (Py_Int32)val2; -- } -- return rv; -+ -+ for ( i=0; i < len; i += size ) { -+ if ( size == 1 ) val = (int)*CHARP(cp, i); -+ else if ( size == 2 ) val = (int)*SHORTP(cp, i); -+ else if ( size == 4 ) val = (int)*LONGP(cp, i); -+ -+ fval = (double)val*fac1; -+ if ( fval > maxval ) fval = maxval; -+ else if ( fval < -maxval ) fval = -maxval; -+ val1 = (int)fval; -+ -+ fval = (double)val*fac2; -+ if ( fval > maxval ) fval = maxval; -+ else if ( fval < -maxval ) fval = -maxval; -+ val2 = (int)fval; -+ -+ if ( size == 1 ) *CHARP(ncp, i*2) = (signed char)val1; -+ else if ( size == 2 ) *SHORTP(ncp, i*2) = (short)val1; -+ else if ( size == 4 ) *LONGP(ncp, i*2) = (Py_Int32)val1; -+ -+ if ( size == 1 ) *CHARP(ncp, i*2+1) = (signed char)val2; -+ else if ( size == 2 ) *SHORTP(ncp, i*2+2) = (short)val2; -+ else if ( size == 4 ) *LONGP(ncp, i*2+4) = (Py_Int32)val2; -+ } -+ return rv; - } - - static PyObject * - audioop_add(PyObject *self, PyObject *args) - { -- signed char *cp1, *cp2, *ncp; -- int len1, len2, size, val1 = 0, val2 = 0, maxval, newval; -- PyObject *rv; -- int i; -- -- if ( !PyArg_ParseTuple(args, "s#s#i:add", -- &cp1, &len1, &cp2, &len2, &size ) ) -- return 0; -- -- if ( len1 != len2 ) { -- PyErr_SetString(AudioopError, "Lengths should be the same"); -- return 0; -- } -- -- if ( size == 1 ) maxval = 0x7f; -- else if ( size == 2 ) maxval = 0x7fff; -- else if ( size == 4 ) maxval = 0x7fffffff; -- else { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- rv = PyBytes_FromStringAndSize(NULL, len1); -- if ( rv == 0 ) -- return 0; -- ncp = (signed char *)PyBytes_AsString(rv); -- -- for ( i=0; i < len1; i += size ) { -- if ( size == 1 ) val1 = (int)*CHARP(cp1, i); -- else if ( size == 2 ) val1 = (int)*SHORTP(cp1, i); -- else if ( size == 4 ) val1 = (int)*LONGP(cp1, i); -- -- if ( size == 1 ) val2 = (int)*CHARP(cp2, i); -- else if ( size == 2 ) val2 = (int)*SHORTP(cp2, i); -- else if ( size == 4 ) val2 = (int)*LONGP(cp2, i); -- -- newval = val1 + val2; -- /* truncate in case of overflow */ -- if (newval > maxval) newval = maxval; -- else if (newval < -maxval) newval = -maxval; -- else if (size == 4 && (newval^val1) < 0 && (newval^val2) < 0) -- newval = val1 > 0 ? maxval : - maxval; -- -- if ( size == 1 ) *CHARP(ncp, i) = (signed char)newval; -- else if ( size == 2 ) *SHORTP(ncp, i) = (short)newval; -- else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)newval; -- } -- return rv; -+ signed char *cp1, *cp2, *ncp; -+ int len1, len2, size, val1 = 0, val2 = 0, maxval, newval; -+ PyObject *rv; -+ int i; -+ -+ if ( !PyArg_ParseTuple(args, "s#s#i:add", -+ &cp1, &len1, &cp2, &len2, &size ) ) -+ return 0; -+ -+ if ( len1 != len2 ) { -+ PyErr_SetString(AudioopError, "Lengths should be the same"); -+ return 0; -+ } -+ -+ if ( size == 1 ) maxval = 0x7f; -+ else if ( size == 2 ) maxval = 0x7fff; -+ else if ( size == 4 ) maxval = 0x7fffffff; -+ else { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ rv = PyBytes_FromStringAndSize(NULL, len1); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (signed char *)PyBytes_AsString(rv); -+ -+ for ( i=0; i < len1; i += size ) { -+ if ( size == 1 ) val1 = (int)*CHARP(cp1, i); -+ else if ( size == 2 ) val1 = (int)*SHORTP(cp1, i); -+ else if ( size == 4 ) val1 = (int)*LONGP(cp1, i); -+ -+ if ( size == 1 ) val2 = (int)*CHARP(cp2, i); -+ else if ( size == 2 ) val2 = (int)*SHORTP(cp2, i); -+ else if ( size == 4 ) val2 = (int)*LONGP(cp2, i); -+ -+ newval = val1 + val2; -+ /* truncate in case of overflow */ -+ if (newval > maxval) newval = maxval; -+ else if (newval < -maxval) newval = -maxval; -+ else if (size == 4 && (newval^val1) < 0 && (newval^val2) < 0) -+ newval = val1 > 0 ? maxval : - maxval; -+ -+ if ( size == 1 ) *CHARP(ncp, i) = (signed char)newval; -+ else if ( size == 2 ) *SHORTP(ncp, i) = (short)newval; -+ else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)newval; -+ } -+ return rv; - } - - static PyObject * - audioop_bias(PyObject *self, PyObject *args) - { -- signed char *cp, *ncp; -- int len, size, val = 0; -- PyObject *rv; -- int i; -- int bias; -- -- if ( !PyArg_ParseTuple(args, "s#ii:bias", -- &cp, &len, &size , &bias) ) -- return 0; -- -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- rv = PyBytes_FromStringAndSize(NULL, len); -- if ( rv == 0 ) -- return 0; -- ncp = (signed char *)PyBytes_AsString(rv); -- -- -- for ( i=0; i < len; i += size ) { -- if ( size == 1 ) val = (int)*CHARP(cp, i); -- else if ( size == 2 ) val = (int)*SHORTP(cp, i); -- else if ( size == 4 ) val = (int)*LONGP(cp, i); -- -- if ( size == 1 ) *CHARP(ncp, i) = (signed char)(val+bias); -- else if ( size == 2 ) *SHORTP(ncp, i) = (short)(val+bias); -- else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)(val+bias); -- } -- return rv; -+ signed char *cp, *ncp; -+ int len, size, val = 0; -+ PyObject *rv; -+ int i; -+ int bias; -+ -+ if ( !PyArg_ParseTuple(args, "s#ii:bias", -+ &cp, &len, &size , &bias) ) -+ return 0; -+ -+ if ( size != 1 && size != 2 && size != 4) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ rv = PyBytes_FromStringAndSize(NULL, len); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (signed char *)PyBytes_AsString(rv); -+ -+ -+ for ( i=0; i < len; i += size ) { -+ if ( size == 1 ) val = (int)*CHARP(cp, i); -+ else if ( size == 2 ) val = (int)*SHORTP(cp, i); -+ else if ( size == 4 ) val = (int)*LONGP(cp, i); -+ -+ if ( size == 1 ) *CHARP(ncp, i) = (signed char)(val+bias); -+ else if ( size == 2 ) *SHORTP(ncp, i) = (short)(val+bias); -+ else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)(val+bias); -+ } -+ return rv; - } - - static PyObject * - audioop_reverse(PyObject *self, PyObject *args) - { -- signed char *cp; -- unsigned char *ncp; -- int len, size, val = 0; -- PyObject *rv; -- int i, j; -- -- if ( !PyArg_ParseTuple(args, "s#i:reverse", -- &cp, &len, &size) ) -- return 0; -- -- if ( size != 1 && size != 2 && size != 4 ) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- rv = PyBytes_FromStringAndSize(NULL, len); -- if ( rv == 0 ) -- return 0; -- ncp = (unsigned char *)PyBytes_AsString(rv); -- -- for ( i=0; i < len; i += size ) { -- if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -- else if ( size == 2 ) val = (int)*SHORTP(cp, i); -- else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -- -- j = len - i - size; -- -- if ( size == 1 ) *CHARP(ncp, j) = (signed char)(val >> 8); -- else if ( size == 2 ) *SHORTP(ncp, j) = (short)(val); -- else if ( size == 4 ) *LONGP(ncp, j) = (Py_Int32)(val<<16); -- } -- return rv; -+ signed char *cp; -+ unsigned char *ncp; -+ int len, size, val = 0; -+ PyObject *rv; -+ int i, j; -+ -+ if ( !PyArg_ParseTuple(args, "s#i:reverse", -+ &cp, &len, &size) ) -+ return 0; -+ -+ if ( size != 1 && size != 2 && size != 4 ) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ rv = PyBytes_FromStringAndSize(NULL, len); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (unsigned char *)PyBytes_AsString(rv); -+ -+ for ( i=0; i < len; i += size ) { -+ if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -+ else if ( size == 2 ) val = (int)*SHORTP(cp, i); -+ else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -+ -+ j = len - i - size; -+ -+ if ( size == 1 ) *CHARP(ncp, j) = (signed char)(val >> 8); -+ else if ( size == 2 ) *SHORTP(ncp, j) = (short)(val); -+ else if ( size == 4 ) *LONGP(ncp, j) = (Py_Int32)(val<<16); -+ } -+ return rv; - } - - static PyObject * - audioop_lin2lin(PyObject *self, PyObject *args) - { -- signed char *cp; -- unsigned char *ncp; -- int len, new_len, size, size2, val = 0; -- PyObject *rv; -- int i, j; -- -- if ( !PyArg_ParseTuple(args, "s#ii:lin2lin", -- &cp, &len, &size, &size2) ) -- return 0; -- -- if ( (size != 1 && size != 2 && size != 4) || -- (size2 != 1 && size2 != 2 && size2 != 4)) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- new_len = (len/size)*size2; -- if (new_len < 0) { -- PyErr_SetString(PyExc_MemoryError, -- "not enough memory for output buffer"); -- return 0; -- } -- rv = PyBytes_FromStringAndSize(NULL, new_len); -- if ( rv == 0 ) -- return 0; -- ncp = (unsigned char *)PyBytes_AsString(rv); -- -- for ( i=0, j=0; i < len; i += size, j += size2 ) { -- if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -- else if ( size == 2 ) val = (int)*SHORTP(cp, i); -- else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -- -- if ( size2 == 1 ) *CHARP(ncp, j) = (signed char)(val >> 8); -- else if ( size2 == 2 ) *SHORTP(ncp, j) = (short)(val); -- else if ( size2 == 4 ) *LONGP(ncp, j) = (Py_Int32)(val<<16); -- } -- return rv; -+ signed char *cp; -+ unsigned char *ncp; -+ int len, new_len, size, size2, val = 0; -+ PyObject *rv; -+ int i, j; -+ -+ if ( !PyArg_ParseTuple(args, "s#ii:lin2lin", -+ &cp, &len, &size, &size2) ) -+ return 0; -+ -+ if ( (size != 1 && size != 2 && size != 4) || -+ (size2 != 1 && size2 != 2 && size2 != 4)) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ new_len = (len/size)*size2; -+ if (new_len < 0) { -+ PyErr_SetString(PyExc_MemoryError, -+ "not enough memory for output buffer"); -+ return 0; -+ } -+ rv = PyBytes_FromStringAndSize(NULL, new_len); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (unsigned char *)PyBytes_AsString(rv); -+ -+ for ( i=0, j=0; i < len; i += size, j += size2 ) { -+ if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -+ else if ( size == 2 ) val = (int)*SHORTP(cp, i); -+ else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -+ -+ if ( size2 == 1 ) *CHARP(ncp, j) = (signed char)(val >> 8); -+ else if ( size2 == 2 ) *SHORTP(ncp, j) = (short)(val); -+ else if ( size2 == 4 ) *LONGP(ncp, j) = (Py_Int32)(val<<16); -+ } -+ return rv; - } - - static int - gcd(int a, int b) - { -- while (b > 0) { -- int tmp = a % b; -- a = b; -- b = tmp; -- } -- return a; -+ while (b > 0) { -+ int tmp = a % b; -+ a = b; -+ b = tmp; -+ } -+ return a; - } - - static PyObject * - audioop_ratecv(PyObject *self, PyObject *args) - { -- char *cp, *ncp; -- int len, size, nchannels, inrate, outrate, weightA, weightB; -- int chan, d, *prev_i, *cur_i, cur_o; -- PyObject *state, *samps, *str, *rv = NULL; -- int bytes_per_frame; -- size_t alloc_size; -- -- weightA = 1; -- weightB = 0; -- if (!PyArg_ParseTuple(args, "s#iiiiO|ii:ratecv", &cp, &len, &size, -- &nchannels, &inrate, &outrate, &state, -- &weightA, &weightB)) -- return NULL; -- if (size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return NULL; -- } -- if (nchannels < 1) { -- PyErr_SetString(AudioopError, "# of channels should be >= 1"); -- return NULL; -- } -- bytes_per_frame = size * nchannels; -- if (bytes_per_frame / nchannels != size) { -- /* This overflow test is rigorously correct because -- both multiplicands are >= 1. Use the argument names -- from the docs for the error msg. */ -- PyErr_SetString(PyExc_OverflowError, -- "width * nchannels too big for a C int"); -- return NULL; -- } -- if (weightA < 1 || weightB < 0) { -- PyErr_SetString(AudioopError, -- "weightA should be >= 1, weightB should be >= 0"); -- return NULL; -- } -- if (len % bytes_per_frame != 0) { -- PyErr_SetString(AudioopError, "not a whole number of frames"); -- return NULL; -- } -- if (inrate <= 0 || outrate <= 0) { -- PyErr_SetString(AudioopError, "sampling rate not > 0"); -- return NULL; -- } -- /* divide inrate and outrate by their greatest common divisor */ -- d = gcd(inrate, outrate); -- inrate /= d; -- outrate /= d; -- -- alloc_size = sizeof(int) * (unsigned)nchannels; -- if (alloc_size < (unsigned)nchannels) { -- PyErr_SetString(PyExc_MemoryError, -- "not enough memory for output buffer"); -- return 0; -- } -- prev_i = (int *) malloc(alloc_size); -- cur_i = (int *) malloc(alloc_size); -- if (prev_i == NULL || cur_i == NULL) { -- (void) PyErr_NoMemory(); -+ char *cp, *ncp; -+ int len, size, nchannels, inrate, outrate, weightA, weightB; -+ int chan, d, *prev_i, *cur_i, cur_o; -+ PyObject *state, *samps, *str, *rv = NULL; -+ int bytes_per_frame; -+ size_t alloc_size; -+ -+ weightA = 1; -+ weightB = 0; -+ if (!PyArg_ParseTuple(args, "s#iiiiO|ii:ratecv", &cp, &len, &size, -+ &nchannels, &inrate, &outrate, &state, -+ &weightA, &weightB)) -+ return NULL; -+ if (size != 1 && size != 2 && size != 4) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return NULL; -+ } -+ if (nchannels < 1) { -+ PyErr_SetString(AudioopError, "# of channels should be >= 1"); -+ return NULL; -+ } -+ bytes_per_frame = size * nchannels; -+ if (bytes_per_frame / nchannels != size) { -+ /* This overflow test is rigorously correct because -+ both multiplicands are >= 1. Use the argument names -+ from the docs for the error msg. */ -+ PyErr_SetString(PyExc_OverflowError, -+ "width * nchannels too big for a C int"); -+ return NULL; -+ } -+ if (weightA < 1 || weightB < 0) { -+ PyErr_SetString(AudioopError, -+ "weightA should be >= 1, weightB should be >= 0"); -+ return NULL; -+ } -+ if (len % bytes_per_frame != 0) { -+ PyErr_SetString(AudioopError, "not a whole number of frames"); -+ return NULL; -+ } -+ if (inrate <= 0 || outrate <= 0) { -+ PyErr_SetString(AudioopError, "sampling rate not > 0"); -+ return NULL; -+ } -+ /* divide inrate and outrate by their greatest common divisor */ -+ d = gcd(inrate, outrate); -+ inrate /= d; -+ outrate /= d; -+ -+ alloc_size = sizeof(int) * (unsigned)nchannels; -+ if (alloc_size < (unsigned)nchannels) { -+ PyErr_SetString(PyExc_MemoryError, -+ "not enough memory for output buffer"); -+ return 0; -+ } -+ prev_i = (int *) malloc(alloc_size); -+ cur_i = (int *) malloc(alloc_size); -+ if (prev_i == NULL || cur_i == NULL) { -+ (void) PyErr_NoMemory(); -+ goto exit; -+ } -+ -+ len /= bytes_per_frame; /* # of frames */ -+ -+ if (state == Py_None) { -+ d = -outrate; -+ for (chan = 0; chan < nchannels; chan++) -+ prev_i[chan] = cur_i[chan] = 0; -+ } -+ else { -+ if (!PyArg_ParseTuple(state, -+ "iO!;audioop.ratecv: illegal state argument", -+ &d, &PyTuple_Type, &samps)) -+ goto exit; -+ if (PyTuple_Size(samps) != nchannels) { -+ PyErr_SetString(AudioopError, -+ "illegal state argument"); -+ goto exit; -+ } -+ for (chan = 0; chan < nchannels; chan++) { -+ if (!PyArg_ParseTuple(PyTuple_GetItem(samps, chan), -+ "ii:ratecv", &prev_i[chan], -+ &cur_i[chan])) - goto exit; - } -+ } - -- len /= bytes_per_frame; /* # of frames */ -+ /* str <- Space for the output buffer. */ -+ { -+ /* There are len input frames, so we need (mathematically) -+ ceiling(len*outrate/inrate) output frames, and each frame -+ requires bytes_per_frame bytes. Computing this -+ without spurious overflow is the challenge; we can -+ settle for a reasonable upper bound, though. */ -+ int ceiling; /* the number of output frames */ -+ int nbytes; /* the number of output bytes needed */ -+ int q = len / inrate; -+ /* Now len = q * inrate + r exactly (with r = len % inrate), -+ and this is less than q * inrate + inrate = (q+1)*inrate. -+ So a reasonable upper bound on len*outrate/inrate is -+ ((q+1)*inrate)*outrate/inrate = -+ (q+1)*outrate. -+ */ -+ ceiling = (q+1) * outrate; -+ nbytes = ceiling * bytes_per_frame; -+ /* See whether anything overflowed; if not, get the space. */ -+ if (q+1 < 0 || -+ ceiling / outrate != q+1 || -+ nbytes / bytes_per_frame != ceiling) -+ str = NULL; -+ else -+ str = PyBytes_FromStringAndSize(NULL, nbytes); - -- if (state == Py_None) { -- d = -outrate; -+ if (str == NULL) { -+ PyErr_SetString(PyExc_MemoryError, -+ "not enough memory for output buffer"); -+ goto exit; -+ } -+ } -+ ncp = PyBytes_AsString(str); -+ -+ for (;;) { -+ while (d < 0) { -+ if (len == 0) { -+ samps = PyTuple_New(nchannels); -+ if (samps == NULL) -+ goto exit; - for (chan = 0; chan < nchannels; chan++) -- prev_i[chan] = cur_i[chan] = 0; -- } -- else { -- if (!PyArg_ParseTuple(state, -- "iO!;audioop.ratecv: illegal state argument", -- &d, &PyTuple_Type, &samps)) -- goto exit; -- if (PyTuple_Size(samps) != nchannels) { -- PyErr_SetString(AudioopError, -- "illegal state argument"); -- goto exit; -- } -- for (chan = 0; chan < nchannels; chan++) { -- if (!PyArg_ParseTuple(PyTuple_GetItem(samps, chan), -- "ii:ratecv", &prev_i[chan], -- &cur_i[chan])) -- goto exit; -- } -- } -- -- /* str <- Space for the output buffer. */ -- { -- /* There are len input frames, so we need (mathematically) -- ceiling(len*outrate/inrate) output frames, and each frame -- requires bytes_per_frame bytes. Computing this -- without spurious overflow is the challenge; we can -- settle for a reasonable upper bound, though. */ -- int ceiling; /* the number of output frames */ -- int nbytes; /* the number of output bytes needed */ -- int q = len / inrate; -- /* Now len = q * inrate + r exactly (with r = len % inrate), -- and this is less than q * inrate + inrate = (q+1)*inrate. -- So a reasonable upper bound on len*outrate/inrate is -- ((q+1)*inrate)*outrate/inrate = -- (q+1)*outrate. -- */ -- ceiling = (q+1) * outrate; -- nbytes = ceiling * bytes_per_frame; -- /* See whether anything overflowed; if not, get the space. */ -- if (q+1 < 0 || -- ceiling / outrate != q+1 || -- nbytes / bytes_per_frame != ceiling) -- str = NULL; -- else -- str = PyBytes_FromStringAndSize(NULL, nbytes); -- -- if (str == NULL) { -- PyErr_SetString(PyExc_MemoryError, -- "not enough memory for output buffer"); -- goto exit; -- } -- } -- ncp = PyBytes_AsString(str); -- -- for (;;) { -- while (d < 0) { -- if (len == 0) { -- samps = PyTuple_New(nchannels); -- if (samps == NULL) -- goto exit; -- for (chan = 0; chan < nchannels; chan++) -- PyTuple_SetItem(samps, chan, -- Py_BuildValue("(ii)", -- prev_i[chan], -- cur_i[chan])); -- if (PyErr_Occurred()) -- goto exit; -- /* We have checked before that the length -- * of the string fits into int. */ -- len = (int)(ncp - PyBytes_AsString(str)); -- rv = PyBytes_FromStringAndSize -- (PyBytes_AsString(str), len); -- Py_DECREF(str); -- str = rv; -- if (str == NULL) -- goto exit; -- rv = Py_BuildValue("(O(iO))", str, d, samps); -- Py_DECREF(samps); -- Py_DECREF(str); -- goto exit; /* return rv */ -- } -- for (chan = 0; chan < nchannels; chan++) { -- prev_i[chan] = cur_i[chan]; -- if (size == 1) -- cur_i[chan] = ((int)*CHARP(cp, 0)) << 8; -- else if (size == 2) -- cur_i[chan] = (int)*SHORTP(cp, 0); -- else if (size == 4) -- cur_i[chan] = ((int)*LONGP(cp, 0)) >> 16; -- cp += size; -- /* implements a simple digital filter */ -- cur_i[chan] = -- (weightA * cur_i[chan] + -- weightB * prev_i[chan]) / -- (weightA + weightB); -- } -- len--; -- d += outrate; -- } -- while (d >= 0) { -- for (chan = 0; chan < nchannels; chan++) { -- cur_o = (prev_i[chan] * d + -- cur_i[chan] * (outrate - d)) / -- outrate; -- if (size == 1) -- *CHARP(ncp, 0) = (signed char)(cur_o >> 8); -- else if (size == 2) -- *SHORTP(ncp, 0) = (short)(cur_o); -- else if (size == 4) -- *LONGP(ncp, 0) = (Py_Int32)(cur_o<<16); -- ncp += size; -- } -- d -= inrate; -- } -+ PyTuple_SetItem(samps, chan, -+ Py_BuildValue("(ii)", -+ prev_i[chan], -+ cur_i[chan])); -+ if (PyErr_Occurred()) -+ goto exit; -+ /* We have checked before that the length -+ * of the string fits into int. */ -+ len = (int)(ncp - PyBytes_AsString(str)); -+ rv = PyBytes_FromStringAndSize -+ (PyBytes_AsString(str), len); -+ Py_DECREF(str); -+ str = rv; -+ if (str == NULL) -+ goto exit; -+ rv = Py_BuildValue("(O(iO))", str, d, samps); -+ Py_DECREF(samps); -+ Py_DECREF(str); -+ goto exit; /* return rv */ -+ } -+ for (chan = 0; chan < nchannels; chan++) { -+ prev_i[chan] = cur_i[chan]; -+ if (size == 1) -+ cur_i[chan] = ((int)*CHARP(cp, 0)) << 8; -+ else if (size == 2) -+ cur_i[chan] = (int)*SHORTP(cp, 0); -+ else if (size == 4) -+ cur_i[chan] = ((int)*LONGP(cp, 0)) >> 16; -+ cp += size; -+ /* implements a simple digital filter */ -+ cur_i[chan] = -+ (weightA * cur_i[chan] + -+ weightB * prev_i[chan]) / -+ (weightA + weightB); -+ } -+ len--; -+ d += outrate; -+ } -+ while (d >= 0) { -+ for (chan = 0; chan < nchannels; chan++) { -+ cur_o = (prev_i[chan] * d + -+ cur_i[chan] * (outrate - d)) / -+ outrate; -+ if (size == 1) -+ *CHARP(ncp, 0) = (signed char)(cur_o >> 8); -+ else if (size == 2) -+ *SHORTP(ncp, 0) = (short)(cur_o); -+ else if (size == 4) -+ *LONGP(ncp, 0) = (Py_Int32)(cur_o<<16); -+ ncp += size; -+ } -+ d -= inrate; - } -+ } - exit: -- if (prev_i != NULL) -- free(prev_i); -- if (cur_i != NULL) -- free(cur_i); -- return rv; -+ if (prev_i != NULL) -+ free(prev_i); -+ if (cur_i != NULL) -+ free(cur_i); -+ return rv; - } - - static PyObject * - audioop_lin2ulaw(PyObject *self, PyObject *args) - { -- signed char *cp; -- unsigned char *ncp; -- int len, size, val = 0; -- PyObject *rv; -- int i; -- -- if ( !PyArg_ParseTuple(args, "s#i:lin2ulaw", -- &cp, &len, &size) ) -- return 0 ; -- -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- rv = PyBytes_FromStringAndSize(NULL, len/size); -- if ( rv == 0 ) -- return 0; -- ncp = (unsigned char *)PyBytes_AsString(rv); -- -- for ( i=0; i < len; i += size ) { -- if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -- else if ( size == 2 ) val = (int)*SHORTP(cp, i); -- else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -- -- *ncp++ = st_14linear2ulaw(val); -- } -- return rv; -+ signed char *cp; -+ unsigned char *ncp; -+ int len, size, val = 0; -+ PyObject *rv; -+ int i; -+ -+ if ( !PyArg_ParseTuple(args, "s#i:lin2ulaw", -+ &cp, &len, &size) ) -+ return 0 ; -+ -+ if ( size != 1 && size != 2 && size != 4) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ rv = PyBytes_FromStringAndSize(NULL, len/size); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (unsigned char *)PyBytes_AsString(rv); -+ -+ for ( i=0; i < len; i += size ) { -+ if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -+ else if ( size == 2 ) val = (int)*SHORTP(cp, i); -+ else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -+ -+ *ncp++ = st_14linear2ulaw(val); -+ } -+ return rv; - } - - static PyObject * - audioop_ulaw2lin(PyObject *self, PyObject *args) - { -- unsigned char *cp; -- unsigned char cval; -- signed char *ncp; -- int len, new_len, size, val; -- PyObject *rv; -- int i; -- -- if ( !PyArg_ParseTuple(args, "s#i:ulaw2lin", -- &cp, &len, &size) ) -- return 0; -- -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- new_len = len*size; -- if (new_len < 0) { -- PyErr_SetString(PyExc_MemoryError, -- "not enough memory for output buffer"); -- return 0; -- } -- rv = PyBytes_FromStringAndSize(NULL, new_len); -- if ( rv == 0 ) -- return 0; -- ncp = (signed char *)PyBytes_AsString(rv); -- -- for ( i=0; i < new_len; i += size ) { -- cval = *cp++; -- val = st_ulaw2linear16(cval); -- -- if ( size == 1 ) *CHARP(ncp, i) = (signed char)(val >> 8); -- else if ( size == 2 ) *SHORTP(ncp, i) = (short)(val); -- else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)(val<<16); -- } -- return rv; -+ unsigned char *cp; -+ unsigned char cval; -+ signed char *ncp; -+ int len, new_len, size, val; -+ PyObject *rv; -+ int i; -+ -+ if ( !PyArg_ParseTuple(args, "s#i:ulaw2lin", -+ &cp, &len, &size) ) -+ return 0; -+ -+ if ( size != 1 && size != 2 && size != 4) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ new_len = len*size; -+ if (new_len < 0) { -+ PyErr_SetString(PyExc_MemoryError, -+ "not enough memory for output buffer"); -+ return 0; -+ } -+ rv = PyBytes_FromStringAndSize(NULL, new_len); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (signed char *)PyBytes_AsString(rv); -+ -+ for ( i=0; i < new_len; i += size ) { -+ cval = *cp++; -+ val = st_ulaw2linear16(cval); -+ -+ if ( size == 1 ) *CHARP(ncp, i) = (signed char)(val >> 8); -+ else if ( size == 2 ) *SHORTP(ncp, i) = (short)(val); -+ else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)(val<<16); -+ } -+ return rv; - } - - static PyObject * - audioop_lin2alaw(PyObject *self, PyObject *args) - { -- signed char *cp; -- unsigned char *ncp; -- int len, size, val = 0; -- PyObject *rv; -- int i; -- -- if ( !PyArg_ParseTuple(args, "s#i:lin2alaw", -- &cp, &len, &size) ) -- return 0; -- -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- rv = PyBytes_FromStringAndSize(NULL, len/size); -- if ( rv == 0 ) -- return 0; -- ncp = (unsigned char *)PyBytes_AsString(rv); -- -- for ( i=0; i < len; i += size ) { -- if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -- else if ( size == 2 ) val = (int)*SHORTP(cp, i); -- else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -- -- *ncp++ = st_linear2alaw(val); -- } -- return rv; -+ signed char *cp; -+ unsigned char *ncp; -+ int len, size, val = 0; -+ PyObject *rv; -+ int i; -+ -+ if ( !PyArg_ParseTuple(args, "s#i:lin2alaw", -+ &cp, &len, &size) ) -+ return 0; -+ -+ if ( size != 1 && size != 2 && size != 4) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ rv = PyBytes_FromStringAndSize(NULL, len/size); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (unsigned char *)PyBytes_AsString(rv); -+ -+ for ( i=0; i < len; i += size ) { -+ if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -+ else if ( size == 2 ) val = (int)*SHORTP(cp, i); -+ else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -+ -+ *ncp++ = st_linear2alaw(val); -+ } -+ return rv; - } - - static PyObject * - audioop_alaw2lin(PyObject *self, PyObject *args) - { -- unsigned char *cp; -- unsigned char cval; -- signed char *ncp; -- int len, new_len, size, val; -- PyObject *rv; -- int i; -- -- if ( !PyArg_ParseTuple(args, "s#i:alaw2lin", -- &cp, &len, &size) ) -- return 0; -- -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- new_len = len*size; -- if (new_len < 0) { -- PyErr_SetString(PyExc_MemoryError, -- "not enough memory for output buffer"); -- return 0; -- } -- rv = PyBytes_FromStringAndSize(NULL, new_len); -- if ( rv == 0 ) -- return 0; -- ncp = (signed char *)PyBytes_AsString(rv); -- -- for ( i=0; i < new_len; i += size ) { -- cval = *cp++; -- val = st_alaw2linear16(cval); -- -- if ( size == 1 ) *CHARP(ncp, i) = (signed char)(val >> 8); -- else if ( size == 2 ) *SHORTP(ncp, i) = (short)(val); -- else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)(val<<16); -- } -- return rv; -+ unsigned char *cp; -+ unsigned char cval; -+ signed char *ncp; -+ int len, new_len, size, val; -+ PyObject *rv; -+ int i; -+ -+ if ( !PyArg_ParseTuple(args, "s#i:alaw2lin", -+ &cp, &len, &size) ) -+ return 0; -+ -+ if ( size != 1 && size != 2 && size != 4) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ new_len = len*size; -+ if (new_len < 0) { -+ PyErr_SetString(PyExc_MemoryError, -+ "not enough memory for output buffer"); -+ return 0; -+ } -+ rv = PyBytes_FromStringAndSize(NULL, new_len); -+ if ( rv == 0 ) -+ return 0; -+ ncp = (signed char *)PyBytes_AsString(rv); -+ -+ for ( i=0; i < new_len; i += size ) { -+ cval = *cp++; -+ val = st_alaw2linear16(cval); -+ -+ if ( size == 1 ) *CHARP(ncp, i) = (signed char)(val >> 8); -+ else if ( size == 2 ) *SHORTP(ncp, i) = (short)(val); -+ else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)(val<<16); -+ } -+ return rv; - } - - static PyObject * - audioop_lin2adpcm(PyObject *self, PyObject *args) - { -- signed char *cp; -- signed char *ncp; -- int len, size, val = 0, step, valpred, delta, -- index, sign, vpdiff, diff; -- PyObject *rv, *state, *str; -- int i, outputbuffer = 0, bufferstep; -- -- if ( !PyArg_ParseTuple(args, "s#iO:lin2adpcm", -- &cp, &len, &size, &state) ) -- return 0; -- -- -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- str = PyBytes_FromStringAndSize(NULL, len/(size*2)); -- if ( str == 0 ) -- return 0; -- ncp = (signed char *)PyBytes_AsString(str); -- -- /* Decode state, should have (value, step) */ -- if ( state == Py_None ) { -- /* First time, it seems. Set defaults */ -- valpred = 0; -- step = 7; -- index = 0; -- } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) -- return 0; -+ signed char *cp; -+ signed char *ncp; -+ int len, size, val = 0, step, valpred, delta, -+ index, sign, vpdiff, diff; -+ PyObject *rv, *state, *str; -+ int i, outputbuffer = 0, bufferstep; -+ -+ if ( !PyArg_ParseTuple(args, "s#iO:lin2adpcm", -+ &cp, &len, &size, &state) ) -+ return 0; -+ -+ -+ if ( size != 1 && size != 2 && size != 4) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ str = PyBytes_FromStringAndSize(NULL, len/(size*2)); -+ if ( str == 0 ) -+ return 0; -+ ncp = (signed char *)PyBytes_AsString(str); -+ -+ /* Decode state, should have (value, step) */ -+ if ( state == Py_None ) { -+ /* First time, it seems. Set defaults */ -+ valpred = 0; -+ step = 7; -+ index = 0; -+ } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) -+ return 0; -+ -+ step = stepsizeTable[index]; -+ bufferstep = 1; -+ -+ for ( i=0; i < len; i += size ) { -+ if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -+ else if ( size == 2 ) val = (int)*SHORTP(cp, i); -+ else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -+ -+ /* Step 1 - compute difference with previous value */ -+ diff = val - valpred; -+ sign = (diff < 0) ? 8 : 0; -+ if ( sign ) diff = (-diff); -+ -+ /* Step 2 - Divide and clamp */ -+ /* Note: -+ ** This code *approximately* computes: -+ ** delta = diff*4/step; -+ ** vpdiff = (delta+0.5)*step/4; -+ ** but in shift step bits are dropped. The net result of this -+ ** is that even if you have fast mul/div hardware you cannot -+ ** put it to good use since the fixup would be too expensive. -+ */ -+ delta = 0; -+ vpdiff = (step >> 3); - -+ if ( diff >= step ) { -+ delta = 4; -+ diff -= step; -+ vpdiff += step; -+ } -+ step >>= 1; -+ if ( diff >= step ) { -+ delta |= 2; -+ diff -= step; -+ vpdiff += step; -+ } -+ step >>= 1; -+ if ( diff >= step ) { -+ delta |= 1; -+ vpdiff += step; -+ } -+ -+ /* Step 3 - Update previous value */ -+ if ( sign ) -+ valpred -= vpdiff; -+ else -+ valpred += vpdiff; -+ -+ /* Step 4 - Clamp previous value to 16 bits */ -+ if ( valpred > 32767 ) -+ valpred = 32767; -+ else if ( valpred < -32768 ) -+ valpred = -32768; -+ -+ /* Step 5 - Assemble value, update index and step values */ -+ delta |= sign; -+ -+ index += indexTable[delta]; -+ if ( index < 0 ) index = 0; -+ if ( index > 88 ) index = 88; - step = stepsizeTable[index]; -- bufferstep = 1; - -- for ( i=0; i < len; i += size ) { -- if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; -- else if ( size == 2 ) val = (int)*SHORTP(cp, i); -- else if ( size == 4 ) val = ((int)*LONGP(cp, i)) >> 16; -- -- /* Step 1 - compute difference with previous value */ -- diff = val - valpred; -- sign = (diff < 0) ? 8 : 0; -- if ( sign ) diff = (-diff); -- -- /* Step 2 - Divide and clamp */ -- /* Note: -- ** This code *approximately* computes: -- ** delta = diff*4/step; -- ** vpdiff = (delta+0.5)*step/4; -- ** but in shift step bits are dropped. The net result of this -- ** is that even if you have fast mul/div hardware you cannot -- ** put it to good use since the fixup would be too expensive. -- */ -- delta = 0; -- vpdiff = (step >> 3); -- -- if ( diff >= step ) { -- delta = 4; -- diff -= step; -- vpdiff += step; -- } -- step >>= 1; -- if ( diff >= step ) { -- delta |= 2; -- diff -= step; -- vpdiff += step; -- } -- step >>= 1; -- if ( diff >= step ) { -- delta |= 1; -- vpdiff += step; -- } -- -- /* Step 3 - Update previous value */ -- if ( sign ) -- valpred -= vpdiff; -- else -- valpred += vpdiff; -- -- /* Step 4 - Clamp previous value to 16 bits */ -- if ( valpred > 32767 ) -- valpred = 32767; -- else if ( valpred < -32768 ) -- valpred = -32768; -- -- /* Step 5 - Assemble value, update index and step values */ -- delta |= sign; -- -- index += indexTable[delta]; -- if ( index < 0 ) index = 0; -- if ( index > 88 ) index = 88; -- step = stepsizeTable[index]; -- -- /* Step 6 - Output value */ -- if ( bufferstep ) { -- outputbuffer = (delta << 4) & 0xf0; -- } else { -- *ncp++ = (delta & 0x0f) | outputbuffer; -- } -- bufferstep = !bufferstep; -+ /* Step 6 - Output value */ -+ if ( bufferstep ) { -+ outputbuffer = (delta << 4) & 0xf0; -+ } else { -+ *ncp++ = (delta & 0x0f) | outputbuffer; - } -- rv = Py_BuildValue("(O(ii))", str, valpred, index); -- Py_DECREF(str); -- return rv; -+ bufferstep = !bufferstep; -+ } -+ rv = Py_BuildValue("(O(ii))", str, valpred, index); -+ Py_DECREF(str); -+ return rv; - } - - static PyObject * - audioop_adpcm2lin(PyObject *self, PyObject *args) - { -- signed char *cp; -- signed char *ncp; -- int len, new_len, size, valpred, step, delta, index, sign, vpdiff; -- PyObject *rv, *str, *state; -- int i, inputbuffer = 0, bufferstep; -- -- if ( !PyArg_ParseTuple(args, "s#iO:adpcm2lin", -- &cp, &len, &size, &state) ) -- return 0; -- -- if ( size != 1 && size != 2 && size != 4) { -- PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -- return 0; -- } -- -- /* Decode state, should have (value, step) */ -- if ( state == Py_None ) { -- /* First time, it seems. Set defaults */ -- valpred = 0; -- step = 7; -- index = 0; -- } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) -- return 0; -- -- new_len = len*size*2; -- if (new_len < 0) { -- PyErr_SetString(PyExc_MemoryError, -- "not enough memory for output buffer"); -- return 0; -+ signed char *cp; -+ signed char *ncp; -+ int len, new_len, size, valpred, step, delta, index, sign, vpdiff; -+ PyObject *rv, *str, *state; -+ int i, inputbuffer = 0, bufferstep; -+ -+ if ( !PyArg_ParseTuple(args, "s#iO:adpcm2lin", -+ &cp, &len, &size, &state) ) -+ return 0; -+ -+ if ( size != 1 && size != 2 && size != 4) { -+ PyErr_SetString(AudioopError, "Size should be 1, 2 or 4"); -+ return 0; -+ } -+ -+ /* Decode state, should have (value, step) */ -+ if ( state == Py_None ) { -+ /* First time, it seems. Set defaults */ -+ valpred = 0; -+ step = 7; -+ index = 0; -+ } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) -+ return 0; -+ -+ new_len = len*size*2; -+ if (new_len < 0) { -+ PyErr_SetString(PyExc_MemoryError, -+ "not enough memory for output buffer"); -+ return 0; -+ } -+ str = PyBytes_FromStringAndSize(NULL, new_len); -+ if ( str == 0 ) -+ return 0; -+ ncp = (signed char *)PyBytes_AsString(str); -+ -+ step = stepsizeTable[index]; -+ bufferstep = 0; -+ -+ for ( i=0; i < new_len; i += size ) { -+ /* Step 1 - get the delta value and compute next index */ -+ if ( bufferstep ) { -+ delta = inputbuffer & 0xf; -+ } else { -+ inputbuffer = *cp++; -+ delta = (inputbuffer >> 4) & 0xf; - } -- str = PyBytes_FromStringAndSize(NULL, new_len); -- if ( str == 0 ) -- return 0; -- ncp = (signed char *)PyBytes_AsString(str); - -+ bufferstep = !bufferstep; -+ -+ /* Step 2 - Find new index value (for later) */ -+ index += indexTable[delta]; -+ if ( index < 0 ) index = 0; -+ if ( index > 88 ) index = 88; -+ -+ /* Step 3 - Separate sign and magnitude */ -+ sign = delta & 8; -+ delta = delta & 7; -+ -+ /* Step 4 - Compute difference and new predicted value */ -+ /* -+ ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment -+ ** in adpcm_coder. -+ */ -+ vpdiff = step >> 3; -+ if ( delta & 4 ) vpdiff += step; -+ if ( delta & 2 ) vpdiff += step>>1; -+ if ( delta & 1 ) vpdiff += step>>2; -+ -+ if ( sign ) -+ valpred -= vpdiff; -+ else -+ valpred += vpdiff; -+ -+ /* Step 5 - clamp output value */ -+ if ( valpred > 32767 ) -+ valpred = 32767; -+ else if ( valpred < -32768 ) -+ valpred = -32768; -+ -+ /* Step 6 - Update step value */ - step = stepsizeTable[index]; -- bufferstep = 0; -- -- for ( i=0; i < new_len; i += size ) { -- /* Step 1 - get the delta value and compute next index */ -- if ( bufferstep ) { -- delta = inputbuffer & 0xf; -- } else { -- inputbuffer = *cp++; -- delta = (inputbuffer >> 4) & 0xf; -- } -- -- bufferstep = !bufferstep; -- -- /* Step 2 - Find new index value (for later) */ -- index += indexTable[delta]; -- if ( index < 0 ) index = 0; -- if ( index > 88 ) index = 88; -- -- /* Step 3 - Separate sign and magnitude */ -- sign = delta & 8; -- delta = delta & 7; -- -- /* Step 4 - Compute difference and new predicted value */ -- /* -- ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment -- ** in adpcm_coder. -- */ -- vpdiff = step >> 3; -- if ( delta & 4 ) vpdiff += step; -- if ( delta & 2 ) vpdiff += step>>1; -- if ( delta & 1 ) vpdiff += step>>2; -- -- if ( sign ) -- valpred -= vpdiff; -- else -- valpred += vpdiff; -- -- /* Step 5 - clamp output value */ -- if ( valpred > 32767 ) -- valpred = 32767; -- else if ( valpred < -32768 ) -- valpred = -32768; -- -- /* Step 6 - Update step value */ -- step = stepsizeTable[index]; -- -- /* Step 6 - Output value */ -- if ( size == 1 ) *CHARP(ncp, i) = (signed char)(valpred >> 8); -- else if ( size == 2 ) *SHORTP(ncp, i) = (short)(valpred); -- else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)(valpred<<16); -- } - -- rv = Py_BuildValue("(O(ii))", str, valpred, index); -- Py_DECREF(str); -- return rv; -+ /* Step 6 - Output value */ -+ if ( size == 1 ) *CHARP(ncp, i) = (signed char)(valpred >> 8); -+ else if ( size == 2 ) *SHORTP(ncp, i) = (short)(valpred); -+ else if ( size == 4 ) *LONGP(ncp, i) = (Py_Int32)(valpred<<16); -+ } -+ -+ rv = Py_BuildValue("(O(ii))", str, valpred, index); -+ Py_DECREF(str); -+ return rv; - } - - static PyMethodDef audioop_methods[] = { -- { "max", audioop_max, METH_VARARGS }, -- { "minmax", audioop_minmax, METH_VARARGS }, -- { "avg", audioop_avg, METH_VARARGS }, -- { "maxpp", audioop_maxpp, METH_VARARGS }, -- { "avgpp", audioop_avgpp, METH_VARARGS }, -- { "rms", audioop_rms, METH_VARARGS }, -- { "findfit", audioop_findfit, METH_VARARGS }, -- { "findmax", audioop_findmax, METH_VARARGS }, -- { "findfactor", audioop_findfactor, METH_VARARGS }, -- { "cross", audioop_cross, METH_VARARGS }, -- { "mul", audioop_mul, METH_VARARGS }, -- { "add", audioop_add, METH_VARARGS }, -- { "bias", audioop_bias, METH_VARARGS }, -- { "ulaw2lin", audioop_ulaw2lin, METH_VARARGS }, -- { "lin2ulaw", audioop_lin2ulaw, METH_VARARGS }, -- { "alaw2lin", audioop_alaw2lin, METH_VARARGS }, -- { "lin2alaw", audioop_lin2alaw, METH_VARARGS }, -- { "lin2lin", audioop_lin2lin, METH_VARARGS }, -- { "adpcm2lin", audioop_adpcm2lin, METH_VARARGS }, -- { "lin2adpcm", audioop_lin2adpcm, METH_VARARGS }, -- { "tomono", audioop_tomono, METH_VARARGS }, -- { "tostereo", audioop_tostereo, METH_VARARGS }, -- { "getsample", audioop_getsample, METH_VARARGS }, -- { "reverse", audioop_reverse, METH_VARARGS }, -- { "ratecv", audioop_ratecv, METH_VARARGS }, -- { 0, 0 } -+ { "max", audioop_max, METH_VARARGS }, -+ { "minmax", audioop_minmax, METH_VARARGS }, -+ { "avg", audioop_avg, METH_VARARGS }, -+ { "maxpp", audioop_maxpp, METH_VARARGS }, -+ { "avgpp", audioop_avgpp, METH_VARARGS }, -+ { "rms", audioop_rms, METH_VARARGS }, -+ { "findfit", audioop_findfit, METH_VARARGS }, -+ { "findmax", audioop_findmax, METH_VARARGS }, -+ { "findfactor", audioop_findfactor, METH_VARARGS }, -+ { "cross", audioop_cross, METH_VARARGS }, -+ { "mul", audioop_mul, METH_VARARGS }, -+ { "add", audioop_add, METH_VARARGS }, -+ { "bias", audioop_bias, METH_VARARGS }, -+ { "ulaw2lin", audioop_ulaw2lin, METH_VARARGS }, -+ { "lin2ulaw", audioop_lin2ulaw, METH_VARARGS }, -+ { "alaw2lin", audioop_alaw2lin, METH_VARARGS }, -+ { "lin2alaw", audioop_lin2alaw, METH_VARARGS }, -+ { "lin2lin", audioop_lin2lin, METH_VARARGS }, -+ { "adpcm2lin", audioop_adpcm2lin, METH_VARARGS }, -+ { "lin2adpcm", audioop_lin2adpcm, METH_VARARGS }, -+ { "tomono", audioop_tomono, METH_VARARGS }, -+ { "tostereo", audioop_tostereo, METH_VARARGS }, -+ { "getsample", audioop_getsample, METH_VARARGS }, -+ { "reverse", audioop_reverse, METH_VARARGS }, -+ { "ratecv", audioop_ratecv, METH_VARARGS }, -+ { 0, 0 } - }; - - - static struct PyModuleDef audioopmodule = { -- PyModuleDef_HEAD_INIT, -- "audioop", -- NULL, -- -1, -- audioop_methods, -- NULL, -- NULL, -- NULL, -- NULL -+ PyModuleDef_HEAD_INIT, -+ "audioop", -+ NULL, -+ -1, -+ audioop_methods, -+ NULL, -+ NULL, -+ NULL, -+ NULL - }; - - PyMODINIT_FUNC - PyInit_audioop(void) - { -- PyObject *m, *d; -- m = PyModule_Create(&audioopmodule); -- if (m == NULL) -- return NULL; -- d = PyModule_GetDict(m); -- if (d == NULL) -- return NULL; -- AudioopError = PyErr_NewException("audioop.error", NULL, NULL); -- if (AudioopError != NULL) -- PyDict_SetItemString(d,"error",AudioopError); -- return m; -+ PyObject *m, *d; -+ m = PyModule_Create(&audioopmodule); -+ if (m == NULL) -+ return NULL; -+ d = PyModule_GetDict(m); -+ if (d == NULL) -+ return NULL; -+ AudioopError = PyErr_NewException("audioop.error", NULL, NULL); -+ if (AudioopError != NULL) -+ PyDict_SetItemString(d,"error",AudioopError); -+ return m; - } diff --git a/python-3.2a1-apply-our-changes-to-expected-shebang-for-test_imp.patch b/python-3.2a1-apply-our-changes-to-expected-shebang-for-test_imp.patch new file mode 100644 index 0000000..68eb618 --- /dev/null +++ b/python-3.2a1-apply-our-changes-to-expected-shebang-for-test_imp.patch @@ -0,0 +1,12 @@ +diff -up Python-3.2a1/Lib/test/test_imp.py.apply-our-changes-to-expected-shebang Python-3.2a1/Lib/test/test_imp.py +--- Python-3.2a1/Lib/test/test_imp.py.apply-our-changes-to-expected-shebang 2010-08-02 15:57:49.151002176 -0400 ++++ Python-3.2a1/Lib/test/test_imp.py 2010-08-02 15:58:40.428010729 -0400 +@@ -52,7 +52,7 @@ class ImportTests(unittest.TestCase): + self.assertNotEqual(fp, None) + self.assertEqual(fp.encoding, "iso-8859-1") + self.assertEqual(fp.tell(), 0) +- self.assertEqual(fp.readline(), '#!/usr/bin/env python3\n') ++ self.assertEqual(fp.readline(), '#!/usr/bin/python3.2\n') + fp.close() + + fp, filename, info = imp.find_module("tokenize") diff --git a/python-3.2a1-debug-build.patch b/python-3.2a1-debug-build.patch new file mode 100644 index 0000000..49fb182 --- /dev/null +++ b/python-3.2a1-debug-build.patch @@ -0,0 +1,290 @@ +diff -up Python-3.2a1/configure.in.debug-build Python-3.2a1/configure.in +--- Python-3.2a1/configure.in.debug-build 2010-08-20 16:06:24.616082276 -0400 ++++ Python-3.2a1/configure.in 2010-08-20 16:06:24.632127011 -0400 +@@ -584,7 +584,7 @@ AC_SUBST(LIBRARY) + AC_MSG_CHECKING(LIBRARY) + if test -z "$LIBRARY" + then +- LIBRARY='libpython$(VERSION).a' ++ LIBRARY='libpython$(VERSION)$(DEBUG_EXT).a' + fi + AC_MSG_RESULT($LIBRARY) + +@@ -726,8 +726,8 @@ if test $enable_shared = "yes"; then + INSTSONAME="$LDLIBRARY".$SOVERSION + ;; + Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*) +- LDLIBRARY='libpython$(VERSION).so' +- BLDLIBRARY='-L. -lpython$(VERSION)' ++ LDLIBRARY='libpython$(VERSION)$(DEBUG_EXT).so' ++ BLDLIBRARY='-L. -lpython$(VERSION)$(DEBUG_EXT)' + RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH} + case $ac_sys_system in + FreeBSD*) +@@ -825,6 +825,14 @@ else AC_MSG_RESULT(no); Py_DEBUG='false' + fi], + [AC_MSG_RESULT(no)]) + ++if test "$Py_DEBUG" = 'true' ++then ++ DEBUG_EXT=_d ++ DEBUG_SUFFIX=-debug ++fi ++AC_SUBST(DEBUG_EXT) ++AC_SUBST(DEBUG_SUFFIX) ++ + # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be + # merged with this chunk of code? + +diff -up Python-3.2a1/Lib/distutils/command/build_ext.py.debug-build Python-3.2a1/Lib/distutils/command/build_ext.py +--- Python-3.2a1/Lib/distutils/command/build_ext.py.debug-build 2010-07-22 08:50:05.000000000 -0400 ++++ Python-3.2a1/Lib/distutils/command/build_ext.py 2010-08-20 16:06:24.633125472 -0400 +@@ -673,7 +673,10 @@ class build_ext(Command): + so_ext = get_config_var('SO') + if os.name == 'nt' and self.debug: + return os.path.join(*ext_path) + '_d' + so_ext +- return os.path.join(*ext_path) + so_ext ++ ++ # Similarly, extensions in debug mode are named 'module_d.so', to ++ # avoid adding the _d to the SO config variable: ++ return os.path.join(*ext_path) + (sys.pydebug and "_d" or "") + so_ext + + def get_export_symbols(self, ext): + """Return the list of symbols that a shared extension has to +@@ -754,6 +757,8 @@ class build_ext(Command): + template = "python%d.%d" + pythonlib = (template % + (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff)) ++ if sys.pydebug: ++ pythonlib += '_d' + return ext.libraries + [pythonlib] + else: + return ext.libraries +diff -up Python-3.2a1/Lib/distutils/sysconfig.py.debug-build Python-3.2a1/Lib/distutils/sysconfig.py +--- Python-3.2a1/Lib/distutils/sysconfig.py.debug-build 2010-08-20 16:06:24.623083865 -0400 ++++ Python-3.2a1/Lib/distutils/sysconfig.py 2010-08-20 16:06:24.633125472 -0400 +@@ -83,7 +83,8 @@ def get_python_inc(plat_specific=0, pref + else: + incdir = os.path.join(get_config_var('srcdir'), 'Include') + return os.path.normpath(incdir) +- return os.path.join(prefix, "include", "python" + get_python_version()) ++ return os.path.join(prefix, "include", ++ "python" + get_python_version() + (sys.pydebug and '-debug' or '')) + elif os.name == "nt": + return os.path.join(prefix, "include") + elif os.name == "mac": +@@ -229,7 +230,7 @@ def get_makefile_filename(): + if python_build: + return os.path.join(os.path.dirname(sys.executable), "Makefile") + lib_dir = get_python_lib(plat_specific=1, standard_lib=1) +- return os.path.join(lib_dir, "config", "Makefile") ++ return os.path.join(lib_dir, "config" + (sys.pydebug and "-debug" or ""), "Makefile") + + + def parse_config_h(fp, g=None): +diff -up Python-3.2a1/Makefile.pre.in.debug-build Python-3.2a1/Makefile.pre.in +--- Python-3.2a1/Makefile.pre.in.debug-build 2010-08-20 16:06:24.624081000 -0400 ++++ Python-3.2a1/Makefile.pre.in 2010-08-20 16:06:57.287084214 -0400 +@@ -105,8 +105,8 @@ SCRIPTDIR= $(prefix)/lib64 + # Detailed destination directories + BINLIBDEST= $(LIBDIR)/python$(VERSION) + LIBDEST= $(SCRIPTDIR)/python$(VERSION) +-INCLUDEPY= $(INCLUDEDIR)/python$(VERSION) +-CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION) ++INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX) ++CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)$(DEBUG_SUFFIX) + LIBP= $(LIBDIR)/python$(VERSION) + + # Symbols used for using shared libraries +@@ -120,6 +120,12 @@ DESTSHARED= $(BINLIBDEST)/lib-dynload + EXE= @EXEEXT@ + BUILDEXE= @BUILDEXEEXT@ + ++# DEBUG_EXT is used by ELF files (names and SONAMEs); it will be "_d" for a debug build ++# DEBUG_SUFFIX is used by filesystem paths; it will be "-debug" for a debug build ++# Both will be empty in an optimized build ++DEBUG_EXT= @DEBUG_EXT@ ++DEBUG_SUFFIX= @DEBUG_SUFFIX@ ++ + # Short name and location for Mac OS X Python framework + UNIVERSALSDK=@UNIVERSALSDK@ + PYTHONFRAMEWORK= @PYTHONFRAMEWORK@ +@@ -183,7 +189,7 @@ LIBOBJDIR= Python/ + LIBOBJS= @LIBOBJS@ + + PYTHON= python$(EXE) +-BUILDPYTHON= python$(BUILDEXE) ++BUILDPYTHON= python$(BUILD_SUFFIX)$(BUILDEXE) + + # The task to run while instrument when building the profile-opt target + PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck +@@ -433,7 +439,7 @@ sharedmods: $(BUILDPYTHON) + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(PY_LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ + esac + +-libpython$(VERSION).so: $(LIBRARY_OBJS) ++libpython$(VERSION)$(DEBUG_EXT).so: $(LIBRARY_OBJS) + if test $(INSTSONAME) != $(LDLIBRARY); then \ + $(LDSHARED) $(PY_LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ + $(LN) -f $(INSTSONAME) $@; \ +@@ -817,7 +823,7 @@ altbininstall: $(BUILDPYTHON) + else true; \ + fi; \ + done +- $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) ++ $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)$(EXE) + if test -f $(LDLIBRARY); then \ + if test -n "$(DLLLIBRARY)" ; then \ + $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \ +@@ -831,15 +837,15 @@ altbininstall: $(BUILDPYTHON) + fi + + bininstall: altbininstall +- -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE); \ +- then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(EXE); \ ++ -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(DEBUG_SUFFIX)$(EXE) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON)3$(DEBUG_SUFFIX)$(EXE); \ ++ then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON)3$(DEBUG_SUFFIX)$(EXE); \ + else true; \ + fi +- (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)3$(EXE)) +- -rm -f $(DESTDIR)$(BINDIR)/python3-config +- (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config) +- -rm -f $(DESTDIR)$(LIBPC)/python3.pc +- (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc) ++ (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(DEBUG_SUFFIX)$(EXE) $(PYTHON)3$(DEBUG_SUFFIX)$(EXE)) ++ -rm -f $(DESTDIR)$(BINDIR)/python3$(DEBUG_SUFFIX)-config ++ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(DEBUG_SUFFIX)-config python3$(DEBUG_SUFFIX)-config) ++ -rm -f $(DESTDIR)$(LIBPC)/python3$(DEBUG_SUFFIX).pc ++ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)$(DEBUG_SUFFIX).pc python3$(DEBUG_SUFFIX).pc) + + # Install the manual page + maninstall: +@@ -965,10 +971,10 @@ $(srcdir)/Lib/$(PLATDIR): + export EXE; EXE="$(BUILDEXE)"; \ + cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen + +-python-config: $(srcdir)/Misc/python-config.in ++python$(DEBUG_SUFFIX)-config: $(srcdir)/Misc/python-config.in + # Substitution happens here, as the completely-expanded BINDIR + # is not available in configure +- sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config ++ sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)$(EXE)," < $(srcdir)/Misc/python-config.in >python$(DEBUG_SUFFIX)-config + + # Install the include files + INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY) +@@ -990,12 +996,12 @@ inclinstall: + + # Install the library and miscellaneous stuff needed for extending/embedding + # This goes into $(exec_prefix) +-LIBPL= $(LIBP)/config ++LIBPL= $(LIBP)/config$(DEBUG_SUFFIX) + + # pkgconfig directory + LIBPC= $(LIBDIR)/pkgconfig + +-libainstall: all python-config ++libainstall: all python$(DEBUG_SUFFIX)-config + @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \ + do \ + if test ! -d $(DESTDIR)$$i; then \ +@@ -1011,11 +1017,11 @@ libainstall: all python-config + $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup + $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local + $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config +- $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc ++ $(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION)$(DEBUG_SUFFIX).pc + $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup + $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh +- $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config +- rm python-config ++ $(INSTALL_SCRIPT) python$(DEBUG_SUFFIX)-config $(DESTDIR)$(BINDIR)/python$(VERSION)$(DEBUG_SUFFIX)-config ++ rm python$(DEBUG_SUFFIX)-config + @if [ -s Modules/python.exp -a \ + "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ + echo; echo "Installing support files for building shared extension modules on AIX:"; \ +diff -up Python-3.2a1/Misc/python-config.in.debug-build Python-3.2a1/Misc/python-config.in +--- Python-3.2a1/Misc/python-config.in.debug-build 2010-04-06 17:30:42.000000000 -0400 ++++ Python-3.2a1/Misc/python-config.in 2010-08-20 16:06:24.635124366 -0400 +@@ -45,7 +45,7 @@ for opt in opt_flags: + + elif opt in ('--libs', '--ldflags'): + libs = getvar('LIBS').split() + getvar('SYSLIBS').split() +- libs.append('-lpython'+pyver) ++ libs.append('-lpython' + pyver + (sys.pydebug and "_d" or "")) + # add the prefix/lib/pythonX.Y/config dir, but only if there is no + # shared library in prefix/lib/. + if opt == '--ldflags': +diff -up Python-3.2a1/Modules/makesetup.debug-build Python-3.2a1/Modules/makesetup +--- Python-3.2a1/Modules/makesetup.debug-build 2010-07-09 12:30:58.000000000 -0400 ++++ Python-3.2a1/Modules/makesetup 2010-08-20 16:06:24.635124366 -0400 +@@ -233,7 +233,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | + *$mod.o*) base=$mod;; + *) base=${mod}module;; + esac +- file="$srcdir/$base\$(SO)" ++ file="$srcdir/$base\$(DEBUG_EXT)\$(SO)" + case $doconfig in + no) SHAREDMODS="$SHAREDMODS $file";; + esac +diff -up Python-3.2a1/Python/dynload_shlib.c.debug-build Python-3.2a1/Python/dynload_shlib.c +--- Python-3.2a1/Python/dynload_shlib.c.debug-build 2010-05-09 11:52:27.000000000 -0400 ++++ Python-3.2a1/Python/dynload_shlib.c 2010-08-20 16:06:24.635124366 -0400 +@@ -46,11 +46,16 @@ const struct filedescr _PyImport_DynLoad + {"module.exe", "rb", C_EXTENSION}, + {"MODULE.EXE", "rb", C_EXTENSION}, + #else ++#ifdef Py_DEBUG ++ {"_d.so", "rb", C_EXTENSION}, ++ {"module_d.so", "rb", C_EXTENSION}, ++#else + {".so", "rb", C_EXTENSION}, + {"module.so", "rb", C_EXTENSION}, +-#endif +-#endif +-#endif ++#endif /* Py_DEBUG */ ++#endif /* __VMS */ ++#endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */ ++#endif /* __CYGWIN__ */ + {0, 0} + }; + +diff -up Python-3.2a1/Python/sysmodule.c.debug-build Python-3.2a1/Python/sysmodule.c +--- Python-3.2a1/Python/sysmodule.c.debug-build 2010-07-06 06:53:30.000000000 -0400 ++++ Python-3.2a1/Python/sysmodule.c 2010-08-20 16:06:24.636251716 -0400 +@@ -1598,6 +1598,12 @@ _PySys_Init(void) + WindowsVersionType.tp_new = NULL; + #endif + ++#ifdef Py_DEBUG ++ PyDict_SetItemString(sysdict, "pydebug", Py_True); ++#else ++ PyDict_SetItemString(sysdict, "pydebug", Py_False); ++#endif ++ + /* float repr style: 0.03 (short) vs 0.029999999999999999 (legacy) */ + #ifndef PY_NO_SHORT_FLOAT_REPR + SET_SYS_FROM_STRING("float_repr_style", +diff -up Python-3.2a1/runtests.sh.debug-build Python-3.2a1/runtests.sh +--- Python-3.2a1/runtests.sh.debug-build 2008-10-17 08:05:40.000000000 -0400 ++++ Python-3.2a1/runtests.sh 2010-08-20 16:06:24.637251276 -0400 +@@ -16,11 +16,14 @@ Flags (arguments starting with '-') are + regrtest.py, except for -x, which is processed here." + + # Choose the Python binary. +-case `uname` in +-Darwin) PYTHON=./python.exe;; +-CYGWIN*) PYTHON=./python.exe;; +-*) PYTHON=./python;; +-esac ++if [ -z $PYTHON ] ++then ++ case `uname` in ++ Darwin) PYTHON=./python.exe;; ++ CYGWIN*) PYTHON=./python.exe;; ++ *) PYTHON=./python;; ++ esac ++fi + + PYTHON="$PYTHON -bb" + diff --git a/python-3.2a1-fix-parallel-make.patch b/python-3.2a1-fix-parallel-make.patch new file mode 100644 index 0000000..b6189b5 --- /dev/null +++ b/python-3.2a1-fix-parallel-make.patch @@ -0,0 +1,37 @@ +diff -up Python-3.2a1/Makefile.pre.in.parallel-grammar Python-3.2a1/Makefile.pre.in +--- Python-3.2a1/Makefile.pre.in.parallel-grammar 2010-08-20 15:09:13.613527156 -0400 ++++ Python-3.2a1/Makefile.pre.in 2010-08-20 15:10:31.428135355 -0400 +@@ -222,6 +222,7 @@ IO_OBJS= \ + + ########################################################################## + # Grammar ++GRAMMAR_STAMP= $(srcdir)/grammar-stamp + GRAMMAR_H= $(srcdir)/Include/graminit.h + GRAMMAR_C= $(srcdir)/Python/graminit.c + GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar +@@ -557,9 +558,24 @@ Modules/python.o: $(srcdir)/Modules/pyth + + $(IO_OBJS): $(IO_H) + +-$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) ++# GNU "make" interprets rules with two dependents as two copies of the rule. ++# ++# In a parallel build this can lead to pgen being run twice, once for each of ++# GRAMMAR_H and GRAMMAR_C, leading to race conditions in which the compiler ++# reads a partially-overwritten copy of one of these files, leading to syntax ++# errors (or linker errors if the fragment happens to be syntactically valid C) ++# ++# See http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html ++# for more information ++# ++# Introduce ".grammar-stamp" as a contrived single output from PGEN to avoid ++# this: ++$(GRAMMAR_H) $(GRAMMAR_C): $(GRAMMAR_STAMP) ++ ++$(GRAMMAR_STAMP): $(PGEN) $(GRAMMAR_INPUT) + -@$(INSTALL) -d Include + -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) ++ touch $(GRAMMAR_STAMP) + + $(PGEN): $(PGENOBJS) + $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) diff --git a/python-3.2a1-lib64.patch b/python-3.2a1-lib64.patch new file mode 100644 index 0000000..d778b5a --- /dev/null +++ b/python-3.2a1-lib64.patch @@ -0,0 +1,146 @@ +diff -up Python-3.2a1/Lib/distutils/command/install.py.lib64 Python-3.2a1/Lib/distutils/command/install.py +--- Python-3.2a1/Lib/distutils/command/install.py.lib64 2010-07-22 08:50:05.000000000 -0400 ++++ Python-3.2a1/Lib/distutils/command/install.py 2010-08-02 18:33:15.667001759 -0400 +@@ -47,14 +47,14 @@ else: + INSTALL_SCHEMES = { + 'unix_prefix': { + 'purelib': '$base/lib/python$py_version_short/site-packages', +- 'platlib': '$platbase/lib/python$py_version_short/site-packages', ++ 'platlib': '$platbase/lib64/python$py_version_short/site-packages', + 'headers': '$base/include/python$py_version_short/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', + }, + 'unix_home': { + 'purelib': '$base/lib/python', +- 'platlib': '$base/lib/python', ++ 'platlib': '$base/lib64/python', + 'headers': '$base/include/python/$dist_name', + 'scripts': '$base/bin', + 'data' : '$base', +diff -up Python-3.2a1/Lib/distutils/sysconfig.py.lib64 Python-3.2a1/Lib/distutils/sysconfig.py +--- Python-3.2a1/Lib/distutils/sysconfig.py.lib64 2010-07-23 05:43:17.000000000 -0400 ++++ Python-3.2a1/Lib/distutils/sysconfig.py 2010-08-02 18:33:15.669000547 -0400 +@@ -117,8 +117,12 @@ def get_python_lib(plat_specific=0, stan + prefix = plat_specific and EXEC_PREFIX or PREFIX + + if os.name == "posix": ++ if plat_specific or standard_lib: ++ lib = "lib64" ++ else: ++ lib = "lib" + libpython = os.path.join(prefix, +- "lib", "python" + get_python_version()) ++ lib, "python" + get_python_version()) + if standard_lib: + return libpython + else: +diff -up Python-3.2a1/Lib/site.py.lib64 Python-3.2a1/Lib/site.py +--- Python-3.2a1/Lib/site.py.lib64 2010-06-27 17:45:24.000000000 -0400 ++++ Python-3.2a1/Lib/site.py 2010-08-02 18:34:30.584001242 -0400 +@@ -283,12 +283,16 @@ def getsitepackages(): + if sys.platform in ('os2emx', 'riscos'): + sitepackages.append(os.path.join(prefix, "Lib", "site-packages")) + elif os.sep == '/': ++ sitepackages.append(os.path.join(prefix, "lib64", ++ "python" + sys.version[:3], ++ "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", + "python" + sys.version[:3], + "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", "site-python")) + else: + sitepackages.append(prefix) ++ sitepackages.append(os.path.join(prefix, "lib64", "site-packages")) + sitepackages.append(os.path.join(prefix, "lib", "site-packages")) + if sys.platform == "darwin": + # for framework builds *only* we add the standard Apple +diff -up Python-3.2a1/Makefile.pre.in.lib64 Python-3.2a1/Makefile.pre.in +--- Python-3.2a1/Makefile.pre.in.lib64 2010-08-02 18:33:15.000000000 -0400 ++++ Python-3.2a1/Makefile.pre.in 2010-08-02 18:35:07.147000664 -0400 +@@ -100,7 +100,7 @@ LIBDIR= @libdir@ + MANDIR= @mandir@ + INCLUDEDIR= @includedir@ + CONFINCLUDEDIR= $(exec_prefix)/include +-SCRIPTDIR= $(prefix)/lib ++SCRIPTDIR= $(prefix)/lib64 + + # Detailed destination directories + BINLIBDEST= $(LIBDIR)/python$(VERSION) +diff -up Python-3.2a1/Modules/getpath.c.lib64 Python-3.2a1/Modules/getpath.c +--- Python-3.2a1/Modules/getpath.c.lib64 2010-07-23 12:05:35.000000000 -0400 ++++ Python-3.2a1/Modules/getpath.c 2010-08-02 18:35:50.857000717 -0400 +@@ -117,8 +117,8 @@ + #endif + + #ifndef PYTHONPATH +-#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \ +- EXEC_PREFIX "/lib/python" VERSION "/lib-dynload" ++#define PYTHONPATH PREFIX "/lib64/python" VERSION ":" \ ++ EXEC_PREFIX "/lib64/python" VERSION "/lib-dynload" + #endif + + #ifndef LANDMARK +@@ -129,7 +129,7 @@ static wchar_t prefix[MAXPATHLEN+1]; + static wchar_t exec_prefix[MAXPATHLEN+1]; + static wchar_t progpath[MAXPATHLEN+1]; + static wchar_t *module_search_path = NULL; +-static wchar_t *lib_python = L"lib/python" VERSION; ++static wchar_t *lib_python = L"lib64/python" VERSION; + + /* In principle, this should use HAVE__WSTAT, and _wstat + should be detected by autoconf. However, no current +@@ -603,7 +603,7 @@ calculate_path(void) + } + else + wcsncpy(zip_path, L"" PREFIX, MAXPATHLEN); +- joinpath(zip_path, L"lib/python00.zip"); ++ joinpath(zip_path, L"lib64/python00.zip"); + bufsz = wcslen(zip_path); /* Replace "00" with version */ + zip_path[bufsz - 6] = VERSION[0]; + zip_path[bufsz - 5] = VERSION[2]; +@@ -613,7 +613,7 @@ calculate_path(void) + fprintf(stderr, + "Could not find platform dependent libraries \n"); + wcsncpy(exec_prefix, L"" EXEC_PREFIX, MAXPATHLEN); +- joinpath(exec_prefix, L"lib/lib-dynload"); ++ joinpath(exec_prefix, L"lib64/lib-dynload"); + } + /* If we found EXEC_PREFIX do *not* reduce it! (Yet.) */ + +--- Python-3.2a1/setup.py.lib64 2010-07-23 15:25:47.000000000 -0400 ++++ Python-3.2a1/setup.py 2010-08-02 18:36:51.521000448 -0400 +@@ -343,7 +343,7 @@ class PyBuildExt(build_ext): + + def detect_modules(self): + # Ensure that /usr/local is always used +- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') ++ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64') + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + + # Add paths specified in the environment variables LDFLAGS and +@@ -587,11 +587,11 @@ class PyBuildExt(build_ext): + elif curses_library: + readline_libs.append(curses_library) + elif self.compiler.find_library_file(lib_dirs + +- ['/usr/lib/termcap'], ++ ['/usr/lib64/termcap'], + 'termcap'): + readline_libs.append('termcap') + exts.append( Extension('readline', ['readline.c'], +- library_dirs=['/usr/lib/termcap'], ++ library_dirs=['/usr/lib64/termcap'], + extra_link_args=readline_extra_link_args, + libraries=readline_libs) ) + else: +@@ -628,8 +628,8 @@ class PyBuildExt(build_ext): + if krb5_h: + ssl_incs += krb5_h + ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, +- ['/usr/local/ssl/lib', +- '/usr/contrib/ssl/lib/' ++ ['/usr/local/ssl/lib64', ++ '/usr/contrib/ssl/lib64/' + ] ) + + if (ssl_incs is not None and diff --git a/python-3.2a1-no-static-lib.patch b/python-3.2a1-no-static-lib.patch new file mode 100644 index 0000000..6dd8147 --- /dev/null +++ b/python-3.2a1-no-static-lib.patch @@ -0,0 +1,50 @@ +diff -up Python-3.2a1/Makefile.pre.in.no-static-lib Python-3.2a1/Makefile.pre.in +--- Python-3.2a1/Makefile.pre.in.no-static-lib 2010-07-17 16:39:23.000000000 -0400 ++++ Python-3.2a1/Makefile.pre.in 2010-08-02 16:02:28.378010008 -0400 +@@ -416,7 +416,7 @@ coverage: + + + # Build the interpreter +-$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) ++$(BUILDPYTHON): Modules/python.o $(LDLIBRARY) + $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ \ + Modules/python.o \ + $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) +@@ -432,18 +432,6 @@ sharedmods: $(BUILDPYTHON) + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(PY_LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ + esac + +-# Build static library +-# avoid long command lines, same as LIBRARY_OBJS +-$(LIBRARY): $(LIBRARY_OBJS) +- -rm -f $@ +- $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o +- $(AR) $(ARFLAGS) $@ $(PARSER_OBJS) +- $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS) +- $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) +- $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS) +- $(AR) $(ARFLAGS) $@ $(MODOBJS) +- $(RANLIB) $@ +- + libpython$(VERSION).so: $(LIBRARY_OBJS) + if test $(INSTSONAME) != $(LDLIBRARY); then \ + $(LDSHARED) $(PY_LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ +@@ -1003,18 +991,6 @@ libainstall: all python-config + else true; \ + fi; \ + done +- @if test -d $(LIBRARY); then :; else \ +- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ +- if test "$(SO)" = .dll; then \ +- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ +- else \ +- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +- fi; \ +- else \ +- echo Skip install of $(LIBRARY) - use make frameworkinstall; \ +- fi; \ +- fi + $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c + $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o + $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in diff --git a/python-3.2a1-remove-mimeaudio-tests.patch b/python-3.2a1-remove-mimeaudio-tests.patch new file mode 100644 index 0000000..ff67690 --- /dev/null +++ b/python-3.2a1-remove-mimeaudio-tests.patch @@ -0,0 +1,57 @@ +diff -up Python-3.2a1/Lib/email/test/test_email.py.remove-mimeaudio-tests Python-3.2a1/Lib/email/test/test_email.py +--- Python-3.2a1/Lib/email/test/test_email.py.remove-mimeaudio-tests 2010-08-02 15:52:12.397002172 -0400 ++++ Python-3.2a1/Lib/email/test/test_email.py 2010-08-02 15:52:38.132999850 -0400 +@@ -952,53 +952,6 @@ Blah blah blah + + + +-# Test the basic MIMEAudio class +-class TestMIMEAudio(unittest.TestCase): +- def setUp(self): +- # Make sure we pick up the audiotest.au that lives in email/test/data. +- # In Python, there's an audiotest.au living in Lib/test but that isn't +- # included in some binary distros that don't include the test +- # package. The trailing empty string on the .join() is significant +- # since findfile() will do a dirname(). +- datadir = os.path.join(os.path.dirname(landmark), 'data', '') +- with open(findfile('audiotest.au', datadir), 'rb') as fp: +- self._audiodata = fp.read() +- self._au = MIMEAudio(self._audiodata) +- +- def test_guess_minor_type(self): +- self.assertEqual(self._au.get_content_type(), 'audio/basic') +- +- def test_encoding(self): +- payload = self._au.get_payload() +- self.assertEqual(base64.decodebytes(bytes(payload, 'ascii')), +- self._audiodata) +- +- def test_checkSetMinor(self): +- au = MIMEAudio(self._audiodata, 'fish') +- self.assertEqual(au.get_content_type(), 'audio/fish') +- +- def test_add_header(self): +- eq = self.assertEqual +- unless = self.assertTrue +- self._au.add_header('Content-Disposition', 'attachment', +- filename='audiotest.au') +- eq(self._au['content-disposition'], +- 'attachment; filename="audiotest.au"') +- eq(self._au.get_params(header='content-disposition'), +- [('attachment', ''), ('filename', 'audiotest.au')]) +- eq(self._au.get_param('filename', header='content-disposition'), +- 'audiotest.au') +- missing = [] +- eq(self._au.get_param('attachment', header='content-disposition'), '') +- unless(self._au.get_param('foo', failobj=missing, +- header='content-disposition') is missing) +- # Try some missing stuff +- unless(self._au.get_param('foobar', missing) is missing) +- unless(self._au.get_param('attachment', missing, +- header='foobar') is missing) +- +- +- + # Test the basic MIMEImage class + class TestMIMEImage(unittest.TestCase): + def setUp(self): diff --git a/python-3.2a1-statvfs-f_flag-constants.patch b/python-3.2a1-statvfs-f_flag-constants.patch new file mode 100644 index 0000000..b666c1b --- /dev/null +++ b/python-3.2a1-statvfs-f_flag-constants.patch @@ -0,0 +1,47 @@ +diff -up Python-3.2a1/Modules/posixmodule.c.statvfs-f-flag-constants Python-3.2a1/Modules/posixmodule.c +--- Python-3.2a1/Modules/posixmodule.c.statvfs-f-flag-constants 2010-07-23 09:53:51.000000000 -0400 ++++ Python-3.2a1/Modules/posixmodule.c 2010-08-02 16:39:38.756000423 -0400 +@@ -8173,6 +8173,43 @@ all_ins(PyObject *d) + #endif + #endif + ++ /* These came from statvfs.h */ ++#ifdef ST_RDONLY ++ if (ins(d, "ST_RDONLY", (long)ST_RDONLY)) return -1; ++#endif /* ST_RDONLY */ ++#ifdef ST_NOSUID ++ if (ins(d, "ST_NOSUID", (long)ST_NOSUID)) return -1; ++#endif /* ST_NOSUID */ ++ ++ /* GNU extensions */ ++#ifdef ST_NODEV ++ if (ins(d, "ST_NODEV", (long)ST_NODEV)) return -1; ++#endif /* ST_NODEV */ ++#ifdef ST_NOEXEC ++ if (ins(d, "ST_NOEXEC", (long)ST_NOEXEC)) return -1; ++#endif /* ST_NOEXEC */ ++#ifdef ST_SYNCHRONOUS ++ if (ins(d, "ST_SYNCHRONOUS", (long)ST_SYNCHRONOUS)) return -1; ++#endif /* ST_SYNCHRONOUS */ ++#ifdef ST_MANDLOCK ++ if (ins(d, "ST_MANDLOCK", (long)ST_MANDLOCK)) return -1; ++#endif /* ST_MANDLOCK */ ++#ifdef ST_WRITE ++ if (ins(d, "ST_WRITE", (long)ST_WRITE)) return -1; ++#endif /* ST_WRITE */ ++#ifdef ST_APPEND ++ if (ins(d, "ST_APPEND", (long)ST_APPEND)) return -1; ++#endif /* ST_APPEND */ ++#ifdef ST_NOATIME ++ if (ins(d, "ST_NOATIME", (long)ST_NOATIME)) return -1; ++#endif /* ST_NOATIME */ ++#ifdef ST_NODIRATIME ++ if (ins(d, "ST_NODIRATIME", (long)ST_NODIRATIME)) return -1; ++#endif /* ST_NODIRATIME */ ++#ifdef ST_RELATIME ++ if (ins(d, "ST_RELATIME", (long)ST_RELATIME)) return -1; ++#endif /* ST_RELATIME */ ++ + #if defined(PYOS_OS2) + if (insertvalues(d)) return -1; + #endif diff --git a/python-3.2a1-systemtap.patch b/python-3.2a1-systemtap.patch new file mode 100644 index 0000000..6770b58 --- /dev/null +++ b/python-3.2a1-systemtap.patch @@ -0,0 +1,222 @@ +diff -up Python-3.2a1/configure.in.systemtap Python-3.2a1/configure.in +--- Python-3.2a1/configure.in.systemtap 2010-07-19 03:31:40.000000000 -0400 ++++ Python-3.2a1/configure.in 2010-08-02 16:19:43.809000621 -0400 +@@ -1987,6 +1987,7 @@ AC_ARG_WITH(system_expat, + AC_MSG_RESULT($with_system_expat) + + # Check for use of the system libffi library ++ + AC_MSG_CHECKING(for --with-system-ffi) + AC_ARG_WITH(system_ffi, + AS_HELP_STRING([--with-system-ffi], [build _ctypes module using an installed ffi library])) +@@ -2500,6 +2501,38 @@ if test "$with_valgrind" != no; then + OPT="-DDYNAMIC_ANNOTATIONS_ENABLED=1 $OPT" + fi + ++# Check for dtrace support ++AC_MSG_CHECKING(for --with-dtrace) ++AC_ARG_WITH(dtrace, ++ AC_HELP_STRING(--with(out)-dtrace, disable/enable dtrace support)) ++ ++if test ! -z "$with_dtrace" ++then ++ if dtrace -G -o /dev/null -s $srcdir/Include/pydtrace.d 2>/dev/null ++ then ++ AC_DEFINE(WITH_DTRACE, 1, ++ [Define if you want to compile in Dtrace support]) ++ with_dtrace="Sun" ++ DTRACEOBJS="Python/dtrace.o" ++ DTRADEHDRS="" ++ elif dtrace -h -o /dev/null -s $srcdir/Include/pydtrace.d ++ then ++ AC_DEFINE(WITH_DTRACE, 1, ++ [Define if you want to compile in Dtrace support]) ++ with_dtrace="Apple" ++ DTRACEOBJS="" ++ DTRADEHDRS="pydtrace.h" ++ else ++ with_dtrace="no" ++ fi ++else ++ with_dtrace="no" ++fi ++ ++AC_MSG_RESULT($with_dtrace) ++AC_SUBST(DTRACEOBJS) ++AC_SUBST(DTRACEHDRS) ++ + # Check for --with-wctype-functions + AC_MSG_CHECKING(for --with-wctype-functions) + AC_ARG_WITH(wctype-functions, +diff -up Python-3.2a1/Include/pydtrace.d.systemtap Python-3.2a1/Include/pydtrace.d +--- Python-3.2a1/Include/pydtrace.d.systemtap 2010-08-02 16:17:04.249000540 -0400 ++++ Python-3.2a1/Include/pydtrace.d 2010-08-02 16:17:04.249000540 -0400 +@@ -0,0 +1,10 @@ ++provider python { ++ probe function__entry(const char *, const char *, int); ++ probe function__return(const char *, const char *, int); ++}; ++ ++#pragma D attributes Evolving/Evolving/Common provider python provider ++#pragma D attributes Private/Private/Common provider python module ++#pragma D attributes Private/Private/Common provider python function ++#pragma D attributes Evolving/Evolving/Common provider python name ++#pragma D attributes Evolving/Evolving/Common provider python args +diff -up Python-3.2a1/Makefile.pre.in.systemtap Python-3.2a1/Makefile.pre.in +--- Python-3.2a1/Makefile.pre.in.systemtap 2010-08-02 16:17:04.243000614 -0400 ++++ Python-3.2a1/Makefile.pre.in 2010-08-02 16:20:41.617000527 -0400 +@@ -324,6 +324,7 @@ PYTHON_OBJS= \ + Python/dtoa.o \ + Python/formatter_unicode.o \ + Python/$(DYNLOADFILE) \ ++ @DTRACEOBJS@ \ + $(LIBOBJS) \ + $(MACHDEP_OBJS) \ + $(THREADOBJ) +@@ -615,6 +616,18 @@ Python/formatter_unicode.o: $(srcdir)/Py + $(srcdir)/Objects/stringlib/formatter.h + + ++# Only needed with --with-dtrace ++buildinclude: ++ mkdir -p Include ++ ++Include/pydtrace.h: buildinclude $(srcdir)/Include/pydtrace.d ++ dtrace -o $@ $(DFLAGS) -C -h -s $(srcdir)/Include/pydtrace.d ++ ++Python/ceval.o: Include/pydtrace.h ++ ++Python/dtrace.o: buildinclude $(srcdir)/Include/pydtrace.d Python/ceval.o ++ dtrace -o $@ $(DFLAGS) -C -G -s $(srcdir)/Include/pydtrace.d Python/ceval.o ++ + ############################################################################ + # Header files + +@@ -1248,7 +1261,7 @@ Python/thread.o: @THREADHEADERS@ + .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure + .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools + .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean +-.PHONY: smelly funny patchcheck ++.PHONY: smelly funny patchcheck buildinclude + .PHONY: gdbhooks + + # IF YOU PUT ANYTHING HERE IT WILL GO AWAY +diff -up Python-3.2a1/pyconfig.h.in.systemtap Python-3.2a1/pyconfig.h.in +--- Python-3.2a1/pyconfig.h.in.systemtap 2010-08-02 16:18:33.696001964 -0400 ++++ Python-3.2a1/pyconfig.h.in 2010-08-02 16:21:48.566001832 -0400 +@@ -1078,6 +1078,9 @@ + /* Define if you want documentation strings in extension modules */ + #undef WITH_DOC_STRINGS + ++/* Define if you want to compile in Dtrace support */ ++#undef WITH_DTRACE ++ + /* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic + linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). + Dyld is necessary to support frameworks. */ +diff -up Python-3.2a1/Python/ceval.c.systemtap Python-3.2a1/Python/ceval.c +--- Python-3.2a1/Python/ceval.c.systemtap 2010-07-20 18:39:34.000000000 -0400 ++++ Python-3.2a1/Python/ceval.c 2010-08-02 16:23:58.703001000 -0400 +@@ -19,6 +19,10 @@ + + #include + ++#ifdef WITH_DTRACE ++#include "pydtrace.h" ++#endif ++ + #ifndef WITH_TSC + + #define READ_TIMESTAMP(var) +@@ -752,6 +756,70 @@ PyEval_EvalCode(PyCodeObject *co, PyObje + } + + ++#ifdef WITH_DTRACE ++struct frame_marker_info ++{ ++ char *filename; ++ char *name; ++ int lineno; ++ ++ PyObject *utf8_filename; ++ PyObject *utf8_name; ++}; ++ ++static void ++get_frame_marker_info(PyFrameObject *f, struct frame_marker_info *fmi) ++{ ++ fmi->utf8_filename = PyUnicode_AsUTF8String(f->f_code->co_filename); ++ if (fmi->utf8_filename) { ++ fmi->filename = PyBytes_AsString(fmi->utf8_filename); ++ } else { ++ fmi->filename = NULL; ++ /* FIXME: clear the exception? */ ++ } ++ ++ fmi->utf8_name = PyUnicode_AsUTF8String(f->f_code->co_name); ++ if (fmi->utf8_name) { ++ fmi->name = PyBytes_AsString(fmi->utf8_name); ++ } else { ++ fmi->name = NULL; ++ /* FIXME: clear the exception? */ ++ } ++ ++ fmi->lineno = PyCode_Addr2Line(f->f_code, f->f_lasti); ++} ++ ++static void ++release_frame_marker_info(struct frame_marker_info *fmi) ++{ ++ Py_XDECREF(fmi->utf8_filename); ++ Py_XDECREF(fmi->utf8_name); ++} ++ ++static void ++dtrace_entry(PyFrameObject *f) ++{ ++ struct frame_marker_info fmi; ++ get_frame_marker_info(f, &fmi); ++ PYTHON_FUNCTION_ENTRY(fmi.filename, fmi.name, fmi.lineno); ++ release_frame_marker_info(&fmi); ++} ++ ++static void ++dtrace_return(PyFrameObject *f) ++{ ++ struct frame_marker_info fmi; ++ get_frame_marker_info(f, &fmi); ++ PYTHON_FUNCTION_RETURN(fmi.filename, fmi.name, fmi.lineno); ++ release_frame_marker_info(&fmi); ++} ++#else ++#define PYTHON_FUNCTION_ENTRY_ENABLED() 0 ++#define PYTHON_FUNCTION_RETURN_ENABLED() 0 ++#define dtrace_entry(f) ++#define dtrace_return(f) ++#endif ++ + /* Interpreter main loop */ + + PyObject * +@@ -1156,6 +1224,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int + } + } + ++ if (PYTHON_FUNCTION_ENTRY_ENABLED()) { ++ dtrace_entry(f); ++ } ++ + co = f->f_code; + names = co->co_names; + consts = co->co_consts; +@@ -3046,6 +3118,9 @@ fast_yield: + + /* pop frame */ + exit_eval_frame: ++ if (PYTHON_FUNCTION_RETURN_ENABLED()) { ++ dtrace_return(f); ++ } + Py_LeaveRecursiveCall(); + tstate->frame = f->f_back; + diff --git a/python3.spec b/python3.spec index 3c8f9ef..15a8549 100644 --- a/python3.spec +++ b/python3.spec @@ -1,7 +1,20 @@ -%global pybasever 3.1 +%global pybasever 3.2 +%global alphatag a1 + %global pylibdir %{_libdir}/python%{pybasever} %global dynload_dir %{pylibdir}/lib-dynload +# All bytecode files are now in a __pycache__ subdirectory, with a name +# reflecting the version of the bytecode (to permit sharing of python libraries +# between different runtimes) +# See http://www.python.org/dev/peps/pep-3147/ +# For example, +# foo/bar.py +# now has bytecode at: +# foo/__pycache__/bar.cpython-32.pyc +# foo/__pycache__/bar.cpython-32.pyo +%global bytecode_suffixes .cpython-32.py? + # Python's configure script defines SOVERSION, and this is used in the Makefile # to determine INSTSONAME, the name of the libpython DSO: # LDLIBRARY='libpython$(VERSION).so' @@ -42,13 +55,43 @@ # invocation of brp-python-hardlink (since this should still work for python3 # pyc/pyo files) + +# We need to get a newer configure generated out of configure.in for the following +# patches: +# patch 55 (systemtap) +# patch 103 (debug build) +# patch 104 (more config flags) +# +# For patch 55 (systemtap), we need to get a new header for configure to use +# +# configure.in requires autoconf-2.65, but the version in Fedora is currently +# autoconf-2.66 +# +# For now, we'll generate a patch to the generated configure script and +# pyconfig.h.in on a machine that has a local copy of autoconf 2.65 +# +# Instructions on obtaining such a copy can be seen at +# http://bugs.python.org/issue7997 +# +# To make it easy to regenerate the patch, this specfile can be run in two +# ways: +# (i) regenerate_autotooling_patch 0 : the normal approach: prep the +# source tree using a pre-generated patch to the "configure" script, and do a +# full build +# (ii) regenerate_autotooling_patch 1 : intended to be run on a developer's +# workstation: prep the source tree without patching configure, then rerun a +# local copy of autoconf-2.65, regenerate the patch, then exit, without doing +# the rest of the build +%global regenerate_autotooling_patch 0 + + Summary: Version 3 of the Python programming language aka Python 3000 Name: python3 -Version: %{pybasever}.2 -Release: 13%{?dist} +Version: %{pybasever} +Release: 0.0.%{alphatag}%{?dist} License: Python Group: Development/Languages -Source: http://python.org/ftp/python/%{version}/Python-%{version}.tar.bz2 +Source: http://python.org/ftp/python/%{version}/Python-%{version}%{alphatag}.tar.bz2 # Avoid having various bogus auto-generated Provides lines for the various # python c modules' SONAMEs: @@ -100,40 +143,33 @@ Source6: systemtap-example.stp Source7: pyfuntop.stp -Patch0: python-3.1.1-config.patch - - # Fixup distutils/unixccompiler.py to remove standard library path from rpath: # Was Patch0 in ivazquez' python3000 specfile: Patch1: Python-3.1.1-rpath.patch # The four TestMIMEAudio tests fail due to "audiotest.au" not being packaged. # It's simplest to remove them: -Patch3: python-3.1.1-remove-mimeaudio-tests.patch +Patch3: python-3.2a1-remove-mimeaudio-tests.patch # ImportTests.test_issue1267 in test_imp.py reads pydoc.py's shebang line and # checks that it read it correctly. # # Since we modify the shebang lines in our packaging, we also need to modify # the expected value in this test: -Patch4: python-3.1.1-apply-our-changes-to-expected-shebang-for-test_imp.patch +Patch4: python-3.2a1-apply-our-changes-to-expected-shebang-for-test_imp.patch # Patch the Makefile.pre.in so that the generated Makefile doesn't try to build # a libpythonMAJOR.MINOR.a (bug 550692): -Patch6: python-3.1.1-no-static-lib.patch - -# Fixup configure.in and setup.py to build against system expat library. -# Adapted from http://svn.python.org/view?view=rev&revision=77170 -Patch7: python-3.1.1-with-system-expat.patch +Patch6: python-3.2a1-no-static-lib.patch # Systemtap support: add statically-defined probe points # Patch based on upstream bug: http://bugs.python.org/issue4111 # fixed up by mjw and wcohen for 2.6.2, then fixed up by dmalcolm for 2.6.4 # then rewritten by mjw (attachment 390110 of rhbz 545179); ported to 3.1.1 by # dmalcolm -Patch8: python-3.1.1-systemtap.patch +Patch8: python-3.2a1-systemtap.patch -Patch102: python-3.1.1-lib64.patch +Patch102: python-3.2a1-lib64.patch # Patch to support building both optimized vs debug stacks DSO ABIs, sharing # the same .py and .pyc files, using "_d.so" to signify a debug build of an @@ -197,7 +233,7 @@ Patch102: python-3.1.1-lib64.patch # * Patch runtests.sh to support supplying a value for PYTHON, so that we can # run the tests against each of the builds -Patch103: python-3.1.2-debug-build.patch +Patch103: python-3.2a1-debug-build.patch # Add configure-time support for the COUNT_ALLOCS and CALL_PROFILE options # described at http://svn.python.org/projects/python/trunk/Misc/SpecialBuilds.txt @@ -207,22 +243,7 @@ Patch104: python-3.1.2-more-configuration-flags.patch # Add flags for statvfs.f_flag to the constant list in posixmodule (i.e. "os") # (rhbz:553020); partially upstream as http://bugs.python.org/issue7647 -Patch105: python-2.6.5-statvfs-f_flag-constants.patch - -# This is the Modules/audioop.c part of the whitespace cleanup in r81032, to make it -# easier to apply subsequent security fixes: -Patch106: python-3.1.2-reformat-audioop.c.patch - -# CVE-2010-1634: fix various integer overflow checks in the audioop module -# This is the difference from r81032 to r81081 (i.e r81047 and r81081) -Patch107: python-3.1.2-CVE-2010-1634.patch - -# CVE-2010-2089: verify sizes/lengths within audioop module: -Patch108: python-3.1.2-CVE-2010-2089.patch - -# CVE-2008-5983: the new PySys_SetArgvEx entry point from r81400 (backported to -# the old layout before the whitespace cleanup of release31-maint in r81033): -Patch109: python-3.1.2-CVE-2008-5983.patch +Patch105: python-3.2a1-statvfs-f_flag-constants.patch # Fix an incompatibility between pyexpat and the system expat-2.0.1 that led to # a segfault running test_pyexpat.py (rhbz:610312) @@ -233,7 +254,19 @@ Patch110: python-3.1.2-fix-expat-issue9054.patch # to compile, or linker errors with "undefined reference to # `_PyParser_Grammar'": # Not yet sent upstream: -Patch111: python-3.1-fix-parallel-make.patch +Patch111: python-3.2a1-fix-parallel-make.patch + +# COUNT_ALLOCS is useful for debugging, but the upstream behaviour of always +# emitting debug info to stdout on exit is too verbose and makes it harder to +# use the debug build. Add a "PYTHONDUMPCOUNTS" environment variable which +# must be set to enable the output on exit +# Not yet sent upstream: +Patch125: less-verbose-COUNT_ALLOCS.patch + +# This is the generated patch to "configure"; see the description of +# %{regenerate_autotooling_patch} +# above: +Patch300: autotool-intermediates.patch BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: readline-devel, openssl-devel, gmp-devel @@ -343,9 +376,10 @@ It shares installation directories with the standard Python 3 runtime, so that .py and .pyc files can be shared. All compiled extension modules gain a "_d" suffix ("foo_d.so" rather than "foo.so") so that each Python 3 implementation can load its own extensions. +%endif # with_debug_build %prep -%setup -q -n Python-%{version} +%setup -q -n Python-%{version}%{alphatag} chmod +x %{SOURCE1} %if 0%{?with_systemtap} @@ -370,34 +404,31 @@ rm -r Modules/zlib || exit 1 # # Apply patches: # -%patch0 -p1 -b .config -%patch1 -p1 -b .rpath +%patch1 -p1 %patch3 -p1 -b .remove-mimeaudio-tests %patch4 -p1 -b .apply-our-changes-to-expected-shebang %patch6 -p1 -b .no-static-lib -%patch7 -p1 -b .expat + %if 0%{?with_systemtap} %patch8 -p1 -b .systemtap %endif %if "%{_lib}" == "lib64" -%patch102 -p1 -b .lib64 +%patch102 -p1 %endif -%patch103 -p1 -b .debug-build +%patch103 -p1 + %patch104 -p1 -b .more-configuration-flags %patch105 -p1 -b .statvfs-f-flag-constants -%patch106 -p3 -b .reformat-audioop -%patch107 -p3 -b .CVE-2010-1634 -%patch108 -p1 -b .CVE-2010-2089 -%patch109 -p1 -b .CVE-2008-5983 - %patch110 -p0 -b .fix-expat-issue9054 %patch111 -p1 -b .parallel-grammar +%patch125 -p1 -b .less-verbose-COUNT_ALLOCS + # Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there # are many differences between 2.6 and the Python 3 library. # @@ -408,6 +439,12 @@ sed --in-place \ --expression="s|http://docs.python.org/library|http://docs.python.org/%{pybasever}/library|g" \ Lib/pydoc.py || exit 1 +%if ! 0%{regenerate_autotooling_patch} +# Normally we apply the patch to "configure" +# We don't apply the patch if we're working towards regenerating it +%patch300 -p0 -b .autotool-intermediates +%endif + %build topdir=$(pwd) export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv" @@ -418,10 +455,28 @@ export LINKCC="gcc" export CFLAGS="$CFLAGS `pkg-config --cflags openssl`" export LDFLAGS="$LDFLAGS `pkg-config --libs-only-L openssl`" -autoconf +%if 0%{regenerate_autotooling_patch} +# If enabled, this code regenerates the patch to "configure", using a +# local copy of autoconf-2.65, then exits the build +# +# The following assumes that the copy is installed to ~/autoconf-2.65/bin +# as per these instructions: +# http://bugs.python.org/issue7997 + +for f in pyconfig.h.in configure ; do + cp $f $f.autotool-intermediates ; +done + +# Rerun the autotools: +PATH=~/autoconf-2.65/bin:$PATH autoreconf -# For patch 8 (systemtap), we need to get a new header for configure to use: -autoheader +# Regenerate the patch: +gendiff . .autotool-intermediates > %{PATCH300} + + +# Exit the build +exit 1 +%endif # Define a function, for how to perform a "build" of python for a given # configuration: @@ -548,7 +603,6 @@ install -m755 -d ${RPM_BUILD_ROOT}%{pylibdir}/Tools install Tools/README ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ cp -ar Tools/freeze ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ cp -ar Tools/i18n ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ -cp -ar Tools/modulator ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ cp -ar Tools/pynche ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ cp -ar Tools/scripts ${RPM_BUILD_ROOT}%{pylibdir}/Tools/ @@ -804,93 +858,95 @@ rm -fr %{buildroot} %{_mandir}/*/* %dir %{pylibdir} %dir %{dynload_dir} -%{dynload_dir}/Python-%{version}-py%{pybasever}.egg-info -%{dynload_dir}/_bisectmodule.so +%{dynload_dir}/Python-%{version}%{alphatag}-py%{pybasever}.egg-info +%{dynload_dir}/_bisect.so %{dynload_dir}/_codecs_cn.so %{dynload_dir}/_codecs_hk.so %{dynload_dir}/_codecs_iso2022.so %{dynload_dir}/_codecs_jp.so %{dynload_dir}/_codecs_kr.so %{dynload_dir}/_codecs_tw.so -%{dynload_dir}/_collectionsmodule.so +%{dynload_dir}/_collections.so %{dynload_dir}/_csv.so %{dynload_dir}/_ctypes.so %{dynload_dir}/_curses.so %{dynload_dir}/_curses_panel.so %{dynload_dir}/_dbm.so %{dynload_dir}/_elementtree.so -%{dynload_dir}/_gdbmmodule.so +%{dynload_dir}/_gdbm.so %{dynload_dir}/_hashlib.so -%{dynload_dir}/_heapqmodule.so +%{dynload_dir}/_heapq.so %{dynload_dir}/_json.so %{dynload_dir}/_lsprof.so -%{dynload_dir}/_multibytecodecmodule.so +%{dynload_dir}/_multibytecodec.so %{dynload_dir}/_multiprocessing.so %{dynload_dir}/_pickle.so -%{dynload_dir}/_randommodule.so -%{dynload_dir}/_sha1module.so -%{dynload_dir}/_sha256module.so -%{dynload_dir}/_sha512module.so -%{dynload_dir}/_socketmodule.so +%{dynload_dir}/_posixsubprocess.so +%{dynload_dir}/_random.so +%{dynload_dir}/_socket.so %{dynload_dir}/_sqlite3.so %{dynload_dir}/_ssl.so %{dynload_dir}/_struct.so -%{dynload_dir}/_weakref.so -%{dynload_dir}/arraymodule.so -%{dynload_dir}/atexitmodule.so +%{dynload_dir}/array.so +%{dynload_dir}/atexit.so %{dynload_dir}/audioop.so %{dynload_dir}/binascii.so %{dynload_dir}/bz2.so -%{dynload_dir}/cmathmodule.so -%{dynload_dir}/cryptmodule.so -%{dynload_dir}/datetime.so -%{dynload_dir}/fcntlmodule.so -%{dynload_dir}/grpmodule.so -%{dynload_dir}/itertoolsmodule.so -%{dynload_dir}/mathmodule.so -%{dynload_dir}/mmapmodule.so -%{dynload_dir}/nismodule.so +%{dynload_dir}/cmath.so +%{dynload_dir}/crypt.so +%{dynload_dir}/_datetime.so +%{dynload_dir}/fcntl.so +%{dynload_dir}/grp.so +%{dynload_dir}/itertools.so +%{dynload_dir}/math.so +%{dynload_dir}/mmap.so +%{dynload_dir}/nis.so %{dynload_dir}/operator.so %{dynload_dir}/ossaudiodev.so -%{dynload_dir}/parsermodule.so +%{dynload_dir}/parser.so %{dynload_dir}/pyexpat.so %{dynload_dir}/readline.so %{dynload_dir}/resource.so -%{dynload_dir}/selectmodule.so -%{dynload_dir}/spwdmodule.so -%{dynload_dir}/syslogmodule.so +%{dynload_dir}/select.so +%{dynload_dir}/spwd.so +%{dynload_dir}/syslog.so %{dynload_dir}/termios.so -%{dynload_dir}/timemodule.so +%{dynload_dir}/time.so %{dynload_dir}/unicodedata.so -%{dynload_dir}/xxsubtype.so -%{dynload_dir}/zlibmodule.so +%{dynload_dir}/zlib.so %dir %{pylibdir}/site-packages %{pylibdir}/site-packages/README -%{pylibdir}/*.py* -%{pylibdir}/*.doc +%{pylibdir}/*.py +%{pylibdir}/__pycache__/*%{bytecode_suffixes} %{pylibdir}/wsgiref.egg-info %dir %{pylibdir}/ctypes -%{pylibdir}/ctypes/*.py* +%{pylibdir}/ctypes/*.py +%{pylibdir}/ctypes/__pycache__/*%{bytecode_suffixes} %{pylibdir}/ctypes/macholib %{pylibdir}/curses %dir %{pylibdir}/dbm -%{pylibdir}/dbm/*.py* +%{pylibdir}/dbm/*.py +%{pylibdir}/dbm/__pycache__/*%{bytecode_suffixes} %dir %{pylibdir}/distutils -%{pylibdir}/distutils/*.py* +%{pylibdir}/distutils/*.py +%{pylibdir}/distutils/__pycache__/*%{bytecode_suffixes} %{pylibdir}/distutils/README %{pylibdir}/distutils/command %dir %{pylibdir}/email -%{pylibdir}/email/*.py* +%{pylibdir}/email/*.py +%{pylibdir}/email/__pycache__/*%{bytecode_suffixes} %{pylibdir}/email/mime %{pylibdir}/encodings %{pylibdir}/html %{pylibdir}/http %{pylibdir}/idlelib %dir %{pylibdir}/importlib -%{pylibdir}/importlib/*.py* +%{pylibdir}/importlib/*.py +%{pylibdir}/importlib/__pycache__/*%{bytecode_suffixes} %dir %{pylibdir}/json -%{pylibdir}/json/*.py* +%{pylibdir}/json/*.py +%{pylibdir}/json/__pycache__/*%{bytecode_suffixes} %{pylibdir}/lib2to3 %exclude %{pylibdir}/lib2to3/tests %{pylibdir}/logging @@ -898,9 +954,14 @@ rm -fr %{buildroot} %{pylibdir}/plat-linux2 %{pylibdir}/pydoc_data %dir %{pylibdir}/sqlite3 -%{pylibdir}/sqlite3/*.py* +%{pylibdir}/sqlite3/*.py +%{pylibdir}/sqlite3/__pycache__/*%{bytecode_suffixes} %dir %{pylibdir}/test -%{pylibdir}/test/__init__.py* +%{pylibdir}/test/__init__.py +%{pylibdir}/test/__pycache__/__init__%{bytecode_suffixes} +%dir %{pylibdir}/unittest +%{pylibdir}/unittest/*.py +%{pylibdir}/unittest/__pycache__/*%{bytecode_suffixes} %{pylibdir}/urllib %{pylibdir}/wsgiref %{pylibdir}/xml @@ -967,11 +1028,14 @@ rm -fr %{buildroot} %{pylibdir}/sqlite3/test %{pylibdir}/test %{dynload_dir}/_ctypes_test.so -%{dynload_dir}/_testcapimodule.so +%{dynload_dir}/_testcapi.so %{pylibdir}/lib2to3/tests %doc %{pylibdir}/Demo/distutils %doc %{pylibdir}/Demo/md5test %{pylibdir}/tkinter/test +%dir %{pylibdir}/unittest/test +%{pylibdir}/unittest/test/*.py +%{pylibdir}/unittest/test/__pycache__/*%{bytecode_suffixes} # We don't bother splitting the debug build out into further subpackages: @@ -989,65 +1053,65 @@ rm -fr %{buildroot} %{_bindir}/python%{pybasever}-debug # ...with debug builds of the built-in "extension" modules: -%{dynload_dir}/_bisectmodule_d.so +%{dynload_dir}/_bisect_d.so %{dynload_dir}/_codecs_cn_d.so %{dynload_dir}/_codecs_hk_d.so %{dynload_dir}/_codecs_iso2022_d.so %{dynload_dir}/_codecs_jp_d.so %{dynload_dir}/_codecs_kr_d.so %{dynload_dir}/_codecs_tw_d.so -%{dynload_dir}/_collectionsmodule_d.so +%{dynload_dir}/_collections_d.so %{dynload_dir}/_csv_d.so %{dynload_dir}/_ctypes_d.so %{dynload_dir}/_curses_d.so %{dynload_dir}/_curses_panel_d.so %{dynload_dir}/_dbm_d.so %{dynload_dir}/_elementtree_d.so -%{dynload_dir}/_gdbmmodule_d.so +%{dynload_dir}/_gdbm_d.so %{dynload_dir}/_hashlib_d.so -%{dynload_dir}/_heapqmodule_d.so +%{dynload_dir}/_heapq_d.so %{dynload_dir}/_json_d.so %{dynload_dir}/_lsprof_d.so -%{dynload_dir}/_multibytecodecmodule_d.so +%{dynload_dir}/_md5_d.so +%{dynload_dir}/_multibytecodec_d.so %{dynload_dir}/_multiprocessing_d.so %{dynload_dir}/_pickle_d.so -%{dynload_dir}/_randommodule_d.so -%{dynload_dir}/_sha1module_d.so -%{dynload_dir}/_sha256module_d.so -%{dynload_dir}/_sha512module_d.so -%{dynload_dir}/_socketmodule_d.so +%{dynload_dir}/_posixsubprocess_d.so +%{dynload_dir}/_random_d.so +%{dynload_dir}/_sha1_d.so +%{dynload_dir}/_sha256_d.so +%{dynload_dir}/_sha512_d.so +%{dynload_dir}/_socket_d.so %{dynload_dir}/_sqlite3_d.so %{dynload_dir}/_ssl_d.so %{dynload_dir}/_struct_d.so -%{dynload_dir}/_weakref_d.so -%{dynload_dir}/arraymodule_d.so -%{dynload_dir}/atexitmodule_d.so +%{dynload_dir}/array_d.so +%{dynload_dir}/atexit_d.so %{dynload_dir}/audioop_d.so %{dynload_dir}/binascii_d.so %{dynload_dir}/bz2_d.so -%{dynload_dir}/cmathmodule_d.so -%{dynload_dir}/cryptmodule_d.so -%{dynload_dir}/datetime_d.so -%{dynload_dir}/fcntlmodule_d.so -%{dynload_dir}/grpmodule_d.so -%{dynload_dir}/itertoolsmodule_d.so -%{dynload_dir}/mathmodule_d.so -%{dynload_dir}/mmapmodule_d.so -%{dynload_dir}/nismodule_d.so +%{dynload_dir}/cmath_d.so +%{dynload_dir}/crypt_d.so +%{dynload_dir}/_datetime_d.so +%{dynload_dir}/fcntl_d.so +%{dynload_dir}/grp_d.so +%{dynload_dir}/itertools_d.so +%{dynload_dir}/math_d.so +%{dynload_dir}/mmap_d.so +%{dynload_dir}/nis_d.so %{dynload_dir}/operator_d.so %{dynload_dir}/ossaudiodev_d.so -%{dynload_dir}/parsermodule_d.so +%{dynload_dir}/parser_d.so %{dynload_dir}/pyexpat_d.so %{dynload_dir}/readline_d.so %{dynload_dir}/resource_d.so -%{dynload_dir}/selectmodule_d.so -%{dynload_dir}/spwdmodule_d.so -%{dynload_dir}/syslogmodule_d.so +%{dynload_dir}/select_d.so +%{dynload_dir}/spwd_d.so +%{dynload_dir}/syslog_d.so %{dynload_dir}/termios_d.so -%{dynload_dir}/timemodule_d.so +%{dynload_dir}/time_d.so %{dynload_dir}/unicodedata_d.so -%{dynload_dir}/xxsubtype_d.so -%{dynload_dir}/zlibmodule_d.so +%{dynload_dir}/zlib_d.so # No need to split things out the "Makefile" and the config-32/64.h file as we # do for the regular build above (bug 531901), since they're all in one package @@ -1078,7 +1142,7 @@ rm -fr %{buildroot} # Analog of the -test subpackage's files: %{dynload_dir}/_ctypes_test_d.so -%{dynload_dir}/_testcapimodule_d.so +%{dynload_dir}/_testcapi_d.so %endif # with_debug_build @@ -1097,6 +1161,26 @@ rm -fr %{buildroot} %changelog +* Sat Aug 21 2010 David Malcolm - 3.2-0.0.a1 +- 3.2a1; add alphatag +- rework %%files in the light of PEP 3147 (__pycache__) +- drop our configuration patch to Setup.dist (patch 0): setup.py should do a +better job of things, and the %%files explicitly lists our modules (r82746 +appears to break the old way of doing things). This leads to various modules +changing from "foomodule.so" to "foo.so". It also leads to the optimized build +dropping the _sha1, _sha256 and _sha512 modules, but these are provided by +_hashlib; _weakref becomes a builtin module; xxsubtype goes away (it's only for +testing/devel purposes) +- fixup patches 3, 4, 6, 8, 102, 103, 105, 111 for the rebase +- remove upstream patches: 7 (system expat), 106, 107, 108 (audioop reformat +plus CVE-2010-1634 and CVE-2010-2089), 109 (CVE-2008-5983) +- add machinery for rebuilding "configure" and friends, using the correct +version of autoconf (patch 300) +- patch the debug build's usage of COUNT_ALLOCS to be less verbose (patch 125) +- "modulator" was removed upstream +- drop "-b" from patch applications affecting .py files to avoid littering the +installation tree + * Thu Aug 19 2010 Toshio Kuratomi - 3.1.2-13 - Turn on computed-gotos. - Fix for parallel make and graminit.c diff --git a/sources b/sources index 30f03d2..c49803c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -45350b51b58a46b029fb06c61257e350 Python-3.1.2.tar.bz2 +b371e1f7a0e98e7a0d1792823fd0f58c Python-3.2a1.tar.bz2