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.
This commit is contained in:
Larry Hastings 2012-05-24 22:58:30 -07:00
parent 5ed7bd79df
commit ca28e99202

View File

@ -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;