Skip to content

Commit

Permalink
Update python-thriftpy2 to version 0.5.2 / rev 11 via SR 1248709
Browse files Browse the repository at this point in the history
https://build.opensuse.org/request/show/1248709
by user dgarcia + dimstar_suse
- Add patch 0001-Use-SO_REUSEPORT-only-for-AF_INET-sockets.patch to
  make it compatible with latest cpython. gh#Thriftpy/thriftpy2#303
- Update to 0.5.2:
  * Fix an issue where loading a thrift file in a sub-thread will cause an error with load_fp.
  * Move static metadata from setup.py to pyproject.toml.
  * Using a thread pool to avoid TAsyncSocket.open block the event loop.
- 0.5.1:
  * Fix an issue where loading a thrift file in a sub-thread will cause an error.
  * Some typo fixes.
  • Loading branch information
dgarcia authored and bmwiedemann committed Feb 26, 2025
1 parent 68af4c4 commit 9196a8c
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 6 deletions.
Binary file modified packages/p/python-thriftpy2/.files
Binary file not shown.
16 changes: 16 additions & 0 deletions packages/p/python-thriftpy2/.rev
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,20 @@
<comment></comment>
<requestid>1177583</requestid>
</revision>
<revision rev="11" vrev="1">
<srcmd5>79172e49b06e80d56115a808d8113cb6</srcmd5>
<version>0.5.2</version>
<time>1740587072</time>
<user>dimstar_suse</user>
<comment>- Add patch 0001-Use-SO_REUSEPORT-only-for-AF_INET-sockets.patch to
make it compatible with latest cpython. gh#Thriftpy/thriftpy2#303
- Update to 0.5.2:
* Fix an issue where loading a thrift file in a sub-thread will cause an error with load_fp.
* Move static metadata from setup.py to pyproject.toml.
* Using a thread pool to avoid TAsyncSocket.open block the event loop.
- 0.5.1:
* Fix an issue where loading a thrift file in a sub-thread will cause an error.
* Some typo fixes.</comment>
<requestid>1248709</requestid>
</revision>
</revisionlist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 6590305637da64e0b1898bbb2ecd9700aef7c06b Mon Sep 17 00:00:00 2001
From: Daniel Garcia Moreno <[email protected]>
Date: Wed, 26 Feb 2025 13:00:45 +0100
Subject: [PATCH] Use SO_REUSEPORT only for AF_INET sockets

The latest python version changes the behavior, now if it's used with
other kind of sockets (ex AF_UNIX) it raises OSError:

https://github.com/python/cpython/issues/128916
---
thriftpy2/contrib/aio/socket.py | 4 +++-
thriftpy2/transport/socket.py | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/thriftpy2/contrib/aio/socket.py b/thriftpy2/contrib/aio/socket.py
index 8f4195a..28b0cc8 100644
--- a/thriftpy2/contrib/aio/socket.py
+++ b/thriftpy2/contrib/aio/socket.py
@@ -281,7 +281,9 @@ class TAsyncServerSocket(object):
_sock = socket.socket(self.socket_family, socket.SOCK_STREAM)

_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- if hasattr(socket, "SO_REUSEPORT"):
+ # valid socket https://github.com/python/cpython/issues/128916
+ valid_family = (socket.AF_INET, socket.AF_INET6)
+ if _sock.family in valid_family and hasattr(socket, "SO_REUSEPORT"):
try:
_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
except socket.error as err:
diff --git a/thriftpy2/transport/socket.py b/thriftpy2/transport/socket.py
index edd78ab..b98b4c8 100644
--- a/thriftpy2/transport/socket.py
+++ b/thriftpy2/transport/socket.py
@@ -201,7 +201,9 @@ class TServerSocket(object):
_sock = socket.socket(self.socket_family, socket.SOCK_STREAM)

_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- if hasattr(socket, "SO_REUSEPORT"):
+ # valid socket https://github.com/python/cpython/issues/128916
+ valid_family = (socket.AF_INET, socket.AF_INET6)
+ if _sock.family in valid_family and hasattr(socket, "SO_REUSEPORT"):
try:
_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
except socket.error as err:
--
2.48.0

13 changes: 13 additions & 0 deletions packages/p/python-thriftpy2/python-thriftpy2.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
-------------------------------------------------------------------
Wed Feb 26 11:05:48 UTC 2025 - Daniel Garcia <[email protected]>

- Add patch 0001-Use-SO_REUSEPORT-only-for-AF_INET-sockets.patch to
make it compatible with latest cpython. gh#Thriftpy/thriftpy2#303
- Update to 0.5.2:
* Fix an issue where loading a thrift file in a sub-thread will cause an error with load_fp.
* Move static metadata from setup.py to pyproject.toml.
* Using a thread pool to avoid TAsyncSocket.open block the event loop.
- 0.5.1:
* Fix an issue where loading a thrift file in a sub-thread will cause an error.
* Some typo fixes.

-------------------------------------------------------------------
Wed May 29 11:59:34 UTC 2024 - John Paul Adrian Glaubitz <[email protected]>

Expand Down
15 changes: 10 additions & 5 deletions packages/p/python-thriftpy2/python-thriftpy2.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# spec file for package python-thriftpy2
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
Expand All @@ -18,13 +18,15 @@

%{?sle15_python_module_pythons}
Name: python-thriftpy2
Version: 0.5.0
Version: 0.5.2
Release: 0
Summary: Pure python implementation of Apache Thrift
License: MIT
URL: https://github.com/Thriftpy/thriftpy2
Source0: https://github.com/Thriftpy/thriftpy2/archive/v%{version}.tar.gz
Source1: new_certs.tar.xz
# PATCH-FIX-UPSTREAM 0001-Use-SO_REUSEPORT-only-for-AF_INET-sockets.patch gh#Thriftpy/thriftpy2#303
Patch1: 0001-Use-SO_REUSEPORT-only-for-AF_INET-sockets.patch
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module dbm}
BuildRequires: %{python_module devel}
Expand All @@ -38,7 +40,6 @@ BuildRequires: %{python_module tornado >= 5.0}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python3-pytest-asyncio
Requires: python-ply >= 3.4
Requires: python-six
Recommends: python-tornado >= 5.0
Expand Down Expand Up @@ -67,10 +68,14 @@ find %{buildroot}%{$python_sitearch} -name '*.c' -exec rm {} \;
}

%check
cd tests
# the two tests fail in OBS on timeout
# test_asynchronous_exception/test_asynchronous_result - needs old tornado to work
%pytest_arch -k 'not (test_able_to_communicate or test_zero_length_string or test_asynchronous_exception or test_asynchronous_result or test_api_ipv6)'
donttest="test_able_to_communicate or test_zero_length_string or test_asynchronous_exception or test_asynchronous_result or test_api_ipv6"
# Requires python-pytest-reraise
donttest+=" or test_load_in_sub_thread or test_load_fp_in_sub_thread"

cd tests
%pytest_arch -k "not ($donttest)"

%files %{python_files}
%license LICENSE
Expand Down
1 change: 0 additions & 1 deletion packages/p/python-thriftpy2/v0.5.0.tar.gz

This file was deleted.

1 change: 1 addition & 0 deletions packages/p/python-thriftpy2/v0.5.2.tar.gz

0 comments on commit 9196a8c

Please sign in to comment.