Skip to content

Mac + Glumpy and Gloo/program.py, '1type' as a synonym FutureWarning. #318

Description

@atalkingegg

Programs that pull in gloo trigger a warning...
/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/glumpy/gloo/program.py:108: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
self._buffer = np.zeros(self._count, dtype=dtype).view(VertexBuffer)

The fix...

replace the line at 108 in glumpy/gloo/program.py:

dtype.append(attribute.dtype)

with these lines

dt = attribute.dtype
if isinstance(dt, tuple) and len(dt) == 3 and dt[2] == 1:
dt = (dt[0], dt[1])
dtype.append(dt)

This strips off the future-offending and redundant length of 1 element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions