mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
Issue #25923: Added the const qualifier to static constant arrays.
This commit is contained in:
parent
ea8c43152f
commit
2d06e84455
44 changed files with 139 additions and 134 deletions
|
|
@ -644,7 +644,7 @@ PyObject_Bytes(PyObject *v)
|
|||
/* Map rich comparison operators to their swapped version, e.g. LT <--> GT */
|
||||
int _Py_SwappedOp[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE};
|
||||
|
||||
static char *opstrings[] = {"<", "<=", "==", "!=", ">", ">="};
|
||||
static const char * const opstrings[] = {"<", "<=", "==", "!=", ">", ">="};
|
||||
|
||||
/* Perform a rich comparison, raising TypeError when the requested comparison
|
||||
operator is not supported. */
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
|
||||
static char visible_length_key[] = "n_sequence_fields";
|
||||
static char real_length_key[] = "n_fields";
|
||||
static char unnamed_fields_key[] = "n_unnamed_fields";
|
||||
static const char visible_length_key[] = "n_sequence_fields";
|
||||
static const char real_length_key[] = "n_fields";
|
||||
static const char unnamed_fields_key[] = "n_unnamed_fields";
|
||||
|
||||
/* Fields with this name have only a field index, not a field name.
|
||||
They are only allowed for indices < n_visible_fields. */
|
||||
|
|
|
|||
|
|
@ -2690,7 +2690,7 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static short slotoffsets[] = {
|
||||
static const short slotoffsets[] = {
|
||||
-1, /* invalid slot */
|
||||
#include "typeslots.inc"
|
||||
};
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ raise_encode_exception(PyObject **exceptionObject,
|
|||
const char *reason);
|
||||
|
||||
/* Same for linebreaks */
|
||||
static unsigned char ascii_linebreak[] = {
|
||||
static const unsigned char ascii_linebreak[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/* 0x000A, * LINE FEED */
|
||||
/* 0x000B, * LINE TABULATION */
|
||||
|
|
@ -4135,7 +4135,7 @@ unicode_decode_call_errorhandler_wchar(
|
|||
Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr,
|
||||
PyObject **output, Py_ssize_t *outpos)
|
||||
{
|
||||
static char *argparse = "O!n;decoding error handler must return (str, int) tuple";
|
||||
static const char *argparse = "O!n;decoding error handler must return (str, int) tuple";
|
||||
|
||||
PyObject *restuple = NULL;
|
||||
PyObject *repunicode = NULL;
|
||||
|
|
@ -4243,7 +4243,7 @@ unicode_decode_call_errorhandler_writer(
|
|||
Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr,
|
||||
_PyUnicodeWriter *writer /* PyObject **output, Py_ssize_t *outpos */)
|
||||
{
|
||||
static char *argparse = "O!n;decoding error handler must return (str, int) tuple";
|
||||
static const char *argparse = "O!n;decoding error handler must return (str, int) tuple";
|
||||
|
||||
PyObject *restuple = NULL;
|
||||
PyObject *repunicode = NULL;
|
||||
|
|
@ -6560,7 +6560,7 @@ unicode_encode_call_errorhandler(const char *errors,
|
|||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
Py_ssize_t *newpos)
|
||||
{
|
||||
static char *argparse = "On;encoding error handler must return (str/bytes, int) tuple";
|
||||
static const char *argparse = "On;encoding error handler must return (str/bytes, int) tuple";
|
||||
Py_ssize_t len;
|
||||
PyObject *restuple;
|
||||
PyObject *resunicode;
|
||||
|
|
@ -8572,7 +8572,7 @@ unicode_translate_call_errorhandler(const char *errors,
|
|||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
Py_ssize_t *newpos)
|
||||
{
|
||||
static char *argparse = "O!n;translating error handler must return (str, int) tuple";
|
||||
static const char *argparse = "O!n;translating error handler must return (str, int) tuple";
|
||||
|
||||
Py_ssize_t i_newpos;
|
||||
PyObject *restuple;
|
||||
|
|
@ -12156,7 +12156,7 @@ unicode_lower(PyObject *self)
|
|||
#define BOTHSTRIP 2
|
||||
|
||||
/* Arrays indexed by above */
|
||||
static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"};
|
||||
static const char * const stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"};
|
||||
|
||||
#define STRIPNAME(i) (stripformat[i]+3)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue