1
- using System ;
2
-
3
- namespace Python . Runtime
1
+ namespace Python . Runtime . Interop
4
2
{
3
+ using System ;
5
4
using System . Reflection ;
6
5
using System . Runtime . InteropServices ;
7
6
7
+ using JetBrains . Annotations ;
8
+
8
9
#if ( PYTHON32 || PYTHON33 || PYTHON34 || PYTHON35 )
9
10
[ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Ansi ) ]
11
+ [ NoReorder ]
10
12
internal class BytesOffset
11
13
{
12
14
static BytesOffset ( )
13
15
{
14
- Type type = typeof ( BytesOffset ) ;
15
- FieldInfo [ ] fi = type . GetFields ( ) ;
16
- int size = IntPtr . Size ;
17
- for ( int i = 0 ; i < fi . Length ; i ++ )
16
+ var type = typeof ( BytesOffset ) ;
17
+ var fi = type . GetFields ( ) ;
18
+ var size = IntPtr . Size ;
19
+ for ( var i = 0 ; i < fi . Length ; i ++ )
18
20
{
19
21
fi [ i ] . SetValue ( null , i * size ) ;
20
22
}
21
23
}
22
24
23
25
/* The *real* layout of a type object when allocated on the heap */
24
26
//typedef struct _heaptypeobject {
25
- #if ( Py_DEBUG ) // #ifdef Py_TRACE_REFS
27
+ #if ( Py_DEBUG ) // #ifdef Py_TRACE_REFS
26
28
/* _PyObject_HEAD_EXTRA defines pointers to support a doubly-linked list of all live heap objects. */
27
29
public static int _ob_next = 0 ;
28
30
public static int _ob_prev = 0 ;
29
31
#endif
30
32
// PyObject_VAR_HEAD {
31
33
// PyObject_HEAD {
32
34
public static int ob_refcnt = 0 ;
35
+
33
36
public static int ob_type = 0 ;
37
+
34
38
// }
35
- public static int ob_size = 0 ; /* Number of items in _VAR_iable part */
39
+ public static int ob_size = 0 ; /* Number of items in _VAR_iable part */
40
+
36
41
// }
37
42
public static int ob_shash = 0 ;
43
+
38
44
public static int ob_sval = 0 ; /* start of data */
39
45
40
46
/* Invariants:
@@ -45,4 +51,4 @@ static BytesOffset()
45
51
//} PyBytesObject;
46
52
}
47
53
#endif
48
- }
54
+ }
0 commit comments