Path: csiph.com!1.us.feeder.erje.net!3.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!news.mixmin.net!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod From: Alastair McKinstry Newsgroups: linux.debian.maint.python Subject: Fwd: change in the extention importation with 3.11 Date: Tue, 06 Dec 2022 18:00:01 +0100 Message-ID: References: X-Original-To: debian-python@lists.debian.org X-Mailbox-Line: From debian-python-request@lists.debian.org Tue Dec 6 16:51:13 2022 Old-Return-Path: X-Amavis-Spam-Status: No, score=-0.907 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, BODY_8BITS=1.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MD5_SHA1_SUM=-1, RDNS_NONE=0.793] autolearn=no autolearn_force=no X-Policyd-Weight: using cached result; rate: -4.6 X-Greylist: delayed 464 seconds by postgrey-1.36 at bendel; Tue, 06 Dec 2022 16:34:07 UTC MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:108.0) Gecko/20100101 Thunderbird/108.0 Content-Language: en-US Organization: Councillor, Galway Co Co, Green party X-Forwarded-Message-ID: <36e18036-1bf5-7fd2-357b-2f6e9a7c7383@sceal.ie> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailing-List: archive/latest/20561 List-ID: List-URL: List-Archive: https://lists.debian.org/msgid-search/131412c2-f723-b083-6942-06ae3988091b@sceal.ie Approved: robomod@news.nic.it Lines: 138 Sender: robomod@news.nic.it X-Original-Date: Tue, 6 Dec 2022 16:26:18 +0000 X-Original-Message-ID: <131412c2-f723-b083-6942-06ae3988091b@sceal.ie> X-Original-References: <36e18036-1bf5-7fd2-357b-2f6e9a7c7383@sceal.ie> Xref: csiph.com linux.debian.maint.python:14697 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 "", line 1, in > 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     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",             "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