Skip to content

Commit 30f070e

Browse files
committed
Move warning definition above implicit behavior on import. Fixes #2846.
1 parent dfbbf11 commit 30f070e

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

changelog.d/2486.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Move PkgResourcesDeprecationWarning above implicitly-called function so that it's in the namespace when version warnings are generated in an environment that contains them.

pkg_resources/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3244,6 +3244,15 @@ def _initialize(g=globals()):
32443244
)
32453245

32463246

3247+
class PkgResourcesDeprecationWarning(Warning):
3248+
"""
3249+
Base class for warning about deprecations in ``pkg_resources``
3250+
3251+
This class is not derived from ``DeprecationWarning``, and as such is
3252+
visible by default.
3253+
"""
3254+
3255+
32473256
@_call_aside
32483257
def _initialize_master_working_set():
32493258
"""
@@ -3282,12 +3291,3 @@ def _initialize_master_working_set():
32823291
# match order
32833292
list(map(working_set.add_entry, sys.path))
32843293
globals().update(locals())
3285-
3286-
3287-
class PkgResourcesDeprecationWarning(Warning):
3288-
"""
3289-
Base class for warning about deprecations in ``pkg_resources``
3290-
3291-
This class is not derived from ``DeprecationWarning``, and as such is
3292-
visible by default.
3293-
"""

0 commit comments

Comments
 (0)