Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Fix compatibility with Python 3.8.

Andrey Rakhmatullin0ec79e316619
diff --git a/scrapy/utils/deprecate.py b/scrapy/utils/deprecate.py
index ab2719bb3..ea577c44a 100644
--- a/scrapy/utils/deprecate.py
+++ b/scrapy/utils/deprecate.py
@@ -2,7 +2,7 @@
import inspect
import warnings
-from typing import Any, List, Optional, Tuple, Type, overload
+from typing import Any, Dict, List, Optional, Tuple, Type, overload
from scrapy.exceptions import ScrapyDeprecationWarning
@@ -20,7 +20,7 @@ def attribute(obj: Any, oldattr: str, newattr: str, version: str = "0.12") -> No
def create_deprecated_class(
name: str,
new_class: type,
- clsdict: Optional[dict[str, Any]] = None,
+ clsdict: Optional[Dict[str, Any]] = None,
warn_category: Type[Warning] = ScrapyDeprecationWarning,
warn_once: bool = True,
old_class_path: Optional[str] = None,
@@ -59,14 +59,14 @@ def create_deprecated_class(
warned_on_subclass: bool = False
def __new__(
- metacls, name: str, bases: Tuple[type, ...], clsdict_: dict[str, Any]
+ metacls, name: str, bases: Tuple[type, ...], clsdict_: Dict[str, Any]
) -> type:
cls = super().__new__(metacls, name, bases, clsdict_)
if metacls.deprecated_class is None:
metacls.deprecated_class = cls
return cls
- def __init__(cls, name: str, bases: Tuple[type, ...], clsdict_: dict[str, Any]):
+ def __init__(cls, name: str, bases: Tuple[type, ...], clsdict_: Dict[str, Any]):
meta = cls.__class__
old = meta.deprecated_class
if old in bases and not (warn_once and meta.warned_on_subclass):