Author: Greg Price <[email protected]>
Branch: 
Changeset: r59499:dc8ddeca10f7
Date: 2012-12-12 21:18 -0500
http://bitbucket.org/pypy/pypy/changeset/dc8ddeca10f7/

Log:    malloc: small cleanups

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

diff --git a/pypy/rpython/lltypesystem/lltype.py 
b/pypy/rpython/lltypesystem/lltype.py
--- a/pypy/rpython/lltypesystem/lltype.py
+++ b/pypy/rpython/lltypesystem/lltype.py
@@ -1965,12 +1965,12 @@
         assert n is None
         o = _opaque(T, initialization=initialization)
     else:
-        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):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to