Comments (5)
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.
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.
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.
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.
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)
- [BUG] Can not do logic with `char *` ? HOT 2
- [BUG] Compiler crash using ufunc with multiple, fused return types HOT 1
- [BUG] `TypeError` when using type annotations in signatures with defaults HOT 4
- Document compilation caching? HOT 10
- A number of warning messages during docs make build procedure HOT 6
- [BUG] Test failures with NumPy 2.0b1
- [BUG] `int` power of an `int` results a `float` when computed inside a list comprehension HOT 1
- [BUG] segfault when raising an exception with python 3.13 alpha 5 HOT 2
- Limited API preview branch HOT 3
- [ENH] __Pyx_PyDict_Pack function (for code size)?
- [BUG] Segmentation fault with Walrus-Operator and same named variables HOT 2
- [BUG] Generators after being cythonized cannot be inspect as generators HOT 13
- [ENH] Can Cython support the vector database function of redis? HOT 3
- [BUG] Function Wrapper yields unused-variable warning when compiled with pypy HOT 3
- [BUG] cppclass inheritance does not work with overloaded methods HOT 3
- [BUG] Deadlock in OpenMP Parallel Loop When Invoking LAPACK Functions in Cython>=3.0 HOT 4
- [BUG] Multi-line f-string literals do not adhere to """\ syntax HOT 1
- [bug] issues with "cppclass overloadable methods" HOT 1
- [ENH] Improve Cython install speed from source HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cython.