mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Fixed python3 compatibility
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1041 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
bcbb754da9
commit
2c7c76a668
@ -233,13 +233,22 @@ PySfDrawable_TransformToGlobal(PySfDrawable* self, PyObject *args)
|
||||
|
||||
int PySfDrawable_SetAttr(PyObject* self, PyObject *attr_name, PyObject *v)
|
||||
{
|
||||
#ifdef IS_PY3K
|
||||
PyObject *string = PyUnicode_AsUTF8String(attr_name);
|
||||
if (string == NULL) return NULL;
|
||||
std::string Name(PyBytes_AsString(string));
|
||||
#else
|
||||
std::string Name(PyString_AsString(attr_name));
|
||||
#endif
|
||||
if (Name == "Render")
|
||||
{
|
||||
Py_CLEAR(((PySfDrawable*)self)->obj->RenderFunction);
|
||||
Py_INCREF(v);
|
||||
((PySfDrawable*)self)->obj->RenderFunction = v;
|
||||
}
|
||||
#ifdef IS_PY3K
|
||||
Py_DECREF(string);
|
||||
#endif
|
||||
return PyObject_GenericSetAttr(self, attr_name, v);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user