On Fri, Jun 13, 2014 at 11:08 AM, Pieter Hintjens <[email protected]> wrote:
> On Fri, Jun 13, 2014 at 7:55 PM, Michel Pelletier > <[email protected]> wrote: > > > Some gdb adventures shows I was calling zsock_new with filename and > line_nbr > > args defaulting to NULL and 0 out of sheer laziness. > > That should actually work... it's usually what you'd do in release > mode with all socket tracking switched off. > Yeah that's what I was thinking when I wrote it. Python can't know how czmq was compiled with ZSOCK_NOCHECK unless I expose it and that sounded ugly to me, so instead I have: @cdef('zsock_t * zsock_new_ (int type, const char *filename, size_t line_nbr);') def new(type, filename=None, line_nbr=None): if filename is None: frame = inspect.stack()[1][0] info = inspect.getframeinfo(frame) filename = info.filename line_nbr = info.lineno return ffi.gc(C.zsock_new_(type, filename, line_nbr), destroy) Which sidesteps the issue by calling zsock_new_ directly with file and line information from the frame's caller. I don't think __FILE__ and __LINE__ would be useful to a pyczmq user, as it would end up referencing a generated C file internal to CFFI. -Michel
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
