• Kirill Smelkov's avatar
    bigfile/py/loadblk: Resort to pybuf unpinninf, if nothing helps · 024c246c
    Kirill Smelkov authored
    There are situations possible when both exc_traceback and frame objects are
    garbage-collected, but frame's f_locals remains not collected because e.g. it
    was explicitly added to somewhere. We cannot detect such cases (dicts are not
    listed in referrers).
    
    So if nothing helped, as a last resort, unpin pybuf from its original
    memory and make it point to zero-sized NULL.
    
    In general this is not strictly correct to do as other buffers &
    memoryview objects created from pybuf, copy its pointer on
    initialization and thus pybuf unpinning won't adjust them.
    
    However we require BigFile implementations to make sure not to use
    such-created objects, if any, after return from loadblk().
    
    Finally fixes #7
    024c246c
_bigfile.c 33 KB