Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9)

Side by Side Diff: Python/Python-ast.c

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Python/modsupport.c ('k') | Python/pythonrun.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* File automatically generated by Parser/asdl_c.py. */ 1 /* File automatically generated by Parser/asdl_c.py. */
2
3
4 /*
5 __version__ e0e663132363.
6
7 This module must be committed separately after each AST grammar change;
8 The __version__ number is set to the revision number of the commit
9 containing the grammar change.
10 */
2 11
3 #include "Python.h" 12 #include "Python.h"
4 #include "Python-ast.h" 13 #include "Python-ast.h"
5 14
6 static PyTypeObject AST_type; 15 static PyTypeObject AST_type;
7 static PyTypeObject *mod_type; 16 static PyTypeObject *mod_type;
8 static PyObject* ast2obj_mod(void*); 17 static PyObject* ast2obj_mod(void*);
9 static PyTypeObject *Module_type; 18 static PyTypeObject *Module_type;
10 static char *Module_fields[]={ 19 static char *Module_fields[]={
11 "body", 20 "body",
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 { 594 {
586 if (obj == Py_None) 595 if (obj == Py_None)
587 obj = NULL; 596 obj = NULL;
588 if (obj) 597 if (obj)
589 PyArena_AddPyObject(arena, obj); 598 PyArena_AddPyObject(arena, obj);
590 Py_XINCREF(obj); 599 Py_XINCREF(obj);
591 *out = obj; 600 *out = obj;
592 return 0; 601 return 0;
593 } 602 }
594 603
595 static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) 604 #define obj2ast_identifier obj2ast_object
596 { 605 #define obj2ast_string obj2ast_object
597 if (!PyUnicode_CheckExact(obj) && obj != Py_None) {
598 PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str");
599 return 1;
600 }
601 return obj2ast_object(obj, out, arena);
602 }
603
604 static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
605 {
606 if (!PyUnicode_CheckExact(obj)) {
607 PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
608 return 1;
609 }
610 return obj2ast_object(obj, out, arena);
611 }
612 606
613 static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) 607 static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
614 { 608 {
615 int i; 609 int i;
616 if (!PyLong_Check(obj)) { 610 if (!PyLong_Check(obj)) {
617 PyObject *s = PyObject_Repr(obj); 611 PyObject *s = PyObject_Repr(obj);
618 if (s == NULL) return 1; 612 if (s == NULL) return 1;
619 PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", 613 PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s",
620 PyBytes_AS_STRING(s)); 614 PyBytes_AS_STRING(s));
621 Py_DECREF(s); 615 Py_DECREF(s);
(...skipping 6126 matching lines...) Expand 10 before | Expand all | Expand 10 after
6748 PyInit__ast(void) 6742 PyInit__ast(void)
6749 { 6743 {
6750 PyObject *m, *d; 6744 PyObject *m, *d;
6751 if (!init_types()) return NULL; 6745 if (!init_types()) return NULL;
6752 m = PyModule_Create(&_astmodule); 6746 m = PyModule_Create(&_astmodule);
6753 if (!m) return NULL; 6747 if (!m) return NULL;
6754 d = PyModule_GetDict(m); 6748 d = PyModule_GetDict(m);
6755 if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return 6749 if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return
6756 NULL; 6750 NULL;
6757 if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) 6751 if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0)
6752 return NULL;
6753 if (PyModule_AddStringConstant(m, "__version__", "e0e663132363") < 0)
6758 return NULL; 6754 return NULL;
6759 if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return 6755 if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return
6760 NULL; 6756 NULL;
6761 if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) 6757 if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0)
6762 return NULL; 6758 return NULL;
6763 if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type) 6759 if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type)
6764 < 0) return NULL; 6760 < 0) return NULL;
6765 if (PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) < 6761 if (PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) <
6766 0) return NULL; 6762 0) return NULL;
6767 if (PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return 6763 if (PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
6991 return res; 6987 return res;
6992 } 6988 }
6993 6989
6994 int PyAST_Check(PyObject* obj) 6990 int PyAST_Check(PyObject* obj)
6995 { 6991 {
6996 init_types(); 6992 init_types();
6997 return PyObject_IsInstance(obj, (PyObject*)&AST_type); 6993 return PyObject_IsInstance(obj, (PyObject*)&AST_type);
6998 } 6994 }
6999 6995
7000 6996
OLDNEW
« no previous file with comments | « Python/modsupport.c ('k') | Python/pythonrun.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+