diff Objects/longobject.c @ 51517:20609fc13a13 legacy-trunk

Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError for negative arguments. Previously, it raised TypeError. Thanks Lisandro Dalcin.
author Mark Dickinson <dickinsm@gmail.com>
date Tue, 10 Feb 2009 15:46:50 +0000
parents 2ea75f60d9e5
children b55a3b5d7008
line wrap: on
line diff
--- a/Objects/longobject.c	Tue Feb 10 13:32:24 2009 +0000
+++ b/Objects/longobject.c	Tue Feb 10 15:46:50 2009 +0000
@@ -557,7 +557,7 @@
 	if (Py_SIZE(v) < 0) {
 		ndigits = -(Py_SIZE(v));
 		if (!is_signed) {
-			PyErr_SetString(PyExc_TypeError,
+			PyErr_SetString(PyExc_OverflowError,
 				"can't convert negative long to unsigned");
 			return -1;
 		}