INIT_STR(utf_8, "utf-8"), \
}, \
.identifiers = { \
+ INIT_ID(CANCELLED), \
+ INIT_ID(FINISHED), \
INIT_ID(False), \
INIT_ID(JSONDecodeError), \
+ INIT_ID(PENDING), \
INIT_ID(Py_Repr), \
INIT_ID(TextIOWrapper), \
INIT_ID(True), \
INIT_ID(__anext__), \
INIT_ID(__annotations__), \
INIT_ID(__args__), \
+ INIT_ID(__asyncio_running_event_loop__), \
INIT_ID(__await__), \
INIT_ID(__bases__), \
INIT_ID(__bool__), \
INIT_ID(__xor__), \
INIT_ID(_abc_impl), \
INIT_ID(_annotation), \
+ INIT_ID(_asyncio_future_blocking), \
INIT_ID(_blksize), \
INIT_ID(_bootstrap), \
INIT_ID(_dealloc_warn), \
INIT_ID(_initializing), \
INIT_ID(_is_text_encoding), \
INIT_ID(_lock_unlock_module), \
+ INIT_ID(_loop), \
INIT_ID(_showwarnmsg), \
INIT_ID(_shutdown), \
INIT_ID(_slotnames), \
INIT_ID(abs_tol), \
INIT_ID(access), \
INIT_ID(add), \
+ INIT_ID(add_done_callback), \
INIT_ID(after_in_child), \
INIT_ID(after_in_parent), \
INIT_ID(aggregate_class), \
INIT_ID(cadata), \
INIT_ID(cafile), \
INIT_ID(call), \
+ INIT_ID(call_exception_handler), \
+ INIT_ID(call_soon), \
+ INIT_ID(cancel), \
INIT_ID(capath), \
INIT_ID(category), \
INIT_ID(cb_type), \
INIT_ID(digest_size), \
INIT_ID(digestmod), \
INIT_ID(dir_fd), \
+ INIT_ID(discard), \
INIT_ID(dispatch_table), \
INIT_ID(displayhook), \
INIT_ID(dklen), \
INIT_ID(fromlist), \
INIT_ID(fset), \
INIT_ID(func), \
+ INIT_ID(future), \
INIT_ID(generation), \
INIT_ID(genexpr), \
INIT_ID(get), \
+ INIT_ID(get_debug), \
+ INIT_ID(get_event_loop), \
+ INIT_ID(get_loop), \
INIT_ID(get_source), \
INIT_ID(getattr), \
INIT_ID(getstate), \
INIT_ID(sort), \
INIT_ID(sound), \
INIT_ID(source), \
+ INIT_ID(source_traceback), \
INIT_ID(src), \
INIT_ID(src_dir_fd), \
INIT_ID(stacklevel), \
static inline void
_PyUnicode_InitStaticStrings(void) {
PyObject *string;
+ string = &_Py_ID(CANCELLED);
+ PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(FINISHED);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(False);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(JSONDecodeError);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(PENDING);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(Py_Repr);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(TextIOWrapper);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(__args__);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(__asyncio_running_event_loop__);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(__await__);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(__bases__);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(_annotation);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(_asyncio_future_blocking);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(_blksize);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(_bootstrap);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(_lock_unlock_module);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(_loop);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(_showwarnmsg);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(_shutdown);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(add);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(add_done_callback);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(after_in_child);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(after_in_parent);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(call);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(call_exception_handler);
+ PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(call_soon);
+ PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(cancel);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(capath);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(category);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(dir_fd);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(discard);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(dispatch_table);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(displayhook);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(func);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(future);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(generation);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(genexpr);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(get);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(get_debug);
+ PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(get_event_loop);
+ PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(get_loop);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(get_source);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(getattr);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(source);
PyUnicode_InternInPlace(&string);
+ string = &_Py_ID(source_traceback);
+ PyUnicode_InternInPlace(&string);
string = &_Py_ID(src);
PyUnicode_InternInPlace(&string);
string = &_Py_ID(src_dir_fd);
_PyObject_Dump((PyObject *)&_Py_STR(utf_8));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(CANCELLED)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(CANCELLED));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
+ if (Py_REFCNT((PyObject *)&_Py_ID(FINISHED)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(FINISHED));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(False)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(False));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(JSONDecodeError));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(PENDING)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(PENDING));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(Py_Repr)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(Py_Repr));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(__args__));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(__asyncio_running_event_loop__)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(__asyncio_running_event_loop__));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(__await__)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(__await__));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(_annotation));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(_asyncio_future_blocking)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(_asyncio_future_blocking));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(_blksize)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(_blksize));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(_lock_unlock_module));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(_loop)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(_loop));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(_showwarnmsg)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(_showwarnmsg));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(add));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(add_done_callback)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(add_done_callback));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(after_in_child)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(after_in_child));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(call));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(call_exception_handler)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(call_exception_handler));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
+ if (Py_REFCNT((PyObject *)&_Py_ID(call_soon)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(call_soon));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
+ if (Py_REFCNT((PyObject *)&_Py_ID(cancel)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(cancel));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(capath)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(capath));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(dir_fd));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(discard)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(discard));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(dispatch_table)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(dispatch_table));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(func));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(future)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(future));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(generation)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(generation));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(get));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(get_debug)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(get_debug));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
+ if (Py_REFCNT((PyObject *)&_Py_ID(get_event_loop)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(get_event_loop));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
+ if (Py_REFCNT((PyObject *)&_Py_ID(get_loop)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(get_loop));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(get_source)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(get_source));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
_PyObject_Dump((PyObject *)&_Py_ID(source));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
};
+ if (Py_REFCNT((PyObject *)&_Py_ID(source_traceback)) < _PyObject_IMMORTAL_REFCNT) {
+ _PyObject_Dump((PyObject *)&_Py_ID(source_traceback));
+ Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
+ };
if (Py_REFCNT((PyObject *)&_Py_ID(src)) < _PyObject_IMMORTAL_REFCNT) {
_PyObject_Dump((PyObject *)&_Py_ID(src));
Py_FatalError("immortal object has less refcnt than expected _PyObject_IMMORTAL_REFCNT");
#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
#endif
-#define NEEDS_PY_IDENTIFIER
#include "Python.h"
#include "pycore_pyerrors.h" // _PyErr_ClearExcState()
#include "pycore_pystate.h" // _PyThreadState_GET()
+#include "pycore_runtime_init.h" // _Py_ID()
#include <stddef.h> // offsetof()
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8fd17862aa989c69]*/
-/* identifiers used from some functions */
-_Py_IDENTIFIER(__asyncio_running_event_loop__);
-_Py_IDENTIFIER(_asyncio_future_blocking);
-_Py_IDENTIFIER(add_done_callback);
-_Py_IDENTIFIER(call_soon);
-_Py_IDENTIFIER(cancel);
-_Py_IDENTIFIER(get_event_loop);
-_Py_IDENTIFIER(throw);
-
-
/* State of the _asyncio module */
static PyObject *asyncio_mod;
static PyObject *traceback_extract_stack;
{
/* Implementation of `asyncio.futures._get_loop` */
- _Py_IDENTIFIER(get_loop);
- _Py_IDENTIFIER(_loop);
PyObject *getloop;
if (Future_CheckExact(fut) || Task_CheckExact(fut)) {
return loop;
}
- if (_PyObject_LookupAttrId(fut, &PyId_get_loop, &getloop) < 0) {
+ if (_PyObject_LookupAttr(fut, &_Py_ID(get_loop), &getloop) < 0) {
return NULL;
}
if (getloop != NULL) {
return res;
}
- return _PyObject_GetAttrId(fut, &PyId__loop);
+ return PyObject_GetAttr(fut, &_Py_ID(_loop));
}
goto not_found;
}
- rl = _PyDict_GetItemIdWithError(
- ts_dict, &PyId___asyncio_running_event_loop__); // borrowed
+ rl = PyDict_GetItemWithError(
+ ts_dict, &_Py_ID(__asyncio_running_event_loop__)); // borrowed
if (rl == NULL) {
if (PyErr_Occurred()) {
goto error;
return -1;
}
- if (_PyDict_SetItemId(
- ts_dict, &PyId___asyncio_running_event_loop__, (PyObject *)rl) < 0)
+ if (PyDict_SetItem(
+ ts_dict, &_Py_ID(__asyncio_running_event_loop__), (PyObject *)rl) < 0)
{
Py_DECREF(rl); // will cleanup loop & current_pid
return -1;
return NULL;
}
- loop = _PyObject_CallMethodIdNoArgs(policy, &PyId_get_event_loop);
+ loop = PyObject_CallMethodNoArgs(policy, &_Py_ID(get_event_loop));
Py_DECREF(policy);
return loop;
}
Py_ssize_t nargs;
if (ctx == NULL) {
- handle = _PyObject_CallMethodIdObjArgs(
- loop, &PyId_call_soon, func, arg, NULL);
+ handle = PyObject_CallMethodObjArgs(
+ loop, &_Py_ID(call_soon), func, arg, NULL);
}
else {
/* Use FASTCALL to pass a keyword-only argument to call_soon */
- PyObject *callable = _PyObject_GetAttrId(loop, &PyId_call_soon);
+ PyObject *callable = PyObject_GetAttr(loop, &_Py_ID(call_soon));
if (callable == NULL) {
return -1;
}
{
PyObject *res;
int is_true;
- _Py_IDENTIFIER(get_debug);
// Same to FutureObj_clear() but not clearing fut->dict
Py_CLEAR(fut->fut_loop);
}
fut->fut_loop = loop;
- res = _PyObject_CallMethodIdNoArgs(fut->fut_loop, &PyId_get_debug);
+ res = PyObject_CallMethodNoArgs(fut->fut_loop, &_Py_ID(get_debug));
if (res == NULL) {
return -1;
}
static PyObject *
FutureObj_get_state(FutureObj *fut, void *Py_UNUSED(ignored))
{
- _Py_IDENTIFIER(PENDING);
- _Py_IDENTIFIER(CANCELLED);
- _Py_IDENTIFIER(FINISHED);
PyObject *ret = NULL;
ENSURE_FUTURE_ALIVE(fut)
switch (fut->fut_state) {
case STATE_PENDING:
- ret = _PyUnicode_FromId(&PyId_PENDING);
+ ret = &_Py_ID(PENDING);
break;
case STATE_CANCELLED:
- ret = _PyUnicode_FromId(&PyId_CANCELLED);
+ ret = &_Py_ID(CANCELLED);
break;
case STATE_FINISHED:
- ret = _PyUnicode_FromId(&PyId_FINISHED);
+ ret = &_Py_ID(FINISHED);
break;
default:
assert (0);
static void
FutureObj_finalize(FutureObj *fut)
{
- _Py_IDENTIFIER(call_exception_handler);
- _Py_IDENTIFIER(message);
- _Py_IDENTIFIER(exception);
- _Py_IDENTIFIER(future);
- _Py_IDENTIFIER(source_traceback);
-
PyObject *error_type, *error_value, *error_traceback;
PyObject *context;
PyObject *message = NULL;
goto finally;
}
- if (_PyDict_SetItemId(context, &PyId_message, message) < 0 ||
- _PyDict_SetItemId(context, &PyId_exception, fut->fut_exception) < 0 ||
- _PyDict_SetItemId(context, &PyId_future, (PyObject*)fut) < 0) {
+ if (PyDict_SetItem(context, &_Py_ID(message), message) < 0 ||
+ PyDict_SetItem(context, &_Py_ID(exception), fut->fut_exception) < 0 ||
+ PyDict_SetItem(context, &_Py_ID(future), (PyObject*)fut) < 0) {
goto finally;
}
if (fut->fut_source_tb != NULL) {
- if (_PyDict_SetItemId(context, &PyId_source_traceback,
+ if (PyDict_SetItem(context, &_Py_ID(source_traceback),
fut->fut_source_tb) < 0) {
goto finally;
}
}
- func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler);
+ func = PyObject_GetAttr(fut->fut_loop, &_Py_ID(call_exception_handler));
if (func != NULL) {
PyObject *res = PyObject_CallOneArg(func, context);
if (res == NULL) {
static int
register_task(PyObject *task)
{
- _Py_IDENTIFIER(add);
-
- PyObject *res = _PyObject_CallMethodIdOneArg(all_tasks,
- &PyId_add, task);
+ PyObject *res = PyObject_CallMethodOneArg(all_tasks,
+ &_Py_ID(add), task);
if (res == NULL) {
return -1;
}
static int
unregister_task(PyObject *task)
{
- _Py_IDENTIFIER(discard);
-
- PyObject *res = _PyObject_CallMethodIdOneArg(all_tasks,
- &PyId_discard, task);
+ PyObject *res = PyObject_CallMethodOneArg(all_tasks,
+ &_Py_ID(discard), task);
if (res == NULL) {
return -1;
}
PyObject *res;
int is_true;
- res = _PyObject_CallMethodIdOneArg(self->task_fut_waiter,
- &PyId_cancel, msg);
+ res = PyObject_CallMethodOneArg(self->task_fut_waiter,
+ &_Py_ID(cancel), msg);
if (res == NULL) {
return NULL;
}
static void
TaskObj_finalize(TaskObj *task)
{
- _Py_IDENTIFIER(call_exception_handler);
- _Py_IDENTIFIER(task);
- _Py_IDENTIFIER(message);
- _Py_IDENTIFIER(source_traceback);
-
PyObject *context;
PyObject *message = NULL;
PyObject *func;
goto finally;
}
- if (_PyDict_SetItemId(context, &PyId_message, message) < 0 ||
- _PyDict_SetItemId(context, &PyId_task, (PyObject*)task) < 0)
+ if (PyDict_SetItem(context, &_Py_ID(message), message) < 0 ||
+ PyDict_SetItem(context, &_Py_ID(task), (PyObject*)task) < 0)
{
goto finally;
}
if (task->task_source_tb != NULL) {
- if (_PyDict_SetItemId(context, &PyId_source_traceback,
+ if (PyDict_SetItem(context, &_Py_ID(source_traceback),
task->task_source_tb) < 0)
{
goto finally;
}
}
- func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler);
+ func = PyObject_GetAttr(task->task_loop, &_Py_ID(call_exception_handler));
if (func != NULL) {
PyObject *res = PyObject_CallOneArg(func, context);
if (res == NULL) {
gen_status = PyIter_Send(coro, Py_None, &result);
}
else {
- result = _PyObject_CallMethodIdOneArg(coro, &PyId_throw, exc);
+ result = PyObject_CallMethodOneArg(coro, &_Py_ID(throw), exc);
gen_status = gen_status_from_result(&result);
if (clear_exc) {
/* We created 'exc' during this call */
if (task->task_must_cancel) {
PyObject *r;
int is_true;
- r = _PyObject_CallMethodIdOneArg(result, &PyId_cancel,
+ r = PyObject_CallMethodOneArg(result, &_Py_ID(cancel),
task->task_cancel_msg);
if (r == NULL) {
return NULL;
}
/* Check if `result` is a Future-compatible object */
- if (_PyObject_LookupAttrId(result, &PyId__asyncio_future_blocking, &o) < 0) {
+ if (_PyObject_LookupAttr(result, &_Py_ID(_asyncio_future_blocking), &o) < 0) {
goto fail;
}
if (o != NULL && o != Py_None) {
}
/* result._asyncio_future_blocking = False */
- if (_PyObject_SetAttrId(
- result, &PyId__asyncio_future_blocking, Py_False) == -1) {
+ if (PyObject_SetAttr(
+ result, &_Py_ID(_asyncio_future_blocking), Py_False) == -1) {
goto fail;
}
}
/* result.add_done_callback(task._wakeup) */
- PyObject *add_cb = _PyObject_GetAttrId(
- result, &PyId_add_done_callback);
+ PyObject *add_cb = PyObject_GetAttr(
+ result, &_Py_ID(add_done_callback));
if (add_cb == NULL) {
Py_DECREF(wrapper);
goto fail;
if (task->task_must_cancel) {
PyObject *r;
int is_true;
- r = _PyObject_CallMethodIdOneArg(result, &PyId_cancel,
+ r = PyObject_CallMethodOneArg(result, &_Py_ID(cancel),
task->task_cancel_msg);
if (r == NULL) {
return NULL;