Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of deprecated ast.Num for Python 3.12 #10886

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

jakelishman
Copy link
Member

Summary

Since Python 3.8 (our minimum supported version), this has been silently deprecated in favour of the catch-all ast.Constant (which Num subclasses). In Python 3.12, this deprecation is elevated to a warning, which will cause a failure in our test suite when it releases.

Details and comments

This alone doesn't get us all the way to full logical Python 3.12 support. #10305 is still an issue, and becomes a larger problem because Numpy 1.24 doesn't have Python 3.12 wheels. There are currently some problems with python-subunit, testtools and stestr with Python 3.12 that will need addressing upstream before we can run our test suite (I had to use a Python 3.10 host to run stestr with the parallel runners using Python 3.12rc3 to run the tests). I'm not clear what the stestr problem was, but testtools suffers from the removal of distutils and python-subunit from use of the deprecated datetime.datetime.utcnow.

Symengine of course does not have Python 3.12 wheels yet, and I haven't bothered trying to build one locally myself.

Since Python 3.8 (our minimum supported version), this has been silently
deprecated in favour of the catch-all `ast.Constant` (which `Num`
subclasses).  In Python 3.12, this deprecation is elevated to a warning,
which will cause a failure in our test suite when it releases.
@jakelishman jakelishman added type: qa Issues and PRs that relate to testing and code quality Changelog: None Do not include in changelog labels Sep 22, 2023
@jakelishman jakelishman requested review from eggerdj, wshanks and a team as code owners September 22, 2023 12:21
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core
  • @nkanazawa1989

@jakelishman jakelishman added this to the 0.45.0 milestone Sep 22, 2023
Copy link
Contributor

@wshanks wshanks left a comment

Choose a reason for hiding this comment

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

This is in keeping with the guidance in the 3.12 release notes. It seems like a bit of a loss of functionality not being able to distinguish strings from numbers but I guess it effectively happened long ago.

@jakelishman jakelishman added this pull request to the merge queue Sep 27, 2023
Merged via the queue into Qiskit:main with commit 326d651 Sep 27, 2023
@jakelishman jakelishman deleted the fix-py312-deprecations branch September 28, 2023 08:15
rupeshknn pushed a commit to rupeshknn/qiskit that referenced this pull request Oct 9, 2023
Since Python 3.8 (our minimum supported version), this has been silently
deprecated in favour of the catch-all `ast.Constant` (which `Num`
subclasses).  In Python 3.12, this deprecation is elevated to a warning,
which will cause a failure in our test suite when it releases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog type: qa Issues and PRs that relate to testing and code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants