[pypy-dev] Catching MemoryError in RPython

holger krekel holger at merlinux.de
Sat Feb 23 14:33:23 CET 2008

Hi Armin, 

On Sat, Feb 23, 2008 at 13:44 +0100, Armin Rigo wrote:
> On Fri, Feb 22, 2008 at 07:54:52PM +0100, Niko Matsakis wrote:
> > I cannot seem to generate code that catches OOM errors in RPython.
> A known issue: the flow space doesn't consider that almost any operation
> could raise MemoryError, and thus the except clause is never seen by it.
> The same issue applies to try:finally:.
> The workaround is to use a function call:
>     def fn():
>         try:
>             do_stuff()
>         except MemoryError:
>             return True
>         else:
>             return False
>     def do_stuff():
>         ...

the "range" and "lst.append" in Niko's example are not 
considered to be function calls?  Is it (also) the explicit 
catching of MemoryError here that is important? 


More information about the Pypy-dev mailing list