From 6e2ba04cc1e23b2953357cba047a5db0a3326b2b Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Wed, 7 Sep 2022 13:47:50 -0400 Subject: [PATCH] toasty/pyramid.py: avoid crash on macOS/Py3.7 Discovered in conda-forge build process. Apparently Queue.qsize() just doesn't work! --- toasty/pyramid.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/toasty/pyramid.py b/toasty/pyramid.py index 5366bc6..a512941 100644 --- a/toasty/pyramid.py +++ b/toasty/pyramid.py @@ -994,8 +994,15 @@ class Pyramid(object): total = riter.result()[1] if self.depth > 9: + # On macOS/Python 3.7, qsize() raises NotImplementedError "because + # of broken sem_getvalue()". + try: + ready_queue_size = ready_queue.qsize() + except NotImplementedError: + ready_queue_size = "(cannot be determined)" + print( - f"... {time.time() - t0:.1f}s elapsed; queue size {ready_queue.qsize()}; ready map size {len(readiness)}" + f"... {time.time() - t0:.1f}s elapsed; queue size {ready_queue_size}; ready map size {len(readiness)}" ) if total == 0: