title: Is it Python's interpreter fault that I received a segfault?
body: <p>Can I assume it's Python's bug that I got segfault on condition that:</p>
  <ol>
  <li>I'm not using any external library</li>
  <li>I'm barely using any internal library (just sys to increase recursion depth limit and typing for typing :P</li>
  <li>I didn't observe increased RAM usage that could justify lack of memory and therefore segfault</li>
  <li>My code is recursive and it doesn't do any advanced memory manipulation (through ctypes or whatever)</li>
  </ol>
  <p>I think I don't do anything advanced in my code, and I if these conditions are met, then if I do something wrong I would expect python to raise an exception rather than exit program unexpectedly with exit code != 0, am I right? What do you think, is posting issue on Python's bugtracker justified in that case? :P</p>
  <pre class="lang-py prettyprint-override"><code>import typing
  import sys
  sys.setrecursionlimit(50000)
   
   
  class RuleDb:
      _rules: typing.Dict[int, str] = None
   
      @classmethod
      def load(cls):
          if not cls._rules:
              cls._rules = {}
   
              rules = open('input', 'r').read().split('\n\n')[0].strip().split('\n')
              for rule in rules:
                  number, rule = rule.split(':')
                  number = int(number)
                  rule = rule.strip()
                  cls._rules[number] = rule
   
      @classmethod
      def get_by_id(cls, id: int):
          return cls._rules[id]
   
      @classmethod
      def last_index(cls):
          return max(cls._rules.keys())
   
   
  def unroll(rules: RuleDb, rule_string: str):
      unrolled = ''
      rule_string = rule_string.replace('&quot;','')
      if len(rule_string) == 1:
          if rule_string.isalpha():
              return rule_string
          elif rule_string.isnumeric():
              return unroll(rules, rules.get_by_id(int(rule_string.strip('&quot;'))))
   
      if rule_string.count('|'):
          unrolled = unrolled + '('
          left, right = rule_string.split('|')
          left, right = left.strip(), right.strip()
   
          for symbol in left.split():
              unrolled += unroll(rules, symbol)
   
          unrolled += '|'
          for symbol in right.split():
              unrolled += unroll(rules, symbol)
          unrolled += ')'
      elif not rule_string.count('|'):
          for symbol in rule_string.split():
              unrolled += unroll(rules, symbol)
   
      return unrolled
   
   
  rules_db = RuleDb()
  rules_db.load()
  print(
      unroll(rules_db, rules_db.get_by_id(0))
  )
  </code></pre>