Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 289e4cb

Browse files
committed
Changed applicable use of char * declarations that are passed into
PyArg_ParseTuple() to ``const char *`` to match the recommendation made in section 1.3 and to support better coding habits. Section 1.8 ("Keyword Parameters for Extension Functions") and it's coding example were not touched since it is stems from an accredited source and thus did not want to step on anyone's toes.
1 parent 93d1b2c commit 289e4cb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Doc/ext/extending.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ \section{A Simple Example
7070
static PyObject *
7171
spam_system(PyObject *self, PyObject *args)
7272
{
73-
char *command;
73+
const char *command;
7474
int sts;
7575
7676
if (!PyArg_ParseTuple(args, "s", &command))
@@ -634,7 +634,7 @@ \section{Extracting Parameters in Extension Functions
634634
int ok;
635635
int i, j;
636636
long k, l;
637-
char *s;
637+
const char *s;
638638
int size;
639639
640640
ok = PyArg_ParseTuple(args, ""); /* No arguments */
@@ -659,8 +659,8 @@ \section{Extracting Parameters in Extension Functions
659659

660660
\begin{verbatim}
661661
{
662-
char *file;
663-
char *mode = "r";
662+
const char *file;
663+
const char *mode = "r";
664664
int bufsize = 0;
665665
ok = PyArg_ParseTuple(args, "s|si", &file, &mode, &bufsize);
666666
/* A string, and optionally another string and an integer */
@@ -1228,7 +1228,7 @@ \section{Providing a C API for an Extension Module
12281228

12291229
\begin{verbatim}
12301230
static int
1231-
PySpam_System(char *command)
1231+
PySpam_System(const char *command)
12321232
{
12331233
return system(command);
12341234
}
@@ -1240,7 +1240,7 @@ \section{Providing a C API for an Extension Module
12401240
static PyObject *
12411241
spam_system(PyObject *self, PyObject *args)
12421242
{
1243-
char *command;
1243+
const char *command;
12441244
int sts;
12451245
12461246
if (!PyArg_ParseTuple(args, "s", &command))

0 commit comments

Comments
 (0)