First alpha build of PyPy 3.3

This commit is contained in:
Miro Hrončok 2016-07-08 14:38:18 +02:00
parent 092bdc18b3
commit 343676a899
10 changed files with 108 additions and 320 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/pypy3-2.4.0-src.tar.bz2 /pypy3-2.4.0-src.tar.bz2
/pypy3.3-v5.2.0-alpha1-src.tar.bz2

13
001-nevertty.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/rpython/tool/ansi_print.py b/rpython/tool/ansi_print.py
index bfa40be..29dd332 100644
--- a/rpython/tool/ansi_print.py
+++ b/rpython/tool/ansi_print.py
@@ -7,7 +7,7 @@ from py.io import ansi_print
from rpython.tool.ansi_mandelbrot import Driver
-isatty = getattr(sys.stderr, 'isatty', lambda: False)
+isatty = lambda: False
mandelbrot_driver = Driver()
wrote_dot = False # global shared state

View File

@ -1,7 +1,8 @@
diff -rup pypy-pypy-f66246c46ca3/rpython/translator/platform/__init__.py pypy-pypy-f66246c46ca3/rpython/translator/platform/__init__.py diff --git a/rpython/translator/platform/__init__.py b/rpython/translator/platform/__init__.py
--- pypy-pypy-f66246c46ca3/rpython/translator/platform/__init__.py 2013-05-27 10:35:37.680237338 +0200 index 051668b..6e59acc 100644
+++ pypy-pypy-f66246c46ca3/rpython/translator/platform/__init__.py 2013-05-27 10:41:04.113098738 +0200 --- a/rpython/translator/platform/__init__.py
@@ -138,6 +138,8 @@ class Platform(object): +++ b/rpython/translator/platform/__init__.py
@@ -140,6 +140,8 @@ class Platform(object):
self._handle_error(returncode, stdout, stderr, outname) self._handle_error(returncode, stdout, stderr, outname)
def _handle_error(self, returncode, stdout, stderr, outname): def _handle_error(self, returncode, stdout, stderr, outname):

View File

@ -1,12 +1,24 @@
diff -rup pypy-pypy-f66246c46ca3/lib_pypy/_pypy_interact.py pypy-pypy-f66246c46ca3/lib_pypy/_pypy_interact.py diff --git a/lib_pypy/_pypy_interact.py b/lib_pypy/_pypy_interact.py
--- pypy-pypy-f66246c46ca3/lib_pypy/_pypy_interact.py 2013-05-27 10:35:37.612236951 +0200 index 9542f54..5e44fb4 100644
+++ pypy-pypy-f66246c46ca3/lib_pypy/_pypy_interact.py 2013-05-27 10:37:25.602852747 +0200 --- a/lib_pypy/_pypy_interact.py
@@ -4,7 +4,7 @@ import sys +++ b/lib_pypy/_pypy_interact.py
irc_header = "And now for something completely different" @@ -13,19 +13,6 @@ def interactive_console(mainmodule=None, quiet=False):
sys.ps1 = '>>>> '
if not hasattr(sys, 'ps2'):
-def interactive_console(mainmodule=None, quiet=False): sys.ps2 = '.... '
+def interactive_console(mainmodule=None, quiet=True): - #
# set sys.{ps1,ps2} just before invoking the interactive interpreter. This - if not quiet:
# mimics what CPython does in pythonrun.c - try:
if not hasattr(sys, 'ps1'): - from _pypy_irc_topic import some_topic
- text = "%s: ``%s''" % ( irc_header, some_topic())
- while len(text) >= 80:
- i = text[:80].rfind(' ')
- print(text[:i])
- text = text[i+1:]
- print(text)
- except ImportError:
- pass
- #
run_interactive = run_simple_interactive_console
try:
if not os.isatty(sys.stdin.fileno()):

View File

@ -1,179 +0,0 @@
diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py
index 9b14943..b9d1c4c 100644
--- a/rpython/jit/metainterp/blackhole.py
+++ b/rpython/jit/metainterp/blackhole.py
@@ -1052,35 +1052,45 @@ class BlackholeInterpreter(object):
@arguments("cpu", "i", "R", "d", returns="i")
def bhimpl_residual_call_r_i(cpu, func, args_r, calldescr):
+ workaround2200.active = True
return cpu.bh_call_i(func, None, args_r, None, calldescr)
@arguments("cpu", "i", "R", "d", returns="r")
def bhimpl_residual_call_r_r(cpu, func, args_r, calldescr):
+ workaround2200.active = True
return cpu.bh_call_r(func, None, args_r, None, calldescr)
@arguments("cpu", "i", "R", "d")
def bhimpl_residual_call_r_v(cpu, func, args_r, calldescr):
+ workaround2200.active = True
return cpu.bh_call_v(func, None, args_r, None, calldescr)
@arguments("cpu", "i", "I", "R", "d", returns="i")
def bhimpl_residual_call_ir_i(cpu, func, args_i, args_r, calldescr):
+ workaround2200.active = True
return cpu.bh_call_i(func, args_i, args_r, None, calldescr)
@arguments("cpu", "i", "I", "R", "d", returns="r")
def bhimpl_residual_call_ir_r(cpu, func, args_i, args_r, calldescr):
+ workaround2200.active = True
return cpu.bh_call_r(func, args_i, args_r, None, calldescr)
@arguments("cpu", "i", "I", "R", "d")
def bhimpl_residual_call_ir_v(cpu, func, args_i, args_r, calldescr):
+ workaround2200.active = True
return cpu.bh_call_v(func, args_i, args_r, None, calldescr)
@arguments("cpu", "i", "I", "R", "F", "d", returns="i")
def bhimpl_residual_call_irf_i(cpu, func, args_i,args_r,args_f,calldescr):
+ workaround2200.active = True
return cpu.bh_call_i(func, args_i, args_r, args_f, calldescr)
@arguments("cpu", "i", "I", "R", "F", "d", returns="r")
def bhimpl_residual_call_irf_r(cpu, func, args_i,args_r,args_f,calldescr):
+ workaround2200.active = True
return cpu.bh_call_r(func, args_i, args_r, args_f, calldescr)
@arguments("cpu", "i", "I", "R", "F", "d", returns="f")
def bhimpl_residual_call_irf_f(cpu, func, args_i,args_r,args_f,calldescr):
+ workaround2200.active = True
return cpu.bh_call_f(func, args_i, args_r, args_f, calldescr)
@arguments("cpu", "i", "I", "R", "F", "d")
def bhimpl_residual_call_irf_v(cpu, func, args_i,args_r,args_f,calldescr):
+ workaround2200.active = True
return cpu.bh_call_v(func, args_i, args_r, args_f, calldescr)
# conditional calls - note that they cannot return stuff
@@ -1108,44 +1118,54 @@ class BlackholeInterpreter(object):
@arguments("cpu", "j", "R", returns="i")
def bhimpl_inline_call_r_i(cpu, jitcode, args_r):
+ workaround2200.active = True
return cpu.bh_call_i(jitcode.get_fnaddr_as_int(),
None, args_r, None, jitcode.calldescr)
@arguments("cpu", "j", "R", returns="r")
def bhimpl_inline_call_r_r(cpu, jitcode, args_r):
+ workaround2200.active = True
return cpu.bh_call_r(jitcode.get_fnaddr_as_int(),
None, args_r, None, jitcode.calldescr)
@arguments("cpu", "j", "R")
def bhimpl_inline_call_r_v(cpu, jitcode, args_r):
+ workaround2200.active = True
return cpu.bh_call_v(jitcode.get_fnaddr_as_int(),
None, args_r, None, jitcode.calldescr)
@arguments("cpu", "j", "I", "R", returns="i")
def bhimpl_inline_call_ir_i(cpu, jitcode, args_i, args_r):
+ workaround2200.active = True
return cpu.bh_call_i(jitcode.get_fnaddr_as_int(),
args_i, args_r, None, jitcode.calldescr)
@arguments("cpu", "j", "I", "R", returns="r")
def bhimpl_inline_call_ir_r(cpu, jitcode, args_i, args_r):
+ workaround2200.active = True
return cpu.bh_call_r(jitcode.get_fnaddr_as_int(),
args_i, args_r, None, jitcode.calldescr)
@arguments("cpu", "j", "I", "R")
def bhimpl_inline_call_ir_v(cpu, jitcode, args_i, args_r):
+ workaround2200.active = True
return cpu.bh_call_v(jitcode.get_fnaddr_as_int(),
args_i, args_r, None, jitcode.calldescr)
@arguments("cpu", "j", "I", "R", "F", returns="i")
def bhimpl_inline_call_irf_i(cpu, jitcode, args_i, args_r, args_f):
+ workaround2200.active = True
return cpu.bh_call_i(jitcode.get_fnaddr_as_int(),
args_i, args_r, args_f, jitcode.calldescr)
@arguments("cpu", "j", "I", "R", "F", returns="r")
def bhimpl_inline_call_irf_r(cpu, jitcode, args_i, args_r, args_f):
+ workaround2200.active = True
return cpu.bh_call_r(jitcode.get_fnaddr_as_int(),
args_i, args_r, args_f, jitcode.calldescr)
@arguments("cpu", "j", "I", "R", "F", returns="f")
def bhimpl_inline_call_irf_f(cpu, jitcode, args_i, args_r, args_f):
+ workaround2200.active = True
return cpu.bh_call_f(jitcode.get_fnaddr_as_int(),
args_i, args_r, args_f, jitcode.calldescr)
@arguments("cpu", "j", "I", "R", "F")
def bhimpl_inline_call_irf_v(cpu, jitcode, args_i, args_r, args_f):
+ workaround2200.active = True
return cpu.bh_call_v(jitcode.get_fnaddr_as_int(),
args_i, args_r, args_f, jitcode.calldescr)
@@ -1438,6 +1458,8 @@ class BlackholeInterpreter(object):
if not self.nextblackholeinterp:
self._exit_frame_with_exception(current_exc)
return current_exc
+ finally:
+ workaround2200.active = False
#
# pass the frame's return value to the caller
caller = self.nextblackholeinterp
@@ -1656,3 +1678,10 @@ def convert_and_run_from_pyjitpl(metainterp, raising_exception=False):
current_exc = lltype.nullptr(rclass.OBJECTPTR.TO)
#
_run_forever(firstbh, current_exc)
+
+# ____________________________________________________________
+
+class WorkaroundIssue2200(object):
+ pass
+workaround2200 = WorkaroundIssue2200()
+workaround2200.active = False
diff --git a/rpython/jit/metainterp/test/test_ajit.py b/rpython/jit/metainterp/test/test_ajit.py
index ad81456..c820185 100644
--- a/rpython/jit/metainterp/test/test_ajit.py
+++ b/rpython/jit/metainterp/test/test_ajit.py
@@ -4044,3 +4044,30 @@ class TestLLtype(BaseLLtypeTests, LLJitMixin):
res = self.interp_operations(f, [17])
assert res == 42
self.check_operations_history(guard_true=1, guard_false=0)
+
+ def test_issue2200_recursion(self):
+ # Reproduces issue #2200. This test contains no recursion,
+ # but due to an unlikely combination of factors it ends up
+ # creating an RPython-level recursion, one per loop iteration.
+ # The recursion is: blackhole interp from the failing guard ->
+ # does the call to enter() as a normal call -> enter() runs
+ # can_enter_jit() as if we're interpreted -> we enter the JIT
+ # again from the start of the loop -> the guard fails again
+ # during the next iteration -> blackhole interp. All arrows
+ # in the previous sentence are one or more levels of RPython
+ # function calls.
+ driver = JitDriver(greens=[], reds=["i"])
+ def enter(i):
+ driver.can_enter_jit(i=i)
+ def f():
+ set_param(None, 'trace_eagerness', 999999)
+ i = 0
+ while True:
+ driver.jit_merge_point(i=i)
+ i += 1
+ if i >= 300:
+ return i
+ promote(i + 1) # a failing guard
+ enter(i)
+
+ self.meta_interp(f, [])
diff --git a/rpython/jit/metainterp/warmstate.py b/rpython/jit/metainterp/warmstate.py
index 805933e..ca47f03 100644
--- a/rpython/jit/metainterp/warmstate.py
+++ b/rpython/jit/metainterp/warmstate.py
@@ -405,6 +405,14 @@ class WarmEnterState(object):
bound_reached(hash, None, *args)
return
+ # Workaround for issue #2200, maybe temporary. This is not
+ # a proper fix, but only a hack that should work well enough
+ # for PyPy's main jitdriver... See test_issue2200_recursion
+ from rpython.jit.metainterp.blackhole import workaround2200
+ if workaround2200.active:
+ workaround2200.active = False
+ return
+
# Here, we have found 'cell'.
#
if cell.flags & (JC_TRACING | JC_TEMPORARY):

View File

@ -1,6 +1,6 @@
From 9092f6266c3054befff053aa943632856cedbdba Mon Sep 17 00:00:00 2001 From 4c0f6a6fe6c71009ab4a6b3716e70af021e04904 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz> From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Fri, 1 Jul 2016 11:42:53 +0200 Date: Sat, 2 Jul 2016 20:18:12 +0200
Subject: [PATCH] Raise an error when STARTTLS fails Subject: [PATCH] Raise an error when STARTTLS fails
CVE-2016-0772 python: smtplib StartTLS stripping attack CVE-2016-0772 python: smtplib StartTLS stripping attack
@ -15,10 +15,10 @@ Based on an upstream change by Benjamin Peterson <benjamin@python.org>
1 file changed, 5 insertions(+) 1 file changed, 5 insertions(+)
diff --git a/lib-python/3/smtplib.py b/lib-python/3/smtplib.py diff --git a/lib-python/3/smtplib.py b/lib-python/3/smtplib.py
index 679e478..1aacfaf 100644 index 57f181b..5656cc6 100755
--- a/lib-python/3/smtplib.py --- a/lib-python/3/smtplib.py
+++ b/lib-python/3/smtplib.py +++ b/lib-python/3/smtplib.py
@@ -666,6 +666,11 @@ class SMTP: @@ -680,6 +680,11 @@ class SMTP:
self.ehlo_resp = None self.ehlo_resp = None
self.esmtp_features = {} self.esmtp_features = {}
self.does_esmtp = 0 self.does_esmtp = 0

View File

@ -1,6 +1,6 @@
From 82dc922c7c4771ef789f5b395f54a603c693b05e Mon Sep 17 00:00:00 2001 From 9a8db191cf8a3557a24e91081bf434d581b98c5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz> From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Fri, 1 Jul 2016 13:08:55 +0200 Date: Sat, 2 Jul 2016 20:20:58 +0200
Subject: [PATCH] Disabled HTTP header injections in http.client. Subject: [PATCH] Disabled HTTP header injections in http.client.
CVE-2016-5699 python: http protocol steam injection attack CVE-2016-5699 python: http protocol steam injection attack
@ -16,7 +16,7 @@ Based on an upstream change by Demian Brecht and Serhiy Storchaka
2 files changed, 94 insertions(+) 2 files changed, 94 insertions(+)
diff --git a/lib-python/3/http/client.py b/lib-python/3/http/client.py diff --git a/lib-python/3/http/client.py b/lib-python/3/http/client.py
index 5466d06..1d215d8 100644 index e05c84d..476d6c8 100644
--- a/lib-python/3/http/client.py --- a/lib-python/3/http/client.py
+++ b/lib-python/3/http/client.py +++ b/lib-python/3/http/client.py
@@ -70,6 +70,7 @@ import email.parser @@ -70,6 +70,7 @@ import email.parser
@ -27,9 +27,9 @@ index 5466d06..1d215d8 100644
import socket import socket
import collections import collections
from urllib.parse import urlsplit from urllib.parse import urlsplit
@@ -207,6 +208,34 @@ MAXAMOUNT = 1048576 @@ -217,6 +218,34 @@ _MAXLINE = 65536
# maximal line length when calling readline(). _MAXHEADERS = 100
_MAXLINE = 65536
+# Header name/value ABNF (http://tools.ietf.org/html/rfc7230#section-3.2) +# Header name/value ABNF (http://tools.ietf.org/html/rfc7230#section-3.2)
+# +#
@ -62,7 +62,7 @@ index 5466d06..1d215d8 100644
class HTTPMessage(email.message.Message): class HTTPMessage(email.message.Message):
# XXX The only usage of this method is in # XXX The only usage of this method is in
# http.server.CGIHTTPRequestHandler. Maybe move the code there so # http.server.CGIHTTPRequestHandler. Maybe move the code there so
@@ -953,12 +982,20 @@ class HTTPConnection: @@ -1035,12 +1064,20 @@ class HTTPConnection:
if hasattr(header, 'encode'): if hasattr(header, 'encode'):
header = header.encode('ascii') header = header.encode('ascii')
@ -73,7 +73,7 @@ index 5466d06..1d215d8 100644
values = list(values) values = list(values)
for i, one_value in enumerate(values): for i, one_value in enumerate(values):
if hasattr(one_value, 'encode'): if hasattr(one_value, 'encode'):
values[i] = one_value.encode('latin1') values[i] = one_value.encode('latin-1')
elif isinstance(one_value, int): elif isinstance(one_value, int):
values[i] = str(one_value).encode('ascii') values[i] = str(one_value).encode('ascii')
+ +
@ -84,12 +84,12 @@ index 5466d06..1d215d8 100644
header = header + b': ' + value header = header + b': ' + value
self._output(header) self._output(header)
diff --git a/lib-python/3/test/test_httplib.py b/lib-python/3/test/test_httplib.py diff --git a/lib-python/3/test/test_httplib.py b/lib-python/3/test/test_httplib.py
index 420302c..31d3bd0 100644 index c8ded92..fd71bea 100644
--- a/lib-python/3/test/test_httplib.py --- a/lib-python/3/test/test_httplib.py
+++ b/lib-python/3/test/test_httplib.py +++ b/lib-python/3/test/test_httplib.py
@@ -134,6 +134,33 @@ class HeaderTests(TestCase): @@ -134,6 +134,33 @@ class HeaderTests(TestCase):
conn.putheader('Content-length', 42) conn.putheader('Content-length', 42)
self.assertTrue(b'Content-length: 42' in conn._buffer) self.assertIn(b'Content-length: 42', conn._buffer)
+ conn.putheader('Foo', ' bar ') + conn.putheader('Foo', ' bar ')
+ self.assertIn(b'Foo: bar ', conn._buffer) + self.assertIn(b'Foo: bar ', conn._buffer)

View File

@ -1,12 +0,0 @@
diff -rup pypy-pypy-f66246c46ca3/rpython/tool/ansi_print.py pypy-pypy-f66246c46ca3/rpython/tool/ansi_print.py
--- pypy-pypy-f66246c46ca3/rpython/tool/ansi_print.py 2013-05-27 10:35:37.648237156 +0200
+++ pypy-pypy-f66246c46ca3/rpython/tool/ansi_print.py 2013-05-28 10:15:58.200426205 +0200
@@ -25,7 +25,7 @@ class AnsiLog:
self.kw_to_color = self.KW_TO_COLOR.copy()
self.kw_to_color.update(kw_to_color)
self.file = file
- self.fancy = True
+ self.fancy = False
self.isatty = getattr(sys.stderr, 'isatty', lambda: False)
if self.fancy and self.isatty():
self.mandelbrot_driver = Driver()

View File

@ -1,6 +1,6 @@
Name: pypy3 Name: pypy3
Version: 2.4.0 Version: 5.2.0
Release: 6%{?dist} Release: 0.1.alpha1%{?dist}
Summary: Python 3 implementation with a Just-In-Time compiler Summary: Python 3 implementation with a Just-In-Time compiler
Group: Development/Languages Group: Development/Languages
@ -116,7 +116,7 @@ URL: http://pypy.org/
# Easy way to turn off the selftests: # Easy way to turn off the selftests:
%global run_selftests 1 %global run_selftests 1
%global pypyprefix %{_libdir}/%{name}-%{version} %global pypyprefix %{_libdir}/pypy3-%{version}
%global pylibver 3 %global pylibver 3
# We refer to this subdir of the source tree in a few places during the build: # We refer to this subdir of the source tree in a few places during the build:
@ -129,17 +129,17 @@ URL: http://pypy.org/
%(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
# Source and patches: # Source and patches:
Source0: https://bitbucket.org/pypy/pypy/downloads/%{name}-%{version}-src.tar.bz2 Source0: https://bitbucket.org/pypy/pypy/downloads/pypy3.3-v5.2.0-alpha1-src.tar.bz2
# Supply various useful RPM macros for building python modules against pypy: # Supply various useful RPM macros for building python modules against pypy:
# __pypy, pypy_sitelib, pypy_sitearch # __pypy, pypy_sitelib, pypy_sitearch
Source2: macros.%{name} Source2: macros.pypy3
# By default, if built at a tty, the translation process renders a Mandelbrot # By default, if built at a tty, the translation process renders a Mandelbrot
# set to indicate progress. # set to indicate progress.
# This obscures useful messages, and may waste CPU cycles, so suppress it, and # This obscures useful messages, and may waste CPU cycles, so suppress it, and
# merely render dots: # merely render dots:
Patch0: pypy-1.2-suppress-mandelbrot-set-during-tty-build.patch Patch0: 001-nevertty.patch
# Patch pypy.translator.platform so that stdout from "make" etc gets logged, # Patch pypy.translator.platform so that stdout from "make" etc gets logged,
# rather than just stderr, so that the command-line invocations of the compiler # rather than just stderr, so that the command-line invocations of the compiler
@ -152,9 +152,6 @@ Patch1: 006-always-log-stdout.patch
# community that won't make sense outside of it). [Sorry to be a killjoy] # community that won't make sense outside of it). [Sorry to be a killjoy]
Patch2: 007-remove-startup-message.patch Patch2: 007-remove-startup-message.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1307889
# https://bitbucket.org/pypy/pypy/commits/c4c54cb69aba
Patch3: 008-maximum-recursion-depth.patch
# CVE-2016-0772 python: smtplib StartTLS stripping attack # CVE-2016-0772 python: smtplib StartTLS stripping attack
# rhbz#1303647: https://bugzilla.redhat.com/show_bug.cgi?id=1303647 # rhbz#1303647: https://bugzilla.redhat.com/show_bug.cgi?id=1303647
@ -180,7 +177,7 @@ Patch5: 010-disabled-HTTP-header-injections-in-http.client.patch
# Note, pypy3 is built with pypy2, so no dependency cycle # Note, pypy3 is built with pypy2, so no dependency cycle
%global use_self_when_building 1 %global use_self_when_building 0
%if 0%{use_self_when_building} %if 0%{use_self_when_building}
# pypy3 can only be build with pypy2 # pypy3 can only be build with pypy2
BuildRequires: pypy BuildRequires: pypy
@ -205,6 +202,8 @@ BuildRequires: bzip2-devel
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
BuildRequires: expat-devel BuildRequires: expat-devel
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: gdbm-devel
BuildRequires: xz-devel
%ifnarch s390 %ifnarch s390
BuildRequires: valgrind-devel BuildRequires: valgrind-devel
%endif %endif
@ -234,7 +233,7 @@ BuildRequires: emacs
BuildRequires: git BuildRequires: git
# Metadata for the core package (the JIT build): # Metadata for the core package (the JIT build):
Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: pypy3-libs%{?_isa} = %{version}-%{release}
%description %description
PyPy's implementation of Python 3, featuring a Just-In-Time compiler on some CPU PyPy's implementation of Python 3, featuring a Just-In-Time compiler on some CPU
@ -266,7 +265,7 @@ Libraries required by the various PyPy implementations of Python 3.
%package devel %package devel
Group: Development/Languages Group: Development/Languages
Summary: Development tools for working with PyPy3 Summary: Development tools for working with PyPy3
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: pypy3%{?_isa} = %{version}-%{release}
%description devel %description devel
Header files for building C extension modules against PyPy3 Header files for building C extension modules against PyPy3
@ -276,13 +275,13 @@ Header files for building C extension modules against PyPy3
%package stackless %package stackless
Group: Development/Languages Group: Development/Languages
Summary: Stackless Python interpreter built using PyPy3 Summary: Stackless Python interpreter built using PyPy3
Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: pypy3-libs%{?_isa} = %{version}-%{release}
%description stackless %description stackless
Build of PyPy3 with support for micro-threads for massive concurrency Build of PyPy3 with support for micro-threads for massive concurrency
%endif %endif
%prep %prep
%autosetup -n %{name}-%{version}-src -p1 -S git %autosetup -n pypy3.3-v5.2.0-alpha1-src -p1 -S git
# Replace /usr/local/bin/python shebangs with /usr/bin/python: # Replace /usr/local/bin/python shebangs with /usr/bin/python:
find -name "*.py" -exec \ find -name "*.py" -exec \
@ -304,20 +303,6 @@ find lib-python/%{pylibver} -name "*.py" -exec \
"{}" \ "{}" \
\; \;
# Hacky fix to allow the curses module to build on x86_64; otherwise we get:
# cffi.ffiplatform.VerificationError: anonymous MEVENT: wrong total size
# (we have 24, but C compiler says 20)
# https://github.com/archlinuxcn/repo/commit/560a75090333b6de8a1de960acac5e624b444ee1
%ifarch x86_64
_type=unsigned
%else
_type=uint32_t
%endif
sed -i -e "s/typedef unsigned long mmask_t/typedef $_type mmask_t/" \
-e "s/typedef unsigned long chtype/typedef $_type chtype/" \
lib_pypy/_curses.py
%build %build
BuildPyPy() { BuildPyPy() {
@ -379,8 +364,7 @@ BuildPyPy() {
# of root pointers: # of root pointers:
%global gcrootfinder_options --gcrootfinder=shadowstack %global gcrootfinder_options --gcrootfinder=shadowstack
# Prevent memory exhaustion export CFLAGS=$(echo "$RPM_OPT_FLAGS")
export CFLAGS=$(echo "$RPM_OPT_FLAGS" | sed -e 's/-g//')
%else %else
# Go with the default, which is "asmgcc" # Go with the default, which is "asmgcc"
@ -399,7 +383,7 @@ BuildPyPy() {
# For now, filter our CFLAGS of everything that could be conflicting with # For now, filter our CFLAGS of everything that could be conflicting with
# pypy. Need to check these and reenable ones that are okay later. # pypy. Need to check these and reenable ones that are okay later.
# Filed as https://bugzilla.redhat.com/show_bug.cgi?id=666966 # Filed as https://bugzilla.redhat.com/show_bug.cgi?id=666966
export CFLAGS=$(echo "$RPM_OPT_FLAGS" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//' -e 's/-fexceptions//' -e 's/-fstack-protector//' -e 's/--param=ssp-buffer-size=4//' -e 's/-O2//' -e 's/-fasynchronous-unwind-tables//' -e 's/-march=i686//' -e 's/-mtune=atom//' -e 's/-g//') export CFLAGS=$(echo "$RPM_OPT_FLAGS" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//' -e 's/-fexceptions//' -e 's/-fstack-protector//' -e 's/--param=ssp-buffer-size=4//' -e 's/-O2//' -e 's/-fasynchronous-unwind-tables//' -e 's/-march=i686//' -e 's/-mtune=atom//')
%endif %endif
@ -425,7 +409,6 @@ BuildPyPy() {
PYPY_USESSION_DIR=$(pwd) \ PYPY_USESSION_DIR=$(pwd) \
PYPY_USESSION_BASENAME=$ExeName \ PYPY_USESSION_BASENAME=$ExeName \
$INTERP ../../rpython/bin/rpython \ $INTERP ../../rpython/bin/rpython \
--output=$ExeName \
%{gcrootfinder_options} \ %{gcrootfinder_options} \
$Options \ $Options \
targetpypystandalone targetpypystandalone
@ -442,7 +425,7 @@ BuildPyPy() {
} }
BuildPyPy \ BuildPyPy \
%{name} \ pypy3 \
%if 0%{with_jit} %if 0%{with_jit}
"-Ojit" \ "-Ojit" \
%else %else
@ -452,7 +435,7 @@ BuildPyPy \
%if 0%{with_stackless} %if 0%{with_stackless}
BuildPyPy \ BuildPyPy \
%{name}-stackless \ pypy3-stackless \
"--stackless" "--stackless"
%endif %endif
@ -498,36 +481,11 @@ InstallPyPy() {
mkdir -p %{buildroot}/%{_bindir} mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{pypyprefix} mkdir -p %{buildroot}/%{pypyprefix}
InstallPyPy %{name}
%if 0%{with_stackless} # Run installing script, archive-name %{name}-%{version} in %{buildroot}/%{_libdir} == %{pypyprefix}
InstallPyPy %{name}-stackless %{bootstrap_python_interp} pypy/tool/release/package.py --archive-name %{name}-%{version} --builddir %{buildroot}/%{_libdir}
%endif
# Install the various support libraries as described at:
# http://codespeak.net/pypy/dist/pypy/doc/getting-started-python.html#installation
# which refers to a "PREFIX" found relative to the location of the binary.
# Given that the pypy binaries will be in /usr/bin, PREFIX can be
# "../share/pypy-1.2" relative to that directory, i.e. /usr/share/pypy-1.2
#
# Running "strace" on a built binary indicates that it searches within
# PREFIX/lib-python/modified-2.5.2
# not
# PREFIX/lib-python/modified.2.5.2
# as given on the above page, i.e. it uses '-' not '.'
cp -a lib-python %{buildroot}/%{pypyprefix}
cp -a lib_pypy %{buildroot}/%{pypyprefix}
# Remove a text file that documents which selftests fail on Win32:
rm %{buildroot}/%{pypyprefix}/lib-python/win32-failures.txt
# Remove a text file containing upstream's recipe for syncing stdlib in
# their hg repository with cpython's:
rm %{buildroot}/%{pypyprefix}/lib-python/stdlib-upgrade.txt
# Remove shebang lines from .py files that aren't executable, and # Remove shebang lines from .py files that aren't executable, and
# remove executability from .py files that don't have a shebang line: # remove executability from .py files that don't have a shebang line:
find \ find \
@ -546,6 +504,8 @@ find \
mkdir -p %{buildroot}/%{pypyprefix}/site-packages mkdir -p %{buildroot}/%{pypyprefix}/site-packages
ln -s %{pypyprefix}/bin/pypy3 %{buildroot}/%{_bindir}/pypy3
ln -s %{pypyprefix}/bin/pypy3.3 %{buildroot}/%{_bindir}/pypy3.3
# pypy uses .pyc files by default (--objspace-usepycfiles), but has a slightly # pypy uses .pyc files by default (--objspace-usepycfiles), but has a slightly
# different bytecode format to CPython. It doesn't use .pyo files: the -O flag # different bytecode format to CPython. It doesn't use .pyo files: the -O flag
@ -604,16 +564,16 @@ mkdir -p %{buildroot}/%{pypyprefix}/site-packages
# Note that some of the test files deliberately contain syntax errors, so # Note that some of the test files deliberately contain syntax errors, so
# we pass 0 for the second argument ("errors_terminate"): # we pass 0 for the second argument ("errors_terminate"):
/usr/lib/rpm/brp-python-bytecompile \ /usr/lib/rpm/brp-python-bytecompile \
%{buildroot}/%{_bindir}/%{name} \ %{buildroot}%{pypyprefix}/bin/pypy3 \
0 0
%{buildroot}/%{pypyprefix}/%{name} -c 'import _tkinter' %{buildroot}%{pypyprefix}/bin/pypy3 -c 'import _tkinter'
%{buildroot}/%{pypyprefix}/%{name} -c 'import tkinter' %{buildroot}%{pypyprefix}/bin/pypy3 -c 'import tkinter'
%{buildroot}/%{pypyprefix}/%{name} -c 'import _sqlite3' %{buildroot}%{pypyprefix}/bin/pypy3 -c 'import _sqlite3'
%{buildroot}/%{pypyprefix}/%{name} -c 'import _curses' %{buildroot}%{pypyprefix}/bin/pypy3 -c 'import _curses'
%{buildroot}/%{pypyprefix}/%{name} -c 'import curses' %{buildroot}%{pypyprefix}/bin/pypy3 -c 'import curses'
%{buildroot}/%{pypyprefix}/%{name} -c 'import syslog' %{buildroot}%{pypyprefix}/bin/pypy3 -c 'import syslog'
%{buildroot}/%{pypyprefix}/%{name} -c 'from _sqlite3 import *' %{buildroot}%{pypyprefix}/bin/pypy3 -c 'from _sqlite3 import *'
# Header files for C extension modules. # Header files for C extension modules.
# Upstream's packaging process (pypy/tool/release/package.py) # Upstream's packaging process (pypy/tool/release/package.py)
@ -626,8 +586,8 @@ mkdir -p %{buildroot}/%{pypyprefix}/site-packages
# it's not yet clear to me how upstream plan to deal with the C extension # it's not yet clear to me how upstream plan to deal with the C extension
# interface going forward, so let's just mimic upstream for now. # interface going forward, so let's just mimic upstream for now.
%global pypy_include_dir %{pypyprefix}/include %global pypy_include_dir %{pypyprefix}/include
mkdir -p %{buildroot}/%{pypy_include_dir} mkdir -p %{buildroot}%{pypy_include_dir}
cp include/*.h %{buildroot}/%{pypy_include_dir} rm -f %{buildroot}%{pypy_include_dir}/README
# Capture the RPython source code files from the build within the debuginfo # Capture the RPython source code files from the build within the debuginfo
@ -677,16 +637,18 @@ find \
# Install the JIT trace mode for Emacs: # Install the JIT trace mode for Emacs:
%if %{with_emacs} %if %{with_emacs}
mkdir -p %{buildroot}/%{_emacs_sitelispdir} mkdir -p %{buildroot}/%{_emacs_sitelispdir}
cp -a rpython/jit/tool/pypytrace-mode.el %{buildroot}/%{_emacs_sitelispdir}/%{name}trace-mode.el cp -a rpython/jit/tool/pypytrace-mode.el %{buildroot}/%{_emacs_sitelispdir}/pypy3trace-mode.el
cp -a rpython/jit/tool/pypytrace-mode.elc %{buildroot}/%{_emacs_sitelispdir}/%{name}trace-mode.elc cp -a rpython/jit/tool/pypytrace-mode.elc %{buildroot}/%{_emacs_sitelispdir}/pypy3trace-mode.elc
%endif %endif
# Install macros for rpm: # Install macros for rpm:
mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d
install -m 644 %{SOURCE2} %{buildroot}/%{_rpmconfigdir}/macros.d install -m 644 %{SOURCE2} %{buildroot}/%{_rpmconfigdir}/macros.d
# Remove build script from the package # Remove files we don't want:
rm %{buildroot}/%{pypyprefix}/lib_pypy/ctypes_config_cache/rebuild.py rm -f %{buildroot}%{_libdir}//pypy3-5.2.0.tar.bz2
rm -f %{buildroot}%{pypyprefix}/LICENSE
rm -f %{buildroot}%{pypyprefix}/README.rst
%check %check
topdir=$(pwd) topdir=$(pwd)
@ -807,10 +769,10 @@ CheckPyPy() {
#pypy/goal/pypy pypy/test_all.py --resultlog=pypyjit_new.log #pypy/goal/pypy pypy/test_all.py --resultlog=pypyjit_new.log
%if %{run_selftests} %if %{run_selftests}
CheckPyPy %{name} CheckPyPy pypy-c
%if 0%{with_stackless} %if 0%{with_stackless}
CheckPyPy %{name}-stackless CheckPyPy pypy3-stackless
%endif %endif
%endif # run_selftests %endif # run_selftests
@ -826,37 +788,39 @@ CheckPyPy %{name}-stackless
%dir %{pypyprefix} %dir %{pypyprefix}
%dir %{pypyprefix}/lib-python %dir %{pypyprefix}/lib-python
%{pypyprefix}/lib-python/stdlib-version.txt
%{pypyprefix}/lib-python/%{pylibver}/ %{pypyprefix}/lib-python/%{pylibver}/
%{pypyprefix}/lib-python/conftest.py*
%{pypyprefix}/lib_pypy/ %{pypyprefix}/lib_pypy/
%{pypyprefix}/site-packages/ %{pypyprefix}/site-packages/
%if %{with_emacs} %if %{with_emacs}
%{_emacs_sitelispdir}/%{name}trace-mode.el %{_emacs_sitelispdir}/pypy3trace-mode.el
%{_emacs_sitelispdir}/%{name}trace-mode.elc %{_emacs_sitelispdir}/pypy3trace-mode.elc
%endif %endif
%files %files
%license LICENSE %license LICENSE
%doc README.rst %doc README.rst
%{_bindir}/%{name} %{_bindir}/pypy3
%{pypyprefix}/%{name} %{_bindir}/pypy3.3
%{pypyprefix}/bin/
%files devel %files devel
%dir %{pypy_include_dir} %dir %{pypy_include_dir}
%{pypy_include_dir}/*.h %{pypy_include_dir}/*.h
%{_rpmconfigdir}/macros.d/macros.%{name} %{_rpmconfigdir}/macros.d/macros.pypy3
%if 0%{with_stackless} %if 0%{with_stackless}
%files stackless %files stackless
%license LICENSE %license LICENSE
%doc README.rst %doc README.rst
%{_bindir}/%{name}-stackless %{_bindir}/pypy-stackless
%endif %endif
%changelog %changelog
* Fri Jul 01 2016 Miro Hrončok <mhroncok@redhat.com> - 2.4.0-6 * Sat Jul 02 2016 Miro Hrončok <mhroncok@redhat.com> - 5.2.0-0.1.alpha1
- First alpha build of PyPy 3.3
* Fri Jul 01 2016 Miro Hrončok <mhroncok@redhat.com> - 2.4.0-3
- Fix for: CVE-2016-0772 python: smtplib StartTLS stripping attack - Fix for: CVE-2016-0772 python: smtplib StartTLS stripping attack
- Raise an error when STARTTLS fails - Raise an error when STARTTLS fails
- rhbz#1303647: https://bugzilla.redhat.com/show_bug.cgi?id=1303647 - rhbz#1303647: https://bugzilla.redhat.com/show_bug.cgi?id=1303647
@ -867,18 +831,6 @@ CheckPyPy %{name}-stackless
- rhbz#1351687: https://bugzilla.redhat.com/show_bug.cgi?id=1351687 - rhbz#1351687: https://bugzilla.redhat.com/show_bug.cgi?id=1351687
- Fixed upstream: https://hg.python.org/cpython/rev/bf3e1c9b80e9 - Fixed upstream: https://hg.python.org/cpython/rev/bf3e1c9b80e9
* Fri May 13 2016 Miro Hrončok <mhroncok@redhat.com> - 2.4.0-5
- Fix FTBFS (#1307889)
- Add patch to fix maximum recursion depth error during build
- Don't use -g flag to prevent memory exhaustion
- Add fix form Arch Linux to prevent VerificationError during the build
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Tue Aug 04 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.4.0-3
- Bump release to rebuild with new execstack
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.0-2 * Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

View File

@ -1 +1 @@
96ba72916114d16904e12562b5d84e51 pypy3-2.4.0-src.tar.bz2 e4bbd6fe42481a17f705611d76914eda pypy3.3-v5.2.0-alpha1-src.tar.bz2