Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Bug in string comparison in StringArray #247

Description

@dntaylor

There is a bug in StringArray when comparing strings:

>>> import awkward
>>> a = awkward.fromiter(['a','b','c'])
>>> a == 'a'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dntaylor/miniconda3/envs/test/lib/python3.7/site-packages/numpy/lib/mixins.py", line 25, in func
    return ufunc(self, other)
  File "/Users/dntaylor/miniconda3/envs/test/lib/python3.7/site-packages/awkward/array/objects.py", line 331, in __array_ufunc__
    right = self.StringArray.fromstr(len(left), right)
  File "/Users/dntaylor/miniconda3/envs/test/lib/python3.7/site-packages/awkward/array/objects.py", line 383, in fromstr
    for i, x in string:
TypeError: cannot unpack non-iterable int object
>>> a
<StringArray ['a' 'b' 'c'] at 0x000102c01390>
>>> awkward.__version__
'0.12.21'

I guess it needs either enumerate or to remove the "i" (since it isn't used).

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