Skip to content

Can't create length one array out of RegularForm with IndexedOptionForm content #3808

@ikrommyd

Description

@ikrommyd

Version of Awkward Array

HEAD

Description and code to reproduce

To reproduce

import awkward as ak
ak.forms.RegularForm(ak.forms.IndexedOptionForm("i64", ak.forms.NumpyForm("float64")), 10).length_one_array()

raises

File ~/Dropbox/work/pyhep_dev/awkward/src/awkward/operations/ak_from_buffers.py:293, in _from_buffer(nplike, buffer, dtype, count, byteorder, buffer_key, shape_generator, enable_virtualarray_caching)
    291         return array
    292 else:
--> 293     array = nplike.frombuffer(buffer, dtype=dtype, count=count)
    294     return ak._util.native_to_byteorder(array, byteorder)

File ~/Dropbox/work/pyhep_dev/awkward/src/awkward/_nplikes/array_module.py:126, in ArrayModuleNumpyLike.frombuffer(self, buffer, dtype, count)
    124 if isinstance(buffer, VirtualNDArray):
    125     raise TypeError("virtual arrays are not supported in `frombuffer`")
--> 126 return self._module.frombuffer(buffer, dtype=dtype, count=count)

ValueError: buffer is smaller than requested size

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug (unverified)The problem described would be a bug, but needs to be triaged

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions