Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Aug 8, 2024

In the linecache module and in the Python implementation of the warnings module, a DeprecationWarning is issued when m.__loader__ differs from m.__spec__.loader (like in the C implementation of the warnings module).

… of the warnings module

In the linecache module and in the Python implementation of the
warnings module, a DeprecationWarning is issued when
m.__loader__ differs from m.__spec__.loader (like in the C
implementation of the warnings module).
@serhiy-storchaka
Copy link
Member Author

serhiy-storchaka commented Sep 24, 2024

Failed tests show that we may reconsider this deprecation.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I just left minor comments.

DeprecationWarning)
return loader

assert spec_loader is not None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion looks redundant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is such assertion in _bless_my_loader() in Lib/importlib/_bootstrap_external.py. This function is its copy with minimal necessary changes.

@brettcannon brettcannon removed their request for review September 19, 2025 10:49
@serhiy-storchaka serhiy-storchaka merged commit 8deaa93 into python:main Nov 14, 2025
46 checks passed
@serhiy-storchaka serhiy-storchaka deleted the spec-loader-warnings branch November 14, 2025 14:49
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
… of the warnings module (pythonGH-122824)

In the linecache module and in the Python implementation of the
warnings module, a DeprecationWarning is issued when
m.__loader__ differs from m.__spec__.loader (like in the C
implementation of the warnings module).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants