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

Skip to content

Commit e4dc324

Browse files
committed
Use unicode for AST attributes
1 parent aefab1e commit e4dc324

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Parser/asdl_c.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def visitModule(self, mod):
408408
Py_INCREF(Py_None);
409409
}
410410
for(i=0; i < num_fields; i++) {
411-
PyObject *field = PyString_FromString(fields[i]);
411+
PyObject *field = PyUnicode_FromString(fields[i]);
412412
if (!field) {
413413
Py_DECREF(fnames);
414414
return NULL;
@@ -427,7 +427,7 @@ def visitModule(self, mod):
427427
PyObject *s, *l = PyList_New(num_fields);
428428
if (!l) return 0;
429429
for(i = 0; i < num_fields; i++) {
430-
s = PyString_FromString(attrs[i]);
430+
s = PyUnicode_FromString(attrs[i]);
431431
if (!s) {
432432
Py_DECREF(l);
433433
return 0;

Python/Python-ast.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int
404404
Py_INCREF(Py_None);
405405
}
406406
for(i=0; i < num_fields; i++) {
407-
PyObject *field = PyString_FromString(fields[i]);
407+
PyObject *field = PyUnicode_FromString(fields[i]);
408408
if (!field) {
409409
Py_DECREF(fnames);
410410
return NULL;
@@ -423,7 +423,7 @@ static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
423423
PyObject *s, *l = PyList_New(num_fields);
424424
if (!l) return 0;
425425
for(i = 0; i < num_fields; i++) {
426-
s = PyString_FromString(attrs[i]);
426+
s = PyUnicode_FromString(attrs[i]);
427427
if (!s) {
428428
Py_DECREF(l);
429429
return 0;

0 commit comments

Comments
 (0)