devel/py-backports.zoneinfo: unbreak build with py310+ (+)

We already have Python 3.7 as minimal supported release, so
force #ifdef's for 3.7+ API as always positive to prevent use deprecated types

While here, port upstream patch for MR#97 (https://github.com/pganssle/zoneinfo/pull/97)
"Decrement the refcount of _PyLong_One in the correct branch"
This commit is contained in:
Dima Panov 2022-06-25 23:15:34 +03:00
parent f6233d7490
commit 56f689af8e
2 changed files with 15 additions and 1 deletions

View file

@ -1,5 +1,6 @@
PORTNAME= backports.zoneinfo
DISTVERSION= 0.2.1
PORTREVISION= 1
CATEGORIES= devel python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -10,7 +11,9 @@ COMMENT= Backport of the standard library module zoneinfo
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= python:3.7-3.9
USES= python:3.7+
USE_PYTHON= autoplist concurrent distutils
# We already have Python 3.7 as minimal supported release, force positive checks
CFLAGS+= -DATLEAST_37
.include <bsd.port.mk>

View file

@ -0,0 +1,11 @@
--- lib/zoneinfo_module.c.orig 2020-06-23 13:47:53 UTC
+++ lib/zoneinfo_module.c
@@ -617,7 +617,7 @@ zoneinfo_fromutc(PyObject *obj_self, PyObject *dt)
Py_DECREF(args);
Py_DECREF(kwargs);
Py_DECREF(replace);
-#ifndef ATLEAST_37
+#ifdef ATLEAST_37
Py_DECREF(one);
#endif