diff options
author | Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> | 2023-06-13 05:41:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-13 05:41:34 (GMT) |
commit | 829ac13b69a2b53153e1b40670e6ef82f05130c1 (patch) | |
tree | 0b40bd89ed5760c6c22d21ef44f680d908d6b623 | |
parent | 8da9d1b16319f4a6bd78435016ef1f4bef6e2b41 (diff) | |
download | cpython-829ac13b69a2b53153e1b40670e6ef82f05130c1.zip cpython-829ac13b69a2b53153e1b40670e6ef82f05130c1.tar.gz cpython-829ac13b69a2b53153e1b40670e6ef82f05130c1.tar.bz2 |
GH-104787: use bitfields in `_asyncio` (#104788)
-rw-r--r-- | Modules/_asynciomodule.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 08ce172..4b84c1d 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -119,11 +119,14 @@ typedef enum { PyObject *prefix##_result; \ PyObject *prefix##_source_tb; \ PyObject *prefix##_cancel_msg; \ - fut_state prefix##_state; \ - int prefix##_log_tb; \ - int prefix##_blocking; \ PyObject *prefix##_weakreflist; \ - PyObject *prefix##_cancelled_exc; + PyObject *prefix##_cancelled_exc; \ + fut_state prefix##_state; \ + /* These bitfields need to be at the end of the struct + so that these and bitfields from TaskObj are contiguous. + */ \ + unsigned prefix##_log_tb: 1; \ + unsigned prefix##_blocking: 1; typedef struct { FutureObj_HEAD(fut) @@ -131,13 +134,13 @@ typedef struct { typedef struct { FutureObj_HEAD(task) + unsigned task_must_cancel: 1; + unsigned task_log_destroy_pending: 1; + int task_num_cancels_requested; PyObject *task_fut_waiter; PyObject *task_coro; PyObject *task_name; PyObject *task_context; - int task_must_cancel; - int task_log_destroy_pending; - int task_num_cancels_requested; } TaskObj; typedef struct { |