BGE Py API using python3 c/api calls. include bpy_compat.h to support py2.x
authorCampbell Barton <ideasman42@gmail.com>
Mon, 29 Jun 2009 02:25:54 +0000 (02:25 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 29 Jun 2009 02:25:54 +0000 (02:25 +0000)
66 files changed:
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Expressions/BoolValue.cpp
source/gameengine/Expressions/IntValue.cpp
source/gameengine/Expressions/ListValue.cpp
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/Expressions/StringValue.h
source/gameengine/Expressions/Value.cpp
source/gameengine/Expressions/Value.h
source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
source/gameengine/GameLogic/SCA_DelaySensor.cpp
source/gameengine/GameLogic/SCA_IController.cpp
source/gameengine/GameLogic/SCA_ILogicBrick.cpp
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_MouseSensor.cpp
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GameLogic/SCA_RandomSensor.cpp
source/gameengine/Ketsji/BL_Shader.cpp
source/gameengine/Ketsji/BL_Shader.h
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.h
source/gameengine/Ketsji/KX_CDActuator.cpp
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_CameraActuator.cpp
source/gameengine/Ketsji/KX_ConstraintActuator.cpp
source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
source/gameengine/Ketsji/KX_GameActuator.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/Ketsji/KX_Light.cpp
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_ObjectActuator.cpp
source/gameengine/Ketsji/KX_ParentActuator.cpp
source/gameengine/Ketsji/KX_PolyProxy.cpp
source/gameengine/Ketsji/KX_PolygonMaterial.cpp
source/gameengine/Ketsji/KX_PolygonMaterial.h
source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_PythonSeq.cpp
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_Scene.h
source/gameengine/Ketsji/KX_SceneActuator.cpp
source/gameengine/Ketsji/KX_SoundActuator.cpp
source/gameengine/Ketsji/KX_TouchSensor.cpp
source/gameengine/Ketsji/KX_TrackToActuator.cpp
source/gameengine/Ketsji/KX_VehicleWrapper.cpp
source/gameengine/Ketsji/KX_VertexProxy.cpp
source/gameengine/VideoTexture/FilterBlueScreen.cpp
source/gameengine/VideoTexture/FilterColor.cpp
source/gameengine/VideoTexture/FilterNormal.cpp
source/gameengine/VideoTexture/ImageRender.cpp
source/gameengine/VideoTexture/ImageViewport.cpp
source/gameengine/VideoTexture/VideoBase.cpp
source/gameengine/VideoTexture/VideoFFmpeg.cpp
source/gameengine/VideoTexture/blendVideoTex.cpp

index 1787909b06499217ddaa9575a5fd4cab22526867..d9e65c53face1c013ab00a737f3617532a499739 100644 (file)
@@ -446,7 +446,7 @@ PyObject* BL_ActionActuator::PyGetAction(PyObject* args,
        ShowDeprecationWarning("getAction()", "the action property");
 
        if (m_action){
-               return PyString_FromString(m_action->id.name+2);
+               return PyUnicode_FromString(m_action->id.name+2);
        }
        Py_RETURN_NONE;
 }
@@ -796,7 +796,7 @@ PyObject* BL_ActionActuator::PySetFrameProperty(PyObject* args,
 }
 
 PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) {
-       char *string= PyString_AsString(value);
+       char *string= _PyUnicode_AsString(value);
        
        if (!string) {
                PyErr_SetString(PyExc_TypeError, "expected a single string");
@@ -888,7 +888,7 @@ PyObject* BL_ActionActuator::PySetType(PyObject* args,
 PyObject* BL_ActionActuator::PyGetContinue() {
        ShowDeprecationWarning("getContinue()", "the continue property");
 
-    return PyInt_FromLong((long)(m_end_reset==0));
+    return PyLong_FromSsize_t((long)(m_end_reset==0));
 }
 
 PyObject* BL_ActionActuator::PySetContinue(PyObject* value) {
@@ -1066,21 +1066,21 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
 PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
-       return PyString_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
+       return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
 }
 
 int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
        BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
        
-       if (!PyString_Check(value))
+       if (!PyUnicode_Check(value))
        {
                PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, expected the string name of the action");
                return PY_SET_ATTR_FAIL;
        }
 
        bAction *action= NULL;
-       STR_String val = PyString_AsString(value);
+       STR_String val = _PyUnicode_AsString(value);
        
        if (val != "")
        {
index b92e94b6e0448afabc7699d88aef1d2c7592303b..4c9a584d72b8b641949410c27f7d0fc3cb14cef4 100644 (file)
@@ -486,7 +486,7 @@ const char BL_ShapeActionActuator::GetAction_doc[] =
 PyObject* BL_ShapeActionActuator::PyGetAction() {
        ShowDeprecationWarning("getAction()", "the action property");
        if (m_action){
-               return PyString_FromString(m_action->id.name+2);
+               return PyUnicode_FromString(m_action->id.name+2);
        }
        Py_RETURN_NONE;
 }
@@ -845,21 +845,21 @@ PyObject* BL_ShapeActionActuator::PySetType(PyObject* args) {
 PyObject* BL_ShapeActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        BL_ShapeActionActuator* self= static_cast<BL_ShapeActionActuator*>(self_v);
-       return PyString_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
+       return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
 }
 
 int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
        BL_ShapeActionActuator* self= static_cast<BL_ShapeActionActuator*>(self_v);
        /* exact copy of BL_ActionActuator's function from here down */
-       if (!PyString_Check(value))
+       if (!PyUnicode_Check(value))
        {
                PyErr_SetString(PyExc_ValueError, "actuator.action = val: Shape Action Actuator, expected the string name of the action");
                return PY_SET_ATTR_FAIL;
        }
 
        bAction *action= NULL;
-       STR_String val = PyString_AsString(value);
+       STR_String val = _PyUnicode_AsString(value);
        
        if (val != "")
        {
index d90da8b3a920ecd665de4480bfde5b342f353eb7..1102b12fdc4994646db75ef2b3015dc4cc4737a7 100644 (file)
@@ -210,5 +210,5 @@ CValue* CBoolValue::GetReplica()
 
 PyObject* CBoolValue::ConvertValueToPython()
 {
-       return PyInt_FromLong(m_bool != 0);
+       return PyBool_FromLong(m_bool != 0);
 }
index 227518e9439af6f9d27d56959b122dc12efb6f36..b782de4bef6685139f3a812cf45f9990536f35eb 100644 (file)
@@ -330,7 +330,7 @@ void CIntValue::SetValue(CValue* newval)
 PyObject* CIntValue::ConvertValueToPython()
 {
        if((m_int > INT_MIN) && (m_int < INT_MAX))
-               return PyInt_FromLong(m_int);
+               return PyLong_FromSsize_t(m_int);
        else
                return PyLong_FromLongLong(m_int);
 }
index 4cad4728521d48fc9dbd02f84462197892b58b28..34a357aa5f10ed52691fdcdb7b564fedcbce4994 100644 (file)
@@ -76,9 +76,9 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
                return NULL;
        }
        
-       if (PyString_Check(pyindex))
+       if (PyUnicode_Check(pyindex))
        {
-               CValue *item = ((CListValue*) list)->FindValue(PyString_AsString(pyindex));
+               CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(pyindex));
                if (item) {
                        PyObject* pyobj = item->ConvertValueToPython();
                        if(pyobj)
@@ -87,14 +87,14 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
                                return item->GetProxy();
                }
        }
-       else if (PyInt_Check(pyindex))
+       else if (PyLong_Check(pyindex))
        {
-               int index = PyInt_AsLong(pyindex);
+               int index = PyLong_AsSsize_t(pyindex);
                return listvalue_buffer_item(self, index); /* wont add a ref */
        }
        
        PyObject *pyindex_str = PyObject_Repr(pyindex); /* new ref */
-       PyErr_Format(PyExc_KeyError, "CList[key]: '%s' key not in list", PyString_AsString(pyindex_str));
+       PyErr_Format(PyExc_KeyError, "CList[key]: '%s' key not in list", _PyUnicode_AsString(pyindex_str));
        Py_DECREF(pyindex_str);
        return NULL;
 }
@@ -220,8 +220,8 @@ static int listvalue_buffer_contains(PyObject *self_v, PyObject *value)
                return -1;
        }
        
-       if (PyString_Check(value)) {
-               if (self->FindValue((const char *)PyString_AsString(value))) {
+       if (PyUnicode_Check(value)) {
+               if (self->FindValue((const char *)_PyUnicode_AsString(value))) {
                        return 1;
                }
        }
@@ -542,7 +542,7 @@ PyObject* CListValue::Pyindex(PyObject *value)
                CValue* elem =                  GetValue(i);
                if (checkobj==elem || CheckEqual(checkobj,elem))
                {
-                       result = PyInt_FromLong(i);
+                       result = PyLong_FromSsize_t(i);
                        break;
                }
        }
@@ -565,7 +565,7 @@ PyObject* CListValue::Pycount(PyObject* value)
        
        if (checkobj==NULL) { /* in this case just return that there are no items in the list */
                PyErr_Clear();
-               return PyInt_FromLong(0);
+               return PyLong_FromSsize_t(0);
        }
 
        int numelem = GetCount();
@@ -579,7 +579,7 @@ PyObject* CListValue::Pycount(PyObject* value)
        }
        checkobj->Release();
 
-       return PyInt_FromLong(numfound);
+       return PyLong_FromSsize_t(numfound);
 }
 
 /* Matches python dict.get(key, [default]) */
@@ -606,7 +606,7 @@ PyObject* CListValue::Pyget(PyObject *args)
 /* Matches python dict.has_key() */
 PyObject* CListValue::Pyhas_key(PyObject* value)
 {
-       if (PyString_Check(value) && FindValue((const char *)PyString_AsString(value)))
+       if (PyUnicode_Check(value) && FindValue((const char *)_PyUnicode_AsString(value)))
                Py_RETURN_TRUE;
        
        Py_RETURN_FALSE;
index 552e839d2b8e46221c50debc68ca19265fc2a5e1..863390f209d83fe72c12bfbac87cc354f198a280 100644 (file)
@@ -183,14 +183,14 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
                                {
                                        bool *val = reinterpret_cast<bool*>(ptr);
                                        ptr += sizeof(bool);
-                                       PyList_SET_ITEM(resultlist,i,PyInt_FromLong(*val));
+                                       PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
                                        break;
                                }
                        case KX_PYATTRIBUTE_TYPE_SHORT:
                                {
                                        short int *val = reinterpret_cast<short int*>(ptr);
                                        ptr += sizeof(short int);
-                                       PyList_SET_ITEM(resultlist,i,PyInt_FromLong(*val));
+                                       PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
                                        break;
                                }
                        case KX_PYATTRIBUTE_TYPE_ENUM:
@@ -205,7 +205,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
                                {
                                        int *val = reinterpret_cast<int*>(ptr);
                                        ptr += sizeof(int);
-                                       PyList_SET_ITEM(resultlist,i,PyInt_FromLong(*val));
+                                       PyList_SET_ITEM(resultlist,i,PyLong_FromSsize_t(*val));
                                        break;
                                }
                        case KX_PYATTRIBUTE_TYPE_FLOAT:
@@ -229,12 +229,12 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
                case KX_PYATTRIBUTE_TYPE_BOOL:
                        {
                                bool *val = reinterpret_cast<bool*>(ptr);
-                               return PyInt_FromLong(*val);
+                               return PyLong_FromSsize_t(*val);
                        }
                case KX_PYATTRIBUTE_TYPE_SHORT:
                        {
                                short int *val = reinterpret_cast<short int*>(ptr);
-                               return PyInt_FromLong(*val);
+                               return PyLong_FromSsize_t(*val);
                        }
                case KX_PYATTRIBUTE_TYPE_ENUM:
                        // enum are like int, just make sure the field size is the same
@@ -246,7 +246,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
                case KX_PYATTRIBUTE_TYPE_INT:
                        {
                                int *val = reinterpret_cast<int*>(ptr);
-                               return PyInt_FromLong(*val);
+                               return PyLong_FromSsize_t(*val);
                        }
                case KX_PYATTRIBUTE_TYPE_FLOAT:
                        {
@@ -271,7 +271,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
                case KX_PYATTRIBUTE_TYPE_STRING:
                        {
                                STR_String *val = reinterpret_cast<STR_String*>(ptr);
-                               return PyString_FromString(*val);
+                               return PyUnicode_FromString(*val);
                        }
                default:
                        return NULL;
@@ -352,9 +352,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
                                {
                                        bool *var = reinterpret_cast<bool*>(ptr);
                                        ptr += sizeof(bool);
-                                       if (PyInt_Check(item)) 
+                                       if (PyLong_Check(item)) 
                                        {
-                                               *var = (PyInt_AsLong(item) != 0);
+                                               *var = (PyLong_AsSsize_t(item) != 0);
                                        } 
                                        else if (PyBool_Check(item))
                                        {
@@ -371,9 +371,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
                                {
                                        short int *var = reinterpret_cast<short int*>(ptr);
                                        ptr += sizeof(short int);
-                                       if (PyInt_Check(item)) 
+                                       if (PyLong_Check(item)) 
                                        {
-                                               long val = PyInt_AsLong(item);
+                                               long val = PyLong_AsSsize_t(item);
                                                if (attrdef->m_clamp)
                                                {
                                                        if (val < attrdef->m_imin)
@@ -407,9 +407,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
                                {
                                        int *var = reinterpret_cast<int*>(ptr);
                                        ptr += sizeof(int);
-                                       if (PyInt_Check(item)) 
+                                       if (PyLong_Check(item)) 
                                        {
-                                               long val = PyInt_AsLong(item);
+                                               long val = PyLong_AsSsize_t(item);
                                                if (attrdef->m_clamp)
                                                {
                                                        if (val < attrdef->m_imin)
@@ -542,9 +542,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
                case KX_PYATTRIBUTE_TYPE_BOOL:
                        {
                                bool *var = reinterpret_cast<bool*>(ptr);
-                               if (PyInt_Check(value)) 
+                               if (PyLong_Check(value)) 
                                {
-                                       *var = (PyInt_AsLong(value) != 0);
+                                       *var = (PyLong_AsSsize_t(value) != 0);
                                } 
                                else if (PyBool_Check(value))
                                {
@@ -560,9 +560,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
                case KX_PYATTRIBUTE_TYPE_SHORT:
                        {
                                short int *var = reinterpret_cast<short int*>(ptr);
-                               if (PyInt_Check(value)) 
+                               if (PyLong_Check(value)) 
                                {
-                                       long val = PyInt_AsLong(value);
+                                       long val = PyLong_AsSsize_t(value);
                                        if (attrdef->m_clamp)
                                        {
                                                if (val < attrdef->m_imin)
@@ -595,9 +595,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
                case KX_PYATTRIBUTE_TYPE_INT:
                        {
                                int *var = reinterpret_cast<int*>(ptr);
-                               if (PyInt_Check(value)) 
+                               if (PyLong_Check(value)) 
                                {
-                                       long val = PyInt_AsLong(value);
+                                       long val = PyLong_AsSsize_t(value);
                                        if (attrdef->m_clamp)
                                        {
                                                if (val < attrdef->m_imin)
@@ -682,9 +682,9 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
                case KX_PYATTRIBUTE_TYPE_STRING:
                        {
                                STR_String *var = reinterpret_cast<STR_String*>(ptr);
-                               if (PyString_Check(value)) 
+                               if (PyUnicode_Check(value)) 
                                {
-                                       char *val = PyString_AsString(value);
+                                       char *val = _PyUnicode_AsString(value);
                                        if (attrdef->m_clamp)
                                        {
                                                if (strlen(val) < attrdef->m_imin)
@@ -859,7 +859,7 @@ void PyObjectPlus::ShowDeprecationWarning_func(const char* old_way,const char* n
                                        co_filename= PyObject_GetAttrString(f_code, "co_filename");
                                        if (co_filename) {
                                                
-                                               printf("\t%s:%d\n", PyString_AsString(co_filename), (int)PyInt_AsLong(f_lineno));
+                                               printf("\t%s:%d\n", _PyUnicode_AsString(co_filename), (int)PyLong_AsSsize_t(f_lineno));
                                                
                                                Py_DECREF(f_lineno);
                                                Py_DECREF(f_code);
index 0fe3e9f083d6decfcd76385f237250ac09234a83..ee69e7d3b072f6d2eeb33b01810fd0e5e052496c 100644 (file)
@@ -51,19 +51,9 @@ extern "C" {
 }
 #endif
 
-#if PY_VERSION_HEX > 0x03000000
-#define PyString_FromString PyUnicode_FromString
-#define PyString_FromFormat PyUnicode_FromFormat
-#define PyString_Check PyUnicode_Check
-#define PyString_Size PyUnicode_GetSize
-
-#define PyInt_FromLong PyLong_FromSsize_t
-#define PyInt_AsLong PyLong_AsSsize_t
-#define PyString_AsString _PyUnicode_AsString
-#define PyInt_Check PyLong_Check
-#define PyInt_AS_LONG PyLong_AsLong // TODO - check this one
-#endif
-
+extern "C" {
+#include "../../blender/python/intern/bpy_compat.h"
+}
 
 
 /*
index 52f8a580f4d6a3a7b7e6a6a5233bb1357c45006c..c580e8fd23a29f9f4ebf1cbc3c4f000806c4df05 100644 (file)
@@ -40,7 +40,7 @@ public:
        virtual void            SetValue(CValue* newval) {      m_strString = newval->GetText(); SetModified(true);     };
        virtual CValue*         GetReplica();
        virtual PyObject*       ConvertValueToPython() {
-               return PyString_FromString(m_strString.Ptr());
+               return PyUnicode_FromString(m_strString.Ptr());
        }
 
 private:
index 45eb15ecd08d31a8981312edc6d169b2a8796c30..a9b444954958676728630ad220205e05ec3c3c04 100644 (file)
@@ -74,7 +74,7 @@ PyObject* CValue::PyGetName()
 {
        ShowDeprecationWarning("getName()", "the name property");
        
-       return PyString_FromString(this->GetName());
+       return PyUnicode_FromString(this->GetName());
 }
 
 /*#define CVALUE_DEBUG*/
@@ -555,7 +555,7 @@ PyAttributeDef CValue::Attributes[] = {
 
 PyObject * CValue::pyattr_get_name(void * self_v, const KX_PYATTRIBUTE_DEF * attrdef) {
        CValue * self = static_cast<CValue *> (self_v);
-       return PyString_FromString(self->GetName());
+       return PyUnicode_FromString(self->GetName());
 }
 
 CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
@@ -599,21 +599,23 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
        {
                vallie = new CFloatValue( (float)PyFloat_AsDouble(pyobj) );
        } else
+#if PY_VERSION_HEX < 0x03000000
        if (PyInt_Check(pyobj))
        {
                vallie = new CIntValue( (cInt)PyInt_AS_LONG(pyobj) );
        } else
+#endif
        if (PyLong_Check(pyobj))
        {
                vallie = new CIntValue( (cInt)PyLong_AsLongLong(pyobj) );
        } else
-       if (PyString_Check(pyobj))
+       if (PyUnicode_Check(pyobj))
        {
-               vallie = new CStringValue(PyString_AsString(pyobj),"");
+               vallie = new CStringValue(_PyUnicode_AsString(pyobj),"");
        } else
        if (BGE_PROXY_CHECK_TYPE(pyobj)) /* Note, dont let these get assigned to GameObject props, must check elsewhere */
        {
-               if (BGE_PROXY_REF(pyobj) && PyObject_TypeCheck(BGE_PROXY_REF(pyobj), &CValue::Type))
+               if (BGE_PROXY_REF(pyobj) && PyObject_TypeCheck((PyObject *)BGE_PROXY_REF(pyobj), &CValue::Type))
                {
                        vallie = (static_cast<CValue *>(BGE_PROXY_REF(pyobj)))->AddRef();
                } else {
@@ -642,7 +644,7 @@ PyObject*   CValue::ConvertKeysToPython( void )
                std::map<STR_String,CValue*>::iterator it;
                for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++)
                {
-                       pystr = PyString_FromString( (*it).first );
+                       pystr = PyUnicode_FromString( (*it).first );
                        PyList_Append(pylist, pystr);
                        Py_DECREF( pystr );
                }
index 9da75b96e789c27d03935789d0774790eeebb9ef..8c9f99b335ec4f92de75c8953f0f8326e68acebd 100644 (file)
@@ -219,7 +219,7 @@ public:
        //static PyObject*      PyMake(PyObject*,PyObject*);
        virtual PyObject *py_repr(void)
        {
-               return PyString_FromString((const char*)GetText());
+               return PyUnicode_FromString((const char*)GetText());
        }
 
        virtual PyObject*       ConvertValueToPython() {
index b6a9471f23c28ecff886ed4413fe44aa7ca79e2b..9d2642ba01ab0409918b5e50e693fcc223f30ab4 100644 (file)
@@ -181,7 +181,7 @@ const char SCA_ActuatorSensor::GetActuator_doc[] =
 PyObject* SCA_ActuatorSensor::PyGetActuator() 
 {
        ShowDeprecationWarning("getActuator()", "the actuator property");
-       return PyString_FromString(m_checkactname);
+       return PyUnicode_FromString(m_checkactname);
 }
 
 /* 4. setActuator */
index afc9028d95dd35a282acc817caf200270c2d88a9..db6a6af7928bf54f4dd502ce0cac14f9f89f34ac 100644 (file)
@@ -245,7 +245,7 @@ const char SCA_DelaySensor::GetDelay_doc[] =
 PyObject* SCA_DelaySensor::PyGetDelay()
 {
        ShowDeprecationWarning("getDelay()", "the delay property");
-       return PyInt_FromLong(m_delay);
+       return PyLong_FromSsize_t(m_delay);
 }
 
 const char SCA_DelaySensor::GetDuration_doc[] = 
@@ -254,7 +254,7 @@ const char SCA_DelaySensor::GetDuration_doc[] =
 PyObject* SCA_DelaySensor::PyGetDuration()
 {
        ShowDeprecationWarning("getDuration()", "the duration property");
-       return PyInt_FromLong(m_duration);
+       return PyLong_FromSsize_t(m_duration);
 }
 
 const char SCA_DelaySensor::GetRepeat_doc[] = 
index 7880daf0eb426566fca2a6f94130bedf3ac846bf..4b7c462b6f756b19e7d811109374f7c12f77e423 100644 (file)
@@ -263,7 +263,7 @@ PyObject* SCA_IController::PyGetSensor(PyObject* value)
 {
        ShowDeprecationWarning("getSensor(string)", "the sensors[string] property");
        
-       char *scriptArg = PyString_AsString(value);
+       char *scriptArg = _PyUnicode_AsString(value);
        if (scriptArg==NULL) {
                PyErr_SetString(PyExc_TypeError, "controller.getSensor(string): Python Controller, expected a string (sensor name)");
                return NULL;
@@ -287,7 +287,7 @@ PyObject* SCA_IController::PyGetActuator(PyObject* value)
 {
        ShowDeprecationWarning("getActuator(string)", "the actuators[string] property");
        
-       char *scriptArg = PyString_AsString(value);
+       char *scriptArg = _PyUnicode_AsString(value);
        if (scriptArg==NULL) {
                PyErr_SetString(PyExc_TypeError, "controller.getActuator(string): Python Controller, expected a string (actuator name)");
                return NULL;
@@ -322,13 +322,13 @@ PyObject* SCA_IController::PyGetSensors()
 PyObject* SCA_IController::PyGetState()
 {
        ShowDeprecationWarning("getState()", "the state property");
-       return PyInt_FromLong(m_statemask);
+       return PyLong_FromSsize_t(m_statemask);
 }
 
 PyObject* SCA_IController::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        SCA_IController* self= static_cast<SCA_IController*>(self_v);
-       return PyInt_FromLong(self->m_statemask);
+       return PyLong_FromSsize_t(self->m_statemask);
 }
 
 PyObject* SCA_IController::pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
index d747daec2b4dcd9b9a366967b45249951cf122ca..9d0b9b30ff6fc125a1979c99ae1c61bf4369e2d8 100644 (file)
@@ -275,7 +275,7 @@ PyObject* SCA_ILogicBrick::PySetExecutePriority(PyObject* args)
 PyObject* SCA_ILogicBrick::PyGetExecutePriority()
 {
        ShowDeprecationWarning("getExecutePriority()", "the executePriority property");
-       return PyInt_FromLong(m_Execute_Priority);
+       return PyLong_FromSsize_t(m_Execute_Priority);
 }
 
 
@@ -305,5 +305,5 @@ bool SCA_ILogicBrick::PyArgToBool(int boolArg)
 
 PyObject* SCA_ILogicBrick::BoolToPyArg(bool boolarg)
 {
-       return PyInt_FromLong(boolarg? KX_TRUE: KX_FALSE);      
+       return PyLong_FromSsize_t(boolarg? KX_TRUE: KX_FALSE);  
 }
index de7030197b281b6fc4a4ad8595ffadba9effca7a..d68afebbc207f9e075b35f5480f7d5f4e8f33b2f 100644 (file)
@@ -300,7 +300,7 @@ PyObject* SCA_ISensor::PyIsPositive()
 {
        ShowDeprecationWarning("isPositive()", "the read-only positive property");
        int retval = GetState();
-       return PyInt_FromLong(retval);
+       return PyLong_FromSsize_t(retval);
 }
 
 const char SCA_ISensor::IsTriggered_doc[] = 
@@ -313,7 +313,7 @@ PyObject* SCA_ISensor::PyIsTriggered()
        int retval = 0;
        if (SCA_PythonController::m_sCurrentController)
                retval = SCA_PythonController::m_sCurrentController->IsTriggered(this);
-       return PyInt_FromLong(retval);
+       return PyLong_FromSsize_t(retval);
 }
 
 /**
@@ -354,7 +354,7 @@ const char SCA_ISensor::GetFrequency_doc[] =
 PyObject* SCA_ISensor::PyGetFrequency()
 {
        ShowDeprecationWarning("getFrequency()", "the frequency property");
-       return PyInt_FromLong(m_pulse_frequency);
+       return PyLong_FromSsize_t(m_pulse_frequency);
 }
 
 /**
@@ -553,13 +553,13 @@ PyObject* SCA_ISensor::pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_D
        int retval = 0;
        if (SCA_PythonController::m_sCurrentController)
                retval = SCA_PythonController::m_sCurrentController->IsTriggered(self);
-       return PyInt_FromLong(retval);
+       return PyLong_FromSsize_t(retval);
 }
 
 PyObject* SCA_ISensor::pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
-       return PyInt_FromLong(self->GetState());
+       return PyLong_FromSsize_t(self->GetState());
 }
 
 int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
index 645c73efaa4e4e721f706d4ffb59ab95986f939a..f91ccff799cf9d294774207cecffdbcb85e01034 100644 (file)
@@ -329,7 +329,7 @@ const char SCA_JoystickSensor::GetIndex_doc[] =
 "\tReturns the joystick index to use.\n";
 PyObject* SCA_JoystickSensor::PyGetIndex( ) {
        ShowDeprecationWarning("getIndex()", "the index property");
-       return PyInt_FromLong(m_joyindex);
+       return PyLong_FromSsize_t(m_joyindex);
 }
 
 
@@ -339,7 +339,7 @@ const char SCA_JoystickSensor::SetIndex_doc[] =
 "\tSets the joystick index to use.\n";
 PyObject* SCA_JoystickSensor::PySetIndex( PyObject* value ) {
        ShowDeprecationWarning("setIndex()", "the index property");
-       int index = PyInt_AsLong( value ); /* -1 on error, will raise an error in this case */
+       int index = PyLong_AsSsize_t( value ); /* -1 on error, will raise an error in this case */
        if (index < 0 || index >= JOYINDEX_MAX) {
                PyErr_SetString(PyExc_ValueError, "joystick index out of range or not an int");
                return NULL;
@@ -390,7 +390,7 @@ PyObject* SCA_JoystickSensor::PyGetAxisValue( ) {
        PyObject *list= PyList_New(axis_index);
        
        while(axis_index--) {
-               PyList_SET_ITEM(list, axis_index, PyInt_FromLong(joy->GetAxisPosition(axis_index)));
+               PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index)));
        }
        
        return list;
@@ -403,7 +403,7 @@ const char SCA_JoystickSensor::GetThreshold_doc[] =
 "\tReturns the threshold of the axis.\n";
 PyObject* SCA_JoystickSensor::PyGetThreshold( ) {
        ShowDeprecationWarning("getThreshold()", "the threshold property");
-       return PyInt_FromLong(m_precision);
+       return PyLong_FromSsize_t(m_precision);
 }
 
 
@@ -427,7 +427,7 @@ const char SCA_JoystickSensor::GetButton_doc[] =
 "\tReturns the current button this sensor is checking.\n";
 PyObject* SCA_JoystickSensor::PyGetButton( ) {
        ShowDeprecationWarning("getButton()", "the button property");
-       return PyInt_FromLong(m_button);
+       return PyLong_FromSsize_t(m_button);
 }
 
 /* set button  -------------------------------------------------------- */
@@ -436,7 +436,7 @@ const char SCA_JoystickSensor::SetButton_doc[] =
 "\tSets the button the sensor reacts to.\n";
 PyObject* SCA_JoystickSensor::PySetButton( PyObject* value ) {
        ShowDeprecationWarning("setButton()", "the button property");
-       int button = PyInt_AsLong(value);
+       int button = PyLong_AsSsize_t(value);
        if(button==-1 && PyErr_Occurred()) {
                PyErr_SetString(PyExc_ValueError, "expected an int");
                return NULL;
@@ -467,7 +467,7 @@ PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) {
        if(joy) {
                for (i=0; i < joy->GetNumberOfButtons(); i++) {
                        if (joy->aButtonPressIsPositive(i)) {
-                               value = PyInt_FromLong(i);
+                               value = PyLong_FromSsize_t(i);
                                PyList_Append(ls, value);
                                Py_DECREF(value);
                        }
@@ -529,7 +529,7 @@ PyObject* SCA_JoystickSensor::PyNumberOfAxes( ) {
        ShowDeprecationWarning("getNumAxes()", "the numAxis property");
        SCA_Joystick *joy = m_pJoystickMgr->GetJoystickDevice(m_joyindex);
        // when the joystick is null their is 0 exis still. dumb but scripters should use isConnected()
-       return PyInt_FromLong( joy ? joy->GetNumberOfAxes() : 0 );
+       return PyLong_FromSsize_t( joy ? joy->GetNumberOfAxes() : 0 );
 }
 
 
@@ -539,7 +539,7 @@ const char SCA_JoystickSensor::NumberOfButtons_doc[] =
 PyObject* SCA_JoystickSensor::PyNumberOfButtons( ) {
        ShowDeprecationWarning("getNumButtons()", "the numButtons property");
        SCA_Joystick *joy = m_pJoystickMgr->GetJoystickDevice(m_joyindex);
-       return PyInt_FromLong( joy ? joy->GetNumberOfButtons() : 0 );
+       return PyLong_FromSsize_t( joy ? joy->GetNumberOfButtons() : 0 );
 }
 
 
@@ -549,7 +549,7 @@ const char SCA_JoystickSensor::NumberOfHats_doc[] =
 PyObject* SCA_JoystickSensor::PyNumberOfHats( ) {
        ShowDeprecationWarning("getNumHats()", "the numHats property");
        SCA_Joystick *joy = m_pJoystickMgr->GetJoystickDevice(m_joyindex);
-       return PyInt_FromLong( joy ? joy->GetNumberOfHats() : 0 );
+       return PyLong_FromSsize_t( joy ? joy->GetNumberOfHats() : 0 );
 }
 
 const char SCA_JoystickSensor::Connected_doc[] = 
@@ -571,7 +571,7 @@ PyObject* SCA_JoystickSensor::pyattr_get_axis_values(void *self_v, const KX_PYAT
        PyObject *list= PyList_New(axis_index);
        
        while(axis_index--) {
-               PyList_SET_ITEM(list, axis_index, PyInt_FromLong(joy->GetAxisPosition(axis_index)));
+               PyList_SET_ITEM(list, axis_index, PyLong_FromSsize_t(joy->GetAxisPosition(axis_index)));
        }
        
        return list;
@@ -587,7 +587,7 @@ PyObject* SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT
                return NULL;
        }
        
-       return PyInt_FromLong(joy->GetAxisPosition(self->m_axis-1));
+       return PyLong_FromSsize_t(joy->GetAxisPosition(self->m_axis-1));
 }
 
 PyObject* SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -599,7 +599,7 @@ PyObject* SCA_JoystickSensor::pyattr_get_hat_values(void *self_v, const KX_PYATT
        PyObject *list= PyList_New(hat_index);
        
        while(hat_index--) {
-               PyList_SET_ITEM(list, hat_index, PyInt_FromLong(joy->GetHat(hat_index)));
+               PyList_SET_ITEM(list, hat_index, PyLong_FromSsize_t(joy->GetHat(hat_index)));
        }
        
        return list;
@@ -610,28 +610,28 @@ PyObject* SCA_JoystickSensor::pyattr_get_hat_single(void *self_v, const KX_PYATT
        SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
        SCA_Joystick *joy = self->m_pJoystickMgr->GetJoystickDevice(self->m_joyindex);
        
-       return PyInt_FromLong(joy->GetHat(self->m_hat-1));
+       return PyLong_FromSsize_t(joy->GetHat(self->m_hat-1));
 }
 
 PyObject* SCA_JoystickSensor::pyattr_get_num_axis(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
        SCA_Joystick *joy = self->m_pJoystickMgr->GetJoystickDevice(self->m_joyindex);
-       return PyInt_FromLong( joy ? joy->GetNumberOfAxes() : 0 );
+       return PyLong_FromSsize_t( joy ? joy->GetNumberOfAxes() : 0 );
 }
 
 PyObject* SCA_JoystickSensor::pyattr_get_num_buttons(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
        SCA_Joystick *joy = self->m_pJoystickMgr->GetJoystickDevice(self->m_joyindex);
-       return PyInt_FromLong( joy ? joy->GetNumberOfButtons() : 0 );
+       return PyLong_FromSsize_t( joy ? joy->GetNumberOfButtons() : 0 );
 }
 
 PyObject* SCA_JoystickSensor::pyattr_get_num_hats(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        SCA_JoystickSensor* self= static_cast<SCA_JoystickSensor*>(self_v);
        SCA_Joystick *joy = self->m_pJoystickMgr->GetJoystickDevice(self->m_joyindex);
-       return PyInt_FromLong( joy ? joy->GetNumberOfHats() : 0 );
+       return PyLong_FromSsize_t( joy ? joy->GetNumberOfHats() : 0 );
 }
 
 PyObject* SCA_JoystickSensor::pyattr_get_connected(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
index 34ade17ffb796bd5c1f6f143be0f7625367b444d..cbf25f10291591edbbf2cbc8eb3e135d5b6e6ec6 100644 (file)
@@ -417,7 +417,7 @@ const char SCA_KeyboardSensor::GetKey_doc[] =
 PyObject* SCA_KeyboardSensor::PyGetKey()
 {
        ShowDeprecationWarning("getKey()", "the key property");
-       return PyInt_FromLong(m_hotkey);
+       return PyLong_FromSsize_t(m_hotkey);
 }
 
 /** 2. SetKey: change the key to look at */
@@ -449,7 +449,7 @@ const char SCA_KeyboardSensor::GetHold1_doc[] =
 PyObject* SCA_KeyboardSensor::PyGetHold1()
 {
        ShowDeprecationWarning("getHold1()", "the hold1 property");
-       return PyInt_FromLong(m_qual);
+       return PyLong_FromSsize_t(m_qual);
 }
 
 /** 4. SetHold1: change the first bucky bit */
@@ -481,7 +481,7 @@ const char SCA_KeyboardSensor::GetHold2_doc[] =
 PyObject* SCA_KeyboardSensor::PyGetHold2()
 {
        ShowDeprecationWarning("getHold2()", "the hold2 property");
-       return PyInt_FromLong(m_qual2);
+       return PyLong_FromSsize_t(m_qual2);
 }
 
 /** 6. SetHold2: change the second bucky bit */
@@ -531,8 +531,8 @@ PyObject* SCA_KeyboardSensor::PyGetPressedKeys()
                                || (inevent.m_status == SCA_InputEvent::KX_JUSTRELEASED))
                        {
                                PyObject* keypair = PyList_New(2);
-                               PyList_SET_ITEM(keypair,0,PyInt_FromLong(i));
-                               PyList_SET_ITEM(keypair,1,PyInt_FromLong(inevent.m_status));
+                               PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i));
+                               PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status));
                                PyList_SET_ITEM(resultlist,index,keypair);
                                index++;
                                
@@ -571,8 +571,8 @@ PyObject* SCA_KeyboardSensor::PyGetCurrentlyPressedKeys()
                                 || (inevent.m_status == SCA_InputEvent::KX_JUSTACTIVATED))
                        {
                                PyObject* keypair = PyList_New(2);
-                               PyList_SET_ITEM(keypair,0,PyInt_FromLong(i));
-                               PyList_SET_ITEM(keypair,1,PyInt_FromLong(inevent.m_status));
+                               PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i));
+                               PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status));
                                PyList_SET_ITEM(resultlist,index,keypair);
                                index++;
                                
@@ -591,12 +591,12 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
 "getKeyStatus(keycode)\n"
 "\tGet the given key's status (KX_NO_INPUTSTATUS, KX_JUSTACTIVATED, KX_ACTIVE or KX_JUSTRELEASED).\n")
 {
-       if (!PyInt_Check(value)) {
+       if (!PyLong_Check(value)) {
                PyErr_SetString(PyExc_ValueError, "sensor.getKeyStatus(int): Keyboard Sensor, expected an int");
                return NULL;
        }
        
-       int keycode = PyInt_AsLong(value);
+       int keycode = PyLong_AsSsize_t(value);
        
        if ((keycode < SCA_IInputDevice::KX_BEGINKEY)
                || (keycode > SCA_IInputDevice::KX_ENDKEY)){
@@ -606,7 +606,7 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
        
        SCA_IInputDevice* inputdev = m_pKeyboardMgr->GetInputDevice();
        const SCA_InputEvent & inevent = inputdev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) keycode);
-       return PyInt_FromLong(inevent.m_status);
+       return PyLong_FromSsize_t(inevent.m_status);
 }
 
 /* ------------------------------------------------------------------------- */
@@ -683,8 +683,8 @@ PyObject* SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU
                if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS)
                {
                        PyObject* keypair = PyList_New(2);
-                       PyList_SET_ITEM(keypair,0,PyInt_FromLong(i));
-                       PyList_SET_ITEM(keypair,1,PyInt_FromLong(inevent.m_status));
+                       PyList_SET_ITEM(keypair,0,PyLong_FromSsize_t(i));
+                       PyList_SET_ITEM(keypair,1,PyLong_FromSsize_t(inevent.m_status));
                        PyList_Append(resultlist,keypair);
                }
        }       
index 3a1e6191fdb4891c91a9763fa38450df296767a9..608aa043461d0f87a3317ffd5cf3600362096fd6 100644 (file)
@@ -253,7 +253,7 @@ const char SCA_MouseSensor::GetXPosition_doc[] =
 "\tpixels\n";
 PyObject* SCA_MouseSensor::PyGetXPosition() {
        ShowDeprecationWarning("getXPosition()", "the position property");
-       return PyInt_FromLong(m_x);
+       return PyLong_FromSsize_t(m_x);
 }
 
 /* get y position ---------------------------------------------------------- */
@@ -264,7 +264,7 @@ const char SCA_MouseSensor::GetYPosition_doc[] =
 "\tpixels\n";
 PyObject* SCA_MouseSensor::PyGetYPosition() {
        ShowDeprecationWarning("getYPosition()", "the position property");
-       return PyInt_FromLong(m_y);
+       return PyLong_FromSsize_t(m_y);
 }
 //<----- Deprecated
 
@@ -272,9 +272,9 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
 "getButtonStatus(button)\n"
 "\tGet the given button's status (KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED).\n")
 {
-       if (PyInt_Check(value))
+       if (PyLong_Check(value))
        {
-               int button = PyInt_AsLong(value);
+               int button = PyLong_AsSsize_t(value);
                
                if ((button < SCA_IInputDevice::KX_LEFTMOUSE)
                        || (button > SCA_IInputDevice::KX_RIGHTMOUSE)){
@@ -284,7 +284,7 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
                
                SCA_IInputDevice* mousedev = m_pMouseMgr->GetInputDevice();
                const SCA_InputEvent& event = mousedev->GetEventValue((SCA_IInputDevice::KX_EnumInputs) button);
-               return PyInt_FromLong(event.m_status);
+               return PyLong_FromSsize_t(event.m_status);
        }
        
        Py_RETURN_NONE;
index 7eb088bef98020e5b16da54465b2a26d7ab2f45d..f3c0a76a9f26e8c0b0bc8c00068f9a17ed6575eb 100644 (file)
@@ -307,7 +307,7 @@ const char SCA_PropertyActuator::GetProperty_doc[] =
 PyObject* SCA_PropertyActuator::PyGetProperty(PyObject* args, PyObject* kwds)
 {
        ShowDeprecationWarning("getProperty()", "the 'propName' property");
-       return PyString_FromString(m_propname);
+       return PyUnicode_FromString(m_propname);
 }
 
 /* 3. setValue                                                        */
@@ -337,7 +337,7 @@ const char SCA_PropertyActuator::GetValue_doc[] =
 PyObject* SCA_PropertyActuator::PyGetValue(PyObject* args, PyObject* kwds)
 {
        ShowDeprecationWarning("getValue()", "the value property");
-       return PyString_FromString(m_exprtxt);
+       return PyUnicode_FromString(m_exprtxt);
 }
 
 /* eof */
index b15711647745ba0d2fb1ac0e7bbb0d6bc6e87568..ea928bb1c8f64b45766cc7c30f5afa36ff31703a 100644 (file)
@@ -356,7 +356,7 @@ const char SCA_PropertySensor::GetType_doc[] =
 PyObject* SCA_PropertySensor::PyGetType()
 {
        ShowDeprecationWarning("getType()", "the mode property");
-       return PyInt_FromLong(m_checktype);
+       return PyLong_FromSsize_t(m_checktype);
 }
 
 /* 2. setType */
@@ -390,7 +390,7 @@ const char SCA_PropertySensor::GetProperty_doc[] =
 PyObject* SCA_PropertySensor::PyGetProperty() 
 {
        ShowDeprecationWarning("getProperty()", "the 'propName' property");
-       return PyString_FromString(m_checkpropname);
+       return PyUnicode_FromString(m_checkpropname);
 }
 
 /* 4. setProperty */
@@ -427,7 +427,7 @@ const char SCA_PropertySensor::GetValue_doc[] =
 PyObject* SCA_PropertySensor::PyGetValue() 
 {
        ShowDeprecationWarning("getValue()", "the value property");
-       return PyString_FromString(m_checkpropval);
+       return PyUnicode_FromString(m_checkpropval);
 }
 
 /* 6. setValue */
index fb12674ebeda4cd2c7700ff07e95abc71a3dd051..7eecb6ccc985f0d05ed5c01dd89414e2a0afce06 100644 (file)
@@ -148,7 +148,7 @@ void SCA_PythonController::SetDictionary(PyObject*  pythondictionary)
        
        /* Without __file__ set the sys.argv[0] is used for the filename
         * which ends up with lines from the blender binary being printed in the console */
-       PyDict_SetItemString(m_pythondictionary, "__file__", PyString_FromString(m_scriptName.Ptr()));
+       PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_FromString(m_scriptName.Ptr()));
        
 }
 
@@ -178,9 +178,9 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
        std::vector<SCA_IActuator*> lacts =  m_sCurrentController->GetLinkedActuators();
        std::vector<SCA_IActuator*>::iterator it;
        
-       if (PyString_Check(value)) {
+       if (PyUnicode_Check(value)) {
                /* get the actuator from the name */
-               char *name= PyString_AsString(value);
+               char *name= _PyUnicode_AsString(value);
                for(it = lacts.begin(); it!= lacts.end(); ++it) {
                        if( name == (*it)->GetName() ) {
                                return *it;
@@ -198,7 +198,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
        
        /* set the exception */
        PyObject *value_str = PyObject_Repr(value); /* new ref */
-       PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", PyString_AsString(value_str));
+       PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str));
        Py_DECREF(value_str);
        
        return false;
@@ -521,13 +521,13 @@ PyObject* SCA_PythonController::PyDeActivate(PyObject *value)
 PyObject* SCA_PythonController::PyGetScript()
 {
        ShowDeprecationWarning("getScript()", "the script property");
-       return PyString_FromString(m_scriptText);
+       return PyUnicode_FromString(m_scriptText);
 }
 
 /* 2. setScript */
 PyObject* SCA_PythonController::PySetScript(PyObject* value)
 {
-       char *scriptArg = PyString_AsString(value);
+       char *scriptArg = _PyUnicode_AsString(value);
        
        ShowDeprecationWarning("setScript()", "the script property");
        
@@ -550,7 +550,7 @@ PyObject* SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRI
        // static_cast<void *>(dynamic_cast<Derived *>(obj)) - static_cast<void *>(obj)
 
        SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
-       return PyString_FromString(self->m_scriptText);
+       return PyUnicode_FromString(self->m_scriptText);
 }
 
 
@@ -559,7 +559,7 @@ int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_D
 {
        SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
        
-       char *scriptArg = PyString_AsString(value);
+       char *scriptArg = _PyUnicode_AsString(value);
        
        if (scriptArg==NULL) {
                PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text");
index a272306bd1d3f8f602b4a776c07605a941ad3f43..0474cb4ab5f65a0de9602a6887abac470778a43d 100644 (file)
@@ -380,14 +380,14 @@ PyAttributeDef SCA_RandomActuator::Attributes[] = {
 PyObject* SCA_RandomActuator::pyattr_get_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
 {
        SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
-       return PyInt_FromLong(act->m_base->GetSeed());
+       return PyLong_FromSsize_t(act->m_base->GetSeed());
 }
 
 int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
        SCA_RandomActuator* act = static_cast<SCA_RandomActuator*>(self);
-       if (PyInt_Check(value)) {
-               int ival = PyInt_AsLong(value);
+       if (PyLong_Check(value))        {
+               int ival = PyLong_AsSsize_t(value);
                act->m_base->SetSeed(ival);
                return PY_SET_ATTR_SUCCESS;
        } else {
@@ -422,7 +422,7 @@ const char SCA_RandomActuator::GetSeed_doc[] =
 PyObject* SCA_RandomActuator::PyGetSeed()
 {
        ShowDeprecationWarning("getSeed()", "the seed property");
-       return PyInt_FromLong(m_base->GetSeed());
+       return PyLong_FromSsize_t(m_base->GetSeed());
 }
 
 /* 4. getPara1                                                           */
@@ -456,7 +456,7 @@ const char SCA_RandomActuator::GetDistribution_doc[] =
 PyObject* SCA_RandomActuator::PyGetDistribution()
 {
        ShowDeprecationWarning("getDistribution()", "the distribution property");
-       return PyInt_FromLong(m_distribution);
+       return PyLong_FromSsize_t(m_distribution);
 }
 
 /* 9. setProperty                                                        */
@@ -491,7 +491,7 @@ const char SCA_RandomActuator::GetProperty_doc[] =
 PyObject* SCA_RandomActuator::PyGetProperty()
 {
        ShowDeprecationWarning("getProperty()", "the 'propName' property");
-       return PyString_FromString(m_propname);
+       return PyUnicode_FromString(m_propname);
 }
 
 /* 11. setBoolConst */
index 8a6f42c9926209649cac5dc35054bf59cb58642c..9d3501ab4edf931d06fd3a1c2f463e38637e4b01 100644 (file)
@@ -199,7 +199,7 @@ const char SCA_RandomSensor::GetSeed_doc[] =
 "\tequal series.\n";
 PyObject* SCA_RandomSensor::PyGetSeed() {
        ShowDeprecationWarning("getSeed()", "the seed property");
-       return PyInt_FromLong(m_basegenerator->GetSeed());
+       return PyLong_FromSsize_t(m_basegenerator->GetSeed());
 }
 
 /* 3. getLastDraw                                                            */
@@ -208,24 +208,24 @@ const char SCA_RandomSensor::GetLastDraw_doc[] =
 "\tReturn the last value that was drawn.\n";
 PyObject* SCA_RandomSensor::PyGetLastDraw() {
        ShowDeprecationWarning("getLastDraw()", "the lastDraw property");
-       return PyInt_FromLong(m_lastdraw);
+       return PyLong_FromSsize_t(m_lastdraw);
 }
 
 
 PyObject* SCA_RandomSensor::pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v);
-       return PyInt_FromLong(self->m_basegenerator->GetSeed());
+       return PyLong_FromSsize_t(self->m_basegenerator->GetSeed());
 }
 
 int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
        SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v);
-       if (!PyInt_Check(value)) {
+       if (!PyLong_Check(value)) {
                PyErr_SetString(PyExc_TypeError, "sensor.seed = int: Random Sensor, expected an integer");
                return PY_SET_ATTR_FAIL;
        }
-       self->m_basegenerator->SetSeed(PyInt_AsLong(value));
+       self->m_basegenerator->SetSeed(PyLong_AsSsize_t(value));
        return PY_SET_ATTR_SUCCESS;
 }
 
index b595aab578fb0c7520bb2d9f0c9abab8158c39b8..b6debb4c62cf1df1d5ac9cce3688a6e191225990 100644 (file)
@@ -834,17 +834,17 @@ KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" )
 
 KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" )
 {
-       return PyInt_FromLong( ( mShader !=0 &&  mOk ) );
+       return PyLong_FromSsize_t( ( mShader !=0 &&  mOk ) );
 }
 
 KX_PYMETHODDEF_DOC( BL_Shader, getVertexProg ,"getVertexProg( )" )
 {
-       return PyString_FromString(vertProg?vertProg:"");
+       return PyUnicode_FromString(vertProg?vertProg:"");
 }
 
 KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg ,"getFragmentProg( )" )
 {
-       return PyString_FromString(fragProg?fragProg:"");
+       return PyUnicode_FromString(fragProg?fragProg:"");
 }
 
 KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
@@ -1209,7 +1209,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2
        for(unsigned int i=0; (i<list_size && i<4); i++)
        {
                PyObject *item = PySequence_GetItem(listPtr, i);
-               array_data[i] = PyInt_AsLong(item);
+               array_data[i] = PyLong_AsSsize_t(item);
                Py_DECREF(item);
        }
        
index 517f31519092075f7b60075aeacfa9b62993df47..42969996b3ec0b8e77ef5e9f154f0b338909b177 100644 (file)
@@ -202,7 +202,7 @@ public:
        void SetUniform(int uniform, const int val);
 
        // Python interface
-       virtual PyObject* py_repr(void) { return PyString_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); }
+       virtual PyObject* py_repr(void) { return PyUnicode_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); }
 
        // -----------------------------------
        KX_PYMETHOD_DOC( BL_Shader, setSource );
index da43893cee3cdf2744d693758e206059c2e9153b..bfc490407948065893d56a47295b9c08c71630f2 100644 (file)
@@ -251,7 +251,7 @@ const char KX_NetworkMessageSensor::SetSubjectFilterText_doc[] =
 PyObject* KX_NetworkMessageSensor::PySetSubjectFilterText(PyObject* value)
 {
        ShowDeprecationWarning("setSubjectFilterText()", "subject");
-       char* Subject = PyString_AsString(value);
+       char* Subject = _PyUnicode_AsString(value);
        if (Subject==NULL) {
                PyErr_SetString(PyExc_TypeError, "sensor.tsetSubjectFilterText(string): KX_NetworkMessageSensor, expected a string message");
                return NULL;
@@ -269,7 +269,7 @@ const char KX_NetworkMessageSensor::GetFrameMessageCount_doc[] =
 PyObject* KX_NetworkMessageSensor::PyGetFrameMessageCount()
 {
        ShowDeprecationWarning("getFrameMessageCount()", "frameMessageCount");
-       return PyInt_FromLong(long(m_frame_message_count));
+       return PyLong_FromSsize_t(long(m_frame_message_count));
 }
 
 // 3. Get the message bodies
@@ -295,7 +295,7 @@ const char KX_NetworkMessageSensor::GetSubject_doc[] =
 PyObject* KX_NetworkMessageSensor::PyGetSubject()
 {
        ShowDeprecationWarning("getSubject()", "subject");
-       return PyString_FromString(m_subject ? m_subject : "");
+       return PyUnicode_FromString(m_subject ? m_subject : "");
 }
 
 // 5. Get the message subjects
index 9e3b718a87a47657162f697e5160a607f7283b37..ea819cea5f209d98ecbb34fed3dd945420568fca 100644 (file)
@@ -892,7 +892,7 @@ void KX_BlenderMaterial::SetBlenderGLSLShader(int layer)
 
 KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getMaterialIndex, "getMaterialIndex()")
 {
-       return PyInt_FromLong( GetMaterialIndex() );
+       return PyLong_FromSsize_t( GetMaterialIndex() );
 }
 
 KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getTexture, "getTexture( index )" )
index 6eb9647a5959bcf72c9cb182d126856eb49c98f6..1f5edc1d7d109ade699e9b5a7a4fbc0ad87fec2e 100644 (file)
@@ -81,7 +81,7 @@ public:
        );
        
        // --------------------------------
-       virtual PyObject* py_repr(void) { return PyString_FromString(mMaterial->matname.ReadPtr()); }
+       virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); }
 
        KX_PYMETHOD_DOC( KX_BlenderMaterial, getShader );
        KX_PYMETHOD_DOC( KX_BlenderMaterial, getMaterialIndex );
index 6e01bf0dded1affc8a72527442ced6d2348e229b..d025dbfa4696e7227a7b502054b2ec5f415602e5 100644 (file)
@@ -249,8 +249,8 @@ KX_PYMETHODDEF_DOC_O(KX_CDActuator, playTrack,
 "playTrack(trackNumber)\n"
 "\tPlays the track selected.\n")
 {
-       if (PyInt_Check(value)) {
-               int track = PyInt_AsLong(value);
+       if (PyLong_Check(value)) {
+               int track = PyLong_AsSsize_t(value);
                SND_CDObject::Instance()->SetPlaymode(SND_CD_TRACK);
                SND_CDObject::Instance()->SetTrack(track);
                SND_CDObject::Instance()->SetPlaystate(SND_MUST_PLAY);
index 4ccbf73b417e25fd34d7867255013a607cc2fc34..85fa579167bc051fe80582c2f1e73e61576c616b 100644 (file)
@@ -586,7 +586,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
                MT_Point3 center;
                if (PyVecTo(pycenter, center))
                {
-                       return PyInt_FromLong(SphereInsideFrustum(center, radius)); /* new ref */
+                       return PyLong_FromSsize_t(SphereInsideFrustum(center, radius)); /* new ref */
                }
        }
 
@@ -637,7 +637,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum,
                        return NULL;
        }
        
-       return PyInt_FromLong(BoxInsideFrustum(box)); /* new ref */
+       return PyLong_FromSsize_t(BoxInsideFrustum(box)); /* new ref */
 }
 
 KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
@@ -659,7 +659,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
        MT_Point3 point;
        if (PyVecTo(value, point))
        {
-               return PyInt_FromLong(PointInsideFrustum(point)); /* new ref */
+               return PyLong_FromSsize_t(PointInsideFrustum(point)); /* new ref */
        }
        
        PyErr_SetString(PyExc_TypeError, "camera.pointInsideFrustum(point): KX_Camera, expected point argument.");
@@ -927,11 +927,11 @@ PyObject* KX_Camera::pyattr_get_world_to_camera(void *self_v, const KX_PYATTRIBU
 
 
 PyObject* KX_Camera::pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{      return PyInt_FromLong(INSIDE); }
+{      return PyLong_FromSsize_t(INSIDE); }
 PyObject* KX_Camera::pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{      return PyInt_FromLong(OUTSIDE); }
+{      return PyLong_FromSsize_t(OUTSIDE); }
 PyObject* KX_Camera::pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{      return PyInt_FromLong(INTERSECT); }
+{      return PyLong_FromSsize_t(INTERSECT); }
 
 
 bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok, const char *error_prefix)
@@ -953,14 +953,14 @@ bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok
                }
        }
        
-       if (PyString_Check(value)) {
-               STR_String value_str = PyString_AsString(value);
+       if (PyUnicode_Check(value)) {
+               STR_String value_str = _PyUnicode_AsString(value);
                *object = KX_GetActiveScene()->FindCamera(value_str);
                
                if (*object) {
                        return true;
                } else {
-                       PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_Camera in this scene", error_prefix, PyString_AsString(value));
+                       PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_Camera in this scene", error_prefix, _PyUnicode_AsString(value));
                        return false;
                }
        }
@@ -1117,7 +1117,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay,
                PyTuple_SET_ITEM(argValue, 0, PyObjectFrom(vect));
                PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(dist));
                if (propName)
-                       PyTuple_SET_ITEM(argValue, 2, PyString_FromString(propName));
+                       PyTuple_SET_ITEM(argValue, 2, PyUnicode_FromString(propName));
 
                PyObject* ret= this->PyrayCastTo(argValue,NULL);
                Py_DECREF(argValue);
index b960ae25841b6f1ed19879a0dd6c8f616810e35e..e2c3ecb1b3ef881e76a10a9da6b986ef65686f88 100644 (file)
@@ -438,7 +438,7 @@ PyObject* KX_CameraActuator::PyGetObject(PyObject* args)
                Py_RETURN_NONE;
        
        if (ret_name_only)
-               return PyString_FromString(m_ob->GetName().ReadPtr());
+               return PyUnicode_FromString(m_ob->GetName().ReadPtr());
        else
                return m_ob->GetProxy();
 }
@@ -563,7 +563,7 @@ const char KX_CameraActuator::GetXY_doc[] =
 PyObject* KX_CameraActuator::PyGetXY()
 {
        ShowDeprecationWarning("getXY()", "the xy property");
-       return PyInt_FromLong(m_x);
+       return PyLong_FromSsize_t(m_x);
 }
 
 PyObject* KX_CameraActuator::pyattr_get_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
index 7e5a2e3190725cd7242a867db2e90beedd72f1d3..8470c2c1f5fb14ccd3bd286ead3c6d28f2de1773 100644 (file)
@@ -672,7 +672,7 @@ const char KX_ConstraintActuator::GetDamp_doc[] =
 "\tReturns the damping parameter.\n";
 PyObject* KX_ConstraintActuator::PyGetDamp(){
        ShowDeprecationWarning("getDamp()", "the damp property");
-       return PyInt_FromLong(m_posDampTime);
+       return PyLong_FromSsize_t(m_posDampTime);
 }
 
 /* 2. setRotDamp                                                                */
@@ -699,7 +699,7 @@ const char KX_ConstraintActuator::GetRotDamp_doc[] =
 "\tReturns the damping time for application of the constraint.\n";
 PyObject* KX_ConstraintActuator::PyGetRotDamp(){
        ShowDeprecationWarning("getRotDamp()", "the rotDamp property");
-       return PyInt_FromLong(m_rotDampTime);
+       return PyLong_FromSsize_t(m_rotDampTime);
 }
 
 /* 2. setDirection                                                                */
@@ -772,7 +772,7 @@ const char KX_ConstraintActuator::GetOption_doc[] =
 "\tReturns the option parameter.\n";
 PyObject* KX_ConstraintActuator::PyGetOption(){
        ShowDeprecationWarning("getOption()", "the option property");
-       return PyInt_FromLong(m_option);
+       return PyLong_FromSsize_t(m_option);
 }
 
 /* 2. setTime                                                                */
@@ -801,7 +801,7 @@ const char KX_ConstraintActuator::GetTime_doc[] =
 "\tReturns the time parameter.\n";
 PyObject* KX_ConstraintActuator::PyGetTime(){
        ShowDeprecationWarning("getTime()", "the time property");
-       return PyInt_FromLong(m_activeTime);
+       return PyLong_FromSsize_t(m_activeTime);
 }
 
 /* 2. setProperty                                                                */
@@ -830,7 +830,7 @@ const char KX_ConstraintActuator::GetProperty_doc[] =
 "\tReturns the property parameter.\n";
 PyObject* KX_ConstraintActuator::PyGetProperty(){
        ShowDeprecationWarning("getProperty()", "the 'property' property");
-       return PyString_FromString(m_property.Ptr());
+       return PyUnicode_FromString(m_property.Ptr());
 }
 
 /* 4. setDistance                                                                 */
@@ -959,7 +959,7 @@ const char KX_ConstraintActuator::GetLimit_doc[] =
 "\tReturns the type of constraint.\n";
 PyObject* KX_ConstraintActuator::PyGetLimit() {
        ShowDeprecationWarning("setLimit()", "the limit property");
-       return PyInt_FromLong(m_locrot);
+       return PyLong_FromSsize_t(m_locrot);
 }
 
 /* eof */
index be23eff6ac0a7379483e9d566fa4d1b4c327f3fc..955dd18d43eb4cd6cdfbe357ee6087e08ebe0777 100644 (file)
@@ -51,7 +51,7 @@ KX_ConstraintWrapper::~KX_ConstraintWrapper()
 
 PyObject* KX_ConstraintWrapper::PyGetConstraintId()
 {
-       return PyInt_FromLong(m_constraintId);
+       return PyLong_FromSsize_t(m_constraintId);
 }
 
 
index 2a769cf6c6665335f1ee70077bb3f94ffbb69cab..029f1f07861807bfa8d9b0ff1fcae47fec03697b 100644 (file)
@@ -258,7 +258,7 @@ const char KX_GameActuator::GetFile_doc[] =
 PyObject* KX_GameActuator::PyGetFile(PyObject* args, PyObject* kwds)
 {      
        ShowDeprecationWarning("getFile()", "the fileName property");
-       return PyString_FromString(m_filename);
+       return PyUnicode_FromString(m_filename);
 }
 
 /* setFile */
index 30b3cb201a7104b3977d4a349ff726bfb63a5710..5798830e243120289819896327be3aed9555ba0c 100644 (file)
@@ -1496,7 +1496,7 @@ PyObject* KX_GameObject::PyGetPosition()
 static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
 {
        KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
-       const char *attr_str= PyString_AsString(item);
+       const char *attr_str= _PyUnicode_AsString(item);
        CValue* resultattr;
        PyObject* pyconvert;
        
@@ -1530,7 +1530,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
 static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 {
        KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
-       const char *attr_str= PyString_AsString(key);
+       const char *attr_str= _PyUnicode_AsString(key);
        if(attr_str==NULL)
                PyErr_Clear();
        
@@ -1624,7 +1624,7 @@ static int Seq_Contains(PyObject *self_v, PyObject *value)
                return -1;
        }
        
-       if(PyString_Check(value) && self->GetProperty(PyString_AsString(value)))
+       if(PyUnicode_Check(value) && self->GetProperty(_PyUnicode_AsString(value)))
                return 1;
        
        if (self->m_attr_dict && PyDict_GetItem(self->m_attr_dict, value))
@@ -1686,7 +1686,7 @@ PyTypeObject KX_GameObject::Type = {
 PyObject* KX_GameObject::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
-       return PyString_FromString(self->GetName().ReadPtr());
+       return PyUnicode_FromString(self->GetName().ReadPtr());
 }
 
 PyObject* KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -1959,13 +1959,13 @@ PyObject* KX_GameObject::pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF
        KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
        int state = 0;
        state |= self->GetState();
-       return PyInt_FromLong(state);
+       return PyLong_FromSsize_t(state);
 }
 
 int KX_GameObject::pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
 {
        KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
-       int state_i = PyInt_AsLong(value);
+       int state_i = PyLong_AsSsize_t(value);
        unsigned int state = 0;
        
        if (state_i == -1 && PyErr_Occurred()) {
@@ -2179,7 +2179,7 @@ PyObject* KX_GameObject::PySetOcclusion(PyObject* args)
 PyObject* KX_GameObject::PyGetVisible()
 {
        ShowDeprecationWarning("getVisible()", "the visible property");
-       return PyInt_FromLong(m_bVisible);      
+       return PyLong_FromSsize_t(m_bVisible);  
 }
 
 PyObject* KX_GameObject::PyGetState()
@@ -2187,13 +2187,13 @@ PyObject* KX_GameObject::PyGetState()
        ShowDeprecationWarning("getState()", "the state property");
        int state = 0;
        state |= GetState();
-       return PyInt_FromLong(state);
+       return PyLong_FromSsize_t(state);
 }
 
 PyObject* KX_GameObject::PySetState(PyObject* value)
 {
        ShowDeprecationWarning("setState()", "the state property");
-       int state_i = PyInt_AsLong(value);
+       int state_i = PyLong_AsSsize_t(value);
        unsigned int state = 0;
        
        if (state_i == -1 && PyErr_Occurred()) {
@@ -2499,7 +2499,7 @@ PyObject* KX_GameObject::PyGetPhysicsId()
        {
                physid= (uint_ptr)ctrl->GetUserData();
        }
-       return PyInt_FromLong((long)physid);
+       return PyLong_FromSsize_t((long)physid);
 }
 
 PyObject* KX_GameObject::PyGetPropertyNames()
@@ -2875,8 +2875,8 @@ PyObject* KX_GameObject::Pyget(PyObject *args)
                return NULL;
        
        
-       if(PyString_Check(key)) {
-               CValue *item = GetProperty(PyString_AsString(key));
+       if(PyUnicode_Check(key)) {
+               CValue *item = GetProperty(_PyUnicode_AsString(key));
                if (item) {
                        ret = item->ConvertValueToPython();
                        if(ret)
@@ -2945,13 +2945,13 @@ bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py
                }
        }
        
-       if (PyString_Check(value)) {
-               *object = (KX_GameObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String( PyString_AsString(value) ));
+       if (PyUnicode_Check(value)) {
+               *object = (KX_GameObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetGameObjectByName(STR_String( _PyUnicode_AsString(value) ));
                
                if (*object) {
                        return true;
                } else {
-                       PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_GameObject in this scene", error_prefix, PyString_AsString(value));
+                       PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_GameObject in this scene", error_prefix, _PyUnicode_AsString(value));
                        return false;
                }
        }
index 1abd4399295212f0e8dbec09c7d6cf303d6cdf1c..947cc9959ffd494fd9bb16b48055baa4b684d6e9 100644 (file)
@@ -809,7 +809,7 @@ public:
         */
        virtual PyObject* py_repr(void)
        {
-               return PyString_FromString(GetName().ReadPtr());
+               return PyUnicode_FromString(GetName().ReadPtr());
        }
                
        KX_PYMETHOD_NOARGS(KX_GameObject,GetPosition);
index 18e91250233a03538c556c4a81ddad69bbc086d0..0edb6747f2f89601b278dd8c25406b0e4c46d4f1 100644 (file)
@@ -673,7 +673,7 @@ const char KX_IpoActuator::GetType_doc[] =
 "\tReturns the operation mode of the actuator.\n";
 PyObject* KX_IpoActuator::PyGetType() {
        ShowDeprecationWarning("getType()", "the mode property");
-       return PyInt_FromLong(m_type);
+       return PyLong_FromSsize_t(m_type);
 }
 
 /* 10. setForceIpoActsLocal:                                                 */
index c7d8ab4f0d1e79795bf7016925f843b158551d95..08542ec16022ea436d38d426594513de2d8fda02 100644 (file)
@@ -349,11 +349,11 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
        const char* type = attrdef->m_name;
 
        if(strcmp(type, "SPOT")) {
-               retvalue = PyInt_FromLong(RAS_LightObject::LIGHT_SPOT);
+               retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SPOT);
        } else if (strcmp(type, "SUN")) {
-               retvalue = PyInt_FromLong(RAS_LightObject::LIGHT_SUN);
+               retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SUN);
        } else if (strcmp(type, "NORMAL")) {
-               retvalue = PyInt_FromLong(RAS_LightObject::LIGHT_NORMAL);
+               retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_NORMAL);
        }
 
        return retvalue;
@@ -362,13 +362,13 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
 PyObject* KX_LightObject::pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
-       return PyInt_FromLong(self->m_lightobj.m_type);
+       return PyLong_FromSsize_t(self->m_lightobj.m_type);
 }
 
 int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value)
 {
        KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
-       int val = PyInt_AsLong(value);
+       int val = PyLong_AsSsize_t(value);
        if((val==-1 && PyErr_Occurred()) || val<0 || val>2) {
                PyErr_SetString(PyExc_ValueError, "light.type= val: KX_LightObject, expected an int between 0 and 2");
                return PY_SET_ATTR_FAIL;
index 79aa887601a51e586643ad1d15c314b598dbf5e3..2c0c31c96c4260de0c54dd115b2b5f3bf5c4e2c3 100644 (file)
@@ -132,14 +132,14 @@ PyObject* KX_MeshProxy::PyGetNumMaterials(PyObject* args, PyObject* kwds)
 {
        int num = m_meshobj->NumMaterials();
        ShowDeprecationWarning("getNumMaterials()", "the numMaterials property");
-       return PyInt_FromLong(num);
+       return PyLong_FromSsize_t(num);
 }
 
 PyObject* KX_MeshProxy::PyGetNumPolygons()
 {
        int num = m_meshobj->NumPolygons();
        ShowDeprecationWarning("getNumPolygons()", "the numPolygons property");
-       return PyInt_FromLong(num);
+       return PyLong_FromSsize_t(num);
 }
 
 PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* args, PyObject* kwds)
@@ -155,7 +155,7 @@ PyObject* KX_MeshProxy::PyGetMaterialName(PyObject* args, PyObject* kwds)
                return NULL;
        }
 
-       return PyString_FromString(matname.Ptr());
+       return PyUnicode_FromString(matname.Ptr());
                
 }
        
@@ -173,7 +173,7 @@ PyObject* KX_MeshProxy::PyGetTextureName(PyObject* args, PyObject* kwds)
                return NULL;
        }
 
-       return PyString_FromString(matname.Ptr());
+       return PyUnicode_FromString(matname.Ptr());
                
 }
 
@@ -196,7 +196,7 @@ PyObject* KX_MeshProxy::PyGetVertexArrayLength(PyObject* args, PyObject* kwds)
                        length = m_meshobj->NumVertices(mat);
        }
        
-       return PyInt_FromLong(length);
+       return PyLong_FromSsize_t(length);
 }
 
 
@@ -286,12 +286,12 @@ PyObject* KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_
 
 PyObject * KX_MeshProxy::pyattr_get_numMaterials(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef) {
        KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
-       return PyInt_FromLong(self->m_meshobj->NumMaterials());
+       return PyLong_FromSsize_t(self->m_meshobj->NumMaterials());
 }
 
 PyObject * KX_MeshProxy::pyattr_get_numPolygons(void * selfv, const KX_PYATTRIBUTE_DEF * attrdef) {
        KX_MeshProxy * self = static_cast<KX_MeshProxy *> (selfv);
-       return PyInt_FromLong(self->m_meshobj->NumPolygons());
+       return PyLong_FromSsize_t(self->m_meshobj->NumPolygons());
 }
 
 /* a close copy of ConvertPythonToGameObject but for meshes */
@@ -314,13 +314,13 @@ bool ConvertPythonToMesh(PyObject * value, RAS_MeshObject **object, bool py_none
                }
        }
        
-       if (PyString_Check(value)) {
-               *object = (RAS_MeshObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetMeshByName(STR_String( PyString_AsString(value) ));
+       if (PyUnicode_Check(value)) {
+               *object = (RAS_MeshObject*)SCA_ILogicBrick::m_sCurrentLogicManager->GetMeshByName(STR_String( _PyUnicode_AsString(value) ));
                
                if (*object) {
                        return true;
                } else {
-                       PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_MeshProxy in this scene", error_prefix, PyString_AsString(value));
+                       PyErr_Format(PyExc_ValueError, "%s, requested name \"%s\" did not match any KX_MeshProxy in this scene", error_prefix, _PyUnicode_AsString(value));
                        return false;
                }
        }
index 15e82581bc6ac59d04993c619c5e4e71c9900072..b13c225a16f780c492aa4a309771f167380bce2e 100644 (file)
@@ -556,7 +556,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitX(void *self_v, const KX_PYATTRIBUTE
        {
                self->m_drot[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
                self->m_dloc[0] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
-               self->m_bitLocalFlag.Torque = (PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+               self->m_bitLocalFlag.Torque = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
 
                if (!PyErr_Occurred())
                {
@@ -592,7 +592,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitY(void *self_v, const KX_PYATTRIBUTE
        {
                self->m_drot[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
                self->m_dloc[1] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
-               self->m_bitLocalFlag.DLoc = (PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+               self->m_bitLocalFlag.DLoc = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
 
                if (!PyErr_Occurred())
                {
@@ -628,7 +628,7 @@ int KX_ObjectActuator::pyattr_set_forceLimitZ(void *self_v, const KX_PYATTRIBUTE
        {
                self->m_drot[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 0));
                self->m_dloc[2] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, 1));
-               self->m_bitLocalFlag.DRot = (PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2)) != 0);
+               self->m_bitLocalFlag.DRot = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2)) != 0);
 
                if (!PyErr_Occurred())
                {
index a68bafc4d863dc17bc7e2c95bc1683c81eacc016..fb2fd61406269a2c871a54a3a88c0cacebbefb3a 100644 (file)
@@ -257,7 +257,7 @@ PyObject* KX_ParentActuator::PyGetObject(PyObject* args)
                Py_RETURN_NONE;
        
        if (ret_name_only)
-               return PyString_FromString(m_ob->GetName().ReadPtr());
+               return PyUnicode_FromString(m_ob->GetName().ReadPtr());
        else
                return m_ob->GetProxy();
 }
index babead252747ef19ff262851d5d920a7ee9412c6..7fd667eeaf3284b5c7ec23a7c958dbb02db9a0b2 100644 (file)
@@ -99,14 +99,14 @@ PyAttributeDef KX_PolyProxy::Attributes[] = {
 #if 0
 PyObject* KX_PolyProxy::py_getattro(PyObject *attr)
 {
-       char *attr_str= PyString_AsString(attr);
+       char *attr_str= _PyUnicode_AsString(attr);
        if (!strcmp(attr_str, "matname"))
        {
-               return PyString_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
+               return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
        }
        if (!strcmp(attr_str, "texture"))
        {
-               return PyString_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
+               return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
        }
        if (!strcmp(attr_str, "material"))
        {
@@ -135,31 +135,31 @@ PyObject* KX_PolyProxy::py_getattro(PyObject *attr)
                                // found it
                                break;
                }
-               return PyInt_FromLong(matid);
+               return PyLong_FromSsize_t(matid);
        }
        if (!strcmp(attr_str, "v1"))
        {
-               return PyInt_FromLong(m_polygon->GetVertexOffset(0));
+               return PyLong_FromSsize_t(m_polygon->GetVertexOffset(0));
        }
        if (!strcmp(attr_str, "v2"))
        {
-               return PyInt_FromLong(m_polygon->GetVertexOffset(1));
+               return PyLong_FromSsize_t(m_polygon->GetVertexOffset(1));
        }
        if (!strcmp(attr_str, "v3"))
        {
-               return PyInt_FromLong(m_polygon->GetVertexOffset(2));
+               return PyLong_FromSsize_t(m_polygon->GetVertexOffset(2));
        }
        if (!strcmp(attr_str, "v4"))
        {
-               return PyInt_FromLong(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffset(3):0));
+               return PyLong_FromSsize_t(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffset(3):0));
        }
        if (!strcmp(attr_str, "visible"))
        {
-               return PyInt_FromLong(m_polygon->IsVisible());
+               return PyLong_FromSsize_t(m_polygon->IsVisible());
        }
        if (!strcmp(attr_str, "collide"))
        {
-               return PyInt_FromLong(m_polygon->IsCollider());
+               return PyLong_FromSsize_t(m_polygon->IsCollider());
        }
        // py_getattro_up(CValue); // XXX -- todo, make all these attributes
 }
@@ -200,37 +200,37 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex,
                        // found it
                        break;
        }
-       return PyInt_FromLong(matid);
+       return PyLong_FromSsize_t(matid);
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getNumVertex,
 "getNumVertex() : returns the number of vertex of the polygon, 3 or 4\n")
 {
-       return PyInt_FromLong(m_polygon->VertexCount());
+       return PyLong_FromSsize_t(m_polygon->VertexCount());
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isVisible,
 "isVisible() : returns whether the polygon is visible or not\n")
 {
-       return PyInt_FromLong(m_polygon->IsVisible());
+       return PyLong_FromSsize_t(m_polygon->IsVisible());
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, isCollider,
 "isCollider() : returns whether the polygon is receives collision or not\n")
 {
-       return PyInt_FromLong(m_polygon->IsCollider());
+       return PyLong_FromSsize_t(m_polygon->IsCollider());
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialName,
 "getMaterialName() : returns the polygon material name, \"NoMaterial\" if no material\n")
 {
-       return PyString_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
+       return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getTextureName,
 "getTexturelName() : returns the polygon texture name, \"NULL\" if no texture\n")
 {
-       return PyString_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
+       return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
 }
 
 KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
@@ -251,9 +251,9 @@ KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
        }
        if (index < m_polygon->VertexCount())
        {
-               return PyInt_FromLong(m_polygon->GetVertexOffset(index));
+               return PyLong_FromSsize_t(m_polygon->GetVertexOffset(index));
        }
-       return PyInt_FromLong(0);
+       return PyLong_FromSsize_t(0);
 }
 
 KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMesh,
index 8d8492cc062248dd33b97d7e9c07e6ad77137f6c..4d5e7ca565b2592c7e6f56810f0d39ebc699507c 100644 (file)
@@ -115,7 +115,7 @@ bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingI
                PyObject *ret = PyObject_CallMethod(m_pymaterial, "activate", "(NNO)", pyRasty, pyCachingInfo, (PyObject*) this->m_proxy);
                if (ret)
                {
-                       bool value = PyInt_AsLong(ret);
+                       bool value = PyLong_AsSsize_t(ret);
                        Py_DECREF(ret);
                        dopass = value;
                }
@@ -332,13 +332,13 @@ KX_PYMETHODDEF_DOC(KX_PolygonMaterial, activate, "activate(rasty, cachingInfo)")
 PyObject* KX_PolygonMaterial::pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
-       return PyString_FromString(self->m_texturename.ReadPtr());
+       return PyUnicode_FromString(self->m_texturename.ReadPtr());
 }
 
 PyObject* KX_PolygonMaterial::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
-       return PyString_FromString(self->m_materialname.ReadPtr());
+       return PyUnicode_FromString(self->m_materialname.ReadPtr());
 }
 
 /* this does not seem useful */
@@ -355,7 +355,7 @@ PyObject* KX_PolygonMaterial::pyattr_get_gl_texture(void *self_v, const KX_PYATT
        if (self->m_tface && self->m_tface->tpage)
                bindcode= self->m_tface->tpage->bindcode;
        
-       return PyInt_FromLong(bindcode);
+       return PyLong_FromSsize_t(bindcode);
 }
 
 
index 481c429f658748c1291b73bdd5b5fefc56936e0a..266b4d7e789d1c85f688a1535edceb3719f9182a 100644 (file)
@@ -116,7 +116,7 @@ public:
        KX_PYMETHOD_DOC(KX_PolygonMaterial, setCustomMaterial);
        KX_PYMETHOD_DOC(KX_PolygonMaterial, loadProgram);
 
-       virtual PyObject* py_repr(void) { return PyString_FromString(m_material ? ((ID *)m_material)->name+2 : ""); }
+       virtual PyObject* py_repr(void) { return PyUnicode_FromString(m_material ? ((ID *)m_material)->name+2 : ""); }
        
        static PyObject*        pyattr_get_texture(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static PyObject*        pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
index 4ec901a2f5e35ca605779bf6382f20fd38146376..94e8d1fd5836a657a5d37542eca25456bff1b7cb 100644 (file)
@@ -640,7 +640,7 @@ PyObject*   initPythonConstraintBinding()
 
   // Add some symbolic constants to the module
   d = PyModule_GetDict(m);
-  ErrorObject = PyString_FromString("PhysicsConstraints.error");
+  ErrorObject = PyUnicode_FromString("PhysicsConstraints.error");
   PyDict_SetItemString(d, "error", ErrorObject);
   Py_DECREF(ErrorObject);
 
index 736460d33db27bb5a52e0b36dbe728c22dfaad2b..eead7a51885fdd0092b1c64b4e51071b90b7a98c 100644 (file)
@@ -130,10 +130,10 @@ void      KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,cons
 }
 
 /* Macro for building the keyboard translation */
-//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyInt_FromLong(SCA_IInputDevice::KX_##name))
-#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyInt_FromLong(name)); Py_DECREF(item)
+//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromSsize_t(SCA_IInputDevice::KX_##name))
+#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name)); Py_DECREF(item)
 /* For the defines for types from logic bricks, we do stuff explicitly... */
-#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyInt_FromLong(name2)); Py_DECREF(item)
+#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item)
 
 
 // temporarily python stuff, will be put in another place later !
@@ -181,7 +181,7 @@ static PyObject* gPyExpandPath(PyObject*, PyObject* args)
 
        BLI_strncpy(expanded, filename, FILE_MAXDIR + FILE_MAXFILE);
        BLI_convertstringcode(expanded, gp_GamePythonPath);
-       return PyString_FromString(expanded);
+       return PyUnicode_FromString(expanded);
 }
 
 static char gPySendMessage_doc[] = 
@@ -306,7 +306,7 @@ static PyObject* gPySetMaxLogicFrame(PyObject*, PyObject* args)
 
 static PyObject* gPyGetMaxLogicFrame(PyObject*)
 {
-       return PyInt_FromLong(KX_KetsjiEngine::GetMaxLogicFrame());
+       return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxLogicFrame());
 }
 
 static PyObject* gPySetMaxPhysicsFrame(PyObject*, PyObject* args)
@@ -321,7 +321,7 @@ static PyObject* gPySetMaxPhysicsFrame(PyObject*, PyObject* args)
 
 static PyObject* gPyGetMaxPhysicsFrame(PyObject*)
 {
-       return PyInt_FromLong(KX_KetsjiEngine::GetMaxPhysicsFrame());
+       return PyLong_FromSsize_t(KX_KetsjiEngine::GetMaxPhysicsFrame());
 }
 
 static PyObject* gPySetPhysicsTicRate(PyObject*, PyObject* args)
@@ -386,7 +386,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
        
     while ((dirp = readdir(dp)) != NULL) {
                if (BLI_testextensie(dirp->d_name, ".blend")) {
-                       value = PyString_FromString(dirp->d_name);
+                       value = PyUnicode_FromString(dirp->d_name);
                        PyList_Append(list, value);
                        Py_DECREF(value);
                }
@@ -500,7 +500,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
 
 static PyObject *gEvalExpression(PyObject*, PyObject* value)
 {
-       char* txt= PyString_AsString(value);
+       char* txt= _PyUnicode_AsString(value);
        
        if (txt==NULL) {
                PyErr_SetString(PyExc_TypeError, "Expression.calc(text): expects a single string argument");
@@ -558,14 +558,14 @@ static struct PyMethodDef game_methods[] = {
 
 static PyObject* gPyGetWindowHeight(PyObject*, PyObject* args)
 {
-       return PyInt_FromLong((gp_Canvas ? gp_Canvas->GetHeight() : 0));
+       return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetHeight() : 0));
 }
 
 
 
 static PyObject* gPyGetWindowWidth(PyObject*, PyObject* args)
 {
-       return PyInt_FromLong((gp_Canvas ? gp_Canvas->GetWidth() : 0));
+       return PyLong_FromSsize_t((gp_Canvas ? gp_Canvas->GetWidth() : 0));
 }
 
 
@@ -893,7 +893,7 @@ static PyObject* gPyGetGLSLMaterialSetting(PyObject*,
        }
 
        enabled = ((G.fileflags & flag) != 0);
-       return PyInt_FromLong(enabled);
+       return PyLong_FromSsize_t(enabled);
 }
 
 #define KX_TEXFACE_MATERIAL                            0
@@ -937,7 +937,7 @@ static PyObject* gPyGetMaterialType(PyObject*)
        else
                flag = KX_TEXFACE_MATERIAL;
        
-       return PyInt_FromLong(flag);
+       return PyLong_FromSsize_t(flag);
 }
 
 static PyObject* gPyDrawLine(PyObject*, PyObject* args)
@@ -1075,7 +1075,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
        
        PyDict_SetItemString(d, "globalDict", item=PyDict_New()); Py_DECREF(item);
 
-       ErrorObject = PyString_FromString("GameLogic.error");
+       ErrorObject = PyUnicode_FromString("GameLogic.error");
        PyDict_SetItemString(d, "error", ErrorObject);
        Py_DECREF(ErrorObject);
        
@@ -1362,7 +1362,7 @@ PyObject *KXpy_import(PyObject *self, PyObject *args)
        /* check for builtin modules */
        m = PyImport_AddModule("sys");
        l = PyObject_GetAttrString(m, "builtin_module_names");
-       n = PyString_FromString(name);
+       n = PyUnicode_FromString(name);
        
        if (PySequence_Contains(l, n)) {
                return PyImport_ImportModuleEx(name, globals, locals, fromlist);
@@ -1538,7 +1538,7 @@ static void initPySysObjects__append(PyObject *sys_path, char *filename)
        BLI_split_dirfile_basic(filename, expanded, NULL); /* get the dir part of filename only */
        BLI_convertstringcode(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
        BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */
-       item= PyString_FromString(expanded);
+       item= PyUnicode_FromString(expanded);
        
 //     printf("SysPath - '%s', '%s', '%s'\n", expanded, filename, gp_GamePythonPath);
        
@@ -1735,7 +1735,7 @@ PyObject* initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
 
   // Add some symbolic constants to the module
   d = PyModule_GetDict(m);
-  ErrorObject = PyString_FromString("Rasterizer.error");
+  ErrorObject = PyUnicode_FromString("Rasterizer.error");
   PyDict_SetItemString(d, "error", ErrorObject);
   Py_DECREF(ErrorObject);
 
@@ -1813,10 +1813,10 @@ static PyObject* gPyEventToCharacter(PyObject*, PyObject* args)
        if(IsPrintable(event)) {
                char ch[2] = {'\0', '\0'};
                ch[0] = ToCharacter(event, (bool)shift);
-               return PyString_FromString(ch);
+               return PyUnicode_FromString(ch);
        }
        else {
-               return PyString_FromString("");
+               return PyUnicode_FromString("");
        }
 }
 
@@ -2044,7 +2044,7 @@ int saveGamePythonConfig( char **marshal_buffer)
                                char *marshal_cstring;
                                
 #if PY_VERSION_HEX < 0x03000000
-                               marshal_cstring = PyString_AsString(pyGlobalDictMarshal);
+                               marshal_cstring = _PyUnicode_AsString(pyGlobalDictMarshal);
                                marshal_length= PyString_Size(pyGlobalDictMarshal);
 #else                  // py3 uses byte arrays
                                marshal_cstring = PyBytes_AsString(pyGlobalDictMarshal);
index 524d957a80c6a33a379be11bbb14d86f597aa670..5b4d77156db67fa5e4699c57040ed157c5415e10 100644 (file)
@@ -221,11 +221,11 @@ static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key)
                return NULL;
        }
        
-       if (PyInt_Check(key)) {
-               return KX_PythonSeq_getIndex(self, PyInt_AS_LONG( key ));
+       if (PyLong_Check(key)) {
+               return KX_PythonSeq_getIndex(self, PyLong_AsSsize_t( key ));
        }
-       else if ( PyString_Check(key) ) {
-               char *name = PyString_AsString(key);
+       else if ( PyUnicode_Check(key) ) {
+               char *name = _PyUnicode_AsString(key);
                PyObjectPlus *ret = KX_PythonSeq_subscript__internal(self, name);
                
                if(ret) {
@@ -250,12 +250,12 @@ static int KX_PythonSeq_contains(PyObject *self, PyObject *key)
                PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: "BGE_PROXY_ERROR_MSG);
                return -1;
        }
-       if(!PyString_Check(key)) {
+       if(!PyUnicode_Check(key)) {
                PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: key must be a string");
                return -1;
        }
        
-       if(KX_PythonSeq_subscript__internal(self, PyString_AsString(key)))
+       if(KX_PythonSeq_subscript__internal(self, _PyUnicode_AsString(key)))
                return 1;
        
        return 0;
index 2a4ae3a2abdd5ee6a6d338c696b8cd78cf46ca05..69214dbbbcf5041a26254f4a3dca8bfefd19a5ee 100644 (file)
@@ -298,7 +298,7 @@ const char KX_SCA_AddObjectActuator::SetTime_doc[] =
 PyObject* KX_SCA_AddObjectActuator::PySetTime(PyObject* value)
 {
        ShowDeprecationWarning("setTime()", "the time property");
-       int deltatime = PyInt_AsLong(value);
+       int deltatime = PyLong_AsSsize_t(value);
        if (deltatime==-1 && PyErr_Occurred()) {
                PyErr_SetString(PyExc_TypeError, "expected an int");
                return NULL;
@@ -321,7 +321,7 @@ const char KX_SCA_AddObjectActuator::GetTime_doc[] =
 PyObject* KX_SCA_AddObjectActuator::PyGetTime()
 {
        ShowDeprecationWarning("getTime()", "the time property");
-       return PyInt_FromLong(m_timeProp);
+       return PyLong_FromSsize_t(m_timeProp);
 }
 
 
@@ -343,7 +343,7 @@ PyObject* KX_SCA_AddObjectActuator::PyGetObject(PyObject* args)
                Py_RETURN_NONE;
        
        if (ret_name_only)
-               return PyString_FromString(m_OriginalObject->GetName().ReadPtr());
+               return PyUnicode_FromString(m_OriginalObject->GetName().ReadPtr());
        else
                return m_OriginalObject->GetProxy();
 }
index 8626512fdf355abcd7341797450aaead60d3cdaa..3cff9457c347d996efec0a950d69b6f4dafaca35 100644 (file)
@@ -121,7 +121,7 @@ KX_PYMETHODDEF_DOC(KX_SCA_DynamicActuator, getOperation,
 )
 {
        ShowDeprecationWarning("getOperation()", "the mode property");
-       return PyInt_FromLong((long)m_dyn_operation);
+       return PyLong_FromSsize_t((long)m_dyn_operation);
 }
 
 
index 873272a37f969debdee9d9a77a6ed638273040d8..ee50008edae1d18cbd887ad3bfd2bd3bbd779531 100644 (file)
@@ -140,7 +140,7 @@ KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, getMesh,
        if (!m_mesh)
                Py_RETURN_NONE;
 
-       return PyString_FromString(const_cast<char *>(m_mesh->GetName().ReadPtr()));
+       return PyUnicode_FromString(const_cast<char *>(m_mesh->GetName().ReadPtr()));
 }
 
 
index f2bbc8e6fefbed2e0aa613a8060c0eb2663d1ae4..5f3ed690adcded5a647b82b79237b9a0f59d8aee 100644 (file)
@@ -1653,7 +1653,7 @@ PyMethodDef KX_Scene::Methods[] = {
 PyObject* KX_Scene::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_Scene* self= static_cast<KX_Scene*>(self_v);
-       return PyString_FromString(self->GetName().ReadPtr());
+       return PyUnicode_FromString(self->GetName().ReadPtr());
 }
 
 PyObject* KX_Scene::pyattr_get_objects(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -1753,7 +1753,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_Scene, getName,
 )
 {
        ShowDeprecationWarning("getName()", "the name property");
-       return PyString_FromString(GetName());
+       return PyUnicode_FromString(GetName());
 }
 
 KX_PYMETHODDEF_DOC(KX_Scene, addObject,
index edc4297ff14d56c309f9836ae0326e9d197a7e6c..2792f1f5fe4f6aff8454e0d9c2fc7a9827e3a6bb 100644 (file)
@@ -563,7 +563,7 @@ public:
        static PyObject*        pyattr_get_active_camera(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static int                      pyattr_set_active_camera(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 
-       virtual PyObject* py_repr(void) { return PyString_FromString(GetName().ReadPtr()); }
+       virtual PyObject* py_repr(void) { return PyUnicode_FromString(GetName().ReadPtr()); }
                
        /**
         * Sets the time the scene was suspended
index 16521f2ddcc6e65920f90627308535323797e713..76869f82c1a2b13e091cf02d1a6deeea142e4f23 100644 (file)
@@ -332,7 +332,7 @@ const char KX_SceneActuator::GetUseRestart_doc[] =
 PyObject* KX_SceneActuator::PyGetUseRestart()
 {
        ShowDeprecationWarning("getUseRestart()", "the useRestart property");
-       return PyInt_FromLong(!(m_restart == 0));
+       return PyLong_FromSsize_t(!(m_restart == 0));
 }
 
 
@@ -368,7 +368,7 @@ const char KX_SceneActuator::GetScene_doc[] =
 PyObject* KX_SceneActuator::PyGetScene()
 {
        ShowDeprecationWarning("getScene()", "the scene property");
-       return PyString_FromString(m_nextSceneName);
+       return PyUnicode_FromString(m_nextSceneName);
 }
 
 
@@ -409,7 +409,7 @@ PyObject* KX_SceneActuator::PyGetCamera()
 {
        ShowDeprecationWarning("getCamera()", "the camera property");
        if (m_camera) {
-               return PyString_FromString(m_camera->GetName());
+               return PyUnicode_FromString(m_camera->GetName());
        }
        else {
                Py_RETURN_NONE;
index 28e46cc9fa2e87f5c7e9b5066b7b72f65c33cd79..0ad699fd811e843fd8d9cffe2f95e28da18affe8 100644 (file)
@@ -338,7 +338,7 @@ PyObject* KX_SoundActuator::pyattr_get_filename(void *self, const struct KX_PYAT
        KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
        if (!actuator->m_soundObject)
        {
-               return PyString_FromString("");
+               return PyUnicode_FromString("");
        }
        STR_String objectname = actuator->m_soundObject->GetObjectName();
        char* name = objectname.Ptr();
@@ -347,7 +347,7 @@ PyObject* KX_SoundActuator::pyattr_get_filename(void *self, const struct KX_PYAT
                PyErr_SetString(PyExc_RuntimeError, "value = actuator.fileName: KX_SoundActuator, unable to get sound fileName");
                return NULL;
        } else
-               return PyString_FromString(name);
+               return PyUnicode_FromString(name);
 }
 
 PyObject* KX_SoundActuator::pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
@@ -382,7 +382,7 @@ PyObject* KX_SoundActuator::pyattr_get_looping(void *self, const struct KX_PYATT
 {
        KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
        int looping = (actuator->m_soundObject) ? actuator->m_soundObject->GetLoopMode() : (int)SND_LOOP_OFF;
-       PyObject* result = PyInt_FromLong(looping);
+       PyObject* result = PyLong_FromSsize_t(looping);
        
        return result;
 }
@@ -560,7 +560,7 @@ PyObject* KX_SoundActuator::PyGetFilename()
        ShowDeprecationWarning("getFilename()", "the fileName property");
        if (!m_soundObject)
        {
-               return PyString_FromString("");
+               return PyUnicode_FromString("");
        }
        STR_String objectname = m_soundObject->GetObjectName();
        char* name = objectname.Ptr();
@@ -569,7 +569,7 @@ PyObject* KX_SoundActuator::PyGetFilename()
                PyErr_SetString(PyExc_RuntimeError, "Unable to get sound fileName");
                return NULL;
        } else
-               return PyString_FromString(name);
+               return PyUnicode_FromString(name);
 }
 
 PyObject* KX_SoundActuator::PySetGain(PyObject* args)
@@ -669,7 +669,7 @@ PyObject* KX_SoundActuator::PyGetLooping()
 {
        ShowDeprecationWarning("getLooping()", "the looping property");
        int looping = (m_soundObject) ? m_soundObject->GetLoopMode() : (int)SND_LOOP_OFF;
-       PyObject* result = PyInt_FromLong(looping);
+       PyObject* result = PyLong_FromSsize_t(looping);
        
        return result;
 }
@@ -757,7 +757,7 @@ PyObject* KX_SoundActuator::PySetType(PyObject* args)
 PyObject* KX_SoundActuator::PyGetType()
 {
        ShowDeprecationWarning("getType()", "the mode property");
-       return PyInt_FromLong(m_type);
+       return PyLong_FromSsize_t(m_type);
 }
 // <-----
 
index 8686de8f2ca14160a1a9763efa4f121c2778f724..32c19df3542a36d596068afd2204b0879ea56361 100644 (file)
@@ -357,7 +357,7 @@ const char KX_TouchSensor::SetProperty_doc[] =
 PyObject* KX_TouchSensor::PySetProperty(PyObject* value)
 {
        ShowDeprecationWarning("setProperty()", "the propName property");
-       char *nameArg= PyString_AsString(value);
+       char *nameArg= _PyUnicode_AsString(value);
        if (nameArg==NULL) {
                PyErr_SetString(PyExc_ValueError, "expected a ");
                return NULL;
@@ -375,7 +375,7 @@ const char KX_TouchSensor::GetProperty_doc[] =
 PyObject*  KX_TouchSensor::PyGetProperty() {
        ShowDeprecationWarning("getProperty()", "the propName property");
        
-       return PyString_FromString(m_touchedpropname);
+       return PyUnicode_FromString(m_touchedpropname);
 }
 
 const char KX_TouchSensor::GetHitObject_doc[] = 
@@ -416,7 +416,7 @@ const char KX_TouchSensor::GetTouchMaterial_doc[] =
 PyObject* KX_TouchSensor::PyGetTouchMaterial()
 {
        ShowDeprecationWarning("getTouchMaterial()", "the useMaterial property");
-       return PyInt_FromLong(m_bFindMaterial);
+       return PyLong_FromSsize_t(m_bFindMaterial);
 }
 
 /* 6. setTouchMaterial */
@@ -429,7 +429,7 @@ const char KX_TouchSensor::SetTouchMaterial_doc[] =
 PyObject* KX_TouchSensor::PySetTouchMaterial(PyObject *value)
 {
        ShowDeprecationWarning("setTouchMaterial()", "the useMaterial property");
-       int pulseArg = PyInt_AsLong(value);
+       int pulseArg = PyLong_AsSsize_t(value);
 
        if(pulseArg ==-1 && PyErr_Occurred()) {
                PyErr_SetString(PyExc_ValueError, "expected a bool");
index 12f0137977a482722bb280dd501820b6b5b742cd..49737a6dfc2892a1f01adaad8fa5f352ca7f24d2 100644 (file)
@@ -552,7 +552,7 @@ PyObject* KX_TrackToActuator::PyGetObject(PyObject* args)
                Py_RETURN_NONE;
        
        if (ret_name_only)
-               return PyString_FromString(m_object->GetName());
+               return PyUnicode_FromString(m_object->GetName());
        else
                return m_object->GetProxy();
 }
@@ -589,7 +589,7 @@ const char KX_TrackToActuator::GetTime_doc[] =
 PyObject* KX_TrackToActuator::PyGetTime()
 {
        ShowDeprecationWarning("getTime()", "the timer property");
-       return PyInt_FromLong(m_time);
+       return PyLong_FromSsize_t(m_time);
 }
 
 
@@ -601,7 +601,7 @@ const char KX_TrackToActuator::GetUse3D_doc[] =
 PyObject* KX_TrackToActuator::PyGetUse3D()
 {
        ShowDeprecationWarning("setTime()", "the use3D property");
-       return PyInt_FromLong(!(m_allow3D == 0));
+       return PyLong_FromSsize_t(!(m_allow3D == 0));
 }
 
 
index b742c9d145aa86d3a81762f3be537a1cdeb84de7..484c8f38b3ffa2f36411c8bc2856544d7bf59697 100644 (file)
@@ -127,13 +127,13 @@ PyObject* KX_VehicleWrapper::PyGetWheelOrientationQuaternion(PyObject* args)
 
 PyObject* KX_VehicleWrapper::PyGetNumWheels(PyObject* args)
 {
-       return PyInt_FromLong(m_vehicle->GetNumWheels());
+       return PyLong_FromSsize_t(m_vehicle->GetNumWheels());
 }
 
 
 PyObject* KX_VehicleWrapper::PyGetConstraintId(PyObject* args)
 {
-       return PyInt_FromLong(m_vehicle->GetUserConstraintId());
+       return PyLong_FromSsize_t(m_vehicle->GetUserConstraintId());
 }
 
 
@@ -264,7 +264,7 @@ PyObject* KX_VehicleWrapper::PySetSteeringValue(PyObject* args)
 
 PyObject* KX_VehicleWrapper::PyGetConstraintType(PyObject* args)
 {
-       return PyInt_FromLong(m_vehicle->GetUserConstraintType());
+       return PyLong_FromSsize_t(m_vehicle->GetUserConstraintType());
 }
 
 
index e4192bf7d678a5fab1143bd2094781fdb7d614f2..34a84f908a83c14df4eb0a12ee6cc3709f600202 100644 (file)
@@ -114,7 +114,7 @@ PyAttributeDef KX_VertexProxy::Attributes[] = {
 PyObject*
 KX_VertexProxy::py_getattro(PyObject *attr)
 {
-  char *attr_str= PyString_AsString(attr);
+  char *attr_str= _PyUnicode_AsString(attr);
   if (attr_str[1]=='\0') { // Group single letters
     // pos
     if (attr_str[0]=='x')
@@ -169,7 +169,7 @@ KX_VertexProxy::py_getattro(PyObject *attr)
 #if 0
 int    KX_VertexProxy::py_setattro(PyObject *attr, PyObject *pyvalue)
 {
-  char *attr_str= PyString_AsString(attr);
+  char *attr_str= _PyUnicode_AsString(attr);
   if (PySequence_Check(pyvalue))
   {
        if (!strcmp(attr_str, "XYZ"))
@@ -384,13 +384,13 @@ PyObject* KX_VertexProxy::PySetNormal(PyObject* value)
 PyObject* KX_VertexProxy::PyGetRGBA()
 {
        int *rgba = (int *) m_vertex->getRGBA();
-       return PyInt_FromLong(*rgba);
+       return PyLong_FromSsize_t(*rgba);
 }
 
 PyObject* KX_VertexProxy::PySetRGBA(PyObject* value)
 {
-       if PyInt_Check(value) {
-               int rgba = PyInt_AsLong(value);
+       if PyLong_Check(value) {
+               int rgba = PyLong_AsSsize_t(value);
                m_vertex->SetRGBA(rgba);
                m_mesh->SetMeshModified(true);
                Py_RETURN_NONE;
index 6b23105a2782a828e15d21cd47b3d6dac552b9c5..6d26e5b6d35c039f96b94a94ed506f1c25d08b16 100644 (file)
@@ -81,17 +81,17 @@ static int setColor (PyFilter * self, PyObject * value, void * closure)
 {
        // check validity of parameter
        if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 3
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1))
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 2)))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
        {
                PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 3 ints");
                return -1;
        }
        // set color
-       getFilter(self)->setColor((unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
-               (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
-               (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2))));
+       getFilter(self)->setColor((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+               (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
+               (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))));
        // success
        return 0;
 }
@@ -108,15 +108,15 @@ static int setLimits (PyFilter * self, PyObject * value, void * closure)
 {
        // check validity of parameter
        if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1)))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
        {
                PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
                return -1;
        }
        // set limits
-       getFilter(self)->setLimits((unsigned short)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
-               (unsigned short)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1))));
+       getFilter(self)->setLimits((unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+               (unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))));
        // success
        return 0;
 }
index 5ff1f7f11cec276f9c59c561474e250db9fc5bcd..eb86f520e027e24211bb38010f03fdd48fa8c4fc 100644 (file)
@@ -147,10 +147,10 @@ static int setMatrix (PyFilter * self, PyObject * value, void * closure)
                for (int c = 0; valid && c < 5; ++c)
                {
                        // item must be int
-                       valid = PyInt_Check(PySequence_Fast_GET_ITEM(row, c));
+                       valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
                        // if it is valid, save it in matrix
                        if (valid)
-                               mat[r][c] = short(PyInt_AsLong(PySequence_Fast_GET_ITEM(row, c)));
+                               mat[r][c] = short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
                }
        }
        // if parameter is not valid, report error
@@ -286,10 +286,10 @@ static int setLevels (PyFilter * self, PyObject * value, void * closure)
                for (int c = 0; valid && c < 2; ++c)
                {
                        // item must be int
-                       valid = PyInt_Check(PySequence_Fast_GET_ITEM(row, c));
+                       valid = PyLong_Check(PySequence_Fast_GET_ITEM(row, c));
                        // if it is valid, save it in matrix
                        if (valid)
-                               lev[r][c] = (unsigned short)(PyInt_AsLong(PySequence_Fast_GET_ITEM(row, c)));
+                               lev[r][c] = (unsigned short)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(row, c)));
                }
        }
        // if parameter is not valid, report error
index 9a2b1e90d5a4c9836964ddcb7baa70583c42fb3a..002be6c3189ed0bc73131d436d06d5d6c644074f 100644 (file)
@@ -72,13 +72,13 @@ static PyObject * getColor (PyFilter * self, void * closure)
 static int setColor (PyFilter * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PyInt_Check(value))
+       if (value == NULL || !PyLong_Check(value))
        {
                PyErr_SetString(PyExc_TypeError, "filt.colorIdx = int: VideoTexture.FilterNormal, expected the value must be a int");
                return -1;
        }
        // set color index
-       getFilter(self)->setColor((unsigned short)(PyInt_AsLong(value)));
+       getFilter(self)->setColor((unsigned short)(PyLong_AsSsize_t(value)));
        // success
        return 0;
 }
index c4fb1fefd9cc5fc852952c121faf215aa06b07e9..d8be08e0eb55304488685ea70e6209aa026424b0 100644 (file)
@@ -331,19 +331,19 @@ static int setBackground (PyImage * self, PyObject * value, void * closure)
 {
        // check validity of parameter
        if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 4
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1))
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 2))
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 3)))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 3)))
        {
                PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 4 integer between 0 and 255");
                return -1;
        }
        // set background color
-       getImageRender(self)->setBackground((unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
-               (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
-               (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2))),
-        (unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 3))));
+       getImageRender(self)->setBackground((unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+               (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1))),
+               (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 2))),
+        (unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 3))));
        // success
        return 0;
 }
index d2c23e758f6d03cdf2800e843eb367584e0de833..55b143962805ddf571ff3fc44295d6c92692b59a 100644 (file)
@@ -218,16 +218,16 @@ static int ImageViewport_setPosition (PyImage * self, PyObject * value, void * c
 {
        // check validity of parameter
        if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1)))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
        {
                PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
                return -1;
        }
        // set position
        GLint pos [] = {
-               GLint(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
-                       GLint(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
+               GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+                       GLint(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
        };
        getImageViewport(self)->setPosition(pos);
        // success
@@ -246,16 +246,16 @@ int ImageViewport_setCaptureSize (PyImage * self, PyObject * value, void * closu
 {
        // check validity of parameter
        if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
-               || !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1)))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
+               || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
        {
                PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 2 ints");
                return -1;
        }
        // set capture size
        short size [] = {
-               short(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
-                       short(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
+               short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 0))),
+                       short(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 1)))
        };
        getImageViewport(self)->setCaptureSize(size);
        // success
index 5d449a158d855bb17e7f803d0e7f053013a7995c..5de7a9e80a9d180473756ef81fe4cee9fa096e65 100644 (file)
@@ -167,13 +167,13 @@ PyObject * Video_getRepeat (PyImage * self, void * closure)
 int Video_setRepeat (PyImage * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PyInt_Check(value))
+       if (value == NULL || !PyLong_Check(value))
        {
                PyErr_SetString(PyExc_TypeError, "The value must be an int");
                return -1;
        }
        // set repeat
-       getVideo(self)->setRepeat(int(PyInt_AsLong(value)));
+       getVideo(self)->setRepeat(int(PyLong_AsSsize_t(value)));
        // success
        return 0;
 }
index 1a5481488c05705ec8dddba9974d22b57396c1d6..cf4ea88c1b5556ecb57dc6d715dba8d756ea2998 100644 (file)
@@ -1095,13 +1095,13 @@ PyObject * VideoFFmpeg_getPreseek (PyImage *self, void * closure)
 int VideoFFmpeg_setPreseek (PyImage * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PyInt_Check(value))
+       if (value == NULL || !PyLong_Check(value))
        {
                PyErr_SetString(PyExc_TypeError, "The value must be an integer");
                return -1;
        }
        // set preseek
-       getFFmpeg(self)->setPreseek(PyInt_AsLong(value));
+       getFFmpeg(self)->setPreseek(PyLong_AsSsize_t(value));
        // success
        return 0;
 }
index dad52a426b6a07ef8a1534a2d2d79ca774247bf4..22171f69321fd459ce7088c9ac599cc53b49f67f 100644 (file)
@@ -67,7 +67,7 @@ static PyObject * getMaterialID (PyObject *self, PyObject *args)
 // get last error description
 static PyObject * getLastError (PyObject *self, PyObject *args)
 {
-       return PyString_FromString(Exception::m_lastError.c_str());
+       return PyUnicode_FromString(Exception::m_lastError.c_str());
 }
 
 // set log file