Skip to content

Commit

Permalink
EXPERIMENTAL: Support capnp 1.0
Browse files Browse the repository at this point in the history
Adapt pycapnp to work with capnp 1.0.
The breaking change is that allowCancellation is removed
from the CallContext since its now defined in the schema.

TODO: Not sure how one can inject the version of capnp during
compiletime best ...
  • Loading branch information
tobiasah committed Oct 4, 2023
1 parent 3e182ef commit 0e420d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ docs/_build

capnp/lib/capnp.cpp
capnp/lib/capnp.h
capnp/lib/capnp_api.h
bundled/
example
*.iml
Expand Down
2 changes: 1 addition & 1 deletion buildutils/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#


bundled_version = (0, 10, 3)
bundled_version = (1, 0, 1)
libcapnp_name = "capnproto-c++-%i.%i.%i.tar.gz" % (bundled_version)
libcapnp_url = "https://capnproto.org/" + libcapnp_name

Expand Down
8 changes: 6 additions & 2 deletions capnp/lib/capnp.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,11 @@ cdef class _CallContext:
self.thisptr.releaseParams()

cpdef allow_cancellation(self):
self.thisptr.allowCancellation()
_warnings.warn(
"The allowCancellation method has been replaced by the allowCancellation "
"annotation in the in schema. The call to this method has no effect any "
"more."
)

cpdef tail_call(self, _Request tailRequest):
return _voidpromise_to_asyncio(self.thisptr.tailCall(move(deref(tailRequest.thisptr_child))))
Expand Down Expand Up @@ -2426,7 +2430,7 @@ cdef class _PyAsyncIoStreamProtocol(DummyBaseClass, asyncio.BufferedProtocol):

# State for reading data from the transport
cdef char* read_buffer
cdef size_t read_min_bytes
cdef int32_t read_min_bytes
cdef size_t read_max_bytes
cdef size_t read_already_read
cdef PromiseFulfiller[size_t]* read_fulfiller
Expand Down

0 comments on commit 0e420d1

Please sign in to comment.