question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fused Type + Memoryview Parameter Throws unused-function Warning on Master

See original GitHub issue

Credit 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:closed
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
da-woodscommented, Apr 2, 2020

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?

0reactions
scodercommented, Apr 6, 2020

I was guessing that there was just some inconsistent condition somewhere. Let’s see if #3491 fixes it.

Read more comments on GitHub >

github_iconTop 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 >
apache-arrow | Yarn - Package Manager
Fast, reliable, and secure dependency management.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found