diff --git a/folly/python/iobuf.pxd b/folly/python/iobuf.pxd index f1ebbf177e6..34ab5455dc9 100644 --- a/folly/python/iobuf.pxd +++ b/folly/python/iobuf.pxd @@ -32,6 +32,7 @@ cdef extern from "folly/io/IOBuf.h" namespace "folly": size_t countChainElements() uint64_t computeChainDataLength() unique_ptr[cIOBuf] clone() + unique_ptr[cIOBuf] cloneCoalesced() cIOBuf* prev() cIOBuf* next() void insertAfterThisOne(unique_ptr[cIOBuf]&& ciobuf) diff --git a/folly/python/iobuf.pyi b/folly/python/iobuf.pyi index 0893c1cdf31..df2d4ae716c 100644 --- a/folly/python/iobuf.pyi +++ b/folly/python/iobuf.pyi @@ -18,6 +18,7 @@ class IOBuf(Hashable): def __init__(self, buffer: Union[IOBuf, bytes, bytearray, memoryview]) -> None: ... def writable(self) -> bool: ... def clone(self) -> IOBuf: ... + def cloneCoalesced(self) -> IOBuf: ... @property def next(self) -> Optional[IOBuf]: ... @property diff --git a/folly/python/iobuf.pyx b/folly/python/iobuf.pyx index 046f30d56b0..044921b94fa 100644 --- a/folly/python/iobuf.pyx +++ b/folly/python/iobuf.pyx @@ -103,6 +103,10 @@ cdef class IOBuf: """ Clone the iobuf chain """ return from_unique_ptr(self._this.clone()) + def cloneCoalesced(self): + """ Clone the iobuf chain """ + return from_unique_ptr(self._this.cloneCoalesced()) + @property def next(self): _next = self._this.next()