Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-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
MemberAuthor

serhiy-storchaka commented Sep 24, 2024

Failed tests show that we may reconsider this deprecation.

Copy link
Member

@vstinnervstinner 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)
returnloader

assertspec_loaderisnotNone
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
MemberAuthor

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.

@serhiy-storchakaserhiy-storchaka merged commit 8deaa93 into python:mainNov 14, 2025
46 checks passed
@serhiy-storchakaserhiy-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 freeto 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

@serhiy-storchaka@vstinner