-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added brackets to list comprehension, fixing this exception: #174
Conversation
Traceback (most recent call last): File "/Users/ricardopinto/a_project/env/lib/python3.6/site-packages/structlog/_frames.py", line 42, in <genexpr> while any(name.startswith(i) for i in ignores): SystemError: error return without exception set
Codecov Report
@@ Coverage Diff @@
## master #174 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 13 13
Lines 822 822
Branches 106 106
=====================================
Hits 822 822
Continue to review full report at Codecov.
|
I’d need to see a breaking test for the old code. IMHO the code itself should be fine: it’s generator which is more effective than a list comprehension but if it’s broken, we need a regression test to make sure the error doesn’t come back. Out of curiosity, is numpy involved? Googling that error brings up a bunch of it. |
I tried to pinpoint the code that triggers the issue, but to no avail. There's plenty of threads and processes in execution time, and it seemed to happen when we created a thread that enqueued a message on a periodic basis, it had nothing related to logging, numpy or anything complex. I even reduced all its code to a simple class PeriodicTrigger(Thread):
def __init__(self, queue: Queue, interval: float):
super(PeriodicTrigger, self).__init__()
self.queue: Queue = queue
self.interval: float = interval
self.should_stop: bool = False
def run(self):
while not self.should_stop:
now: float = time()
next_run_at = now + self.interval
sleep(next_run_at - now)
self.queue.put('a_message') As you can see, there's nothing particular about this thread. Numpy is indeed a requirement, but I couldn't see any direct relationship in the traces or code. |
Looks like we’re not the only ones with this problem: psf/requests#4567 It seems like there’s something weird going on with frames, C extensions and threads. The unholy trifecta. :) Would you mind changing |
Bump? 😇 |
I'm getting quite a lot of log noise due to exceptions in this generator, so fixing this would be very welcome. |
@techdragon would you mind to test whether the proposed solution with |
@hynek I tried |
That would be swell! |
@hynek done. Happy new year! |
thanks and sorry for the delays! |
Excellent, thanks! |
@ricardopinto Sorry for asking about old issue, but do you remember that you did use PyCharm? It seems there was a bug in PyCharm and python raised SystemErro during genexpr. |
Hi. Yes, I was using PyCharm when I got that error. |
Thank you. I am relieved to hear that. |
From what I saw,
ignores
was['structlog', 'logging']
, andname
wasstructlog._frames
.Python version is 3.6.5, structlog is 18.1.0.