Author: Ronan Lamy <ronan.l...@gmail.com> Branch: py3.6 Changeset: r97724:6e344fc026c3 Date: 2019-10-04 18:29 +0100 http://bitbucket.org/pypy/pypy/changeset/6e344fc026c3/
Log: Rename to PyDict_GetItemWithError (no leading underscore) 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 -@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); _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit