- fd = f.fileno()
- max_chunk = max(1, (8 * 1024 * 1024) / _page_size)
- rpr = _nonresident_page_regions(_helpers.fmincore(fd), max_chunk)
- rstart, rlen = next(rpr, (None, None))
+ try:
+ fd = f.fileno()
+ except io.UnsupportedOperation:
+ pass
+ if fd:
+ mcore = _fmincore(fd)
+ if mcore:
+ max_chunk = max(1, (8 * 1024 * 1024) / sc_page_size)
+ rpr = _nonresident_page_regions(mcore, helpers.MINCORE_INCORE,
+ max_chunk)
+ rstart, rlen = next(rpr, (None, None))