Mercurial > cpython-lru_cache-weakref
comparison Python/ceval.c @ 4009:61106986a1a4 legacy-trunk
Don't test here for negative number to float power; that belongs in
floatobject.c.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 16 Aug 1996 20:49:17 +0000 |
| parents | 138fa15a1032 |
| children | f41f0caf1cfc |
comparison
equal
deleted
inserted
replaced
| 4008:18c32714f8ba | 4009:61106986a1a4 |
|---|---|
| 2280 if (v->ob_type->tp_as_number == NULL || | 2280 if (v->ob_type->tp_as_number == NULL || |
| 2281 w->ob_type->tp_as_number == NULL) { | 2281 w->ob_type->tp_as_number == NULL) { |
| 2282 err_setstr(TypeError, "pow() requires numeric arguments"); | 2282 err_setstr(TypeError, "pow() requires numeric arguments"); |
| 2283 return NULL; | 2283 return NULL; |
| 2284 } | 2284 } |
| 2285 if ( | |
| 2286 #ifndef WITHOUT_COMPLEX | |
| 2287 !is_complexobject(v) && | |
| 2288 #endif | |
| 2289 is_floatobject(w) && getfloatvalue(v) < 0.0) { | |
| 2290 if (!err_occurred()) | |
| 2291 err_setstr(ValueError, "negative number to float power"); | |
| 2292 return NULL; | |
| 2293 } | |
| 2294 if (coerce(&v, &w) != 0) | 2285 if (coerce(&v, &w) != 0) |
| 2295 return NULL; | 2286 return NULL; |
| 2296 res = (*v->ob_type->tp_as_number->nb_power)(v, w, None); | 2287 res = (*v->ob_type->tp_as_number->nb_power)(v, w, None); |
| 2297 DECREF(v); | 2288 DECREF(v); |
| 2298 DECREF(w); | 2289 DECREF(w); |
