Skip to content

Commit def66bf

Browse files
committed
IECorePython : Remove Python 2 support
1 parent cbeec90 commit def66bf

File tree

5 files changed

+3
-170
lines changed

5 files changed

+3
-170
lines changed

include/IECorePython/UnicodeToStringBinding.h

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/IECorePython/InternedStringBinding.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ struct InternedStringFromPython
6161

6262
static void *convertible( PyObject *obj_ptr )
6363
{
64-
#if PY_MAJOR_VERSION >= 3
6564
if ( !PyUnicode_Check( obj_ptr ) )
66-
#else
67-
if ( !PyString_Check( obj_ptr ) )
68-
#endif
6965
{
7066
return nullptr;
7167
}
@@ -79,14 +75,9 @@ struct InternedStringFromPython
7975
assert( obj_ptr );
8076

8177
void* storage = (( converter::rvalue_from_python_storage<InternedString>* ) data )->storage.bytes;
82-
#if PY_MAJOR_VERSION >= 3
8378
Py_ssize_t size;
8479
const char *c = PyUnicode_AsUTF8AndSize( obj_ptr, &size );
8580
new( storage ) InternedString( c, size );
86-
#else
87-
assert( PyString_Check( obj_ptr ) );
88-
new( storage ) InternedString( PyString_AsString( obj_ptr ) );
89-
#endif
9081
data->convertible = storage;
9182
}
9283
};

src/IECorePython/SimpleTypedDataBinding.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636

3737
#include "boost/python.hpp"
3838

39-
#include "patchlevel.h" // For PY_MAJOR_VERSION
40-
4139
#include "IECorePython/SimpleTypedDataBinding.h"
4240

4341
#include "IECorePython/GeometricTypedDataBinding.h"
@@ -317,12 +315,6 @@ static void bindNumericMethods( RunTimeTypedClass<T> &c )
317315
void bindAllSimpleTypedData()
318316
{
319317

320-
#if PY_MAJOR_VERSION > 2
321-
const char *longOperatorName = "__int__";
322-
#else
323-
const char *longOperatorName = "__long__";
324-
#endif
325-
326318
RunTimeTypedClass<StringData> sdc = bindSimpleData<StringData>();
327319
sdc.def( "__lt__", &lessThan<StringData> );
328320
sdc.def( "__le__", &lessThanOrEqualTo<StringData> );
@@ -339,7 +331,7 @@ void bindAllSimpleTypedData()
339331

340332
RunTimeTypedClass<UIntData> uidc = bindSimpleData<UIntData>();
341333
bindNumericMethods( uidc );
342-
uidc.def( longOperatorName, &getValue<UIntData> );
334+
uidc.def( "__int__", &getValue<UIntData> );
343335

344336
RunTimeTypedClass<FloatData > fdc = bindSimpleData<FloatData>();
345337
bindNumericMethods( fdc );
@@ -371,11 +363,11 @@ void bindAllSimpleTypedData()
371363

372364
RunTimeTypedClass<Int64Data> i64dc = bindSimpleData<Int64Data>();
373365
bindNumericMethods( i64dc );
374-
i64dc.def( longOperatorName, &getValue<Int64Data> );
366+
i64dc.def( "__int__", &getValue<Int64Data> );
375367

376368
RunTimeTypedClass<UInt64Data> ui64dc = bindSimpleData<UInt64Data>();
377369
bindNumericMethods( ui64dc );
378-
ui64dc.def( longOperatorName, &getValue<UInt64Data> );
370+
ui64dc.def( "__int__", &getValue<UInt64Data> );
379371

380372
bindSimpleData<Color3fData>();
381373
bindSimpleData<Color4fData>();

src/IECorePython/UnicodeToStringBinding.cpp

Lines changed: 0 additions & 103 deletions
This file was deleted.

src/IECorePythonModule/IECore.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@
110110
#include "IECorePython/BezierAlgoBinding.h"
111111
#include "IECorePython/ToCoreConverterBinding.h"
112112
#include "IECorePython/PolygonAlgoBinding.h"
113-
#include "IECorePython/UnicodeToStringBinding.h"
114113
#include "IECorePython/RadixSortBinding.h"
115114
#include "IECorePython/AngleConversionBinding.h"
116115
#include "IECorePython/SplineBinding.h"
@@ -259,7 +258,6 @@ BOOST_PYTHON_MODULE(_IECore)
259258
bindBezierAlgo();
260259
bindToCoreConverter();
261260
bindPolygonAlgo();
262-
bindUnicodeToString();
263261
bindRadixSort();
264262
bindAngleConversion();
265263
bindSpline();

0 commit comments

Comments
 (0)