Skip to content

Commit

Permalink
kore: fix build for Python 3.11 (not ready yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgn committed Sep 22, 2022
1 parent e277fa4 commit 1ce54dc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
35 changes: 35 additions & 0 deletions srcpkgs/kore/patches/python-3.11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/src/python.c b/src/python.c
index ab0f3c6..526d443 100644
--- a/src/python.c
+++ b/src/python.c
@@ -1192,8 +1192,14 @@ python_coro_trace(const char *label, struct python_coro *coro)

gen = (PyGenObject *)coro->obj;

- if (gen->gi_frame != NULL && gen->gi_frame->f_code != NULL) {
- code = gen->gi_frame->f_code;
+#if PY_VERSION_HEX <= 0x030B0000
+ code = NULL;
+ if (gen->gi_frame != NULL)
+ code = gen->gi_frame->f_code
+#else
+ code = gen->gi_code;
+#endif
+ if (code != NULL) {
func = PyUnicode_AsUTF8AndSize(code->co_name, NULL);
file = PyUnicode_AsUTF8AndSize(code->co_filename, NULL);

@@ -1206,8 +1206,13 @@ python_coro_trace(const char *label, struct python_coro *coro)
fname = "unknown";
}

+#if PY_VERSION_HEX <= 0x030B0000
if (gen->gi_frame != NULL)
line = PyFrame_GetLineNumber(gen->gi_frame);
+#else
+ if (code != NULL)
+ line = PyCode_Addr2Line(code, 0);
+#endif
else
line = -1;

12 changes: 4 additions & 8 deletions srcpkgs/kore/template
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ revision=1
archs="x86_64* aarch64* ppc64*"
build_style=gnu-makefile
make_use_env=yes
make_build_args="CURL=1 TASKS=1 PGSQL=1 JSONRPC=1 ACME=1"
hostmakedepends="postgresql-libs-devel"
makedepends="openssl-devel libcurl-devel postgresql-libs-devel yajl-devel"
make_build_args="CURL=1 TASKS=1 PGSQL=1 JSONRPC=1 ACME=1 PYTHON=1"
hostmakedepends="postgresql-libs-devel python3"
makedepends="openssl-devel libcurl-devel postgresql-libs-devel yajl-devel
python3-devel"
short_desc="Easy to use web platform for writing scalable web APIs in C"
maintainer="Helmut Pozimski <helmut@pozimski.eu>"
license="ISC"
Expand All @@ -23,11 +24,6 @@ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
makedepends+=" musl-legacy-compat"
fi

if [ -z "$CROSS_BUILD" ]; then
makedepends+=" python3-devel"
make_build_args+=" PYTHON=1"
fi

post_install() {
vlicense LICENSE
}

0 comments on commit 1ce54dc

Please sign in to comment.