Skip to content

Commit 169b46d

Browse files
committed
Fixed the asserts in PyAwaitable_AddAwait, PyAwaitable_DeferAwait, and PyAwaitable_SetResult.
This is because Py_IS_TYPE already checks Py_TYPE for us causing the assertion to fail. Signed-off-by: AraHaan <seandhunt_7@yahoo.com>
1 parent 34dcee2 commit 169b46d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/_pyawaitable/awaitable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ PyAwaitable_AddAwait(
160160
)
161161
{
162162
PyAwaitableObject *aw = (PyAwaitableObject *) self;
163-
assert(Py_IS_TYPE(Py_TYPE(self), PyAwaitable_GetType()));
163+
assert(Py_IS_TYPE(self, PyAwaitable_GetType()));
164164
if (coro == NULL) {
165165
PyErr_SetString(
166166
PyExc_ValueError,
@@ -231,7 +231,7 @@ _PyAwaitable_API(int)
231231
PyAwaitable_DeferAwait(PyObject * awaitable, PyAwaitable_Defer cb)
232232
{
233233
PyAwaitableObject *aw = (PyAwaitableObject *) awaitable;
234-
assert(Py_IS_TYPE(Py_TYPE(awaitable), PyAwaitable_GetType()));
234+
assert(Py_IS_TYPE(awaitable, PyAwaitable_GetType()));
235235
pyawaitable_callback *aw_c = PyMem_Malloc(sizeof(pyawaitable_callback));
236236
if (aw_c == NULL) {
237237
PyErr_NoMemory();
@@ -256,7 +256,7 @@ _PyAwaitable_API(int)
256256
PyAwaitable_SetResult(PyObject * awaitable, PyObject * result)
257257
{
258258
PyAwaitableObject *aw = (PyAwaitableObject *) awaitable;
259-
assert(Py_IS_TYPE(Py_TYPE(awaitable), PyAwaitable_GetType()));
259+
assert(Py_IS_TYPE(awaitable, PyAwaitable_GetType()));
260260
aw->aw_result = Py_NewRef(result);
261261
return 0;
262262
}

0 commit comments

Comments
 (0)