Keywords are present in the main module tab completion lists generated by rlcompleter, which is used by REPLs on *nix. Add all keywords to IDLE's main module name list except those already added from builtins (True, False, and None) . This list may also be used by Show Completions on the Edit menu, and its hot key.
Rewrite Completions doc.
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
(cherry picked from commit bce2eb4646)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
- Mention that some compiler optimizations might not roundtrip
exactly (such as constant tuples and frozensets).
- Add a warning about it might raise RecursionError on very
complex expressions due to the recursive unparsing aspect of ast.unparse
(cherry picked from commit 8df1016)
* Add a glossary entry for the term "callback"
* Link to it in loop.call_soon() and in the "Concurrency and Multithreading" section
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit a16d697049)
Co-authored-by: Roger Iyengar <ri@rogeriyengar.com>
The doccumentation at https://docs.python.org/3.10/library/weakref.html cautions that the `WeakKeyDictionary` and `WeakValueDictionary` are susceptible to the problem of dictionary mutation during iteration.
These notes present the user with a problem that has no easy solution.
I dug into the implementation and found that fortunately, Antoine Pitrou already addressed this challenge (10 years ago!) by introducing an `_IterationGuard` context manager to the implementation, which delays mutation while an iteration is in progress.
I asked for confirmation and @pitrou agreed that these notes could be removed:
c1baa601e2GH-commitcomment-39514438
(cherry picked from commit 1642c0ef75)
Co-authored-by: Daniel Fortunov <asqui@users.noreply.github.com>
Looks like the merging of bpo-33187 and bpo-20928 was racy, resulting in
this change going undocumented.
(cherry picked from commit 301f0d4ff9)
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
Also added an example in shutil in order to make more clear how they are to be used.
Initially reported by Weinan Li on bpo.
(cherry picked from commit 7633371dac)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* Refresh importlib.metadata from importlib_metadata 1.6.1.
* 📜🤖 Added by blurb_it.
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 161541ab45)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Before
```
content.txt is 42 bytes in size and isa regular file.
folder is 420 bytes in size and isa directory.
magic is 4200 bytes in size and issomething else.
```
After:
```
content.txt is 42 bytes in size and is a regular file.
folder is 420 bytes in size and is a directory.
magic is 4200 bytes in size and is something else.
```
Automerge-Triggered-By: @orsenthil
(cherry picked from commit 7a280197f4)
Co-authored-by: Harsha Laxman <HarshaLaxman@users.noreply.github.com>
* bpo-40630: Add tracemalloc.reset_peak (GH-20102, cherrypick 8b62644)
The reset_peak function sets the peak memory size to the current size,
representing a resetting of that metric. This allows for recording the
peak of specific sections of code, ignoring other code that may have
had a higher peak (since the most recent `tracemalloc.start()` or
tracemalloc.clear_traces()` call).
* Adjust docs to point to 3.9
The topological sort functionality that was introduced initially in the
functools module has been moved to a new graphlib module to
better accommodate the new tools and keep the original scope of the
functools module.
(cherry picked from commit 2f172d8f15)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
When I wrote the documentation for `asyncio.to_thread()`, I mistakenly assumed that `return await loop.run_in_executor(...)` within an async def function would return a Future. In reality, it returns a coroutine.
This likely won't affect typical usage of `asyncio.to_thread()`, but it's important for the documentation to be correct here. In general, we also tend to avoid returning futures from high-level APIs in asyncio.
(cherry picked from commit 2b201369b4)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Reference to PySide has been removed has it is for Qt 4, which has reached end of life.
(cherry picked from commit 4649202ea7)
Co-authored-by: Samuel Gaist <samuel.gaist@idiap.ch>
Try to make the meaning of platlibdir clear. The previous wording could
be misinterpreted to suggest that it will be used to find all shared
libraries on the system, and not just Python extensions. Furthermore,
it was unclear whether it affects third-party (site-packages) extensions
or not. The new wording tries to make its dual purpose clear,
and provide the additional example of extensions in site-packages.
(cherry picked from commit 242d95659b)
Co-authored-by: Michał Górny <mgorny@gentoo.org>
hashlib.compare_digest uses OpenSSL's CRYPTO_memcmp() function
when OpenSSL is available.
Note: The _operator module is a builtin module. I don't want to add
libcrypto dependency to libpython. Therefore I duplicated the wrapper
function and added a copy to _hashopenssl.c..
(cherry picked from commit db5aed931f)
Co-authored-by: Christian Heimes <christian@python.org>
* bpo-39301: State that floor division is used for right shift operations
* Remove "without overflow check"
(cherry picked from commit af7553ac95)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* Fix as_completed docs to correctly state the function return value.
* Also, improves the general wording of the as_completed documentation.
Co-Authored-By: Rémi Lapeyre <remi.lapeyre@henki.fr>
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
Co-Authored-By: Yury Selivanov <yury@edgedb.com>
(cherry picked from commit 13206b52d1)
Co-authored-by: Bar Harel <bzvi7919@gmail.com>
This is more informative and avoids the question of whether the period should go inside or outside the quotation marks.
See also GH-20007.
(cherry picked from commit 2e76820a50)
Co-authored-by: Mathieu Dupuy <mathieu.dupuy@doctolib.com>
Allows contextvars from the main thread to be accessed in the separate thread used in `asyncio.to_thread()`. See the [discussion](https://github.com/python/cpython/pull/20143GH-discussion_r427808225) in GH-20143 for context.
Automerge-Triggered-By: @aeros
(cherry picked from commit 0f56263e62)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
```
Warning, treated as error:
/tmp/code/Doc/library/zoneinfo.rst:303:Error in "code-block" directive:
1 argument(s) required, 0 supplied.
.. code-block::
>>> a = ZoneInfo("Europe/Berlin")
>>> b = pickle.loads(europe_berlin_pkl)
>>> a is b
True
```
(cherry picked from commit 9095f76613)
Co-authored-by: Anthony Sottile <asottile@umich.edu>
Implements `asyncio.to_thread`, a coroutine for asynchronously running IO-bound functions in a separate thread without blocking the event loop. See the discussion starting from [here](https://github.com/python/cpython/pull/18410GH-issuecomment-628930973) in GH-18410 for context.
Automerge-Triggered-By: @aeros
(cherry picked from commit cc2bbc2227)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
This was not specified in the PEP, but it will likely be a frequently requested feature if it's not included.
This includes only the "canonical" zones, not a simple listing of every valid value of `key` that can be passed to `Zoneinfo`, because it seems likely that that's what people will want.