From fb89b4e2acc3c63b7b118c168dd5d779b60f7a72 Mon Sep 17 00:00:00 2001 From: Huang Rui Date: Tue, 6 May 2025 17:00:00 +0800 Subject: dev-libs/json-parser: fix bug 954840 and 955499 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: https://bugs.gentoo.org/954840 Closes: https://bugs.gentoo.org/955499 Signed-off-by: Huang Rui Upstream-PR: https://github.com/json-parser/json-parser/pull/182 Closes: https://github.com/gentoo/gentoo/pull/41956 Signed-off-by: Petr Vaněk --- .../files/json-parser-1.1.0-python3-pylong.patch | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 dev-libs/json-parser/files/json-parser-1.1.0-python3-pylong.patch (limited to 'dev-libs/json-parser/files/json-parser-1.1.0-python3-pylong.patch') diff --git a/dev-libs/json-parser/files/json-parser-1.1.0-python3-pylong.patch b/dev-libs/json-parser/files/json-parser-1.1.0-python3-pylong.patch new file mode 100644 index 000000000000..858afa485a69 --- /dev/null +++ b/dev-libs/json-parser/files/json-parser-1.1.0-python3-pylong.patch @@ -0,0 +1,40 @@ +From 5bd7dc824bcffd867edef7ef80cc896c8c51ce38 Mon Sep 17 00:00:00 2001 +From: Huang Rui +Date: Tue, 6 May 2025 16:17:53 +0800 +Subject: [PATCH] fix(python): Add Python 3 compatibility macros for PyInt + functions + +- Add PY_MAJOR_VERSION check to define PyInt_* macros for Python 3 +- Replace deprecated PyInt functions with PyLong equivalents in Python 3 + +Signed-off-by: Huang Rui +--- + bindings/python/wrap_json.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/bindings/python/wrap_json.c b/bindings/python/wrap_json.c +index bd0360512fd3..1d42a82aad77 100644 +--- a/bindings/python/wrap_json.c ++++ b/bindings/python/wrap_json.c +@@ -27,6 +27,18 @@ + + #include "../../json.c" + ++#include ++ ++#if PY_MAJOR_VERSION >= 3 ++ /* Define PyInt_* only for Python 3, where they no longer exist */ ++ #ifndef PyInt_FromLong ++ #define PyInt_FromLong PyLong_FromLong ++ #endif ++ #ifndef PyInt_AsLong ++ #define PyInt_AsLong PyLong_AsLong ++ #endif ++#endif ++ + PyObject * json_exception = PyErr_NewException("jsonparser.JSONException", + NULL, NULL); + +-- +2.49.0 + -- cgit v1.2.3