Commit Graph

26494 Commits

Author SHA1 Message Date
Inada Naoki f9c9354a7a
gh-92536: PEP 623: Remove wstr and legacy APIs from Unicode (GH-92537) 2022-05-12 14:48:38 +09:00
Raymond Hettinger 68fec31364
gh-86388 Remove deprecated behaviors in randrange() (#92677) 2022-05-11 23:54:51 -05:00
Victor Stinner da5727a120
gh-92651: Remove the Include/token.h header file (#92652)
Remove the token.h header file. There was never any public tokenizer
C API. The token.h header file was only designed to be used by Python
internals.

Move Include/token.h to Include/internal/pycore_token.h. Including
this header file now requires that the Py_BUILD_CORE macro is
defined. It no longer checks for the Py_LIMITED_API macro.

Rename functions:

* PyToken_OneChar() => _PyToken_OneChar()
* PyToken_TwoChars() => _PyToken_TwoChars()
* PyToken_ThreeChars() => _PyToken_ThreeChars()
2022-05-11 23:22:50 +02:00
狂男风 b69297ea23
bpo-42627: Fix incorrect parsing of Windows registry proxy settings (GH-26307) 2022-05-11 19:17:17 +01:00
Serhiy Storchaka 707839b0fe
gh-91810: ElementTree: Use text file's encoding by default in XML declaration (GH-91903)
ElementTree method write() and function tostring() now use the text file's
encoding ("UTF-8" if not available) instead of locale encoding in XML
declaration when encoding="unicode" is specified.
2022-05-11 09:31:07 +03:00
Serhiy Storchaka 87f849c775
gh-92550: Fix pathlib.Path.rglob() for empty pattern (GH-92604) 2022-05-11 07:43:04 +03:00
Serhiy Storchaka b1c4368824
Revert "gh-92550 - Fix regression in `pathlib.Path.rglob()` (GH-92583)" (GH-92598)
This reverts commit dcdf250d2d.
2022-05-11 07:14:25 +03:00
Bar Harel 30a43586f0
bpo-39264: Fix UserDict.get() to account for __missing__() (GH-17910)
Here's the patch according to the discussion at the [Python-Dev mailing list](https://mail.python.org/archives/list/python-dev@python.org/thread/SDXOEMAEM6KQ3CQCJVBVRT5QNSPAVU6X/).
UserDict.get() will match dict's behavior and not call `__missing__`.

Automerge-Triggered-By: GH:rhettinger
2022-05-10 14:23:45 -07:00
Jürgen Gmach fe1c5ba608
bpo-43689: improve documentation for Differ (GH-25132)
Lines beginning with ``?`` try to help understanding the given diff.

The output can be hard to understand when it contains whitespace characters, such as spaces, tabs or line breaks.

While previously only tabs were mentioned, now all are listed.

Automerge-Triggered-By: GH:rhettinger
2022-05-10 13:57:12 -07:00
Gregory P. Smith 07b34926d3
gh-84131: Remove the deprecated pathlib.Path.link_to method. (#92505)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
2022-05-10 12:31:41 -07:00
Irit Katriel 7c6b7ade8d
gh-92619: Fix bug where the compiler duplicates exit blocks unnecessarily (GH-92620) 2022-05-10 13:36:08 +01:00
Cheryl Sabella c56e2bb994
bpo-13553: Document tkinter.Tk args (#4786) 2022-05-09 20:49:00 -07:00
Barney Gale dcdf250d2d
gh-92550 - Fix regression in `pathlib.Path.rglob()` (GH-92583)
We could try to remedy this by taking a slice, but we then run into an issue where the empty string will match altsep on POSIX. That rabbit hole could keep getting deeper.

A proper fix for the original issue involves making pathlib's path normalisation more configurable - in this case we want to retain trailing slashes, but in other we might want to preserve `./` prefixes, or elide `../` segments when we're sure we won't encounter symlinks.

This reverts commit ea2f5bcda1.
2022-05-09 17:12:16 -07:00
Gregory P. Smith 6ed7c353b8
gh-88750: Remove the PYTHONTHREADDEBUG env var support. (#92509)
Remove the `PYTHONTHREADDEBUG` env var support.
Remove no-op dprintf() macro calls.
2022-05-09 16:03:46 -07:00
Mariusz Felisiak 22bddc864d
bpo-46907: Update Windows installer to SQLite 3.38.4. (#92322) 2022-05-09 23:37:01 +02:00
Raymond Hettinger e01eeb7b4b
Fix inconsistent return type for statistics median_grouped() gh-92531 (#92533) 2022-05-09 02:08:41 -05:00
Ma Lin 5bc2390229
bpo-38056: overhaul Error Handlers section in codecs documentation (#15732)
* Some handlers were wrongly described as text-encoding only, but actually they can also be used in text-decoding.
* Add more description to each handler.
* Add two REPL examples.
* Add indexes for Error Handler's name.

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-08 19:58:55 -07:00
David CARLIER 9d85aba9e2
gh-91968: Add socket constants SO_USER_COOKIE/SO_RTABLE from BSD (#91967)
Those are somewhat equivalent to Linux' SO_MARK.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-08 16:19:41 -07:00
Gregory P. Smith ebb37fc3fd
gh-90622: Do not spawn ProcessPool workers on demand via fork method. (#91598)
Do not spawn ProcessPool workers on demand when they spawn via fork.

This avoids potential deadlocks in the child processes due to forking from
a multithreaded process.
2022-05-08 09:20:34 -07:00
Serhiy Storchaka a84a56d80f
gh-91760: More strict rules for numerical group references and group names in RE (GH-91792)
Only sequence of ASCII digits is now accepted as a numerical reference.
The group name in bytes patterns and replacement strings can now only
contain ASCII letters and digits and underscore.
2022-05-08 19:19:29 +03:00
Serhiy Storchaka 086c6b1b0f
bpo-45046: Support context managers in unittest (GH-28045)
Add methods enterContext() and enterClassContext() in TestCase.
Add method enterAsyncContext() in IsolatedAsyncioTestCase.
Add function enterModuleContext().
2022-05-08 17:49:09 +03:00
Marc Mueller 5ed5c56123
Add __class_getitem__ to csv.DictReader and csv.DictWriter (#92393) 2022-05-08 07:24:54 -07:00
Matthew Rahtz 4739997e14
gh-92261: Disallow iteration of Union (and other special forms) (GH-92262) 2022-05-08 16:21:28 +03:00
Dong-hee Na 45e1721d10
gh-92448: Update the documentation builder to render the GitHub issue. (GH-92449) 2022-05-08 21:50:40 +09:00
Pablo Galindo 0e5fe7f9e9
Python 3.11.0b1 2022-05-06 23:53:50 +01:00
Brandt Bucher 3f61db4756
gh-90997: Move `CACHE` handling into `_unpack_opargs` (#92409)
* Move CACHE handling into _unpack_opargs

* Remove auto-added import

* blurb add
2022-05-06 18:57:08 +01:00
larryhastings 5021064390
gh-92203: Add closure support to exec(). (#92204)
Add a closure keyword-only parameter to exec(). It can only be specified when exec-ing a code object that uses free variables. When specified, it must be a tuple, with exactly the number of cell variables referenced by the code object. closure has a default value of None, and it must be None if the code object doesn't refer to any free variables.
2022-05-06 10:09:35 -07:00
Brandt Bucher 93a666b5a5
gh-90997: Show cached inline values in `dis` output (#92360) 2022-05-06 15:18:09 +01:00
Serhiy Storchaka 15dbe8570f
gh-91827: Add method info_pathlevel() in tkinter (GH-91829) 2022-05-06 13:50:38 +03:00
Alex Waygood 6f18b86fda
gh-92332: Docs-only deprecation of `typing.Text` (GH-92351)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-05-06 18:15:18 +08:00
Raymond Hettinger ebaf0945f9
GH-89519: Deprecate classmethod descriptor chaining (#92379) 2022-05-06 02:57:53 -05:00
Ethan Furman 93364f9716
gh-78157: [Enum] nested classes will not be members in 3.13 (GH-92366)
- add member() and nonmember() functions
- add deprecation warning for internal classes in enums not
  becoming members in 3.13

Co-authored-by: edwardcwang
2022-05-06 00:16:22 -07:00
Gregory P. Smith fa4f0a134e
gh-90622: Prevent max_tasks_per_child use with a fork mp_context. (#91587)
Prevent `max_tasks_per_child` use with a "fork" mp_context to avoid deadlocks.

Also defaults to "spawn" when no mp_context is supplied for safe convenience.
2022-05-06 00:04:53 -07:00
Inada Naoki 2b563f1ad3
gh-87901: Add encoding to os.popen (GH-92374) 2022-05-06 14:48:36 +09:00
Mariusz Felisiak 926854e858
bpo-46907: Update macOS installer to SQLite 3.38.4. (GH-32148) 2022-05-06 00:59:32 -04:00
Inada Naoki 9b491ae04c
NEWS: Reorder items by section (GH-92373)
They caused duplicated sections.
2022-05-06 13:58:58 +09:00
Alexey Izbyshev 85354ed78c
gh-92112: Fix crash triggered by an evil custom `mro()` (#92113) 2022-05-05 21:01:15 -07:00
Michael Droettboom adcb6a6055
gh-92356: Fix regression in ctypes function call overhead (#92357)
38f331d introduced a delayed initialization routine to set up
ctypes formattable (`_ctypes_init_fielddesc`), but inadvertently
removed setting the `initialization` flag to 1 to avoid initting
each time.
2022-05-05 20:59:45 -07:00
Victor Stinner 299692afd8
gh-88279: Deprecate PySys_SetArgvEx() (#92363)
Deprecate the following C functions:

* PySys_SetArgv()
* PySys_SetArgvEx()
* PySys_SetPath()
2022-05-06 05:24:29 +02:00
Paul Ganssle 1303f8c927
gh-80010: Expand fromisoformat to include most of ISO-8601 (#92177)
This expands `fromisoformat` to cover most of the common uses of ISO 8601. We may expand the scope more in the future.
2022-05-05 18:31:24 -06:00
Victor Stinner ada8b6d1b1
gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)
Add the -P command line option and the PYTHONSAFEPATH environment
variable to not prepend a potentially unsafe path to sys.path.

* Add sys.flags.safe_path flag.
* Add PyConfig.safe_path member.
* Programs/_bootstrap_python.c uses config.safe_path=0.
* Update subprocess._optim_args_from_interpreter_flags() to handle
  the -P command line option.
* Modules/getpath.py sets safe_path to 1 if a "._pth" file is
  present.
2022-05-06 01:34:11 +02:00
Gregory P. Smith f6dd14c653
gh-82616: Add process_group support to subprocess.Popen (#23930)
One more thing that can help prevent people from using `preexec_fn`.

Also adds conditional skips to two tests exposing ASAN flakiness on the Ubuntu 20.04 Address Sanitizer Github CI system. When that build is run on more modern systems the "problem" does not show up. It seems ASAN implementation related.

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-05 16:22:32 -07:00
cibofo 9a0a7b4868
gh-91996: Add an HTTPMethod StrEnum to http (GH-91997)
* Add HTTPMethod enum to http

Create a StrEnum for the 9 common HTTP methods.

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2022-05-05 15:39:02 -07:00
Christian Heimes 8122e8d501
gh-92345: Import rlcompleter before sys.path is extended (#92346)
``pymain_run_python()`` now imports ``readline`` and ``rlcompleter``
before sys.path is extended to include the current working directory of
an interactive interpreter. Non-interactive interpreters are not
affected.

Also move imports of ``re`` and ``keyword`` module to top level so they
are materialized early, too. The ``keyword`` module is trivial and the
``re`` is already imported via ``inspect`` -> ``linecache``.
2022-05-05 21:24:16 +02:00
Alexey Izbyshev 58573ffba0
gh-92301: subprocess: Prefer close_range() to procfs-based fd closing (#92303)
#92301: subprocess: Prefer `close_range()` to procfs-based fd closing.

`close_range()` is much faster for large number of file descriptors, e.g.
4 times faster for 1000 descriptors in a Linux 5.16-based environment.

We prefer close_range() only if it's known to be async-signal-safe.
2022-05-05 09:46:19 -07:00
Soumendra Ganguly ae553b3561
bpo-41818: Add os.login_tty() for *nix. (#29658)
* Add `os.login_tty(fd)` for Unix.

Reviewed-by: Christian Heimes <christian@python.org>
Signed-off-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2022-05-05 09:04:44 -07:00
Vlad Hoi 42fee931d0
bpo-43827: Make arguments to abc.ABCMeta.__new__ pos-only (#25385)
To avoid conflicts with `__init__subclass__`.
2022-05-05 06:40:01 -07:00
Géry Ogam a95138b2c5
bpo-43857: Improve the AttributeError message when deleting a missing attribute (#25424)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-05 06:37:26 -07:00
Michael J. Sullivan a918589578
bpo-46764: Fix wrapping bound method with @classmethod (#31367) 2022-05-04 23:00:21 -05:00
Irit Katriel e61330b44f
gh-92118: fix traceback of exceptions propagated from inside a contextlib.contextmanager (GH-92202) 2022-05-04 19:40:47 +01:00
Mark Shannon f8a2fab212
GH-92239: Make sure that PEP 523 is supported, even when specializing first. (GH-92245) 2022-05-04 09:31:21 -06:00
Joshua Herman 000a072318
gh-92210: Move socket.__init__ to argument clinic (#92237)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-04 07:38:01 -06:00
Erlend Egeberg Aasland 090819ec5f
gh-89022: Improve sqlite3 exceptions related to binding params and API misuse (#91572)
* Map SQLITE_MISUSE to sqlite3.InterfaceError

SQLITE_MISUSE implies misuse of the SQLite C API, which, if it happens,
is _not_ a user error; it is an sqlite3 extension module error.

* Raise better errors when binding parameters fail.

Instead of always raising InterfaceError, guessing what went wrong,
raise accurate exceptions with more accurate error messages.
2022-05-04 07:16:01 -06:00
Victor Stinner 14243369b5
gh-92036: Fix gc_fini_untrack() (#92037)
Fix a crash in subinterpreters related to the garbage collector. When
a subinterpreter is deleted, untrack all objects tracked by its GC.
To prevent a crash in deallocator functions expecting objects to be
tracked by the GC, leak a strong reference to these objects on
purpose, so they are never deleted and their deallocator functions
are not called.
2022-05-04 11:59:01 +02:00
Sam Denton 465fdc02a3
gh-67248: cmd: Sort miscellaneous help topics (#92254)
Closes #67248
2022-05-03 21:36:52 -06:00
Inada Naoki 6dcfd6c5e3
gh-78214: marshal: Stabilize FLAG_REF usage (GH-8226)
Use FLAG_REF always for interned strings.

Refcounts of interned string is very unstable.
When compiling same source, refcounts of interned string in the output may be 1 or >1.
It makes FLAG_REF usage unstable.

To help reproducible build, use FLAG_REF for interned string even if refcnt(obj)==1.
2022-05-04 10:01:15 +09:00
Géry Ogam dfb1b9da8a
bpo-47029: Fix BrokenPipeError in multiprocessing.Queue at garbage collection and explicit close (#31913) 2022-05-03 17:49:57 -06:00
Erlend Egeberg Aasland f629dcfe83
gh-80254: Disallow recursive usage of cursors in `sqlite3` converters (#29054)
Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-03 17:03:06 -06:00
Kumar Aditya e8d7661ff2
GH-91173: disable frozen modules in debug builds (#92023) 2022-05-03 15:20:13 -07:00
Kabir Kwatra 48c6165c28
gh-91928: Add `datetime.UTC` alias for `datetime.timezone.utc` (GH-91973)
### fixes #91928

`UTC` is now module attribute aliased to `datetime.timezone.utc`.
You can now do the following:
```python
from datetime import UTC
```
2022-05-03 15:14:25 -07:00
kixorz 6dee69577a
bpo-45639: Add webp and avif image formats to mimetypes (#29259)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-03 15:17:57 -06:00
Zac Hatfield-Dodds 65f88a6ef7
gh-92062: `inspect.Parameter` checks whether `name` is a keyword (GH-92065)
Fixes #92062.
2022-05-03 13:52:30 -07:00
David CARLIER d5dfcd4489
bpo-46696: Add socket.SO_INCOMING_CPU constant (#31237)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-03 11:33:11 -06:00
Humbled Drugman b295a92c50
bpo-29890: Test IPv*Interface construction with tuple argument (#30862)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-03 11:21:24 -06:00
Abhigyan Bose 77e7a04cd2
GH-91752: Skip test_freeze_simple_script when zlib is not available (#91758)
Fixes GH-91752.
2022-05-03 10:19:54 -07:00
Toshio Kuratomi 20490d5018
gh-88753: Make BooleanOptionalAction's addition of default to help more similar to other actions (#27808)
Help for other actions omit the default value if default is SUPPRESS or
already contains the special format string '%(default)'.  Add those
special cases to BooleanOptionalAction's help formatting too.

Fixes https://bugs.python.org/issue44587 so that default=SUPPRESS is not
emitted.

Fixes https://bugs.python.org/issue38956 as this code will detect
whether '%(default)s' has already been specified in the help string.

Signed-off-by: Micky Yun Chan (michiboo): <chanmickyyun@gmail.com>
Co-authored-by: Micky Yun Chan <michan@redhat.com>
2022-05-03 18:38:18 +02:00
Łukasz Langa 6c25bf07e8
gh-89452: Prefer gdbm-compat over ndbm (#92208)
This makes macOS gdbm provided by Homebrew not segfault through correct
selection of the linked library (-lgdbm_compat) *AND* the correct ndbm-style
header (gdbm-ndbm.h instead of the invalid ndbm.h).
2022-05-03 18:27:38 +02:00
Dennis Sweeney b156578bd6
gh-92031: Deoptimize Static Code at Finalization (GH-92039) 2022-05-03 08:59:12 -06:00
David CARLIER 04dc4b06a3
gh-90887: posix module: Add more flags for fcopy_file (#31300)
Closes #90887

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-03 08:53:51 -06:00
Samodya Abey f6f36cc269
bpo-44863: Allow generic typing.TypedDict (#27663)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-03 07:21:42 -06:00
Ken Jin 6c7249f265
gh-92154: Expose PyCode_GetCode in the C API (GH-92168) 2022-05-03 21:13:13 +08:00
Carey Metcalfe 78e70be331
gh-70363: Implement `io.IOBase` interface for `SpooledTemporaryFile` (GH-29560)
Since the underlying file-like objects (either `io.BytesIO`,
or a true file object) all implement the `io.IOBase`
interface, the `SpooledTemporaryFile` should as well.

Additionally, since the underlying file object will either be an
instance of an `io.BufferedIOBase` (for binary mode) or an
`io.TextIOBase` (for text mode), methods for these classes were also
implemented.

In every case, the required methods and properties are simply delegated
to the underlying file object.

Co-authored-by: Gary Fernie <Gary.Fernie@skyscanner.net>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2022-05-03 21:18:18 +09:00
Thomas Cellerier 52dc9c3066
bpo-46415: Use f-string for ValueError in ipaddress.ip_{address,network,interface} helper functions (#30642)
`IPv*Network` and `IPv*Interface` constructors accept a 2-tuple of
(address description, netmask) as the address parameter.
When the tuple-based address is used errors are not propagated
correctly through the `ipaddress.ip_*` helper because of the %-formatting now expecting several arguments:

	In [7]: ipaddress.ip_network(("192.168.100.0", "fooo"))
        ...
	TypeError: not all arguments converted during string formatting

Compared to:

	In [8]: ipaddress.IPv4Network(("192.168.100.0", "foo"))
        ...
	NetmaskValueError: 'foo' is not a valid netmask

Use an f-string to make sure the error is always properly formatted.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-03 06:12:58 -06:00
Hugo van Kemenade 9b027d4cea
gh-92169: Use warnings_helper.import_deprecated() to import deprecated modules uniformly in tests (GH-92170) 2022-05-03 10:17:54 +03:00
Itai Steinherz 39e6b8ae6a
bpo-46785: Fix race condition between os.stat() and unlink on Windows (GH-31858) 2022-05-03 00:19:13 +01:00
Shantanu ebb8b512e9
gh-91621: Fix typing.get_type_hints for collections.abc.Callable (#91656)
This mirrors logic in typing.get_args. The trickiness comes from how we
flatten args in collections.abc.Callable, see
https://bugs.python.org/issue42195
2022-05-02 17:08:28 -06:00
Ethan Smith aff8c4f488
gh-84461: Add ability for multiprocessed libregrtest to use a different Python executable (GH-91930) 2022-05-02 15:51:34 -07:00
Serhiy Storchaka b04e02c57f
bpo-43923: Add support for generic typing.NamedTuple (#92027) 2022-05-02 16:41:23 -06:00
kbeldan 4bed9c47bd
gh-92032: Add soft keywords to rlcompleter (#92029)
Let the interpreter autocomplete soft-keywords, ATM the PEP-634 'match'
/ 'case' / '_' (wildcard pattern).

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-02 16:36:29 -06:00
Géry Ogam 2d30adee72
bpo-46285: Add command-line option -p/--protocol to module http.server (#30999)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-02 16:28:45 -06:00
Nikita Sobolev cb6c6648be
bpo-46547: remove leaking vars into `pydoc.Helper` namespace (#30957)
Fixes #90705
2022-05-02 16:25:52 -06:00
themylogin 9c204b148f
bpo-46787: Fix `ProcessPoolExecutor exception` memory leak (GH-31408) (#31408)
Do not store `ProcessPoolExecutor` work item exception traceback that prevents
exception frame locals from being garbage collected.
2022-05-02 14:24:39 -06:00
larryhastings c96da83a8e
Fix the closure argument to PyEval_EvalCodeEx. (GH-92175) 2022-05-02 14:08:22 -06:00
Jelle Zijlstra ff88f7e007
gh-87390: Add __unpacked__ attribute to types.GenericAlias (#92059) 2022-05-02 13:21:59 -06:00
Mark Dickinson 0ed91a26fe
gh-90213: Speed up right shifts of negative integers (GH-30277) 2022-05-02 11:19:03 -06:00
Sam Ezeh 4b297a9ffd
gh-91783: Document security considerations for shutil.unpack_archive (#91844) 2022-05-02 11:15:04 -06:00
Eric V. Smith 5f9c0f5ddf
Add weakref_slot to dataclass decorator, to allow instances with slots to be weakref-able. (#92160) 2022-05-02 10:36:39 -06:00
Alex Waygood ab616d323d
gh-92128: Add `__class_getitem__` to `logging.LoggerAdapter` and `logging.StreamHandler` (#92129)
Closes #92128
2022-05-02 09:10:02 -06:00
Mariusz Felisiak e6040604b3
bpo-46907: Update Windows installer to SQLite 3.38.3. (GH-91995) 2022-05-02 16:02:54 +01:00
Erlend Egeberg Aasland 721aa96540
gh-89301: Fix regression with bound values in traced SQLite statements (#92053) 2022-05-02 08:14:35 -06:00
Serhiy Storchaka 18b07d773e
bpo-36819: Fix crashes in built-in encoders with weird error handlers (GH-28593)
If the error handler returns position less or equal than the starting
position of non-encodable characters, most of built-in encoders didn't
properly re-size the output buffer. This led to out-of-bounds writes,
and segfaults.
2022-05-02 12:37:48 +03:00
Serhiy Storchaka 4d10f703d7
gh-92114: Improve error message for types with __class_getitem__ = None (GH-92115) 2022-05-02 08:29:49 +03:00
Antony Lee ad5e8520f3
bpo-39716: Raise on conflicting subparser names. (GH-18605)
Raise an ArgumentError when the same subparser name is added twice to an
ArgumentParser.  This is consistent with the (default) behavior when the
same option string is added twice to an ArgumentParser.

(Support for `conflict_handler="resolve"` could be considered as a
followup feature, although real use cases seem even rarer than
"resolve"ing option-strings.)

Automerge-Triggered-By: GH:rhettinger
2022-04-30 23:04:50 -07:00
Inada Naoki 0729b31a8b
gh-91952: Make TextIOWrapper.reconfigure() supports "locale" encoding (GH-91982) 2022-05-01 10:44:14 +09:00
Dennis Sweeney 868b1afa05
gh-92063: Enforce types in specialized PRECALL opcodes (GH-92068)
* Check the types of PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS

* fix PRECALL_NO_KW_METHOD_DESCRIPTOR_NOARGS as well

* fix PRECALL_NO_KW_METHOD_DESCRIPTOR_O

* fix PRECALL_NO_KW_METHOD_DESCRIPTOR_FAST
2022-04-30 12:35:33 -06:00
Serhiy Storchaka e91dee87ed
bpo-43323: Fix UnicodeEncodeError in the email module (GH-32137)
It was raised if the charset itself contains characters not encodable
in UTF-8 (in particular \udcxx characters representing non-decodable
bytes in the source).
2022-04-30 13:17:23 +03:00
Serhiy Storchaka 3483299a24
gh-81548: Deprecate octal escape sequences with value larger than 0o377 (GH-91668) 2022-04-30 13:16:27 +03:00
Serhiy Storchaka a055dac0b4
gh-91583: AC: Fix regression for functions with defining_class (GH-91739)
Argument Clinic now generates the same efficient code as before
adding the defining_class parameter.
2022-04-30 13:15:02 +03:00
Serhiy Storchaka 19dca04121
gh-91760: Deprecate group names and numbers which will be invalid in future (GH-91794)
Only sequence of ASCII digits will be accepted as a numerical reference.
The group name in bytes patterns and replacement strings could only
contain ASCII letters and digits and underscore.
2022-04-30 13:13:46 +03:00
Serhiy Storchaka 6d0d547033
gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070)
Previously, pickling did not fail, but the result could not be unpickled.
2022-04-30 13:03:23 +03:00
Inada Naoki 354ace8b07
gh-91954: Emit EncodingWarning from locale and subprocess (GH-91977)
locale.getpreferredencoding() and subprocess.Popen() emit EncodingWarning
2022-04-30 15:53:29 +09:00
Brett Cannon c2b579741d
gh-91217: deprecate xdrlib (GH-92066)
Automerge-Triggered-By: GH:brettcannon
2022-04-29 18:22:10 -07:00
Serhiy Storchaka 81120b6754
bpo-44791: Accept ellipsis as the last argument of typing.Concatenate (#30969) 2022-04-29 15:01:40 -06:00
Humbled Drugman 117836f123
bpo-26792: Improve docstrings of runpy module run_functions (#30729)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-04-29 12:22:46 -06:00
Petr Viktorin 83bce8ef14
gh-91324: Convert the stable ABI manifest to TOML (GH-92026) 2022-04-29 16:18:08 +02:00
Hugo van Kemenade 89c6b2b8f6
bpo-36329: Remove 'make -C Doc serve' in favour of 'make -C Doc htmlview' (GH-32354)
Also updated `make -C htmlview` so it used a full path with `file://`, because the original didn't open the page (macOS).

For example:
```sh
cd Doc

# Doesn't open anything:
python3 -c "import webbrowser; webbrowser.open('build/html/index.html')"

# Opens the docs page e.g. file:///Users/hugo/github/cpython/Doc/build/html/index.html :
python3 -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"
```

https://bugs.python.org/issue36329
2022-04-29 15:47:26 +02:00
Eisuke Kawashima ea2f5bcda1
bpo-22276: Change pathlib.Path.glob not to ignore trailing path separator (GH-10349)
Now pathlib.Path.glob() **only** matches directories when the pattern ends in a path separator.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-04-28 12:45:03 -07:00
Yurii Karabas 0ef8d921f5
gh-91603: Speed up isinstance/issubclass on union types (GH-91631)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-04-28 23:24:19 +08:00
Abhigyan Bose 4ed3900041
gh-91832: Add 'required' attr to argparse.Action repr (GH-91841)
# Adding 'required' to names in Lib.argparse.Action

gh-91832: 
Added 'required' to the list `names` in `Lib.argparse.Action`. 
Changed constant strings that test the Action object.

Automerge-Triggered-By: GH:merwok
2022-04-28 07:50:27 -07:00
Petr Viktorin 6dcbc08c95
gh-91324: List feature macros in the stable ABI manifest, improve tests (GH-32415) 2022-04-28 16:30:28 +02:00
Abhigyan Bose 88dd227959
gh-91984: Fix trailing spaces in multiline test strings in test_argparse (GH-91986) 2022-04-28 14:29:24 +03:00
Serhiy Storchaka cd1fbbc817
gh-91603: Speed up operator "|" for UnionType (GH-91955)
Reduce the complexity from O((M+N)^2) to O(M*N), where M and N are the length
of __args__ for both operands (1 for operand which is not a UnionType).

As a consequence, the complexity of parameter substitution in UnionType has
been reduced from O(N^3) to O(N^2).

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2022-04-28 13:25:33 +03:00
Dennis Sweeney 37c6db60f9
gh-91869: Fix tracing of specialized instructions with extended args (GH-91945) 2022-04-27 22:36:34 -06:00
Brett Cannon 407c3afe19
gh-91217: deprecate uu (GH-92009)
Automerge-Triggered-By: GH:brettcannon
2022-04-27 20:26:33 -07:00
Serhiy Storchaka 43a8bf1ea4
gh-87999: Change warning type for numeric literal followed by keyword (GH-91980)
The warning emitted by the Python parser for a numeric literal
immediately followed by keyword has been changed from deprecation
warning to syntax warning.
2022-04-27 20:15:14 +03:00
David CARLIER ad9f817eeb
gh-91498: socket: Add TCP_CONNECTION_INFO on macOS (#69256)
Fixes GH-91498
2022-04-27 06:47:17 -06:00
Victor Stinner 29e2245ad5
gh-91320: Add _Py_reinterpret_cast() macro (#91959)
Fix C++ compiler warnings about "old-style cast"
(g++ -Wold-style-cast) in the Python C API.  Use C++
reinterpret_cast<> and static_cast<> casts when the Python C API is
used in C++.

Example of fixed warning:

    Include/object.h:107:43: error: use of old-style cast to
    ‘PyObject*’ {aka ‘struct _object*’} [-Werror=old-style-cast]
    #define _PyObject_CAST(op) ((PyObject*)(op))

Add _Py_reinterpret_cast() and _Py_static_cast() macros.
2022-04-27 10:40:57 +02:00
Alexander Shadchin f882d33778
Fix missing `f` prefix on f-strings (GH-91910) 2022-04-27 09:30:54 +03:00
Victor Stinner 80de0273c0
gh-68966: Deprecate the mailcap module (#91951) 2022-04-26 22:43:50 +02:00
Brett Cannon 1af871eeee
gh-91217: deprecate telnetlib (GH-91958) 2022-04-26 10:45:08 -07:00
Jelle Zijlstra 5397b5afc1
gh-91860: Add typing.dataclass_transform (PEP 681) (#91861)
Copied from typing-extensions (python/typing#1054, python/typing#1120).

Documentation is intentionally omitted, so we can focus on getting the
runtime part in before the feature freeze.
2022-04-25 20:30:25 -07:00
Brett Cannon d174ebe91e
gh-91217: deprecate sunau (GH-91866) 2022-04-25 16:26:43 -07:00
Gregory P. Smith cd5726fe67
gh-91401: Add a failsafe way to disable vfork. (#91490)
Just in case there is ever an issue with _posixsubprocess's use of
vfork() due to the complexity of using it properly and potential
directions that Linux platforms where it defaults to on could take, this
adds a failsafe so that users can disable its use entirely by setting
a global flag.

No known reason to disable it exists. But it'd be a shame to encounter
one and not be able to use CPython without patching and rebuilding it.

See the linked issue for some discussion on reasoning.

Also documents the existing way to disable posix_spawn.
2022-04-25 16:19:39 -07:00
Mariusz Felisiak eddd07f840
bpo-46907: Update Windows installer to SQLite 3.38.2 (GH-32147) 2022-04-25 23:33:45 +01:00
Victor Stinner 20cc695286
gh-64783: Fix signal.NSIG value on FreeBSD (#91929)
Fix signal.NSIG value on FreeBSD to accept signal numbers greater
than 32, like signal.SIGRTMIN and signal.SIGRTMAX.

* Add Py_NSIG constant.
* Add pycore_signal.h internal header file.
* _Py_Sigset_Converter() now includes the range of valid signals in
  the error message.
2022-04-26 00:13:31 +02:00
Serhiy Storchaka 54d068adfb
gh-91904: Fix setting envvar PYTHONREGRTEST_UNICODE_GUARD (GH-91905)
It always failed on non-UTF-8 locale and prevented running regrtests.
2022-04-25 17:35:14 +03:00
Jelle Zijlstra 93d280141c
gh-90633: Improve error and docs for typing.assert_never (#91720)
Closes #90633

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-04-25 06:40:18 -07:00
Ezio Melotti f7641a2ffe
gh-91888: add a `:gh:` role to the documentation (#91889)
* Add a new :gh:`...` role for GitHub issues.

* Fix a GitHub id to use the :gh: role.

* Add Misc/NEWS entry.

* Refactoring and rephrasing.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-04-25 12:05:54 +02:00
Jelle Zijlstra e93d2fbdda
gh-91821: Make decimal test succeed consistently (#91825)
The test relies on precision being set to 9, but some ways of
invoking this test leave it set to 28 instead. I don't know
exactly how it happens, but setting the precision directly should
make the behavior consistent.
2022-04-24 15:02:57 -07:00
Zac Hatfield-Dodds b4e048411f
gh-91230: Concise catch_warnings with simplefilter (#91435) 2022-04-23 17:55:22 -07:00
Brett Cannon 692e9078a1
gh-91217: deprecate spwd (#91846)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-04-23 14:48:17 -07:00
Christian Heimes 92c1037afc
gh-84461: Add --enable-wasm-pthreads and more file systems (GH-91820) 2022-04-23 14:59:33 +02:00
Christian Heimes 9b5ca5405e
gh-84461: Add sys._emscripten_info, improve docs and build (gh-91781) 2022-04-23 09:52:16 +02:00
Pablo Galindo Salgado 0daa99f68b
gh-88116: Enhance the inspect frame APIs to use the extended position information (GH-91531) 2022-04-23 03:16:48 +01:00
Shantanu 254aaa7981
gh-91547: Remove "Undocumented modules" page (#91682) 2022-04-22 16:01:52 -07:00
Brett Cannon e7929cba16
gh-91217: deprecate-sndhdr (#91806)
Also inline necessary functionality from `sndhdr` into `email.mime.audio` for `MIMEAudio`.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-04-22 15:48:03 -07:00
Géry Ogam 5576ddbbbc
bpo-46720: Add support for path-like objects to multiprocessing.set_executable for Windows (GH-31279)
This bring the API to be on a par with Unix-like systems.
2022-04-22 15:47:09 -07:00
Serhiy Storchaka f912cc0e41
gh-91575: Add a script for generating data for case-insensitive matching in re (GH-91660)
Also test that all extra cases are in BMP.
2022-04-22 21:37:46 +03:00
Serhiy Storchaka 48ec61a89a
gh-91700: Validate the group number in conditional expression in RE (GH-91702)
In expression (?(group)...) an appropriate re.error is now
raised if the group number refers to not defined group.

Previously it raised RuntimeError: invalid SRE code.
2022-04-22 19:53:10 +03:00
Serhiy Storchaka 6ccfa31421
gh-90568: Fix exception type for \N with a named sequence in RE (GH-91665)
re.error is now raised instead of TypeError.
2022-04-22 18:35:28 +03:00
Guido van Rossum 2f233fceae
gh-89279: In ceval.c, redefine some macros for speed (#32387)
Macros Py_DECREF, Py_XDECREF, Py_IS_TYPE, _Py_atomic_load_32bit_impl
and _Py_DECREF_SPECIALIZED are redefined as macros
that completely replace the inline functions of the same name.
These three came out in the top four of functions that (in MSVC)
somehow weren't inlined.

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2022-04-22 07:46:26 -07:00
Victor Stinner 9e146bbb7e
gh-80527: Deprecate PEP 623 Unicode functions (#91801)
Deprecate functions:

* PyUnicode_AS_DATA()
* PyUnicode_AS_UNICODE()
* PyUnicode_GET_DATA_SIZE()
* PyUnicode_GET_SIZE()

Previously, these functions were macros and so it wasn't possible to
decorate them with Py_DEPRECATED().
2022-04-22 13:05:36 +02:00
Sam Ezeh bcf14ae433
gh-91291: Accept attributes as keyword arguments in decimal.localcontext (#32242)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-21 21:27:15 -07:00
Brett Cannon 2551a6c92f
gh-91217: deprecate-pipes (GH-91779) 2022-04-21 19:28:34 -07:00
Erlend Egeberg Aasland 29afb7d2ef
gh-69093: Add indexing and slicing support to sqlite3.Blob (#91599)
Authored-by: Aviv Palivoda <palaviv@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no>
2022-04-21 18:45:16 -07:00
Victor Stinner 364ed94092
gh-89373: _Py_Dealloc() checks tp_dealloc exception (#32357)
If Python is built in debug mode, _Py_Dealloc() now ensures that the
tp_dealloc function leaves the current exception unchanged.
2022-04-21 23:04:01 +02:00
Victor Stinner eaa85cb22f
gh-91768: C API no longer use "const PyObject*" type (#91769)
Py_REFCNT(), Py_TYPE(), Py_SIZE() and Py_IS_TYPE() functions argument
type is now "PyObject*", rather than "const PyObject*".

* Replace also "const PyObject*" with "PyObject*" in functions:

  * _Py_strhex_impl()
  * _Py_strhex_with_sep()
  * _Py_strhex_bytes_with_sep()

* Remove _PyObject_CAST_CONST() and _PyVarObject_CAST_CONST() macros.
* Py_IS_TYPE() can now use Py_TYPE() in its implementation.
2022-04-21 22:07:19 +02:00
Petr Viktorin ac4ffd3be2
bpo-47169: Export PyOS_CheckStack on Windows (GH-32414) 2022-04-21 18:03:25 +02:00
Mark Shannon 944fffee89
GH-88116: Use a compact format to represent end line and column offsets. (GH-91666)
* Stores all location info in linetable to conform to PEP 626.

* Remove column table from code objects.

* Remove end-line table from code objects.

* Document new location table format
2022-04-21 16:10:37 +01:00
Dennis Sweeney f2b4e458b3
gh-91636: Don't clear required fields of function objects (GH-91651) 2022-04-21 02:06:35 -04:00
Iman Kermani 615b24c80b
bpo-42066: CookieJar cookies should not be sorted (GH-22745) 2022-04-20 20:45:24 -05:00
Victor Stinner 031f1e6040
gh-90623: signal.raise_signal() calls PyErr_CheckSignals() (#91756)
signal.raise_signal() and os.kill() now call PyErr_CheckSignals() to
check immediately for pending signals.
2022-04-21 03:14:57 +02:00
Victor Stinner c77953b23e
Revert "gh-85567: Register a cleanup function to close files for FileType objects in argparse (#32257)" (#91771)
This reverts commit 328dbc051f.
2022-04-21 03:10:51 +02:00
Dong-hee Na f571c26fc1
gh-91632: Fix generic_alias_iterator to be finalized at exit. (GH-91727) 2022-04-20 23:10:41 +09:00
Victor Stinner aaeea78b0f
gh-91731: Build Python with -std=c11 (#91733)
Python is now built with "-std=c11" compiler option, rather than
"-std=c99".
2022-04-20 13:19:05 +02:00
Jakub Kulík 4420faf273
gh-91734: Fix ossaudio support on Solaris (GH-91735) 2022-04-20 13:46:08 +03:00
Inada Naoki 4d2403fd50
gh-91020: Add `PyBytes_Type.tp_alloc` for subclass (GH-91686) 2022-04-20 14:06:29 +09:00
Nick b6d5e3c3c9
bpo-46075: Store localhost cookies in CookieJar (#30108)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-19 13:08:06 -07:00
Dennis Sweeney da6c78584b
gh-90667: Add specializations of Py_DECREF when types are known (GH-30872) 2022-04-19 19:02:19 +01:00
Ma Lin a059395921
bpo-40859: Update Windows build to use xz-5.2.5 (GH-20622) 2022-04-19 17:36:51 +01:00
Ma Lin e4e8895ae3
gh-91616: re module, fix .fullmatch() mismatch when using Atomic Grouping or Possessive Quantifiers (GH-91681)
These jumps should use DO_JUMP0() instead of DO_JUMP():
- JUMP_POSS_REPEAT_1
- JUMP_POSS_REPEAT_2
- JUMP_ATOMIC_GROUP
2022-04-19 17:49:36 +03:00
Victor Stinner 061a8bf77c
gh-91231: Add shutdown_timeout to multiprocessing BaseManager (#32112)
Add an optional keyword 'shutdown_timeout' parameter to the
multiprocessing.BaseManager constructor. Kill the process if
terminate() takes longer than the timeout.

Multiprocessing tests pass test.support.SHORT_TIMEOUT
to BaseManager.shutdown_timeout.
2022-04-19 16:27:00 +02:00
penguin_wwy e590379197
gh-90997: bpo-46841: Disassembly of quickened code (GH-32099) 2022-04-19 09:45:08 +01:00
Victor Stinner aa5c0a9f8d
bpo-40421: Cleanup PyFrame C API (GH-32417) 2022-04-19 09:53:10 +02:00
Oleg Iarygin 7fbc7f6128
gh-91098: Use Argument Clinic for Object/classobject.c to fix docstrings (#31711)
Closes GH-91098.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-18 19:56:53 -07:00
Inada Naoki 6fdb62b1fa
gh-91526: io: Remove device encoding support from TextIOWrapper (GH-91529)
`TextIOWrapper.__init__()` called `os.device_encoding(file.fileno())` if fileno is 0-2 and encoding=None.
But it is very rarely works, and never documented behavior.
2022-04-19 11:44:36 +09:00
Irit Katriel 39a54ba638
gh-74166: Add option to get all errors from socket.create_connection (GH-91586) 2022-04-18 23:15:41 +01:00
Bryan Weber 0860b26a4f
gh-91670: Removes `SO` config variable in `sysconfig.py` (#91671)
* Removes SO config variable in sysconfig

Per @warsaw in https://github.com/python/cpython/issues/63754, this was
deprecated in Python 3.4 and was suggested for removal in Python 3.5.

* Add NEWS

* Update Misc/NEWS.d/next/Library/2022-04-18-15-23-24.gh-issue-91670.6eyChw.rst

Co-authored-by: Éric <merwok@netwok.org>

Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: Éric <merwok@netwok.org>
2022-04-18 14:01:18 -07:00
Oleg Iarygin 2f0fc521f4
gh-91102: Use Argument Clinic for EncodingMap (#31725)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-18 13:43:56 -07:00
Barry Warsaw dbd9d75fed
Add some information about where pynche has moved to (#91650) 2022-04-18 07:34:53 -07:00
Kumar Aditya 8c54c3dacc
gh-91576: Speed up iteration of strings (#91574) 2022-04-18 07:18:27 -07:00
Ma Lin a29f858124
bpo-47256: Increasing the depth of backtracking in RE (GH-32411)
Limit the maximum capturing group to 2**30-1 on 64-bit platforms
(it was 2**31-1). No change on 32-bit platforms (2**28-1).

It allows to reduce the size of SRE(match_context):
- On 32 bit platform: 36 bytes, no change.  (msvc2022)
- On 64 bit platform: 72 bytes -> 56 bytes. (msvc2022/gcc9.4)

which leads to increasing the depth of backtracking.
2022-04-18 16:50:40 +03:00
Serhiy Storchaka 1c2fcebf3c
gh-91575: Update case-insensitive matching in re to the latest Unicode version (GH-91580) 2022-04-18 12:26:30 +03:00
Thomas Klausner 2e7e3c4c10
bpo-46053: Fix OSS audio support on NetBSD (GH-30065) 2022-04-18 12:12:39 +03:00
Oleg Iarygin 804ea2da97
gh-91265: Make old ctypes.macholib tests runned by `python -m test` (gh-32094)
* Move tests from ctypes.macholib.dy* to ctypes.test
2022-04-18 09:27:09 +02:00
Raymond Hettinger 4c3b283e83
Remove ill-formed an unneeded news entry (GH-91657) 2022-04-18 00:27:41 -05:00
Susan Su 8e76d7e1a9
bpo-21150: Add quick link/summary table to the top of argparse documentation (GH-12005)
No work has been done to move this forward.  On the theory that perfect is the enemy of good, I'm going to push it and we can make minor edits as needed afterwards.
2022-04-17 23:46:18 -05:00
Oleg Iarygin a573cb2fec
gh-91118: Fix docstrings that do not honor --without-doc-strings (#31769)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-17 20:39:32 -07:00
achhina 328dbc051f
gh-85567: Register a cleanup function to close files for FileType objects in argparse (#32257)
* bpo-41395: Register a cleanup function to close files for FileType objects in argparse

* Added import as top level import, and renamed file as fh.
2022-04-17 22:53:37 -03:00
Barry Warsaw 7173fd5de0
Remove the ancient Pynche color editor (#91554)
Closes #91551
2022-04-17 15:38:44 -07:00
Brett Cannon ceea0715df
gh-91217: deprecate ossaudiodev (GH-91641)
Automerge-Triggered-By: GH:brettcannon
2022-04-17 15:02:36 -07:00
Dennis Sweeney cec5d858f5
gh-91625: Don't ignore extended args of adaptive opcodes (GH-91626) 2022-04-17 14:04:29 -04:00
Jason R. Coombs 7659681556
gh-91298: Refine traversable (apply changes from importlib_resources 5.7.1) (#91623)
* bpo-47142: Refine traversable (apply changes from importlib_resources 5.7.1)

* Replace changelog referencing github issue.
2022-04-17 11:10:36 -04:00
Dennis Sweeney 37965d2fb4
gh-78607: Replace __ltrace__ with __lltrace__ (GH-91619) 2022-04-16 18:57:00 -04:00
Dennis Sweeney 8560f4a0f2
gh-91462: Make lltrace output human-readable. (GH-91463)
* Transform opcodes into opnames
* Print the whole stack at each opcode, and eliminate prtrace output at each (push/pop/stackadj)
* Display info about the function at each resume_frame
2022-04-16 17:36:29 -04:00
Brett Cannon 9f06ff96cc
gh-91217: deprecate nis (GH-91606)
Automerge-Triggered-By: GH:brettcannon
2022-04-16 13:17:30 -07:00
Irit Katriel d4c4a76ed1
gh-89770: Implement PEP-678 - Exception notes (GH-31317) 2022-04-16 19:59:52 +01:00
Gregory P. Smith 7fa3a5a219
gh-91607: Fix several test_concurrent_futures tests to actually test what they claim (#91600)
* Fix test_concurrent_futures to actually test what it says.

Many ProcessPoolExecutor based tests were ignoring the mp_context
and using the default instead.  This meant we lacked proper test
coverage of all of them.

Also removes the old _prime_executor() worker delay seeding code
as it appears to have no point and causes 20-30 seconds extra
latency on this already long test.  It also interfered with some
of the refactoring to fix the above to not needlessly create their
own executor when setUp has already created an appropriate one.

* Don't import the name from multiprocessing directly to avoid confusion.

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-04-16 11:46:33 -07:00
Sebastian Rittau 0ddc63b240
gh-86178: Add wsgiref.types (GH-32335) 2022-04-16 10:37:58 -07:00
Shantanu 1adc837bf1
bpo-40676: Use Argument Clinic for csv (where possible) (GH-20200) 2022-04-16 10:34:23 -07:00
Jelle Zijlstra 055760ed9e
gh-89263: Add typing.get_overloads (GH-31716)
Based on suggestions by Guido van Rossum, Spencer Brown, and Alex Waygood.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2022-04-16 09:01:43 -07:00
Yu Liu 9300b6d729
gh-91595: fix the comparison of character and integer by using ord() (#91596)
* fix the comparison of character and integer by using ord()

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-04-16 16:34:48 +02:00
Jack DeVries 468314cc8b
gh-82849: revise intro to os.path.rst (GH-32232)
* revise the first paragraph of docs for os.path
* add a mention of `os.PathLike` protocol
* remove warnings rendered irrelevant by :pep:`383` and :pep:`529`

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-15 21:23:07 -07:00
Erlend Egeberg Aasland a861756675
gh-69093: Add context manager support to sqlite3.Blob (GH-91562) 2022-04-15 21:21:12 -07:00
msoxzw 42fabc3ea7
gh-91487: Optimize asyncio UDP speed (GH-91488)
Fix #91487

When transferring a small file, e.g. 256 KiB, the speed of this PR is comparable. However, if a large file, e.g. 65536 KiB, is transferred, asyncio UDP will be over 100 times faster than the original. The speed is presumably significantly faster if a larger file is transferred, e.g. 1048576 KiB.

Automerge-Triggered-By: GH:gpshead
2022-04-15 12:59:01 -07:00
Brett Cannon c9e231de85
gh-91217: deprecate nntplib (GH-91543) 2022-04-15 12:32:56 -07:00
Irit Katriel ea2ae02607
gh-91276: Make JUMP_IF_TRUE_OR_POP/JUMP_IF_FALSE_OR_POP relative (GH-32215) 2022-04-15 20:19:24 +01:00
Irit Katriel 5d421d7342
gh-90501: Add PyErr_GetHandledException and PyErr_SetHandledException (GH-30531) 2022-04-15 19:57:47 +01:00
Brandt Bucher 1b34b5687b
gh-91404: Use computed gotos and reduce indirection in re (#91495) 2022-04-15 09:26:44 -07:00
Oleg Iarygin 6217864fe5
gh-79156: Add start_tls() method to streams API (#91453)
The existing event loop `start_tls()` method is not sufficient for
connections using the streams API. The existing StreamReader works
because the new transport passes received data to the original protocol.
The StreamWriter must then write data to the new transport, and the
StreamReaderProtocol must be updated to close the new transport
correctly.

The new StreamWriter `start_tls()` updates itself and the reader
protocol to the new SSL transport.

Co-authored-by: Ian Good <icgood@gmail.com>
2022-04-15 14:23:14 +02:00
Erlend Egeberg Aasland ee475430d4
gh-69093: Support basic incremental I/O to blobs in `sqlite3` (GH-30680)
Authored-by: Aviv Palivoda <palaviv@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no>
Co-authored-by: palaviv <palaviv@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-14 17:02:56 -07:00
Brett Cannon 1b6cd872f4
gh-91217: deprecate msilib (GH-91515) 2022-04-14 12:50:11 -07:00
Gregory P. Smith 861974b514
gh-89455: Fix an uninitialized bool in exception print context. (#91466)
Fix an uninitialized bool in exception print context.
    
`struct exception_print_context.need_close` was uninitialized.
    
Found by oss-fuzz in a test case running under the undefined behavior sanitizer.
    
https://oss-fuzz.com/testcase-detail/6217746058182656
    
```
Python/pythonrun.c:1241:28: runtime error: load of value 253, which is not a valid value for type 'bool'
    #0 0xbf2203 in print_chained cpython3/Python/pythonrun.c:1241:28
    #1 0xbea4bb in print_exception_cause_and_context cpython3/Python/pythonrun.c:1320:19
    #2 0xbea4bb in print_exception_recursive cpython3/Python/pythonrun.c:1470:13
    #3 0xbe9e39 in _PyErr_Display cpython3/Python/pythonrun.c:1517:9
```
    
Pretty obvious what the ommission was upon code inspection.
2022-04-14 11:26:25 -07:00
Hood Chatham 1b035d9699
gh-91353: Fix void return type handling in ctypes (GH-32246) 2022-04-14 16:27:01 +02:00
Inada Naoki 13b17e2a0a
gh-91156: Fix `encoding="locale"` in UTF-8 mode (GH-70056) 2022-04-14 16:00:35 +09:00
Pieter Eendebak 355cbaadbb
gh-91266: refactor bytearray strip methods (GH-32096) 2022-04-13 22:20:38 -04:00
Brett Cannon 3fc57e8f6f
gh-91217: deprecate imghdr (#91461)
* Deprecate imghdr

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Update Doc/whatsnew/3.11.rst

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Inline `imghdr` into `email.mime.image`

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Barry Warsaw <barry@python.org>
2022-04-13 10:47:41 -07:00
David Foster dfbc792a4b
gh-91243: Update authors for Required[] and NotRequired[] implementation (GH-91506) 2022-04-13 07:52:19 -07:00
Pablo Galindo Salgado 37a53fb6bd
gh-91502: Add a new API to check if a frame is an entry frame (GH-91503) 2022-04-13 14:06:56 +01:00
Dustin Rodrigues 54f67ad543
bpo-43218: Prevent venv creation when the target directory contains a PATH separator. (GH-24530) 2022-04-13 09:07:10 +01:00
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
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
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
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
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
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
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
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
Serhiy Storchaka 884eba3c76
bpo-26579: Add object.__getstate__(). (GH-2821)
Copying and pickling instances of subclasses of builtin types
bytearray, set, frozenset, collections.OrderedDict, collections.deque,
weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes
implemented as slots.
2022-04-06 20:00:14 +03:00
Serhiy Storchaka a69a4a917c
bpo-46721: Optimize set.issuperset() for non-set arguments (GH-31280) 2022-04-06 19:57:13 +03:00
Serhiy Storchaka 31cd25f4e1
bpo-43464: Optimize set.intersection() for non-set arguments (GH-31316) 2022-04-06 19:56:28 +03:00
Serhiy Storchaka 50872dbadc
bpo-47227: Suppress expression chaining for more RE parsing errors (GH-32333) 2022-04-06 19:54:44 +03:00
Serhiy Storchaka b09184bf05
bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)
They were undocumented and never working.
2022-04-06 19:53:50 +03:00
Petr Viktorin d79f118d04
bpo-47115: Document which parts of structs are in limited API/stable ABI (GH-32196)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2022-04-06 16:50:45 +02:00
Ken Jin 9ffe47df54
bpo-47189: What's New in 3.11: Faster CPython (GH-32235)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2022-04-06 19:38:25 +08:00
Steve Dower 074da78802
bpo-47103: Copy pgort140.dll into output directory when building PGInstrument on Windows (GH-32083) 2022-04-06 11:56:31 +01:00
Pablo Galindo 2e49bd06c5
Python 3.11.0a7 2022-04-05 20:54:03 +01:00
Brett Cannon c1d93b6411
bpo-47061: deprecate the `aifc` module (GH-32134)
Co-authored-by: Christian Heimes <christian@python.org>
2022-04-05 12:05:48 -07:00
Sam Ezeh 050a8f94c6
bpo-4833: Add ZipFile.mkdir (GH-32160) 2022-04-05 11:41:38 -07:00
Hugo van Kemenade 75280944e5
bpo-46607: Add DeprecationWarning for LegacyInterpolation, deprecated in docs since 3.2 (GH-30927) 2022-04-05 08:15:11 -07:00
Jelle Zijlstra cfb849a326
bpo-47088: Add typing.LiteralString (PEP 675) (GH-32064)
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2022-04-05 07:21:03 -07:00
Erlend Egeberg Aasland a7551247e7
bpo-41930: Add support for SQLite serialise/deserialise API (GH-26728)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-04-05 07:15:25 -07:00
Matthieu Dartiailh aa0f056a00
bpo-47212: Improve error messages for un-parenthesized generator expressions (GH-32302) 2022-04-05 14:47:13 +01:00
Erlend Egeberg Aasland f1606a5ba5
bpo-45774: Harden SQLite detection (GH-30016) 2022-04-05 14:54:47 +02:00
Irit Katriel 0aa8d5cbd8
bpo-47120: make JUMP_NO_INTERRUPT relative (GH-32221) 2022-04-05 12:49:08 +01:00
Irit Katriel 32091df41c
bpo-47186: Replace JUMP_IF_NOT_EG_MATCH by CHECK_EG_MATCH + jump (GH-32309) 2022-04-05 12:06:22 +01:00
Christian Heimes 96e09837fb
bpo-40280: Add limited Emscripten REPL (GH-32284)
Co-authored-by: Katie Bell <katie@katharos.id.au>
2022-04-05 11:21:11 +02:00
Ronald Oussoren 6aaf4cd866
bpo-46890: Fix setting of sys._base_executable with framework builds on macOS (GH-31958)
The side effect of this bug was that venv environments directly
used the main interpreter instead of the intermediate stub executable,
which can cause problems when a script uses system APIs that
require the use of an application bundle.
2022-04-05 02:05:36 -04:00
rtobar b275267aa7
bpo-45790: List macros in same order in which fields are described (GH-29529)
Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-04 19:36:33 -07:00
Shantanu 5a4973e29f
bpo-46998: Allow subclassing Any at runtime (GH-31841)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-04 19:35:29 -07:00
yyyyyyyan a74892cb21
bpo-41233: Add links to errnos referenced in exceptions docs (GH-21380)
Co-authored-by: Andrew Kuchling <amk@amk.ca>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-04 19:01:36 -07:00
Christian Heimes c9844cb8aa
bpo-40280: Add --enable-wasm-dynamic-linking (GH-32253) 2022-04-04 19:31:31 +02:00
180909 48269ea9fd
bpo-46484:Add test for Calendar.iterweekdays (GH-30825) 2022-04-04 18:16:56 +01:00
Christian Heimes d1b1c885d8
bpo-47208: Allow vendors to override CTYPES_MAX_ARGCOUNT (GH-32297) 2022-04-04 19:13:42 +02:00
Inada Naoki 4216dce04b
bpo-47000: Make `io.text_encoding()` respects UTF-8 mode (GH-32003)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2022-04-04 11:46:57 +09:00
Hood Chatham 087d0fa5b9
bpo-47176: Interrupt handling for wasm32-emscripten builds without pthreads (GH-32209)
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Brett Cannon <brett@python.org>
2022-04-03 22:58:52 +02:00
Jason R. Coombs 84acb5cad1
bpo-46126: Restore 'descriptions' when running tests internally. (GH-32128)
This reverts commit a941e5927f (GH-30194).

Automerge-Triggered-By: GH:jaraco
2022-04-03 12:33:28 -07:00
Ma Lin 6e3eee5c11
bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure (GH-32283) 2022-04-03 19:16:20 +03:00
Christian Heimes b82cdd1dac
bpo-47205: Skip error check of sched_get/setaffinity on FreeBSD (GH-32285) 2022-04-03 17:03:49 +02:00
Michał D 281f980d35
bpo-46033: Clarify for-statement execution (GH-30025)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-02 20:52:20 -04:00
Zachary Ware 6066739ff7
bpo-47194: Update zlib to v1.2.12 on Windows to resolve CVE-2018-25032 (GH-32241) 2022-04-02 14:10:23 +01:00
Serhiy Storchaka 1be3260a90
bpo-47152: Convert the re module into a package (GH-32177)
The sre_* modules are now deprecated.
2022-04-02 11:35:13 +03:00
Christian Heimes abdd69c95c
bpo-46023: makesetup: skip all duplicate modules (GH-32234) 2022-04-01 17:23:12 +02:00
Irit Katriel 04e07c258f
bpo-47186: Replace JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH + jump (GH-32231) 2022-04-01 13:59:38 +01:00
Brandt Bucher bd2e47c883
bpo-46841: Avoid unnecessary allocations in code object comparisons (GH-32222) 2022-04-01 11:42:46 +01:00
Dennis Sweeney a0ea7a116c
bpo-47009: Streamline list.append for the common case (GH-31864) 2022-04-01 11:23:42 +01:00
Victor Stinner f877b40e3f
bpo-46850: Move _PyInterpreterState_SetEvalFrameFunc() to internal C API (GH-32054)
Move the private _PyFrameEvalFunction type, and private
_PyInterpreterState_GetEvalFrameFunc() and
_PyInterpreterState_SetEvalFrameFunc() functions to the internal C
API. The _PyFrameEvalFunction callback function type now uses the
_PyInterpreterFrame type which is part of the internal C API.

Update the _PyFrameEvalFunction documentation.
2022-04-01 10:55:00 +02:00
Victor Stinner b9a5522dd9
bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API (GH-32052)
Move the private undocumented _PyEval_EvalFrameDefault() function to
the internal C API. The function now uses the _PyInterpreterFrame
type which is part of the internal C API.
2022-04-01 10:17:57 +02:00
Andrew Svetlov d4bb38f82b
bpo-47167: Allow overriding a future compliance check in asyncio.Task (GH-32197) 2022-04-01 04:25:15 +03:00
Andrew Svetlov ab89ccff3c
bpo-45099: Document asyncio internal API (GH-32166) 2022-04-01 00:06:07 +03:00
Gregory P. Smith 4a08c4c469
bpo-47151: Fallback to fork when vfork fails in subprocess. (GH-32186)
bpo-47151: Fallback to fork when vfork fails in subprocess. An OS kernel can specifically decide to disallow vfork() in a process. No need for that to prevent us from launching subprocesses.
2022-03-31 13:42:28 -07:00
Mark Shannon 74b95d86e0
bpo-40421: Add missing getters for frame object attributes to C-API. (GH-32114) 2022-03-31 17:13:25 +01:00
Christian Heimes 44e915028d
bpo-47182: Fix crash by named unicode characters after interpreter reinitialization (GH-32212)
Automerge-Triggered-By: GH:tiran
2022-03-31 08:14:50 -07:00
Irit Katriel a00518d9ad
bpo-47120: Replace the JUMP_ABSOLUTE opcode by the relative JUMP_BACKWARD (GH-32115) 2022-03-31 14:14:15 +01:00
Steve Dower 2ab609dd61
bpo-47171: Enable installing the py.exe launcher on Windows ARM64 (GH-32203) 2022-03-30 21:20:38 +01:00
Christian Heimes 581c4434de
bpo-47162: Add call trampoline to mitigate bad fpcasts on Emscripten (GH-32189) 2022-03-30 12:28:33 -07:00
Dong-hee Na d0c67ea064
bpo-46775: OSError should call winerror_to_errno unconditionally on Windows (GH-32179) 2022-03-30 18:31:33 +01:00
Oleg Iarygin a03a09e068
Replace with_traceback() with exception chaining and reraising (GH-32074) 2022-03-30 15:28:20 +03:00
Andrew Svetlov f08a191882
bpo-39622: Interrupt the main asyncio task on Ctrl+C (GH-32105)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-03-30 15:15:06 +03:00
Daniël van Noord 75eee1d57e
bpo-34861: Make cumtime the default sorting key for cProfile (GH-31929) 2022-03-30 12:10:10 +01:00
Hugo van Kemenade 6881ea936e
bpo-47126: Update to canonical PEP URLs specified by PEP 676 (GH-32124) 2022-03-30 12:00:27 +01:00
Dave Goncalves dc2d8404a3
bpo-33178: Add BigEndianUnion, LittleEndianUnion classes to ctypes (GH-25480)
* bpo-33178: Add BigEndianUnion, LittleEndianUnion classes to ctypes
* GH-25480: remove trailing whitespace in ctypes doc
* GH-25480: add news entry blurb
* GH-25480: corrected formatting error in news blurb
* GH-25480: simplified, corrected formatting in news blurb
* GH-25480: remove trailing whitespace in news blurb
* GH-25480: fixed class markup in news blurb
* GH-25480: fixed unsupported type tests and naming per review comments
* GH-25480: fixed whitepace errors
* condensed base class selection for unsupported byte order tests
* added versionadded tags for new EndianUnion classes
2022-03-29 14:26:27 -07:00
benfogle d0906c90fc
bpo-42340: Document issues around KeyboardInterrupt (GH-23255)
Update documentation to note that in some circumstances,
KeyboardInterrupt may cause code to enter an inconsistent state. Also
document sample workaround to avoid KeyboardInterrupt, if needed.
2022-03-29 14:21:36 -07:00
Sam Ezeh 755be9b150
bpo-14265: Adds fully qualified test name to unittest output (GH-32138)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-29 18:02:09 +03:00
Ma Lin 356997cccc
bpo-35859: Fix a few long-standing bugs in re engine (GH-12427)
In rare cases, capturing group could get wrong result.

Regular expression engines in Perl and Java have similar bugs.
The new behavior now matches the behavior of more modern
RE engines: in the regex module and in PHP, Ruby and Node.js.
2022-03-29 17:31:01 +03:00
Steve Dower bad86a621a
bpo-46566: Add new py.exe launcher implementation (GH-32062) 2022-03-29 00:21:08 +01:00
Vincent Bernat 5c30388f3c
bpo-27929: resolve names only for AF_INET/AF_INET6 with asyncio (GH-32131)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-29 00:50:26 +03:00
Maciej Górski 7b44ade018
bpo-47129: Add more informative messages to f-string syntax errors (32127)
* Add more informative messages to f-string syntax errors

* 📜🤖 Added by blurb_it.

* Fix whitespaces

* Change error message

* Remove the 'else' statement (as sugested in review)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-03-28 17:08:36 -04:00
Irit Katriel 15ba8167d7
bpo-26120: make pydoc exclude __future__ imports from the data block of the module (GH-30888) 2022-03-28 22:02:57 +01:00
Pieter Eendebak 850687df47
bpo-47070: Add _PyBytes_Repeat() (GH-31999)
Use it where appropriate: the repeat functions of `array.array`, `bytes`, `bytearray`, and `str`.
2022-03-28 04:43:45 -04:00
ty f6b3a07b7d
bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866)
Add missing terminated NUL in sockaddr_un's length

- Linux: https://man7.org/linux/man-pages/man7/unix.7.html
- *BSD: SUN_LEN
2022-03-27 13:22:22 -07:00
Kumar Aditya 58448cbd96
bpo-47127: Specialize calls for fastcall c methods with keywords (GH-32125)
* add PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS
2022-03-28 03:53:25 +08:00
Jouke Witteveen 5ca6d7469b
bpo-45171: Fix stacklevel handling in logging. (GH-28287) 2022-03-27 14:49:28 +01:00
Christian Heimes 5fd8c574e0
bpo-47098: Replace Keccak Code Package with tiny_sha3 (GH-32060) 2022-03-26 21:36:08 +01:00
Christian Heimes b16b6bb8da
bpo-47095: Use libb2 to provide blake2 implementation (GH-32059) 2022-03-26 20:52:24 +01:00
Matthew Rahtz e8e737bcf6
bpo-43224: Implement PEP 646 grammar changes (GH-31018)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-26 09:55:35 -07:00
Pablo Galindo Salgado 26cca8067b
bpo-47117: Don't crash if we fail to decode characters when the tokenizer buffers are uninitialized (GH-32129)
Automerge-Triggered-By: GH:pablogsal
2022-03-26 09:29:02 -07:00
Duprat d03acd7270
bpo-43352: Add a Barrier object in asyncio lib (GH-24903)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-26 00:01:21 +02:00
Dennis Sweeney cca43b7d64
bpo-47053: Reduce deoptimization in BINARY_OP_INPLACE_ADD_UNICODE (GH-31318)
* Don't deopt if refcounts are too big

* Detect more at specialization time
2022-03-25 16:13:19 +00:00
Mark Shannon d7163bb35d
bpo-42197: Don't create `f_locals` dictionary unless we actually need it. (GH-32055)
* `PyFrame_FastToLocalsWithError` and `PyFrame_LocalsToFast` are no longer called during profile and tracing.
 (Contributed by Fabio Zadrozny)

* Make accesses to a frame's `f_locals` safe from C code, not relying on calls to `PyFrame_FastToLocals` or `PyFrame_LocalsToFast`.

* Document new `PyFrame_GetLocals` C-API function.
2022-03-25 12:57:50 +00:00
Christian Heimes 8a0a9e5b19
bpo-40280: Add wasm32-emscripten and wasm32-wasi SOABI (GH-32095)
Shared extension on Emscripten now have suffix
``.cpython-311-wasm32-emscripten.so`` (JS loader) and
``.cpython-311-wasm32-emscripten.wasm`` (WebAssembly code).
2022-03-24 14:09:42 -07:00
Andrew Svetlov 4119d2d7c9
bpo-47062: Implement asyncio.Runner context manager (GH-31799)
Co-authored-by: Zachary Ware <zach@python.org>
2022-03-24 21:51:16 +02:00
Andrew Svetlov ff619c7dfe
bpo-47104: Rewrite asyncio.to_thread tests to use IsolatedAsyncioTestCase (GH-32086) 2022-03-23 23:17:07 +02:00
Christian Heimes 48e2010d92
bpo-47101: list only activated algorithms in hashlib.algorithms_available (GH-32076) 2022-03-23 13:30:05 -07:00
Russel Webber c62b944dfc
bpo-31582: Created a new documentation section describing sys.path initialization (GH-31082) 2022-03-23 17:29:40 +00:00
Andrew Svetlov 0360e9f346
bpo-46829: Deprecate passing a message into Future.cancel() and Task.cancel() (GH-31840)
After a long deliberation we ended up feeling that the message argument for Future.cancel(), added in 3.9, was a bad idea, so we're deprecating it in 3.11 and plan to remove it in 3.13.
2022-03-23 08:43:05 -07:00
Kumar Aditya bd1cf6ecee
bpo-47012: speed up iteration of bytes and bytearray (GH-31867) 2022-03-23 04:30:05 -04:00
Daniël van Noord 7ba7eae508
bpo-2604: Make doctest.DocTestCase reset globs in teardown (GH-31932)
Co-authored-by: Piet Delport
Co-authored-by: Hugo Lopes Tavares
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-22 14:01:15 -07:00
Serhiy Storchaka 492d4109f4
bpo-42885: Optimize search for regular expressions starting with "\A" or "^" (GH-32021)
Affected functions are re.search(), re.split(), re.findall(), re.finditer()
and re.sub().
2022-03-22 17:27:55 +02:00
Andrew Svetlov 32e77154dd
bpo-45997: Fix asyncio.Semaphore re-acquiring order (GH-31910)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-03-22 16:02:51 +02:00
Mark Shannon 49daf6dba8
bpo-47045: Remove `f_state` field (GH-31963)
* Remove the f_state field from _PyInterpreterFrame

*  Make ownership of the frame explicit, replacing the is_generator field with an owner field.
2022-03-22 12:57:19 +00:00
Pablo Galindo Salgado 7d810b6a4e
bpo-46838: Syntax error improvements for function definitions (GH-31590) 2022-03-22 11:38:41 +00:00
Christian Heimes deeaac49e2
bpo-40280: Skip socket, fork, subprocess tests on Emscripten (GH-31986)
- Add requires_fork and requires_subprocess to more tests
- Skip extension import tests if dlopen is not available
- Don't assume that _testcapi is a shared extension
- Skip a lot of socket tests that don't work on Emscripten
- Skip mmap tests, mmap emulation is incomplete
- venv does not work yet
- Cannot get libc from executable

The "entire" test suite is now passing on Emscripten with EMSDK from git head (91 suites are skipped).
2022-03-22 03:04:36 -07:00
Serhiy Storchaka a25a985535
bpo-28080: Add support for the fallback encoding in ZIP files (GH-32007)
* Add the metadata_encoding parameter in the zipfile.ZipFile constructor.
* Add the --metadata-encoding option in the zipfile CLI.

Co-authored-by: Stephen J. Turnbull <stephen@xemacs.org>
2022-03-22 11:52:55 +02:00
Serhiy Storchaka c6cd3cc93c
bpo-47081: Replace "qualifiers" with "quantifiers" in the re module documentation (GH-32028)
It is a more commonly used term.
2022-03-22 11:44:47 +02:00
Christian Heimes 4f97d64c83
bpo-45150: Add hashlib.file_digest() for efficient file hashing (GH-31930) 2022-03-22 02:37:00 -07:00
Steve Dower 3751b6b030
bpo-47086: Remove .chm from Windows installer and add HTML docs (GH-32038) 2022-03-22 01:08:37 +00:00
Brett Cannon 9ac2de922a
bpo-47061: document module deprecations due to PEP 594 (GH-31984)
Also removed asynchat, asyncore, and smtpd from their respective toctree entries so they are only  in the superceded subtree.
2022-03-21 16:16:37 -07:00
penguin_wwy 1ea055bd53
bpo-47067: Optimize calling GenericAlias objects (GH-31996)
Use vectorcall, and replace `PyObject_SetAttrString` with `PyObject_SetAttr` and a global string.
2022-03-21 16:33:02 -04:00
Serhiy Storchaka 345b390ed6
bpo-433030: Add support of atomic grouping in regular expressions (GH-31982)
* Atomic grouping: (?>...).
* Possessive quantifiers: x++, x*+, x?+, x{m,n}+.
  Equivalent to (?>x+), (?>x*), (?>x?), (?>x{m,n}).

Co-authored-by: Jeffrey C. Jacobs <timehorse@users.sourceforge.net>
2022-03-21 18:28:22 +02:00
Brandt Bucher 2bde6827ea
bpo-46841: Quicken code in-place (GH-31888)
* Moves the bytecode to the end of the corresponding PyCodeObject, and quickens it in-place.

* Removes the almost-always-unused co_varnames, co_freevars, and co_cellvars member caches

* _PyOpcode_Deopt is a new mapping from all opcodes to their un-quickened forms.

* _PyOpcode_InlineCacheEntries is renamed to _PyOpcode_Caches

* _Py_IncrementCountAndMaybeQuicken is renamed to _PyCode_Warmup

* _Py_Quicken is renamed to _PyCode_Quicken

* _co_quickened is renamed to _co_code_adaptive (and is now a read-only memoryview).

* Do not emit unused nonzero opargs anymore in the compiler.
2022-03-21 11:11:17 +00:00
Serhiy Storchaka 08eb754d84
bpo-23691: Protect the re.finditer() iterator from re-entering (GH-32012) 2022-03-21 13:00:43 +02:00
Victor Stinner e63894b3ee
bpo-46850: Remove _PyEval_CallTracing() function (GH-32019)
Remove the private undocumented function _PyEval_CallTracing() from
the C API. Call the public sys.call_tracing() function instead.
2022-03-21 03:03:22 +01:00
Victor Stinner 9087243e2c
bpo-46850: Remove _PyEval_GetCoroutineOriginTrackingDepth() (GH-32018)
Remove the private undocumented function
_PyEval_GetCoroutineOriginTrackingDepth() from the C API. Call the
public sys.get_coroutine_origin_tracking_depth() function instead.

Change the internal function
_PyEval_SetCoroutineOriginTrackingDepth():

* Remove the 'tstate' parameter;
* Add return value and raises an exception if depth is negative;
* No longer export the function: call the public
  sys.set_coroutine_origin_tracking_depth() function instead.

Uniformize also function declarations in pycore_ceval.h.
2022-03-21 02:24:00 +01:00
Victor Stinner 332b04bac3
bpo-46850: Remove _PyEval_SetAsyncGenFinalizer() (GH-32017)
Remove the following private undocumented functions from the C API:

* _PyEval_GetAsyncGenFirstiter()
* _PyEval_GetAsyncGenFinalizer()
* _PyEval_SetAsyncGenFirstiter()
* _PyEval_SetAsyncGenFinalizer()

Call the public sys.get_asyncgen_hooks() and sys.set_asyncgen_hooks()
functions instead.
2022-03-21 01:15:32 +01:00
Gregory P. Smith 9d1c4d69db
bpo-38256: Fix binascii.crc32() when inputs are 4+GiB (GH-32000)
When compiled with `USE_ZLIB_CRC32` defined (`configure` sets this on POSIX systems), `binascii.crc32(...)` failed to compute the correct value when the input data was >= 4GiB. Because the zlib crc32 API is limited to a 32-bit length.

This lines it up with the `zlib.crc32(...)` implementation that doesn't have that flaw.

**Performance:** This also adopts the same GIL releasing for larger inputs logic that `zlib.crc32` has, and causes the Windows build to always use zlib's crc32 instead of our slow C code as zlib is a required build dependency on Windows.
2022-03-20 12:28:15 -07:00
Oleg Iarygin 3ae975f1ac
bpo-47015: Update test_os from asyncore to asyncio (GH-31876) 2022-03-20 16:39:12 +02:00
Kevin Mehall e730ae7eff
bpo-42369: Fix thread safety of zipfile._SharedFile.tell (GH-26974)
The `_SharedFile` tracks its own virtual position into the file as
`self._pos` and updates it after reading or seeking. `tell()` should
return this position instead of calling into the underlying file object,
since if multiple `_SharedFile` instances are being used concurrently on
the same file, another one may have moved the real file position.
Additionally, calling into the underlying `tell` may expose thread
safety issues in the underlying file object because it was called
without taking the lock.
2022-03-20 16:26:09 +02:00
Ma Lin b3f2d4c8ba
bpo-47040: improve document of checksum functions (gh-31955)
Clarifies a versionchanged note on crc32 & adler32 docs that the workaround is only needed for Python 2 and earlier.
Also cleans up an unnecessary intermediate variable in the implementation.

Authored-By: Ma Lin / animalize
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-03-19 14:42:04 -07:00
Arie Bovenberg 82e9b0bb0a
bpo-46382 dataclass(slots=True) now takes inherited slots into account (GH-31980)
Do not include any members in __slots__ that are already in a base class's __slots__.
2022-03-19 17:01:17 -04:00
Serhiy Storchaka 92a6abf72e
bpo-47066: Convert a warning about flags not at the start of the regular expression into error (GH-31994) 2022-03-19 16:10:44 +02:00
Serhiy Storchaka 4142961b9f
bpo-39394: Improve warning message in the re module (GH-31988)
A warning about inline flags not at the start of the regular
expression now contains the position of the flag.
2022-03-19 14:13:31 +02:00
Andrew Svetlov 0a8b8e0d26
bpo-47057: Use FASTCALL convention for FutureIter.throw() (GH-31973)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-03-19 14:01:46 +02:00
Hugo van Kemenade 7747384643
bpo-47022: Document asynchat, asyncore and smtpd removals in 3.12 (GH-31891)
Document the deprecation of asyncore, asynchat, and smtpd with a slated removal in Python 3.12 thanks to PEP 594.
2022-03-18 12:45:37 -07:00
Pablo Galindo Salgado 8e3fde728f
bpo-46968: Check for 'sys/auxv.h' in the configure script (GH-31961) 2022-03-18 05:03:22 -07:00
Christian Heimes d190a9351b
bpo-47037: Don't test for strftime('%4Y') on Windows (GH-31945) 2022-03-18 11:27:20 +00:00
Miro Hrončok 48d9262699
bpo-45413: Define "posix_venv", "nt_venv" and "venv" sysconfig installation schemes (GH-31034)
Define *posix_venv* and *nt_venv* sysconfig installation schemes
to be used for bootstrapping new virtual environments.
Add *venv* sysconfig installation scheme to get the appropriate one of the above.
The schemes are identical to the pre-existing
*posix_prefix* and *nt* install schemes.
The venv module now uses the *venv* scheme to create new virtual environments
instead of hardcoding the paths depending only on the platform. Downstream
Python distributors customizing the *posix_prefix* or *nt* install
scheme in a way that is not compatible with the install scheme used in
virtual environments are encouraged not to customize the *venv* schemes.
When Python itself runs in a virtual environment,
sysconfig.get_default_scheme and
sysconfig.get_preferred_scheme with `key="prefix"` returns
*venv*.
2022-03-18 10:53:29 +01:00
Serhiy Storchaka cd44afc573
bpo-40296: Fix supporting generic aliases in pydoc (GH-30253) 2022-03-18 11:05:18 +02:00
Bader Zaidan a0db11b10f
bpo-46421: Fix unittest filename evaluation when called as a module (GH-30654) 2022-03-17 16:37:52 -07:00
Pieter Eendebak ac8308d3ea
bpo-47005: Improve performance of bytearray_repeat and bytearray_irepeat (GH-31856) 2022-03-17 19:10:36 -04:00
Andrew Svetlov 903f0a02c1
bpo-34790: Remove passing coroutine objects to asyncio.wait() (GH-31964)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
2022-03-17 22:51:40 +02:00
David CARLIER 33698e8ff4
bpo-46030: socket module add couple of FreeBSD constants. (GH-30018)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-17 22:40:00 +02:00
Mark Shannon 3011a097bd
Use low bit of LOAD_GLOBAL's oparg to indicate whether it should push an additional NULL. (GH-31933) 2022-03-17 16:14:57 +00:00
Serhiy Storchaka c2e3c06139
bpo-46996: Remove support of Tcl/Tk < 8.5.12 (GH-31839) 2022-03-17 13:05:52 +02:00
Serhiy Storchaka 15df8f8d89
bpo-46981: Remove typing._TypingEmpty (GH-31836)
* get_args(Tuple[()]) now returns () instead of ((),).
* Tuple[Unpack[Ts]][()] now returns the result equal to Tuple[()].
2022-03-17 09:52:24 +02:00
Erlend Egeberg Aasland 4674fd4e93
bpo-44859: Raise more accurate exceptions in `sqlite3` (GH-27695)
* Improve exception compliance with PEP 249
* Raise InterfaceError instead of ProgrammingError for SQLITE_MISUSE.
  If SQLITE_MISUSE is raised, it is a sqlite3 module bug. Users of the
  sqlite3 module are not responsible for using the SQLite C API correctly.
* Don't overwrite BufferError with ValueError when conversion to BLOB fails.
* Raise ProgrammingError instead of Warning if user tries to execute() more
  than one SQL statement.
* Raise ProgrammingError instead of ValueError if an SQL query contains null characters.
* Make sure `_pysqlite_set_result` raises an exception if it returns -1.
2022-03-16 22:58:25 -07:00
Jelle Zijlstra 96568e995d
bpo-46480: add typing.assert_type (GH-30843)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: David Foster <david@dafoster.net>
2022-03-16 20:02:26 -07:00
Carlos Damazio 7c353b7594
bpo-22859: deprecate unittest.main.TestProgram.usageExit (GH-30293)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-16 19:41:02 -07:00
Andrew Svetlov 30b5d41fab
bpo-47039: Normalize repr() of asyncio future and task objects (GH-31950) 2022-03-17 03:03:09 +02:00
Steve Dower 7c77652141
bpo-47032: Ensure Windows install builds fail correctly with a non-zero exit code when part of the build fails (GH-31921) 2022-03-16 01:36:20 +00:00
Christian Heimes af0a50de4b
bpo-47024: Update OpenSSL to 1.1.1n (GH-31895)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2022-03-15 21:03:04 +01:00
Mariusz Felisiak a8c728b8b7
bpo-46907: Update Windows installer to SQLite 3.38.1. (GH-31655) 2022-03-15 16:55:10 +00:00
Mariusz Felisiak ea786a882b
bpo-46907: Update macOS installer to SQLite 3.38.1. (GH-31656) 2022-03-15 11:04:41 -04:00
Maximilian Hils 70155412f1
bpo-43253: Don't call shutdown() for invalid socket handles (GH-31892) 2022-03-15 16:59:02 +02:00
Kumar Aditya 6dfe09fc5f
bpo-46993: Speed up bytearray creation from list and tuple (GH-31834) 2022-03-15 15:27:30 +02:00
Kumar Aditya 5dd7ec52b8
bpo-20392: Fix inconsistency with uppercase file extensions in mimetypes.guess_type (GH-30229) 2022-03-15 15:25:43 +02:00
Christian Heimes 2cf7f865f0
bpo-46587: Skip tests if strftime does not support glibc extension (GH-31873)
Co-authored-by: Victor Stinner <vstinner@python.org>
2022-03-15 10:41:04 +01:00
Michael P. Nitowski d8066b420b
bpo-46557: Log captured warnings without format string (GH-30975) 2022-03-15 09:01:03 +00:00
Hugo van Kemenade 16995ed0f2
But Add missing newline to NEWS entry (GH-31893) 2022-03-15 08:29:10 +00:00
Irit Katriel e3d348a525
bpo-43721: Fix docstrings for property.getter/setter/deleter (GH-31046) 2022-03-14 23:28:54 +00:00
Ned Deily 19f69993ae
Revert "bpo-46986: Upgrade bundled setuptools to 60.9.3 (GH-31820)" (GH-31879)
This reverts commit c99ac3c364
as it breaks test_bdb and test_distutils with installed Pythons.
2022-03-14 16:30:46 -04:00
Christian Heimes f00ced8396
bpo-40280: select: Use NULL for empty fdset (GH-31865)
wasm32-emscripten does not support exceptfds and requires NULL. Python
now passes NULL instead of a fdset pointer when the input list is empty.
This works fine on all platforms and might even be a tiny bit faster.
2022-03-14 14:40:28 +01:00
Dong-hee Na bb1c543f4a
bpo-46987: Remove _PySys_GetObjectId / _PySys_GetObjectId (GH-31835) 2022-03-14 21:48:00 +09:00
Andrew Svetlov 9523c0d84f
bpo-46994: Accept explicit contextvars.Context in asyncio create_task() API (GH-31837) 2022-03-14 13:54:13 +02:00
Crowthebird 2153daf0a0
bpo-39829: Fix `__len__()` is called twice in list() constructor (GH-31816) 2022-03-14 10:23:59 +09:00
Jason R. Coombs b1e2868607
bpo-47004: Sync with importlib_metadata 4.11.3. (#31854) 2022-03-13 15:53:29 -04:00
Pradyun Gedam c99ac3c364
bpo-46986: Upgrade bundled setuptools to 60.9.3 (GH-31820) 2022-03-13 14:49:28 -04:00
Pradyun Gedam d87f1b787e
bpo-46985: Upgrade bundled pip to 22.0.4 (GH-31819) 2022-03-13 14:14:20 -04:00
Alex Grönholm 9f04ee569c
bpo-46805: Add low level UDP socket functions to asyncio (GH-31455) 2022-03-13 18:42:29 +02:00
Andrew Svetlov 7e473e94a5
bpo-46995: Deprecate missing asyncio.Task.set_name() for third-party task implementations (GH-31838)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-03-13 18:34:46 +02:00
Matthew Rahtz af2277e461
bpo-43224: Implement PEP 646 changes to genericaliasobject.c (GH-31019)
Specifically, prepare for starring of tuples via a new genericalias iter type. GenericAlias also partially supports the iterator protocol after this change.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-03-12 20:20:12 +08:00
Gregory Beauregard 870b22b9c4
bpo-46644: Remove callable() requirement from typing._type_check (GH-31151)
We also remove all the tests that check for integer literals.
2022-03-11 17:12:17 -08:00
Victor Stinner 882d8096c2
bpo-46906: Add PyFloat_Pack8() to the C API (GH-31657)
Add new functions to pack and unpack C double (serialize and
deserialize):

* PyFloat_Pack2(), PyFloat_Pack4(), PyFloat_Pack8()
* PyFloat_Unpack2(), PyFloat_Unpack4(), PyFloat_Unpack8()

Document these functions and add unit tests.

Rename private functions and move them from the internal C API
to the public C API:

* _PyFloat_Pack2() => PyFloat_Pack2()
* _PyFloat_Pack4() => PyFloat_Pack4()
* _PyFloat_Pack8() => PyFloat_Pack8()
* _PyFloat_Unpack2() => PyFloat_Unpack2()
* _PyFloat_Unpack4() => PyFloat_Unpack4()
* _PyFloat_Unpack8() => PyFloat_Unpack8()

Replace the "unsigned char*" type with "char*" which is more common
and easy to use.
2022-03-12 00:10:02 +01:00
Oleksandr Pavlyk 3b128c0548
bpo-46968: Fix faulthandler for Sapphire Rapids Xeon (GH-31789)
In Linux kernel 5.14 one can dynamically request size of altstacksize
based on hardware capabilities with getauxval(AT_MINSIGSTKSZ).

This changes allows for Python extension's request to Linux kernel
to use AMX_TILE instruction set on Sapphire Rapids Xeon processor
to succeed, unblocking use of the ISA in frameworks.

Introduced HAVE_LINUX_AUXVEC_H in configure.ac and pyconfig.h.in
Used cpython_autoconf:269 docker container to generate configure.
2022-03-11 23:19:35 +01:00
Victor Stinner dc374ac7b0
bpo-46968: Add os.sysconf_names['SC_MINSIGSTKSZ'] (GH-31824) 2022-03-11 23:01:40 +01:00
Kumar Aditya 304197b382
bpo-46944: use FASTCALL calling convention in generator.throw (GH-31723) 2022-03-11 14:37:14 +00:00
Christian Heimes 434ffb7f1f
bpo-46973: Add regen-configure make target (GH-31792) 2022-03-10 18:03:27 +01:00
Victor Stinner 7854012077
bpo-46917: math.nan is now always available (GH-31793) 2022-03-10 17:47:18 +01:00
Andrew Svetlov f537b2a4fb
bpo-46771: Implement asyncio context managers for handling timeouts (GH-31394)
Example:

async with asyncio.timeout(5):
    await some_task()

Will interrupt the await and raise TimeoutError if some_task() takes longer than 5 seconds.

Co-authored-by: Guido van Rossum <guido@python.org>
2022-03-10 08:05:20 -08:00
Matt Bogosian 32bf359792
bpo-46581: Propagate private vars via _GenericAlias.copy_with (GH-31061)
GH-26091 added the _typevar_types and _paramspec_tvars instance
variables to _GenericAlias. However, they were not propagated
consistently. This commit addresses the most prominent deficiency
identified in bpo-46581 (namely their absence from
_GenericAlias.copy_with), but there could be others.

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-03-10 16:42:15 +02:00
Victor Stinner 9b51fd5d13
bpo-46917: Require IEEE 754 to build Python (GH-31790)
Building Python now requires support of IEEE 754 floating point
numbers.
2022-03-10 14:37:19 +01:00
Kumar Aditya 8714b6fa27
bpo-46881: Statically allocate and initialize the latin1 characters. (GH-31616) 2022-03-09 15:02:00 -08:00
Erlend Egeberg Aasland e801e88744
bpo-45138: Revert GH-28240: Expand traced SQL statements (GH-31788)
This reverts commit d1777515f9.

Automerge-Triggered-By: GH:JelleZijlstra
2022-03-09 09:39:49 -08:00
Serhiy Storchaka 02fbaf4887
bpo-46245: Add optional parameter dir_fd in shutil.rmtree() (GH-30365) 2022-03-09 14:29:33 +02:00
Erlend Egeberg Aasland d1777515f9
bpo-45138: Expand traced SQL statements in `sqlite3` trace callback (GH-28240) 2022-03-08 18:46:40 -08:00
Irit Katriel 88b7d86a73
bpo-24959: fix unittest.assertRaises bug where traceback entries are dropped from chained exceptions (GH-23688) 2022-03-08 21:43:49 +00:00
Stefan Zabka da80d6b2f3
bpo-46955: Expose asyncio.base_events.Server as asyncio.Server (GH-31760)
This change aligns the documentation at https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.Server
with the actual implementation

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-08 23:07:33 +02:00
Christian Heimes c8a47e76a3
bpo-23325: Fix SIG_IGN and SIG_DFL int comparison in signal module (GH-31759) 2022-03-08 10:22:32 -08:00
Brandt Bucher 5498a61c7c
bpo-46841: Don't use an oparg counter for `STORE_SUBSCR` (GH-31742) 2022-03-08 15:53:22 +00:00
Ma Lin 36dd7396fc
bpo-44439: _ZipWriteFile.write() handle buffer protocol correctly (GH-29468)
Co-authored-by: Marco Ribeiro <marcoffee@users.noreply.github.com>
2022-03-08 11:33:56 +02:00
Taneli Hukkinen 591f6754b5
bpo-40059: Add tomllib (PEP-680) (GH-31498)
This adds a new standard library module, `tomllib`, for parsing TOML.

The implementation is based on Tomli (https://github.com/hukkin/tomli).

## Steps taken (converting `tomli` to `tomllib`)

- Move everything in `tomli:src/tomli` to `Lib/tomllib`. Exclude `py.typed`.
- Remove `__version__ = ...` line from `Lib/tomllib/__init__.py`
- Move everything in `tomli:tests` to `Lib/test/test_tomllib`. Exclude the following test data dirs recursively:
  - `tomli:tests/data/invalid/_external/`
  - `tomli:tests/data/valid/_external/`
- Create `Lib/test/test_tomllib/__main__.py`:

  ```python
  import unittest

  from . import load_tests


  unittest.main()
  ```


- Add the following to `Lib/test/test_tomllib/__init__.py`:

  ```python
  import os
  from test.support import load_package_tests

  def load_tests(*args):
      return load_package_tests(os.path.dirname(__file__), *args)
  ```

  Also change `import tomli as tomllib` to `import tomllib`.

- In `cpython/Lib/tomllib/_parser.py` replace `__fp` with `fp` and `__s` with
  `s`. Add the `/` to `load` and `loads` function signatures.

- Run `make regen-stdlib-module-names`

- Create `Doc/library/tomllib.rst` and reference it in `Doc/library/fileformats.rst`
2022-03-08 09:26:13 +01:00
Matthew Rahtz 7a793a388b
bpo-43224: Implement PEP 646 changes to typing.py (GH-31021)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-07 20:02:55 -08:00
James Hilton-Balfe f391f9bf28
bpo-46170: Improve the error message when subclassing NewType (GH-30268)
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-03-07 19:50:46 -08:00