summaryrefslogtreecommitdiff
path: root/bs4/__init__.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2023-01-27 12:45:14 -0500
committerLeonard Richardson <leonardr@segfault.org>2023-01-27 12:45:14 -0500
commit98756d3c97f553f7abf22e3e16a357dac60f0b02 (patch)
treea30d5bdc90e4639053b037cd1b6a8e8d81deb63e /bs4/__init__.py
parent12ad184120ad7ddebe63462daf3c6f1a64fb4338 (diff)
Warnings now do their best to provide an appropriate stacklevel,
improving the usefulness of the message. [bug=1978744]
Diffstat (limited to 'bs4/__init__.py')
-rw-r--r--bs4/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bs4/__init__.py b/bs4/__init__.py
index b3c9feb..887ed19 100644
--- a/bs4/__init__.py
+++ b/bs4/__init__.py
@@ -405,7 +405,8 @@ class BeautifulSoup(Tag):
'The input looks more like a URL than markup. You may want to use'
' an HTTP client like requests to get the document behind'
' the URL, and feed that document to Beautiful Soup.',
- MarkupResemblesLocatorWarning
+ MarkupResemblesLocatorWarning,
+ stacklevel=3
)
return True
return False
@@ -436,7 +437,7 @@ class BeautifulSoup(Tag):
'The input looks more like a filename than markup. You may'
' want to open this file and pass the filehandle into'
' Beautiful Soup.',
- MarkupResemblesLocatorWarning
+ MarkupResemblesLocatorWarning, stacklevel=3
)
return True
return False
@@ -789,7 +790,7 @@ class BeautifulStoneSoup(BeautifulSoup):
warnings.warn(
'The BeautifulStoneSoup class is deprecated. Instead of using '
'it, pass features="xml" into the BeautifulSoup constructor.',
- DeprecationWarning
+ DeprecationWarning, stacklevel=2
)
super(BeautifulStoneSoup, self).__init__(*args, **kwargs)