diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-11-09 22:02:48 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-11-09 22:02:48 (GMT) |
commit | 9f64caaf00340fce95c2980435ef819e385cf5ff (patch) | |
tree | b439eb38dfdf5fe534f0e8b31f72072870fe86e3 /Modules/newmodule.c | |
parent | 89c3a22a2788cb85b89990543e33236cd60ba307 (diff) | |
download | cpython-9f64caaf00340fce95c2980435ef819e385cf5ff.zip cpython-9f64caaf00340fce95c2980435ef819e385cf5ff.tar.gz cpython-9f64caaf00340fce95c2980435ef819e385cf5ff.tar.bz2 |
Use PyObject_CheckReadBuffer().
Diffstat (limited to 'Modules/newmodule.c')
-rw-r--r-- | Modules/newmodule.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/Modules/newmodule.c b/Modules/newmodule.c index 9a9cbf1..6c29fe4 100644 --- a/Modules/newmodule.c +++ b/Modules/newmodule.c @@ -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; |