Skip to content

Python 3.11 gives SystemError: type Boost.Python.enum has the Py_TPFLAGS_HAVE_GC flag but has no traverse function #400

Open

Description

@owillebo

Up to Python 3.10 our Boost Python binding ran fine.
As of Python 3.11 we get the following error upon import of the binding;

SystemError: type Boost.Python.enum has the Py_TPFLAGS_HAVE_GC flag but has no traverse function

Running;
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
boost_1_80_0
b2 -j%NUMBER_OF_PROCESSORS% python=3.11 --with-python --stage-libdir=lib64-msvc-14.3 --build-type=complete toolset=msvc-14.3 address-model=64 architecture=x86 debug-symbols=on stage

If I remove line 116 of libs\python\src\object\enum.cpp I don't get the error.


          #if PY_VERSION_HEX < 0x03000000
              | Py_TPFLAGS_CHECKTYPES
          #endif
              | Py_TPFLAGS_HAVE_GC                    /* <============== remove this line */
              | Py_TPFLAGS_BASETYPE,                  /* tp_flags */

Is it safe to do this?

Activity

  1. transferred this issue fromboostorg/booston Nov 4, 2022
  2. AllSeeingEyeTolledEweSew commented on Nov 9, 2022

    @AllSeeingEyeTolledEweSew
  3. owillebo commented on Dec 20, 2022

    @owillebo
    Author

    Fixed;

    a218bab

  4. Sinan81 commented on Jun 27, 2025

    @Sinan81

    Is it advisable to patch boost <=1.80 if python >=3.11?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions