1. Pypy
  2. Untitled project
  3. pypy

Commits

Amaury Forgeot d'Arc  committed bf6ff9d

The "zero" parameter of lltype.malloc() is checked to be constant.
This constraint has to be propagated up to scoped_alloc(), to generate specialized versions.

  • Participants
  • Parent commits 766ef22
  • Branches decimal-libmpdec

Comments (0)

Files changed (1)

File rpython/rtyper/lltypesystem/lltype.py

View file
     if track_allocation:
         leakfinder.remember_free(p._obj0)
 
-def _make_scoped_allocator(T):
+def _make_scoped_allocator(T, zero):
     class ScopedAlloc:
-        def __init__(self, n=None, zero=False):
+        def __init__(self, n=None):
             if n is None:
                 self.buf = malloc(T, flavor='raw', zero=zero)
             else:
             ...use array...
         ...it's freed now.
     """
-    return _make_scoped_allocator(T)(n=n, zero=zero)
-scoped_alloc._annspecialcase_ = 'specialize:arg(0)'
+    return _make_scoped_allocator(T, zero)(n=n)
+scoped_alloc._annspecialcase_ = 'specialize:arg(0, 2)'
 
 def functionptr(TYPE, name, **attrs):
     if not isinstance(TYPE, FuncType):