mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
gh-103583: Always pass multibyte codec structs as const (#103588)
This commit is contained in:
parent
ffdbfe1976
commit
e989e0b62a
2 changed files with 7 additions and 7 deletions
|
|
@ -67,7 +67,7 @@ typedef struct {
|
||||||
static char *incnewkwarglist[] = {"errors", NULL};
|
static char *incnewkwarglist[] = {"errors", NULL};
|
||||||
static char *streamkwarglist[] = {"stream", "errors", NULL};
|
static char *streamkwarglist[] = {"stream", "errors", NULL};
|
||||||
|
|
||||||
static PyObject *multibytecodec_encode(MultibyteCodec *,
|
static PyObject *multibytecodec_encode(const MultibyteCodec *,
|
||||||
MultibyteCodec_State *, PyObject *, Py_ssize_t *,
|
MultibyteCodec_State *, PyObject *, Py_ssize_t *,
|
||||||
PyObject *, int);
|
PyObject *, int);
|
||||||
|
|
||||||
|
|
@ -221,7 +221,7 @@ expand_encodebuffer(MultibyteEncodeBuffer *buf, Py_ssize_t esize)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
multibytecodec_encerror(MultibyteCodec *codec,
|
multibytecodec_encerror(const MultibyteCodec *codec,
|
||||||
MultibyteCodec_State *state,
|
MultibyteCodec_State *state,
|
||||||
MultibyteEncodeBuffer *buf,
|
MultibyteEncodeBuffer *buf,
|
||||||
PyObject *errors, Py_ssize_t e)
|
PyObject *errors, Py_ssize_t e)
|
||||||
|
|
@ -375,7 +375,7 @@ errorexit:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
multibytecodec_decerror(MultibyteCodec *codec,
|
multibytecodec_decerror(const MultibyteCodec *codec,
|
||||||
MultibyteCodec_State *state,
|
MultibyteCodec_State *state,
|
||||||
MultibyteDecodeBuffer *buf,
|
MultibyteDecodeBuffer *buf,
|
||||||
PyObject *errors, Py_ssize_t e)
|
PyObject *errors, Py_ssize_t e)
|
||||||
|
|
@ -479,7 +479,7 @@ errorexit:
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
multibytecodec_encode(MultibyteCodec *codec,
|
multibytecodec_encode(const MultibyteCodec *codec,
|
||||||
MultibyteCodec_State *state,
|
MultibyteCodec_State *state,
|
||||||
PyObject *text, Py_ssize_t *inpos_t,
|
PyObject *text, Py_ssize_t *inpos_t,
|
||||||
PyObject *errors, int flags)
|
PyObject *errors, int flags)
|
||||||
|
|
@ -1953,7 +1953,7 @@ _multibytecodec___create_codec(PyObject *module, PyObject *arg)
|
||||||
/*[clinic end generated code: output=cfa3dce8260e809d input=6840b2a6b183fcfa]*/
|
/*[clinic end generated code: output=cfa3dce8260e809d input=6840b2a6b183fcfa]*/
|
||||||
{
|
{
|
||||||
MultibyteCodecObject *self;
|
MultibyteCodecObject *self;
|
||||||
MultibyteCodec *codec;
|
const MultibyteCodec *codec;
|
||||||
|
|
||||||
if (!PyCapsule_IsValid(arg, PyMultibyteCodec_CAPSULE_NAME)) {
|
if (!PyCapsule_IsValid(arg, PyMultibyteCodec_CAPSULE_NAME)) {
|
||||||
PyErr_SetString(PyExc_ValueError, "argument type invalid");
|
PyErr_SetString(PyExc_ValueError, "argument type invalid");
|
||||||
|
|
|
||||||
|
|
@ -62,14 +62,14 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
MultibyteCodec *codec;
|
const MultibyteCodec *codec;
|
||||||
} MultibyteCodecObject;
|
} MultibyteCodecObject;
|
||||||
|
|
||||||
#define MultibyteCodec_Check(state, op) Py_IS_TYPE((op), state->multibytecodec_type)
|
#define MultibyteCodec_Check(state, op) Py_IS_TYPE((op), state->multibytecodec_type)
|
||||||
|
|
||||||
#define _MultibyteStatefulCodec_HEAD \
|
#define _MultibyteStatefulCodec_HEAD \
|
||||||
PyObject_HEAD \
|
PyObject_HEAD \
|
||||||
MultibyteCodec *codec; \
|
const MultibyteCodec *codec; \
|
||||||
MultibyteCodec_State state; \
|
MultibyteCodec_State state; \
|
||||||
PyObject *errors;
|
PyObject *errors;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue