[Patches] A little optimization in PyObject_Cmp()
M.-A. Lemburg
mal@lemburg.com
Thu, 22 Jun 2000 22:12:29 +0200
Gisle Aas wrote:
>
> Avoid calling PyErr_Occurred() all the time...
>
> Index: Objects/abstract.c
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v
> retrieving revision 2.35
> diff -u -p -u -r2.35 abstract.c
> --- Objects/abstract.c 2000/06/18 18:43:14 2.35
> +++ Objects/abstract.c 2000/06/22 19:27:42
> @@ -68,7 +68,7 @@ PyObject_Cmp(o1, o2, result)
> return -1;
> }
> r = PyObject_Compare(o1, o2);
> - if (PyErr_Occurred())
> + if (r == -1 && PyErr_Occurred())
Is this documented ? I mean: will all implementations return
-1 in the error case ?
(I think this is the case for the core interpreter, but
what about extensions ?)
> return -1;
> *result = r;
> return 0;
>
> _______________________________________________
> Patches mailing list
> Patches@python.org
> http://www.python.org/mailman/listinfo/patches
--
Marc-Andre Lemburg
______________________________________________________________________
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/