Debian Codegraph @

pypy/doc/release-v7.3.18.rst

raw
1 ============================================================================
2 PyPy v7.3.18: release of python 2.7, 3.10 and 3.11 beta, released 2025-02-06
3 ============================================================================
4
5 ..
6 updated to 30e1d327015bf68
7
8 The PyPy team is proud to release version 7.3.18 of PyPy.
9
10 This release includes a python 3.11 interpreter. We are labelling it "beta"
11 because it is the first one. In the next release we will drop 3.10 and remove
12 the "beta" label. There are a particularly large set of bugfixes in this
13 release thanks to @devdanzin using fusil on the 3.10 builds, originally written
14 by Victor Stinner. Other significant changes:
15
16 - We have updated libffi shipped in our portable builds. We also now statically
17 link to libffi where possible which reduces the number of
18 shared object dependencies.
19
20 - We have added code to be able to show the native function names when
21 profiling with VMProf. So far only Linux supports this feature.
22
23 - We have added a `PEP 768`_-inspired remote debugging facility. See
24 :doc:`remotedebugging`.
25
26 - The HPy backend has been updated to latest HPy HEAD
27
28 The release includes three different interpreters:
29
30 - PyPy2.7, which is an interpreter supporting the syntax and the features of
31 Python 2.7 including the stdlib for CPython 2.7.18+ (the ``+`` is for
32 backported security updates)
33
34 - PyPy3.10, which is an interpreter supporting the syntax and the features of
35 Python 3.10, including the stdlib for CPython 3.10.16.
36
37 - PyPy3.11, which is an interpreter supporting the syntax and the features of
38 Python 3.11, including the stdlib for CPython 3.11.11.
39
40 The interpreters are based on much the same codebase, thus the triple
41 release. This is a micro release, all APIs are compatible with the other 7.3
42 releases. It follows after 7.3.17 release on August 28, 2024.
43
44 We recommend updating. You can find links to download the releases here:
45
46 https://pypy.org/download.html
47
48 We would like to thank our donors for the continued support of the PyPy
49 project. If PyPy is not quite good enough for your needs, we are available for
50 `direct consulting`_ work. If PyPy is helping you out, we would love to hear
51 about it and encourage submissions to our blog_ via a pull request
52 to https://github.com/pypy/pypy.org
53
54 We would also like to thank our contributors and encourage new people to join
55 the project. PyPy has many layers and we need help with all of them: bug fixes,
56 `PyPy`_ and `RPython`_ documentation improvements, or general `help`_ with
57 making RPython's JIT even better.
58
59 If you are a python library maintainer and use C-extensions, please consider
60 making a HPy_ / CFFI_ / cppyy_ version of your library that would be performant
61 on PyPy. In any case, both `cibuildwheel`_ and the `multibuild system`_ support
62 building wheels for PyPy.
63
64 .. _`PyPy`: index.html
65 .. _`RPython`: https://rpython.readthedocs.org
66 .. _`help`: project-ideas.html
67 .. _CFFI: https://cffi.readthedocs.io
68 .. _cppyy: https://cppyy.readthedocs.io
69 .. _`multibuild system`: https://github.com/matthew-brett/multibuild
70 .. _`cibuildwheel`: https://github.com/joerick/cibuildwheel
71 .. _blog: https://pypy.org/blog
72 .. _HPy: https://hpyproject.org/
73 .. _direct consulting: https://www.pypy.org/pypy-sponsors.html
74
75
76 VMProf Native Symbol Names
77 ===========================
78
79 When running VMProf profiling with native profiling enabled, PyPy did so far
80 not produce function names for C functions. The output looked like this::
81
82 pypy -m vmprof ~/projects/gitpypy/lib-python/2.7/test/pystone.py
83 Pystone(1.1) time for 50000 passes = 0.0109887
84 This machine benchmarks at 4.55011e+06 pystones/second
85 vmprof output:
86 %: name: location:
87 100.0% entry_point <builtin>/app_main.py:874
88 100.0% run_command_line <builtin>/app_main.py:601
89 100.0% run_toplevel <builtin>/app_main.py:93
90 100.0% _run_module_as_main /home/user/bin/pypy-c-jit-170203-99a72243b541-linux64/lib-python/2.7/runpy.py:150
91 100.0% _run_code /home/user/bin/pypy-c-jit-170203-99a72243b541-linux64/lib-python/2.7/runpy.py:62
92 100.0% <module> /home/user/bin/pypy-c-jit-170203-99a72243b541-linux64/site-packages/vmprof/__main__.py:1
93 100.0% main /home/user/bin/pypy-c-jit-170203-99a72243b541-linux64/site-packages/vmprof/__main__.py:30
94 100.0% run_path /home/user/bin/pypy-c-jit-170203-99a72243b541-linux64/lib-python/2.7/runpy.py:238
95 100.0% _run_module_code /home/user/bin/pypy-c-jit-170203-99a72243b541-linux64/lib-python/2.7/runpy.py:75
96 100.0% <module> /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:3
97 100.0% main /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:60
98 100.0% pystones /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:67
99 100.0% Proc0 /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:79
100 76.9% <unknown code>
101 69.2% <unknown code>
102 53.8% <unknown code>
103 53.8% <unknown code>
104 46.2% <unknown code>
105 46.2% <unknown code>
106 38.5% <unknown code>
107 38.5% Proc8 /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:212
108 30.8% <unknown code>
109 ...
110
111 We can now symbolify these C functions and give function names and which
112 shared library they come from, at least on Linux::
113
114 Pystone(1.1) time for 50000 passes = 0.218967
115 This machine benchmarks at 228345 pystones/second
116 vmprof output:
117 %: name: location:
118 100.0% entry_point <builtin>/app_main.py:889
119 100.0% run_command_line <builtin>/app_main.py:616
120 100.0% run_toplevel <builtin>/app_main.py:95
121 100.0% _run_module_as_main /home/user/projects/gitpypy/lib-python/2.7/runpy.py:150
122 100.0% _run_code /home/user/projects/gitpypy/lib-python/2.7/runpy.py:62
123 100.0% <module> /home/user/projects/gitpypy/site-packages/vmprof/__main__.py:1
124 100.0% main /home/user/projects/gitpypy/site-packages/vmprof/__main__.py:30
125 100.0% run_module /home/user/projects/gitpypy/lib-python/2.7/runpy.py:179
126 100.0% _run_module_code /home/user/projects/gitpypy/lib-python/2.7/runpy.py:75
127 100.0% <module> /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:3
128 100.0% main /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:60
129 100.0% pystones /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:67
130 100.0% Proc0 /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:79
131 95.5% n:pypy_g_execute_frame:0:pypy-c
132 91.4% n:pypy_g_PyFrame_dispatch:0:pypy-c
133 63.8% n:pypy_g_PyFrame_dispatch_bytecode:0:pypy-c
134 49.8% Proc1 /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:137
135 17.6% copy /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:53
136 13.6% n:pypy_g_PyFrame_CALL_FUNCTION:0:pypy-c
137 10.4% Proc8 /home/user/projects/gitpypy/lib-python/2.7/test/pystone.py:212
138 8.6% n:pypy_g_STORE_ATTR_slowpath:0:pypy-c
139
140 This becomes even more useful when using the `VMProf Firefox converter`_, which
141 uses the Firefox Profiler Web UI to visualize profiling output:
142
143 .. image:: image/2025-vmprof-firefox.png
144
145 .. _`VMProf Firefox converter`: https://github.com/Cskorpion/vmprof-firefox-converter/
146
147
148
149
150 What is PyPy?
151 =============
152
153 PyPy is a Python interpreter, a drop-in replacement for CPython
154 It's fast (`PyPy and CPython`_ performance
155 comparison) due to its integrated tracing JIT compiler.
156
157 We also welcome developers of other `dynamic languages`_ to see what RPython
158 can do for them.
159
160 We provide binary builds for:
161
162 * **x86** machines on most common operating systems
163 (Linux 32/64 bits, Mac OS 64 bits, Windows 64 bits)
164
165 * 64-bit **ARM** machines running Linux (``aarch64``) and macos (``macos_arm64``).
166
167 PyPy supports Windows 32-bit, Linux PPC64 big- and little-endian, Linux ARM
168 32 bit, RISC-V RV64IMAFD Linux, and s390x Linux but does not release binaries.
169 Please reach out to us if you wish to sponsor binary releases for those
170 platforms. Downstream packagers provide binary builds for debian, Fedora,
171 conda, OpenBSD, FreeBSD, Gentoo, and more.
172
173 .. _`PyPy and CPython`: https://speed.pypy.org
174 .. _`dynamic languages`: https://rpython.readthedocs.io/en/latest/examples.html
175
176 Changelog
177 =========
178
179 For all versions
180 ----------------
181 - Update cffi backend to 1.18.0-dev
182 - Refactor use of Python2 unicode in rpython to use only utf-8. This affects
183 windows calls to ``rposix`` routines. Now all the system calls on windows
184 should use the ``FunctionW`` variants instead of the ``FunctionA`` ones.
185 - Update to vmprof-0.4.17
186 - Update vmprof native profiling to show more native symbols
187 - Implement `PEP 768`_-inspired remote debugging facility. See
188 :doc:`remotedebugging`.
189 - Add many more int optimization rules.
190 - Bump ``macosx-version-min`` to 10.13 on 2.7 to match 3.10, 3.11
191
192 Bugfixes
193 ~~~~~~~~
194 - Make sure that tracing tail-recursive infinite recursion ends (:issue:`5021`)
195 - Revive ``tools/gcdump.py`` which uses ``PYPYLOG``
196 - Fix ``socket.socket.sendto`` for ``AF_PACKET`` protocol (:issue:`5024`)
197 - Fix ``inf``/``nan`` formatting with thousands separator (:issue:`5018`)
198 - Fixup int/long confusion on 32-bit builds
199 - Fix the ``gc.get_stats`` output to not show incorrect numbers (:issue:`5005`)
200 - Use simple interactive console if ``stdin`` is closed (:issue:`2981`)
201 - Use ``HOMEBREW_CELLAR`` to find ``tcl`` library on macOS (:issue:`5096`)
202 - Don't segfault in unicodedb when looking up invalid codepoints (:issue:`5113`)
203 - Fix segfault in ``pyexpat`` (:issue:`5112`)
204 - Guard against list mutation in the list ``repr`` (:issue:`5117`)
205 - Check input for divide-by-zero in ``__pypy__.intops`` (:issue:`5129`)
206 - Check input for valid c in ``mulmod(a, b, c)``, ``mod``, and ``floordiv``
207 (:issue:`5128`)
208
209 Speedups and enhancements
210 ~~~~~~~~~~~~~~~~~~~~~~~~~
211 - Make the opencoder encoding support varsized ints. This shrinks the memory
212 usage of the JIT and is supposed to support really long trace limits without
213 recompiling pypy
214 - Implement a ``try_cast_erased`` function in RPython
215 - Copy CPython's ``threading`` implementation for windows
216 - Only use ``largefile`` glibc interfaces on 32-bit build (:issue:`5071`)
217 - Add a DSL for integer optimizations, use it to create some optimizations, see the blogpost_
218 - Optimize overflowing ``int*int`` multiplication that produces a ``long`` result
219 - Resolve names of native functions in vmprof (:issue:`5114`)
220 - Make internal streamio ``replace_crlf_with_lf`` do only one copy, not two
221 since we often read programmatically generated python code.
222 - Avoid keeping refs on the frame stack when calling functions
223 - Fix ``reverse`` JIT unrolling, which was done too eagerly
224 - Write ``abs(int)`` in a branch-free way, producing fewer JIT traces
225 - On windows, use ``wchar_t`` for ``main(..., argv)``. Solves long standing
226 issue around calling ``pypy.exe <unicode-named-file>.py``
227 - Fix cffi backend for struct-in-a-struct (:issue:`python-cffi/cffi#147`)
228 - Make ``str.format`` somewhat more jit friendly
229 - Use ``BCryptGenRandom`` on windows in ``rurandom`` (:issue:`5039`)
230 - If mode is 0700 in ``mkdir`` on windows, restrict the directory to
231 the current user
232 - Add support for unicode version 14 to RPython
233
234
235 .. _blogpost: https://pypy.org/posts/2024/10/jit-peephole-dsl.html
236 .. _`PEP 768`: https://peps.python.org/pep-0768/
237
238 Python 3.10
239 -----------
240
241 Bugfixes
242 ~~~~~~~~
243 - Sync ``Python.h`` with upstream, add ``import.h`` (:issue:`5013`)
244 - Prefer static sysconfigdata if it exists and do not create static
245 sysconfigdata on portable builds (:issue:`5015`)
246 - Fix python2-isms in ``complex``, in both str and format
247 - Do not segfault in ``reversed.__setstate__`` (:issue:`5029`)
248 - Fix weird edge case where a ``index`` of a ``memoryview`` releases the
249 underlying buffer
250 - Fix ``_ssl.read`` when ``get_shutdown`` is true, should no longer error
251 - Always initialize locale by calling ``setlocale(LC_CTYPE, '')``
252 - Fix when metaclass ``__new__`` has extra args
253 - Fix ``venv`` when src is a source build
254 - Also create python.exe and python3.exe when creating a venv in a source build
255 on windows
256 - Sync ``'user_base'`` between ``site.py`` and ``sysconfig.py`` on windows
257 (:issue:`5073`)
258 - Allow unterminated string error to propagate in the tokenizer (:issue:`5076`)
259 - Fix subtle problem with ``Py_SIZE(PyListObject)`` since it assumes
260 ``PyListObject`` is a ``PyVarObject``.
261 - Fix race in ``Thread.join()`` (:issue:`5080`) and ``threadpool`` stopping (:issue:`4994`)
262 - Fix logic in packaging ``tklib`` for darwin (:issue:`5082`)
263 - Fix an infinite loop in the jump threading optimization in the bytecode
264 compiler (:issue:`5090`)
265 - Make ``__doc__`` a proper descr on methods
266 - Limit ``_string.formatter*`` functions to reject ``bytes`` (:issue:`5111`)
267 - Remove internal calls of ``utf8(bytes)``, fix error handler, add test
268 (:issue:`5110`, :issue:`5111`)
269 - Make ``linecache.checkcache`` more resilient in the presence of ``__del__`` and multithreading (:issue:`5109`)
270 - Remove extraneous exports from ``_dbm.__all__`` (:issue:`5115`)
271 - Add missing ``_ensure_initialized`` in ``_curses.putp`` (:issue:`5116`)
272 - Check ``self.ssl`` for pathological use of ``_ssl`` (:issue:`5124`)
273 - Use ``os.fsencode`` for ``dbm.*.open`` (:issue:`5115`)
274 - Check for NULL ssl certificate (:issue:`5120`)
275 - Check before calling ``_dealloc_warn_w`` (:issue:`5123`)
276 - Fix ``_curses`` tests and hide ``_mk_acs`` (:issue:`5122`)
277 - Use ``pkg-config`` for cffi ``_tkinter``, fix tk/tcl_path for portable
278 builds (:issue:`5064`, :issue:`5096`)
279 - Test, fix infinite recursion when creating a ``pyobj`` from ``w_obj`` when
280 the ``pyobj`` is a list subtype that overrides ``__len__`` in c
281 - Be more careful in the order of ``StringIO.__init__`` since decoding can fail
282 (:issue:`5126`)
283 - Refactor hashlib ``_keccak_init`` to be a regular class method (:issue:`5127`)
284 - Fix ``list.pop`` and ``list.insert`` to use ``__index__``
285 - Check code validity in ``_pickle_support.builtin_code`` (:issue:`5130`)
286 - Check for bad result when calling ``nl_langinfo`` (:issue:`5132`)
287 - Backport CPython fix to not write incomplete pyc files
288 (:issue:`python/cpython#126606`)
289 - Do not initialize values if stringio newline is wrong (:issue:`5140`)
290 - Initialize buffer view ``readonly`` flag properly (:issue:`5136`)
291 - Only increment ``pos`` in ``PyDict_Next`` after checking len (:issue:`5142`)
292 - In builtin ``hex(x)``, ``oct(x)``, ``bin(x)``, use ``int.__format__`` not
293 ``x.__format__``
294 - Invalidate the method cache in the presence of overridden mros (:issue:`5149`)
295 - Fix new failure in ``lib-python/3/test/test_descr`` when ``mro()`` sets
296 ``__bases__``
297 - Avoid segfault when creating memoryview of ctypes array with 0 shape
298 (:issue:`5156`)
299 - Fix signature of ``sendfunc``
300 - Backport the CPython fixes to ``pyrepl`` to PyPy (:issue:`4990`)
301 - Fix ``win32console._write`` return value (:issue: `5139`)
302 - Backport changes to ``site.py`` from CPython3.13 to get pyrepl's
303 ``PYTHON_HISTORY`` working
304
305 Speedups and enhancements
306 ~~~~~~~~~~~~~~~~~~~~~~~~~
307 - Move ``_remove_dead_weakref`` to the _weakref module (:issue:`5068`)
308 - Make ``unicodedata.normalize`` O(1) for ascii strings (:issue:`5052`)
309 - Add ``PyContextVar_Reset``, ``Py_FatalError`` (:issue:`5081`) (:issue:`5086`)
310 - Make ``Py_FatalError`` a macro that adds the current function name, like
311 CPython
312 - Many error message tweaks for test compliance with CPython
313 - Make unmarshaling use ``unrolling_iterable`` instead of a function ptr table,
314 which should speed it up slightly.
315 - Add ``_ssl.keylog_filename`` which is useful for debugging ssl problems
316 (:issue:`5141`)
317 - Allocate less when using ``PyErr_NoMemory`` to raise an error rather than
318 segfault
319 - Add docstrings to tupleobject
320 - Add audit events to ``syslog`` and ``_sqlite3``