public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-websockets] rawhide: Fix compatibility with Python 3.15
@ 2026-06-03  9:46 Lumir Balhar
  0 siblings, 0 replies; only message in thread
From: Lumir Balhar @ 2026-06-03  9:46 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-websockets
Branch : rawhide
Commit : ebf6f892a8c540cf418cb48c2a0b567a1c9a3862
Author : Lumir Balhar <lbalhar@redhat.com>
Date   : 2026-04-07T09:21:52+02:00
Stats  : +31/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-websockets/c/ebf6f892a8c540cf418cb48c2a0b567a1c9a3862?branch=rawhide

Log:
Fix compatibility with Python 3.15

---
diff --git a/1706.patch b/1706.patch
new file mode 100644
index 0000000..6ce426d
--- /dev/null
+++ b/1706.patch
@@ -0,0 +1,29 @@
+From f3bf8033276aa4fc272940e650c319c517bb3479 Mon Sep 17 00:00:00 2001
+From: Lumir Balhar <lbalhar@redhat.com>
+Date: Tue, 7 Apr 2026 09:16:08 +0200
+Subject: [PATCH] Python 3.15+ requires C-contiguous buffers for
+ int.from_bytes()
+
+---
+ src/websockets/utils.py | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/websockets/utils.py b/src/websockets/utils.py
+index b2a90e52..84904ea0 100644
+--- a/src/websockets/utils.py
++++ b/src/websockets/utils.py
+@@ -47,6 +47,14 @@ def apply_mask(data: BytesLike, mask: bytes | bytearray) -> bytes:
+     if len(mask) != 4:
+         raise ValueError("mask must contain 4 bytes")
+ 
++    # Python 3.15+ requires C-contiguous buffers for int.from_bytes()
++    # CPython (https://github.com/python/cpython/pull/132109) optimized
++    # int.from_bytes() to use the buffer protocol with PyBUF_SIMPLE, which requires
++    # C-contiguous buffers. Non-contiguous memoryviews (e.g., created by [::-1])
++    # now raise BufferError. Convert to bytes to create a contiguous copy.
++    if isinstance(data, memoryview) and not data.c_contiguous:
++        data = bytes(data)
++
+     data_int = int.from_bytes(data, sys.byteorder)
+     mask_repeated = mask * (len(data) // 4) + mask[: len(data) % 4]
+     mask_int = int.from_bytes(mask_repeated, sys.byteorder)

diff --git a/python-websockets.spec b/python-websockets.spec
index e2a04ed..57ef947 100644
--- a/python-websockets.spec
+++ b/python-websockets.spec
@@ -18,6 +18,8 @@ Patch:          https://github.com/python-websockets/websockets/pull/1639.patch
 # Support for Python 3.14
 # I remove the patch on the changelog because auto apply fails.
 Patch:          https://github.com/python-websockets/websockets/commit/036fd45c16afec1b713ae7f37393c76c3ff528a5.patch
+# Fix for Python 3.15: int.from_bytes() requires C-contiguous buffers
+Patch:          https://github.com/python-websockets/websockets/pull/1706.patch
 
 BuildRequires:  gcc
 BuildRequires:  python3dist(pytest)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-03  9:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03  9:46 [rpms/python-websockets] rawhide: Fix compatibility with Python 3.15 Lumir Balhar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox