Bug#1024859: change in the extention importation with 3.11

2022-12-06 Thread Alastair McKinstry



On 06/12/2022 16:13, PICCA Frederic-Emmanuel wrote:

There is a fix from the upstream around enum.


https://github.com/boostorg/python/commit/a218babc8daee904a83f550fb66e5cb3f1cb3013


  Fix enum_type_object type on Python 3.11

The enum_type_object type inherits from PyLong_Type which is not tracked
by the GC. Instances doesn't have to be tracked by the GC: remove the
Py_TPFLAGS_HAVE_GC flag.

The Python C API documentation says:

 "To create a container type, the tp_flags field of the type object
 must include the Py_TPFLAGS_HAVE_GC and provide an implementation of
 the tp_traverse handler."

https://docs.python.org/dev/c-api/gcsupport.html

The new exception was introduced in Python 3.11 by:
python/cpython#88429


an opinion ?

I'd favour that being added to boost1.74. It would fix my ecflow bugĀ  
(#1024911).


A minor (?) fix also needed for Swig wrapping too (#1024555)


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



Bug#1024859: change in the extention importation with 3.11

2022-12-06 Thread PICCA Frederic-Emmanuel
There is a fix from the upstream around enum.


https://github.com/boostorg/python/commit/a218babc8daee904a83f550fb66e5cb3f1cb3013


 Fix enum_type_object type on Python 3.11

The enum_type_object type inherits from PyLong_Type which is not tracked
by the GC. Instances doesn't have to be tracked by the GC: remove the
Py_TPFLAGS_HAVE_GC flag.

The Python C API documentation says:

"To create a container type, the tp_flags field of the type object
must include the Py_TPFLAGS_HAVE_GC and provide an implementation of
the tp_traverse handler."

https://docs.python.org/dev/c-api/gcsupport.html

The new exception was introduced in Python 3.11 by:
python/cpython#88429


an opinion ?



Bug#1024859: change in the extention importation with 3.11

2022-12-06 Thread PICCA Frederic-Emmanuel
in order to debug this, I started gdb

set a breakpoint in init_module_scitbx_linalg_ext

then a catch throw and I end up with this backtrace

Catchpoint 2 (exception thrown), 0x770a90a1 in __cxxabiv1::__cxa_throw 
(obj=0xb542e0, tinfo=0x772d8200 , dest=0x772c1290 
) at 
../../../../src/libstdc++-v3/libsupc++/eh_throw.cc:81
81  ../../../../src/libstdc++-v3/libsupc++/eh_throw.cc: Le dossier n'est 
pas vide.
(gdb) bt
#0  0x770a90a1 in __cxxabiv1::__cxa_throw (obj=0xb542e0, 
tinfo=0x772d8200 , 
dest=0x772c1290 
) at 
../../../../src/libstdc++-v3/libsupc++/eh_throw.cc:81
#1  0x772ad089 in boost::python::throw_error_already_set () at 
libs/python/src/errors.cpp:61
#2  0x772b6f05 in boost::python::objects::(anonymous 
namespace)::new_enum_type (doc=0x0, name=0x7743ddf9 
"bidiagonal_matrix_kind") at libs/python/src/object/enum.cpp:169
#3  boost::python::objects::enum_base::enum_base 
(this=this@entry=0x7fffcee0, name=name@entry=0x7743ddf9 
"bidiagonal_matrix_kind", 
to_python=to_python@entry=0x7741f720 
::to_python(void 
const*)>, 
convertible=convertible@entry=0x77422e50 
::convertible_from_python(_object*)>,
 
construct=construct@entry=0x7741fb60 
::construct(_object*,
 boost::python::converter::rvalue_from_python_stage1_data*)>, id=..., doc=0x0)
at libs/python/src/object/enum.cpp:204
#4  0x774203cb in 
boost::python::enum_::enum_ 
(this=0x7fffcee0, name=0x7743ddf9 "bidiagonal_matrix_kind", doc=0x0) at 
/usr/include/boost/python/enum.hpp:45
#5  0x77428330 in 
scitbx::matrix::boost_python::bidiagonal_matrix_svd_decomposition_wrapper::wrap
 (name=name@entry=0x7743dbd0 "svd_decomposition_of_bidiagonal_matrix")
at ./scitbx/linalg/boost_python/svd.cpp:19
#6  0x7741f6b0 in scitbx::matrix::boost_python::wrap_svd () at 
./scitbx/linalg/boost_python/svd.cpp:66
#7  0x773f8aa3 in scitbx::matrix::boost_python::(anonymous 
namespace)::init_module () at ./scitbx/linalg/boost_python/linalg_ext.cpp:19
#8  0x772c13e3 in boost::function0::operator() 
(this=0x7fffd2b0) at ./boost/function/function_template.hpp:763
#9  boost::python::handle_exception_impl (f=...) at 
libs/python/src/errors.cpp:25
#10 0x772c1b69 in boost::python::handle_exception 
(f=) at ./boost/function/function_template.hpp:635
#11 boost::python::detail::(anonymous namespace)::init_module_in_scope 
(init_function=0x773f8ac0 , m=) at libs/python/src/module.cpp:24
#12 boost::python::detail::init_module (moduledef=..., 
init_function=0x773f8ac0 ) at 
libs/python/src/module.cpp:43

not crystal clear to me :)