Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Modules/_csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ Reader_iternext(ReaderObj *self)
Py_UCS4 c;
Py_ssize_t pos, linelen;
unsigned int kind;
void *data;
const void *data;
PyObject *lineobj;

if (parse_reset(self) < 0)
Expand Down Expand Up @@ -996,7 +996,7 @@ join_reset(WriterObj *self)
* record length.
*/
static Py_ssize_t
join_append_data(WriterObj *self, unsigned int field_kind, void *field_data,
join_append_data(WriterObj *self, unsigned int field_kind, const void *field_data,
Py_ssize_t field_len, int *quoted,
int copy_phase)
{
Expand Down Expand Up @@ -1107,7 +1107,7 @@ static int
join_append(WriterObj *self, PyObject *field, int quoted)
{
unsigned int field_kind = -1;
void *field_data = NULL;
const void *field_data = NULL;
Py_ssize_t field_len = 0;
Py_ssize_t rec_len;

Expand Down Expand Up @@ -1139,7 +1139,7 @@ join_append_lineterminator(WriterObj *self)
{
Py_ssize_t terminator_len, i;
unsigned int term_kind;
void *term_data;
const void *term_data;

terminator_len = PyUnicode_GET_LENGTH(self->dialect->lineterminator);
if (terminator_len == -1)
Expand Down
4 changes: 2 additions & 2 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,7 @@ dec_dealloc(PyObject *dec)
/******************************************************************************/

Py_LOCAL_INLINE(int)
is_space(enum PyUnicode_Kind kind, void *data, Py_ssize_t pos)
is_space(enum PyUnicode_Kind kind, const void *data, Py_ssize_t pos)
{
Py_UCS4 ch = PyUnicode_READ(kind, data, pos);
return Py_UNICODE_ISSPACE(ch);
Expand All @@ -1896,7 +1896,7 @@ static char *
numeric_as_ascii(const PyObject *u, int strip_ws, int ignore_underscores)
{
enum PyUnicode_Kind kind;
void *data;
const void *data;
Py_UCS4 ch;
char *res, *cp;
Py_ssize_t j, len;
Expand Down
2 changes: 1 addition & 1 deletion Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ checkpath(PyObject* tag)

if (PyUnicode_Check(tag)) {
const Py_ssize_t len = PyUnicode_GET_LENGTH(tag);
void *data = PyUnicode_DATA(tag);
const void *data = PyUnicode_DATA(tag);
unsigned int kind = PyUnicode_KIND(tag);
if (len >= 3 && PyUnicode_READ(kind, data, 0) == '{' && (
PyUnicode_READ(kind, data, 1) == '}' || (
Expand Down
10 changes: 5 additions & 5 deletions Modules/_io/textio.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself,
goto error;
kind = PyUnicode_KIND(modified);
out = PyUnicode_DATA(modified);
PyUnicode_WRITE(kind, PyUnicode_DATA(modified), 0, '\r');
PyUnicode_WRITE(kind, out, 0, '\r');
memcpy(out + kind, PyUnicode_DATA(output), kind * output_len);
Py_DECREF(output);
output = modified; /* output remains ready */
Expand All @@ -367,7 +367,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself,
/* Record which newlines are read and do newline translation if desired,
all in one pass. */
{
void *in_str;
const void *in_str;
Py_ssize_t len;
int seennl = self->seennl;
int only_lf = 0;
Expand Down Expand Up @@ -447,7 +447,7 @@ _PyIncrementalNewlineDecoder_decode(PyObject *myself,
else {
void *translated;
int kind = PyUnicode_KIND(output);
void *in_str = PyUnicode_DATA(output);
const void *in_str = PyUnicode_DATA(output);
Py_ssize_t in, out;
/* XXX: Previous in-place translation here is disabled as
resizing is not possible anymore */
Expand Down Expand Up @@ -2085,7 +2085,7 @@ _PyIO_find_line_ending(
else {
/* Non-universal mode. */
Py_ssize_t readnl_len = PyUnicode_GET_LENGTH(readnl);
Py_UCS1 *nl = PyUnicode_1BYTE_DATA(readnl);
const Py_UCS1 *nl = PyUnicode_1BYTE_DATA(readnl);
/* Assume that readnl is an ASCII character. */
assert(PyUnicode_KIND(readnl) == PyUnicode_1BYTE_KIND);
if (readnl_len == 1) {
Expand Down Expand Up @@ -2139,7 +2139,7 @@ _textiowrapper_readline(textio *self, Py_ssize_t limit)
chunked = 0;

while (1) {
char *ptr;
const char *ptr;
Py_ssize_t line_len;
int kind;
Py_ssize_t consumed = 0;
Expand Down
14 changes: 7 additions & 7 deletions Modules/_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ ascii_escape_unicode(PyObject *pystr)
Py_ssize_t output_size;
Py_ssize_t chars;
PyObject *rval;
void *input;
unsigned char *output;
const void *input;
Py_UCS1 *output;
int kind;

if (PyUnicode_READY(pystr) == -1)
Expand Down Expand Up @@ -225,7 +225,7 @@ escape_unicode(PyObject *pystr)
Py_ssize_t output_size;
Py_ssize_t chars;
PyObject *rval;
void *input;
const void *input;
int kind;
Py_UCS4 maxchar;

Expand Down Expand Up @@ -677,7 +677,7 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss

Returns a new PyObject (usually a dict, but object_hook can change that)
*/
void *str;
const void *str;
int kind;
Py_ssize_t end_idx;
PyObject *val = NULL;
Expand Down Expand Up @@ -807,7 +807,7 @@ _parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssi

Returns a new PyList
*/
void *str;
const void *str;
int kind;
Py_ssize_t end_idx;
PyObject *val = NULL;
Expand Down Expand Up @@ -910,7 +910,7 @@ _match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_
PyLong, or PyFloat.
May return other types if parse_int or parse_float are set
*/
void *str;
const void *str;
int kind;
Py_ssize_t end_idx;
Py_ssize_t idx = start;
Expand Down Expand Up @@ -1027,7 +1027,7 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_
Returns a new PyObject representation of the term.
*/
PyObject *res;
void *str;
const void *str;
int kind;
Py_ssize_t length;

Expand Down
2 changes: 1 addition & 1 deletion Modules/_operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
for (idx = 0; idx < nattrs; ++idx) {
PyObject *item = PyTuple_GET_ITEM(args, idx);
Py_ssize_t item_len;
void *data;
const void *data;
unsigned int kind;
int dot_count;

Expand Down
2 changes: 1 addition & 1 deletion Modules/_pickle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2581,7 +2581,7 @@ raw_unicode_escape(PyObject *obj)
{
char *p;
Py_ssize_t i, size;
void *data;
const void *data;
unsigned int kind;
_PyBytesWriter writer;

Expand Down
2 changes: 1 addition & 1 deletion Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
const char *uppercase_name_str;
int rc;
unsigned int kind;
void *data;
const void *data;

if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
goto finally;
Expand Down
12 changes: 6 additions & 6 deletions Modules/_sre.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ state_reset(SRE_STATE* state)
data_stack_dealloc(state);
}

static void*
static const void*
getstring(PyObject* string, Py_ssize_t* p_length,
int* p_isbytes, int* p_charsize,
Py_buffer *view)
Expand Down Expand Up @@ -398,11 +398,11 @@ state_init(SRE_STATE* state, PatternObject* pattern, PyObject* string,

Py_ssize_t length;
int isbytes, charsize;
void* ptr;
const void* ptr;

memset(state, 0, sizeof(SRE_STATE));

state->mark = PyMem_New(void *, pattern->groups * 2);
state->mark = PyMem_New(const void *, pattern->groups * 2);
if (!state->mark) {
PyErr_NoMemory();
goto err;
Expand Down Expand Up @@ -891,7 +891,7 @@ _sre_SRE_Pattern_split_impl(PatternObject *self, PyObject *string,
Py_ssize_t status;
Py_ssize_t n;
Py_ssize_t i;
void* last;
const void* last;

assert(self->codesize != 0);

Expand Down Expand Up @@ -984,7 +984,7 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,
PyObject* item;
PyObject* filter;
PyObject* match;
void* ptr;
const void* ptr;
Py_ssize_t status;
Py_ssize_t n;
Py_ssize_t i, b, e;
Expand Down Expand Up @@ -1895,7 +1895,7 @@ match_getslice_by_index(MatchObject* self, Py_ssize_t index, PyObject* def)
int isbytes, charsize;
Py_buffer view;
PyObject *result;
void* ptr;
const void* ptr;
Py_ssize_t i, j;

assert(0 <= index && index < self->groups);
Expand Down
2 changes: 1 addition & 1 deletion Modules/cjkcodecs/cjkcodecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static const struct dbcs_map *mapping_list;
#define ENCODER(encoding) \
static Py_ssize_t encoding##_encode( \
MultibyteCodec_State *state, const void *config, \
int kind, void *data, \
int kind, const void *data, \
Py_ssize_t *inpos, Py_ssize_t inlen, \
unsigned char **outbuf, Py_ssize_t outleft, int flags)
#define ENCODER_RESET(encoding) \
Expand Down
4 changes: 2 additions & 2 deletions Modules/cjkcodecs/multibytecodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ multibytecodec_encerror(MultibyteCodec *codec,
Py_ssize_t r;
Py_ssize_t inpos;
int kind;
void *data;
const void *data;

replchar = PyUnicode_FromOrdinal('?');
if (replchar == NULL)
Expand Down Expand Up @@ -457,7 +457,7 @@ multibytecodec_encode(MultibyteCodec *codec,
Py_ssize_t finalsize, r = 0;
Py_ssize_t datalen;
int kind;
void *data;
const void *data;

if (PyUnicode_READY(text) < 0)
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion Modules/cjkcodecs/multibytecodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ typedef struct {
typedef int (*mbcodec_init)(const void *config);
typedef Py_ssize_t (*mbencode_func)(MultibyteCodec_State *state,
const void *config,
int kind, void *data,
int kind, const void *data,
Py_ssize_t *inpos, Py_ssize_t inlen,
unsigned char **outbuf, Py_ssize_t outleft,
int flags);
Expand Down
2 changes: 1 addition & 1 deletion Modules/pyexpat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ PyUnknownEncodingHandler(void *encodingHandlerData,
static unsigned char template_buffer[256] = {0};
PyObject* u;
int i;
void *data;
const void *data;
unsigned int kind;

if (PyErr_Occurred())
Expand Down
14 changes: 7 additions & 7 deletions Modules/sre.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ typedef struct {

typedef struct SRE_REPEAT_T {
Py_ssize_t count;
SRE_CODE* pattern; /* points to REPEAT operator arguments */
void* last_ptr; /* helper to check for infinite loops */
const SRE_CODE* pattern; /* points to REPEAT operator arguments */
const void* last_ptr; /* helper to check for infinite loops */
struct SRE_REPEAT_T *prev; /* points to previous repeat context */
} SRE_REPEAT;

typedef struct {
/* string pointers */
void* ptr; /* current position (also end of current slice) */
void* beginning; /* start of original string */
void* start; /* start of current slice */
void* end; /* end of original string */
const void* ptr; /* current position (also end of current slice) */
const void* beginning; /* start of original string */
const void* start; /* start of current slice */
const void* end; /* end of original string */
/* attributes for the match object */
PyObject* string;
Py_buffer buffer;
Expand All @@ -74,7 +74,7 @@ typedef struct {
/* registers */
Py_ssize_t lastindex;
Py_ssize_t lastmark;
void** mark;
const void** mark;
int match_all;
int must_advance;
/* dynamically allocated stuff */
Expand Down
Loading