[Python-checkins] r81086 - in python/branches/py3k-jit: Lib/unittest/case.py Misc/NEWS Misc/maintainers.rst Modules/_cursesmodule.c Modules/audioop.c configure configure.in

collin.winter python-checkins at python.org
Tue May 11 19:58:55 CEST 2010


Author: collin.winter
Date: Tue May 11 19:58:55 2010
New Revision: 81086

Log:
Merged revisions 81071,81074-81076,81078,81081,81083-81084 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81071 | andrew.kuchling | 2010-05-10 16:14:26 -0700 (Mon, 10 May 2010) | 9 lines
  
  Merged revisions 81049 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81049 | andrew.kuchling | 2010-05-10 13:18:25 -0400 (Mon, 10 May 2010) | 1 line
    
    Move { out of #if...#else block; this confuses Emacs' C-mode
  ........
................
  r81074 | andrew.kuchling | 2010-05-10 16:28:28 -0700 (Mon, 10 May 2010) | 9 lines
  
  Merged revisions 81072 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81072 | andrew.kuchling | 2010-05-10 19:24:09 -0400 (Mon, 10 May 2010) | 1 line
    
    Break long line in macros
  ........
................
  r81075 | andrew.kuchling | 2010-05-10 16:30:25 -0700 (Mon, 10 May 2010) | 9 lines
  
  Merged revisions 81073 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81073 | andrew.kuchling | 2010-05-10 19:27:01 -0400 (Mon, 10 May 2010) | 1 line
    
    Use ';' after initialization macros to avoid confusing re-indenters
  ........
................
  r81076 | benjamin.peterson | 2010-05-10 17:07:48 -0700 (Mon, 10 May 2010) | 1 line
  
  remove now useless __ne__
................
  r81078 | mark.dickinson | 2010-05-11 02:23:07 -0700 (Tue, 11 May 2010) | 10 lines
  
  Recorded merge of revisions 81077 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81077 | mark.dickinson | 2010-05-11 09:55:06 +0100 (Tue, 11 May 2010) | 3 lines
    
    Issue #8510: Remove nested 'main' functions (causing failure) in 3 configure tests;
    remove some unnecessary '#include "confdefs.h"' lines.  Thanks Roumen Petrov.
  ........
................
  r81081 | mark.dickinson | 2010-05-11 06:09:58 -0700 (Tue, 11 May 2010) | 9 lines
  
  Merged revisions 81079 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r81079 | mark.dickinson | 2010-05-11 14:05:30 +0100 (Tue, 11 May 2010) | 1 line
    
    Issue #8674: fix another bogus overflow check in audioop module.
  ........
................
  r81083 | mark.dickinson | 2010-05-11 06:34:35 -0700 (Tue, 11 May 2010) | 2 lines
  
  Issue #8657:  Make the audioop module PY_SSIZE_T_CLEAN.
................
  r81084 | giampaolo.rodola | 2010-05-11 07:00:04 -0700 (Tue, 11 May 2010) | 1 line
  
  adding myself to 'testing' interest area of maintainers.rst file
................


Modified:
   python/branches/py3k-jit/   (props changed)
   python/branches/py3k-jit/Lib/unittest/case.py
   python/branches/py3k-jit/Misc/NEWS
   python/branches/py3k-jit/Misc/maintainers.rst
   python/branches/py3k-jit/Modules/_cursesmodule.c
   python/branches/py3k-jit/Modules/audioop.c
   python/branches/py3k-jit/configure
   python/branches/py3k-jit/configure.in

Modified: python/branches/py3k-jit/Lib/unittest/case.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/case.py	(original)
+++ python/branches/py3k-jit/Lib/unittest/case.py	Tue May 11 19:58:55 2010
@@ -264,9 +264,6 @@
 
         return self._testMethodName == other._testMethodName
 
-    def __ne__(self, other):
-        return not self == other
-
     def __hash__(self):
         return hash((type(self), self._testMethodName))
 

Modified: python/branches/py3k-jit/Misc/NEWS
==============================================================================
--- python/branches/py3k-jit/Misc/NEWS	(original)
+++ python/branches/py3k-jit/Misc/NEWS	Tue May 11 19:58:55 2010
@@ -351,6 +351,9 @@
 Library
 -------
 
+- The audioop module now supports sound fragments of length greater
+  than 2**31 bytes on 64-bit machines, and is PY_SSIZE_T_CLEAN.
+
 - Issue #4972: Add support for the context manager protocol to the ftplib.FTP
   class.
 

Modified: python/branches/py3k-jit/Misc/maintainers.rst
==============================================================================
--- python/branches/py3k-jit/Misc/maintainers.rst	(original)
+++ python/branches/py3k-jit/Misc/maintainers.rst	Tue May 11 19:58:55 2010
@@ -288,7 +288,7 @@
                     gvanrossum, anthonybaxter
 str.format          eric.smith
 time and dates      lemburg
-testing             michael.foord, pitrou
+testing             michael.foord, pitrou, giampaolo.rodola
 threads
 tracker
 unicode             lemburg, ezio.melotti, haypo

Modified: python/branches/py3k-jit/Modules/_cursesmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/_cursesmodule.c	(original)
+++ python/branches/py3k-jit/Modules/_cursesmodule.c	Tue May 11 19:58:55 2010
@@ -251,42 +251,49 @@
    */
 
 #define Window_NoArgNoReturnFunction(X) \
-static PyObject *PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
+static PyObject *PyCursesWindow_ ## X \
+(PyCursesWindowObject *self, PyObject *args) \
 { return PyCursesCheckERR(X(self->win), # X); }
 
 #define Window_NoArgTrueFalseFunction(X) \
-static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \
+static PyObject * PyCursesWindow_ ## X \
+(PyCursesWindowObject *self) \
 { \
   if (X (self->win) == FALSE) { Py_INCREF(Py_False); return Py_False; } \
   else { Py_INCREF(Py_True); return Py_True; } }
 
 #define Window_NoArgNoReturnVoidFunction(X) \
-static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \
+static PyObject * PyCursesWindow_ ## X \
+(PyCursesWindowObject *self) \
 { \
   X(self->win); Py_INCREF(Py_None); return Py_None; }
 
 #define Window_NoArg2TupleReturnFunction(X, TYPE, ERGSTR) \
-static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self) \
+static PyObject * PyCursesWindow_ ## X \
+(PyCursesWindowObject *self) \
 { \
   TYPE arg1, arg2; \
   X(self->win,arg1,arg2); return Py_BuildValue(ERGSTR, arg1, arg2); } 
 
 #define Window_OneArgNoReturnVoidFunction(X, TYPE, PARSESTR) \
-static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
+static PyObject * PyCursesWindow_ ## X \
+(PyCursesWindowObject *self, PyObject *args) \
 { \
   TYPE arg1; \
   if (!PyArg_ParseTuple(args, PARSESTR, &arg1)) return NULL; \
   X(self->win,arg1); Py_INCREF(Py_None); return Py_None; }
 
 #define Window_OneArgNoReturnFunction(X, TYPE, PARSESTR) \
-static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
+static PyObject * PyCursesWindow_ ## X \
+(PyCursesWindowObject *self, PyObject *args) \
 { \
   TYPE arg1; \
   if (!PyArg_ParseTuple(args,PARSESTR, &arg1)) return NULL; \
   return PyCursesCheckERR(X(self->win, arg1), # X); }
 
 #define Window_TwoArgNoReturnFunction(X, TYPE, PARSESTR) \
-static PyObject * PyCursesWindow_ ## X (PyCursesWindowObject *self, PyObject *args) \
+static PyObject * PyCursesWindow_ ## X \
+(PyCursesWindowObject *self, PyObject *args) \
 { \
   TYPE arg1, arg2; \
   if (!PyArg_ParseTuple(args,PARSESTR, &arg1, &arg2)) return NULL; \
@@ -1234,10 +1241,11 @@
   int rtn;
 
 #ifndef WINDOW_HAS_FLAGS
-  if (0) {
+  if (0)
 #else
-  if (self->win->_flags & _ISPAD) {
+  if (self->win->_flags & _ISPAD)
 #endif
+    {
     switch(PyTuple_Size(args)) {
     case 6:
       if (!PyArg_ParseTuple(args, 
@@ -1403,10 +1411,11 @@
   int rtn;
   
 #ifndef WINDOW_HAS_FLAGS
-  if (0) {
+  if (0)
 #else
-  if (self->win->_flags & _ISPAD) {
+  if (self->win->_flags & _ISPAD)
 #endif
+    {
     switch(PyTuple_Size(args)) {
     case 6:
       if (!PyArg_ParseTuple(args, 
@@ -1739,8 +1748,8 @@
 {
   short color,r,g,b;
 
-  PyCursesInitialised
-  PyCursesInitialisedColor
+  PyCursesInitialised;
+  PyCursesInitialisedColor;
 
   if (!PyArg_ParseTuple(args, "h:color_content", &color)) return NULL;
 
@@ -1758,8 +1767,8 @@
 {
   int n;
 
-  PyCursesInitialised
-  PyCursesInitialisedColor
+  PyCursesInitialised;
+  PyCursesInitialisedColor;
 
   if (!PyArg_ParseTuple(args, "i:color_pair", &n)) return NULL;
   return PyLong_FromLong((long) (n << 8));
@@ -1770,7 +1779,7 @@
 {
   int vis,erg;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args, "i:curs_set", &vis)) return NULL;
 
@@ -1785,7 +1794,7 @@
 {
   int ms;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args, "i:delay_output", &ms)) return NULL;
 
@@ -1797,7 +1806,7 @@
 {
   char ch;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   ch = erasechar();
 
@@ -1810,7 +1819,7 @@
   int x = 0;
   int y = 0;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   getsyx(y, x);
 
@@ -1824,7 +1833,7 @@
 	int rtn;
 	MEVENT event;
 
-	PyCursesInitialised
+	PyCursesInitialised;
 
 	rtn = getmouse( &event );
 	if (rtn == ERR) {
@@ -1842,7 +1851,7 @@
 {
 	MEVENT event;
 
-	PyCursesInitialised
+	PyCursesInitialised;
 	if (!PyArg_ParseTuple(args, "hiiil",
 			     &event.id, 
 			     &event.x, &event.y, &event.z,
@@ -1863,7 +1872,7 @@
   size_t datalen;
   WINDOW *win;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   strcpy(fn, "/tmp/py.curses.getwin.XXXXXX");
   fd = mkstemp(fn);
@@ -1914,7 +1923,7 @@
 {
   unsigned char tenths;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args, "b:halfdelay", &tenths)) return NULL;
 
@@ -1927,7 +1936,7 @@
 {
   int ch;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args,"i",&ch)) return NULL;
 
@@ -1945,8 +1954,8 @@
 {
   short color, r, g, b;
 
-  PyCursesInitialised
-  PyCursesInitialisedColor
+  PyCursesInitialised;
+  PyCursesInitialisedColor;
 
   switch(PyTuple_Size(args)) {
   case 4:
@@ -1965,8 +1974,8 @@
 {
   short pair, f, b;
 
-  PyCursesInitialised
-  PyCursesInitialisedColor
+  PyCursesInitialised;
+  PyCursesInitialisedColor;
 
   if (PyTuple_Size(args) != 3) {
     PyErr_SetString(PyExc_TypeError, "init_pair requires 3 arguments");
@@ -2139,7 +2148,7 @@
 {
   int ch;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   switch(PyTuple_Size(args)) {
   case 1:
@@ -2161,7 +2170,7 @@
   int columns;
   int result;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args,"ii:is_term_resized", &lines, &columns))
     return NULL;
@@ -2183,7 +2192,7 @@
   const char *knp;
   int ch;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args,"i",&ch)) return NULL;
 
@@ -2212,7 +2221,7 @@
 {
   int ch;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   switch(PyTuple_Size(args)) {
   case 1:
@@ -2231,7 +2240,7 @@
 PyCurses_MouseInterval(PyObject *self, PyObject *args)
 {
 	int interval;
-	PyCursesInitialised 
+	PyCursesInitialised;
 
 	if (!PyArg_ParseTuple(args,"i;interval",&interval)) 
 		return NULL;
@@ -2244,7 +2253,7 @@
 	int newmask;
 	mmask_t oldmask, availmask;
 
-	PyCursesInitialised 
+	PyCursesInitialised;
 	if (!PyArg_ParseTuple(args,"i;mousemask",&newmask)) 
 		return NULL;
 	availmask = mousemask(newmask, &oldmask);
@@ -2257,7 +2266,7 @@
 {
     int ms;
 
-    PyCursesInitialised
+    PyCursesInitialised;
     if (!PyArg_ParseTuple(args, "i;ms", &ms)) return NULL;
 
     return Py_BuildValue("i", napms(ms));
@@ -2270,7 +2279,7 @@
   WINDOW *win;
   int nlines, ncols;
 
-  PyCursesInitialised 
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args,"ii;nlines,ncols",&nlines,&ncols)) return NULL;
 
@@ -2290,7 +2299,7 @@
   WINDOW *win;
   int nlines, ncols, begin_y=0, begin_x=0;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   switch (PyTuple_Size(args)) {
   case 2:
@@ -2321,8 +2330,8 @@
 {
   short pair,f,b;
 
-  PyCursesInitialised
-  PyCursesInitialisedColor
+  PyCursesInitialised;
+  PyCursesInitialisedColor;
 
   switch(PyTuple_Size(args)) {
   case 1:
@@ -2347,8 +2356,8 @@
 {
   int n;
 
-  PyCursesInitialised
-  PyCursesInitialisedColor
+  PyCursesInitialised;
+  PyCursesInitialisedColor;
 
   switch(PyTuple_Size(args)) {
   case 1:
@@ -2377,7 +2386,7 @@
 {
   int flag = 0;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   switch(PyTuple_Size(args)) {
   case 0:
@@ -2453,7 +2462,7 @@
   int columns;
   PyObject *result;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args,"ii:resizeterm", &lines, &columns))
     return NULL;
@@ -2477,7 +2486,7 @@
 
   PyObject *result;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args,"ii:resize_term", &lines, &columns))
     return NULL;
@@ -2496,7 +2505,7 @@
 {
   int y,x;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (PyTuple_Size(args)!=2) {
     PyErr_SetString(PyExc_TypeError, "setsyx requires 2 arguments");
@@ -2517,7 +2526,7 @@
   int code;
   PyObject *c, *cp;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   code = start_color();
   if (code != ERR) {
@@ -2609,7 +2618,7 @@
 {
   int fd;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args,"i;fd",&fd)) return NULL;
 
@@ -2622,7 +2631,7 @@
   PyObject *temp;
   chtype ch;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args,"O;ch or int",&temp)) return NULL;
 
@@ -2640,7 +2649,7 @@
   PyObject *temp;
   chtype ch;
 
-  PyCursesInitialised
+  PyCursesInitialised;
 
   if (!PyArg_ParseTuple(args,"O;ch or int",&temp)) return NULL;
 
@@ -2677,8 +2686,8 @@
 {
   int code;
 
-  PyCursesInitialised
-  PyCursesInitialisedColor
+  PyCursesInitialised;
+  PyCursesInitialisedColor;
 
   code = use_default_colors();
   if (code != ERR) {

Modified: python/branches/py3k-jit/Modules/audioop.c
==============================================================================
--- python/branches/py3k-jit/Modules/audioop.c	(original)
+++ python/branches/py3k-jit/Modules/audioop.c	Tue May 11 19:58:55 2010
@@ -1,6 +1,8 @@
 
 /* audioopmodule - Module to detect peak values in arrays */
 
+#define PY_SSIZE_T_CLEAN
+
 #include "Python.h"
 
 #if SIZEOF_INT == 4
@@ -299,10 +301,10 @@
 audioop_getsample(PyObject *self, PyObject *args)
 {
     signed char *cp;
-    int len, size, val = 0;
-    int i;
+    Py_ssize_t len, i;
+    int size, val = 0;
 
-    if ( !PyArg_ParseTuple(args, "s#ii:getsample", &cp, &len, &size, &i) )
+    if ( !PyArg_ParseTuple(args, "s#in:getsample", &cp, &len, &size, &i) )
         return 0;
     if ( size != 1 && size != 2 && size != 4 ) {
         PyErr_SetString(AudioopError, "Size should be 1, 2 or 4");
@@ -322,8 +324,8 @@
 audioop_max(PyObject *self, PyObject *args)
 {
     signed char *cp;
-    int len, size, val = 0;
-    int i;
+    Py_ssize_t len, i;
+    int size, val = 0;
     int max = 0;
 
     if ( !PyArg_ParseTuple(args, "s#i:max", &cp, &len, &size) )
@@ -346,8 +348,8 @@
 audioop_minmax(PyObject *self, PyObject *args)
 {
     signed char *cp;
-    int len, size, val = 0;
-    int i;
+    Py_ssize_t len, i;
+    int size, val = 0;
     int min = 0x7fffffff, max = -0x7fffffff;
 
     if (!PyArg_ParseTuple(args, "s#i:minmax", &cp, &len, &size))
@@ -370,8 +372,8 @@
 audioop_avg(PyObject *self, PyObject *args)
 {
     signed char *cp;
-    int len, size, val = 0;
-    int i;
+    Py_ssize_t len, i;
+    int size, val = 0;
     double avg = 0.0;
 
     if ( !PyArg_ParseTuple(args, "s#i:avg", &cp, &len, &size) )
@@ -397,8 +399,8 @@
 audioop_rms(PyObject *self, PyObject *args)
 {
     signed char *cp;
-    int len, size, val = 0;
-    int i;
+    Py_ssize_t len, i;
+    int size, val = 0;
     double sum_squares = 0.0;
 
     if ( !PyArg_ParseTuple(args, "s#i:rms", &cp, &len, &size) )
@@ -420,9 +422,9 @@
     return PyLong_FromLong(val);
 }
 
-static double _sum2(short *a, short *b, int len)
+static double _sum2(short *a, short *b, Py_ssize_t len)
 {
-    int i;
+    Py_ssize_t i;
     double sum = 0.0;
 
     for( i=0; i<len; i++) {
@@ -467,8 +469,8 @@
 audioop_findfit(PyObject *self, PyObject *args)
 {
     short *cp1, *cp2;
-    int len1, len2;
-    int j, best_j;
+    Py_ssize_t len1, len2;
+    Py_ssize_t j, best_j;
     double aj_m1, aj_lm1;
     double sum_ri_2, sum_aij_2, sum_aij_ri, result, best_result, factor;
 
@@ -519,7 +521,7 @@
 
     factor = _sum2(cp1+best_j, cp2, len2) / sum_ri_2;
 
-    return Py_BuildValue("(if)", best_j, factor);
+    return Py_BuildValue("(nf)", best_j, factor);
 }
 
 /*
@@ -530,7 +532,7 @@
 audioop_findfactor(PyObject *self, PyObject *args)
 {
     short *cp1, *cp2;
-    int len1, len2;
+    Py_ssize_t len1, len2;
     double sum_ri_2, sum_aij_ri, result;
 
     if ( !PyArg_ParseTuple(args, "s#s#:findfactor",
@@ -561,12 +563,12 @@
 audioop_findmax(PyObject *self, PyObject *args)
 {
     short *cp1;
-    int len1, len2;
-    int j, best_j;
+    Py_ssize_t len1, len2;
+    Py_ssize_t j, best_j;
     double aj_m1, aj_lm1;
     double result, best_result;
 
-    if ( !PyArg_ParseTuple(args, "s#i:findmax",
+    if ( !PyArg_ParseTuple(args, "s#n:findmax",
                            (char**)&cp1, &len1, &len2) )
         return 0;
     if ( len1 & 1 ) {
@@ -599,16 +601,16 @@
 
     }
 
-    return PyLong_FromLong(best_j);
+    return PyLong_FromSsize_t(best_j);
 }
 
 static PyObject *
 audioop_avgpp(PyObject *self, PyObject *args)
 {
     signed char *cp;
-    int len, size, val = 0, prevval = 0, prevextremevalid = 0,
+    Py_ssize_t len, i;
+    int size, val = 0, prevval = 0, prevextremevalid = 0,
         prevextreme = 0;
-    int i;
     double avg = 0.0;
     int diff, prevdiff, extremediff, nextreme = 0;
 
@@ -663,9 +665,9 @@
 audioop_maxpp(PyObject *self, PyObject *args)
 {
     signed char *cp;
-    int len, size, val = 0, prevval = 0, prevextremevalid = 0,
+    Py_ssize_t len, i;
+    int size, val = 0, prevval = 0, prevextremevalid = 0,
         prevextreme = 0;
-    int i;
     int max = 0;
     int diff, prevdiff, extremediff;
 
@@ -716,9 +718,10 @@
 audioop_cross(PyObject *self, PyObject *args)
 {
     signed char *cp;
-    int len, size, val = 0;
-    int i;
-    int prevval, ncross;
+    Py_ssize_t len, i;
+    int size, val = 0;
+    int prevval;
+    Py_ssize_t ncross;
 
     if ( !PyArg_ParseTuple(args, "s#i:cross", &cp, &len, &size) )
         return 0;
@@ -736,17 +739,17 @@
         if ( val != prevval ) ncross++;
         prevval = val;
     }
-    return PyLong_FromLong(ncross);
+    return PyLong_FromSsize_t(ncross);
 }
 
 static PyObject *
 audioop_mul(PyObject *self, PyObject *args)
 {
     signed char *cp, *ncp;
-    int len, size, val = 0;
+    Py_ssize_t len, i;
+    int size, val = 0;
     double factor, fval, maxval;
     PyObject *rv;
-    int i;
 
     if ( !PyArg_ParseTuple(args, "s#id:mul", &cp, &len, &size, &factor ) )
         return 0;
@@ -785,10 +788,10 @@
 {
     Py_buffer pcp;
     signed char *cp, *ncp;
-    int len, size, val1 = 0, val2 = 0;
+    Py_ssize_t len, i;
+    int 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 ) )
@@ -834,10 +837,10 @@
 audioop_tostereo(PyObject *self, PyObject *args)
 {
     signed char *cp, *ncp;
-    int len, size, val1, val2, val = 0;
+    Py_ssize_t len, i;
+    int 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 ) )
@@ -851,7 +854,7 @@
         return 0;
     }
 
-    if (len > INT_MAX/2) {
+    if (len > PY_SSIZE_T_MAX/2) {
         PyErr_SetString(PyExc_MemoryError,
                         "not enough memory for output buffer");
         return 0;
@@ -893,9 +896,9 @@
 audioop_add(PyObject *self, PyObject *args)
 {
     signed char *cp1, *cp2, *ncp;
-    int len1, len2, size, val1 = 0, val2 = 0, maxval, newval;
+    Py_ssize_t len1, len2, i;
+    int size, val1 = 0, val2 = 0, maxval, newval;
     PyObject *rv;
-    int i;
 
     if ( !PyArg_ParseTuple(args, "s#s#i:add",
                       &cp1, &len1, &cp2, &len2, &size ) )
@@ -946,9 +949,9 @@
 audioop_bias(PyObject *self, PyObject *args)
 {
     signed char *cp, *ncp;
-    int len, size, val = 0;
+    Py_ssize_t len, i;
+    int size, val = 0;
     PyObject *rv;
-    int i;
     int bias;
 
     if ( !PyArg_ParseTuple(args, "s#ii:bias",
@@ -983,9 +986,9 @@
 {
     signed char *cp;
     unsigned char *ncp;
-    int len, size, val = 0;
+    Py_ssize_t len, i, j;
+    int size, val = 0;
     PyObject *rv;
-    int i, j;
 
     if ( !PyArg_ParseTuple(args, "s#i:reverse",
                       &cp, &len, &size) )
@@ -1020,9 +1023,9 @@
 {
     signed char *cp;
     unsigned char *ncp;
-    int len, size, size2, val = 0;
+    Py_ssize_t len, i, j;
+    int size, size2, val = 0;
     PyObject *rv;
-    int i, j;
 
     if ( !PyArg_ParseTuple(args, "s#ii:lin2lin",
                       &cp, &len, &size, &size2) )
@@ -1034,7 +1037,7 @@
         return 0;
     }
 
-    if (len/size > INT_MAX/size2) {
+    if (len/size > PY_SSIZE_T_MAX/size2) {
         PyErr_SetString(PyExc_MemoryError,
                         "not enough memory for output buffer");
         return 0;
@@ -1071,7 +1074,8 @@
 audioop_ratecv(PyObject *self, PyObject *args)
 {
     char *cp, *ncp;
-    int len, size, nchannels, inrate, outrate, weightA, weightB;
+    Py_ssize_t len;
+    int 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;
@@ -1160,25 +1164,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 */
+        Py_ssize_t q = len > 0 ? 1 + (len - 1) / inrate : 0;
+        if (outrate > PY_SSIZE_T_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,
@@ -1203,7 +1198,7 @@
                     goto exit;
                 /* We have checked before that the length
                  * of the string fits into int. */
-                len = (int)(ncp - PyBytes_AsString(str));
+                len = (Py_ssize_t)(ncp - PyBytes_AsString(str));
                 rv = PyBytes_FromStringAndSize
                     (PyBytes_AsString(str), len);
                 Py_DECREF(str);
@@ -1262,9 +1257,9 @@
 {
     signed char *cp;
     unsigned char *ncp;
-    int len, size, val = 0;
+    Py_ssize_t len, i;
+    int size, val = 0;
     PyObject *rv;
-    int i;
 
     if ( !PyArg_ParseTuple(args, "s#i:lin2ulaw",
                            &cp, &len, &size) )
@@ -1296,9 +1291,9 @@
     unsigned char *cp;
     unsigned char cval;
     signed char *ncp;
-    int len, size, val;
+    Py_ssize_t len, i;
+    int size, val;
     PyObject *rv;
-    int i;
 
     if ( !PyArg_ParseTuple(args, "s#i:ulaw2lin",
                            &cp, &len, &size) )
@@ -1309,7 +1304,7 @@
         return 0;
     }
 
-    if (len > INT_MAX/size) {
+    if (len > PY_SSIZE_T_MAX/size) {
         PyErr_SetString(PyExc_MemoryError,
                         "not enough memory for output buffer");
         return 0;
@@ -1335,9 +1330,9 @@
 {
     signed char *cp;
     unsigned char *ncp;
-    int len, size, val = 0;
+    Py_ssize_t len, i;
+    int size, val = 0;
     PyObject *rv;
-    int i;
 
     if ( !PyArg_ParseTuple(args, "s#i:lin2alaw",
                            &cp, &len, &size) )
@@ -1369,9 +1364,9 @@
     unsigned char *cp;
     unsigned char cval;
     signed char *ncp;
-    int len, size, val;
+    Py_ssize_t len, i;
+    int size, val;
     PyObject *rv;
-    int i;
 
     if ( !PyArg_ParseTuple(args, "s#i:alaw2lin",
                            &cp, &len, &size) )
@@ -1382,7 +1377,7 @@
         return 0;
     }
 
-    if (len > INT_MAX/size) {
+    if (len > PY_SSIZE_T_MAX/size) {
         PyErr_SetString(PyExc_MemoryError,
                         "not enough memory for output buffer");
         return 0;
@@ -1408,10 +1403,11 @@
 {
     signed char *cp;
     signed char *ncp;
-    int len, size, val = 0, step, valpred, delta,
+    Py_ssize_t len, i;
+    int size, val = 0, step, valpred, delta,
         index, sign, vpdiff, diff;
     PyObject *rv, *state, *str;
-    int i, outputbuffer = 0, bufferstep;
+    int outputbuffer = 0, bufferstep;
 
     if ( !PyArg_ParseTuple(args, "s#iO:lin2adpcm",
                            &cp, &len, &size, &state) )
@@ -1517,9 +1513,10 @@
 {
     signed char *cp;
     signed char *ncp;
-    int len, size, valpred, step, delta, index, sign, vpdiff;
+    Py_ssize_t len, i;
+    int size, valpred, step, delta, index, sign, vpdiff;
     PyObject *rv, *str, *state;
-    int i, inputbuffer = 0, bufferstep;
+    int inputbuffer = 0, bufferstep;
 
     if ( !PyArg_ParseTuple(args, "s#iO:adpcm2lin",
                            &cp, &len, &size, &state) )
@@ -1539,7 +1536,7 @@
     } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) )
         return 0;
 
-    if (len > (INT_MAX/2)/size) {
+    if (len > (PY_SSIZE_T_MAX/2)/size) {
         PyErr_SetString(PyExc_MemoryError,
                         "not enough memory for output buffer");
         return 0;

Modified: python/branches/py3k-jit/configure
==============================================================================
--- python/branches/py3k-jit/configure	(original)
+++ python/branches/py3k-jit/configure	Tue May 11 19:58:55 2010
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 80728 .
+# From configure.in Revision: 80834 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.65 for python 3.2.
 #
@@ -5337,7 +5337,7 @@
 int
 main ()
 {
-int main() { return 0; }
+
   ;
   return 0;
 }
@@ -5350,11 +5350,11 @@
            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-
+	       void f(int **x) {}
 int
 main ()
 {
-void f(int **x) {} int main() { double *x; f((int **) &x); return 0; }
+double *x; f((int **) &x);
   ;
   return 0;
 }
@@ -5557,7 +5557,7 @@
 int
 main ()
 {
-int main() { return 0; }
+
   ;
   return 0;
 }
@@ -5599,7 +5599,7 @@
 int
 main ()
 {
-int main() { return 0; }
+
   ;
   return 0;
 }
@@ -9548,7 +9548,6 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include "confdefs.h"
 #include <stdio.h>
 
 int
@@ -9577,7 +9576,6 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include "confdefs.h"
 #include <sys/file.h>
 
 int
@@ -9606,7 +9604,6 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include "confdefs.h"
 #include <unistd.h>
 
 int
@@ -9926,7 +9923,6 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include "confdefs.h"
 #include <netdb.h>
 
 int
@@ -9956,7 +9952,6 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -9989,7 +9984,6 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -10022,7 +10016,6 @@
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#include "confdefs.h"
 #include <unistd.h>
 #ifdef HAVE_GRP_H
 #include <grp.h>

Modified: python/branches/py3k-jit/configure.in
==============================================================================
--- python/branches/py3k-jit/configure.in	(original)
+++ python/branches/py3k-jit/configure.in	Tue May 11 19:58:55 2010
@@ -916,14 +916,14 @@
      AC_CACHE_VAL(ac_cv_no_strict_aliasing,
        AC_COMPILE_IFELSE(
          [
-	   AC_LANG_PROGRAM([[]], [[int main() { return 0; }]])
+	   AC_LANG_PROGRAM([[]], [[]])
 	 ],[
 	   CC="$ac_save_cc -fstrict-aliasing"
            CFLAGS="$CFLAGS -Werror -Wstrict-aliasing"
            AC_COMPILE_IFELSE(
 	     [
-	       AC_LANG_PROGRAM([[]],
-	         [[void f(int **x) {} int main() { double *x; f((int **) &x); return 0; }]])
+	       AC_LANG_PROGRAM([[void f(int **x) {}]],
+	         [[double *x; f((int **) &x);]])
 	     ],[
 	       ac_cv_no_strict_aliasing=no
 	     ],[
@@ -1099,7 +1099,7 @@
 [ac_save_cc="$CC"
 CC="$CC -OPT:Olimit=0"
 AC_COMPILE_IFELSE(
-  [AC_LANG_PROGRAM([[]], [[int main() { return 0; }]])],
+  [AC_LANG_PROGRAM([[]], [[]])],
   [ac_cv_opt_olimit_ok=yes],
   [ac_cv_opt_olimit_ok=no]
   )
@@ -1122,7 +1122,7 @@
   [ac_save_cc="$CC"
   CC="$CC -Olimit 1500"
   AC_COMPILE_IFELSE(
-    [AC_LANG_PROGRAM([[]], [[int main() { return 0; }]])],
+    [AC_LANG_PROGRAM([[]], [[]])],
     [ac_cv_olimit_ok=yes],
     [ac_cv_olimit_ok=no]
     )
@@ -2663,7 +2663,6 @@
 
 AC_MSG_CHECKING(for ctermid_r)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h" 
 #include <stdio.h>
 ]], [[void* p = ctermid_r]])],
   [AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
@@ -2673,7 +2672,6 @@
 
 AC_MSG_CHECKING(for flock)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h" 
 #include <sys/file.h>
 ]], [[void* p = flock]])],
   [AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
@@ -2683,7 +2681,6 @@
 
 AC_MSG_CHECKING(for getpagesize)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h" 
 #include <unistd.h>
 ]], [[void* p = getpagesize]])],
   [AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
@@ -2774,7 +2771,6 @@
 
 AC_MSG_CHECKING(for hstrerror)
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h" 
 #include <netdb.h>
 ]], [[void* p = hstrerror; hstrerror(0)]])],
   [AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
@@ -2784,7 +2780,6 @@
 
 AC_MSG_CHECKING(for inet_aton)
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h" 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -2797,7 +2792,6 @@
 
 AC_MSG_CHECKING(for inet_pton)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h" 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -2811,7 +2805,6 @@
 # On some systems, setgroups is in unistd.h, on others, in grp.h
 AC_MSG_CHECKING(for setgroups)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h" 
 #include <unistd.h>
 #ifdef HAVE_GRP_H
 #include <grp.h>


More information about the Python-checkins mailing list