Skip to content

Commit

Permalink
GH-104787: use bitfields in _asyncio (#104788)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 authored Jun 13, 2023
1 parent 8da9d1b commit 829ac13
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,28 @@ 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)
} FutureObj;

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 {
Expand Down

0 comments on commit 829ac13

Please sign in to comment.