mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Use PyObject_CheckReadBuffer().
This commit is contained in:
parent
89c3a22a27
commit
9f64caaf00
3 changed files with 5 additions and 23 deletions
|
@ -153,12 +153,7 @@ new_code(PyObject* unused, PyObject* args)
|
|||
Py_DECREF(empty);
|
||||
}
|
||||
|
||||
pb = code->ob_type->tp_as_buffer;
|
||||
if (pb == NULL ||
|
||||
pb->bf_getreadbuffer == NULL ||
|
||||
pb->bf_getsegcount == NULL ||
|
||||
(*pb->bf_getsegcount)(code, NULL) != 1)
|
||||
{
|
||||
if (!PyObject_CheckReadBuffer(code)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"bytecode object must be a single-segment read-only buffer");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue