Fused Type + Memoryview Parameter Throws unused-function Warning on Master
See original GitHub issueCredit to @tacaswell for originally finding in https://github.com/pandas-dev/pandas/issues/33224
Using this as a minimum reproducible example:
ctypedef fused number_t:
int
float
def add_one(number_t[:] arr):
cdef Py_ssize_t i
for i in range(len(arr)):
arr[i] = arr[i] + 1
Compilation using Cython master will throw the following warning
cytest.c:3476:18: warning: ‘__pyx_pf_6cytest_8__defaults__’ defined but not used [-Wunused-function]
static PyObject *__pyx_pf_6cytest_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No warning is thrown using 0.29.14
From what I can tell, it seems to be specific using a fused type and a memoryview together in the function signature - changing the parameter type to say just int[:]
does not throw a warning
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
C++ fix unused parameter warning with polymorphism
All you need to do is to not name them in the implementation: void car::init(int /* color */, int size){ this->size = size;...
Read more >Nodes.py
ErrorType() return self.type if not MemoryView.validate_axes(self.pos, ... 'extern': warning(self.cfunc_declarator.pos, "Only extern functions can throw C++ ...
Read more >MPLAB XC16 C Compiler Users Guide DS50002071.pdf
3.7.2 How Do I Find the Code that Caused Compiler Errors Or Warnings in My Pro- ... In order to get a warning...
Read more >SciPy Reference Guide
x branch, and on adding new features on the master branch. This release requires Python 2.7 or 3.4-3.6 and NumPy 1.8.2 or greater....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m relatively sure this would be related to https://github.com/cython/cython/pull/3366 (or possibly a combination of that and https://github.com/cython/cython/pull/3398). I don’t know how helpful this actually is as a place to start though.
I’m a bit suspicious of https://github.com/cython/cython/blob/2ca3f569254ddee7d1561d102ccca0c9d3250c91/Cython/Compiler/ExprNodes.py#L9443-L9449 - maybe it means that the thing that would normally use the
__defaults__
isn’t set?I was guessing that there was just some inconsistent condition somewhere. Let’s see if #3491 fixes it.