Skip to content

Commit

Permalink
Fix MemoryError in string operators (erp12#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yifan authored Oct 14, 2021
1 parent abb6068 commit 30a49f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyshgp/push/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def __init__(self):
class PushStrType(PushType):

def __init__(self):
super().__init__("str", (str, np.str_, np.object_))
super().__init__("str", (str, np.str_, np.object_), is_collection=True)


class PushVectorType(PushType):
Expand Down
5 changes: 5 additions & 0 deletions tests/push/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ def test_set_nth_oob(self, str_stack: PushStack):
def test_flush(self, int_stack: PushStack):
int_stack.push(1).push(-1).flush()
assert len(int_stack) == 0

def test_large_str(self, str_stack: PushStack):
s = "largestr"*1000
str_stack.push(s)
assert len(str_stack.pop()) != len(s)

0 comments on commit 30a49f2

Please sign in to comment.