Merge branch '2.13'

This commit is contained in:
Andrey Rakhmatullin 2025-06-09 15:54:35 +05:00
commit 0390176ecd
6 changed files with 72 additions and 4 deletions

View File

@ -15,6 +15,54 @@ Backward-incompatible changes
``True`` when running Scrapy via :ref:`its command-line tool
<topics-commands-crawlerprocess>` to avoid a reactor mismatch exception.
.. _release-2.13.2:
Scrapy 2.13.2 (2025-06-09)
--------------------------
- Fixed a bug introduced in Scrapy 2.13.0 that caused results of request
errbacks to be ignored when the errback was called because of a downloader
error.
(:issue:`6861`, :issue:`6863`)
- Added a note about the behavior change of
:func:`scrapy.utils.reactor.is_asyncio_reactor_installed` to its docs and
to the "Backward-incompatible changes" section of :ref:`the Scrapy 2.13.0
release notes <release-2.13.0>`.
(:issue:`6866`)
- Improved the message in the exception raised by
:func:`scrapy.utils.test.get_reactor_settings` when there is no reactor
installed.
(:issue:`6866`)
- Updated the :class:`scrapy.crawler.CrawlerRunner` examples in
:ref:`topics-practices` to install the reactor explicitly, to fix
reactor-related errors with Scrapy 2.13.0 and later.
(:issue:`6865`)
- Fixed ``scrapy fetch`` not working with scrapy-poet_.
(:issue:`6872`)
- Fixed an exception produced by :class:`scrapy.core.engine.ExecutionEngine`
when it's closed before being fully initialized.
(:issue:`6857`, :issue:`6867`)
- Improved the README, updated the Scrapy logo in it.
(:issue:`6831`, :issue:`6833`, :issue:`6839`)
- Restricted the Twisted version used in tests to below 25.5.0, as some tests
fail with 25.5.0.
(:issue:`6878`, :issue:`6882`)
- Updated type hints for Twisted 25.5.0 changes.
(:issue:`6882`)
- Removed the old artwork.
(:issue:`6874`)
.. _release-2.13.1:
Scrapy 2.13.1 (2025-05-28)
@ -138,6 +186,15 @@ Backward-incompatible changes
also enforced for start requests.
(:issue:`6777`)
- Calling :func:`scrapy.utils.reactor.is_asyncio_reactor_installed` without
an installed reactor now raises an exception instead of installing a
reactor. This shouldn't affect normal Scrapy use cases, but it may affect
3rd-party test suites that use Scrapy internals such as
:class:`~scrapy.crawler.Crawler` and don't install a reactor explicitly. If
you are affected by this change, you most likely need to install the
reactor before running Scrapy code that expects it to be installed.
(:issue:`6732`, :issue:`6735`)
- The ``from_settings()`` method of
:class:`~scrapy.spidermiddlewares.urllength.UrlLengthMiddleware`,
deprecated in Scrapy 2.12.0, is removed earlier than the usual deprecation

View File

@ -115,7 +115,7 @@ module = "twisted"
implicit_reexport = true
[tool.bumpversion]
current_version = "2.13.1"
current_version = "2.13.2"
commit = true
tag = true
tag_name = "{new_version}"

View File

@ -1 +1 @@
2.13.1
2.13.2

View File

@ -1,6 +1,7 @@
from __future__ import annotations
import sys
from argparse import Namespace # noqa: TC003
from typing import TYPE_CHECKING
from w3lib.url import is_url
@ -12,7 +13,7 @@ from scrapy.utils.datatypes import SequenceExclude
from scrapy.utils.spider import DefaultSpider, spidercls_for_request
if TYPE_CHECKING:
from argparse import ArgumentParser, Namespace
from argparse import ArgumentParser
from scrapy import Spider

View File

@ -226,6 +226,11 @@ def is_asyncio_reactor_installed() -> bool:
asyncio features, so the code that that doesn't directly require a Twisted
reactor should use :func:`scrapy.utils.asyncio.is_asyncio_available`
instead of this function.
.. versionchanged:: 2.13
In earlier Scrapy versions this function silently installed the default
reactor if there was no reactor installed. Now it raises an exception to
prevent silent problems in this case.
"""
if not is_reactor_installed():
raise RuntimeError(

View File

@ -18,7 +18,7 @@ from twisted.trial.unittest import SkipTest
from scrapy.exceptions import ScrapyDeprecationWarning
from scrapy.utils.boto import is_botocore_available
from scrapy.utils.deprecate import create_deprecated_class
from scrapy.utils.reactor import is_asyncio_reactor_installed
from scrapy.utils.reactor import is_asyncio_reactor_installed, is_reactor_installed
from scrapy.utils.spider import DefaultSpider
if TYPE_CHECKING:
@ -117,6 +117,11 @@ def get_reactor_settings() -> dict[str, Any]:
settings, so tests that run the crawler in the current process may need to
pass a correct ``"TWISTED_REACTOR"`` setting value when creating it.
"""
if not is_reactor_installed():
raise RuntimeError(
"get_reactor_settings() called without an installed reactor,"
" you may need to install a reactor explicitly when running your tests."
)
settings: dict[str, Any] = {}
if not is_asyncio_reactor_installed():
settings["TWISTED_REACTOR"] = None