Commit 494dc22c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 28f4d7d4
......@@ -32,6 +32,7 @@ cdef extern from *:
ctypedef bint cbool "bool"
from ZODB.utils import p64, u64
from cpython cimport PyBuffer_FillInfo
# XXX hack, why it is needed? (likely top-level wendelin.* redirector
#from wcfs.internal._wcfs cimport *
......@@ -114,6 +115,21 @@ cdef class PyMapping:
def __dealloc__(PyMapping pywmmap):
pywmmap.wmmap = nil # XXX unmap too ?
property blk_start:
def __get__(PyMapping pywmmap):
return pywmmap.wmmap.blk_start
property blk_stop:
def __get__(PyMapping pywmmap):
return pywmmap.wmmap.blk_stop()
def __getbuffer__(PyMapping pywmmap, Py_buffer *view, int flags):
# XXX do we need readonly=1 here? or let it hit SIGBUS on write access?
PyBuffer_FillInfo(view, pywmmap, pywmmap.wmmap.mem_start,
pywmmap.wmmap.mem_stop - pywmmap.wmmap.mem_start, readonly=1, flags=flags)
property mem:
def __get__(PyMapping pywmmap) -> memoryview:
return memoryview(pywmmap)
def unmap(PyMapping pywmmap):
with nogil:
wmmap_unmap_pyexc(pywmmap.wmmap) # XXX +err
......
......@@ -1719,7 +1719,7 @@ class tMapping(object):
assert len(dataok) <= f.blksize
dataok += b'\0'*(f.blksize - len(dataok)) # trailing zeros
blkview = memoryview(t.mmap.mem[blk_inmmap*f.blksize:][:f.blksize])
blkview = t.mmap.mem[blk_inmmap*f.blksize:][:f.blksize]
# XXX first access without GIL, so that e.g. if there is timeout on
# wcfs.py side, _abort_ontimeout could run and kill WCFS.
# FIXME also test with GIL locked, since wcfs.py pinner must be itself
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment