-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
uctypes: Getting (numeric) value of uctypes.PTR object #4084
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
So, by now, I guess I discounted p.2 completely, it's just not worth going for such hacks. And I lean towards p.1. That's definitely cleaner and easier to grasp. P.1 may seem surprising, given my firm anti-bloat position, but actually, it's pretty logical too: there wouldn't be too much code difference implementing p.1 and p.3, but p.1 may benefit more code. That however would be user code, as I can't imagine what else could use However, one concern re: anti-bloat is that adding of support for |
Besides, the right way to do it is apparently not to go to look up |
In this regard, one of the way to implement getting a numeric value without any infra changes would be to use MP_UNARY_OP_POSITIVE: Besides, at the conception of uctypes, I pondered of overriding unary plus as a means of dereferencing a pointer, so |
Patch for |
The above PR was merged. |
RGBMatrix: change default to serpentine=True
uctypes has a few whitespots/goofs which need to be fixed, most of them are more or less clear, but here's one which needs discussion trail.
So, if there's a uctypes object of type uctypes.PTR (apparently gotten as a field of a structure), how to get its (i.e. address it points to) as integer? That's currently not supported. Ideas are:
(Let the
s
being containing structure andptr
a pointer field in it.)int(s.ptr)
.s.ptr.val
ors.ptr.value()
.Discussion:
__int__
special method, we have No int conversion for int-derived types available #1782 on that.The text was updated successfully, but these errors were encountered: