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

Support Python 3.12 #1147

Closed
EwoutH opened this issue Sep 26, 2023 · 7 comments
Closed

Support Python 3.12 #1147

EwoutH opened this issue Sep 26, 2023 · 7 comments

Comments

@EwoutH
Copy link

EwoutH commented Sep 26, 2023

Python 3.12 is releasing in exactly one week, Monday 2023-10-02. It would be great if JPype could support Python 3.12 fully at the release, including testing in CI and wheels uploaded to PyPI.

Summary – Python 3.12 Release highlights

New grammar features:

Interpreter improvements:

New typing features:

Important deprecations, removals or restrictions:

  • PEP 623: Remove wstr from Unicode
  • PEP 632: Remove the distutils package. See the migration guide for advice on its replacement.
  • gh-95299: Do not pre-install setuptools in virtual environments created with venv. This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the activated virtual environment.
@Christopher-Chianelli
Copy link
Contributor

From the logs, it seems the issue is the change of location of ob_digit

  native/common/jp_primitivetype.cpp: In member function 'PyObject* JPPrimitiveType::convertLong(PyTypeObject*, PyLongObject*)':
  native/common/jp_primitivetype.cpp:50:25: error: 'PyLongObject' {aka 'struct _longobject'} has no member named 'ob_digit'
     50 |                 newobj->ob_digit[i] = tmp->ob_digit[i];
        |                         ^~~~~~~~
  native/common/jp_primitivetype.cpp:50:44: error: 'PyLongObject' {aka 'struct _longobject'} has no member named 'ob_digit'
     50 |                 newobj->ob_digit[i] = tmp->ob_digit[i];

According to cython/cython#5238 (comment) ; changing it to ((PyLongObject*)op1)->long_value->ob_digit should work.

@Christopher-Chianelli
Copy link
Contributor

It more complicated than this, since wstr is now removed: https://www.python.org/dev/peps/pep-0623

@Thrameos
Copy link
Contributor

Thrameos commented Dec 4, 2023

I was able to fix both the wstr and ob_digit error, but they also broke the jp_value memory hack which adds extra memory to all types of us to store the extra bytes needs for the wrapper. As a result we are getting random segmentation faults when the memory between the two collides. (the absolute worst kind of error to fix.) They promised a replacement that should be in 3.12 though I am still searching.

@marscher
Copy link
Member

marscher commented Dec 9, 2023

fixed by #1158

@marscher marscher closed this as completed Dec 9, 2023
@EwoutH
Copy link
Author

EwoutH commented Dec 9, 2023

Awesome, thanks a lot!

When can we expect a release and wheels on n PyPI?

@Thrameos
Copy link
Contributor

Starting the process after fixing all merge requests.

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

No branches or pull requests

4 participants