[Bf-blender-cvs] [2ff9c8a3bc5] master: PyAPI: avoid redundant PyLong_AsLong call

Campbell Barton noreply at git.blender.org
Sun Aug 20 07:29:41 CEST 2017


Commit: 2ff9c8a3bc51142a1d7ad19d8b772b58e4dcc890
Author: Campbell Barton
Date:   Sun Aug 20 15:28:06 2017 +1000
Branches: master
https://developer.blender.org/rB2ff9c8a3bc51142a1d7ad19d8b772b58e4dcc890

PyAPI: avoid redundant PyLong_AsLong call

Assigning to an RNA array converted from Python to C twice.

===================================================================

M	source/blender/python/intern/bpy_rna.c

===================================================================

diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 67f2f1fdee6..0d3781ca176 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -2712,7 +2712,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
 		Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
 		if (i == -1 && PyErr_Occurred())
 			return NULL;
-		return pyrna_prop_array_subscript_int(self, PyLong_AsLong(key));
+		return pyrna_prop_array_subscript_int(self, i);
 	}
 	else if (PySlice_Check(key)) {
 		Py_ssize_t step = 1;



More information about the Bf-blender-cvs mailing list