[pypy-commit] pypy release-pypy3.6-v7.x: Rename to PyDict_GetItemWithError (no leading underscore)

rlamy pypy.commits at gmail.com
Wed Oct 9 15:12:13 EDT 2019


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: release-pypy3.6-v7.x
Changeset: r97751:5da45ced70e5
Date: 2019-10-04 18:29 +0100
http://bitbucket.org/pypy/pypy/changeset/5da45ced70e5/

Log:	Rename to PyDict_GetItemWithError (no leading underscore) (grafted
	from 6e344fc026c3997723683b2ae7ed953fdf84c387)

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
@@ -81,8 +81,11 @@
     return w_dict.getitem(w_key)
 
 @cpython_api([PyObject, PyObject], PyObject, result_borrowed=True)
-def _PyDict_GetItemWithError(space, w_dict, w_key):
-    # Like PyDict_GetItem(), but doesn't swallow the error
+def PyDict_GetItemWithError(space, w_dict, w_key):
+    """Variant of PyDict_GetItem() that does not suppress
+    exceptions. Return NULL with an exception set if an exception
+    occurred.  Return NULL without an exception set if the key
+    wasn't present."""
     if not isinstance(w_dict, W_DictMultiObject):
         PyErr_BadInternalCall(space)
     return w_dict.getitem(w_key)
diff --git a/pypy/module/cpyext/stubs.py b/pypy/module/cpyext/stubs.py
--- a/pypy/module/cpyext/stubs.py
+++ b/pypy/module/cpyext/stubs.py
@@ -243,14 +243,6 @@
 def PyWrapper_New(space, w_d, w_self):
     raise NotImplementedError
 
- at cpython_api([PyObject, PyObject], PyObject)
-def PyDict_GetItemWithError(space, p, key):
-    """Variant of PyDict_GetItem() that does not suppress
-    exceptions. Return NULL with an exception set if an exception
-    occurred.  Return NULL without an exception set if the key
-    wasn't present."""
-    raise NotImplementedError
-
 @cpython_api([PyObject, PyObject, rffi.INT_real], rffi.INT_real, error=-1)
 def PyDict_MergeFromSeq2(space, a, seq2, override):
     """Update or merge into dictionary a, from the key-value pairs in seq2.
diff --git a/pypy/module/cpyext/test/test_dictobject.py b/pypy/module/cpyext/test/test_dictobject.py
--- a/pypy/module/cpyext/test/test_dictobject.py
+++ b/pypy/module/cpyext/test/test_dictobject.py
@@ -183,7 +183,7 @@
              if (!PyArg_ParseTuple(args, "OO", &d, &key)) {
                 return NULL;
              }
-             result = _PyDict_GetItemWithError(d, key);
+             result = PyDict_GetItemWithError(d, key);
              if (result == NULL && !PyErr_Occurred())
                 Py_RETURN_NONE;
              Py_XINCREF(result);


More information about the pypy-commit mailing list