-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,6 +256,9 @@ class cpp_function : public function { | |
/// Register a function call with Python (generic non-templated code goes here) | ||
void initialize_generic(unique_function_record &&unique_rec, const char *text, | ||
const std::type_info *const *types, size_t args) { | ||
// Do NOT receive `unique_rec` by value. If this function fails to steal the unique_ptr then | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
YannickJadoul
Author
Collaborator
|
||
// we do not want this to destuct the pointer. `initialize` (the caller) still relies on the | ||
// pointee being alive after this call. Only steal if a `capsule` is going to keep it alive. | ||
auto rec = unique_rec.get(); | ||
|
||
// Keep track of strdup'ed strings, and clean them up as long as the function's capsule | ||
|
Nit: maybe use "move" here instead of "steal"? To use proper std terms.