[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Fwd: change in the extention importation with 3.11




On 06/12/2022 13:47, picca wrote:
Hello, I am trying to fix this bug

I'm debugging something similar, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1024911

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1024859

I find the error message not very informative...

:~/$ python3.11
Python 3.11.0+ (main, Nov  4 2022, 09:23:33) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import scitbx_linalg_ext
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: initialization of scitbx_linalg_ext raised unreported
exception


The problem is that python is catching a C/C++  exception.

You can debug with:

gdb /usr/bin/python3.11

...

(gdb) catch throw

(gdb) run

import scitbx_linalg_ext

...

I would like your opinion and some help in order to fix this or at least understand what is going on.

ther extension was build with boost_python, maybe something is wrong also with boost_python and Python3.11.

I do not know if other packages using boost_python are affected like this.

thanks for considering

Frederic


Both cctbx and ecflow are breaking on generating new enums.

A simple test case is:

```

#include <boost/python.hpp>
    using namespace boost::python;



//  enum has flags 0x42000, no traversefunction set



class CheckPt  {
public:
   /// NEVER   - the check pt file is never saved
   /// ON_TIME - the check pt file is saved periodically. specified by checkPtInterval.
   /// ALWAYS  - the check pt file is saved after any state change
   /// UNDEFINED   - Internal use only
   enum Mode { NEVER, ON_TIME, ALWAYS, UNDEFINED};

};


void inc_enum () {
   enum_<CheckPt::Mode>("CheckPt",
            "CheckPt is enum that is used to control check pointing in the `ecflow_server`_\n\n"
            "- NEVER  : Switches of check pointing\n"
            "- ON_TIME: `check point`_ file is saved periodically, specified by checkPtInterval. This is the default.\n"             "- ALWAYS : `check point`_ file is saved after any state change, *not* recommended for large definitions\n"             "- UNDEFINED : None of the the above, used to provide default argument\n"
   )
   .value("NEVER",  CheckPt::NEVER)
   .value("ON_TIME",CheckPt::ON_TIME)
   .value("ALWAYS", CheckPt::ALWAYS)
   .value("UNDEFINED", CheckPt::UNDEFINED)
   ;
}

char const *greet()
{
  return "Hello world\n";
}

BOOST_PYTHON_MODULE(wrapper)
{
    def ("greet", greet);
    inc_enum();
}

```


What appears to be happening is a change in python3.11: https://docs.python.org/ja/3.11/whatsnew/3.11.html

    The PyType_Ready() function now raises an error if a type is defined with the Py_TPFLAGS_HAVE_GC flag set but has no traverse function         (PyTypeObject.tp_traverse). (Contributed by Victor Stinner in bpo-44263.)

and indeed, the enum types are created without a traverse function but with the HAVE_GC flag set.

It doesn't at first glance look like the code for boost1.80 is different.

A Python/boost expert is now needed.


Regards

Alastair McKinstry

mckinstry@debian.org



--
Alastair McKinstry,
GPG: 82383CE9165B347C787081A2CBE6BB4E5D9AD3A5
ph: +353 87 6847928 e: alastair@sceal.ie, im: @sceal.ie:mckinstry


Reply to: