Skip to content

module.py typo? #111

@sionledbetter

Description

@sionledbetter

I get this error:

File "/home/snledbetter/GitHub/legate/legate.core/install/lib/python3.8/site-packages/cunumeric/module.py", line 187, in array
    array = array
UnboundLocalError: local variable 'array' referenced before assignment

I opened up module.py and found this function:

@copy_docstring(np.array)
def array(obj, dtype=None, copy=True, order="K", subok=False, ndmin=0):
    if not isinstance(obj, ndarray):
        thunk = runtime.get_numpy_thunk(
            obj, stacklevel=2, share=(not copy), dtype=dtype
        )
        array = ndarray(shape=None, stacklevel=2, thunk=thunk)
    else:
        array = array
    if dtype is not None and array.dtype != dtype:
        array = array.astype(dtype)
    elif copy and obj is array:
        array = array.copy()
    if array.ndim < ndmin:
        shape = (np.newaxis,) * (ndmin - array.ndim) + array.shape
        array = array.reshape(shape)
    return array

I assumed the point of checking to see if the obj was an ndarray was to make sure that the array variable was the proper type, so I changed line 187 to array=obj and that seemed to resolve this error.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions