Commits

gcewing  committed ac76d2c

Fix unsigned int indexing bug; tests passed

  • Participants
  • Parent commits 3591907
  • Tags 0.9.8.4

Comments (0)

Files changed (10)

-VERSION = 0.9.8.3
+VERSION = 0.9.8.4
 
 version:
 	@echo "Setting version to $(VERSION)"

File Pyrex/Compiler/ExprNodes.py

 		self.base.analyse_types(env)
 		self.index.analyse_types(env)
 		if self.base.type.is_pyobject:
-#			if self.index.type.is_int:
-#				if getting:
-#					env.use_utility_code(getitem_int_utility_code)
-#				if setting:
-#					env.use_utility_code(setitem_int_utility_code)
-#			else:
-			if not self.index.type.is_int:
+			itype = self.index.type
+			if not (itype.is_int and itype.signed):
 				self.index = self.index.coerce_to_pyobject(env)
 			self.type = py_object_type
 			self.gil_check(env)

File Pyrex/Compiler/Version.py

-version = '0.9.8.2'
+version = '0.9.8.3'

File Tests/10/Reference/intindex.c

   if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_i, __pyx_v_z) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
 
   /* "/Local/Projects/D/Pyrex/Source/Tests/10/intindex.pyx":9 */
-  __pyx_1 = PyObject_GetItem(__pyx_v_x, ((PyObject *)__pyx_v_ui)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
+  __pyx_1 = PyLong_FromUnsignedLong(__pyx_v_ui); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_v_z);
-  __pyx_v_z = __pyx_1;
-  __pyx_1 = 0;
+  __pyx_v_z = __pyx_2;
+  __pyx_2 = 0;
 
   /* "/Local/Projects/D/Pyrex/Source/Tests/10/intindex.pyx":10 */
-  if (PyObject_SetItem(__pyx_v_x, ((PyObject *)__pyx_v_ui), __pyx_v_z) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
+  __pyx_1 = PyLong_FromUnsignedLong(__pyx_v_ui); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
+  if (PyObject_SetItem(__pyx_v_x, __pyx_1, __pyx_v_z) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_1);
+  Py_XDECREF(__pyx_2);
   __Pyx_AddTraceback("intindex.f");
   __pyx_r = (-1);
   __pyx_L0:;

File Tests/10/intindex.c

   unsigned int __pyx_v_ui;
   int __pyx_r;
   PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
   __pyx_v_x = Py_None; Py_INCREF(Py_None);
   __pyx_v_y = Py_None; Py_INCREF(Py_None);
   __pyx_v_z = Py_None; Py_INCREF(Py_None);
   if (__Pyx_SetItemInt(__pyx_v_x, __pyx_v_i, __pyx_v_z) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
 
   /* "/Local/Projects/D/Pyrex/Source/Tests/10/intindex.pyx":9 */
-  __pyx_1 = PyObject_GetItem(__pyx_v_x, ((PyObject *)__pyx_v_ui)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
+  __pyx_1 = PyLong_FromUnsignedLong(__pyx_v_ui); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_v_z);
-  __pyx_v_z = __pyx_1;
-  __pyx_1 = 0;
+  __pyx_v_z = __pyx_2;
+  __pyx_2 = 0;
 
   /* "/Local/Projects/D/Pyrex/Source/Tests/10/intindex.pyx":10 */
-  if (PyObject_SetItem(__pyx_v_x, ((PyObject *)__pyx_v_ui), __pyx_v_z) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
+  __pyx_1 = PyLong_FromUnsignedLong(__pyx_v_ui); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
+  if (PyObject_SetItem(__pyx_v_x, __pyx_1, __pyx_v_z) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_1);
+  Py_XDECREF(__pyx_2);
   __Pyx_AddTraceback("intindex.f");
   __pyx_r = (-1);
   __pyx_L0:;

File Tests/3/.DS_Store

Binary file removed.

File Tests/Runnable3/Reference/r_uintindex.out

+shoe

File Tests/Runnable3/r_uintindex.out

+shoe

File Tests/Runnable3/r_uintindex.pyx

+def idx(seq, i):
+	cdef unsigned int u
+	u = i
+	return seq[u]

File Tests/Runnable3/r_uintindex_t.py

+from r_uintindex import idx
+print idx(["buckle", "my", "shoe"], 2)