diff --git a/asgiref/current_thread_executor.py b/asgiref/current_thread_executor.py index 67a7926f..70097dd1 100644 --- a/asgiref/current_thread_executor.py +++ b/asgiref/current_thread_executor.py @@ -104,12 +104,5 @@ def _submit( # Return the future return f - # Python 3.9+ has a new signature for submit with a "/" after `fn`, to enforce - # it to be a positional argument. If we ignore[override] mypy on 3.9+ will be - # happy but 3.8 will say that the ignore comment is unused, even when - # defining them differently based on sys.version_info. - # We should be able to remove this when we drop support for 3.8. - if not TYPE_CHECKING: - - def submit(self, fn, *args, **kwargs): - return self._submit(fn, *args, **kwargs) + def submit(self, fn, *args, **kwargs): + return self._submit(fn, *args, **kwargs) diff --git a/asgiref/local.py b/asgiref/local.py index 7d228aeb..8f7855df 100644 --- a/asgiref/local.py +++ b/asgiref/local.py @@ -14,12 +14,8 @@ def __init__(self) -> None: def __getattr__(self, key: str) -> Any: try: var = self._data[key] - except KeyError: - raise AttributeError(f"{self!r} object has no attribute {key!r}") - - try: return var.get() - except LookupError: + except (KeyError, LookupError): raise AttributeError(f"{self!r} object has no attribute {key!r}") def __setattr__(self, key: str, value: Any) -> None: