[issue5175] negative PyLong -> C unsigned integral, TypeError or OverflowError?
Lisandro Dalcin
report at bugs.python.org
Sat Feb 7 00:37:46 CET 2009
New submission from Lisandro Dalcin <dalcinl at gmail.com>:
At Objects/longobject.c, in almost all cases
OverflowError is raised when a unsigned integral is requested from a
negative PyLong. However, this one breaks the rules:
int
_PyLong_AsByteArray(PyLongObject* v,
unsigned char* bytes, size_t n,
int little_endian, int is_signed)
{
<...>
if (!is_signed) {
PyErr_SetString(PyExc_TypeError,
"can't convert negative long to
unsigned");
return -1;
}
<...>
}
----------
components: Interpreter Core
messages: 81316
nosy: dalcinl
severity: normal
status: open
title: negative PyLong -> C unsigned integral, TypeError or OverflowError?
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5175>
_______________________________________
More information about the Python-bugs-list
mailing list