Skip to content

[3.13] gh-121279: Re-add prematurely removed import warnings to importlib.abc #121281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lib/importlib/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
_frozen_importlib_external = _bootstrap_external
from ._abc import Loader
import abc
import warnings

from .resources import abc as _resources_abc

Expand Down
22 changes: 22 additions & 0 deletions Lib/test/test_importlib/test_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,5 +913,27 @@ def test_universal_newlines(self):
SourceOnlyLoaderMock=SPLIT_SOL)


class DeprecatedAttrsTests:

"""Test the deprecated attributes can be accessed."""

def test_deprecated_attr_ResourceReader(self):
with self.assertWarns(DeprecationWarning):
self.abc.ResourceReader

def test_deprecated_attr_Traversable(self):
with self.assertWarns(DeprecationWarning):
self.abc.Traversable

def test_deprecated_attr_TraversableResources(self):
with self.assertWarns(DeprecationWarning):
self.abc.TraversableResources


(Frozen_DeprecatedAttrsTests,
Source_DeprecatedAttrsTests
) = test_util.test_both(DeprecatedAttrsTests, abc=abc)


if __name__ == '__main__':
unittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Avoid :exc:`NameError` for the :mod:`warnings` module when accessing the
depracated atributes of the :mod:`importlib.abc` module.
Loading