Skip to content

Commit fda4765

Browse files
Fix peg_generator compiler warnings under MSVC (GH-20405)
(cherry picked from commit a2bbedc) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
1 parent 6597e2a commit fda4765

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Parser/tokenizer.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
|| c == '_'\
3333
|| (c >= 128))
3434

35-
extern char *PyOS_Readline(FILE *, FILE *, const char *);
36-
/* Return malloc'ed string including trailing \n;
37-
empty malloc'ed string for EOF;
38-
NULL if interrupted */
3935

4036
/* Don't ever change this -- it would break the portability of Python code */
4137
#define TABSIZE 8

Tools/peg_generator/peg_extension/peg_extension.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,21 @@ parse_string(PyObject *self, PyObject *args, PyObject *kwds)
9696
}
9797

9898
static PyObject *
99-
clear_memo_stats()
99+
clear_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
100100
{
101101
_PyPegen_clear_memo_statistics();
102102
Py_RETURN_NONE;
103103
}
104104

105105
static PyObject *
106-
get_memo_stats()
106+
get_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
107107
{
108108
return _PyPegen_get_memo_statistics();
109109
}
110110

111111
// TODO: Write to Python's sys.stdout instead of C's stdout.
112112
static PyObject *
113-
dump_memo_stats()
113+
dump_memo_stats(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
114114
{
115115
PyObject *list = _PyPegen_get_memo_statistics();
116116
if (list == NULL) {
@@ -124,7 +124,7 @@ dump_memo_stats()
124124
break;
125125
}
126126
if (count > 0) {
127-
printf("%4ld %9ld\n", i, count);
127+
printf("%4zd %9ld\n", i, count);
128128
}
129129
}
130130
Py_DECREF(list);

0 commit comments

Comments
 (0)