diff options
| author | serge-sans-paille <serge.guelton@telecom-bretagne.eu> | 2022-05-21 13:16:37 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-21 13:16:37 (GMT) |
| commit | 5b71b519f966e1017c868ea2b27c61a5eac38c1f (patch) | |
| tree | 6344abc2bcf797a03a0a2490541327af41e563ba /Lib/test/_testcppext.cpp | |
| parent | 14c0d33016a967a98155f2e1615660e9328aef5d (diff) | |
| download | cpython-5b71b519f966e1017c868ea2b27c61a5eac38c1f.zip cpython-5b71b519f966e1017c868ea2b27c61a5eac38c1f.tar.gz cpython-5b71b519f966e1017c868ea2b27c61a5eac38c1f.tar.bz2 | |
GH-92898: Make _Py_Cast C++ version compatible with cast operator (gh-92951)
Diffstat (limited to 'Lib/test/_testcppext.cpp')
| -rw-r--r-- | Lib/test/_testcppext.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/_testcppext.cpp b/Lib/test/_testcppext.cpp index f38b487..f6049ee 100644 --- a/Lib/test/_testcppext.cpp +++ b/Lib/test/_testcppext.cpp @@ -40,6 +40,15 @@ test_api_casts(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args)) PyTypeObject *type = Py_TYPE(const_obj); assert(Py_REFCNT(const_obj) >= 1); + struct PyObjectProxy { + PyObject* obj; + operator PyObject *() { return obj; } + } proxy_obj = { obj }; + Py_INCREF(proxy_obj); + Py_DECREF(proxy_obj); + assert(Py_REFCNT(proxy_obj) >= 1); + + assert(type == &PyTuple_Type); assert(PyTuple_GET_SIZE(const_obj) == 2); PyObject *one = PyTuple_GET_ITEM(const_obj, 0); |
