Anonymous committed dc8ddec

malloc: small cleanups

Some logic and an error message hadn't kept up with changes
over the years.

  • Participants
  • Parent commits b038715

Comments (0)

Files changed (1)

File pypy/rpython/lltypesystem/

         assert n is None
         o = _opaque(T, initialization=initialization)
-        raise TypeError, "malloc for Structs and Arrays only"
-    if T._gckind != 'gc' and not immortal and flavor.startswith('gc'):
+        raise TypeError, "malloc: unmallocable type"
+    if flavor == 'gc' and T._gckind != 'gc' and not immortal:
         raise TypeError, "gc flavor malloc of a non-GC non-immortal structure"
     if flavor == "raw" and not immortal and track_allocation:
         leakfinder.remember_malloc(o, framedepth=2)
-    solid = immortal or not flavor.startswith('gc') # immortal or non-gc case
+    solid = immortal or flavor == 'raw'
     return _ptr(Ptr(T), o, solid)
 def free(p, flavor, track_allocation=True):