From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 48DC5138359 for ; Sun, 4 Oct 2020 21:15:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 879C0E087B; Sun, 4 Oct 2020 21:15:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5EBE1E087B for ; Sun, 4 Oct 2020 21:15:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D370B335C97 for ; Sun, 4 Oct 2020 21:15:16 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4ED9E38C for ; Sun, 4 Oct 2020 21:15:15 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1601846080.f0e786f0096b75d886fca041c479e936fb27e0b9.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pypy3-exe/, dev-python/pypy3-exe/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/pypy3-exe/files/pypy3-7.3.2-sethostname-bytes.patch dev-python/pypy3-exe/pypy3-exe-7.3.2-r1.ebuild dev-python/pypy3-exe/pypy3-exe-7.3.2.ebuild dev-python/pypy3-exe/pypy3-exe-7.3.2_p37-r1.ebuild dev-python/pypy3-exe/pypy3-exe-7.3.2_p37.ebuild X-VCS-Directories: dev-python/pypy3-exe/files/ dev-python/pypy3-exe/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: f0e786f0096b75d886fca041c479e936fb27e0b9 X-VCS-Branch: master Date: Sun, 4 Oct 2020 21:15:15 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9800bf9d-ea65-4fbe-b578-c24da8282ba6 X-Archives-Hash: 86c145f0a2c0541eff042223d0062c30 commit: f0e786f0096b75d886fca041c479e936fb27e0b9 Author: Michał Górny gentoo org> AuthorDate: Sun Oct 4 19:40:32 2020 +0000 Commit: Michał Górny gentoo org> CommitDate: Sun Oct 4 21:14:40 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f0e786f0 dev-python/pypy3-exe: Backport sethostname() fix Signed-off-by: Michał Górny gentoo.org> .../files/pypy3-7.3.2-sethostname-bytes.patch | 61 ++++++++++++++++++++++ ...-exe-7.3.2.ebuild => pypy3-exe-7.3.2-r1.ebuild} | 4 ++ ....2_p37.ebuild => pypy3-exe-7.3.2_p37-r1.ebuild} | 4 ++ 3 files changed, 69 insertions(+) diff --git a/dev-python/pypy3-exe/files/pypy3-7.3.2-sethostname-bytes.patch b/dev-python/pypy3-exe/files/pypy3-7.3.2-sethostname-bytes.patch new file mode 100644 index 00000000000..68025600b1f --- /dev/null +++ b/dev-python/pypy3-exe/files/pypy3-7.3.2-sethostname-bytes.patch @@ -0,0 +1,61 @@ +From 5ee2925459372a8af805e952f433acd75e426325 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sun, 4 Oct 2020 15:46:23 +0200 +Subject: [PATCH] Fix sethostname() failure when passed bytes + +My implementation of sethostname() was broken and failed when passed +bytes on Python 3. Update the implementation to match CPython -- that +is, use bytes if provided, or fsencode() when str is provided. + +--HG-- +branch : py3.6 +--- + pypy/module/_socket/interp_func.py | 8 +++++++- + pypy/module/_socket/test/test_sock_app.py | 12 ++++++++++++ + 2 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/pypy/module/_socket/interp_func.py b/pypy/module/_socket/interp_func.py +index bdc4f1293f..1727e51d51 100644 +--- a/pypy/module/_socket/interp_func.py ++++ b/pypy/module/_socket/interp_func.py +@@ -392,7 +392,13 @@ if hasattr(rsocket, 'sethostname'): + + Set the host name. + """ +- hostname = space.text_w(w_hostname) ++ if space.isinstance_w(w_hostname, space.w_bytes): ++ hostname = space.bytes_w(w_hostname) ++ elif space.isinstance_w(w_hostname, space.w_unicode): ++ hostname = space.fsencode_w(w_hostname) ++ else: ++ raise oefmt(space.w_TypeError, ++ "sethostname() argument 1 must be str or bytes") + try: + res = rsocket.sethostname(hostname) + except SocketError as e: +diff --git a/pypy/module/_socket/test/test_sock_app.py b/pypy/module/_socket/test/test_sock_app.py +index fe3efec8e3..355fb8a2a9 100644 +--- a/pypy/module/_socket/test/test_sock_app.py ++++ b/pypy/module/_socket/test/test_sock_app.py +@@ -210,6 +210,18 @@ def test_getaddrinfo(space, w_socket): + assert space.unwrap(w_l) == True + + ++def test_sethostname(space, w_socket): ++ space.raises_w(space.w_OSError, space.appexec, ++ [w_socket], ++ "(_socket): _socket.sethostname(_socket.gethostname())") ++ ++ ++def test_sethostname_bytes(space, w_socket): ++ space.raises_w(space.w_OSError, space.appexec, ++ [w_socket], ++ "(_socket): _socket.sethostname(_socket.gethostname().encode())") ++ ++ + def test_unknown_addr_as_object(space, ): + from pypy.module._socket.interp_socket import addr_as_object + c_addr = lltype.malloc(rsocket._c.sockaddr, flavor='raw', track_allocation=False) +-- +GitLab + diff --git a/dev-python/pypy3-exe/pypy3-exe-7.3.2.ebuild b/dev-python/pypy3-exe/pypy3-exe-7.3.2-r1.ebuild similarity index 98% rename from dev-python/pypy3-exe/pypy3-exe-7.3.2.ebuild rename to dev-python/pypy3-exe/pypy3-exe-7.3.2-r1.ebuild index a8648c1e6ea..73313264113 100644 --- a/dev-python/pypy3-exe/pypy3-exe-7.3.2.ebuild +++ b/dev-python/pypy3-exe/pypy3-exe-7.3.2-r1.ebuild @@ -35,6 +35,10 @@ BDEPEND=" ) )" +PATCHES=( + "${FILESDIR}"/pypy3-7.3.2-sethostname-bytes.patch +) + check_env() { if use low-memory; then CHECKREQS_MEMORY="1750M" diff --git a/dev-python/pypy3-exe/pypy3-exe-7.3.2_p37.ebuild b/dev-python/pypy3-exe/pypy3-exe-7.3.2_p37-r1.ebuild similarity index 98% rename from dev-python/pypy3-exe/pypy3-exe-7.3.2_p37.ebuild rename to dev-python/pypy3-exe/pypy3-exe-7.3.2_p37-r1.ebuild index 5992fb3e87e..592f395defc 100644 --- a/dev-python/pypy3-exe/pypy3-exe-7.3.2_p37.ebuild +++ b/dev-python/pypy3-exe/pypy3-exe-7.3.2_p37-r1.ebuild @@ -36,6 +36,10 @@ BDEPEND=" ) )" +PATCHES=( + "${FILESDIR}"/pypy3-7.3.2-sethostname-bytes.patch +) + check_env() { if use low-memory; then CHECKREQS_MEMORY="1750M"