https://pantsbuild.org/ logo
a

average-vr-56795

09/10/2019, 4:34 PM
@witty-crayon-22786 Why does
scheduler_create
returns a raw pointer not a
Handle
wrapping the pointer?
Context: https://github.com/pantsbuild/pants/pull/8275 has a massive TODO because of that question
w

witty-crayon-22786

09/10/2019, 5:18 PM
hm... just historical reasons, i think?
it was probably the absolute first method that existed
oh. wait. no
it returns a raw pointer because it is not a python object
to return a Handle you'd have to "convert" it into a python object
a

average-vr-56795

09/10/2019, 5:19 PM
Ok, so for that PR I should probably make a one off
NonPyResult
that happens to be layout-identical to
PyResult
?
w

witty-crayon-22786

09/10/2019, 5:19 PM
or use some other C calling convention... yea, i think so.
a

average-vr-56795

09/10/2019, 5:20 PM
Cool, will do 🙂 Thanks!
w

witty-crayon-22786

09/10/2019, 5:20 PM
although, i don't know if
NonPyResult
would be generic, unfortunately.
a

average-vr-56795

09/10/2019, 5:21 PM
I’m imagining:
Copy code
struct NonPyResult {
  is_throw: bool,
  throw: Option<Handle>,
  pointer: Option<*const raw::c_void>,
}
w

witty-crayon-22786

09/10/2019, 5:21 PM
RawResult
or something.
yea
a

average-vr-56795

09/10/2019, 5:36 PM
Pushed - please review at your convenience!
w

witty-crayon-22786

09/10/2019, 5:44 PM
@average-vr-56795: commented
(two comments)