Skip to content

Support Python 3.10 #69

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

Closed
polkovnikov opened this issue Feb 14, 2021 · 4 comments
Closed

Support Python 3.10 #69

polkovnikov opened this issue Feb 14, 2021 · 4 comments

Comments

@polkovnikov
Copy link
Contributor

polkovnikov commented Feb 14, 2021

Although Python 3.10 is still in testing version 3.10.0a5, would be great to incorporate it early into your system!

Mainly because of long-awaited new feature which can be enabled by #define EXPERIMENTAL_ISOLATED_SUBINTERPRETERS 1. This feature allows to use fully isolated interpreters within one process. It means no more global GIL! Each interpreter now has local GIL. Hence now Python can be multi-core, thus boosting multi-threaded scripts many times (as many cores there are)!

Different interpreters are isolated and they can't (probably) share objects between each other except for passing serialized (pickled) form of objects between each other. Still each C/C++ thread can run a separate interpreter for parallel algorithms that need not too much of data interaction between threads. Basically this feature allows achieving same thing as with multiprocessing module but within one process instead of many processes.

This feature was developed for several years and now it became alive. It needed to hand-modify around 1500 global static variables to make them thread-local scope.

Would be great to become first early alpha testers of this feature. I used Python C API in my C++ code a lot and thrilled of using now all the CPU cores within one process.

If you think that for some reason non-release version of Python 3.10 is not allowed for your system (although you can make some switch like --python experimental-cpython-3.10) then you can leave this feature request (issue) open till 3.10 becomes a release, and probably it will become not far in the future. But if you decide to support it then don't forget to enable #define mentioned above.

indygreg added a commit that referenced this issue Feb 21, 2021
I didn't spend much mental effort on this. There are likely bugs.

Only Linux is supported for now. The extensions files were copied
from 3.9 without changes. I did not audit upstream for changes that may
need reflected in these files.

In pursuit of #69.
@polkovnikov
Copy link
Contributor Author

polkovnikov commented Feb 21, 2021

@indygreg Thanks for quick response and commit! I'll start from Unix.

Can't wait to have 3.10 on Windows too, because Windows is my main PC OS and main initial development/testing platform. Of cause do this in your own pace later.

I expect that adopting for Windows is much harder than Unix, so Unix testing is alright in the beginning.

As said about isolated sub-interpreters in my initial post, can you also please suggest me how and where I modify current Unix 3.10 build so that to enable #define EXPERIMENTAL_ISOLATED_SUBINTERPRETERS 1, by default it is not enabled, it is enabled either by doing this define when compiling or by passing --with-experimental-isolated-subinterpreters to ./configure script. Can I do right now this define somewhere or pass this option to ./configure anyhow?

@indygreg
Copy link
Collaborator

main now has full support for CPython 3.10 (currently 3.10.0rc2) on all supported platforms. We should be ready to ship 3.10.0 when it is released.

As for --with-experimental-isolated-subinterpreters, this is not something we can enable by default as it changes too many behaviors of how Python is built. But I'm receptive to adding a build configuration for it. If you would still like this feature, please file a new issue to track it.

@polkovnikov
Copy link
Contributor Author

@indygreg Yes, exactly, I wanted isolated subinterpreters to be just some configurable option of your build srcipt that is not enabled by default.

Also, I'm not sure, but maybe final release of Python 3.10 will enable this feature by default in their binary releases on python.org.

@polkovnikov
Copy link
Contributor Author

@indygreg Hooray! A day ago first version of Python 3.10.0 was officially released, here!

So you can now officially use this release in your builds. Also don't forget to see my other feature request about supporting isolated sub-interpreters in Python 3.10 build.

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

2 participants