@@ -1243,19 +1243,23 @@ internal static bool PyUnicode_Check(IntPtr ob)
1243
1243
return PyObject_TYPE( ob) == PyUnicodeType;
1244
1244
}
1245
1245
1246
- #if UCS2 && PYTHON3
1246
+ #if PYTHON3
1247
1247
[ DllImport ( PythonDll ) ]
1248
1248
internal static extern IntPtr PyUnicode_FromObject( IntPtr ob ) ;
1249
1249
1250
1250
[ DllImport( PythonDll ) ]
1251
1251
internal static extern IntPtr PyUnicode_FromEncodedObject( IntPtr ob , IntPtr enc , IntPtr err ) ;
1252
1252
1253
- [ DllImport ( PythonDll , EntryPoint = "PyUnicode_FromKindAndData ", CharSet = CharSet . Unicode ) ]
1254
- internal static extern IntPtr PyUnicode_FromKindAndString( int kind , string s , int size ) ;
1253
+ [ DllImport ( PythonDll , EntryPoint = "PyUnicode_FromKindAndData ") ]
1254
+ internal static extern IntPtr PyUnicode_FromKindAndString(
1255
+ int kind ,
1256
+ [ MarshalAs ( UnmanagedType . CustomMarshaler , MarshalTypeRef = typeof ( StrMarshaler ) ) ] string s,
1257
+ int size
1258
+ ) ;
1255
1259
1256
1260
internal static IntPtr PyUnicode_FromUnicode( string s , int size )
1257
1261
{
1258
- return PyUnicode_FromKindAndString ( 2 , s , size ) ;
1262
+ return PyUnicode_FromKindAndString ( UCS , s , size ) ;
1259
1263
}
1260
1264
1261
1265
[ DllImport ( PythonDll ) ]
@@ -1284,33 +1288,6 @@ internal static IntPtr PyUnicode_FromUnicode(string s, int size)
1284
1288
1285
1289
[ DllImport( PythonDll , EntryPoint = "PyUnicodeUCS2_FromOrdinal ") ]
1286
1290
internal static extern IntPtr PyUnicode_FromOrdinal( int c ) ;
1287
- #elif UCS4 && PYTHON3
1288
- [ DllImport ( PythonDll ) ]
1289
- internal static extern IntPtr PyUnicode_FromObject( IntPtr ob ) ;
1290
-
1291
- [ DllImport( PythonDll ) ]
1292
- internal static extern IntPtr PyUnicode_FromEncodedObject( IntPtr ob , IntPtr enc , IntPtr err ) ;
1293
-
1294
- [ DllImport ( PythonDll , EntryPoint = "PyUnicode_FromKindAndData ") ]
1295
- internal static extern IntPtr PyUnicode_FromKindAndString(
1296
- int kind ,
1297
- [ MarshalAs ( UnmanagedType . CustomMarshaler , MarshalTypeRef = typeof ( StrMarshaler ) ) ] string s,
1298
- int size
1299
- ) ;
1300
-
1301
- internal static IntPtr PyUnicode_FromUnicode( string s , int size )
1302
- {
1303
- return PyUnicode_FromKindAndString ( 4 , s , size ) ;
1304
- }
1305
-
1306
- [ DllImport ( PythonDll ) ]
1307
- internal static extern int PyUnicode_GetSize( IntPtr ob) ;
1308
-
1309
- [ DllImport( PythonDll) ]
1310
- internal static extern IntPtr PyUnicode_AsUnicode( IntPtr ob) ;
1311
-
1312
- [ DllImport( PythonDll) ]
1313
- internal static extern IntPtr PyUnicode_FromOrdinal( int c) ;
1314
1291
#elif UCS4 && PYTHON2
1315
1292
[ DllImport ( PythonDll , EntryPoint = "PyUnicodeUCS4_FromObject" ) ]
1316
1293
internal static extern IntPtr PyUnicode_FromObject( IntPtr ob ) ;
0 commit comments