[Python-checkins] python/dist/src/Objects complexobject.c,2.63,2.64

Raymond Hettinger python@rcn.com
Thu, 29 Aug 2002 14:44:02 -0400


I think this should be backported but am not certain.

----- Original Message ----- 
From: <rhettinger@users.sourceforge.net>
To: <python-checkins@python.org>
Sent: Thursday, August 29, 2002 10:22 AM
Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.63,2.64


> Update of /cvsroot/python/python/dist/src/Objects
> In directory usw-pr-cvs1:/tmp/cvs-serv26220/Objects
> 
> Modified Files:
> complexobject.c 
> Log Message:
> complex() was the only numeric constructor that created a new instance
> when given its own type as an argument.
> 
> 
> Index: complexobject.c
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v
> retrieving revision 2.63
> retrieving revision 2.64
> diff -C2 -d -r2.63 -r2.64
> *** complexobject.c 19 Aug 2002 19:26:42 -0000 2.63
> --- complexobject.c 29 Aug 2002 14:22:50 -0000 2.64
> ***************
> *** 824,827 ****
> --- 824,836 ----
>   &r, &i))
>   return NULL;
> + 
> + /* Special-case for single argumet that is already complex */
> + if (PyComplex_CheckExact(r) && i == NULL) {
> + /* Note that we can't know whether it's safe to return
> +    a complex *subclass* instance as-is, hence the restriction
> +    to exact complexes here.  */
> + Py_INCREF(r);
> + return r;
> + }
>   if (PyString_Check(r) || PyUnicode_Check(r)) {
>   if (i != NULL) {
> 
> 
> 
> _______________________________________________
> Python-checkins mailing list
> Python-checkins@python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>