Coder Social home page Coder Social logo

Comments (5)

da-woods avatar da-woods commented on June 13, 2024

The upshot is that we can't use PyFloat_Type because it's opaque. The C compiler knows that it exists but doesn't know what's in it.

__Pyx_PyFloat_EqObjC (and related functions) are largely just optimisations. As a fallback they could just be replaced with the standard PyObject comparison in the limited API.

I suspect in case we could use __Pyx_PyType_GetSlot on PyFloat_Type. This should end up equivalent to the current code normally, and something slightly less efficient but valid in the limited API.

from cython.

vyasr avatar vyasr commented on June 13, 2024

I figured out the opaque struct bit, what I was having trouble understanding is what code gen cython is doing to produce the invalid code. The error is coming up right after the limited api macros are defined and python.h is included, so almost none of the cython generated code has been hit. How is what cython doing triggering this error from just the include of python.h?

from cython.

da-woods avatar da-woods commented on June 13, 2024

The error is the line

PyFloat_Type.tp_richcompare(op2, op1, Py_EQ));

All the other messages are just telling you that PyFloat_Type is an incomplete type and is defined in "Python.h". They're informational.

from cython.

vyasr avatar vyasr commented on June 13, 2024

Ah right I didn't look at the C traceback nearly closely enough, sorry about that. Any idea why the issue is so obscured in the C++ traceback? I do see the

/home/coder/.conda/envs/rapids/include/python3.11/floatobject.h: In function 'PyObject* __Pyx_PyFloat_EqObjC(PyObject*, PyObject*, double, int, int)':

which is the function you mentioned as being an optimization, but I don't see the equivalent obvious error line indicating where the incomplete type is being used. Apologies if this is obvious to see, I suspect that I'm having trouble tracing because I'm not accustomed to using macros nearly to the extent used in the Cython/CPython code bases and they make tracebacks harder to follow.

from cython.

da-woods avatar da-woods commented on June 13, 2024

I'm going off the C traceback instead. I think they're expressing the same issue in slightly different ways. I can't actually see the relevant line in the C++ traceback you've posted.

from cython.

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.