[pypy-commit] pypy numpy-pickle: Add an optional track_allocation parameter to str2charp
rguillebert
noreply at buildbot.pypy.org
Sat May 4 22:09:41 CEST 2013
Author: Romain Guillebert <romain.py at gmail.com>
Branch: numpy-pickle
Changeset: r63850:fe83fa4acdef
Date: 2013-05-04 22:08 +0200
http://bitbucket.org/pypy/pypy/changeset/fe83fa4acdef/
Log: Add an optional track_allocation parameter to str2charp
diff --git a/rpython/rtyper/lltypesystem/rffi.py b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -446,7 +446,7 @@
TYPES += ['__int128_t']
except CompilationError:
pass
-
+
_TYPES_ARE_UNSIGNED = set(['size_t', 'uintptr_t']) # plus "unsigned *"
if os.name != 'nt':
TYPES.append('mode_t')
@@ -693,10 +693,10 @@
builder_class = UnicodeBuilder
# str -> char*
- def str2charp(s):
+ def str2charp(s, track_allocation=True):
""" str -> char*
"""
- array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw')
+ array = lltype.malloc(TYPEP.TO, len(s) + 1, flavor='raw', track_allocation=track_allocation)
i = len(s)
array[i] = lastchar
i -= 1
@@ -706,8 +706,8 @@
return array
str2charp._annenforceargs_ = [strtype]
- def free_charp(cp):
- lltype.free(cp, flavor='raw')
+ def free_charp(cp, track_allocation=True):
+ lltype.free(cp, flavor='raw', track_allocation=track_allocation)
# char* -> str
# doesn't free char*
More information about the pypy-commit
mailing list