Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kore: fix build for Python 3.11 (not ready yet) #39413

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out that my previous recommendation for strictly less than is irrelevant because the release version will be 0x030B0F00 and the current RC should be 0x030B0C02, so both are greater than the cutoff anyway. I misread the explanation of the hex versioning scheme and expected the release to be 0x30B00000`.

I'd say make this strictly less than for consistency and mathematical correctness.

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: 5 additions & 7 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,10 +24,7 @@ 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
LDFLAGS=-lpython3

post_install() {
vlicense LICENSE
Expand Down