comparison Python/Python-ast.c @ 71456:75d56cf3020c

merge 3.2
author Benjamin Peterson <benjamin@python.org>
date Fri, 22 Jul 2011 10:55:02 -0500
parents b23ad0a6cf87 3301689bd78d
children 34d0b02a01e4
comparison
equal deleted inserted replaced
71449:44a02d6b74e4 71456:75d56cf3020c
590 Py_XINCREF(obj); 590 Py_XINCREF(obj);
591 *out = obj; 591 *out = obj;
592 return 0; 592 return 0;
593 } 593 }
594 594
595 #define obj2ast_identifier obj2ast_object 595 static int obj2ast_stringlike(PyObject* obj, PyObject** out, PyArena* arena,
596 #define obj2ast_string obj2ast_object 596 const char *name)
597 {
598 if (!PyUnicode_CheckExact(name)) {
599 PyErr_Format(PyExc_TypeError, "AST %s must be of type str", name);
600 return 1;
601 }
602 return obj2ast_object(obj, out, arena);
603 }
604
605 static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
606 {
607 return obj2ast_stringlike(obj, out, arena, "identifier");
608 }
609
610 static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
611 {
612 return obj2ast_stringlike(obj, out, arena, "string");
613 }
597 614
598 static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) 615 static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
599 { 616 {
600 int i; 617 int i;
601 if (!PyLong_Check(obj)) { 618 if (!PyLong_Check(obj)) {