Debian Codegraph @

pypy/doc/release-v7.3.17.rst

raw
1 =================================================================
2 PyPy v7.3.17: release of python 2.7 and 3.10, released 2024-08-28
3 =================================================================
4
5 The PyPy team is proud to release version 7.3.17 of PyPy.
6
7 This release includes a new `RISC-V JIT backend`_, an `improved REPL`_ based on
8 work by the CPython team, and `better JIT optimizations`_ of integer
9 operations. Special shout-outs to `Logan Chien`_ for the `RISC-V backend
10 work`_, to `Nico Rittinghaus`_ for better integer optimization in the JIT, and
11 the CPython team that has worked on the repl.
12
13 The release includes two different interpreters:
14
15 - PyPy2.7, which is an interpreter supporting the syntax and the features of
16 Python 2.7 including the stdlib for CPython 2.7.18+ (the ``+`` is for
17 backported security updates)
18
19 - PyPy3.10, which is an interpreter supporting the syntax and the features of
20 Python 3.10, including the stdlib for CPython 3.10.14.
21
22 The interpreters are based on much the same codebase, thus the dual
23 release. This is a micro release, all APIs are compatible with the other 7.3
24 releases. It follows after 7.3.16 release on April 23, 2024.
25
26 We recommend updating. You can find links to download the releases here:
27
28 https://pypy.org/download.html
29
30 We would like to thank our donors for the continued support of the PyPy
31 project. If PyPy is not quite good enough for your needs, we are available for
32 `direct consulting`_ work. If PyPy is helping you out, we would love to hear
33 about it and encourage submissions to our blog_ via a pull request
34 to https://github.com/pypy/pypy.org
35
36 We would also like to thank our contributors and encourage new people to join
37 the project. PyPy has many layers and we need help with all of them: bug fixes,
38 `PyPy`_ and `RPython`_ documentation improvements, or general `help`_ with
39 making RPython's JIT even better.
40
41 If you are a python library maintainer and use C-extensions, please consider
42 making a HPy_ / CFFI_ / cppyy_ version of your library that would be performant
43 on PyPy. In any case, both `cibuildwheel`_ and the `multibuild system`_ support
44 building wheels for PyPy.
45
46 .. _`PyPy`: index.html
47 .. _`RPython`: https://rpython.readthedocs.org
48 .. _`help`: project-ideas.html
49 .. _CFFI: https://cffi.readthedocs.io
50 .. _cppyy: https://cppyy.readthedocs.io
51 .. _`multibuild system`: https://github.com/matthew-brett/multibuild
52 .. _`cibuildwheel`: https://github.com/joerick/cibuildwheel
53 .. _blog: https://pypy.org/blog
54 .. _HPy: https://hpyproject.org/
55 .. _direct consulting: https://www.pypy.org/pypy-sponsors.html
56 .. _`RISC-V backend work`: https://github.com/pypy/pypy/pull/5002
57
58
59 .. _`RISC-V JIT backend`:
60
61 RISC-V backend for the JIT
62 ===========================
63
64 PyPy's JIT has added support for generating 64-bit RISC-V machine code at
65 runtime (RV64-IMAD, specifically). So far we are not releasing binaries for any
66 RISC-V platforms, but there are instructions_ on how to cross-compile binaries.
67
68 .. _instructions: https://rpython.readthedocs.io/en/latest/riscv.html
69
70
71 .. _`improved REPL`:
72
73 REPL Improvements
74 ==================
75
76 The biggest user-visible change of the release is new features in the repl of
77 PyPy3.10. CPython 3.13 has adopted and extended PyPy's pure-Python repl, adding
78 a number of features and fixing a number or bugs in the process. We have
79 backported and added the following features:
80
81 - Prompts and tracebacks use terminal colors, as well as `terminal hyperlinks`_
82 for file names.
83 - `Bracketed paste`_ enable pasting several lines of input into the terminal
84 without auto-indentation getting in the way.
85 - A special interactive help browser (F1), history browser (F2), explicit paste
86 mode (F3).
87 - Support for Ctrl-<left/right> to jump over whole words at a time.
88
89 See the `CPython documentation for further details`_. Thanks to Łukasz Langa,
90 Pablo Galindo Salgado and the other CPython devs involved in this work.
91
92 .. _`terminal hyperlinks`: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
93 .. _`Bracketed paste`: https://en.wikipedia.org/wiki/Bracketed-paste
94 .. _`CPython documentation for further details`: https://docs.python.org/3.13/whatsnew/3.13.html#a-better-interactive-interpreter
95
96
97 .. _`better JIT optimizations`:
98
99 Better JIT optimizations of integer operations
100 ==============================================
101
102 The optimizers of PyPy's JIT have become much better at reasoning about and
103 optimizing integer operations. This is done with a new `"knownbits" abstract
104 domain`_. In many programs that do bit-manipulation of integers, some of the
105 bits of the integer variables of the program can be statically known. Here's a
106 simple example:
107
108 .. _`"knownbits" abstract domain`: https://pypy.org/posts/2024/08/toy-knownbits.html
109
110 .. code:: python
111
112 x = a | 1
113 ...
114 if x & 1:
115 ...
116 else:
117 ...
118
119 With the new abstract domain, the JIT can optimize the ``if``-condition to
120 ``True``, because it already knows that the lowest bit of ``x`` must be set.
121 This optimization applies to all Python-integers that fit into a machine word
122 (PyPy optimistically picks between two different representations for ``int``,
123 depending on the size of the value). Unfortunately there is very little impact
124 of this change on almost all Python code, because intensive bit-manipulation is
125 rare in Python. However, the change leads to significant performance
126 improvements in `Pydrofoil`_ (the RPython-based RISC-V/ARM emulators that are
127 automatically generated from high-level Sail_ specifications of the respective
128 ISAs, and that use the RPython JIT to improve performance).
129
130 .. _`Pydrofoil`: https://docs.pydrofoil.org/en/latest/
131 .. _Sail: https://github.com/rems-project/sail/
132
133 PyPy versions and speed.pypy.org
134 ================================
135
136 The keen-eyed will have noticed no mention of Python version 3.9 in the
137 releases above. Typically we will maintain only one version of Python3, but due
138 to PyPy3.9 support on conda-forge we maintained multiple versions from the
139 first release of PyPy3.10 in PyPy v7.3.12 (Dec 2022). Conda-forge is
140 `sunsetting its PyPy support`_, which means we can drop PyPy3.9. Since that was
141 the major driver of benchmarks at https://speed.pypy.org, we revamped the site
142 to showcase PyPy3.9, PyPy3.10, and various versions of cpython on the home
143 page. For historical reasons, the "baseline" for comparison is still cpython
144 3.7.19.
145
146 We will keep the buildbots building PyPY3.9 until the end of August, these
147 builds will still be available on the `nightly builds`_ tab of the buildbot.
148
149 .. _`sunsetting its PyPy support`: https://pypy.org/posts/2024/08/conda-forge-proposes-dropping-support-for-pypy.html
150 .. _`nightly builds`: https://buildbot.pypy.org/nightly/
151
152 What is PyPy?
153 =============
154
155 PyPy is a Python interpreter, a drop-in replacement for CPython
156 It's fast (`PyPy and CPython`_ performance
157 comparison) due to its integrated tracing JIT compiler.
158
159 We also welcome developers of other `dynamic languages`_ to see what RPython
160 can do for them.
161
162 We provide binary builds for:
163
164 * **x86** machines on most common operating systems
165 (Linux 32/64 bits, Mac OS 64 bits, Windows 64 bits)
166
167 * 64-bit **ARM** machines running Linux (``aarch64``) and macos (``macos_arm64``).
168
169 PyPy supports Windows 32-bit, Linux PPC64 big- and little-endian, Linux ARM
170 32 bit, RISC-V RV64IMAFD Linux, and s390x Linux but does not release binaries.
171 Please reach out to us if you wish to sponsor binary releases for those
172 platforms. Downstream packagers provide binary builds for debian, Fedora,
173 conda, OpenBSD, FreeBSD, Gentoo, and more.
174
175 .. _`PyPy and CPython`: https://speed.pypy.org
176 .. _`dynamic languages`: https://rpython.readthedocs.io/en/latest/examples.html
177
178 Changelog
179 =========
180
181 For all versions
182 ----------------
183
184 - DOCS: Fix source links in docs when moving from heptapod to github (:issue:`3216`)
185 - DOCS: Mention ``externals`` mercurial repo for windows build (:issue:`4921`)
186
187 Bugfixes
188 ~~~~~~~~
189
190 - Don't crash on constfolding field reads from null pointers in the RPython
191 translator (:issue:`4941`)
192 - Fix ``const char`` declaration in cffi gdbm (:issue:`4931`)
193 - Restore error message of ``TypeError`` generated when calling
194 ``tuple.__getitem__`` with invalid types (:issue:`4954`)
195 - ``id(obj)`` should really be an ``int``, not a ``long``
196 - Bump ``MACOSX_DEPLOYMENT_TARGET`` to 10.15 on x86_64 and 11.0 on arm64
197 (:issue:`4975`)
198 - Ignore whitespace when parsing complex numbers (:issue:`4980`)
199 - Add ``mmap.MAP_POPULATE`` on linux (:issue:`4991`)
200
201 Speedups and enhancements
202 ~~~~~~~~~~~~~~~~~~~~~~~~~
203
204 - Optimize for array length from ``new_array`` for non-virtual arrays
205 - Add ``look_inside_iff`` for ``W_TupleObject._getslice``
206 - Allow implicit string literal concatenation as docstring (:issue:`4973`)
207 - Improve trace of adding a new attribute to an already big instance and to a
208 list of unboxed fields
209 - Improve the code generated by some ``list`` methods in the JIT and the
210 RPython support code:
211
212 - calling ``find`` or ``count`` doesn't need the list object itself, just the
213 underlying storage
214 - unroll in more situations when creating a list
215 - make list multiplication use ``ll_alloc_and_set`` if the list has length 1
216 - copy lists in multiplication with ``log2(n)`` arraycopys instead of just
217 copying n times (string multiplication does it like this too)
218 - save one copy of the ``lhs`` list when adding two list
219
220 - Add a jit driver for ``dict.__eq__`` and an especially fast implementation
221 for mapdict equality
222 - Make the JIT generate better code for certain function calling patterns with ``*args``
223 - Optimize ``x * -1`` and ``x // -1`` to ``-x`` in the JIT.
224 - Speed up binary search on the ``utf8`` index storage. This slightly speeds up
225 ``unicode/str.find`` on very large strings.
226 - Optimize integers using the knownbits abstract domain (shout-out to `Nico Rittinghaus`).
227
228
229 .. _`Nico Rittinghaus`: https://github.com/nirit100
230 .. _`Logan Chien`: https://github.com/loganchien
231
232 Python 3.10
233 -----------
234
235 Bugfixes
236 ~~~~~~~~
237
238 - Fix leak of global named resources when using multiprocessing spawn
239 (:issue:`python/cpython#90549`)
240 - Include ``pyexpatns.h`` when building ``pyexpat``
241 - Add ``IO_REPARSE_TAG*`` constants to ``stats.py`` (:issue:`4953`)
242 - Add some missing sqlite3 symbols and defines.
243 - ``getindex_w`` works differently between py2 and py3, leading to error
244 message confusion
245 - Fix typo ``HAVE_MS_WINDOWS``-> ``MS_WINDOWS`` which impacted the ``stats``
246 module (:issue:`4952`)
247 - Compare lower case exe names when creating a virtual environment (:issue:`4958`)
248 - Add missing ``typecodes`` attribute to ``array``
249 - Add ``cmath.tau``, using ``math.pi * 2.0`` to define it.
250 - Remove dead code, make ``stats`` logic like CPython (:issue:`4976`)
251 - Add ``Py_UNREACHABLE`` to ``pymacro.h`` (:issue:`4982`)
252 - Don't segfault trying to generate a better SyntaxError msg. Also follow CPython's
253 logic about ``RAISE_SYNTAX_ERROR_INVALID_TARGET`` more closely, to get the
254 correct locations (:issue:`4897`)
255 - Fix long-standing bugs in pyrepl (from the CPython port of PyPy's pyrepl)
256
257 - Support ``ctrl-left`` and ``ctrl-right`` in the console (:issue:`906`)
258 - Implement bracketed paste (:issue:`2880`)
259 - Update bundled setuptools to `65.5.0`
260 - Fix value of readonly flag in ``PyMemoryView_FromMemory`` (:issue:`4993`)
261 - Make sure to call the ``atexit`` handlers after receiving ``sigint``
262 (:issue:`4995`). This is done by calling ``space.finish()``.
263 - Make stack depth computation in the bytecode compiler more precise. Stack
264 depths of various instructions were off by one for historical reasons. the
265 errors carefully balanced each other out. Now code that does exception
266 handling has smaller maximum bytecode stack sizes.
267 - Do not try ``__int__`` in ``PyLong_AsLong`` and ``PyLong_AsInt`` (:issue:`4949`)
268 - Make ``math.isinf.__self__`` == ``math`` to follow CPython's behaviour (:issue:`4959`)
269 - Fix post-build in-place ``venv`` creation (:issue:`4958`)
270 - Fix converting python object to ``unsigned long`` (in C) object attribute
271 (:issue:`4996`)
272 - Add missing sysconfig value ``LDCXXSHARED`` (:issue:`5004`)
273 - Add missing ``token.SOFT_KEYWORD`` (:issue:`4962`)
274 - Update vendored CFFI version to 1.17.0 from 1.17.0dev1. No real changes, this
275 will ensure ``pip install cffi`` does nothing.
276 - Implement more of ``asyncio``'s ``_overlap`` module on windows (:issue:`4008`)
277 - Disallow ``HAVE_LCHMOD`` like CPython on linux, since glibc has a dummy
278 implementation that always errors out.
279
280
281 Speedups and enhancements
282 ~~~~~~~~~~~~~~~~~~~~~~~~~
283 - Move the ``import`` fast path from ``IMPORT_NAME`` to ``__import__``, which
284 speeds up explicitly calling the latter.
285 - Update OpenSSL in the "embedded" builds to 3.3.1, addressing a performance
286 regression in urllib3 tests (:issue:`4877`)
287 - Speed up unicode encode/decode errormessage handling (:issue:`4972`). Before
288 this fix, the ``surrogateescape`` codec was quadratic in some corner cases.
289 - Backport ``pyrepl`` and ``_colorize`` from CPython3.13
290 - Make ``TextIOWrapper.tell()`` about 100x faster (:issue:`5009`). Also fix
291 some problems with ``seek`` and ``_multibytecodecs``.
292
293 .. _bpo-29334: https://github.com/python/cpython/issues/73520