[pypy-svn] r55875 - in pypy/dist/pypy/rpython/lltypesystem: . test
arigo at codespeak.net
arigo at codespeak.net
Mon Jun 16 13:25:09 CEST 2008
Author: arigo
Date: Mon Jun 16 13:25:09 2008
New Revision: 55875
Modified:
pypy/dist/pypy/rpython/lltypesystem/rffi.py
pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py
Log:
Test and fix for running str_from_buffer() directly.
Modified: pypy/dist/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rffi.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/rffi.py Mon Jun 16 13:25:09 2008
@@ -558,7 +558,7 @@
if gc_buf:
src = cast_ptr_to_adr(gc_buf) + str_chars_offset
else:
- src = cast_ptr_to_adr(raw_buf)
+ src = cast_ptr_to_adr(raw_buf) + itemoffsetof(CCHARP.TO, 0)
dest = cast_ptr_to_adr(new_buf) + str_chars_offset
## FIXME: This is bad, because dest could potentially move
## if there are threads involved.
Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py Mon Jun 16 13:25:09 2008
@@ -449,6 +449,7 @@
return str_from_buffer(raw_buf, gc_buf, len(d), len(d)-1)
finally:
keep_buffer_alive_until_here(raw_buf, gc_buf)
+ assert f() == d[:-1]
fn = self.compile(f, [], gcpolicy='ref')
assert fn() == d[:-1]
@@ -465,6 +466,7 @@
return counter
finally:
free_nonmovingbuffer(d, buf)
+ assert f() == len(d)
fn = self.compile(f, [], gcpolicy='ref')
assert fn() == len(d)
More information about the Pypy-commit
mailing list