[Python-3000-checkins] r51646 - in python/branches/p3yk: Doc/api/refcounts.dat Doc/lib/libfuncs.tex Doc/tut/tut.tex Include/object.h Objects/longobject.c Objects/object.c Objects/typeobject.c

neal.norwitz python-3000-checkins at python.org
Tue Aug 29 09:58:00 CEST 2006


Author: neal.norwitz
Date: Tue Aug 29 09:57:59 2006
New Revision: 51646

Modified:
   python/branches/p3yk/Doc/api/refcounts.dat
   python/branches/p3yk/Doc/lib/libfuncs.tex
   python/branches/p3yk/Doc/tut/tut.tex
   python/branches/p3yk/Include/object.h
   python/branches/p3yk/Objects/longobject.c
   python/branches/p3yk/Objects/object.c
   python/branches/p3yk/Objects/typeobject.c
Log:
Get rid of more coerce cruft (really check in this time :-)

Modified: python/branches/p3yk/Doc/api/refcounts.dat
==============================================================================
--- python/branches/p3yk/Doc/api/refcounts.dat	(original)
+++ python/branches/p3yk/Doc/api/refcounts.dat	Tue Aug 29 09:57:59 2006
@@ -712,10 +712,6 @@
 PyNumber_Check:PyObject*:o:0:
 PyNumber_Check:int:::
 
-PyNumber_Coerce:int:::
-PyNumber_Coerce:PyObject**:p1:+1:
-PyNumber_Coerce:PyObject**:p2:+1:
-
 PyNumber_Divide:PyObject*::+1:
 PyNumber_Divide:PyObject*:o1:0:
 PyNumber_Divide:PyObject*:o2:0:

Modified: python/branches/p3yk/Doc/lib/libfuncs.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libfuncs.tex	(original)
+++ python/branches/p3yk/Doc/lib/libfuncs.tex	Tue Aug 29 09:57:59 2006
@@ -1228,12 +1228,6 @@
   argument).
 \end{funcdesc}
 
-\begin{funcdesc}{coerce}{x, y}
-  Return a tuple consisting of the two numeric arguments converted to
-  a common type, using the same rules as used by arithmetic
-  operations. If coercion is not possible, raise \exception{TypeError}.
-\end{funcdesc}
-
 \begin{funcdesc}{intern}{string}
   Enter \var{string} in the table of ``interned'' strings and return
   the interned string -- which is \var{string} itself or a copy.

Modified: python/branches/p3yk/Doc/tut/tut.tex
==============================================================================
--- python/branches/p3yk/Doc/tut/tut.tex	(original)
+++ python/branches/p3yk/Doc/tut/tut.tex	Tue Aug 29 09:57:59 2006
@@ -2696,7 +2696,7 @@
  'UserWarning', 'ValueError', 'Warning', 'WindowsError',
  'ZeroDivisionError', '_', '__debug__', '__doc__', '__import__',
  '__name__', 'abs', 'basestring', 'bool', 'buffer',
- 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 'compile',
+ 'callable', 'chr', 'classmethod', 'cmp', 'compile',
  'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod',
  'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float',
  'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex',

Modified: python/branches/p3yk/Include/object.h
==============================================================================
--- python/branches/p3yk/Include/object.h	(original)
+++ python/branches/p3yk/Include/object.h	Tue Aug 29 09:57:59 2006
@@ -395,7 +395,6 @@
 PyAPI_FUNC(int) PyObject_IsTrue(PyObject *);
 PyAPI_FUNC(int) PyObject_Not(PyObject *);
 PyAPI_FUNC(int) PyCallable_Check(PyObject *);
-PyAPI_FUNC(int) PyNumber_CoerceEx(PyObject **, PyObject **);
 
 PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *);
 

Modified: python/branches/p3yk/Objects/longobject.c
==============================================================================
--- python/branches/p3yk/Objects/longobject.c	(original)
+++ python/branches/p3yk/Objects/longobject.c	Tue Aug 29 09:57:59 2006
@@ -3158,22 +3158,6 @@
 	return c;
 }
 
-static int
-long_coerce(PyObject **pv, PyObject **pw)
-{
-	if (PyInt_Check(*pw)) {
-		*pw = PyLong_FromLong(PyInt_AS_LONG(*pw));
-		Py_INCREF(*pv);
-		return 0;
-	}
-	else if (PyLong_Check(*pw)) {
-		Py_INCREF(*pv);
-		Py_INCREF(*pw);
-		return 0;
-	}
-	return 1; /* Can't do it */
-}
-
 static PyObject *
 long_long(PyObject *v)
 {
@@ -3330,7 +3314,7 @@
 			long_and,	/*nb_and*/
 			long_xor,	/*nb_xor*/
 			long_or,	/*nb_or*/
-			long_coerce,	/*nb_coerce*/
+			0,		/*nb_coerce*/
 			long_int,	/*nb_int*/
 			long_long,	/*nb_long*/
 			long_float,	/*nb_float*/

Modified: python/branches/p3yk/Objects/object.c
==============================================================================
--- python/branches/p3yk/Objects/object.c	(original)
+++ python/branches/p3yk/Objects/object.c	Tue Aug 29 09:57:59 2006
@@ -1273,33 +1273,6 @@
 	return res == 0;
 }
 
-/* Coerce two numeric types to the "larger" one.
-   Increment the reference count on each argument.
-   Return value:
-   -1 if an error occurred;
-   0 if the coercion succeeded (and then the reference counts are increased);
-   1 if no coercion is possible (and no error is raised).
-*/
-int
-PyNumber_CoerceEx(PyObject **pv, PyObject **pw)
-{
-	register PyObject *v = *pv;
-	register PyObject *w = *pw;
-	int res;
-
-	if (v->ob_type->tp_as_number && v->ob_type->tp_as_number->nb_coerce) {
-		res = (*v->ob_type->tp_as_number->nb_coerce)(pv, pw);
-		if (res <= 0)
-			return res;
-	}
-	if (w->ob_type->tp_as_number && w->ob_type->tp_as_number->nb_coerce) {
-		res = (*w->ob_type->tp_as_number->nb_coerce)(pw, pv);
-		if (res <= 0)
-			return res;
-	}
-	return 1;
-}
-
 /* Test whether an object can be called */
 
 int

Modified: python/branches/p3yk/Objects/typeobject.c
==============================================================================
--- python/branches/p3yk/Objects/typeobject.c	(original)
+++ python/branches/p3yk/Objects/typeobject.c	Tue Aug 29 09:57:59 2006
@@ -2935,7 +2935,6 @@
 		COPYNUM(nb_and);
 		COPYNUM(nb_xor);
 		COPYNUM(nb_or);
-		COPYNUM(nb_coerce);
 		COPYNUM(nb_int);
 		COPYNUM(nb_long);
 		COPYNUM(nb_float);


More information about the Python-3000-checkins mailing list