Author: Armin Rigo <[email protected]>
Branch:
Changeset: r94884:6868da604e68
Date: 2018-07-23 18:18 +0200
http://bitbucket.org/pypy/pypy/changeset/6868da604e68/
Log: Add a get_raw_address() in the base class---better than segfaulting
due to calls to a missing method!
diff --git a/rpython/rlib/buffer.py b/rpython/rlib/buffer.py
--- a/rpython/rlib/buffer.py
+++ b/rpython/rlib/buffer.py
@@ -6,7 +6,7 @@
from rpython.rtyper.lltypesystem.rstr import STR
from rpython.rtyper.lltypesystem.rlist import LIST_OF
from rpython.rtyper.annlowlevel import llstr
-from rpython.rlib.objectmodel import specialize
+from rpython.rlib.objectmodel import specialize, we_are_translated
from rpython.rlib import jit
from rpython.rlib.rgc import (resizable_list_supporting_raw_ptr,
nonmoving_raw_ptr_for_resizable_list,
@@ -114,6 +114,12 @@
"""
raise CannotWrite
+ def get_raw_address(self):
+ msg = "cannot take the raw address of this buffer"
+ if not we_are_translated():
+ msg += " '%s'" % (self,)
+ raise ValueError(msg)
+
class RawBuffer(Buffer):
"""
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit