[Python-checkins] bpo-46841: Use a `bytes` object for `_co_code_adaptive` (GH-32205)

markshannon webhook-mailer at python.org
Fri Apr 1 07:29:29 EDT 2022


https://github.com/python/cpython/commit/ae9de82e321581e1906c6ef2a7ad83ab30ae3325
commit: ae9de82e321581e1906c6ef2a7ad83ab30ae3325
branch: main
author: Brandt Bucher <brandtbucher at microsoft.com>
committer: markshannon <mark at hotpy.org>
date: 2022-04-01T12:28:50+01:00
summary:

bpo-46841: Use a `bytes` object for `_co_code_adaptive` (GH-32205)

files:
M Objects/codeobject.c

diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 987cdef3c90d4..7d50b40ec4536 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -1523,8 +1523,8 @@ code_getfreevars(PyCodeObject *code, void *closure)
 static PyObject *
 code_getcodeadaptive(PyCodeObject *code, void *closure)
 {
-    return PyMemoryView_FromMemory(code->co_code_adaptive, _PyCode_NBYTES(code),
-                                   PyBUF_READ);
+    return PyBytes_FromStringAndSize(code->co_code_adaptive,
+                                     _PyCode_NBYTES(code));
 }
 
 static PyObject *



More information about the Python-checkins mailing list