Skip to content

Commit

Permalink
Rename _PyAwaitable_SetAwaiter -> Ci_PyAwaitable_SetAwaiter
Browse files Browse the repository at this point in the history
Summary: Nothing but a rename. Makes the next diff neater.

Reviewed By: alexmalyshev

Differential Revision: D60097672

fbshipit-source-id: 0f06b92b7ca9ad01de92b002ed5255642ccc0854
  • Loading branch information
jbower-fb authored and facebook-github-bot committed Jul 26, 2024
1 parent fee7d79 commit 7b5bcda
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Include/genobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ CiAPI_FUNC(PyObject *) _PyCoro_GetAwaitableIter(PyObject *o);
PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *,
PyObject *name, PyObject *qualname);

static inline void _PyAwaitable_SetAwaiter(PyObject *receiver, PyObject *awaiter) {
static inline void Ci_PyAwaitable_SetAwaiter(PyObject *receiver, PyObject *awaiter) {
PyTypeObject *ty = Py_TYPE(receiver);
if (!PyType_HasFeature(ty, Py_TPFLAGS_HAVE_AM_EXTRA)) {
return;
Expand Down
20 changes: 10 additions & 10 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,9 @@ typedef struct {

// This may be set if someone tries to set the awaiter before we've started
// running the computation. This happens during non-eager execution because
// we call _PyAwaitable_SetAwaiter in both the JIT/interpreter before
// we call Ci_PyAwaitable_SetAwaiter in both the JIT/interpreter before
// starting the compute object. We'll check for this when we start the computation
// and call _PyAwaitable_SetAwaiter with the stored value on the awaitable
// and call Ci_PyAwaitable_SetAwaiter with the stored value on the awaitable
// that is created.
//
// Stores a borrowed reference.
Expand Down Expand Up @@ -3417,7 +3417,7 @@ FutureIter_am_send(futureiterobject *it,
static void
FutureIter_setawaiter(futureiterobject *it, PyObject *awaiter) {
if (it->future != NULL) {
_PyAwaitable_SetAwaiter((PyObject *)it->future, awaiter);
Ci_PyAwaitable_SetAwaiter((PyObject *)it->future, awaiter);
}
}

Expand Down Expand Up @@ -4413,7 +4413,7 @@ TaskObj_finalize(TaskObj *task)
static void TaskObj_dealloc(PyObject *); /* Needs Task_CheckExact */

static void TaskObj_set_awaiter(TaskObj *self, PyObject *awaiter) {
_PyAwaitable_SetAwaiter(self->task_coro, awaiter);
Ci_PyAwaitable_SetAwaiter(self->task_coro, awaiter);
}

// clang-format off
Expand Down Expand Up @@ -6102,7 +6102,7 @@ forward_and_clear_pending_awaiter(AsyncLazyValueComputeObj *self)
if (self->alvc_pending_awaiter == NULL) {
return;
}
_PyAwaitable_SetAwaiter(self->alvc_coroobj, self->alvc_pending_awaiter);
Ci_PyAwaitable_SetAwaiter(self->alvc_coroobj, self->alvc_pending_awaiter);
self->alvc_pending_awaiter = NULL;
}

Expand Down Expand Up @@ -6224,7 +6224,7 @@ AsyncLazyValueCompute_handle_error(AsyncLazyValueComputeObj *self,
static void
AsyncLazyValueCompute_set_awaiter(AsyncLazyValueComputeObj *self, PyObject *awaiter) {
if (self->alvc_coroobj != NULL) {
_PyAwaitable_SetAwaiter(self->alvc_coroobj, awaiter);
Ci_PyAwaitable_SetAwaiter(self->alvc_coroobj, awaiter);
} else {
self->alvc_pending_awaiter = awaiter;
}
Expand Down Expand Up @@ -7027,7 +7027,7 @@ _GatheringFutureObj_set_awaiter(_GatheringFutureObj *self, PyObject *awaiter) {

FOREACH_INDEX(self->gf_datamap, i) {
PyObject* fut = PyList_GET_ITEM(list, i);
_PyAwaitable_SetAwaiter(fut, awaiter);
Ci_PyAwaitable_SetAwaiter(fut, awaiter);
}
FOREACH_INDEX_END()
}
Expand Down Expand Up @@ -7613,7 +7613,7 @@ _gather_multiple(PyObject *const*items,
for (Py_ssize_t i = 0; i < nitems; ++i) {
PyObject *arg = items[i];
if (awaiter) {
_PyAwaitable_SetAwaiter(arg, awaiter);
Ci_PyAwaitable_SetAwaiter(arg, awaiter);
}

Py_hash_t arg_hash = -1;
Expand Down Expand Up @@ -8645,7 +8645,7 @@ _asyncio__AwaitingFuture_cancel_impl(_AwaitingFutureObj *self, PyObject *msg)

// Awaited may continue running while whatever awaited us may finish.
// Clear awaiter in case awaited outlives us.
_PyAwaitable_SetAwaiter(self->af_awaited, NULL);
Ci_PyAwaitable_SetAwaiter(self->af_awaited, NULL);

PyObject *res = FutureLike_remove_done_callback(self->af_awaited, self->af_done_callback);
if (res == NULL) {
Expand Down Expand Up @@ -8753,7 +8753,7 @@ _AwaitingFutureObj_dealloc(PyObject *self)

static void
_AwaitingFutureObj_set_awaiter(_AwaitingFutureObj *self, PyObject *awaiter) {
_PyAwaitable_SetAwaiter(self->af_awaited, awaiter);
Ci_PyAwaitable_SetAwaiter(self->af_awaited, awaiter);
}

static PyAsyncMethodsWithExtra _AwaitingFutureType_as_async = {
Expand Down
2 changes: 1 addition & 1 deletion Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ _PyGen_Finalize(PyObject *self)
* target awaitable. */
PyObject *yf = _PyGen_yf(gen);
if (yf) {
_PyAwaitable_SetAwaiter(yf, NULL);
Ci_PyAwaitable_SetAwaiter(yf, NULL);
Py_DECREF(yf);
}
}
Expand Down
6 changes: 3 additions & 3 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ PyEval_ThreadsInitialized(void)
if (((Ci_PyWaitHandleObject*)r)->wh_waiter) { \
f->f_state = FRAME_SUSPENDED; \
if (f->f_gen != NULL && (co->co_flags & CO_COROUTINE)) { \
_PyAwaitable_SetAwaiter(coro_or_result, f->f_gen); \
Ci_PyAwaitable_SetAwaiter(coro_or_result, f->f_gen); \
} \
f->f_stackdepth = (int)(stack_pointer - f->f_valuestack); \
retval = ((Ci_PyWaitHandleObject*)r)->wh_waiter; \
Expand Down Expand Up @@ -1241,7 +1241,7 @@ _PyEval_EvalEagerCoro(PyThreadState *tstate, struct _frame *f, PyObject *name, P
PyObject *yf = _PyGen_yf((PyGenObject *)coro);
f->f_state = FRAME_SUSPENDED;
if (yf) {
_PyAwaitable_SetAwaiter(yf, (PyObject *)coro);
Ci_PyAwaitable_SetAwaiter(yf, (PyObject *)coro);
Py_DECREF(yf);
}
return Ci_PyWaitHandle_New((PyObject *)coro, retval);
Expand Down Expand Up @@ -2635,7 +2635,7 @@ f->lazy_imports_cache_seq = -1;
PyObject *receiver = TOP();
PySendResult gen_status;
if (f->f_gen && (co->co_flags & CO_COROUTINE)) {
_PyAwaitable_SetAwaiter(receiver, f->f_gen);
Ci_PyAwaitable_SetAwaiter(receiver, f->f_gen);
}
if (tstate->c_tracefunc == NULL) {
gen_status = PyIter_Send(receiver, v, &retval);
Expand Down

0 comments on commit 7b5bcda

Please sign in to comment.