-
Notifications
You must be signed in to change notification settings - Fork 565
Get uv_loop_t pointer #307
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
Comments
I have experimented with passing a Loop object to my extension, accessing the PyTypeObject, confirming the tp_name and tp_itemsize. From there I planned on accessing the uv_loop_t pointer from the PyObject (the loop pointer looks to be at the top of the object?) but I don't think I have the correct pointer yet. I'm not so sure about how this Cython language works. Any hints? |
You can probably add a getter like this in
You can then call it and cast the returned int to a pointer. |
I've been looking for this functionality too! @alexhultman I can pass in a PR for this if you'd like |
Please make it PyCapsule_New(ptr, NULL, NULL) instead so it becomes a proper thing. https://docs.python.org/3/c-api/capsule.html Python capsules are like Extern in V8, they are objects that hold raw pointers. Then any extension can PyCapsule_GetPointer that thing |
def get_uvloop_ptr(self):
return PyCapsule_New(<void *>self.uvloop, NULL, NULL) I guess that's correct? |
I actually end up doing this:
where This works for me, but it could still be useful to also have uvloop.get_loop_ptr() |
Fixed in #310 |
Hello,
For integration purposes I need to get the current underlying uv_loop_t pointer, preferably as a PyCapsule, from uvloop. I need that pointer for use by my python extension and for it to seamlessly integrate with asyncio scripts.
Do you think you could add such a function, or point me in the direction where I can add it? It should be a minimal change.
The text was updated successfully, but these errors were encountered: