Closed TecIntelli closed 1 year ago
Differentiating between None and _NOT_SET is intentional as None is a valid result of loading JSON. If your only concern is a warning in Scrapy it will disappear once it's fixed in Scrapy which is planned for the next release.
Unnecessary UserWarning message after change of default of karg
root
inclass Selector
from:def __init__( ... root: Optional[Any] = None, ... ) -> None:
to:
def __init__( ... root: Optional[Any] = _NOT_SET, ... ) -> None:
Current scapy version 2.6 called this Selector class as super class with karg
root=None
as default.This if statement raises the UserWarning message because it does not accept
None
like in the past.if root is not _NOT_SET: warnings.warn( "Selector got both text and root, root is being ignored.", stacklevel=2, )
I would suggest to change the condition like:if root not in [_NOT_SET, None]:
This issue cames up with the commit 3b3ec90.