Commit ca28e992 authored by Larry Hastings's avatar Larry Hastings

Issue #14889: PyBytes_FromObject(bytes) now just increfs and returns.

Previously, if you passed in a bytes object, it would create a whole
new object.
parent 5ed7bd79
......@@ -2577,6 +2577,12 @@ PyBytes_FromObject(PyObject *x)
PyErr_BadInternalCall();
return NULL;
}
if (PyBytes_CheckExact(x)) {
Py_INCREF(x);
return x;
}
/* Use the modern buffer interface */
if (PyObject_CheckBuffer(x)) {
Py_buffer view;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment