summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-08 21:05:48 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-08 21:05:48 (GMT)
commitf9e91c9c58de72afdf51f2a6ebfe50e98beeaa78 (patch)
treef2dd45d9585bc92e27c45e345fae3e906e3f2204 /Python
parent2b08b38deacc065b4fea8421528de1eed66d56b0 (diff)
downloadcpython-f9e91c9c58de72afdf51f2a6ebfe50e98beeaa78.zip
cpython-f9e91c9c58de72afdf51f2a6ebfe50e98beeaa78.tar.gz
cpython-f9e91c9c58de72afdf51f2a6ebfe50e98beeaa78.tar.bz2
Given that ord() of a bytes object of length 1 is defined, it should
never return a negative number.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 264470b..aa0d0df 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1482,7 +1482,7 @@ builtin_ord(PyObject *self, PyObject* obj)
/* XXX Hopefully this is temporary */
size = PyBytes_GET_SIZE(obj);
if (size == 1) {
- ord = (long)*PyBytes_AS_STRING(obj);
+ ord = (long)((unsigned char)*PyBytes_AS_STRING(obj));
return PyInt_FromLong(ord);
}
}