New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
does 'Frame' object support buffer interface? #719
Comments
@liuyangc3 Frame does provide the buffer interface. Here's a test script: import sys
import zmq
import msgpack
print(sys.version)
print("libzmq-%s" % zmq.zmq_version())
print("pyzmq-%s" % zmq.pyzmq_version())
print("msgpack-%s" % ('.'.join(map(str, msgpack.version))))
ctx = zmq.Context.instance()
a = ctx.socket(zmq.PAIR)
a.bind('inproc://a')
b = ctx.socket(zmq.PAIR)
b.connect('inproc://a')
d = {'a': 5}
a.send(msgpack.packb(d))
frame = b.recv(copy=False)
print("Trying msgpack.unpackb on %r" % frame)
d2 = msgpack.unpackb(frame)
assert d2 == d, "Failed"
print("Success") Which gives:
for me |
@minrk your test script works with
For
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I am using zerorpc with Python2.6 on a CentOS 6.5
I just followed the http://www.zerorpc.io/ demo and the server side got this
zerorpc use msgpack to serialize object , and , debug from IDE , found that the argument blob in unpacker.feed(blob) is class 'zmq.sugar.frame.Frame'
here is the msgpack feed() function
https://github.com/msgpack/msgpack-python/blob/master/msgpack/_unpacker.pyx#L318
it use a C API get buffer from object
and here is what I found in /usr/lib64/python2.6/site-packages/zmq/backend/cython/message.pxd
seems that Frame object supoort Python Buffer interface
I am confused why feed() failed in getting buffer? Can anyone explan it?
Thanks.
The text was updated successfully, but these errors were encountered: