public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Lumir Balhar <lbalhar@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/python-websockets] rawhide: Fix compatibility with Python 3.15
Date: Wed, 03 Jun 2026 09:46:03 GMT	[thread overview]
Message-ID: <178047996369.1.12822256151069433460.rpms-python-websockets-ebf6f892a8c5@fedoraproject.org> (raw)

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)

                 reply	other threads:[~2026-06-03  9:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178047996369.1.12822256151069433460.rpms-python-websockets-ebf6f892a8c5@fedoraproject.org \
    --to=lbalhar@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox