Skip to content

Commit 00bc513

Browse files
Pavel Minaevint19h
Pavel Minaev
authored andcommitted
Suppress DeprecationWarning from pydevd due to pkg_resources.declare_namespace (#1230)
1 parent bc44eb8 commit 00bc513

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/debugpy/_vendored/force_pydevd.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,28 @@
2828

2929
# Constants must be set before importing any other pydevd module
3030
# # due to heavy use of "from" in them.
31-
with vendored('pydevd'):
32-
pydevd_constants = import_module('_pydevd_bundle.pydevd_constants')
31+
with warnings.catch_warnings():
32+
warnings.simplefilter("ignore", category=DeprecationWarning)
33+
with vendored('pydevd'):
34+
pydevd_constants = import_module('_pydevd_bundle.pydevd_constants')
3335
# We limit representation size in our representation provider when needed.
3436
pydevd_constants.MAXIMUM_VARIABLE_REPRESENTATION_SIZE = 2 ** 32
3537

3638
# Now make sure all the top-level modules and packages in pydevd are
3739
# loaded. Any pydevd modules that aren't loaded at this point, will
3840
# be loaded using their parent package's __path__ (i.e. one of the
3941
# following).
40-
preimport('pydevd', [
41-
'_pydev_bundle',
42-
'_pydev_runfiles',
43-
'_pydevd_bundle',
44-
'_pydevd_frame_eval',
45-
'pydev_ipython',
46-
'pydevd_plugins',
47-
'pydevd',
48-
])
42+
with warnings.catch_warnings():
43+
warnings.simplefilter("ignore", category=DeprecationWarning)
44+
preimport('pydevd', [
45+
'_pydev_bundle',
46+
'_pydev_runfiles',
47+
'_pydevd_bundle',
48+
'_pydevd_frame_eval',
49+
'pydev_ipython',
50+
'pydevd_plugins',
51+
'pydevd',
52+
])
4953

5054
# When pydevd is imported it sets the breakpoint behavior, but it needs to be
5155
# overridden because by default pydevd will connect to the remote debugger using

0 commit comments

Comments
 (0)