diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-06-12 17:44:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-12 17:44:32 (GMT) |
commit | c43317d41e7248405f40864bcc62f675805f4fd0 (patch) | |
tree | 665e1cc2011cca8ca4d271e7ca34bd9be8302c23 /Objects | |
parent | b441e99d89a3f05210cc36ade57699384986ca00 (diff) | |
download | cpython-c43317d41e7248405f40864bcc62f675805f4fd0.zip cpython-c43317d41e7248405f40864bcc62f675805f4fd0.tar.gz cpython-c43317d41e7248405f40864bcc62f675805f4fd0.tar.bz2 |
[3.10] Add more const modifiers. (GH-26691). (GH-26692)
(cherry picked from commit be8b631b7a587aa781245e14c8cca32970e1be5b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/codeobject.c | 6 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index c76ac90..976cec5 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -294,7 +294,7 @@ _PyCode_InitOpcache(PyCodeObject *co) return -1; } - _Py_CODEUNIT *opcodes = (_Py_CODEUNIT*)PyBytes_AS_STRING(co->co_code); + const _Py_CODEUNIT *opcodes = (_Py_CODEUNIT*)PyBytes_AS_STRING(co->co_code); Py_ssize_t opts = 0; for (Py_ssize_t i = 0; i < co_size;) { @@ -1255,7 +1255,7 @@ PyCode_Addr2Line(PyCodeObject *co, int addrq) } void -PyLineTable_InitAddressRange(char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range) +PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range) { range->opaque.lo_next = linetable; range->opaque.limit = range->opaque.lo_next + length; @@ -1268,7 +1268,7 @@ PyLineTable_InitAddressRange(char *linetable, Py_ssize_t length, int firstlineno int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds) { - char *linetable = PyBytes_AS_STRING(co->co_linetable); + const char *linetable = PyBytes_AS_STRING(co->co_linetable); Py_ssize_t length = PyBytes_GET_SIZE(co->co_linetable); PyLineTable_InitAddressRange(linetable, length, co->co_firstlineno, bounds); return bounds->ar_line; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index bfd5c88..342e7ee 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -658,7 +658,7 @@ unicode_result_ready(PyObject *unicode) if (length == 1) { int kind = PyUnicode_KIND(unicode); if (kind == PyUnicode_1BYTE_KIND) { - Py_UCS1 *data = PyUnicode_1BYTE_DATA(unicode); + const Py_UCS1 *data = PyUnicode_1BYTE_DATA(unicode); Py_UCS1 ch = data[0]; struct _Py_unicode_state *state = get_unicode_state(); PyObject *latin1_char = state->latin1[ch]; |