• Paul Sokolovsky's avatar
    py/objexcept: Allow clearing traceback with 'exc.__traceback__ = None'. · c3d96d38
    Paul Sokolovsky authored
    We allow 'exc.__traceback__ = None' assignment as a low-level optimization
    of pre-allocating exception instance and raising it repeatedly - this
    avoids memory allocation during raise. However, uPy will keep adding
    traceback entries to such exception instance, so before throwing it,
    traceback should be cleared like above.
    
    'exc.__traceback__ = None' syntax is CPython compatible. However, unlike
    it, reading that attribute or setting it to any other value is not
    supported (and not intended to be supported, again, the only reason for
    adding this feature is to allow zero-memalloc exception raising).
    c3d96d38