Skip to content

Fix Py_UnbufferedStdioFlag deprecation warning#3265

Merged
rene-dev merged 1 commit intoLinuxCNC:masterfrom
BsAtHome:fix_python-warnings
Jan 21, 2025
Merged

Fix Py_UnbufferedStdioFlag deprecation warning#3265
rene-dev merged 1 commit intoLinuxCNC:masterfrom
BsAtHome:fix_python-warnings

Conversation

@BsAtHome
Copy link
Contributor

The use of Py_UnbufferedStdioFlag has been deprecated in python 3.12 (current debian:sid and other distros) and will be removed in 3.14. This PR fixes the warning (see also: #3203) and also fixes additional problems with the PyConfig code.

@rene-dev: The python documentation states that you need to use Py_InitializeFromConfig() when you change the PyConfig and you need to release the configuration with PyConfig_Clear() (see: https://docs.python.org/3.12/c-api/init_config.html#initialization-with-pyconfig).

Note: the merging #2487 to fix a previous deprecation warning introducing use of PyConfig caused all python versions lower than 3.8 to fail or anything older than Bullseye (see https://wiki.debian.org/Python). Therefore, no CPP conditional are placed around the code to support older distributions.

Fix python initialization using config.
Fix releasing python config after use.
@rene-dev rene-dev self-assigned this Jan 10, 2025
@BsAtHome
Copy link
Contributor Author

@rene-dev: What is the status of this PR?

@rene-dev rene-dev merged commit eabc4e4 into LinuxCNC:master Jan 21, 2025
10 checks passed
@BsAtHome
Copy link
Contributor Author

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants