Rename _Py_identifier to _Py_IDENTIFIER.

This commit is contained in:
Martin v. Löwis 2011-10-14 10:20:37 +02:00
parent 01277d166a
commit bd928fef42
57 changed files with 262 additions and 262 deletions

View File

@ -2031,7 +2031,7 @@ PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
do do
_Py_identifier(foo); _Py_IDENTIFIER(foo);
... ...
r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...); r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...);
@ -2050,7 +2050,7 @@ typedef struct _Py_Identifier {
} _Py_Identifier; } _Py_Identifier;
#define _Py_static_string(varname, value) static _Py_Identifier varname = { 0, value, 0 } #define _Py_static_string(varname, value) static _Py_Identifier varname = { 0, value, 0 }
#define _Py_identifier(varname) _Py_static_string(PyId_##varname, #varname) #define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname)
/* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/ /* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/
PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*); PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*);

View File

@ -86,7 +86,7 @@ insort_right(PyObject *self, PyObject *args, PyObject *kw)
if (PyList_Insert(list, index, item) < 0) if (PyList_Insert(list, index, item) < 0)
return NULL; return NULL;
} else { } else {
_Py_identifier(insert); _Py_IDENTIFIER(insert);
result = _PyObject_CallMethodId(list, &PyId_insert, "nO", index, item); result = _PyObject_CallMethodId(list, &PyId_insert, "nO", index, item);
if (result == NULL) if (result == NULL)
@ -188,7 +188,7 @@ insort_left(PyObject *self, PyObject *args, PyObject *kw)
if (PyList_Insert(list, index, item) < 0) if (PyList_Insert(list, index, item) < 0)
return NULL; return NULL;
} else { } else {
_Py_identifier(insert); _Py_IDENTIFIER(insert);
result = _PyObject_CallMethodId(list, &PyId_insert, "iO", index, item); result = _PyObject_CallMethodId(list, &PyId_insert, "iO", index, item);
if (result == NULL) if (result == NULL)

View File

@ -767,7 +767,7 @@ static PyObject *
deque_reduce(dequeobject *deque) deque_reduce(dequeobject *deque)
{ {
PyObject *dict, *result, *aslist; PyObject *dict, *result, *aslist;
_Py_identifier(__dict__); _Py_IDENTIFIER(__dict__);
dict = _PyObject_GetAttrId((PyObject *)deque, &PyId___dict__); dict = _PyObject_GetAttrId((PyObject *)deque, &PyId___dict__);
if (dict == NULL) if (dict == NULL)
@ -1335,7 +1335,7 @@ defdict_reduce(defdictobject *dd)
PyObject *items; PyObject *items;
PyObject *iter; PyObject *iter;
PyObject *result; PyObject *result;
_Py_identifier(items); _Py_IDENTIFIER(items);
if (dd->default_factory == NULL || dd->default_factory == Py_None) if (dd->default_factory == NULL || dd->default_factory == Py_None)
args = PyTuple_New(0); args = PyTuple_New(0);

View File

@ -1317,7 +1317,7 @@ csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
{ {
PyObject * output_file, * dialect = NULL; PyObject * output_file, * dialect = NULL;
WriterObj * self = PyObject_GC_New(WriterObj, &Writer_Type); WriterObj * self = PyObject_GC_New(WriterObj, &Writer_Type);
_Py_identifier(write); _Py_IDENTIFIER(write);
if (!self) if (!self)
return NULL; return NULL;

View File

@ -3679,7 +3679,7 @@ _build_result(PyObject *result, PyObject *callargs,
PyTuple_SET_ITEM(tup, index, v); PyTuple_SET_ITEM(tup, index, v);
index++; index++;
} else if (bit & outmask) { } else if (bit & outmask) {
_Py_identifier(__ctypes_from_outparam__); _Py_IDENTIFIER(__ctypes_from_outparam__);
v = PyTuple_GET_ITEM(callargs, i); v = PyTuple_GET_ITEM(callargs, i);
v = _PyObject_CallMethodId(v, &PyId___ctypes_from_outparam__, NULL); v = _PyObject_CallMethodId(v, &PyId___ctypes_from_outparam__, NULL);

View File

@ -1687,8 +1687,8 @@ unpickle(PyObject *self, PyObject *args)
PyObject *state; PyObject *state;
PyObject *result; PyObject *result;
PyObject *tmp; PyObject *tmp;
_Py_identifier(__new__); _Py_IDENTIFIER(__new__);
_Py_identifier(__setstate__); _Py_IDENTIFIER(__setstate__);
if (!PyArg_ParseTuple(args, "OO", &typ, &state)) if (!PyArg_ParseTuple(args, "OO", &typ, &state))
return NULL; return NULL;

View File

@ -1418,7 +1418,7 @@ PyCursesWindow_PutWin(PyCursesWindowObject *self, PyObject *stream)
while (1) { while (1) {
char buf[BUFSIZ]; char buf[BUFSIZ];
Py_ssize_t n = fread(buf, 1, BUFSIZ, fp); Py_ssize_t n = fread(buf, 1, BUFSIZ, fp);
_Py_identifier(write); _Py_IDENTIFIER(write);
if (n <= 0) if (n <= 0)
break; break;
@ -1913,7 +1913,7 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
WINDOW *win; WINDOW *win;
PyCursesInitialised; PyCursesInitialised;
_Py_identifier(read); _Py_IDENTIFIER(read);
strcpy(fn, "/tmp/py.curses.getwin.XXXXXX"); strcpy(fn, "/tmp/py.curses.getwin.XXXXXX");
fd = mkstemp(fn); fd = mkstemp(fn);

View File

@ -946,7 +946,7 @@ static PyObject *
call_tzname(PyObject *tzinfo, PyObject *tzinfoarg) call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
{ {
PyObject *result; PyObject *result;
_Py_identifier(tzname); _Py_IDENTIFIER(tzname);
assert(tzinfo != NULL); assert(tzinfo != NULL);
assert(check_tzinfo_subclass(tzinfo) >= 0); assert(check_tzinfo_subclass(tzinfo) >= 0);
@ -1079,7 +1079,7 @@ make_Zreplacement(PyObject *object, PyObject *tzinfoarg)
PyObject *temp; PyObject *temp;
PyObject *tzinfo = get_tzinfo_member(object); PyObject *tzinfo = get_tzinfo_member(object);
PyObject *Zreplacement = PyUnicode_FromStringAndSize(NULL, 0); PyObject *Zreplacement = PyUnicode_FromStringAndSize(NULL, 0);
_Py_identifier(replace); _Py_IDENTIFIER(replace);
if (Zreplacement == NULL) if (Zreplacement == NULL)
return NULL; return NULL;
@ -1289,7 +1289,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
goto Done; goto Done;
format = PyUnicode_FromString(PyBytes_AS_STRING(newfmt)); format = PyUnicode_FromString(PyBytes_AS_STRING(newfmt));
if (format != NULL) { if (format != NULL) {
_Py_identifier(strftime); _Py_IDENTIFIER(strftime);
result = _PyObject_CallMethodId(time, &PyId_strftime, "OO", result = _PyObject_CallMethodId(time, &PyId_strftime, "OO",
format, timetuple, NULL); format, timetuple, NULL);
@ -1318,7 +1318,7 @@ time_time(void)
PyObject *time = PyImport_ImportModuleNoBlock("time"); PyObject *time = PyImport_ImportModuleNoBlock("time");
if (time != NULL) { if (time != NULL) {
_Py_identifier(time); _Py_IDENTIFIER(time);
result = _PyObject_CallMethodId(time, &PyId_time, "()"); result = _PyObject_CallMethodId(time, &PyId_time, "()");
Py_DECREF(time); Py_DECREF(time);
@ -1337,7 +1337,7 @@ build_struct_time(int y, int m, int d, int hh, int mm, int ss, int dstflag)
time = PyImport_ImportModuleNoBlock("time"); time = PyImport_ImportModuleNoBlock("time");
if (time != NULL) { if (time != NULL) {
_Py_identifier(struct_time); _Py_IDENTIFIER(struct_time);
result = _PyObject_CallMethodId(time, &PyId_struct_time, result = _PyObject_CallMethodId(time, &PyId_struct_time,
"((iiiiiiiii))", "((iiiiiiiii))",
@ -1578,7 +1578,7 @@ multiply_float_timedelta(PyObject *floatobj, PyDateTime_Delta *delta)
PyObject *result = NULL; PyObject *result = NULL;
PyObject *pyus_in = NULL, *temp, *pyus_out; PyObject *pyus_in = NULL, *temp, *pyus_out;
PyObject *ratio = NULL; PyObject *ratio = NULL;
_Py_identifier(as_integer_ratio); _Py_IDENTIFIER(as_integer_ratio);
pyus_in = delta_to_microseconds(delta); pyus_in = delta_to_microseconds(delta);
if (pyus_in == NULL) if (pyus_in == NULL)
@ -1677,7 +1677,7 @@ truedivide_timedelta_float(PyDateTime_Delta *delta, PyObject *f)
PyObject *result = NULL; PyObject *result = NULL;
PyObject *pyus_in = NULL, *temp, *pyus_out; PyObject *pyus_in = NULL, *temp, *pyus_out;
PyObject *ratio = NULL; PyObject *ratio = NULL;
_Py_identifier(as_integer_ratio); _Py_IDENTIFIER(as_integer_ratio);
pyus_in = delta_to_microseconds(delta); pyus_in = delta_to_microseconds(delta);
if (pyus_in == NULL) if (pyus_in == NULL)
@ -2473,7 +2473,7 @@ date_today(PyObject *cls, PyObject *dummy)
{ {
PyObject *time; PyObject *time;
PyObject *result; PyObject *result;
_Py_identifier(fromtimestamp); _Py_IDENTIFIER(fromtimestamp);
time = time_time(); time = time_time();
if (time == NULL) if (time == NULL)
@ -2626,7 +2626,7 @@ date_isoformat(PyDateTime_Date *self)
static PyObject * static PyObject *
date_str(PyDateTime_Date *self) date_str(PyDateTime_Date *self)
{ {
_Py_identifier(isoformat); _Py_IDENTIFIER(isoformat);
return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "()"); return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "()");
} }
@ -2647,7 +2647,7 @@ date_strftime(PyDateTime_Date *self, PyObject *args, PyObject *kw)
PyObject *result; PyObject *result;
PyObject *tuple; PyObject *tuple;
PyObject *format; PyObject *format;
_Py_identifier(timetuple); _Py_IDENTIFIER(timetuple);
static char *keywords[] = {"format", NULL}; static char *keywords[] = {"format", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "U:strftime", keywords, if (! PyArg_ParseTupleAndKeywords(args, kw, "U:strftime", keywords,
@ -2667,7 +2667,7 @@ static PyObject *
date_format(PyDateTime_Date *self, PyObject *args) date_format(PyDateTime_Date *self, PyObject *args)
{ {
PyObject *format; PyObject *format;
_Py_identifier(strftime); _Py_IDENTIFIER(strftime);
if (!PyArg_ParseTuple(args, "U:__format__", &format)) if (!PyArg_ParseTuple(args, "U:__format__", &format))
return NULL; return NULL;
@ -3077,8 +3077,8 @@ tzinfo_reduce(PyObject *self)
{ {
PyObject *args, *state, *tmp; PyObject *args, *state, *tmp;
PyObject *getinitargs, *getstate; PyObject *getinitargs, *getstate;
_Py_identifier(__getinitargs__); _Py_IDENTIFIER(__getinitargs__);
_Py_identifier(__getstate__); _Py_IDENTIFIER(__getstate__);
tmp = PyTuple_New(0); tmp = PyTuple_New(0);
if (tmp == NULL) if (tmp == NULL)
@ -3592,7 +3592,7 @@ time_repr(PyDateTime_Time *self)
static PyObject * static PyObject *
time_str(PyDateTime_Time *self) time_str(PyDateTime_Time *self)
{ {
_Py_identifier(isoformat); _Py_IDENTIFIER(isoformat);
return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "()"); return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "()");
} }
@ -4173,7 +4173,7 @@ datetime_now(PyObject *cls, PyObject *args, PyObject *kw)
if (self != NULL && tzinfo != Py_None) { if (self != NULL && tzinfo != Py_None) {
/* Convert UTC to tzinfo's zone. */ /* Convert UTC to tzinfo's zone. */
PyObject *temp = self; PyObject *temp = self;
_Py_identifier(fromutc); _Py_IDENTIFIER(fromutc);
self = _PyObject_CallMethodId(tzinfo, &PyId_fromutc, "O", self); self = _PyObject_CallMethodId(tzinfo, &PyId_fromutc, "O", self);
Py_DECREF(temp); Py_DECREF(temp);
@ -4212,7 +4212,7 @@ datetime_fromtimestamp(PyObject *cls, PyObject *args, PyObject *kw)
if (self != NULL && tzinfo != Py_None) { if (self != NULL && tzinfo != Py_None) {
/* Convert UTC to tzinfo's zone. */ /* Convert UTC to tzinfo's zone. */
PyObject *temp = self; PyObject *temp = self;
_Py_identifier(fromutc); _Py_IDENTIFIER(fromutc);
self = _PyObject_CallMethodId(tzinfo, &PyId_fromutc, "O", self); self = _PyObject_CallMethodId(tzinfo, &PyId_fromutc, "O", self);
Py_DECREF(temp); Py_DECREF(temp);
@ -4239,7 +4239,7 @@ datetime_strptime(PyObject *cls, PyObject *args)
{ {
static PyObject *module = NULL; static PyObject *module = NULL;
PyObject *string, *format; PyObject *string, *format;
_Py_identifier(_strptime_datetime); _Py_IDENTIFIER(_strptime_datetime);
if (!PyArg_ParseTuple(args, "UU:strptime", &string, &format)) if (!PyArg_ParseTuple(args, "UU:strptime", &string, &format))
return NULL; return NULL;
@ -4495,7 +4495,7 @@ datetime_repr(PyDateTime_DateTime *self)
static PyObject * static PyObject *
datetime_str(PyDateTime_DateTime *self) datetime_str(PyDateTime_DateTime *self)
{ {
_Py_identifier(isoformat); _Py_IDENTIFIER(isoformat);
return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "(s)", " "); return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "(s)", " ");
} }
@ -4704,7 +4704,7 @@ datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw)
PyObject *offset; PyObject *offset;
PyObject *temp; PyObject *temp;
PyObject *tzinfo; PyObject *tzinfo;
_Py_identifier(fromutc); _Py_IDENTIFIER(fromutc);
static char *keywords[] = {"tz", NULL}; static char *keywords[] = {"tz", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:astimezone", keywords, if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:astimezone", keywords,

View File

@ -797,7 +797,7 @@ element_find(ElementObject* self, PyObject* args)
return NULL; return NULL;
if (checkpath(tag) || namespaces != Py_None) { if (checkpath(tag) || namespaces != Py_None) {
_Py_identifier(find); _Py_IDENTIFIER(find);
return _PyObject_CallMethodId( return _PyObject_CallMethodId(
elementpath_obj, &PyId_find, "OOO", self, tag, namespaces elementpath_obj, &PyId_find, "OOO", self, tag, namespaces
); );
@ -825,7 +825,7 @@ element_findtext(ElementObject* self, PyObject* args)
PyObject* tag; PyObject* tag;
PyObject* default_value = Py_None; PyObject* default_value = Py_None;
PyObject* namespaces = Py_None; PyObject* namespaces = Py_None;
_Py_identifier(findtext); _Py_IDENTIFIER(findtext);
if (!PyArg_ParseTuple(args, "O|OO:findtext", &tag, &default_value, &namespaces)) if (!PyArg_ParseTuple(args, "O|OO:findtext", &tag, &default_value, &namespaces))
return NULL; return NULL;
@ -868,7 +868,7 @@ element_findall(ElementObject* self, PyObject* args)
return NULL; return NULL;
if (checkpath(tag) || namespaces != Py_None) { if (checkpath(tag) || namespaces != Py_None) {
_Py_identifier(findall); _Py_IDENTIFIER(findall);
return _PyObject_CallMethodId( return _PyObject_CallMethodId(
elementpath_obj, &PyId_findall, "OOO", self, tag, namespaces elementpath_obj, &PyId_findall, "OOO", self, tag, namespaces
); );
@ -900,7 +900,7 @@ element_iterfind(ElementObject* self, PyObject* args)
{ {
PyObject* tag; PyObject* tag;
PyObject* namespaces = Py_None; PyObject* namespaces = Py_None;
_Py_identifier(iterfind); _Py_IDENTIFIER(iterfind);
if (!PyArg_ParseTuple(args, "O|O:iterfind", &tag, &namespaces)) if (!PyArg_ParseTuple(args, "O|O:iterfind", &tag, &namespaces))
return NULL; return NULL;

View File

@ -225,8 +225,8 @@ io_open(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *raw, *modeobj = NULL, *buffer = NULL, *wrapper = NULL; PyObject *raw, *modeobj = NULL, *buffer = NULL, *wrapper = NULL;
_Py_identifier(isatty); _Py_IDENTIFIER(isatty);
_Py_identifier(fileno); _Py_IDENTIFIER(fileno);
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|sizzzi:open", kwlist, if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|sizzzi:open", kwlist,
&file, &mode, &buffering, &file, &mode, &buffering,

View File

@ -13,17 +13,17 @@
#include "pythread.h" #include "pythread.h"
#include "_iomodule.h" #include "_iomodule.h"
_Py_identifier(close); _Py_IDENTIFIER(close);
_Py_identifier(_dealloc_warn); _Py_IDENTIFIER(_dealloc_warn);
_Py_identifier(flush); _Py_IDENTIFIER(flush);
_Py_identifier(isatty); _Py_IDENTIFIER(isatty);
_Py_identifier(peek); _Py_IDENTIFIER(peek);
_Py_identifier(read); _Py_IDENTIFIER(read);
_Py_identifier(read1); _Py_IDENTIFIER(read1);
_Py_identifier(readable); _Py_IDENTIFIER(readable);
_Py_identifier(readinto); _Py_IDENTIFIER(readinto);
_Py_identifier(writable); _Py_IDENTIFIER(writable);
_Py_identifier(write); _Py_IDENTIFIER(write);
/* /*
* BufferedIOBase class, inherits from IOBase. * BufferedIOBase class, inherits from IOBase.
@ -50,7 +50,7 @@ bufferediobase_readinto(PyObject *self, PyObject *args)
Py_buffer buf; Py_buffer buf;
Py_ssize_t len; Py_ssize_t len;
PyObject *data; PyObject *data;
_Py_identifier(read); _Py_IDENTIFIER(read);
if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) { if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) {
return NULL; return NULL;

View File

@ -122,7 +122,7 @@ internal_close(fileio *self)
static PyObject * static PyObject *
fileio_close(fileio *self) fileio_close(fileio *self)
{ {
_Py_identifier(close); _Py_IDENTIFIER(close);
if (!self->closefd) { if (!self->closefd) {
self->fd = -1; self->fd = -1;
Py_RETURN_NONE; Py_RETURN_NONE;

View File

@ -97,7 +97,7 @@ PyDoc_STRVAR(iobase_tell_doc,
static PyObject * static PyObject *
iobase_tell(PyObject *self, PyObject *args) iobase_tell(PyObject *self, PyObject *args)
{ {
_Py_identifier(seek); _Py_IDENTIFIER(seek);
return _PyObject_CallMethodId(self, &PyId_seek, "ii", 0, 1); return _PyObject_CallMethodId(self, &PyId_seek, "ii", 0, 1);
} }
@ -466,7 +466,7 @@ iobase_readline(PyObject *self, PyObject *args)
int has_peek = 0; int has_peek = 0;
PyObject *buffer, *result; PyObject *buffer, *result;
Py_ssize_t old_size = -1; Py_ssize_t old_size = -1;
_Py_identifier(read); _Py_IDENTIFIER(read);
if (!PyArg_ParseTuple(args, "|O&:readline", &_PyIO_ConvertSsize_t, &limit)) { if (!PyArg_ParseTuple(args, "|O&:readline", &_PyIO_ConvertSsize_t, &limit)) {
return NULL; return NULL;
@ -484,7 +484,7 @@ iobase_readline(PyObject *self, PyObject *args)
PyObject *b; PyObject *b;
if (has_peek) { if (has_peek) {
_Py_identifier(peek); _Py_IDENTIFIER(peek);
PyObject *readahead = _PyObject_CallMethodId(self, &PyId_peek, "i", 1); PyObject *readahead = _PyObject_CallMethodId(self, &PyId_peek, "i", 1);
if (readahead == NULL) if (readahead == NULL)
@ -606,7 +606,7 @@ iobase_readlines(PyObject *self, PyObject *args)
/* XXX special-casing this made sense in the Python version in order /* XXX special-casing this made sense in the Python version in order
to remove the bytecode interpretation overhead, but it could to remove the bytecode interpretation overhead, but it could
probably be removed here. */ probably be removed here. */
_Py_identifier(extend); _Py_IDENTIFIER(extend);
PyObject *ret = _PyObject_CallMethodId(result, &PyId_extend, "O", self); PyObject *ret = _PyObject_CallMethodId(result, &PyId_extend, "O", self);
if (ret == NULL) { if (ret == NULL) {
@ -789,7 +789,7 @@ rawiobase_read(PyObject *self, PyObject *args)
} }
if (n < 0) { if (n < 0) {
_Py_identifier(readall); _Py_IDENTIFIER(readall);
return _PyObject_CallMethodId(self, &PyId_readall, NULL); return _PyObject_CallMethodId(self, &PyId_readall, NULL);
} }
@ -833,7 +833,7 @@ rawiobase_readall(PyObject *self, PyObject *args)
return NULL; return NULL;
while (1) { while (1) {
_Py_identifier(read); _Py_IDENTIFIER(read);
PyObject *data = _PyObject_CallMethodId(self, &PyId_read, PyObject *data = _PyObject_CallMethodId(self, &PyId_read,
"i", DEFAULT_BUFFER_SIZE); "i", DEFAULT_BUFFER_SIZE);
if (!data) { if (!data) {

View File

@ -11,23 +11,23 @@
#include "structmember.h" #include "structmember.h"
#include "_iomodule.h" #include "_iomodule.h"
_Py_identifier(close); _Py_IDENTIFIER(close);
_Py_identifier(_dealloc_warn); _Py_IDENTIFIER(_dealloc_warn);
_Py_identifier(decode); _Py_IDENTIFIER(decode);
_Py_identifier(device_encoding); _Py_IDENTIFIER(device_encoding);
_Py_identifier(fileno); _Py_IDENTIFIER(fileno);
_Py_identifier(flush); _Py_IDENTIFIER(flush);
_Py_identifier(getpreferredencoding); _Py_IDENTIFIER(getpreferredencoding);
_Py_identifier(isatty); _Py_IDENTIFIER(isatty);
_Py_identifier(read); _Py_IDENTIFIER(read);
_Py_identifier(readable); _Py_IDENTIFIER(readable);
_Py_identifier(replace); _Py_IDENTIFIER(replace);
_Py_identifier(reset); _Py_IDENTIFIER(reset);
_Py_identifier(seek); _Py_IDENTIFIER(seek);
_Py_identifier(seekable); _Py_IDENTIFIER(seekable);
_Py_identifier(setstate); _Py_IDENTIFIER(setstate);
_Py_identifier(tell); _Py_IDENTIFIER(tell);
_Py_identifier(writable); _Py_IDENTIFIER(writable);
/* TextIOBase */ /* TextIOBase */

View File

@ -826,7 +826,7 @@ _Pickler_SetProtocol(PicklerObject *self, PyObject *proto_obj,
static int static int
_Pickler_SetOutputStream(PicklerObject *self, PyObject *file) _Pickler_SetOutputStream(PicklerObject *self, PyObject *file)
{ {
_Py_identifier(write); _Py_IDENTIFIER(write);
assert(file != NULL); assert(file != NULL);
self->write = _PyObject_GetAttrId(file, &PyId_write); self->write = _PyObject_GetAttrId(file, &PyId_write);
if (self->write == NULL) { if (self->write == NULL) {
@ -1174,9 +1174,9 @@ _Unpickler_New(void)
static int static int
_Unpickler_SetInputStream(UnpicklerObject *self, PyObject *file) _Unpickler_SetInputStream(UnpicklerObject *self, PyObject *file)
{ {
_Py_identifier(peek); _Py_IDENTIFIER(peek);
_Py_identifier(read); _Py_IDENTIFIER(read);
_Py_identifier(readline); _Py_IDENTIFIER(readline);
self->peek = _PyObject_GetAttrId(file, &PyId_peek); self->peek = _PyObject_GetAttrId(file, &PyId_peek);
if (self->peek == NULL) { if (self->peek == NULL) {
@ -2492,7 +2492,7 @@ save_dict(PicklerObject *self, PyObject *obj)
status = batch_dict_exact(self, obj); status = batch_dict_exact(self, obj);
Py_LeaveRecursiveCall(); Py_LeaveRecursiveCall();
} else { } else {
_Py_identifier(items); _Py_IDENTIFIER(items);
items = _PyObject_CallMethodId(obj, &PyId_items, "()"); items = _PyObject_CallMethodId(obj, &PyId_items, "()");
if (items == NULL) if (items == NULL)
@ -3394,7 +3394,7 @@ Pickler_init(PicklerObject *self, PyObject *args, PyObject *kwds)
PyObject *file; PyObject *file;
PyObject *proto_obj = NULL; PyObject *proto_obj = NULL;
PyObject *fix_imports = Py_True; PyObject *fix_imports = Py_True;
_Py_identifier(persistent_id); _Py_IDENTIFIER(persistent_id);
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO:Pickler", if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OO:Pickler",
kwlist, &file, &proto_obj, &fix_imports)) kwlist, &file, &proto_obj, &fix_imports))
@ -3781,7 +3781,7 @@ static PyTypeObject Pickler_Type = {
static PyObject * static PyObject *
find_class(UnpicklerObject *self, PyObject *module_name, PyObject *global_name) find_class(UnpicklerObject *self, PyObject *module_name, PyObject *global_name)
{ {
_Py_identifier(find_class); _Py_IDENTIFIER(find_class);
return _PyObject_CallMethodId((PyObject *)self, &PyId_find_class, "OO", return _PyObject_CallMethodId((PyObject *)self, &PyId_find_class, "OO",
module_name, global_name); module_name, global_name);
@ -4397,7 +4397,7 @@ instantiate(PyObject *cls, PyObject *args)
result = PyObject_CallObject(cls, args); result = PyObject_CallObject(cls, args);
} }
else { else {
_Py_identifier(__new__); _Py_IDENTIFIER(__new__);
result = _PyObject_CallMethodId(cls, &PyId___new__, "O", cls); result = _PyObject_CallMethodId(cls, &PyId___new__, "O", cls);
} }
@ -4940,7 +4940,7 @@ do_append(UnpicklerObject *self, Py_ssize_t x)
} }
else { else {
PyObject *append_func; PyObject *append_func;
_Py_identifier(append); _Py_IDENTIFIER(append);
append_func = _PyObject_GetAttrId(list, &PyId_append); append_func = _PyObject_GetAttrId(list, &PyId_append);
if (append_func == NULL) if (append_func == NULL)
@ -5029,7 +5029,7 @@ load_build(UnpicklerObject *self)
PyObject *state, *inst, *slotstate; PyObject *state, *inst, *slotstate;
PyObject *setstate; PyObject *setstate;
int status = 0; int status = 0;
_Py_identifier(__setstate__); _Py_IDENTIFIER(__setstate__);
/* Stack is ... instance, state. We want to leave instance at /* Stack is ... instance, state. We want to leave instance at
* the stack top, possibly mutated via instance.__setstate__(state). * the stack top, possibly mutated via instance.__setstate__(state).
@ -5086,7 +5086,7 @@ load_build(UnpicklerObject *self)
PyObject *dict; PyObject *dict;
PyObject *d_key, *d_value; PyObject *d_key, *d_value;
Py_ssize_t i; Py_ssize_t i;
_Py_identifier(__dict__); _Py_IDENTIFIER(__dict__);
if (!PyDict_Check(state)) { if (!PyDict_Check(state)) {
PyErr_SetString(UnpicklingError, "state is not a dictionary"); PyErr_SetString(UnpicklingError, "state is not a dictionary");
@ -5592,7 +5592,7 @@ Unpickler_init(UnpicklerObject *self, PyObject *args, PyObject *kwds)
return -1; return -1;
if (PyObject_HasAttrString((PyObject *)self, "persistent_load")) { if (PyObject_HasAttrString((PyObject *)self, "persistent_load")) {
_Py_identifier(persistent_load); _Py_IDENTIFIER(persistent_load);
self->pers_func = _PyObject_GetAttrId((PyObject *)self, self->pers_func = _PyObject_GetAttrId((PyObject *)self,
&PyId_persistent_load); &PyId_persistent_load);
if (self->pers_func == NULL) if (self->pers_func == NULL)

View File

@ -18,7 +18,7 @@ static long max_fd;
static int _enable_gc(PyObject *gc_module) static int _enable_gc(PyObject *gc_module)
{ {
PyObject *result; PyObject *result;
_Py_identifier(enable); _Py_IDENTIFIER(enable);
result = _PyObject_CallMethodId(gc_module, &PyId_enable, NULL); result = _PyObject_CallMethodId(gc_module, &PyId_enable, NULL);
if (result == NULL) if (result == NULL)
@ -251,8 +251,8 @@ subprocess_fork_exec(PyObject* self, PyObject *args)
/* We need to call gc.disable() when we'll be calling preexec_fn */ /* We need to call gc.disable() when we'll be calling preexec_fn */
if (preexec_fn != Py_None) { if (preexec_fn != Py_None) {
PyObject *result; PyObject *result;
_Py_identifier(isenabled); _Py_IDENTIFIER(isenabled);
_Py_identifier(disable); _Py_IDENTIFIER(disable);
gc_module = PyImport_ImportModule("gc"); gc_module = PyImport_ImportModule("gc");
if (gc_module == NULL) if (gc_module == NULL)

View File

@ -675,7 +675,7 @@ void _pysqlite_final_callback(sqlite3_context* context)
{ {
PyObject* function_result = NULL; PyObject* function_result = NULL;
PyObject** aggregate_instance; PyObject** aggregate_instance;
_Py_identifier(finalize); _Py_IDENTIFIER(finalize);
#ifdef WITH_THREAD #ifdef WITH_THREAD
PyGILState_STATE threadstate; PyGILState_STATE threadstate;
@ -1231,7 +1231,7 @@ PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args,
PyObject* cursor = 0; PyObject* cursor = 0;
PyObject* result = 0; PyObject* result = 0;
PyObject* method = 0; PyObject* method = 0;
_Py_identifier(cursor); _Py_IDENTIFIER(cursor);
cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, ""); cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, "");
if (!cursor) { if (!cursor) {
@ -1261,7 +1261,7 @@ PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* a
PyObject* cursor = 0; PyObject* cursor = 0;
PyObject* result = 0; PyObject* result = 0;
PyObject* method = 0; PyObject* method = 0;
_Py_identifier(cursor); _Py_IDENTIFIER(cursor);
cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, ""); cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, "");
if (!cursor) { if (!cursor) {
@ -1291,7 +1291,7 @@ PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject*
PyObject* cursor = 0; PyObject* cursor = 0;
PyObject* result = 0; PyObject* result = 0;
PyObject* method = 0; PyObject* method = 0;
_Py_identifier(cursor); _Py_IDENTIFIER(cursor);
cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, ""); cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, "");
if (!cursor) { if (!cursor) {
@ -1441,7 +1441,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
PyObject* name; PyObject* name;
PyObject* retval; PyObject* retval;
Py_ssize_t i, len; Py_ssize_t i, len;
_Py_identifier(upper); _Py_IDENTIFIER(upper);
char *uppercase_name_str; char *uppercase_name_str;
int rc; int rc;
unsigned int kind; unsigned int kind;

View File

@ -150,7 +150,7 @@ PyObject* _pysqlite_get_converter(PyObject* key)
{ {
PyObject* upcase_key; PyObject* upcase_key;
PyObject* retval; PyObject* retval;
_Py_identifier(upper); _Py_IDENTIFIER(upper);
upcase_key = _PyObject_CallMethodId(key, &PyId_upper, ""); upcase_key = _PyObject_CallMethodId(key, &PyId_upper, "");
if (!upcase_key) { if (!upcase_key) {

View File

@ -95,7 +95,7 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
/* try to have the protocol adapt this object*/ /* try to have the protocol adapt this object*/
if (PyObject_HasAttrString(proto, "__adapt__")) { if (PyObject_HasAttrString(proto, "__adapt__")) {
_Py_identifier(__adapt__); _Py_IDENTIFIER(__adapt__);
PyObject *adapted = _PyObject_CallMethodId(proto, &PyId___adapt__, "O", obj); PyObject *adapted = _PyObject_CallMethodId(proto, &PyId___adapt__, "O", obj);
if (adapted) { if (adapted) {
@ -112,7 +112,7 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
/* and finally try to have the object adapt itself */ /* and finally try to have the object adapt itself */
if (PyObject_HasAttrString(obj, "__conform__")) { if (PyObject_HasAttrString(obj, "__conform__")) {
_Py_identifier(__conform__); _Py_IDENTIFIER(__conform__);
PyObject *adapted = _PyObject_CallMethodId(obj, &PyId___conform__,"O", proto); PyObject *adapted = _PyObject_CallMethodId(obj, &PyId___conform__,"O", proto);
if (adapted) { if (adapted) {

View File

@ -179,7 +179,7 @@ static PyObject* module_register_converter(PyObject* self, PyObject* args)
PyObject* name = NULL; PyObject* name = NULL;
PyObject* callable; PyObject* callable;
PyObject* retval = NULL; PyObject* retval = NULL;
_Py_identifier(upper); _Py_IDENTIFIER(upper);
if (!PyArg_ParseTuple(args, "UO", &orig_name, &callable)) { if (!PyArg_ParseTuple(args, "UO", &orig_name, &callable)) {
return NULL; return NULL;

View File

@ -1253,7 +1253,7 @@ array_fromfile(arrayobject *self, PyObject *args)
PyObject *f, *b, *res; PyObject *f, *b, *res;
Py_ssize_t itemsize = self->ob_descr->itemsize; Py_ssize_t itemsize = self->ob_descr->itemsize;
Py_ssize_t n, nbytes; Py_ssize_t n, nbytes;
_Py_identifier(read); _Py_IDENTIFIER(read);
int not_enough_bytes; int not_enough_bytes;
if (!PyArg_ParseTuple(args, "On:fromfile", &f, &n)) if (!PyArg_ParseTuple(args, "On:fromfile", &f, &n))
@ -1322,7 +1322,7 @@ array_tofile(arrayobject *self, PyObject *f)
char* ptr = self->ob_item + i*BLOCKSIZE; char* ptr = self->ob_item + i*BLOCKSIZE;
Py_ssize_t size = BLOCKSIZE; Py_ssize_t size = BLOCKSIZE;
PyObject *bytes, *res; PyObject *bytes, *res;
_Py_identifier(write); _Py_IDENTIFIER(write);
if (i*BLOCKSIZE + size > nbytes) if (i*BLOCKSIZE + size > nbytes)
size = nbytes - i*BLOCKSIZE; size = nbytes - i*BLOCKSIZE;
@ -2003,8 +2003,8 @@ array_reduce_ex(arrayobject *array, PyObject *value)
int mformat_code; int mformat_code;
static PyObject *array_reconstructor = NULL; static PyObject *array_reconstructor = NULL;
long protocol; long protocol;
_Py_identifier(_array_reconstructor); _Py_IDENTIFIER(_array_reconstructor);
_Py_identifier(__dict__); _Py_IDENTIFIER(__dict__);
if (array_reconstructor == NULL) { if (array_reconstructor == NULL) {
PyObject *array_module = PyImport_ImportModule("array"); PyObject *array_module = PyImport_ImportModule("array");

View File

@ -1579,7 +1579,7 @@ mbstreamwriter_iwrite(MultibyteStreamWriterObject *self,
PyObject *unistr) PyObject *unistr)
{ {
PyObject *str, *wr; PyObject *str, *wr;
_Py_identifier(write); _Py_IDENTIFIER(write);
str = encoder_encode_stateful(STATEFUL_ECTX(self), unistr, 0); str = encoder_encode_stateful(STATEFUL_ECTX(self), unistr, 0);
if (str == NULL) if (str == NULL)
@ -1651,7 +1651,7 @@ mbstreamwriter_reset(MultibyteStreamWriterObject *self)
assert(PyBytes_Check(pwrt)); assert(PyBytes_Check(pwrt));
if (PyBytes_Size(pwrt) > 0) { if (PyBytes_Size(pwrt) > 0) {
PyObject *wr; PyObject *wr;
_Py_identifier(write); _Py_IDENTIFIER(write);
wr = _PyObject_CallMethodId(self->stream, &PyId_write, "O", pwrt); wr = _PyObject_CallMethodId(self->stream, &PyId_write, "O", pwrt);
if (wr == NULL) { if (wr == NULL) {

View File

@ -146,8 +146,8 @@ static PyObject*
faulthandler_get_fileno(PyObject *file, int *p_fd) faulthandler_get_fileno(PyObject *file, int *p_fd)
{ {
PyObject *result; PyObject *result;
_Py_identifier(fileno); _Py_IDENTIFIER(fileno);
_Py_identifier(flush); _Py_IDENTIFIER(flush);
long fd_long; long fd_long;
int fd; int fd;
@ -1199,7 +1199,7 @@ static int
faulthandler_env_options(void) faulthandler_env_options(void)
{ {
PyObject *xoptions, *key, *module, *res; PyObject *xoptions, *key, *module, *res;
_Py_identifier(enable); _Py_IDENTIFIER(enable);
if (!Py_GETENV("PYTHONFAULTHANDLER")) { if (!Py_GETENV("PYTHONFAULTHANDLER")) {
int has_key; int has_key;

View File

@ -769,7 +769,7 @@ get_time(void)
{ {
double result = 0; double result = 0;
if (tmod != NULL) { if (tmod != NULL) {
_Py_identifier(time); _Py_IDENTIFIER(time);
PyObject *f = _PyObject_CallMethodId(tmod, &PyId_time, NULL); PyObject *f = _PyObject_CallMethodId(tmod, &PyId_time, NULL);
if (f == NULL) { if (f == NULL) {

View File

@ -654,7 +654,7 @@ tee(PyObject *self, PyObject *args)
copyable = it; copyable = it;
PyTuple_SET_ITEM(result, 0, copyable); PyTuple_SET_ITEM(result, 0, copyable);
for (i=1 ; i<n ; i++) { for (i=1 ; i<n ; i++) {
_Py_identifier(__copy__); _Py_IDENTIFIER(__copy__);
copyable = _PyObject_CallMethodId(copyable, &PyId___copy__, NULL); copyable = _PyObject_CallMethodId(copyable, &PyId___copy__, NULL);
if (copyable == NULL) { if (copyable == NULL) {

View File

@ -700,7 +700,7 @@ mmap__enter__method(mmap_object *self, PyObject *args)
static PyObject * static PyObject *
mmap__exit__method(PyObject *self, PyObject *args) mmap__exit__method(PyObject *self, PyObject *args)
{ {
_Py_identifier(close); _Py_IDENTIFIER(close);
return _PyObject_CallMethodId(self, &PyId_close, NULL); return _PyObject_CallMethodId(self, &PyId_close, NULL);
} }

View File

@ -534,7 +534,7 @@ oss_self(PyObject *self, PyObject *unused)
static PyObject * static PyObject *
oss_exit(PyObject *self, PyObject *unused) oss_exit(PyObject *self, PyObject *unused)
{ {
_Py_identifier(close); _Py_IDENTIFIER(close);
PyObject *ret = _PyObject_CallMethodId(self, &PyId_close, NULL); PyObject *ret = _PyObject_CallMethodId(self, &PyId_close, NULL);
if (!ret) if (!ret)

View File

@ -3241,9 +3241,9 @@ PyInit_parser(void)
copyreg = PyImport_ImportModuleNoBlock("copyreg"); copyreg = PyImport_ImportModuleNoBlock("copyreg");
if (copyreg != NULL) { if (copyreg != NULL) {
PyObject *func, *pickler; PyObject *func, *pickler;
_Py_identifier(pickle); _Py_IDENTIFIER(pickle);
_Py_identifier(sequence2st); _Py_IDENTIFIER(sequence2st);
_Py_identifier(_pickler); _Py_IDENTIFIER(_pickler);
func = _PyObject_GetAttrId(copyreg, &PyId_pickle); func = _PyObject_GetAttrId(copyreg, &PyId_pickle);
pickle_constructor = _PyObject_GetAttrId(module, &PyId_sequence2st); pickle_constructor = _PyObject_GetAttrId(module, &PyId_sequence2st);

View File

@ -6102,7 +6102,7 @@ wait_helper(pid_t pid, int status, struct rusage *ru)
{ {
PyObject *result; PyObject *result;
static PyObject *struct_rusage; static PyObject *struct_rusage;
_Py_identifier(struct_rusage); _Py_IDENTIFIER(struct_rusage);
if (pid == -1) if (pid == -1)
return posix_error(); return posix_error();

View File

@ -843,7 +843,7 @@ xmlparse_ParseFile(xmlparseobject *self, PyObject *f)
{ {
int rv = 1; int rv = 1;
PyObject *readmethod = NULL; PyObject *readmethod = NULL;
_Py_identifier(read); _Py_IDENTIFIER(read);
readmethod = _PyObject_GetAttrId(f, &PyId_read); readmethod = _PyObject_GetAttrId(f, &PyId_read);
if (readmethod == NULL) { if (readmethod == NULL) {

View File

@ -4820,7 +4820,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
if (hobj == Py_None) { if (hobj == Py_None) {
hptr = NULL; hptr = NULL;
} else if (PyUnicode_Check(hobj)) { } else if (PyUnicode_Check(hobj)) {
_Py_identifier(encode); _Py_IDENTIFIER(encode);
idna = _PyObject_CallMethodId(hobj, &PyId_encode, "s", "idna"); idna = _PyObject_CallMethodId(hobj, &PyId_encode, "s", "idna");
if (!idna) if (!idna)

View File

@ -540,7 +540,7 @@ time_strptime(PyObject *self, PyObject *args)
{ {
PyObject *strptime_module = PyImport_ImportModuleNoBlock("_strptime"); PyObject *strptime_module = PyImport_ImportModuleNoBlock("_strptime");
PyObject *strptime_result; PyObject *strptime_result;
_Py_identifier(_strptime_time); _Py_IDENTIFIER(_strptime_time);
if (!strptime_module) if (!strptime_module)
return NULL; return NULL;

View File

@ -908,7 +908,7 @@ get_decompress_func(void)
static int importing_zlib = 0; static int importing_zlib = 0;
PyObject *zlib; PyObject *zlib;
PyObject *decompress; PyObject *decompress;
_Py_identifier(decompress); _Py_IDENTIFIER(decompress);
if (importing_zlib != 0) if (importing_zlib != 0)
/* Someone has a zlib.py[co] in their Zip file; /* Someone has a zlib.py[co] in their Zip file;

View File

@ -2082,7 +2082,7 @@ PyMapping_Keys(PyObject *o)
{ {
PyObject *keys; PyObject *keys;
PyObject *fast; PyObject *fast;
_Py_identifier(keys); _Py_IDENTIFIER(keys);
if (PyDict_CheckExact(o)) if (PyDict_CheckExact(o))
return PyDict_Keys(o); return PyDict_Keys(o);
@ -2099,7 +2099,7 @@ PyMapping_Items(PyObject *o)
{ {
PyObject *items; PyObject *items;
PyObject *fast; PyObject *fast;
_Py_identifier(items); _Py_IDENTIFIER(items);
if (PyDict_CheckExact(o)) if (PyDict_CheckExact(o))
return PyDict_Items(o); return PyDict_Items(o);
@ -2116,7 +2116,7 @@ PyMapping_Values(PyObject *o)
{ {
PyObject *values; PyObject *values;
PyObject *fast; PyObject *fast;
_Py_identifier(values); _Py_IDENTIFIER(values);
if (PyDict_CheckExact(o)) if (PyDict_CheckExact(o))
return PyDict_Values(o); return PyDict_Values(o);

View File

@ -2698,7 +2698,7 @@ static PyObject *
bytearray_reduce(PyByteArrayObject *self) bytearray_reduce(PyByteArrayObject *self)
{ {
PyObject *latin1, *dict; PyObject *latin1, *dict;
_Py_identifier(__dict__); _Py_IDENTIFIER(__dict__);
if (self->ob_bytes) if (self->ob_bytes)
latin1 = PyUnicode_DecodeLatin1(self->ob_bytes, latin1 = PyUnicode_DecodeLatin1(self->ob_bytes,

View File

@ -14,7 +14,7 @@ static int numfree = 0;
#define PyMethod_MAXFREELIST 256 #define PyMethod_MAXFREELIST 256
#endif #endif
_Py_identifier(__name__); _Py_IDENTIFIER(__name__);
PyObject * PyObject *
PyMethod_Function(PyObject *im) PyMethod_Function(PyObject *im)

View File

@ -703,7 +703,7 @@ static PyObject *
proxy_get(proxyobject *pp, PyObject *args) proxy_get(proxyobject *pp, PyObject *args)
{ {
PyObject *key, *def = Py_None; PyObject *key, *def = Py_None;
_Py_identifier(get); _Py_IDENTIFIER(get);
if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &def)) if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &def))
return NULL; return NULL;
@ -713,28 +713,28 @@ proxy_get(proxyobject *pp, PyObject *args)
static PyObject * static PyObject *
proxy_keys(proxyobject *pp) proxy_keys(proxyobject *pp)
{ {
_Py_identifier(keys); _Py_IDENTIFIER(keys);
return _PyObject_CallMethodId(pp->dict, &PyId_keys, NULL); return _PyObject_CallMethodId(pp->dict, &PyId_keys, NULL);
} }
static PyObject * static PyObject *
proxy_values(proxyobject *pp) proxy_values(proxyobject *pp)
{ {
_Py_identifier(values); _Py_IDENTIFIER(values);
return _PyObject_CallMethodId(pp->dict, &PyId_values, NULL); return _PyObject_CallMethodId(pp->dict, &PyId_values, NULL);
} }
static PyObject * static PyObject *
proxy_items(proxyobject *pp) proxy_items(proxyobject *pp)
{ {
_Py_identifier(items); _Py_IDENTIFIER(items);
return _PyObject_CallMethodId(pp->dict, &PyId_items, NULL); return _PyObject_CallMethodId(pp->dict, &PyId_items, NULL);
} }
static PyObject * static PyObject *
proxy_copy(proxyobject *pp) proxy_copy(proxyobject *pp)
{ {
_Py_identifier(copy); _Py_IDENTIFIER(copy);
return _PyObject_CallMethodId(pp->dict, &PyId_copy, NULL); return _PyObject_CallMethodId(pp->dict, &PyId_copy, NULL);
} }
@ -1299,7 +1299,7 @@ property_init(PyObject *self, PyObject *args, PyObject *kwds)
/* if no docstring given and the getter has one, use that one */ /* if no docstring given and the getter has one, use that one */
if ((doc == NULL || doc == Py_None) && get != NULL) { if ((doc == NULL || doc == Py_None) && get != NULL) {
_Py_identifier(__doc__); _Py_IDENTIFIER(__doc__);
PyObject *get_doc = _PyObject_GetAttrId(get, &PyId___doc__); PyObject *get_doc = _PyObject_GetAttrId(get, &PyId___doc__);
if (get_doc) { if (get_doc) {
if (Py_TYPE(self) == &PyProperty_Type) { if (Py_TYPE(self) == &PyProperty_Type) {

View File

@ -2707,7 +2707,7 @@ dictviews_sub(PyObject* self, PyObject *other)
{ {
PyObject *result = PySet_New(self); PyObject *result = PySet_New(self);
PyObject *tmp; PyObject *tmp;
_Py_identifier(difference_update); _Py_IDENTIFIER(difference_update);
if (result == NULL) if (result == NULL)
return NULL; return NULL;
@ -2727,7 +2727,7 @@ dictviews_and(PyObject* self, PyObject *other)
{ {
PyObject *result = PySet_New(self); PyObject *result = PySet_New(self);
PyObject *tmp; PyObject *tmp;
_Py_identifier(intersection_update); _Py_IDENTIFIER(intersection_update);
if (result == NULL) if (result == NULL)
return NULL; return NULL;
@ -2767,7 +2767,7 @@ dictviews_xor(PyObject* self, PyObject *other)
{ {
PyObject *result = PySet_New(self); PyObject *result = PySet_New(self);
PyObject *tmp; PyObject *tmp;
_Py_identifier(symmetric_difference_update); _Py_IDENTIFIER(symmetric_difference_update);
if (result == NULL) if (result == NULL)
return NULL; return NULL;

View File

@ -30,7 +30,7 @@ PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding,
char *errors, char *newline, int closefd) char *errors, char *newline, int closefd)
{ {
PyObject *io, *stream; PyObject *io, *stream;
_Py_identifier(open); _Py_IDENTIFIER(open);
io = PyImport_ImportModule("io"); io = PyImport_ImportModule("io");
if (io == NULL) if (io == NULL)
@ -59,7 +59,7 @@ PyFile_GetLine(PyObject *f, int n)
{ {
PyObject *reader; PyObject *reader;
PyObject *args; PyObject *args;
_Py_identifier(readline); _Py_IDENTIFIER(readline);
reader = _PyObject_GetAttrId(f, &PyId_readline); reader = _PyObject_GetAttrId(f, &PyId_readline);
if (reader == NULL) if (reader == NULL)
@ -128,7 +128,7 @@ int
PyFile_WriteObject(PyObject *v, PyObject *f, int flags) PyFile_WriteObject(PyObject *v, PyObject *f, int flags)
{ {
PyObject *writer, *value, *args, *result; PyObject *writer, *value, *args, *result;
_Py_identifier(write); _Py_IDENTIFIER(write);
if (f == NULL) { if (f == NULL) {
PyErr_SetString(PyExc_TypeError, "writeobject with NULL file"); PyErr_SetString(PyExc_TypeError, "writeobject with NULL file");
@ -197,7 +197,7 @@ PyObject_AsFileDescriptor(PyObject *o)
{ {
int fd; int fd;
PyObject *meth; PyObject *meth;
_Py_identifier(fileno); _Py_IDENTIFIER(fileno);
if (PyLong_Check(o)) { if (PyLong_Check(o)) {
fd = PyLong_AsLong(o); fd = PyLong_AsLong(o);

View File

@ -415,7 +415,7 @@ module_clear(PyModuleObject *m)
static PyObject * static PyObject *
module_dir(PyObject *self, PyObject *args) module_dir(PyObject *self, PyObject *args)
{ {
_Py_identifier(__dict__); _Py_IDENTIFIER(__dict__);
PyObject *result = NULL; PyObject *result = NULL;
PyObject *dict = _PyObject_GetAttrId(self, &PyId___dict__); PyObject *dict = _PyObject_GetAttrId(self, &PyId___dict__);

View File

@ -1933,7 +1933,7 @@ static PyObject *
set_reduce(PySetObject *so) set_reduce(PySetObject *so)
{ {
PyObject *keys=NULL, *args=NULL, *result=NULL, *dict=NULL; PyObject *keys=NULL, *args=NULL, *result=NULL, *dict=NULL;
_Py_identifier(__dict__); _Py_IDENTIFIER(__dict__);
keys = PySequence_List((PyObject *)so); keys = PySequence_List((PyObject *)so);
if (keys == NULL) if (keys == NULL)

View File

@ -35,8 +35,8 @@ struct method_cache_entry {
static struct method_cache_entry method_cache[1 << MCACHE_SIZE_EXP]; static struct method_cache_entry method_cache[1 << MCACHE_SIZE_EXP];
static unsigned int next_version_tag = 0; static unsigned int next_version_tag = 0;
_Py_identifier(__dict__); _Py_IDENTIFIER(__dict__);
_Py_identifier(__class__); _Py_IDENTIFIER(__class__);
unsigned int unsigned int
PyType_ClearCache(void) PyType_ClearCache(void)
@ -1284,7 +1284,7 @@ tail_contains(PyObject *list, int whence, PyObject *o) {
static PyObject * static PyObject *
class_name(PyObject *cls) class_name(PyObject *cls)
{ {
_Py_identifier(__name__); _Py_IDENTIFIER(__name__);
PyObject *name = _PyObject_GetAttrId(cls, &PyId___name__); PyObject *name = _PyObject_GetAttrId(cls, &PyId___name__);
if (name == NULL) { if (name == NULL) {
PyErr_Clear(); PyErr_Clear();
@ -2599,7 +2599,7 @@ merge_class_dict(PyObject *dict, PyObject *aclass)
{ {
PyObject *classdict; PyObject *classdict;
PyObject *bases; PyObject *bases;
_Py_identifier(__bases__); _Py_IDENTIFIER(__bases__);
assert(PyDict_Check(dict)); assert(PyDict_Check(dict));
assert(aclass); assert(aclass);
@ -2901,7 +2901,7 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject *sorted; PyObject *sorted;
PyObject *sorted_methods = NULL; PyObject *sorted_methods = NULL;
PyObject *joined = NULL; PyObject *joined = NULL;
_Py_identifier(join); _Py_IDENTIFIER(join);
/* Compute ", ".join(sorted(type.__abstractmethods__)) /* Compute ", ".join(sorted(type.__abstractmethods__))
into joined. */ into joined. */
@ -3189,7 +3189,7 @@ slotnames(PyObject *cls)
PyObject *copyreg; PyObject *copyreg;
PyObject *slotnames; PyObject *slotnames;
static PyObject *str_slotnames; static PyObject *str_slotnames;
_Py_identifier(_slotnames); _Py_IDENTIFIER(_slotnames);
if (str_slotnames == NULL) { if (str_slotnames == NULL) {
str_slotnames = PyUnicode_InternFromString("__slotnames__"); str_slotnames = PyUnicode_InternFromString("__slotnames__");
@ -3329,7 +3329,7 @@ reduce_2(PyObject *obj)
Py_INCREF(dictitems); Py_INCREF(dictitems);
} }
else { else {
_Py_identifier(items); _Py_IDENTIFIER(items);
PyObject *items = _PyObject_CallMethodId(obj, &PyId_items, ""); PyObject *items = _PyObject_CallMethodId(obj, &PyId_items, "");
if (items == NULL) if (items == NULL)
goto end; goto end;

View File

@ -157,7 +157,7 @@ static PyObject *
weakref_repr(PyWeakReference *self) weakref_repr(PyWeakReference *self)
{ {
PyObject *name, *repr; PyObject *name, *repr;
_Py_identifier(__name__); _Py_IDENTIFIER(__name__);
if (PyWeakref_GET_OBJECT(self) == Py_None) if (PyWeakref_GET_OBJECT(self) == Py_None)
return PyUnicode_FromFormat("<weakref at %p; dead>", self); return PyUnicode_FromFormat("<weakref at %p; dead>", self);
@ -441,7 +441,7 @@ proxy_checkref(PyWeakReference *proxy)
#define WRAP_METHOD(method, special) \ #define WRAP_METHOD(method, special) \
static PyObject * \ static PyObject * \
method(PyObject *proxy) { \ method(PyObject *proxy) { \
_Py_identifier(special); \ _Py_IDENTIFIER(special); \
UNWRAP(proxy); \ UNWRAP(proxy); \
return _PyObject_CallMethodId(proxy, &PyId_##special, ""); \ return _PyObject_CallMethodId(proxy, &PyId_##special, ""); \
} }

View File

@ -122,7 +122,7 @@ static FNFCIGETTEMPFILE(cb_gettempfile)
static FNFCISTATUS(cb_status) static FNFCISTATUS(cb_status)
{ {
if (pv) { if (pv) {
_Py_identifier(status); _Py_IDENTIFIER(status);
PyObject *result = _PyObject_CallMethodId(pv, &PyId_status, "iii", typeStatus, cb1, cb2); PyObject *result = _PyObject_CallMethodId(pv, &PyId_status, "iii", typeStatus, cb1, cb2);
if (result == NULL) if (result == NULL)
@ -135,7 +135,7 @@ static FNFCISTATUS(cb_status)
static FNFCIGETNEXTCABINET(cb_getnextcabinet) static FNFCIGETNEXTCABINET(cb_getnextcabinet)
{ {
if (pv) { if (pv) {
_Py_identifier(getnextcabinet); _Py_IDENTIFIER(getnextcabinet);
PyObject *result = _PyObject_CallMethodId(pv, &PyId_getnextcabinet, "i", pccab->iCab); PyObject *result = _PyObject_CallMethodId(pv, &PyId_getnextcabinet, "i", pccab->iCab);
if (result == NULL) if (result == NULL)

View File

@ -462,8 +462,8 @@ static int
fp_setreadl(struct tok_state *tok, const char* enc) fp_setreadl(struct tok_state *tok, const char* enc)
{ {
PyObject *readline = NULL, *stream = NULL, *io = NULL; PyObject *readline = NULL, *stream = NULL, *io = NULL;
_Py_identifier(open); _Py_IDENTIFIER(open);
_Py_identifier(readline); _Py_IDENTIFIER(readline);
int fd; int fd;
io = PyImport_ImportModuleNoBlock("io"); io = PyImport_ImportModuleNoBlock("io");

View File

@ -7,7 +7,7 @@ static PyTypeObject AST_type;
static PyTypeObject *mod_type; static PyTypeObject *mod_type;
static PyObject* ast2obj_mod(void*); static PyObject* ast2obj_mod(void*);
static PyTypeObject *Module_type; static PyTypeObject *Module_type;
_Py_identifier(body); _Py_IDENTIFIER(body);
static char *Module_fields[]={ static char *Module_fields[]={
"body", "body",
}; };
@ -24,18 +24,18 @@ static char *Suite_fields[]={
"body", "body",
}; };
static PyTypeObject *stmt_type; static PyTypeObject *stmt_type;
_Py_identifier(lineno); _Py_IDENTIFIER(lineno);
_Py_identifier(col_offset); _Py_IDENTIFIER(col_offset);
static char *stmt_attributes[] = { static char *stmt_attributes[] = {
"lineno", "lineno",
"col_offset", "col_offset",
}; };
static PyObject* ast2obj_stmt(void*); static PyObject* ast2obj_stmt(void*);
static PyTypeObject *FunctionDef_type; static PyTypeObject *FunctionDef_type;
_Py_identifier(name); _Py_IDENTIFIER(name);
_Py_identifier(args); _Py_IDENTIFIER(args);
_Py_identifier(decorator_list); _Py_IDENTIFIER(decorator_list);
_Py_identifier(returns); _Py_IDENTIFIER(returns);
static char *FunctionDef_fields[]={ static char *FunctionDef_fields[]={
"name", "name",
"args", "args",
@ -44,10 +44,10 @@ static char *FunctionDef_fields[]={
"returns", "returns",
}; };
static PyTypeObject *ClassDef_type; static PyTypeObject *ClassDef_type;
_Py_identifier(bases); _Py_IDENTIFIER(bases);
_Py_identifier(keywords); _Py_IDENTIFIER(keywords);
_Py_identifier(starargs); _Py_IDENTIFIER(starargs);
_Py_identifier(kwargs); _Py_IDENTIFIER(kwargs);
static char *ClassDef_fields[]={ static char *ClassDef_fields[]={
"name", "name",
"bases", "bases",
@ -58,12 +58,12 @@ static char *ClassDef_fields[]={
"decorator_list", "decorator_list",
}; };
static PyTypeObject *Return_type; static PyTypeObject *Return_type;
_Py_identifier(value); _Py_IDENTIFIER(value);
static char *Return_fields[]={ static char *Return_fields[]={
"value", "value",
}; };
static PyTypeObject *Delete_type; static PyTypeObject *Delete_type;
_Py_identifier(targets); _Py_IDENTIFIER(targets);
static char *Delete_fields[]={ static char *Delete_fields[]={
"targets", "targets",
}; };
@ -73,16 +73,16 @@ static char *Assign_fields[]={
"value", "value",
}; };
static PyTypeObject *AugAssign_type; static PyTypeObject *AugAssign_type;
_Py_identifier(target); _Py_IDENTIFIER(target);
_Py_identifier(op); _Py_IDENTIFIER(op);
static char *AugAssign_fields[]={ static char *AugAssign_fields[]={
"target", "target",
"op", "op",
"value", "value",
}; };
static PyTypeObject *For_type; static PyTypeObject *For_type;
_Py_identifier(iter); _Py_IDENTIFIER(iter);
_Py_identifier(orelse); _Py_IDENTIFIER(orelse);
static char *For_fields[]={ static char *For_fields[]={
"target", "target",
"iter", "iter",
@ -90,7 +90,7 @@ static char *For_fields[]={
"orelse", "orelse",
}; };
static PyTypeObject *While_type; static PyTypeObject *While_type;
_Py_identifier(test); _Py_IDENTIFIER(test);
static char *While_fields[]={ static char *While_fields[]={
"test", "test",
"body", "body",
@ -103,21 +103,21 @@ static char *If_fields[]={
"orelse", "orelse",
}; };
static PyTypeObject *With_type; static PyTypeObject *With_type;
_Py_identifier(items); _Py_IDENTIFIER(items);
static char *With_fields[]={ static char *With_fields[]={
"items", "items",
"body", "body",
}; };
static PyTypeObject *Raise_type; static PyTypeObject *Raise_type;
_Py_identifier(exc); _Py_IDENTIFIER(exc);
_Py_identifier(cause); _Py_IDENTIFIER(cause);
static char *Raise_fields[]={ static char *Raise_fields[]={
"exc", "exc",
"cause", "cause",
}; };
static PyTypeObject *Try_type; static PyTypeObject *Try_type;
_Py_identifier(handlers); _Py_IDENTIFIER(handlers);
_Py_identifier(finalbody); _Py_IDENTIFIER(finalbody);
static char *Try_fields[]={ static char *Try_fields[]={
"body", "body",
"handlers", "handlers",
@ -125,19 +125,19 @@ static char *Try_fields[]={
"finalbody", "finalbody",
}; };
static PyTypeObject *Assert_type; static PyTypeObject *Assert_type;
_Py_identifier(msg); _Py_IDENTIFIER(msg);
static char *Assert_fields[]={ static char *Assert_fields[]={
"test", "test",
"msg", "msg",
}; };
static PyTypeObject *Import_type; static PyTypeObject *Import_type;
_Py_identifier(names); _Py_IDENTIFIER(names);
static char *Import_fields[]={ static char *Import_fields[]={
"names", "names",
}; };
static PyTypeObject *ImportFrom_type; static PyTypeObject *ImportFrom_type;
_Py_identifier(module); _Py_IDENTIFIER(module);
_Py_identifier(level); _Py_IDENTIFIER(level);
static char *ImportFrom_fields[]={ static char *ImportFrom_fields[]={
"module", "module",
"names", "names",
@ -165,21 +165,21 @@ static char *expr_attributes[] = {
}; };
static PyObject* ast2obj_expr(void*); static PyObject* ast2obj_expr(void*);
static PyTypeObject *BoolOp_type; static PyTypeObject *BoolOp_type;
_Py_identifier(values); _Py_IDENTIFIER(values);
static char *BoolOp_fields[]={ static char *BoolOp_fields[]={
"op", "op",
"values", "values",
}; };
static PyTypeObject *BinOp_type; static PyTypeObject *BinOp_type;
_Py_identifier(left); _Py_IDENTIFIER(left);
_Py_identifier(right); _Py_IDENTIFIER(right);
static char *BinOp_fields[]={ static char *BinOp_fields[]={
"left", "left",
"op", "op",
"right", "right",
}; };
static PyTypeObject *UnaryOp_type; static PyTypeObject *UnaryOp_type;
_Py_identifier(operand); _Py_IDENTIFIER(operand);
static char *UnaryOp_fields[]={ static char *UnaryOp_fields[]={
"op", "op",
"operand", "operand",
@ -196,19 +196,19 @@ static char *IfExp_fields[]={
"orelse", "orelse",
}; };
static PyTypeObject *Dict_type; static PyTypeObject *Dict_type;
_Py_identifier(keys); _Py_IDENTIFIER(keys);
static char *Dict_fields[]={ static char *Dict_fields[]={
"keys", "keys",
"values", "values",
}; };
static PyTypeObject *Set_type; static PyTypeObject *Set_type;
_Py_identifier(elts); _Py_IDENTIFIER(elts);
static char *Set_fields[]={ static char *Set_fields[]={
"elts", "elts",
}; };
static PyTypeObject *ListComp_type; static PyTypeObject *ListComp_type;
_Py_identifier(elt); _Py_IDENTIFIER(elt);
_Py_identifier(generators); _Py_IDENTIFIER(generators);
static char *ListComp_fields[]={ static char *ListComp_fields[]={
"elt", "elt",
"generators", "generators",
@ -219,7 +219,7 @@ static char *SetComp_fields[]={
"generators", "generators",
}; };
static PyTypeObject *DictComp_type; static PyTypeObject *DictComp_type;
_Py_identifier(key); _Py_IDENTIFIER(key);
static char *DictComp_fields[]={ static char *DictComp_fields[]={
"key", "key",
"value", "value",
@ -235,15 +235,15 @@ static char *Yield_fields[]={
"value", "value",
}; };
static PyTypeObject *Compare_type; static PyTypeObject *Compare_type;
_Py_identifier(ops); _Py_IDENTIFIER(ops);
_Py_identifier(comparators); _Py_IDENTIFIER(comparators);
static char *Compare_fields[]={ static char *Compare_fields[]={
"left", "left",
"ops", "ops",
"comparators", "comparators",
}; };
static PyTypeObject *Call_type; static PyTypeObject *Call_type;
_Py_identifier(func); _Py_IDENTIFIER(func);
static char *Call_fields[]={ static char *Call_fields[]={
"func", "func",
"args", "args",
@ -252,12 +252,12 @@ static char *Call_fields[]={
"kwargs", "kwargs",
}; };
static PyTypeObject *Num_type; static PyTypeObject *Num_type;
_Py_identifier(n); _Py_IDENTIFIER(n);
static char *Num_fields[]={ static char *Num_fields[]={
"n", "n",
}; };
static PyTypeObject *Str_type; static PyTypeObject *Str_type;
_Py_identifier(s); _Py_IDENTIFIER(s);
static char *Str_fields[]={ static char *Str_fields[]={
"s", "s",
}; };
@ -267,15 +267,15 @@ static char *Bytes_fields[]={
}; };
static PyTypeObject *Ellipsis_type; static PyTypeObject *Ellipsis_type;
static PyTypeObject *Attribute_type; static PyTypeObject *Attribute_type;
_Py_identifier(attr); _Py_IDENTIFIER(attr);
_Py_identifier(ctx); _Py_IDENTIFIER(ctx);
static char *Attribute_fields[]={ static char *Attribute_fields[]={
"value", "value",
"attr", "attr",
"ctx", "ctx",
}; };
static PyTypeObject *Subscript_type; static PyTypeObject *Subscript_type;
_Py_identifier(slice); _Py_IDENTIFIER(slice);
static char *Subscript_fields[]={ static char *Subscript_fields[]={
"value", "value",
"slice", "slice",
@ -287,7 +287,7 @@ static char *Starred_fields[]={
"ctx", "ctx",
}; };
static PyTypeObject *Name_type; static PyTypeObject *Name_type;
_Py_identifier(id); _Py_IDENTIFIER(id);
static char *Name_fields[]={ static char *Name_fields[]={
"id", "id",
"ctx", "ctx",
@ -315,16 +315,16 @@ static PyTypeObject *Param_type;
static PyTypeObject *slice_type; static PyTypeObject *slice_type;
static PyObject* ast2obj_slice(void*); static PyObject* ast2obj_slice(void*);
static PyTypeObject *Slice_type; static PyTypeObject *Slice_type;
_Py_identifier(lower); _Py_IDENTIFIER(lower);
_Py_identifier(upper); _Py_IDENTIFIER(upper);
_Py_identifier(step); _Py_IDENTIFIER(step);
static char *Slice_fields[]={ static char *Slice_fields[]={
"lower", "lower",
"upper", "upper",
"step", "step",
}; };
static PyTypeObject *ExtSlice_type; static PyTypeObject *ExtSlice_type;
_Py_identifier(dims); _Py_IDENTIFIER(dims);
static char *ExtSlice_fields[]={ static char *ExtSlice_fields[]={
"dims", "dims",
}; };
@ -380,7 +380,7 @@ static PyTypeObject *In_type;
static PyTypeObject *NotIn_type; static PyTypeObject *NotIn_type;
static PyTypeObject *comprehension_type; static PyTypeObject *comprehension_type;
static PyObject* ast2obj_comprehension(void*); static PyObject* ast2obj_comprehension(void*);
_Py_identifier(ifs); _Py_IDENTIFIER(ifs);
static char *comprehension_fields[]={ static char *comprehension_fields[]={
"target", "target",
"iter", "iter",
@ -393,7 +393,7 @@ static char *excepthandler_attributes[] = {
}; };
static PyObject* ast2obj_excepthandler(void*); static PyObject* ast2obj_excepthandler(void*);
static PyTypeObject *ExceptHandler_type; static PyTypeObject *ExceptHandler_type;
_Py_identifier(type); _Py_IDENTIFIER(type);
static char *ExceptHandler_fields[]={ static char *ExceptHandler_fields[]={
"type", "type",
"name", "name",
@ -401,13 +401,13 @@ static char *ExceptHandler_fields[]={
}; };
static PyTypeObject *arguments_type; static PyTypeObject *arguments_type;
static PyObject* ast2obj_arguments(void*); static PyObject* ast2obj_arguments(void*);
_Py_identifier(vararg); _Py_IDENTIFIER(vararg);
_Py_identifier(varargannotation); _Py_IDENTIFIER(varargannotation);
_Py_identifier(kwonlyargs); _Py_IDENTIFIER(kwonlyargs);
_Py_identifier(kwarg); _Py_IDENTIFIER(kwarg);
_Py_identifier(kwargannotation); _Py_IDENTIFIER(kwargannotation);
_Py_identifier(defaults); _Py_IDENTIFIER(defaults);
_Py_identifier(kw_defaults); _Py_IDENTIFIER(kw_defaults);
static char *arguments_fields[]={ static char *arguments_fields[]={
"args", "args",
"vararg", "vararg",
@ -420,8 +420,8 @@ static char *arguments_fields[]={
}; };
static PyTypeObject *arg_type; static PyTypeObject *arg_type;
static PyObject* ast2obj_arg(void*); static PyObject* ast2obj_arg(void*);
_Py_identifier(arg); _Py_IDENTIFIER(arg);
_Py_identifier(annotation); _Py_IDENTIFIER(annotation);
static char *arg_fields[]={ static char *arg_fields[]={
"arg", "arg",
"annotation", "annotation",
@ -434,15 +434,15 @@ static char *keyword_fields[]={
}; };
static PyTypeObject *alias_type; static PyTypeObject *alias_type;
static PyObject* ast2obj_alias(void*); static PyObject* ast2obj_alias(void*);
_Py_identifier(asname); _Py_IDENTIFIER(asname);
static char *alias_fields[]={ static char *alias_fields[]={
"name", "name",
"asname", "asname",
}; };
static PyTypeObject *withitem_type; static PyTypeObject *withitem_type;
static PyObject* ast2obj_withitem(void*); static PyObject* ast2obj_withitem(void*);
_Py_identifier(context_expr); _Py_IDENTIFIER(context_expr);
_Py_identifier(optional_vars); _Py_IDENTIFIER(optional_vars);
static char *withitem_fields[]={ static char *withitem_fields[]={
"context_expr", "context_expr",
"optional_vars", "optional_vars",
@ -452,7 +452,7 @@ static char *withitem_fields[]={
static int static int
ast_type_init(PyObject *self, PyObject *args, PyObject *kw) ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
{ {
_Py_identifier(_fields); _Py_IDENTIFIER(_fields);
Py_ssize_t i, numfields = 0; Py_ssize_t i, numfields = 0;
int res = -1; int res = -1;
PyObject *key, *value, *fields; PyObject *key, *value, *fields;
@ -506,7 +506,7 @@ static PyObject *
ast_type_reduce(PyObject *self, PyObject *unused) ast_type_reduce(PyObject *self, PyObject *unused)
{ {
PyObject *res; PyObject *res;
_Py_identifier(__dict__); _Py_IDENTIFIER(__dict__);
PyObject *dict = _PyObject_GetAttrId(self, &PyId___dict__); PyObject *dict = _PyObject_GetAttrId(self, &PyId___dict__);
if (dict == NULL) { if (dict == NULL) {
if (PyErr_ExceptionMatches(PyExc_AttributeError)) if (PyErr_ExceptionMatches(PyExc_AttributeError))

View File

@ -18,7 +18,7 @@ static int
check_matched(PyObject *obj, PyObject *arg) check_matched(PyObject *obj, PyObject *arg)
{ {
PyObject *result; PyObject *result;
_Py_identifier(match); _Py_IDENTIFIER(match);
int rc; int rc;
if (obj == Py_None) if (obj == Py_None)
@ -247,7 +247,7 @@ show_warning(PyObject *filename, int lineno, PyObject *text, PyObject
PyObject *f_stderr; PyObject *f_stderr;
PyObject *name; PyObject *name;
char lineno_str[128]; char lineno_str[128];
_Py_identifier(__name__); _Py_IDENTIFIER(__name__);
PyOS_snprintf(lineno_str, sizeof(lineno_str), ":%d: ", lineno); PyOS_snprintf(lineno_str, sizeof(lineno_str), ":%d: ", lineno);

View File

@ -527,7 +527,7 @@ static PyObject *parsestrplus(struct compiling *, const node *n,
static identifier static identifier
new_identifier(const char* n, PyArena *arena) new_identifier(const char* n, PyArena *arena)
{ {
_Py_identifier(normalize); _Py_IDENTIFIER(normalize);
PyObject* id = PyUnicode_DecodeUTF8(n, strlen(n), NULL); PyObject* id = PyUnicode_DecodeUTF8(n, strlen(n), NULL);
if (!id || PyUnicode_READY(id) == -1) if (!id || PyUnicode_READY(id) == -1)
return NULL; return NULL;

View File

@ -32,8 +32,8 @@ const char *Py_FileSystemDefaultEncoding = NULL; /* set by initfsencoding() */
int Py_HasFileSystemDefaultEncoding = 0; int Py_HasFileSystemDefaultEncoding = 0;
#endif #endif
_Py_identifier(fileno); _Py_IDENTIFIER(fileno);
_Py_identifier(flush); _Py_IDENTIFIER(flush);
static PyObject * static PyObject *
builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds) builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
@ -41,7 +41,7 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *func, *name, *bases, *mkw, *meta, *prep, *ns, *cell; PyObject *func, *name, *bases, *mkw, *meta, *prep, *ns, *cell;
PyObject *cls = NULL; PyObject *cls = NULL;
Py_ssize_t nargs; Py_ssize_t nargs;
_Py_identifier(__prepare__); _Py_IDENTIFIER(__prepare__);
assert(args != NULL); assert(args != NULL);
if (!PyTuple_Check(args)) { if (!PyTuple_Check(args)) {
@ -1614,7 +1614,7 @@ builtin_input(PyObject *self, PyObject *args)
char *stdin_encoding_str; char *stdin_encoding_str;
PyObject *result; PyObject *result;
size_t len; size_t len;
_Py_identifier(encoding); _Py_IDENTIFIER(encoding);
stdin_encoding = _PyObject_GetAttrId(fin, &PyId_encoding); stdin_encoding = _PyObject_GetAttrId(fin, &PyId_encoding);
if (!stdin_encoding) if (!stdin_encoding)
@ -1790,7 +1790,7 @@ builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *callable; PyObject *callable;
static char *kwlist[] = {"iterable", "key", "reverse", 0}; static char *kwlist[] = {"iterable", "key", "reverse", 0};
int reverse; int reverse;
_Py_identifier(sort); _Py_IDENTIFIER(sort);
/* args 1-3 should match listsort in Objects/listobject.c */ /* args 1-3 should match listsort in Objects/listobject.c */
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|Oi:sorted", if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|Oi:sorted",
@ -1847,7 +1847,7 @@ builtin_vars(PyObject *self, PyObject *args)
Py_INCREF(d); Py_INCREF(d);
} }
else { else {
_Py_identifier(__dict__); _Py_IDENTIFIER(__dict__);
d = _PyObject_GetAttrId(v, &PyId___dict__); d = _PyObject_GetAttrId(v, &PyId___dict__);
if (d == NULL) { if (d == NULL) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,

View File

@ -372,7 +372,7 @@ PyEval_ReleaseThread(PyThreadState *tstate)
void void
PyEval_ReInitThreads(void) PyEval_ReInitThreads(void)
{ {
_Py_identifier(_after_fork); _Py_IDENTIFIER(_after_fork);
PyObject *threading, *result; PyObject *threading, *result;
PyThreadState *tstate = PyThreadState_GET(); PyThreadState *tstate = PyThreadState_GET();

View File

@ -467,8 +467,8 @@ PyObject *PyCodec_LookupError(const char *name)
static void wrong_exception_type(PyObject *exc) static void wrong_exception_type(PyObject *exc)
{ {
_Py_identifier(__class__); _Py_IDENTIFIER(__class__);
_Py_identifier(__name__); _Py_IDENTIFIER(__name__);
PyObject *type = _PyObject_GetAttrId(exc, &PyId___class__); PyObject *type = _PyObject_GetAttrId(exc, &PyId___class__);
if (type != NULL) { if (type != NULL) {
PyObject *name = _PyObject_GetAttrId(type, &PyId___name__); PyObject *name = _PyObject_GetAttrId(type, &PyId___name__);

View File

@ -712,7 +712,7 @@ PyErr_NewExceptionWithDoc(const char *name, const char *doc,
void void
PyErr_WriteUnraisable(PyObject *obj) PyErr_WriteUnraisable(PyObject *obj)
{ {
_Py_identifier(__module__); _Py_IDENTIFIER(__module__);
PyObject *f, *t, *v, *tb; PyObject *f, *t, *v, *tb;
PyErr_Fetch(&t, &v, &tb); PyErr_Fetch(&t, &v, &tb);
f = PySys_GetObject("stderr"); f = PySys_GetObject("stderr");

View File

@ -154,7 +154,7 @@ static const struct filedescr _PyImport_StandardFiletab[] = {
}; };
static PyObject *initstr = NULL; static PyObject *initstr = NULL;
_Py_identifier(__path__); _Py_IDENTIFIER(__path__);
/* Initialize things */ /* Initialize things */
@ -248,7 +248,7 @@ _PyImportHooks_Init(void)
PySys_WriteStderr("# can't import zipimport\n"); PySys_WriteStderr("# can't import zipimport\n");
} }
else { else {
_Py_identifier(zipimporter); _Py_IDENTIFIER(zipimporter);
PyObject *zipimporter = _PyObject_GetAttrId(zimpimport, PyObject *zipimporter = _PyObject_GetAttrId(zimpimport,
&PyId_zipimporter); &PyId_zipimporter);
Py_DECREF(zimpimport); Py_DECREF(zimpimport);
@ -1802,7 +1802,7 @@ find_module_path(PyObject *fullname, PyObject *name, PyObject *path,
/* sys.path_hooks import hook */ /* sys.path_hooks import hook */
if (p_loader != NULL) { if (p_loader != NULL) {
_Py_identifier(find_module); _Py_IDENTIFIER(find_module);
PyObject *importer; PyObject *importer;
importer = get_path_importer(path_importer_cache, importer = get_path_importer(path_importer_cache,
@ -2032,7 +2032,7 @@ find_module(PyObject *fullname, PyObject *name, PyObject *search_path_list,
/* sys.meta_path import hook */ /* sys.meta_path import hook */
if (p_loader != NULL) { if (p_loader != NULL) {
_Py_identifier(find_module); _Py_IDENTIFIER(find_module);
PyObject *meta_path; PyObject *meta_path;
meta_path = PySys_GetObject("meta_path"); meta_path = PySys_GetObject("meta_path");
@ -2462,7 +2462,7 @@ load_module(PyObject *name, FILE *fp, PyObject *pathname, int type, PyObject *lo
break; break;
case IMP_HOOK: { case IMP_HOOK: {
_Py_identifier(load_module); _Py_IDENTIFIER(load_module);
if (loader == NULL) { if (loader == NULL) {
PyErr_SetString(PyExc_ImportError, PyErr_SetString(PyExc_ImportError,
"import hook without loader"); "import hook without loader");
@ -3227,7 +3227,7 @@ ensure_fromlist(PyObject *mod, PyObject *fromlist, PyObject *name,
} }
if (PyUnicode_READ_CHAR(item, 0) == '*') { if (PyUnicode_READ_CHAR(item, 0) == '*') {
PyObject *all; PyObject *all;
_Py_identifier(__all__); _Py_IDENTIFIER(__all__);
Py_DECREF(item); Py_DECREF(item);
/* See if the package defines __all__ */ /* See if the package defines __all__ */
if (recursive) if (recursive)

View File

@ -480,7 +480,7 @@ r_string(char *s, int n, RFILE *p)
} }
} }
else { else {
_Py_identifier(read); _Py_IDENTIFIER(read);
PyObject *data = _PyObject_CallMethodId(p->readable, &PyId_read, "i", n); PyObject *data = _PyObject_CallMethodId(p->readable, &PyId_read, "i", n);
read = 0; read = 0;
@ -1292,7 +1292,7 @@ marshal_dump(PyObject *self, PyObject *args)
int version = Py_MARSHAL_VERSION; int version = Py_MARSHAL_VERSION;
PyObject *s; PyObject *s;
PyObject *res; PyObject *res;
_Py_identifier(write); _Py_IDENTIFIER(write);
if (!PyArg_ParseTuple(args, "OO|i:dump", &x, &f, &version)) if (!PyArg_ParseTuple(args, "OO|i:dump", &x, &f, &version))
return NULL; return NULL;
@ -1321,7 +1321,7 @@ static PyObject *
marshal_load(PyObject *self, PyObject *f) marshal_load(PyObject *self, PyObject *f)
{ {
PyObject *data, *result; PyObject *data, *result;
_Py_identifier(read); _Py_IDENTIFIER(read);
RFILE rf; RFILE rf;
/* /*

View File

@ -141,7 +141,7 @@ get_codec_name(const char *encoding)
{ {
char *name_utf8, *name_str; char *name_utf8, *name_str;
PyObject *codec, *name = NULL; PyObject *codec, *name = NULL;
_Py_identifier(name); _Py_IDENTIFIER(name);
codec = _PyCodec_Lookup(encoding); codec = _PyCodec_Lookup(encoding);
if (!codec) if (!codec)
@ -353,7 +353,7 @@ flush_std_files(void)
PyObject *fout = PySys_GetObject("stdout"); PyObject *fout = PySys_GetObject("stdout");
PyObject *ferr = PySys_GetObject("stderr"); PyObject *ferr = PySys_GetObject("stderr");
PyObject *tmp; PyObject *tmp;
_Py_identifier(flush); _Py_IDENTIFIER(flush);
if (fout != NULL && fout != Py_None) { if (fout != NULL && fout != Py_None) {
tmp = _PyObject_CallMethodId(fout, &PyId_flush, ""); tmp = _PyObject_CallMethodId(fout, &PyId_flush, "");
@ -807,9 +807,9 @@ create_stdio(PyObject* io,
const char* newline; const char* newline;
PyObject *line_buffering; PyObject *line_buffering;
int buffering, isatty; int buffering, isatty;
_Py_identifier(open); _Py_IDENTIFIER(open);
_Py_identifier(isatty); _Py_IDENTIFIER(isatty);
_Py_identifier(TextIOWrapper); _Py_IDENTIFIER(TextIOWrapper);
/* stdin is always opened in buffered mode, first because it shouldn't /* stdin is always opened in buffered mode, first because it shouldn't
make a difference in common use cases, second because TextIOWrapper make a difference in common use cases, second because TextIOWrapper
@ -831,7 +831,7 @@ create_stdio(PyObject* io,
goto error; goto error;
if (buffering) { if (buffering) {
_Py_identifier(raw); _Py_IDENTIFIER(raw);
raw = _PyObject_GetAttrId(buf, &PyId_raw); raw = _PyObject_GetAttrId(buf, &PyId_raw);
if (raw == NULL) if (raw == NULL)
goto error; goto error;
@ -1117,7 +1117,7 @@ PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags
PyArena *arena; PyArena *arena;
char *ps1 = "", *ps2 = "", *enc = NULL; char *ps1 = "", *ps2 = "", *enc = NULL;
int errcode = 0; int errcode = 0;
_Py_identifier(encoding); _Py_IDENTIFIER(encoding);
if (fp == stdin) { if (fp == stdin) {
/* Fetch encoding from sys.stdin */ /* Fetch encoding from sys.stdin */
@ -1321,11 +1321,11 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
{ {
long hold; long hold;
PyObject *v; PyObject *v;
_Py_identifier(msg); _Py_IDENTIFIER(msg);
_Py_identifier(filename); _Py_IDENTIFIER(filename);
_Py_identifier(lineno); _Py_IDENTIFIER(lineno);
_Py_identifier(offset); _Py_IDENTIFIER(offset);
_Py_identifier(text); _Py_IDENTIFIER(text);
/* old style errors */ /* old style errors */
if (PyTuple_Check(err)) if (PyTuple_Check(err))
@ -1439,7 +1439,7 @@ handle_system_exit(void)
goto done; goto done;
if (PyExceptionInstance_Check(value)) { if (PyExceptionInstance_Check(value)) {
/* The error code should be in the `code' attribute. */ /* The error code should be in the `code' attribute. */
_Py_identifier(code); _Py_IDENTIFIER(code);
PyObject *code = _PyObject_GetAttrId(value, &PyId_code); PyObject *code = _PyObject_GetAttrId(value, &PyId_code);
if (code) { if (code) {
Py_DECREF(value); Py_DECREF(value);
@ -1597,7 +1597,7 @@ print_exception(PyObject *f, PyObject *value)
else { else {
PyObject* moduleName; PyObject* moduleName;
char* className; char* className;
_Py_identifier(__module__); _Py_IDENTIFIER(__module__);
assert(PyExceptionClass_Check(type)); assert(PyExceptionClass_Check(type));
className = PyExceptionClass_Name(type); className = PyExceptionClass_Name(type);
if (className != NULL) { if (className != NULL) {
@ -1773,7 +1773,7 @@ flush_io(void)
{ {
PyObject *f, *r; PyObject *f, *r;
PyObject *type, *value, *traceback; PyObject *type, *value, *traceback;
_Py_identifier(flush); _Py_IDENTIFIER(flush);
/* Save the current exception */ /* Save the current exception */
PyErr_Fetch(&type, &value, &traceback); PyErr_Fetch(&type, &value, &traceback);
@ -2220,7 +2220,7 @@ static void
wait_for_thread_shutdown(void) wait_for_thread_shutdown(void)
{ {
#ifdef WITH_THREAD #ifdef WITH_THREAD
_Py_identifier(_shutdown); _Py_IDENTIFIER(_shutdown);
PyObject *result; PyObject *result;
PyThreadState *tstate = PyThreadState_GET(); PyThreadState *tstate = PyThreadState_GET();
PyObject *threading = PyMapping_GetItemString(tstate->interp->modules, PyObject *threading = PyMapping_GetItemString(tstate->interp->modules,

View File

@ -79,8 +79,8 @@ sys_displayhook_unencodable(PyObject *outf, PyObject *o)
PyObject *encoded, *escaped_str, *repr_str, *buffer, *result; PyObject *encoded, *escaped_str, *repr_str, *buffer, *result;
char *stdout_encoding_str; char *stdout_encoding_str;
int ret; int ret;
_Py_identifier(encoding); _Py_IDENTIFIER(encoding);
_Py_identifier(buffer); _Py_IDENTIFIER(buffer);
stdout_encoding = _PyObject_GetAttrId(outf, &PyId_encoding); stdout_encoding = _PyObject_GetAttrId(outf, &PyId_encoding);
if (stdout_encoding == NULL) if (stdout_encoding == NULL)
@ -101,7 +101,7 @@ sys_displayhook_unencodable(PyObject *outf, PyObject *o)
buffer = _PyObject_GetAttrId(outf, &PyId_buffer); buffer = _PyObject_GetAttrId(outf, &PyId_buffer);
if (buffer) { if (buffer) {
_Py_identifier(write); _Py_IDENTIFIER(write);
result = _PyObject_CallMethodId(buffer, &PyId_write, "(O)", encoded); result = _PyObject_CallMethodId(buffer, &PyId_write, "(O)", encoded);
Py_DECREF(buffer); Py_DECREF(buffer);
Py_DECREF(encoded); Py_DECREF(encoded);
@ -1843,7 +1843,7 @@ sys_pyfile_write_unicode(PyObject *unicode, PyObject *file)
{ {
PyObject *writer = NULL, *args = NULL, *result = NULL; PyObject *writer = NULL, *args = NULL, *result = NULL;
int err; int err;
_Py_identifier(write); _Py_IDENTIFIER(write);
if (file == NULL) if (file == NULL)
return -1; return -1;

View File

@ -152,7 +152,7 @@ _Py_FindSourceFile(PyObject *filename, char* namebuf, size_t namelen, PyObject *
const char* filepath; const char* filepath;
Py_ssize_t len; Py_ssize_t len;
PyObject* result; PyObject* result;
_Py_identifier(open); _Py_IDENTIFIER(open);
filebytes = PyUnicode_EncodeFSDefault(filename); filebytes = PyUnicode_EncodeFSDefault(filename);
if (filebytes == NULL) { if (filebytes == NULL) {
@ -232,9 +232,9 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
char buf[MAXPATHLEN+1]; char buf[MAXPATHLEN+1];
int kind; int kind;
void *data; void *data;
_Py_identifier(close); _Py_IDENTIFIER(close);
_Py_identifier(open); _Py_IDENTIFIER(open);
_Py_identifier(TextIOWrapper); _Py_IDENTIFIER(TextIOWrapper);
/* open the file */ /* open the file */
if (filename == NULL) if (filename == NULL)