Skip to content

Python 3.13 not support #941

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
evertvorster opened this issue Dec 27, 2024 · 8 comments · Fixed by #974
Closed

Python 3.13 not support #941

evertvorster opened this issue Dec 27, 2024 · 8 comments · Fixed by #974
Labels
bug Compiler Error Breaks build on at least one supported platform
Milestone

Comments

@evertvorster
Copy link
Contributor

Hi there!

Something got updated on my system, and I am unable to build master, as well as branches that I have been able to build before.

In all cases, the error message is this:

[ 10%] Building CXX object CMakeFiles/vegastrike_python.dir/src/python/config/python_utils.cpp.o
/mnt/int/system/aur/vegastrike-engine-git/src/Vega-Strike-Engine-Source/engine/src/python/config/python_utils.cpp: In function ‘const std::string GetPythonPath()’:
/mnt/int/system/aur/vegastrike-engine-git/src/Vega-Strike-Engine-Source/engine/src/python/config/python_utils.cpp:44:37: warning: ‘wchar_t* Py_GetPath()’ is deprecated [-Wdeprecated-declarations]
   44 |     wchar_t* w_path_ptr = Py_GetPath();
      |                           ~~~~~~~~~~^~
In file included from /usr/include/python3.13/Python.h:123,
                 from /usr/include/boost/python/detail/wrap_python.hpp:178,
                 from /usr/include/boost/python/detail/prefix.hpp:13,
                 from /usr/include/boost/python/args.hpp:8,
                 from /usr/include/boost/python.hpp:11,
                 from /mnt/int/system/aur/vegastrike-engine-git/src/Vega-Strike-Engine-Source/engine/src/python/config/python_utils.cpp:31:
/usr/include/python3.13/pylifecycle.h:46:43: note: declared here
   46 | Py_DEPRECATED(3.13) PyAPI_FUNC(wchar_t *) Py_GetPath(void);
      |                                           ^~~~~~~~~~
/mnt/int/system/aur/vegastrike-engine-git/src/Vega-Strike-Engine-Source/engine/src/python/config/python_utils.cpp: In function ‘PyObject* GetClassFromPython(std::string, std::string, std::string, std::string)’:
/mnt/int/system/aur/vegastrike-engine-git/src/Vega-Strike-Engine-Source/engine/src/python/config/python_utils.cpp:76:5: error: ‘Py_SetPath’ was not declared in this scope; did you mean ‘Py_GetPath’?
   76 |     Py_SetPath(python_path);
      |     ^~~~~~~~~~
      |     Py_GetPath
make[2]: *** [CMakeFiles/vegastrike_python.dir/build.make:79: CMakeFiles/vegastrike_python.dir/src/python/config/python_utils.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:224: CMakeFiles/vegastrike_python.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Normally I have makeflags -j32, so this failure got jumbled among all the other jobs that are running, but for this build single jobs were specified.

@evertvorster
Copy link
Contributor Author

With a little Googling, it seems related to this commit:

python/cpython#105145

@BenjamenMeyer
Copy link
Member

Looks like Py3.13 is broken for us.

@BenjamenMeyer BenjamenMeyer changed the title Unable to build master Python 3.13 not support Dec 27, 2024
@evertvorster
Copy link
Contributor Author

Hi there...
I could change the way that vegastrike builds on Arch linux, and link to an older version of python, probably. However, this is an issue that needs fixing sooner or later, as other distributions of Linux will be following suit and also updating their version of Python to 3.13.

Keeping this in mind, is there any point in making a special package that uses an older python?

I guess it boils down to how long and involved this issue is to fix. I'm not a good enough coder to know, does anyone else have an idea?

@BenjamenMeyer
Copy link
Member

BenjamenMeyer commented Dec 27, 2024

@evertvorster agreed; though it may be a week or so before we get to it. You might be able to temporarily.

It shouldn't be a huge fix - just changing an API. It's just a matter of getting through several changes before we can probably get to it or get a PR merged. It may also be necessary to review the other APIs caught up in that deprecation too.

@stephengtuggy
Copy link
Contributor

stephengtuggy commented Dec 31, 2024

Okay, so I just looked at the code. This bug appears to be fairly limited in scope, with no more than 4 or 5 lines of code calling any of the deprecated or removed Python APIs from that deprecation. All of these lines of code were introduced in two of your commits, @royfalk , one from 2024-10-02 and the other from 2024-11-01. Filenames:

  1. init.cpp
  2. python_tests.cpp
  3. python_utils.cpp
  4. python_utils.h

The calls in question are Py_GetPath and Py_SetPath. No other deprecated APIs are involved here.

It looks like these two APIs can be replaced using https://docs.python.org/dev/c-api/init_config.html#init-isolated-conf and/or https://docs.python.org/dev/c-api/init_config.html#python-path-configuration

@stephengtuggy stephengtuggy added bug Compiler Error Breaks build on at least one supported platform labels Dec 31, 2024
@stephengtuggy
Copy link
Contributor

Please note, also, that this problem does not exist on the 0.9.x branch, since the Py_GetPath and Py_SetPath calls hadn't been introduced yet.

@evertvorster
Copy link
Contributor Author

Not sure what changed, but git master compiles again.
There are a LOT of warnings, but it does compile.

@stephengtuggy
Copy link
Contributor

Sweet! Yeah, I thought I had fixed it, sometime in the last week I believe. That's good to get confirmation that it is fixed.

@stephengtuggy stephengtuggy moved this to Done in 0.10.x Release Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Compiler Error Breaks build on at least one supported platform
Projects
Status: Done
3 participants