Pylint: numpy.logical_or gives false error assignment-from-no-return

Created on 15 Jan 2019  路  14Comments  路  Source: PyCQA/pylint

Steps to reproduce

Execute pylint on the following code:

"""Demo of the assignment-from-no-return pylint false positive"""

import numpy as np


def demo():
    """Demo of the false positive, at line z = ..."""
    x = np.array([0, 1, 0, 1], dtype=np.bool)
    y = np.array([0, 0, 1, 1], dtype=np.bool)
    z = np.logical_or(x, y)
    print(np.array([x, y, z]))


if __name__ == "__main__":
    demo()

Current behavior

assignment-from-no-return(E1111): test.py:10:4: demo: Assigning result of a function call, where the function has no return

Expected behavior

No issue

pylint --version output

pylint 2.2.2
astroid 2.1.0
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
[GCC 7.3.0]
astroid brain bug

Most helpful comment

Should be fixed with the latest master of astroid.

All 14 comments

Thanks for the report!

For the record, this affects other functions too, such as numpy.equal.

and numpy.divide

numpy.log as well

Any update as to the cause of this? or what versions this didn't occur on? could be a numpy issue?

@jordyjwilliams It has to do with the release of numpy==1.16 pinning numpy<1.16 has fixed CI linting for me for now, but I like this to be fixed for the newer numpy

Does anyone know if this needs fixing on pylint's or numpy's part?

This is on pylint's side.

@PCManticore any idea on when this will be fixed?

Can confirm same problem for a lot more Numpy functions, for example deg2rad(), arctan(), and more presumably. Moreover, array item assignment (such as arr[i] = x) suffers from unsupported-assignment-operation.

+1 to all these issues

Should be fixed with the latest master of astroid.

@PCManticore That was quick! The commit says release date tba. Are we talking days or weeks?

Weeks most likely, I'll do a dev release in a bit, but the final one might be somewhere in February.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ethanchewy picture ethanchewy  路  3Comments

PCManticore picture PCManticore  路  3Comments

PCManticore picture PCManticore  路  3Comments

adamtheturtle picture adamtheturtle  路  3Comments

pylint-bot picture pylint-bot  路  3Comments