[pypy-commit] pypy default: Rename the PyPy-specific 'ob_keys' member of PyDictObject to '_tmpkeys',

arigo pypy.commits at gmail.com
Mon Dec 19 11:50:27 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r89187:12ee90f51eb9
Date: 2016-12-19 17:49 +0100
http://bitbucket.org/pypy/pypy/changeset/12ee90f51eb9/

Log:	Rename the PyPy-specific 'ob_keys' member of PyDictObject to
	'_tmpkeys', otherwise we might think it comes from CPython

diff --git a/pypy/module/cpyext/dictobject.py b/pypy/module/cpyext/dictobject.py
--- a/pypy/module/cpyext/dictobject.py
+++ b/pypy/module/cpyext/dictobject.py
@@ -16,7 +16,7 @@
 PyDictObjectStruct = lltype.ForwardReference()
 PyDictObject = lltype.Ptr(PyDictObjectStruct)
 PyDictObjectFields = PyObjectFields + \
-    (("ob_keys", PyObject),)
+    (("_tmpkeys", PyObject),)
 cpython_struct("PyDictObject", PyDictObjectFields, PyDictObjectStruct)
 
 @bootstrap_function
@@ -33,7 +33,7 @@
     Fills a newly allocated PyDictObject with the given dict object.
     """
     py_dict = rffi.cast(PyDictObject, py_obj)
-    py_dict.c_ob_keys = lltype.nullptr(PyObject.TO)
+    py_dict.c__tmpkeys = lltype.nullptr(PyObject.TO)
     # Problems: if this dict is a typedict, we may have unbound GetSetProperty
     # functions in the dict. The corresponding PyGetSetDescrObject must be
     # bound to a class, but the actual w_type will be unavailable later on. 
@@ -58,8 +58,8 @@
 @cpython_api([PyObject], lltype.Void, header=None)
 def dict_dealloc(space, py_obj):
     py_dict = rffi.cast(PyDictObject, py_obj)
-    decref(space, py_dict.c_ob_keys)
-    py_dict.c_ob_keys = lltype.nullptr(PyObject.TO)
+    decref(space, py_dict.c__tmpkeys)
+    py_dict.c__tmpkeys = lltype.nullptr(PyObject.TO)
     _dealloc(space, py_obj)
 
 @cpython_api([], PyObject)
@@ -263,16 +263,16 @@
     py_dict = rffi.cast(PyDictObject, py_obj)
     if pos == 0:
         # Store the current keys in the PyDictObject.
-        decref(space, py_dict.c_ob_keys)
+        decref(space, py_dict.c__tmpkeys)
         w_keys = space.call_method(space.w_dict, "keys", w_dict)
-        py_dict.c_ob_keys = create_ref(space, w_keys)
-        Py_IncRef(space, py_dict.c_ob_keys)
+        py_dict.c__tmpkeys = create_ref(space, w_keys)
+        Py_IncRef(space, py_dict.c__tmpkeys)
     else:
-        w_keys = from_ref(space, py_dict.c_ob_keys)
+        w_keys = from_ref(space, py_dict.c__tmpkeys)
     ppos[0] += 1
     if pos >= space.len_w(w_keys):
-        decref(space, py_dict.c_ob_keys)
-        py_dict.c_ob_keys = lltype.nullptr(PyObject.TO)
+        decref(space, py_dict.c__tmpkeys)
+        py_dict.c__tmpkeys = lltype.nullptr(PyObject.TO)
         return 0
     w_key = space.listview(w_keys)[pos]
     w_value = space.getitem(w_dict, w_key)
diff --git a/pypy/module/cpyext/include/dictobject.h b/pypy/module/cpyext/include/dictobject.h
--- a/pypy/module/cpyext/include/dictobject.h
+++ b/pypy/module/cpyext/include/dictobject.h
@@ -9,7 +9,7 @@
 
 typedef struct {
     PyObject_HEAD
-    PyObject *ob_keys; /* a private place to put keys during PyDict_Next */
+    PyObject *_tmpkeys; /* a private place to put keys during PyDict_Next */
 } PyDictObject;
 
 #ifdef __cplusplus


More information about the pypy-commit mailing list