- Notifications
You must be signed in to change notification settings - Fork750
Allow borrowing from NewReference#1088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Allow borrowing from NewReference#1088
Uh oh!
There was an error while loading.Please reload this page.
Conversation
implemented as an implicit conversion
codecov-io commentedMar 11, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #1088 +/- ##======================================= Coverage 86.75% 86.75% ======================================= Files 1 1 Lines 302 302 ======================================= Hits 262 262 Misses 40 40
Continue to review full report at Codecov.
|
@amos402 can you review this? |
Uh oh!
There was an error while loading.Please reload this page.
implemented as an implicit conversion
To be honest, I would prefer an explicit
NewReference.Borrow()
method due to "explicit is better than implicit" motto. The only problem with implicit conversion that I see isnew PyObject(newRef)
will call an extra incref implicitly as opposed tonewRef.MoveToPyObject()
, and will go unnoticed.Another thing to consider is having a
null
-check in the conversion. E.g. should we throwNullReferenceException
ifNewReference
isnull
?Does this close any currently open issues?
Related to#1087
Checklist
Check all those that are applicable and complete.