Commit Graph

112936 Commits

Author SHA1 Message Date
Tobias Stoeckmann 0859368335
gh-91421: Use constant value check during runtime (GH-91422)
The left-hand side expression of the if-check can be converted to a
constant by the compiler, but the addition on the right-hand side is
performed during runtime.

Move the addition from the right-hand side to the left-hand side by
turning it into a subtraction there. Since the values are known to
be large enough to not turn negative, this is a safe operation.

Prevents a very unlikely integer overflow on 32 bit systems.

Fixes GH-91421.
2022-04-12 20:01:02 -07:00
Jelle Zijlstra ac6c3de03c
gh-91243: Add typing.Required and NotRequired (PEP 655) (GH-32419)
I talked to @davidfstr and I offered to implement the runtime part of PEP 655
to make sure we can get it in before the feature freeze. We're going to defer
the documentation to a separate PR, because it can wait until after the feature
freeze.

The runtime implementation conveniently already exists in typing-extensions,
so I largely copied that.

Co-authored-by: David Foster <david@dafoster.net>
2022-04-12 12:31:02 -07:00
Serhiy Storchaka 474fdbe9e4
bpo-47152: Automatically regenerate sre_constants.h (GH-91439)
* Move the code for generating Modules/_sre/sre_constants.h from
  Lib/re/_constants.py into a separate script
  Tools/scripts/generate_sre_constants.py.
* Add target `regen-sre` in the makefile.
* Make target `regen-all` depending on `regen-sre`.
2022-04-12 18:34:06 +03:00
Ilya Leoshkevich 943ca5e1d6
gh-90839: Forward gzip.compress() compresslevel to zlib (gh-31215) 2022-04-12 22:46:40 +09:00
Irit Katriel e44f988b26
gh-91276: make space for longer opcodes in dis output (GH-91444) 2022-04-12 14:35:56 +01:00
Jack DeVries f33e2c87a8
gh-88513: clarify shutil.copytree's dirs_exist_ok arg (GH-91434)
* add a paragraph to document this kwarg in detail
* update docstring in the source accordingly
2022-04-11 17:57:52 -07:00
Erlend Egeberg Aasland 9ebcece82f
gh-79097: Add support for aggregate window functions in sqlite3 (GH-20903) 2022-04-11 17:55:59 -07:00
Brett Cannon f45aa8f304
gh-91217: deprecate crypt (GH-91459) 2022-04-11 17:02:19 -07:00
Dennis Sweeney 8a35ce3796
gh-91428: Add _PyOpcode_OpName to opcode.h of debug builds (GH-91430) 2022-04-11 18:33:00 -04:00
Brett Cannon 3869a839d5
gh-47061: Deprecate `chunk` (GH-91419) 2022-04-11 15:02:41 -07:00
Dennis Sweeney 8be8949116
gh-91117: Ensure integer mod and pow operations use cached small ints (GH-31843) 2022-04-11 16:07:09 -04:00
Oleg Iarygin a8abb76af9
Remove dead "Check PRs with 'CLA not signed' label" (#91429) 2022-04-11 18:34:17 +02:00
Ezio Melotti 08cfe07950
Update Sphinx bpo role to use redirect URI. (#32342) 2022-04-11 17:59:35 +02:00
roy reznik df81d2892e
gh-91423: Remove bugs.python.org from bugs.rst (GH-91425)
* Remove bugs.python.org from bugs.rst

* Update bugs.rst to the github issue tracker

* reflow

* Fix a typo and rephrase a sentence.

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-04-11 17:10:34 +02:00
Mark Shannon f6e43e834c
GH-89480: Document motivation, design and implementation of 3.11 frame stack. (GH-32304) 2022-04-11 16:05:20 +01:00
Adrian Garcia Badaracco 5f2abae61e
bpo-44807: Allow Protocol classes to define __init__ (GH-31628)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-11 07:51:25 -07:00
John Belmonte b0b836b20c
bpo-45995: add "z" format specifer to coerce negative 0 to zero (GH-30049)
Add "z" format specifier to coerce negative 0 to zero.

See https://github.com/python/cpython/issues/90153 (originally https://bugs.python.org/issue45995) for discussion.
This covers `str.format()` and f-strings.  Old-style string interpolation is not supported.

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-04-11 15:34:18 +01:00
Irit Katriel dd207a6ac5
bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative (GH-32400) 2022-04-11 10:40:24 +01:00
Oleg Iarygin 98ff4a6877
Replace contributor-visible mentions of BPO in .github/* (GH-91426) 2022-04-11 00:03:27 +02:00
Łukasz Langa 672e7de911
Remove linking to bugs.python.org from the README (#91418)
Fixes #91424.
2022-04-10 22:50:18 +02:00
Ezio Melotti bcda3f1645
Remove the issue template config after the migration (GH-32106) 2022-04-10 21:13:33 +02:00
Ee Durbin 9263c8691c
notify new-bugs-announce on new issue open (#32421) 2022-04-10 19:48:53 +02:00
Christian Heimes defbbd68f7
bpo-40280: WASM docs and smaller browser builds (GH-32412)
Co-authored-by: Brett Cannon <brett@python.org>
2022-04-10 09:29:51 +02:00
Ville Skyttä dc14e33eff
bpo-22295: use python -m pip rather than plain pip in more examples (GH-24003) 2022-04-09 14:37:01 -04:00
jonasdlindner f52d987abf
Fix some typos in comments (GH-32422) 2022-04-09 18:12:15 +09:00
Inada Naoki 6773203487
bpo-47000: Add `locale.getencoding()` (GH-32068) 2022-04-09 09:54:54 +09:00
Brett Cannon cd29bd13ef
bpo-47061: deprecate cgi and cgitb (GH-32410)
Part of PEP 594.
2022-04-08 17:15:35 -07:00
Alexey Izbyshev 1c8b3b5d66
bpo-47260: Fix os.closerange() potentially being a no-op in a seccomp sandbox (GH-32418)
_Py_closerange() currently assumes that close_range() closes
all file descriptors even if it returns an error (other than ENOSYS).
This assumption can be wrong on Linux if a seccomp sandbox denies
the underlying syscall, pretending that it returns EPERM or EACCES.
In this case _Py_closerange() won't close any descriptors at all,
which in the worst case can be a security issue.

Fix this by falling back to other methods in case of any close_range()
error. Note that fallbacks will not be triggered on any problems with
closing individual file descriptors because close_range() is documented
to ignore such errors on both Linux[1] and FreeBSD[2].

[1] https://man7.org/linux/man-pages/man2/close_range.2.html
[2] https://www.freebsd.org/cgi/man.cgi?query=close_range&sektion=2
2022-04-08 10:40:39 -07:00
Raymond Hettinger d6fb104690
Fix bad grammar and import docstring for split/rsplit (GH-32381) 2022-04-08 08:36:20 -05:00
Petr Viktorin 1c2fddddae
Add feature macro PY_HAVE_THREAD_NATIVE_ID to the stable ABI definition (GH-32365) 2022-04-08 14:35:11 +02:00
Mark Shannon 5b4a4b6f09
Add new PyFrame_GetLasti C-API function (GH-32413) 2022-04-08 12:18:57 +01:00
Raymond Hettinger f4b328e2bb
Clarify that this sentence applies to the above example. GH-32405 2022-04-07 21:10:00 -05:00
Dong-hee Na e2d78baed3
bpo-47250: Fix refleak from object.__getstate__() (GH-32403)
Co-authored-by: Brandt Bucher <brandt@python.org>
2022-04-08 08:27:00 +09:00
Brandt Bucher ef6a482b02
bpo-47177: Replace `f_lasti` with `prev_instr` (GH-32208) 2022-04-07 12:31:01 -07:00
Brett Cannon 87eec70d97
Deprecate audioop (GH-32392) 2022-04-07 12:27:35 -07:00
CAM Gerlach 1df4298b62
Doc: Fix spurious comma in the author metadata field (GH-32386)
Signed-off-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-04-07 14:27:14 -04:00
Frederick 9ee2d3a939
ssl docs: Fix typo (GH-32336) 2022-04-07 09:29:23 -07:00
Jelle Zijlstra 4c92427fb8
c-api docs: There are five fields, not four (GH-32379) 2022-04-07 07:02:54 -07:00
Christian Heimes 2b16a08bc7
bpo-40280: Detect missing threading on WASM platforms (GH-32352)
Co-authored-by: Brett Cannon <brett@python.org>
2022-04-07 09:22:47 +02:00
Raymond Hettinger 5aee46b31b
Remove micro-optimization that no longer shows a benefit. (GH-32397) 2022-04-06 22:00:47 -05:00
Géry Ogam 1d0f08fa46
pickle docs: Fix typos and improve wording (GH-24776)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-06 18:38:35 -07:00
Eric Wieser b786d9ec52
doc: Link to `string.capwords` from `str.title` (GH-20913)
Since `title()` mentions its own short-comings, it should also mention the library function which does not possess them.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-06 18:31:39 -07:00
Frederick 1da9c38fd3
ssl docs: Fix typo (GH-32314) 2022-04-06 17:51:35 -07:00
Boris Verkhovskiy 63bd72448a
pkgutil docs: Link sys constants, add backticks (GH-32356)
Co-authored-by: Éric <merwok@netwok.org>
2022-04-06 17:51:05 -07:00
Victor Stinner 85addfb9c6
bpo-35134: Remove the Include/code.h header file (GH-32385)
Remove the Include/code.h header file. C extensions should only
include the main <Python.h> header file.

Python.h includes directly Include/cpython/code.h instead.
2022-04-07 02:29:52 +02:00
Victor Stinner 5c4d1f6e0e
bpo-35134: Add Include/cpython/setobject.h header (GH-32384) 2022-04-07 01:26:24 +02:00
Steve Dower 2390b2236d
bpo-47239: Fixes py.exe output when run in a virtual environment. (GH-32364) 2022-04-07 00:09:54 +01:00
Victor Stinner ca219f6dfc
bpo-35134: Add Include/cpython/complexobject.h header (GH-32383)
Move the private _PyComplex_FormatAdvancedWriter() function to the
internal C API. This function is no longer exported.
2022-04-07 01:05:27 +02:00
Jeremy Kloth 612e422c6e
bpo-46576: Speed up test_peg_generator by using a static library for shared sources (GH-32338)
Speed up test_peg_generator by using a static library for shared sources to avoid recompiling as much code.
2022-04-06 14:55:58 -07:00
Raymond Hettinger 1ba82d4419
Change parameter name from *x* for reals to *n* for integers. (GH-32377) 2022-04-06 14:35:05 -05:00