Skip to content

Conversation

@kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Oct 16, 2024

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think this is the right idea. There are a few things to consider:

  • we still want to keep a statically allocated array for the main pending calls
  • we need to be cautious as we switch to an unbounded linked list, and make it easy to dial it back if needed
  • consider starting off with a "max" and making it unbounded in a separate PR
  • there isn't much reason to change the tests, consider leaving them alone

Comment on lines -34 to -36
/* We keep the number small to preserve as much compatibility
as possible with earlier versions. */
#define MAXPENDINGCALLS_MAIN 32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This point is still valid, so we should probably leave nearly all of the "main" pending calls stuff alone.

run at once, for the sake of prompt signal handling. This is
unlikely to cause any problems since there should be very few
pending calls for the main thread. */
#define MAXPENDINGCALLSLOOP_MAIN 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably leave this alone, but I'm not opposed to this change.

Comment on lines -48 to -51
/* The maximum allowed number of pending calls.
If the queue fills up to this point then _PyEval_AddPendingCall()
will return _Py_ADD_PENDING_FULL. */
int32_t max;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave this, for the sake of the "main" pending calls stuff.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be worth leaving it for a while, so we can more easily deal with unexpected consequences of switching to an unbounded linked list.

A value of 0 means there is no limit (other than the maximum
size of the list of pending calls). */
int32_t maxloop;
struct _pending_call calls[PENDINGCALLSARRAYSIZE];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave this statically allocated array for the sake of the "main" pending calls. We could go back to the old limit of MAXPENDINGCALLS_MAIN though.

Of course, we'd still use this for per-interpreter pending calls, since it's already there.

Comment on lines -100 to -101
// For example, we use a preallocated array
// for the list of pending calls.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This point is still valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants