[PATCH v3] Handle Python 3.11 deprecation of PySys_SetPath and Py_SetProgramName
Simon Marchi
simark@simark.ca
Mon Jul 18 15:49:48 GMT 2022
> @@ -1849,6 +1855,24 @@ show_python_dont_write_bytecode (struct ui_file *file, int from_tty,
> value);
> }
>
> +/* Return value to assign to PyConfig.write_bytecode or, when
> + negated (via !), Py_DontWriteBytecodeFlag. Py_DontWriteBytecodeFlag
> + is deprecated in Python 3.12. */
> +
> +static int
> +python_write_bytecode ()
> +{
> + int wbc = 0;
> +
> + if (python_dont_write_bytecode == AUTO_BOOLEAN_AUTO)
> + wbc = (!python_ignore_environment
> + && getenv ("PYTHONDONTWRITEBYTECODE") != nullptr) ? 0 : 1;
I think it predates your patch (so, orthogonal), but the Python doc says:
If this is set to a non-empty string, Python won’t try to write .pyc
files on the import of source modules.
So I think we would need a "non-empty string" check here?
Simon
More information about the Gdb-patches
mailing list