summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index c760dcb..1c36fe5 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1437,6 +1437,13 @@ builtin_ord(PyObject *self, PyObject* obj)
ord = (long)((unsigned char)*PyString_AS_STRING(obj));
return PyInt_FromLong(ord);
}
+ } else if (PyBytes_Check(obj)) {
+ size = PyBytes_GET_SIZE(obj);
+ if (size == 1) {
+ ord = (long)((unsigned char)*PyBytes_AS_STRING(obj));
+ return PyInt_FromLong(ord);
+ }
+
#ifdef Py_USING_UNICODE
} else if (PyUnicode_Check(obj)) {
size = PyUnicode_GET_SIZE(obj);
@@ -2552,6 +2559,7 @@ _PyBuiltin_Init(void)
SETBUILTIN("basestring", &PyBaseString_Type);
SETBUILTIN("bool", &PyBool_Type);
/* SETBUILTIN("memoryview", &PyMemoryView_Type); */
+ SETBUILTIN("bytearray", &PyBytes_Type);
SETBUILTIN("bytes", &PyString_Type);
SETBUILTIN("buffer", &PyBuffer_Type);
SETBUILTIN("classmethod", &PyClassMethod_Type);