Skip to content

Conversation

mtreinish
Copy link
Member

Summary

In Qiskit 2.1.0 we deprecated Python 3.9 support since it will not be supported in the 2.3.0 release. However, the warnings.warn call to emit the deprecation warning was missing the stacklevel argument. This means that the default Python warning filters will not display the warning to end users because it's not user code that's triggering the warn() call. This commit fixes this oversight so that Python 3.9 users will see the warning by default.

Details and comments

In Qiskit 2.1.0 we deprecated Python 3.9 support since it will not be
supported in the 2.3.0 release. However, the warnings.warn call to emit
the deprecation warning was missing the stacklevel argument. This means
that the default Python warning filters will not display the warning to
end users because it's not user code that's triggering the warn() call.
This commit fixes this oversight so that Python 3.9 users will see the
warning by default.
@mtreinish mtreinish requested a review from a team as a code owner June 21, 2025 01:34
@mtreinish mtreinish added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: Bugfix Include in the "Fixed" section of the changelog labels Jun 21, 2025
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@mtreinish mtreinish added this to the 2.1.1 milestone Jun 21, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 15790710847

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 15 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.004%) to 88.017%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 94.23%
crates/qasm2/src/lex.rs 2 91.73%
crates/qasm2/src/parse.rs 12 96.22%
Totals Coverage Status
Change from base Build 15756791277: -0.004%
Covered Lines: 84016
Relevant Lines: 95454

💛 - Coveralls

Copy link
Member

@eliarbel eliarbel left a comment

Choose a reason for hiding this comment

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

LGTM, good catch!

@eliarbel eliarbel added this pull request to the merge queue Jun 23, 2025
Merged via the queue into Qiskit:main with commit 2b0a682 Jun 23, 2025
28 checks passed
mergify bot pushed a commit that referenced this pull request Jun 23, 2025
In Qiskit 2.1.0 we deprecated Python 3.9 support since it will not be
supported in the 2.3.0 release. However, the warnings.warn call to emit
the deprecation warning was missing the stacklevel argument. This means
that the default Python warning filters will not display the warning to
end users because it's not user code that's triggering the warn() call.
This commit fixes this oversight so that Python 3.9 users will see the
warning by default.

(cherry picked from commit 2b0a682)
@mtreinish mtreinish deleted the add-stacklevel-py39 branch June 23, 2025 15:06
github-merge-queue bot pushed a commit that referenced this pull request Jul 1, 2025
In Qiskit 2.1.0 we deprecated Python 3.9 support since it will not be
supported in the 2.3.0 release. However, the warnings.warn call to emit
the deprecation warning was missing the stacklevel argument. This means
that the default Python warning filters will not display the warning to
end users because it's not user code that's triggering the warn() call.
This commit fixes this oversight so that Python 3.9 users will see the
warning by default.

(cherry picked from commit 2b0a682)

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants