File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -387,14 +387,18 @@ class py_ref_t {
387
387
// Return a wrapped borrowed reference to the wrapped reference.
388
388
py_ref_t <false , not_null> borrow () noexcept
389
389
{
390
+ // Assert that the wrapped pointer is not null if it shouldn't be.
391
+ PYDYND_ASSERT_IF (not_null, o != nullptr );
390
392
// Assert that the wrapped reference is actually valid if it isn't null.
391
393
PYDYND_ASSERT_IF (o != nullptr , Py_REFCNT (o) > 0 );
392
394
return py_ref_t <false , not_null>(o, false );
393
395
}
394
396
395
397
// Return a wrapped owned reference referring to the currently wrapped reference.
396
- py_ref_t <true , not_null> borrow () noexcept
398
+ py_ref_t <true , not_null> new_ownref () noexcept
397
399
{
400
+ // Assert that the wrapped pointer is not null if it shouldn't be.
401
+ PYDYND_ASSERT_IF (not_null, o != nullptr );
398
402
// Assert that the wrapped reference is actually valid if it isn't null.
399
403
PYDYND_ASSERT_IF (o != nullptr , Py_REFCNT (o) > 0 );
400
404
return py_ref_t <true , not_null>(o, false );
You can’t perform that action at this time.
0 commit comments