Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 58ab084 commit b97c969Copy full SHA for b97c969
1 file changed
Parser/grammar1.c
@@ -1,4 +1,4 @@
1
-
+#include "Python.h"
2
/* Grammar subroutines needed by parser */
3
4
#include "pgenheaders.h"
@@ -39,7 +39,7 @@ PyGrammar_LabelRepr(label *lb)
39
return "EMPTY";
40
else if (ISNONTERMINAL(lb->lb_type)) {
41
if (lb->lb_str == NULL) {
42
- sprintf(buf, "NT%d", lb->lb_type);
+ PyOS_snprintf(buf, sizeof(buf), "NT%d", lb->lb_type);
43
return buf;
44
}
45
else
@@ -49,8 +49,9 @@ PyGrammar_LabelRepr(label *lb)
49
if (lb->lb_str == NULL)
50
return _PyParser_TokenNames[lb->lb_type];
51
else {
52
- sprintf(buf, "%.32s(%.32s)",
53
- _PyParser_TokenNames[lb->lb_type], lb->lb_str);
+ PyOS_snprintf(buf, sizeof(buf), "%.32s(%.32s)",
+ _PyParser_TokenNames[lb->lb_type],
54
+ lb->lb_str);
55
56
57
0 commit comments