Code Monkey home page Code Monkey logo

Comments (17)

MatthieuDartiailh avatar MatthieuDartiailh commented on July 4, 2024

Thanks for the report. I did not yet start testing with 3.11. I hope to get to it soon though.

from kiwi.

nascheme avatar nascheme commented on July 4, 2024

This seems to be an issue with type casts with the new inline functions included in 3.11.x. I've created a CPython bug since I don't know if it is a bug with CPython or a bug with the kiwisolver code. See:

python/cpython#93442

Using PyTuple_SetItem fixes the issue but I don't know if the new PyTuple_SET_ITEM is buggy or if the kiwi C++ source code is doing something not quite correct. I'm not a C++ expert.

from kiwi.

nascheme avatar nascheme commented on July 4, 2024

The issue can be worked around by using nullptr, as per change below. However, I think the PyTuple_SET_ITEM() and similar macros in CPython 3.11 should be changed to accept NULL/0 as null arguments.

diff --git a/py/src/symbolics.h b/py/src/symbolics.h
index 69ea540..1558063 100644
--- a/py/src/symbolics.h
+++ b/py/src/symbolics.h
@@ -123,7 +123,7 @@ PyObject* BinaryMul::operator()( Expression* first, double second )
                return 0;
        Py_ssize_t end = PyTuple_GET_SIZE( first->terms );
        for( Py_ssize_t i = 0; i < end; ++i )  // memset 0 for safe error return
-               PyTuple_SET_ITEM( terms.get(), i, 0 );
+               PyTuple_SET_ITEM( terms.get(), i, nullptr );
        for( Py_ssize_t i = 0; i < end; ++i )
        {
                PyObject* item = PyTuple_GET_ITEM( first->terms, i );
diff --git a/py/src/util.h b/py/src/util.h
index 4b00fa7..1f40dc9 100644
--- a/py/src/util.h
+++ b/py/src/util.h
@@ -117,7 +117,7 @@ make_terms( const std::map<PyObject*, double>& coeffs )
         return 0;
     Py_ssize_t size = PyTuple_GET_SIZE( terms.get() );
     for( Py_ssize_t i = 0; i < size; ++i ) // zero tuple for safe early return
-        PyTuple_SET_ITEM( terms.get(), i, 0 );
+        PyTuple_SET_ITEM( terms.get(), i, nullptr );
     Py_ssize_t i = 0;
     iter_t it = coeffs.begin();
     iter_t end = coeffs.end();

from kiwi.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 4, 2024

Thanks for investigating. I will make a PR with those changes while waiting to see if a fix lands in CPython and add 3.11 to the test matrix.

from kiwi.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 4, 2024

PR is at #142 and appears to work just fine. I will merge sometimes next week if nothing happens in the meantime.

from kiwi.

oscarbenjamin avatar oscarbenjamin commented on July 4, 2024

Thanks!

from kiwi.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 4, 2024

The release process has started but the aarch build is real slow. Hopefully the wheels will appear on PyPI later today

from kiwi.

neutrinoceros avatar neutrinoceros commented on July 4, 2024

The build is much longer than the typical duration I can see in the history. Maybe it's just randomly hanging ?

from kiwi.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 4, 2024

Right I will trig it again

from kiwi.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 4, 2024

The discussed fix appears to fail on MacOS ARM (see #144). I would appreciate if anybody with more C++ background has an idea on how to fix this for all compilers and architectures.

from kiwi.

neutrinoceros avatar neutrinoceros commented on July 4, 2024

I think the following CPython patch may have made #142 unecessary : python/cpython@8bcc3fa

This patch was not yet shipped, and will (likely) be included only in Python 3.11.0b4 (scheduled for this Thursday).
I hope this helps.

from kiwi.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 4, 2024

Thanks I will look into reverting the change once the beta is out.

from kiwi.

neutrinoceros avatar neutrinoceros commented on July 4, 2024

@MatthieuDartiailh FYI Python 3.11.0b4 is now available after a couple weeks of delay :)

from kiwi.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 4, 2024

Thanks I am waiting for it to be available on GHA to merge the relevant PR.

from kiwi.

neutrinoceros avatar neutrinoceros commented on July 4, 2024

It's been available on GHA for a couple hours

from kiwi.

oscarbenjamin avatar oscarbenjamin commented on July 4, 2024

Everything seems to be installing fine for SymPy with 3.11b4:
https://github.com/sympy/sympy/runs/7318381460

There is a test failure but it's unrelated to kiwi.

from kiwi.

MatthieuDartiailh avatar MatthieuDartiailh commented on July 4, 2024

I merged the PR and will try to cut a new release soon.

from kiwi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.