File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
1
namespace Python . Runtime
2
2
{
3
3
using System ;
4
- ref struct BorrowedReference
4
+ readonly ref struct BorrowedReference
5
5
{
6
- public IntPtr Pointer ;
6
+ public readonly IntPtr Pointer ;
7
7
public bool IsNull => this . Pointer == IntPtr . Zero ;
8
8
9
9
public PyObject ToPyObject ( )
@@ -13,13 +13,14 @@ public PyObject ToPyObject()
13
13
Runtime . XIncref ( this . Pointer ) ;
14
14
return new PyObject ( this . Pointer ) ;
15
15
}
16
- }
17
16
18
- static class BorrowedReferenceExtensions {
19
17
[ Obsolete ( "Use overloads, that take BorrowedReference or NewReference" ) ]
20
- public static IntPtr DangerousGetAddress ( this in BorrowedReference reference )
21
- => reference . IsNull ( ) ? throw new NullReferenceException ( ) : reference . Pointer ;
22
- public static bool IsNull ( this in BorrowedReference reference )
23
- => reference . Pointer == IntPtr . Zero ;
18
+ public IntPtr DangerousGetAddress ( )
19
+ => this . IsNull ? throw new NullReferenceException ( ) : this . Pointer ;
20
+
21
+ BorrowedReference ( IntPtr pointer )
22
+ {
23
+ this . Pointer = pointer ;
24
+ }
24
25
}
25
26
}
You can’t perform that action at this time.
0 commit comments