Skip to content

Segmetation fault if creating SegmentTree from empty array #2

Open
@abrikos110

Description

@abrikos110
>>> import sys
>>> import segment_tree
>>> 
>>> sys.setrecursionlimit(10**7)
>>> segment_tree.SegmentTree([])
Segmentation fault (core dumped)
>>> import segment_tree
>>> 
>>> segment_tree.SegmentTree([])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.6/site-packages/segment_tree/segment_tree.py", line 25, in __init__
    self.root = SegmentTreeNode(0, len(array) - 1, self)
  File "/home/user/anaconda3/lib/python3.6/site-packages/segment_tree/segment_tree.py", line 88, in __init__
    segment_tree)
  File "/home/user/anaconda3/lib/python3.6/site-packages/segment_tree/segment_tree.py", line 88, in __init__
    segment_tree)
  File "/home/user/anaconda3/lib/python3.6/site-packages/segment_tree/segment_tree.py", line 88, in __init__
    segment_tree)
  [Previous line repeated 244 more times]
RecursionError: maximum recursion depth exceeded
>>> 

If you create SegmentTree from empty array the infinite recursion occurs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions