From c71761402e8e41f0423618564ec6ccd3a025430b Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 25 Apr 2024 17:27:28 -0600 Subject: [PATCH] Bump up the max for per-interpreter pending calls. --- Include/internal/pycore_ceval_state.h | 6 ++++-- Lib/test/test_capi/test_misc.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Include/internal/pycore_ceval_state.h b/Include/internal/pycore_ceval_state.h index 1831f58899b745..11f2a100bf531e 100644 --- a/Include/internal/pycore_ceval_state.h +++ b/Include/internal/pycore_ceval_state.h @@ -20,7 +20,7 @@ struct _pending_call { int flags; }; -#define PENDINGCALLSARRAYSIZE 32 +#define PENDINGCALLSARRAYSIZE 300 #define MAXPENDINGCALLS PENDINGCALLSARRAYSIZE /* For interpreter-level pending calls, we want to avoid spending too @@ -31,7 +31,9 @@ struct _pending_call { # define MAXPENDINGCALLSLOOP MAXPENDINGCALLS #endif -#define MAXPENDINGCALLS_MAIN PENDINGCALLSARRAYSIZE +/* We keep the number small to preserve as much compatibility + as possible with earlier versions. */ +#define MAXPENDINGCALLS_MAIN 32 /* For the main thread, we want to make sure all pending calls are run at once, for the sake of prompt signal handling. This is unlikely to cause any problems since there should be very few diff --git a/Lib/test/test_capi/test_misc.py b/Lib/test/test_capi/test_misc.py index 49d1056f050467..020e8493e57c0c 100644 --- a/Lib/test/test_capi/test_misc.py +++ b/Lib/test/test_capi/test_misc.py @@ -1570,9 +1570,9 @@ def test_max_pending(self): self.assertEqual(added, maxpending) with self.subTest('not main-only'): - # Per-interpreter pending calls has the same low limit + # Per-interpreter pending calls has a much higher limit # on how many may be pending at a time. - maxpending = 32 + maxpending = 300 l = [] added = self.pendingcalls_submit(l, 1, main=False)