Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-122255: Synchronize warnings in C and Python implementations of the warnings module#122824

Merged
serhiy-storchaka merged 6 commits into
python:mainpython/cpython:mainfrom
serhiy-storchaka:spec-loader-warningsserhiy-storchaka/cpython:spec-loader-warningsCopy head branch name to clipboard
Nov 14, 2025
Merged

gh-122255: Synchronize warnings in C and Python implementations of the warnings module#122824
serhiy-storchaka merged 6 commits into
python:mainpython/cpython:mainfrom
serhiy-storchaka:spec-loader-warningsserhiy-storchaka/cpython:spec-loader-warningsCopy head branch name to clipboard

Conversation

@serhiy-storchaka

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

Copy link
Copy Markdown
Member

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).
Comment thread Misc/NEWS.d/next/Library/2024-08-08-12-39-36.gh-issue-122255.J_gU8Y.rst Outdated
Comment thread Lib/linecache.py Outdated
@serhiy-storchaka

serhiy-storchaka commented Sep 24, 2024

Copy link
Copy Markdown
Member Author

Failed tests show that we may reconsider this deprecation.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Lib/linecache.py
DeprecationWarning)
return loader

assert spec_loader is not None

Copy link
Copy Markdown
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
Copy Markdown
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).
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jun 18, 2026
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.