Commit 52bc8503 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8dc103eb
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
from golang cimport chan, structZ, string, error, refptr, pychan from golang cimport chan, structZ, string, error, refptr, pychan
from golang cimport context from golang cimport context
from golang import context as pycontext
from libcpp cimport nullptr_t, nullptr as nil from libcpp cimport nullptr_t, nullptr as nil
from libcpp.utility cimport pair from libcpp.utility cimport pair
...@@ -129,7 +130,14 @@ cdef class PyWatchLink: ...@@ -129,7 +130,14 @@ cdef class PyWatchLink:
if err.eq(EOF): if err.eq(EOF):
return None return None
if err != nil: if err != nil:
# XXX -> common place? support for other errors? is it good idea?
if err.eq(context.canceled):
raise pycontext.canceled
if err.eq(context.deadlineExceeded):
raise pycontext.deadlineExceeded
raise RuntimeError(err.Error()) # XXX exc class? raise RuntimeError(err.Error()) # XXX exc class?
cdef PyPinReq pyreq = PyPinReq.__new__(PyPinReq) cdef PyPinReq pyreq = PyPinReq.__new__(PyPinReq)
...@@ -142,9 +150,13 @@ cdef class PyWatchLink: ...@@ -142,9 +150,13 @@ cdef class PyWatchLink:
reply = _.first reply = _.first
err = _.second err = _.second
#printf("pyxsendReq: reply='%s'\n", reply.c_str())
if err != nil: if err != nil:
# XXX -> common place? support for other errors? is it good idea?
if err.eq(context.canceled):
raise pycontext.canceled
if err.eq(context.deadlineExceeded):
raise pycontext.deadlineExceeded
raise RuntimeError(err.Error()) # XXX -> Xpy(err) ? pyraiseIf(err) ? raise RuntimeError(err.Error()) # XXX -> Xpy(err) ? pyraiseIf(err) ?
#printf("pyxsendReq: reply -> ok\n") #printf("pyxsendReq: reply -> ok\n")
......
...@@ -50,7 +50,7 @@ from golang import context, sync, time ...@@ -50,7 +50,7 @@ from golang import context, sync, time
from zodbtools.util import ashex as h, fromhex from zodbtools.util import ashex as h, fromhex
import pytest; xfail = pytest.mark.xfail import pytest; xfail = pytest.mark.xfail
from pytest import raises, fail from pytest import raises, fail
from six import reraise #from six import reraise
from .internal import io, mm from .internal import io, mm
from .internal._wcfs import _tpywlinkwrite as _twlinkwrite from .internal._wcfs import _tpywlinkwrite as _twlinkwrite
from .internal.wcfs_test import _tDB, read_nogil, install_sigbus_trap, fadvise_dontneed from .internal.wcfs_test import _tDB, read_nogil, install_sigbus_trap, fadvise_dontneed
...@@ -189,7 +189,7 @@ class DF: ...@@ -189,7 +189,7 @@ class DF:
dF.byfile = {} dF.byfile = {}
# DFile represents a change to one file. # DFile represents a change to one file.
# it is is similar to ΔFile in wcfs.go . # it is similar to ΔFile in wcfs.go .
class DFile: class DFile:
# .rev tid # .rev tid
# .ddata {} blk -> data # .ddata {} blk -> data
...@@ -951,7 +951,8 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None): # -> []event(str) ...@@ -951,7 +951,8 @@ def doCheckingPin(f, pinokByWLink, pinfunc=None): # -> []event(str)
except Exception as e: except Exception as e:
if e is context.canceled: if e is context.canceled:
return # cancel is expected after f completes return # cancel is expected after f completes
reraise(e, None, e.__traceback__) #reraise(e, None, e.__traceback__)
raise
fail("extra pin message received: %r" % req.msg) fail("extra pin message received: %r" % req.msg)
wg.go(_, wlink, zf, pinok) wg.go(_, wlink, zf, pinok)
......
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