Closed jjtolton closed 1 year ago
Maybe this fixes one case, but this line is still wrong:
(and I had the NPE on this line)
Whenever this line is used with an empty map, there will be an NPE.
It is easily fixed, by doing:
"__iter__" (as-tuple-instance-fn #(.iterator ^Iterable (or (keys (self->map %1)) [] )))
It is easily fixed, by doing:
"__iter__" (as-tuple-instance-fn #(.iterator ^Iterable (or (keys (self->map %1)) [] )))
Well it doesn't crash any tests so I don't see why not. I'll move the autocasting to a different issue.
The question here is do you always want to completely copy all data into the python and is that even possible. The system is setup to allow large objects that may not have a full python representation to be bridged. @behrica's fix still allows this while this fix will cause at least some things that did work before to fail as the entire JVM object may not be copyable to python.
The tradeoff is that copying may be both more robust and faster in a lot of cases as then Python functions down the line deal with native Python objects and not bridged objects. As it is users can manually call as-python or ->python to choose which they want but I think this fix
causes the as-python pathway to attempt a complete conversion which I don't like.
@cnuernber makes good points, closing
Autocasting args of
py{*}
family of macros to python viapy/->python