Skip to content

Commit 7005595

Browse files
Add explicit syntax for borrowing a reference from a wrapped PyObject*.
1 parent 58082f7 commit 7005595

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

dynd/include/utility_functions.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ class py_ref_tmpl {
361361

362362
// Check if the wrapped pointer is null.
363363
bool is_null() noexcept { return o != nullptr; }
364+
365+
py_ref_tmpl<false, not_null> borrow() noexcept { return py_ref<false, not_null>(o, false); }
364366
};
365367

366368
// Convenience aliases for the templated smart pointer classes.

0 commit comments

Comments
 (0)