@@ -1572,7 +1572,7 @@ internal unsafe static extern int
1572
1572
1573
1573
[ DllImport( Runtime . dll , CallingConvention = CallingConvention . Cdecl,
1574
1574
ExactSpelling = true, CharSet = CharSet . Unicode ) ]
1575
- internal unsafe static extern char *
1575
+ internal unsafe static extern IntPtr
1576
1576
PyUnicode_AsUnicode( IntPtr ob ) ;
1577
1577
1578
1578
[ DllImport( Runtime . dll , CallingConvention = CallingConvention . Cdecl,
@@ -1613,7 +1613,7 @@ internal unsafe static extern int
1613
1613
[ DllImport( Runtime . dll , CallingConvention = CallingConvention . Cdecl,
1614
1614
EntryPoint = "PyUnicodeUCS2_AsUnicode ",
1615
1615
ExactSpelling = true) ]
1616
- internal unsafe static extern char *
1616
+ internal unsafe static extern IntPtr
1617
1617
PyUnicode_AsUnicode( IntPtr ob ) ;
1618
1618
1619
1619
[ DllImport( Runtime . dll , CallingConvention = CallingConvention . Cdecl,
@@ -1749,9 +1749,9 @@ internal unsafe static string GetManagedString(IntPtr op)
1749
1749
Marshal . Copy ( p , buffer , 0 , size ) ;
1750
1750
return Encoding . UTF32 . GetString ( buffer , 0 , size ) ;
1751
1751
#elif UCS2
1752
- char * p = Runtime . PyUnicode_AsUnicode ( op ) ;
1753
- int size = Runtime. PyUnicode_GetSize( op ) ;
1754
- return new String ( p , 0 , size ) ;
1752
+ IntPtr p = Runtime . PyUnicode_AsUnicode ( op ) ;
1753
+ int length = Runtime. PyUnicode_GetSize( op ) ;
1754
+ return Marshal . PtrToStringUni ( p , length ) ;
1755
1755
#endif
1756
1756
}
1757
1757
0 commit comments