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

Delta Between Two Patch Sets: Python/Python-ast.c

Issue 11682: PEP 380 reference implementation for 3.3
Left Patch Set: Created 7 years, 8 months ago
Right Patch Set: Created 7 years, 7 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 /* File automatically generated by Parser/asdl_c.py. */ 1 /* File automatically generated by Parser/asdl_c.py. */
2 2
3 #include "Python.h" 3 #include "Python.h"
4 #include "Python-ast.h" 4 #include "Python-ast.h"
5 5
6 static PyTypeObject AST_type; 6 static PyTypeObject AST_type;
7 static PyTypeObject *mod_type; 7 static PyTypeObject *mod_type;
8 static PyObject* ast2obj_mod(void*); 8 static PyObject* ast2obj_mod(void*);
9 static PyTypeObject *Module_type; 9 static PyTypeObject *Module_type;
10 _Py_IDENTIFIER(body); 10 _Py_IDENTIFIER(body);
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 PyErr_SetString(PyExc_TypeError, "AST bytes must be of type bytes"); 685 PyErr_SetString(PyExc_TypeError, "AST bytes must be of type bytes");
686 return 1; 686 return 1;
687 } 687 }
688 return obj2ast_object(obj, out, arena); 688 return obj2ast_object(obj, out, arena);
689 } 689 }
690 690
691 static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) 691 static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
692 { 692 {
693 int i; 693 int i;
694 if (!PyLong_Check(obj)) { 694 if (!PyLong_Check(obj)) {
695 PyObject *s = PyObject_Repr(obj); 695 PyErr_Format(PyExc_ValueError, "invalid integer value: %R", obj);
696 if (s == NULL) return 1;
697 PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s",
698 PyBytes_AS_STRING(s));
699 Py_DECREF(s);
700 return 1; 696 return 1;
701 } 697 }
702 698
703 i = (int)PyLong_AsLong(obj); 699 i = (int)PyLong_AsLong(obj);
704 if (i == -1 && PyErr_Occurred()) 700 if (i == -1 && PyErr_Occurred())
705 return 1; 701 return 1;
706 *out = i; 702 *out = i;
707 return 0; 703 return 0;
708 } 704 }
709 705
(...skipping 6378 matching lines...) Expand 10 before | Expand all | Expand 10 after
7088 return res; 7084 return res;
7089 } 7085 }
7090 7086
7091 int PyAST_Check(PyObject* obj) 7087 int PyAST_Check(PyObject* obj)
7092 { 7088 {
7093 init_types(); 7089 init_types();
7094 return PyObject_IsInstance(obj, (PyObject*)&AST_type); 7090 return PyObject_IsInstance(obj, (PyObject*)&AST_type);
7095 } 7091 }
7096 7092
7097 7093
LEFTRIGHT

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