Debian Codegraph @

pypy/doc/release-v7.3.4.rst

raw
1 ========================================================
2 PyPy v7.3.4: release of 2.7 and 3.7, released 2021-04-08
3 ========================================================
4
5 ..
6 Changelog up to commit 9c11d242d78c
7
8
9 The PyPy team is proud to release the version 7.3.4 of PyPy, which includes
10 two different interpreters:
11
12 - PyPy2.7, which is an interpreter supporting the syntax and the features of
13 Python 2.7 including the stdlib for CPython 2.7.18+ (the ``+`` is for
14 backported security updates)
15
16 - PyPy3.7, which is an interpreter supporting the syntax and the features of
17 Python 3.7, including the stdlib for CPython 3.7.10. We no longer refer to
18 this as beta-quality as the last incompatibilities with CPython (in the
19 ``re`` module) have been fixed.
20
21 We are no longer releasing a Python3.6 version, as we focus on updating to
22 Python 3.8. We have begun streaming the advances towards this goal on Saturday
23 evenings European time on https://www.twitch.tv/pypyproject. If Python3.6 is
24 important to you, please reach out as we could offer sponsored longer term
25 support.
26
27 The two interpreters are based on much the same codebase, thus the multiple
28 release. This is a micro release, all APIs are compatible with the other 7.3
29 releases. Highlights of the release include binary **Windows 64** support,
30 faster numerical instance fields, and a preliminary HPy backend.
31
32 A new contributor (Ondrej Baranovič - thanks!) took us up on the challenge to get
33 `windows 64-bit`_ support. The work has been merged and for the first time we
34 are releasing a 64-bit Windows binary package.
35
36 The release contains the biggest change to `PyPy's implementation of the
37 instances of user-defined classes`_ in many years. The optimization was
38 motivated by the report of performance problems running a `numerical particle
39 emulation`_. We implemented an optimization that stores ``int`` and ``float``
40 instance fields in an unboxed way, as long as these fields are type-stable
41 (meaning that the same field always stores the same type, using the principle
42 of `type freezing`_). This gives significant performance improvements on
43 numerical pure-Python code, and other code where instances store many integers
44 or floating point numbers.
45
46 .. _`PyPy's implementation of the instances of user-defined classes`:
47 https://www.pypy.org/posts/2010/11/efficiently-implementing-python-objects-3838329944323946932.html
48 .. _`numerical particle emulation`: https://github.com/paugier/nbabel
49 .. _`type freezing`: https://www.csl.cornell.edu/~cbatten/pdfs/cheng-type-freezing-cgo2020.pdf
50
51 There were also a number of optimizations for methods around strings and bytes,
52 following user reported performance problems. If you are unhappy with PyPy's
53 performance on some code of yours, please report `an issue`_!
54
55 .. _`an issue`: https://foss.heptapod.net/pypy/pypy/-/issues/
56
57 A major new feature is prelminary support for the Universal mode of HPy: a
58 new way of writing c-extension modules to totally encapsulate ``PyObject*``.
59 The goal, as laid out in the `HPy documentation`_ and recent `HPy blog post`_,
60 is to enable a migration path
61 for c-extension authors who wish their code to be performant on alternative
62 interpreters like GraalPython_ (written on top of the Java virtual machine),
63 RustPython_, and PyPy. Thanks to Oracle and IBM for sponsoring work on HPy.
64
65 Support for the vmprof_ statistical profiler has been extended to ARM64 via a
66 built-in backend.
67
68 Several issues exposed in the 7.3.3 release were fixed. Many of them came from the
69 great work ongoing to ship PyPy-compatible binary packages in `conda-forge`_.
70 A big shout out to them for taking this on.
71
72 Development of PyPy takes place on https://foss.heptapod.net/pypy/pypy.
73 We have seen an increase in the number of drive-by contributors who are able to
74 use gitlab + mercurial to create merge requests.
75
76 The `CFFI`_ backend has been updated to version 1.14.5 and the cppyy_ backend
77 to 1.14.2. We recommend using CFFI rather than C-extensions to interact with C,
78 and using cppyy for performant wrapping of C++ code for Python.
79
80 As always, we strongly recommend updating to the latest versions. Many fixes
81 are the direct result of end-user bug reports, so please continue reporting
82 issues as they crop up.
83
84 You can find links to download the v7.3.4 releases here:
85
86 https://pypy.org/download.html
87
88 We would like to thank our donors for the continued support of the PyPy
89 project. If PyPy is not quite good enough for your needs, we are available for
90 direct consulting work. If PyPy is helping you out, we would love to hear about
91 it and encourage submissions to our `renovated blog site`_ via a pull request
92 to https://github.com/pypy/pypy.org
93
94 We would also like to thank our contributors and encourage new people to join
95 the project. PyPy has many layers and we need help with all of them: `PyPy`_
96 and `RPython`_ documentation improvements, tweaking popular modules to run
97 on PyPy, or general `help`_ with making RPython's JIT even better. Since the
98 previous release, we have accepted contributions from 10 new contributors,
99 thanks for pitching in, and welcome to the project!
100
101 If you are a python library maintainer and use C-extensions, please consider
102 making a cffi / cppyy version of your library that would be performant on PyPy.
103 In any case both `cibuildwheel`_ and the `multibuild system`_ support
104 building wheels for PyPy.
105
106 .. _`PyPy`: index.html
107 .. _`RPython`: https://rpython.readthedocs.org
108 .. _`help`: project-ideas.html
109 .. _`CFFI`: https://cffi.readthedocs.io
110 .. _`cppyy`: https://cppyy.readthedocs.io
111 .. _`multibuild system`: https://github.com/matthew-brett/multibuild
112 .. _`cibuildwheel`: https://github.com/joerick/cibuildwheel
113 .. _`blog post`: https://pypy.org/blog/2020/02/pypy-and-cffi-have-moved-to-heptapod.html
114 .. _`conda-forge`: https://conda-forge.org/blog//2020/03/10/pypy
115 .. _`documented changes`: https://docs.python.org/3/whatsnew/3.7.html#re
116 .. _`PyPy 3.7 wiki`: https://foss.heptapod.net/pypy/pypy/-/wikis/py3.7%20status
117 .. _`wheels on PyPI`: https://pypi.org/project/numpy/#files
118 .. _`windows 64-bit`: https://foss.heptapod.net/pypy/pypy/-/issues/2073#note_141389
119 .. _`HPy documentation`: https://hpy.readthedocs.io/en/latest/
120 .. _`HPy blog post`: https://hpyproject.org/blog/posts/2021/03/hello-hpy/
121 .. _`GraalPython`: https://github.com/graalvm/graalpython
122 .. _`RustPython`: https://github.com/RustPython/RustPython
123 .. _`renovated blog site`: https://pypy.org/blog
124 .. _vmprof: https://vmprof.readthedocs.io/en/latest/
125
126
127 What is PyPy?
128 =============
129
130 PyPy is a Python interpreter, a drop-in replacement for CPython 2.7, 3.7, and
131 soon 3.8. It's fast (`PyPy and CPython 3.7.4`_ performance
132 comparison) due to its integrated tracing JIT compiler.
133
134 We also welcome developers of other `dynamic languages`_ to see what RPython
135 can do for them.
136
137 This PyPy release supports:
138
139 * **x86** machines on most common operating systems
140 (Linux 32/64 bits, Mac OS X 64 bits, Windows 32/64 bits, OpenBSD, FreeBSD)
141
142 * big- and little-endian variants of **PPC64** running Linux,
143
144 * **s390x** running Linux
145
146 * 64-bit **ARM** machines running Linux.
147
148 PyPy does support ARM 32 bit processors, but does not release binaries.
149
150 .. _`PyPy and CPython 3.7.4`: https://speed.pypy.org
151 .. _`dynamic languages`: https://rpython.readthedocs.io/en/latest/examples.html
152
153 Changelog
154 =========
155
156 Bugfixes shared across versions
157 -------------------------------
158 - Test, fix xml default attribute values (issue 3333_, `bpo 42151`_)
159 - Rename ``_hashlib.Hash`` to ``HASH`` to match CPython
160 - Fix loading system libraries with ctypes on macOS Big Sur (issue 3314)
161 - Fix ``__thread_id`` in greenlets (issue 3381_)
162 - Reject XML entity declarations in plist files (`bpo 42051`_)
163 - Make compare_digest more constant-time (`bpo 40791`_)
164 - Only use '&' as a query string separator in url parsing (`bpo 42967`_)
165 - Fix `__r*__` reverse methods on weakref proxies
166 - Restore pickle of dict iterators on default (python2.7)
167
168 Speedups and enhancements shared across versions
169 ------------------------------------------------
170 - Introduce a new RPython decorator ``@llhelper_error_value``, which
171 officializes the fact that you can raise RPython exceptions from llhelpers,
172 and makes it possible to specify what is the C value to return in case of
173 errors. Useful for HPY_
174 - Introduce a new RPython decorator ``@never_allocate`` which ensures a class
175 is **never** instantiated at runtime. Useful for objects that are required to
176 be constant-folded away
177 - Upstream internal ``cparser`` tool from ``pypy/`` to ``rpython/``
178 - Make ``set.update(<non-set>)`` more jit-friendly by
179 - unrolling it if the number of args is small (usually 1)
180 - jitting the adding of new elements
181 which fixes ``test_unpack_ex`` on PyPy3.7 as a side-effect
182 - Fix position of ``elif`` clauses in the AST
183 - Make the ``exe`` stack larger on windows
184 - Implement ``constcharpsize2str`` in rffi and refactor code to use it
185 - Add a ``versions.json`` to https://downloads.python.org/pypy/versions.json
186 for the gitlab actions python install action
187 - Add symlinks for python, python3 to the package tarballs (not on Windows)
188 - Fix a missing error: bare ``except:``-clauses should come last in ``codegen``
189 - Copy manifest from CPython and link it into ``pypy.exe`` (issue 3363)
190 - Preserve ``None`` passed as ``REG_BINARY`` instead of crashing or changing it
191 to an empty string in ``winreg`` (`bpo 21151`_)
192 - Add ``REG_QWORD*`` and ``Reg{Dis,En}ableReflectionKey``, and
193 ``RegDeleteKeyEx`` to ``winreg``
194 - Backport msvc detection from python3, which probably breaks using Visual
195 Studio 2008 (MSVC9, or the version that used to be used to build CPython2.7
196 on Windows)
197 - Optimize chains of ``longlong2float(float2longlong(x))`` and vice versa
198 - Optimize instances of maps with integer and float fields by storing them
199 unboxed in a float array (on 32bit machines this is only done for float
200 fields). The float array is stored in one of the storage slots of the
201 instance. Once a field proves to be type-unstable we give up on
202 type-specializing this class and revert all instances once we touch them the
203 next time to the default representation.
204 - Update the version of Tk/Tcl on windows to 8.6
205 - Updated ``cppyy`` API to ``cppyy_backend 1.14.2``: consistent types for
206 Win64, support for new builtin types
207 - Refactor the intbound analysis in the JIT
208 - Faster ``str.replace`` and ``bytes.replace`` implementations.
209 - Implement ``vmprof`` support for aarch64
210 - Fast path for ``unicode.upper/lower``, ``unicodedb.toupper/lower`` for ascii,
211 latin-1
212 - Add a JIT driver for ``re.split``
213 - Expose ``os.memfd_create`` on Linux for glibc>2.27 (not on portable builds)
214 - Add a shortcut for ``re.sub`` doing zero replacements
215 for things like escaping characters)
216 - Expose the physical size of a list in ``__pypy__.list_get_physical_size``
217 - Clean up the icon bundled with the exe in windows
218 - Add a fast path for ``list[:] = l2``
219 - Update packaged OpenSSL to 1.1.1k
220 - Make ARM builds portable
221
222 C-API (cpyext) and C-extensions
223 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224 - make order of arguments of ``PyDescr_NewGetSet`` consistent with CPython,
225 related to issue 2267_
226 - Fix parsing ``inf`` and friends in ``PyOS_string_to_double`` (issue 3375_)
227 - Fix signature of ``PyEval_EvalCode``
228 - Change parameter type of ``PyModule_New`` to ``const char*``, add
229 ``PyModule_Check`` and ``PyModule_CheckExact``
230 - Add ``PyUnicode_Contains`` (issue 3400_)
231 - Fix ``PyObject_Format`` for type objects (issue 3404_)
232 - Move ``inttypes.h`` into ``pyport.h`` (issue 3407_)
233 - Sync ``Py_.*Flags`` values with ``sys.flags`` (issue 3409_)
234 - Make ``PyUnicode_Check`` a macro, but still export the function from
235 the shared library for backwards compatibility
236
237
238 Python 3.7+
239 -----------
240 - Update the ``re`` module to the Python 3.7 implementation
241 - Fix the ``crypt`` thread lock (issue 3395_) and fix input encoding (issue
242 3378_)
243 - Fixes ``utf_8_decode`` for ``final=False`` (issue 3348_)
244 - Test, fix for ``time.strftime(u'%y\ud800%m', time.localtime(192039127))``
245 - ``CALL_FUNCTION_KW`` with keyword arguments is now much faster, because the
246 data structure storing the arguments can be removed by the JIT
247 - Fix the ``repr`` of subclasses
248 - Better error message for ``object.__init__`` with too many parameters
249 - Fix bug in ``codecs`` where using a function from the parser turns warnings
250 into SyntaxErrors a bit too eagerly
251 - Produce proper deprecation warnings from the compiler, with the right
252 filename and line number
253 - Fixes for circular imports (`bpo 30024`_) and stack usage (`bpo 31286`_)
254 - A type annotated assignment was incorrectly handled in the scoping rules,
255 leading to a crash in complex situations (issue 3355)
256 - Fix a segfault in nonblocking bufferio reads (issue 3172)
257 - Use correct slot for ``sni_callback`` attribute in ``_ssl`` (issue 3359_)
258 - Hang on to ``servername_callback`` handle in ``_ssl`` so it will not be
259 deleted until the context is deleted (issue 3396)
260 - Implement ``set_wakeup_fd(warn_on_full_buffer)`` (issue 3227_)
261 - Round-trip invalid UTF-16 data in ``winreg`` without a ``UnicodeDecodeError``
262 (issue 3342_)
263 - Truncate ``REG_SZ`` at first ``NULL`` in ``winreg`` to match ``reg.exe``
264 behaviour (`bpo 25778`_)
265 - Fix for surrogates in ``winreg`` input value (issue 3345_)
266 - In ``sysconfig``, ``INCLUDEPY`` and ``INCLUDEDIR`` should point to the
267 original directory even in a virtualenv (issue 3364_)
268 - Add ``LDLIBRARY`` to ``sysconfig`` for postgresql
269 - Prevent overflow in ``_hash_long`` on win64 using method from CPython
270 - Raise ``ValueError`` when ``argv[0]`` of ``execv`` and friends is empty (`bpo
271 28732`_)
272 - Allow compiler to inherit flags from ``__future__.annotations`` (issue 3371_)
273 - Provide a PyPy ``BytesBuilder`` alternative to ``io.BytesIO`` in pure-python
274 ``pickle``
275 - Generalize venv to copy all ``*.exe`` and ``*.dll`` for windows
276 - The evaluation order of keys and values of *large* dict literals was wrong in
277 3.7 (in lower versions it was the same way, but in 3.7 the evaluation order
278 of *small* dicts changed), issue 3380_
279 - Cache the imported ``re`` module in ``_sre`` (going through ``__import__`` is
280 unfortunately quite expensive on 3.x)
281 - Mention a repeated keyword argument in the error message
282 - Stop emitting the ``STORE_ANNOTATION`` and ``BINARY_DIVIDE`` bytecodes,
283 update pyc magic number
284 - Fix ``site.py`` to be closer to upstream to enable ``pip install --user`` and
285 ``pip install --local``
286 - No longer call ``eval()`` on content received via HTTP in CJK codec tests (`bpo 41944`_)
287 - Add missing `c_/f_/contiguous` flags on memoryview
288 - Fix ``xml.ElementTree.extend`` not working on iterators (issue 3181_, `bpo 43399`_)
289 - `Python -m` now adds *starting* directory to `sys.path` (`bpo 33053`_)
290 - Reimplement ``heapq.merge()`` using a linked tournament tree (`bpo 38938`_)
291 - Fix shring of cursors in ``sqllite3`` (issues 3351_ and 3403_)
292 - Fix remaining ``sqllite3`` incompatibilities
293 - Fix ``CALL_METHOD_KW`` to not lose the immutability of the keyword name tuple
294
295 Python 3.7 C-API
296 ~~~~~~~~~~~~~~~~
297 - Change ``char *`` to ``const char *`` in ``PyStructSequence_Field``,
298 ``PyStructSequence_Desc``, ``PyGetSetDef``, ``wrapperbase``
299 - Implement ``METH_FASTCALL`` (issue 3357_)
300 - Add ``pystrtod.h`` and expose constants
301 - Clean up some ``char *`` -> ``const char *`` misnaming (issue 3362)
302 - Accept ``NULL`` input to ``PyLong_AsUnsignedLongLongMask``
303 - Add ``PyImport_GetModule`` (issue 3385_)
304 - Converting utf-8 to 1-byte buffers must consider latin-1 encoding (issue `3413`_)
305 - Fix value of ``.__module__`` and ``.__name__`` on the result of
306 ``PyType_FromSpec``
307 - Add missing ``PyFile_FromFd``
308
309 .. _2267: https://foss.heptapod.net/pypy/pypy/-/issues/2267
310 .. _2371: https://foss.heptapod.net/pypy/pypy/-/issues/2371
311 .. _3172: https://foss.heptapod.net/pypy/pypy/-/issues/3172
312 .. _3181: https://foss.heptapod.net/pypy/pypy/-/issues/3181
313 .. _3227: https://foss.heptapod.net/pypy/pypy/-/issues/3227
314 .. _3314: https://foss.heptapod.net/pypy/pypy/-/issues/3314
315 .. _3333: https://foss.heptapod.net/pypy/pypy/-/issues/3333
316 .. _3342: https://foss.heptapod.net/pypy/pypy/-/issues/3342
317 .. _3345: https://foss.heptapod.net/pypy/pypy/-/issues/3345
318 .. _3348: https://foss.heptapod.net/pypy/pypy/-/issues/3348
319 .. _3351: https://foss.heptapod.net/pypy/pypy/-/issues/3351
320 .. _3355: https://foss.heptapod.net/pypy/pypy/-/issues/3355
321 .. _3357: https://foss.heptapod.net/pypy/pypy/-/issues/3357
322 .. _3359: https://foss.heptapod.net/pypy/pypy/-/issues/3359
323 .. _3362: https://foss.heptapod.net/pypy/pypy/-/issues/3362
324 .. _3363: https://foss.heptapod.net/pypy/pypy/-/issues/3363
325 .. _3364: https://foss.heptapod.net/pypy/pypy/-/issues/3364
326 .. _3371: https://foss.heptapod.net/pypy/pypy/-/issues/3371
327 .. _3375: https://foss.heptapod.net/pypy/pypy/-/issues/3375
328 .. _3378: https://foss.heptapod.net/pypy/pypy/-/issues/3378
329 .. _3380: https://foss.heptapod.net/pypy/pypy/-/issues/3380
330 .. _3385: https://foss.heptapod.net/pypy/pypy/-/issues/3385
331 .. _3381: https://foss.heptapod.net/pypy/pypy/-/issues/3381
332 .. _3395: https://foss.heptapod.net/pypy/pypy/-/issues/3395
333 .. _3396: https://foss.heptapod.net/pypy/pypy/-/issues/3396
334 .. _3400: https://foss.heptapod.net/pypy/pypy/-/issues/3400
335 .. _3403: https://foss.heptapod.net/pypy/pypy/-/issues/3403
336 .. _3404: https://foss.heptapod.net/pypy/pypy/-/issues/3404
337 .. _3407: https://foss.heptapod.net/pypy/pypy/-/issues/3407
338 .. _3409: https://foss.heptapod.net/pypy/pypy/-/issues/3409
339 .. _3413: https://foss.heptapod.net/pypy/pypy/-/issues/3413
340
341 .. _`merge request 723`: https://foss.heptapod.net/pypy/pypy/-/merge_request/723
342
343 .. _`bpo 21151`: https://bugs.python.org/issue21151
344 .. _`bpo 25778`: https://bugs.python.org/issue25778
345 .. _`bpo 28732`: https://bugs.python.org/issue28732
346 .. _`bpo 30024`: https://bugs.python.org/issue30024
347 .. _`bpo 31286`: https://bugs.python.org/issue31286
348 .. _`bpo 33053`: https://bugs.python.org/issue33053
349 .. _`bpo 38938`: https://bugs.python.org/issue38938
350 .. _`bpo 40791`: https://bugs.python.org/issue40791
351 .. _`bpo 41944`: https://bugs.python.org/issue41944
352 .. _`bpo 42051`: https://bugs.python.org/issue42051
353 .. _`bpo 42151`: https://bugs.python.org/issue42151
354 .. _`bpo 42967`: https://bugs.python.org/issue42967
355 .. _`bpo 43399`: https://bugs.python.org/issue43399
356
357 .. _HPy: https://hpy.readthedocs.io/en/latest/