From 9fe87462569a0d3f27364d93df3934ecbb8fe585 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sat, 30 Apr 2022 16:48:48 -0400 Subject: [PATCH] MNT: explicitly cast away const-ness when calling CPython API --- src/greenlet/greenlet_refs.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/greenlet/greenlet_refs.hpp b/src/greenlet/greenlet_refs.hpp index d109229b..7cf741ea 100644 --- a/src/greenlet/greenlet_refs.hpp +++ b/src/greenlet/greenlet_refs.hpp @@ -339,7 +339,7 @@ namespace greenlet { Py_XINCREF(other.p); const T* tmp = this->p; this->p = other.p; - Py_XDECREF(tmp); + Py_XDECREF(const_cast(tmp)); return *this; } @@ -851,7 +851,7 @@ namespace greenlet { void PyAddObject(const char* name, const PyObject* new_object) { - Py_INCREF(new_object); + Py_INCREF(const_cast(new_object)); try { Require(PyModule_AddObject(this->p, name, const_cast(new_object))); }