opbeat_python icon indicating copy to clipboard operation
opbeat_python copied to clipboard

async_mode strange code

Open willmcgugan opened this issue 9 years ago • 1 comments

I've been browsing the Client code and I came across a line in base.py that stands out.

        self.async_mode = (async_mode is True
                           or (defaults.ASYNC_MODE and async_mode is not False))

I'm guessing this is the intended effect?

    self.async_mode = defaults.ASYNC_MODE if async_mode is None else async_mode

willmcgugan avatar Oct 20 '16 14:10 willmcgugan

@willmcgugan thanks for the headsup, this does indeed look a bit strange. We tried to remember why we wrote it this way, and came to the conclusion that it has to do with the deprecation logic of the async argument. async will become a keyword in Python 3.6, so we introduced a deprecation path a while ago (using async_mode instead of async). We will remove async completely in the next major release, and simplify that line of code as you suggested.

beniwohli avatar Oct 25 '16 14:10 beniwohli