We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f8f4e63 commit 57a37f2Copy full SHA for 57a37f2
Lib/doctest.py
@@ -239,22 +239,7 @@ def _normalize_module(module, depth=2):
239
def _load_testfile(filename, package, module_relative, encoding):
240
if module_relative:
241
package = _normalize_module(package, 3)
242
- try:
243
- loader = package.__loader__
244
- except AttributeError:
245
- pass
246
- else:
247
- if loader is not None:
248
- return (
249
- importlib.resources.read_text(package, filename, encoding=encoding),
250
- filename,
251
- )
252
-
253
254
- package.__spec__.loader
255
256
257
+ with contextlib.suppress(Exception):
258
return (
259
importlib.resources.read_text(package, filename, encoding=encoding),
260
filename,
0 commit comments