MemoryError hook in Python?

前端 未结 3 695
粉色の甜心
粉色の甜心 2021-01-06 07:39

Is there a way to globally trap MemoryError exceptions so that a library can clear out caches instead of letting a MemoryError be seen by user code?

I\'m developing

3条回答
  •  甜味超标
    2021-01-06 08:04

    A MemoryError is an exception, you should be able to catch it in an except block.

提交回复
热议问题