Commit Graph

28071 Commits

Author SHA1 Message Date
Tian Gao b034f14a4b
gh-74929: Implement PEP 667 (GH-115153) 2024-05-04 12:12:10 +01:00
Irit Katriel 85af789961
gh-111997: C-API for signalling monitoring events (#116413) 2024-05-04 08:23:50 +00:00
Raymond Hettinger 42dc5b4ace
gh-115532 Add kde_random() to the statistic module (#118210) 2024-05-03 23:13:36 -05:00
Raymond Hettinger 6d9e8e989e
Minor improvements to the itertools recipes (#118563) 2024-05-03 17:07:47 -05:00
Ned Batchelder 9d67b72a49
docs: clarify csv.DictReader's treatment of the first data row (#118549) 2024-05-03 08:48:27 -07:00
Brett Simmers c2627d6eea
gh-116322: Add Py_mod_gil module slot (#116882)
This PR adds the ability to enable the GIL if it was disabled at
interpreter startup, and modifies the multi-phase module initialization
path to enable the GIL when loading a module, unless that module's spec
includes a slot indicating it can run safely without the GIL.

PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went
with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148.

A warning will be issued up to once per interpreter for the first
GIL-using module that is loaded. If `-v` is given, a shorter message
will be printed to stderr every time a GIL-using module is loaded
(including the first one that issues a warning).
2024-05-03 11:30:55 -04:00
Sam Gross 2dae505e87
gh-117514: Add `sys._is_gil_enabled()` function (#118514)
The function returns `True` or `False` depending on whether the GIL is
currently enabled. In the default build, it always returns `True`
because the GIL is always enabled.
2024-05-03 11:09:57 -04:00
Jelle Zijlstra ca269e58c2
gh-116126: Implement PEP 696 (#116129)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-05-03 06:17:32 -07:00
Nice Zombies 852263e108
gh-117492: Clarify documentation of `typing.Never` (#117678)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-05-03 06:02:11 -07:00
Tian Gao 4e2caf2aa0
gh-118500: Add pdb support for zipapp (#118501) 2024-05-02 21:53:27 +01:00
Pablo Galindo Salgado 6bcbee09df
gh-93502: Add new C-API functions to trace object creation and destruction (#115945) 2024-05-02 19:30:00 +02:00
Raphael Gaschignard 2770d5caca
gh-105879: Add support for keyword arguments to eval and exec (#105885)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-02 08:55:29 -07:00
Steve Dower 81939dad77
gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) 2024-05-02 15:20:43 +01:00
Serhiy Storchaka b3372481b6
gh-117903: Clarify that the staticmethod descriptor is callable (GH-117925) 2024-05-02 16:56:33 +03:00
Crowthebird 7c97dc8c95
gh-118216: Don't consider dotted `__future__` imports (#118267) 2024-05-02 06:32:20 -07:00
Andrew Zipperer a6b610a94b
docs: typo: tiny grammar change: "pointed by" -> "pointed to by" (#118411)
* docs: tiny grammar change: "pointed by" -> "pointed to by"

This commit uses "file pointed to by" to replace "file pointed by" in
 - doc for shutil.copytree
 - docstring for shutil.copytree
 - docstring _abc.PathBase.open
 - docstring for pathlib.Path.open
 - doc for os.copy_file_range
 - doc for os.splice

The docs use "file pointed to by" more frequently than
"file pointed by". So, this commit replaces the uses of
"file pointed by" in order to make the uses consistent
through the docs.

```bash
$ grep -ri 'pointed to by' cpython/
```
yields more results than
```bash
$ grep -ri 'pointed by' cpython/
```

Separately:

There are two occurrences of "tree pointed by":
 - cpython/Doc/library/xml.etree.elementtree.rst for
     `xml.etree.ElementInclude.include`
 - cpython/Lib/xml/etree/ElementInclude.py for `include`

For those uses of "tree pointed by", I expect "tree pointed to by"
instead. However, I found enough uses online of (a) "tree pointed by"
rather than (b) "tree pointed to by" to convince me that (a) is in
common use.

So, this commit does not replace those occurrences of "tree pointed by"
to "tree pointed to by". But I will replace them if a reviewer
believes it is correct to replace them.

* docs: typo: "exists and executable" -> "exists and is executable"

---------

Co-authored-by: Andrew-Zipperer <atzipperer@gmail.com>
2024-05-02 05:37:12 +00:00
Guido van Rossum a37b093228
gh-118335: Rename --experimental-interpreter on Windows to --experimental-jit-interpreter (#118497)
Also fix docs for this in whatsnew.
2024-05-02 00:48:34 +00:00
Filipe Laíns 97feb4a78b
GH-118174: specify the type for the path argument of shutil.which 2024-05-02 00:13:32 +01:00
Hugo van Kemenade 164e2c31c0
gh-117225: Document colour use in `doctest` (#118268) 2024-05-01 12:25:11 -06:00
Victor Stinner b52c753e0f
gh-110850: Add PyTime_TimeRaw() function (#118394)
Add "Raw" variant of PyTime functions:

* PyTime_MonotonicRaw()
* PyTime_PerfCounterRaw()
* PyTime_TimeRaw()

Changes:

* Add documentation and tests. Tests release the GIL while calling
  raw clock functions.
* py_get_system_clock() and py_get_monotonic_clock() now check that
  the GIL is hold by the caller if raise_exc is non-zero.
* Reimplement "Unchecked" functions with raw clock functions.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-01 18:05:01 +00:00
Jason R. Coombs a8bcf3ec32
Expand the 'Extending' docs with an example. (#113187)
* Expand the 'Extending' docs to provide a minimal example. Closes python/importlib_metadata#427.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-01 17:04:02 +00:00
Guido van Rossum 7d83f7bcc4
gh-118335: Configure Tier 2 interpreter at build time (#118339)
The code for Tier 2 is now only compiled when configured
with `--enable-experimental-jit[=yes|interpreter]`.

We drop support for `PYTHON_UOPS` and -`Xuops`,
but you can disable the interpreter or JIT
at runtime by setting `PYTHON_JIT=0`.
You can also build it without enabling it by default
using `--enable-experimental-jit=yes-off`;
enable with `PYTHON_JIT=1`.

On Windows, the `build.bat` script supports
`--experimental-jit`, `--experimental-jit-off`,
`--experimental-interpreter`.

In the C code, `_Py_JIT` is defined as before
when the JIT is enabled; the new variable
`_Py_TIER2` is defined when the JIT *or* the
interpreter is enabled. It is actually a bitmask:
1: JIT; 2: default-off; 4: interpreter.
2024-04-30 18:26:34 -07:00
Miro Hrončok f7747f73a9
gh-109975: Document crypt_r as a possible replacement of crypt (#118439) 2024-04-30 21:25:25 +03:00
Tian Gao d7ac427a79
gh-117618: Make package.module searchable for breakpoints and clean up docs (#117619) 2024-04-30 18:18:01 +00:00
edson duarte 0f797402bc
gh-85453: Consistent backquotes on None occurences across datetime.rst (#118282) 2024-04-30 10:34:15 +02:00
Donghee Na 11cbf77f97
gh-118392: Add note about random.random for multi thread app (gh-118396) 2024-04-30 13:42:13 +09:00
Tian Gao 8e4fb5d260
gh-118359: Improve docs for Bdb.user_call (#118368)
The `argument_list` parameter of bdb.Bdb.user_call has been useless for 25 years. It is retained for backwards compatibility, but it will always be None.
2024-04-29 21:57:49 +01:00
Hugo van Kemenade 8d4b756fd3
Docs: Upgrade to Sphinx 7.3 (#118397) 2024-04-29 11:40:50 -06:00
Xie Yanbo 98739c9078
Fix typo in Doc/c-api/exceptions.rst (GH-118371) 2024-04-29 14:02:54 +03:00
Xie Yanbo 0315521c52
Fix typo in Doc/howto/timerfd.rst (GH-118376) 2024-04-29 14:01:03 +03:00
Xie Yanbo 030fcc47fb
Fix typo in Doc/c-api/typeobj.rst (GH-118377) 2024-04-29 10:59:38 +00:00
Erlend E. Aasland c7e7bfc4ca
gh-115119: Detect _decimal dependencies using pkg-config (#115406)
pkg-config is supported for libmpdec 4.0.0 and newer.
2024-04-29 08:58:57 +02:00
Henrik Tunedal 133c1a7cdb
gh-118293: Suppress mouse cursor feedback when launching Windows processes with multiprocessing (GH-118315) 2024-04-28 21:10:44 +00:00
Hugo van Kemenade f5b7e397c0
gh-101100: Fix Sphinx warnings in `whatsnew/3.10.rst` (#118356) 2024-04-28 18:12:25 +00:00
Hugo van Kemenade 33c6cf3148
gh-101100: Fix Sphinx warnings in `library/faulthandler.rst` (#118353) 2024-04-28 12:06:45 -06:00
Hugo van Kemenade e0ab642436
gh-101100: Fix Sphinx warnings in `whatsnew/3.9.rst` (#118364) 2024-04-28 20:31:22 +03:00
Jelle Zijlstra 2326d6c868
gh-109118: Make comprehensions work within annotation scopes, but without inlining (#118160)
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-04-28 06:21:28 -07:00
Cheryl Sabella 194fd17bc6
bpo-32839: Add the after_info() method for Tkinter widgets (GH-5664) 2024-04-27 00:27:58 +03:00
Philipp A 5a4d3df2fa
Fix note in Enum.__new__ docs (#118284) 2024-04-26 07:06:53 -07:00
Kirill Podoprigora 463c20dae9
gh-117928: Bump the minimum Sphinx version to 6.2.1 (#117853)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-04-26 13:10:16 +03:00
Petr Viktorin ef940dec40
gh-118235: Skip RAISE_SYNTAX_ERROR rules in the grammar spec (GH-118237) 2024-04-26 11:01:30 +02:00
Serhiy Storchaka 93b7ed7c6b
gh-108191: Add support of positional argument in SimpleNamespace constructor (GH-108195)
SimpleNamespace({'a': 1, 'b': 2}) and SimpleNamespace([('a', 1), ('b', 2)])
are now the same as SimpleNamespace(a=1, b=2).
2024-04-25 00:39:54 +03:00
edson duarte 59a4d52973
gh-85453: Make numeric literals consistent across datetime.rst (#118245)
Remove code formatting from remaining numeric literals.
2024-04-24 20:19:54 +00:00
edson duarte 809aa9a682
gh-85453: Adapt datetime.rst to devguide recommendations for code snippets and variables (#118068)
Also remove formatting from numeric literals.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-04-24 19:53:52 +00:00
Alex Waygood 8227883d1f
gh-118013: Use weakrefs for the cache key in `inspect._shadowed_dict` (#118202) 2024-04-24 15:55:02 +01:00
Nikita Sobolev 692e902c74
gh-116023: Add `show_empty=False` to `ast.dump` (#116037)
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-04-24 11:02:38 +03:00
Animesh Kumar 0d221e9a19
Fix typo in py_compile.rst (GH-118102) 2024-04-23 17:12:49 +00:00
Shantanu 8e86579cae
gh-95754: Better error when script shadows a standard library or third party module (#113769) 2024-04-22 18:24:21 -07:00
Jelle Zijlstra 85f727c5fb
gh-109118: Allow lambdas in annotation scopes in classes (#118019) 2024-04-22 12:50:26 -07:00
tahia 8974a63f5e
bpo-18108: Adding dir_fd and follow_symlinks keyword args to shutil.chown (GH-15811)
* Adding dir_fd and follow_symlinks keyword args to shutil.chown
* Extending test_shutil.TestShutil.test_chown to include new kwargs
* Updating shutil.chown documentation

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2024-04-22 18:23:36 +00:00