$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Tom Kacvinsky (tkacvins_at_[hidden])
Date: 2025-04-06 12:05:14
On Sun, Mar 16, 2025 at 9:48â¯PM Tom Kacvinsky <tkacvins_at_[hidden]> wrote:
> While working on a project to upgrade an embedded Python interpreter (to
> Python 3.12), which uses boost::python, I noticed the structs from the
> Python
> C API now have more members and those extra struct members were not
> populated in the boost::python code. In particular I was bit by the enum
> module
> crashing our application startup.
>
> I noticed this with boost 1.78, but I found the same problematic code in
> the
> release that was current as of two months ago (1.87.0, I think).
>
> I got things to compile and run, but my approach was to just make the code
> Python 3.12 compliant. I can prepare a patch that has the appropriate
> macro
>
guards for populating the structs as they relate to different Python
> versions.
>
> I'll read the boost developers guide and follow the necessary steps to
> submit
> a fix.
>
I discovered PYTHON_API_VERSION is not a good test for populating the
PyTypeObject as that version is the same for Python 3.0 and higher. So I'm
thinking that PY_VERSION_HEX might be the appropriate macro guard for
the changes in the PyTypeObject struct. Thoughts?
Thanks,
Tom