Skip to content

Commit d24d353

Browse files
committed
Maya Bindings : Use Py3 compatible string API
I believe PyBytes_* was available in Py2 as well
1 parent 7afe273 commit d24d353

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/IECoreMaya/bindings/MDagPathFromPython.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct MDagPathFromPython
4949
{
5050
static void *convertible( PyObject *obj )
5151
{
52-
if( PyUnicode_Check( obj ) || PyString_Check( obj ) )
52+
if( PyUnicode_Check( obj ) || PyBytes_Check( obj ) )
5353
{
5454
return obj;
5555
}
@@ -68,12 +68,12 @@ struct MDagPathFromPython
6868
if( PyUnicode_Check( obj ) )
6969
{
7070
PyObject *ascii = PyUnicode_AsASCIIString( obj );
71-
name = PyString_AsString( ascii );
71+
name = PyBytes_AsString( ascii );
7272
Py_DECREF( ascii );
7373
}
7474
else
7575
{
76-
name = PyString_AsString( obj );
76+
name = PyBytes_AsString( obj );
7777
}
7878

7979
MSelectionList s;

src/IECoreMaya/bindings/MObjectFromPython.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct MObjectFromPython
4949
{
5050
static void *convertible( PyObject *obj )
5151
{
52-
if( PyUnicode_Check( obj ) || PyString_Check( obj ) )
52+
if( PyUnicode_Check( obj ) || PyBytes_Check( obj ) )
5353
{
5454
return obj;
5555
}
@@ -68,12 +68,12 @@ struct MObjectFromPython
6868
if( PyUnicode_Check( obj ) )
6969
{
7070
PyObject *ascii = PyUnicode_AsASCIIString( obj );
71-
objectName = PyString_AsString( ascii );
71+
objectName = PyBytes_AsString( ascii );
7272
Py_DECREF( ascii );
7373
}
7474
else
7575
{
76-
objectName = PyString_AsString( obj );
76+
objectName = PyBytes_AsString( obj );
7777
}
7878

7979
MSelectionList s;

src/IECoreMaya/bindings/MPlugFromPython.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct MPlugFromPython
4949
{
5050
static void *convertible( PyObject *obj )
5151
{
52-
if( PyUnicode_Check( obj ) || PyString_Check( obj ) )
52+
if( PyUnicode_Check( obj ) || PyBytes_Check( obj ) )
5353
{
5454
return obj;
5555
}
@@ -68,12 +68,12 @@ struct MPlugFromPython
6868
if( PyUnicode_Check( obj ) )
6969
{
7070
PyObject *ascii = PyUnicode_AsASCIIString( obj );
71-
plugName = PyString_AsString( ascii );
71+
plugName = PyBytes_AsString( ascii );
7272
Py_DECREF( ascii );
7373
}
7474
else
7575
{
76-
plugName = PyString_AsString( obj );
76+
plugName = PyBytes_AsString( obj );
7777
}
7878

7979
MSelectionList s;

src/IECoreMaya/bindings/MStringFromPython.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct MStringFromPython
4848
{
4949
static void *convertible( PyObject *obj )
5050
{
51-
if( PyUnicode_Check( obj ) || PyString_Check( obj ) )
51+
if( PyUnicode_Check( obj ) || PyBytes_Check( obj ) )
5252
{
5353
return obj;
5454
}
@@ -67,12 +67,12 @@ struct MStringFromPython
6767
if( PyUnicode_Check( obj ) )
6868
{
6969
PyObject *ascii = PyUnicode_AsASCIIString( obj );
70-
new (storage) MString( PyString_AsString( ascii ) );
70+
new (storage) MString( PyBytes_AsString( ascii ) );
7171
Py_DECREF( ascii );
7272
}
7373
else
7474
{
75-
new (storage) MString( PyString_AsString( obj ) );
75+
new (storage) MString( PyBytes_AsString( obj ) );
7676
}
7777

7878
data->convertible = storage;

0 commit comments

Comments
 (0)