Commit Graph

12143 Commits

Author SHA1 Message Date
Guy Yagev ad3c99e521
gh-92446: Improve argparse choices docs; revert bad change to lzma docs (#94627)
Based on the definition of the collections.abc classes, it is more accurate to use "sequence" instead of "container" when describing argparse choices.

A previous attempt at fixing this in #92450 was mistaken; this PR reverts that change.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-26 00:22:53 -06:00
Ilya Kulakov dbc1e696eb
gh-99308: Clarify re docs for byte pattern group names (#99311) 2022-12-25 12:25:27 +05:30
Shantanu 046cbc2080
gh-100472: Fix docs claim that compileall parameters could be bytes (#100473) 2022-12-24 14:22:49 -06:00
Bart Broere efccd04b9e
[Minor PR] Quotes in documentation changed into code blocks (#99536)
Minor formatting fix in documentation

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-24 12:17:39 -08:00
Shantanu 2e1a9ce989
gh-100428: Make float documentation more accurate (#100437)
Previously, the grammar did not accept `float("10")`.
Also implement mdickinson's suggestion of removing the indirection.
2022-12-24 14:09:31 -06:00
MonadChains f5b7b19bf1
gh-99535: Add test for inheritance of annotations and update documentation (#99990) 2022-12-24 12:07:14 -08:00
Raymond Hettinger 0769f95751
Misc Itertools recipe tweaks (GH-100493) 2022-12-24 00:21:30 -08:00
Stanley 0f6420640c
gh-77771: Add enterabs example in sched (#92716)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-23 23:21:52 -06:00
Shantanu 3e46f9fe05
gh-100268: Add is_integer method to int (#100439)
This improves the lives of type annotation users of `float` - which type checkers implicitly treat as `int|float` because that is what most code actually wants. Before this change a `.is_integer()` method could not be assumed to exist on things annotated as `: float` due to the method not existing on both types.
2022-12-23 18:30:27 -08:00
Raymond Hettinger f89de679ff
Add "strict" to dotproduct(). Add docstring. Factor-out common code. (GH-100480) 2022-12-23 15:52:16 -08:00
Raymond Hettinger 5d84966cce
GH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426) 2022-12-23 14:35:58 -08:00
Stanley c615286e85
gh-91081: Add note on WeakKeyDictionary behavior when deleting a replaced entry (#91499)
Co-authored-by: Pieter Eendebak <P.T.eendebak@tudelft.nl>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-12-20 19:27:02 -08:00
Bisola Olasehinde a2bb3b7f9d
gh-99991: improve docs on str.encode and bytes.decode (#100198)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-12-20 18:02:14 -08:00
Pablo Galindo Salgado cb60b6131b
Clarify that every thread has its own default context in contextvars (#99246) 2022-12-20 11:35:48 +00:00
Brad Wolfe 39dfbb2d5d
gh-88211: Change lower-case and upper-case to match recommendations in imaplib docs (#99625) 2022-12-20 15:40:31 +05:30
Thomas Grainger 79ccc03b62
gh-89051: Add ssl.OP_LEGACY_SERVER_CONNECT (#93927)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Fixes https://github.com/python/cpython/issues/89051
2022-12-20 09:10:30 +02:00
Stanley 36a0b1d0dd
gh-69929: re docs: Add more specific definition of \w (#92015)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-12-19 19:07:31 -08:00
Carlton Gibson 532aa4e4e0
gh-94912: Added marker for non-standard coroutine function detection (#99247)
This introduces a new decorator `@inspect.markcoroutinefunction`,
which, applied to a sync function, makes it appear async to
`inspect.iscoroutinefunction()`.
2022-12-18 11:13:24 -08:00
Jeremy Paige 1cf3d78c92
Correct CVE-2020-10735 documentation (#100306) 2022-12-18 12:41:21 +05:30
Barney Gale 5a991da329
gh-78707: deprecate passing >1 argument to `PurePath.[is_]relative_to()` (GH-94469)
This brings `relative_to()` and `is_relative_to()` more in line with other pathlib methods like `rename()` and `symlink_to()`.

Resolves #78707.
2022-12-16 16:14:27 -08:00
Ben Darnell 5234e1cbea
gh-99830: asyncio: Document returns of remove_{reader,writer} (#100302) 2022-12-16 11:04:55 -08:00
JustAnotherArchivist 5ee7eb9deb
Document that zipfile's pwd parameter is a `bytes` object (#100209) 2022-12-16 16:10:10 +05:30
Raymond Hettinger b430399d41
GH-100234: Set a default value for random.expovariate() (GH-100235) 2022-12-15 12:40:45 -06:00
Raymond Hettinger 8356c14b4f
Remove uninformative itertools recipe (GH-100253) 2022-12-15 12:39:01 -06:00
busywhitespace 9663853800
gh-100248: Add missing `ssl_shutdown_timeout` parameter in `asyncio` docs (#100249) 2022-12-14 22:27:02 +05:30
Hugo van Kemenade 3192c00a3c
gh-100176: venv: Remove redundant compat code for Python <= 3.2 (#100177)
gh-100176: Remove redundant compat code for Python 3.2 and older

Python 3.2 has been EOL since 2016-02-20 and 2.7 since 2020-01-01, so we
can remove this old compatibility check and unindent the old else-block.

Also, in the unindented block, replace a .format() call with an f-string.

Plus similar changes in the documentation.
2022-12-14 11:37:11 +00:00
Filipe Laíns d3ea82aaf9
GH-100206: use versionadded for the addition of sysconfig.get_default_scheme (#100207) 2022-12-13 12:54:07 +02:00
jarrodcolburn 8711b59f7a
Fix: typo (Indention) (GH-99904)
Example needed to be indented. Was trying to call a context manger `pr` (from ` with cProfile.Profile() as pr:`) wot perform ` pr.print_stats()` once it had already exited.

Automerge-Triggered-By: GH:AlexWaygood
2022-12-12 04:25:22 -08:00
Ned Batchelder 935ef59321
clarify the 4300-digit limit on int-str conversion (#100175) 2022-12-12 13:39:54 +02:00
Beweeted 868bab0fdc
gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)
Changed from multiples of 3 to powers of 3 to match the class name.
2022-12-11 15:20:59 -08:00
Brad Wolfe d5f8a2b6ad
gh-99728: correct typo in `datetime` format codes documentation (#99750) 2022-12-10 15:50:18 +05:30
busywhitespace e477348f36
gh-99970 Adding missing `optionflags` parameter in the documentation of `doctest` (#99971) 2022-12-10 15:42:40 +05:30
ram vikram singh 7c0fb71fbf
gh-100049: fix `repr` for `mappingproxy` in dictionary view example doc (#100052) 2022-12-10 14:46:00 +05:30
Stanley 286e3c76a9
gh-99087: Add missing newline for prompts in docs (GH-98993)
Add newline for prompts so copying to REPL does not cause errors.
2022-12-08 19:31:19 -08:00
Raymond Hettinger 35cc0ea736
GH-98363: Have batched() return tuples (GH-100118) 2022-12-08 15:08:16 -06:00
Jia Junjie 41d4ac9da3
gh-96250: Improve sqlite3 injection attack example (#99270)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-12-08 21:37:08 +01:00
Matthieu Baerts cce8362960
gh-98030: socket: add missing TCP socket options (#98031)
A few TCP socket options have been added to the Linux kernel these last
few years.

This commit adds all the ones available in Linux 6.0:

  https://elixir.bootlin.com/linux/v6.0/source/include/uapi/linux/tcp.h#L91

While at it, the TCP_FASTOPEN option has been moved lower in the list
just to keep the same order as in tcp.h to ease future synchronisations.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
2022-12-07 20:59:37 -08:00
Ethan Furman 679efbb080
gh-94943: [Enum] improve repr() when inheriting from a dataclass (GH-99740)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-12-06 13:43:41 -08:00
Serhiy Storchaka fd38a2f0ec
gh-93453: No longer create an event loop in get_event_loop() (#98440)
asyncio.get_event_loop() now always return either running event loop or
the result of get_event_loop_policy().get_event_loop() call. The latter
should now raise an RuntimeError if no current event loop was set
instead of creating and setting a new event loop.

It affects also a number of asyncio functions and constructors which
call get_event_loop() implicitly: ensure_future(), shield(), gather(),
etc.

DeprecationWarning is no longer emitted if there is no running event loop but
the current event loop was set.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-12-06 18:42:12 +01:00
Erik De Bonte 5c19050546
gh-99957: Add `frozen_default` parameter on `dataclass_transform` (#99958) 2022-12-05 19:35:43 -08:00
Gregory P. Smith bed15f87ea
gh-100001: Remove doc typo, add versionadded (#100042)
gh-100001: Remove new doc typo, add versionadded.
2022-12-05 15:15:13 -08:00
Gregory P. Smith d8ab0a4dfa
gh-100001: Omit control characters in http.server stderr logs. (#100002)
Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
2022-12-05 12:55:45 -08:00
Ram Rachum 51ee0a29e9
dataclasses.rst: Prevent horizontal scrolling (gh-100025) 2022-12-05 13:56:13 -05:00
Ethan Furman e3a3863cb9
gh-93464: [Enum] Add versionchanged tag (#99997)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-12-05 12:35:31 +02:00
Géry Ogam 2ae894b6d1
[Enum] Fix typos in the documentation (GH-99960) 2022-12-04 11:49:31 -08:00
Brian Skinn bf26bdf6ac
gh-85747: "Preface" section of asyncio-eventloop.rst: Switch to active voice and suggest other edits (#99784) 2022-12-03 16:48:41 -08:00
C.A.M. Gerlach d460c8ec52
Doc: Add summary line to isolation_level & autocommit sqlite3.connect params (#99917)
Add summary lines to isolation_level and autocommit connect() params

Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
2022-12-01 08:19:41 +01:00
ram vikram singh e0f91deb59
GH-98906 ```re``` module: ```search() vs. match()``` section should mention ```fullmatch()``` (GH-98916)
Mention fullmatch along with search and match.
2022-11-30 17:52:21 -05:00
Géry Ogam 9628136fac
bpo-47220: Document the optional callback parameter of weakref.WeakMethod (GH-25491) 2022-11-30 13:44:10 -06:00
Géry Ogam 19c38801ba
gh-99824: Document that sqlite3.connect implicitly open a transaction if autocommit=False (#99825)
Authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-11-30 12:33:50 +01:00
Dong-hee Na 8bb2303fd7
gh-99127: Allow some features of syslog to the main interpreter only (gh-99128) 2022-11-30 07:58:20 +09:00
Géry Ogam 052bc128ac
Docs: improve accuracy of socketserver reference (#24767) 2022-11-29 21:34:52 +01:00
Sam Ezeh 05dfc539c2
gh-90717: Update the documentation for the altchars paremeter in base64 library (GH-94187) 2022-11-29 16:21:01 +00:00
Matthew Hughes ca3e611b1f
`fnmatch` docs: link to `fnmatch.filter()`, not `builtins.filter()` (#99819) 2022-11-28 18:08:08 +00:00
David Miguel Susano Pinto 65417988a5
Grammatical improvements for ctypes 'winmode' documentation (GH-19167) 2022-11-28 16:05:21 +00:00
Georg Brandl 492dc02b01
bpo-41825: restructure docs for the os.wait*() family (GH-22356) 2022-11-28 09:41:24 +00:00
Erlend E. Aasland 276643e207
Docs: both sqlite3 "point examples" now adapt to str (#99823) 2022-11-27 22:08:30 +01:00
Sam Ezeh dfc2732a57
gh-91340: Document multiprocessing.set_start_method force parameter (GH-32339)
#91340


https://bugs.python.org/issue47184

Automerge-Triggered-By: GH:kumaraditya303
2022-11-27 09:58:39 -08:00
Brad Wolfe 65629399bc
gh-85988: Change documentation for sys.float_info.rounds (GH-99675)
* Change documentation for sys.float_info.rounds

Change the documentation for sys.float_info.rounds to remove
references to C99 section 5.2.4.2.2 and instead place the
available values inline.

* Correction to previous documentation change

Newlines were not preserved in generated HTML on previous
commit. I have changes the list to a comma-separated list
of values and their meanings.

* Clarify source for value of FLT_ROUNDS

Clarify the source of the FLT_ROUNDS value and
change 'floating-point addition' to 'floating-point
arithmetic' to indicate that the rounding mode
applies to all arithmetic operations.
2022-11-27 10:25:12 +00:00
George Zhang 22860dbbc8
doc: Remove backslashes in doctest grammar docs (#29346) 2022-11-27 12:08:39 +05:30
Jason R. Coombs 7f005749b2
gh-88330: Add more detail about what is a resource. (#99801) 2022-11-26 16:57:20 -05:00
busywhitespace 5f8898216e
gh-99795: Fix typo in importlib.resources.abc (GH-99796)
Changing TraversableReader to TraversableResources at one place of the documentation.

See #99795 for more details.
2022-11-26 10:01:08 -08:00
Nikita Sobolev 47d673d81f
gh-99502: mention bytes-like objects as input in `secrets.compare_digest` (GH-99512)
Now it is in sync with https://docs.python.org/3/library/hmac.html#hmac.compare_digest
It is the same function, just re-exported. So, I guess they should mention the same input types.
2022-11-26 01:33:48 -08:00
Stanley 7d2dcc53d0
gh-64019: Have attribute table in `inspect` docs link to module attributes instead of listing them (GH-98116)
Co-authored-by: Michael Anckaert <michael.anckaert@sinax.be>
2022-11-25 11:10:22 -08:00
Erlend E. Aasland 8749121b07
gh-96168: Add sqlite3 row factory how-to (#99507)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-11-25 14:07:28 +01:00
Illia Volochii 9dc08361be
gh-96828: Add an `ssl.OP_ENABLE_KTLS` option (GH-96830)
Expose the constant when OpenSSL defines it.
2022-11-23 18:24:09 -08:00
Irit Katriel 5d9183c7ad
gh-99619: fix error in documentation of ExceptionGroup.derive() (GH-99621) 2022-11-23 10:59:52 +00:00
ram vikram singh f5fea22886
gh-99650 : Updated argparse docs (GH-99653) 2022-11-22 13:16:06 -08:00
Skip Montanaro 22d91c16bb
gh-99146 struct module documentation should have more predictable examples/warnings (GH-99141)
* nail down a couple examples to have more predictable output

* update a number of things, but this is really just a stash...

* added an applications section to describe typical uses for native and machine-independent formats

* make sure all format strings use a format prefix character

* responding to comments from @gpshead. Not likely finished yet.

* This got more involved than I expected...

* respond to several PR comments
* a lot of wordsmithing
* try and be more consistent in use of ``x`` vs ``'x'``
* expand examples a bit
* update the "see also" to be more up-to-date
* original examples relied on import * so present all examples as if

* reformat based on @gpshead comment (missed before)

* responding to comments

* missed this

* one more suggested edit

* wordsmithing
2022-11-22 18:06:36 +00:00
Charles Machalow 1b2de89bce
gh-99547: Add isjunction methods for checking if a path is a junction (GH-99548) 2022-11-22 17:19:34 +00:00
Ronald Oussoren bc3a11d21d
GH-92892: Add section about variadic functions to ctypes documentation (#99529)
On some platforms, and in particular macOS/arm64, the calling
convention for variadic arguments is different from the regular
calling convention. Add a section to the documentation to document
this.
2022-11-22 11:33:37 +01:00
GabrielAnguita 1bf983ce7e
gh-99662: fix typo in typing.TypeVarTuple docs (#99672) 2022-11-21 20:02:55 -08:00
Ronald Oussoren 1cae31d26b
GH-95815: Document less specific error for os.remove (#99571)
os.remove can raise PermissionError instead of IsADirectoryError,
when the object to be removed is a directory (in particular on
macOS).

This reverts a change done in #14262.
2022-11-21 11:08:06 +01:00
Julien Palard 858cb79486
Doc: Make functions.html readable again. (GH-99476) 2022-11-19 11:25:45 +01:00
Stanley 27d8dc2c9d
gh-85073: Add some missing links to source (GH-99363)
Add some missing links to source from Python docs
2022-11-18 11:33:40 -08:00
Alexander Ryabov ed206e39f0
Doc: Fix broken link to emscripten networking website (#99531)
There was an extra `>` in the url.
2022-11-18 10:57:04 -08:00
Irit Katriel c8c6113398
gh-99553: fix bug where an ExceptionGroup subclass can wrap a BaseException (GH-99572) 2022-11-18 15:44:43 +00:00
Adorilson Bezerra a0d940d6ac
Misc copyedits in docs on built-in types (GH-24466)
# DOC: Improvements in library/stdtypes

This PR does the following:

1. Replaces :meth: by :func: around repr function
2. Adds links to Unicode Standard site
3. Makes explicit "when" you can call the `iskeyword` function. The previous text could cause confusion to readers, especially those with English as a second language. The reader could understand that the `isidentifier` method calls the `iskeyword` function. Now, it is explicit that the dev can do it.
4. Replaces a URL with an inline link.

Automerge-Triggered-By: GH:AlexWaygood
2022-11-17 08:06:00 -08:00
Steve Dower 19c1462e8d
gh-99377: Add audit events for thread creation and clear (GH-99378) 2022-11-16 17:15:52 +00:00
Kumar Aditya f63002755d
GH-99388: add `loop_factory` parameter to `asyncio.run` (#99462) 2022-11-14 10:18:51 -08:00
Matt Harasymczuk f0d12ca0e0
Fix misspelling in docs for http.HTTPMethod (#99376)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-13 12:46:28 -08:00
ram vikram singh 88385b8564
gh-98930: improve the docstring of signal.strsignal (#99290)
Improves the docstring on signal.strsignal to make it explain when it returns a message, None, or when it raises ValueError.

Closes #98930

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-11-13 11:41:23 -08:00
Erlend E. Aasland c95f554a40
gh-83638: Add sqlite3.Connection.autocommit for PEP 249 compliant behaviour (#93823)
Introduce the autocommit attribute to Connection and the autocommit
parameter to connect() for PEP 249-compliant transaction handling.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
2022-11-12 23:44:41 +01:00
naglis dfc1b17a23
gh-99392: Fix sqlite3 converter recipes (#99393) 2022-11-12 20:39:37 +01:00
Ethan Furman 73a921b070
gh-99304: [Enum] clarify what constitutes a flag alias (GH-99395)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-11-12 10:39:47 -08:00
Kumar Aditya aa874326d8
GH-94597: add deprecation warnings for subclassing `AbstractChildWatcher` (#99386) 2022-11-11 23:17:53 -08:00
Steve Dower c3c3871415
gh-87604: Clarify in docs that sys.addaudithook is not for sandboxes (GH-99372) 2022-11-11 13:35:02 +00:00
Raymond Hettinger 2f4af2d99c
GH-99183: Document behavior of count() for empty substrings (GH-99339) 2022-11-10 15:20:01 -06:00
jmcb 58ee5d8677
Update reference to the size of PyPI (#99076)
Update reference to the size of PyPI

Last changed in 2008 (528576031d).
2022-11-09 11:26:46 -08:00
Gregory P. Smith 2eee9d9cd7
gh-99238: clarify the type of the env dict. (#99253) 2022-11-08 13:00:31 -08:00
Mikael Koli acf4d5d5bd
Fix broken link in `asyncio-subprocesses` doc (GH-99214)
# Fix broken link in Doc/library/asyncio-subprocess.rst

This is a trivial fix in documentation to fix a broken link.

There is a broken link in [Doc/library/asyncio-subprocess.rst](https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process) for the function ``wait_for``:

![image](https://user-images.githubusercontent.com/37690409/200388894-fb6b7c42-b2cc-49ec-a239-e3472890db1f.png)

I suppose this refers to the function ``asyncio.wait_for`` which is not clear in the docs.

This PR fixes the link and the result looks like the following:

![image](https://user-images.githubusercontent.com/37690409/200389483-b4a92105-7d2c-4285-b0fc-78a6dc0be39c.png)

Automerge-Triggered-By: GH:AlexWaygood
2022-11-08 08:26:06 -08:00
Nikita Sobolev e56e33d271
gh-72719: Remove asyncore and asynchat modules (#96580)
Remove modules asyncore and asynchat, which were deprecated by PEP 594.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-08 16:48:58 +01:00
Kamil Turek b9dedfe61d
gh-92119: ctypes: Print exception class name instead of its representation (#98302) 2022-11-07 20:53:59 -08:00
Noam Cohen 80c08d1cd6
gh-95389: expose popular ETHERTYPE_* constants in the socket module (#95390)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-11-07 15:27:37 +01:00
Erlend E. Aasland e02f1e2df9
Docs: add argument spec to sqlite3 CLI docs (#99200) 2022-11-07 14:18:36 +01:00
Nouran Ali 2db55e0c00
gh-94286 Fix documentation of print default param (GH-94297) 2022-11-06 20:14:58 +00:00
Ethan Furman 8feb7ab77c
gh-93464: [Enum] fix auto() failure during multiple assignment (GH-99148)
* fix auto() failure during multiple assignment

i.e. `ONE = auto(), 'text'` will now have `ONE' with the value of `(1,
'text')`.  Before it would have been `(<an auto instance>, 'text')`
2022-11-05 18:01:08 -07:00
Skip Montanaro c0bf7607a1
minor edits to locale doc (#98537) 2022-11-04 06:02:11 -07:00
Nick Pope 016c7d37b6
Docs: add `named` to the list of styles in the sqlite3.paramstyle attr docs (#99078) 2022-11-04 00:21:01 +01:00
Victor Stinner a60ddd31be
gh-98401: Invalid escape sequences emits SyntaxWarning (#99011)
A backslash-character pair that is not a valid escape sequence now
generates a SyntaxWarning, instead of DeprecationWarning.  For
example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an
invalid escape sequence), use raw strings for regular expression:
re.compile(r"\d+\.\d+"). In a future Python version, SyntaxError will
eventually be raised, instead of SyntaxWarning.

Octal escapes with value larger than 0o377 (ex: "\477"), deprecated
in Python 3.11, now produce a SyntaxWarning, instead of
DeprecationWarning. In a future Python version they will be
eventually a SyntaxError.

codecs.escape_decode() and codecs.unicode_escape_decode() are left
unchanged: they still emit DeprecationWarning.

* The parser only emits SyntaxWarning for Python 3.12 (feature
  version), and still emits DeprecationWarning on older Python
  versions.
* Fix SyntaxWarning by using raw strings in Tools/c-analyzer/ and
  wasm_build.py.
2022-11-03 17:53:25 +01:00
Victor Stinner cff1c20667
gh-94199: Remove ssl.wrap_socket() documentation (#99023)
The function has been removed. In the ssl documentation, replace
references to the ssl.wrap_socket() function with references to the
ssl.SSLContext.wrap_socket() method.

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2022-11-03 13:33:33 +01:00
Mark Shannon f4adb97506
GH-96793: Implement PEP 479 in bytecode. (GH-99006)
* Handle converting StopIteration to RuntimeError in bytecode.

* Add custom instruction for converting StopIteration into RuntimeError.
2022-11-03 11:38:51 +00:00
Serhiy Storchaka e9ac890c02
gh-98740: Fix validation of conditional expressions in RE (GH-98764)
In very rare circumstances the JUMP opcode could be confused with the
argument of the opcode in the "then" part which doesn't end with the
JUMP opcode. This led to incorrect detection of the final JUMP opcode
and incorrect calculation of the size of the subexpression.

NOTE: Changed return value of functions _validate_inner() and
_validate_charset() in Modules/_sre/sre.c.  Now they return 0 on success,
-1 on failure, and 1 if the last op is JUMP (which usually is a failure).
Previously they returned 1 on success and 0 on failure.
2022-11-03 09:23:46 +02:00
Oleg Iarygin 898d0d9ad8
gh-92679: Clarify asyncio.loop.start_tls parameters (#92682) 2022-11-01 21:52:19 -07:00
Sebastian Rittau 65d1407737
gh-92871: Postpone the removal of typing.{io,re} to 3.13 (#98958) 2022-11-01 20:51:45 -07:00
Julien Palard c1c3be0f9d
Doc: Fix sphinx-lint issues (GH-98911)
They were introduced right between GH-98441 and GH-98408.
2022-10-31 16:30:29 +01:00
Shantanu 880bafc574
gh-98576: Fix types in dataclass.InitVar example (gh-98577) 2022-10-31 11:02:02 -04:00
Jason R. Coombs 018b2483c4
gh-97966: Update uname docs to clarify the special nature of the platform attribute and to indicate when it became late-bound. (#97972) 2022-10-30 11:53:58 -04:00
Yuvi Panda bfecff5f73
Fix typo in docs (GH-98863) 2022-10-29 15:44:06 -05:00
FC Stegerman d10c2b9742
dataclasses docs: consistent indentation (4 spaces) in examples (#98855) 2022-10-29 18:06:52 +01:00
Mateusz 0023f51deb
gh-98240: Updated Path.rename docs, when it is atomic (GH-98245) 2022-10-28 16:31:37 -07:00
domragusa e089f23bbb
gh-84538: add strict argument to pathlib.PurePath.relative_to (GH-19813)
By default, :meth:`pathlib.PurePath.relative_to` doesn't deal with paths that are not a direct prefix of the other, raising an exception in that instance. This change adds a *walk_up* parameter that can be set to allow for using ``..`` to calculate the relative path.

example:
```
>>> p = PurePosixPath('/etc/passwd')
>>> p.relative_to('/etc')
PurePosixPath('passwd')
>>> p.relative_to('/usr')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pathlib.py", line 940, in relative_to
    raise ValueError(error_message.format(str(self), str(formatted)))
ValueError: '/etc/passwd' does not start with '/usr'
>>> p.relative_to('/usr', strict=False)
PurePosixPath('../etc/passwd')
```


https://bugs.python.org/issue40358

Automerge-Triggered-By: GH:brettcannon
2022-10-28 16:20:14 -07:00
cburroughs 72fa57a8fe
Fix typo in contextvars docs (#98823) 2022-10-28 22:13:48 +01:00
Skip Montanaro b27b57c6e4
`argparse` docs: normalize constant references (#98765) 2022-10-28 13:15:39 +01:00
Nikita Sobolev c144e57b31
gh-98657: [docs] `array.typecodes` is a module-level attribute (#98729)
* gh-98657: [docs] `array.typecodes` is a module-level attribute

* Update array.rst
2022-10-28 12:26:01 +02:00
Stanley 8cd21c2c5d
gh-65002: Make note that null bytes are used to pad bytes (#98635) 2022-10-28 12:21:28 +02:00
Erlend E. Aasland 723ebe76e7
gh-96143: Improve perf profiler docs (#96445) 2022-10-27 14:06:48 +01:00
Mark Shannon 22863df7ca
GH-96793: Change `FOR_ITER` to not pop the iterator on exhaustion. (GH-96801)
Change FOR_ITER to have the same stack effect regardless of whether it branches or not.
Performance is unchanged as FOR_ITER (and specialized forms jump over the cleanup code).
2022-10-27 11:55:03 +01:00
Erlend E. Aasland 365852a03a
gh-98716: Revert gh-96081: Escape lone stars in sqlite3 docs (#98720) 2022-10-26 16:53:46 +02:00
Philipp A 5e74bad93c
gh-98644: point people to tomllib from configparser’s docs (#98645)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-26 07:06:20 -07:00
fancidev 216f45e4fe
gh-98348: Mention ReferenceError in weakref.proxy documentation (#98355) 2022-10-25 20:48:24 -07:00
Stanley 268129a74f
docs: Change links to label refs (#98454)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-25 20:26:28 -07:00
Stanley 0ca6a4d640
gh-77753: Add example for values that compare equal in stdtypes (#98497)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-25 19:54:27 -07:00
Stanley 4196ee5c8b
gh-84747: Add `async for` comment for StreamReader (#98633) 2022-10-25 19:16:18 -07:00
Jelle Zijlstra 5d8bf2b106
gh-97937: dis docs: add adaptive=False (#97939)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2022-10-25 15:58:04 -07:00
Eclips4 be0cf82ae4
gh-98602: [typing docs] Use quotes for forward reference in TypeVarTuple example (#98605) 2022-10-25 16:32:52 +01:00
Nikita Sobolev 5076108872
gh-98623: Fix base classes in `typing.rst` (#98626) 2022-10-25 07:06:13 -07:00
Nikita Sobolev e3b9dd8e87
gh-98507: [typing docs] Rephrase "now supports `[]`" to "now supports subscripting" (#98508) 2022-10-24 19:10:25 +01:00
Kumar Aditya 2fdcc6f2cb
GH-91635: clarify docs about closing of transport in asyncio (#98563) 2022-10-24 10:52:02 -07:00
Nikita Sobolev 1a217f9ffc
gh-98500: Fix typing docs for `*View` classes (#98511) 2022-10-24 10:47:32 -07:00
Omkaar b6d5d5b60a
gh-98561: Fix a typo in typing (GH-98562) 2022-10-23 22:05:08 +08:00
C.A.M. Gerlach 8f30267ab4
gh-95913: Copyedit & xref FrameInfo in Whatsnew inspect section (#98304) 2022-10-22 20:12:04 +01:00
Clément Robert 327fc1c6fa
[Enum docs]: fix order of arguments to isinstance() (#98542) 2022-10-22 12:29:00 +01:00
Stanley d9407b174c
gh-51511: Note that codecs.open()'s encoding parameter affects automatic conversion to binary mode (#94370) 2022-10-21 16:01:05 -07:00
Ethan Furman 3e95ffc7ae
gh-98298: [Enum] document ReprEnum, global_enum, and show_flag_values (GH-98455)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-21 15:36:41 -07:00
Noam Cohen a371a7e03e
gh-95023: Added os.setns and os.unshare functions (#95046)
Added os.setns and os.unshare to easily switch between namespaces
on Linux.

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-20 11:08:54 +02:00
Phil Elson 1a6bacb31f
[doc] Refresh the venv introduction documentation, and correct the statement about VIRTUAL_ENV (GH-98350)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-19 15:49:34 +01:00
Raymond Hettinger a53f637368
Fix markup indentation (GH-98424)
Fix markup
2022-10-18 20:14:41 -05:00
Raymond Hettinger f4ead4874b
General improvements to the itertools docs (GH-98408) 2022-10-18 14:09:34 -05:00
Julien Palard 2eb503e4dd
Doc: Found some remaining default roles. (GH-98392) 2022-10-18 15:46:18 +02:00
Julien Palard 0bbea545e3
Doc: missing underscore in hyperlink. (GH-98391) 2022-10-18 15:28:19 +02:00
Raymond Hettinger de3ece769a
GH-98363: Add itertools.batched() (GH-98364) 2022-10-17 18:53:45 -05:00
Raymond Hettinger 70732d8a4c
Move random selection recipes from itertools.rst to random.rst (GH-98369) 2022-10-17 17:30:49 -05:00
Victor Stinner 1863302d61
gh-97669: Create Tools/build/ directory (#97963)
Create Tools/build/ directory. Move the following scripts from
Tools/scripts/ to Tools/build/:

* check_extension_modules.py
* deepfreeze.py
* freeze_modules.py
* generate_global_objects.py
* generate_levenshtein_examples.py
* generate_opcode_h.py
* generate_re_casefix.py
* generate_sre_constants.py
* generate_stdlib_module_names.py
* generate_token.py
* parse_html5_entities.py
* smelly.py
* stable_abi.py
* umarshal.py
* update_file.py
* verify_ensurepip_wheels.py

Update references to these scripts.
2022-10-17 12:01:00 +02:00
Joannah Nanjekye 5c9302d03a
gh-85525: Remove extra row in doc (#98337)
* remove extra row

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-10-16 13:43:31 -04:00
Stanley 79fd6ccdbe
gh-85299: Add note warning about entry point guard for asyncio example (#93457) 2022-10-16 10:04:43 -07:00
Vinay Sajip f6b1e4048d
gh-98307: Add docstring and documentation for SysLogHandler.createSocket (GH-98319)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-16 09:15:46 +01:00
Kumar Aditya 660f10248b
GH-94597: Deprecate child watcher getters and setters (#98215)
This is the next step for deprecating child watchers.

Until we've removed the API completely we have to use it, so this PR is mostly suppressing a lot of warnings when using the API internally.

Once the child watcher API is totally removed, the two child watcher implementations we actually use and need (Pidfd and Thread) will be turned into internal helpers.
2022-10-15 16:09:30 -07:00
Raymond Hettinger 3a639bbeac
Improve speed. Reduce auxiliary memory to 16.6% of the main array. (GH-98294) 2022-10-15 16:05:28 -05:00
Simon Legner 02389658a4
docs(typing): harmonize "See PEP x for more details" (#97927) 2022-10-15 12:17:51 -07:00
Raymond Hettinger f4370318d6
Faster sieve() recipe (#98287) 2022-10-15 12:43:58 -05:00
Joannah Nanjekye bf786e6901
gh-85455: Add missing doc strings and improve docs (#21573)
* Add missing doc strings and improve docs

* Use imperative form

* Modify docstring wording
2022-10-15 09:31:06 -04:00
Joannah Nanjekye 05c042e707
gh-85525: Indicate supported sound header formats (#21575)
* Indicate supported sound header formats

* modify file names

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-15 09:30:05 -04:00
Julien Palard 3c4cbd177f
gh-91485: Doc: Using Python syntax to document builtin Python functions. (GH-96579) 2022-10-15 12:19:35 +02:00
Shantanu c39a0c3354
gh-65046: Link to logging cookbook from asyncio docs (#98207) 2022-10-11 21:42:57 -07:00
Stanley 3b33c2010a
Formatting fixes in contextlib docs (#98111) 2022-10-11 20:56:32 -07:00
Shantanu ed6344eed0
gh-96130: Rephrase use of "typecheck" verb for clarity (#98144)
I'm sympathetic to the issue report, especially in case this helps
clarify to new users that Python itself does not do type checking at runtime
2022-10-11 19:37:58 -07:00
Stanley f0a680007f
gh-71616: Add note to warn against general translation of saxutils.escape() (#93450)
* Add note to warn against general translation of saxutils.escape()

* Use more direct wording
2022-10-11 05:27:49 -04:00
Vinay Sajip 6a757da080
gh-88452: Add a warning about non-portability of environments. (GH-98155) 2022-10-10 19:27:52 +01:00
Stanley 187e853690
gh-83940: os docs: Improve wording for getenv/getenvb (#98113) 2022-10-10 06:43:01 -07:00
Stanley 281a3f18cc
gh-56133: copyreg docs: Clarify function/constructor parameter (#95497) 2022-10-09 17:51:02 -07:00
JasonYZ 6b485629d2
gh-97822: Fix http.server documentation reference to test() function (#98027)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-07 21:46:23 -07:00
Stanley 0f498f1a95
gh-57179: Add note on symlinks for os.walk (#94799) 2022-10-07 15:51:50 -07:00
Stanley 5eaf4d6101
gh-61105: Add default param, note on using cookiejar subclass (#95427) 2022-10-07 15:21:13 -07:00
Stanley eed80458e8
gh-91708: Revert params note in urllib.parse.urlparse table (#96699)
Revert params note in urllib.parse.urlparse table
2022-10-07 12:19:36 -07:00
Stanley 676d8ef380
gh-65496: Correct wording on csv's skipinitialspace argument (#96170) 2022-10-07 11:15:34 -07:00
Stanley 4a74e6ab38
gh-64921: Clarify wording for open()'s newline arg (#96171) 2022-10-07 11:12:08 -07:00
Victor Stinner 002252c4ad
gh-97669: Move difflib examples to Doc/includes/ (#97964)
Remove diff.py and ndiff.py scripts of Tools/scripts/: move them to
Doc/includes/.

* diff.py and ndiff.py files are no longer executable. Remove also
  their shebang ("#!/usr/bin/env python3").
* Remove the -profile command from ndiff.py to simply the code.
* Remove ndiff.py copyright and history command. The Python
  documentation examples are distributed under the "Zero Clause BSD
  License".
2022-10-07 10:57:48 -07:00
Christopher Chianelli 6592a62ec2
gh-71316: Update dis documentation to include changes to jump arguments (GH-95798) 2022-10-07 14:54:21 +01:00
Raymond Hettinger e500cc0451
Misc updates to the itertools recipes and tests (GH-98018) 2022-10-07 03:37:21 -05:00
Julien Palard 66cc46b2e4
Doc: sphinx-lint finds two other default roles. (GH-98019) 2022-10-07 09:10:51 +02:00
Hugo van Kemenade fa2d43e518
Docs: Fix backtick errors found by sphinx-lint (#97998)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-10-06 18:01:30 -07:00
Nikita Sobolev 27025e158c
gh-97850: Remove deprecated functions from `importlib.utils` (#97898)
* gh-97850: Remove deprecated functions from `importlib.utils`

* Rebase and remove `set_package` from diff
2022-10-06 17:57:10 -07:00
Guido van Rossum 09de8d7aaf
GH-90985: Revert "Deprecate passing a message into cancel()" (#97999)
Reason: we were too hasty in deprecating this.
We shouldn't deprecate it before we have a replacement.
2022-10-06 17:30:27 -07:00
Brett Cannon e1c4d56fdd
gh-65961: Do not rely solely on `__cached__` (GH-97990)
Make sure `__spec__.cached` (at minimum) can be used.
2022-10-06 15:40:22 -07:00
Jason R. Coombs 8af04cdef2
gh-97781: Apply changes from importlib_metadata 5. (GH-97785)
* gh-97781: Apply changes from importlib_metadata 5.

* Apply changes from upstream

* Apply changes from upstream.
2022-10-06 15:25:24 -04:00
180909 0d68879104
gh-95691: Doc BufferedWriter and BufferedReader (#95703) 2022-10-05 16:57:42 -07:00
Guido van Rossum 74ea204634
GH-88968: Add notes about socket ownership transfers (#97936) 2022-10-05 16:42:01 -07:00
Brett Cannon c206e53bb7
gh-65961: Raise `DeprecationWarning` when `__package__` differs from `__spec__.parent` (#97879)
Also remove `importlib.util.set_package()` which was already slated for removal.

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2022-10-05 15:00:45 -07:00
Simon Legner 2016bc54a2
docs(typing): add "see PEP 675" to LiteralString (#97926) 2022-10-05 13:08:07 -07:00
Adam Turner 0031e62973
gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768)
:c:type:`<C type>` -> :c:expr:`<C type>`

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-10-05 11:01:14 -07:00
180909 d6062d1170
GH-95172 Make the same version `versionadded` oneline (#95172)
* Make the same version versionadded oneline

* Format versionadded for enum.rst

* Format versionadded

A single line versionadded was reading better.

Co-authored-by: Senthil Kumaran <senthil@python.org>
2022-10-05 10:52:59 -07:00
Serhiy Storchaka e3ef400be7
gh-74696: Pass root_dir to custom archivers which support it (GH-94251)
Co-authored-by: Éric <merwok@netwok.org>
2022-10-05 12:48:59 +03:00
Jia Junjie 4b83cd0b22
gh-97661: Improve accuracy of sqlite3.Cursor.fetchone docs (#97662)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-05 10:47:54 +02:00
Guido van Rossum 8079bef56f
GH-96704: Add {Task,Handle}.get_context(), use it in call_exception_handler() (#96756)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-04 23:49:10 -07:00
Athos Ribeiro 0ceafa7fa4
Add re.VERBOSE flag documentation example (#97678)
The current re.VERBOSE documentation example leaves space for ambiguous
interpretation. One may read that spaces within the `(?:` token are
spaces inside the non-capturing group (such as `(?: )`). This patch
removes the ambiguity by including examples after the statement.
2022-10-04 17:39:42 -07:00
Adam Turner a0f5599aac
gh-93738: Documentation C syntax (Use `c:struct`) (#97772)
Use `c:struct`
2022-10-04 16:26:14 -07:00
Adam Turner 0bf6a617ed
gh-93738: Documentation C syntax (:c:type:`PyObject` -> :c:expr:`PyObject`) (#97776)
:c:type:`PyObject` -> :c:expr:`PyObject`
2022-10-04 16:13:03 -07:00
cousteau ff28d8926d
gh-88355: Fix backslashes in AF_PIPE (#96543)
Fix backslashes in AF_PIPE (#88355)

The correct syntax for AF_PIPE addresses is `\\.\pipe\blahblah`, not `\.\pipe{blahblah}`, but the syntax markup messed up the backslashes.
2022-10-04 15:54:03 -07:00
Ev2geny 743453a554
gh-58451: Add optional delete_on_close parameter to NamedTemporaryFile (GH-97015) 2022-10-04 23:37:33 +01:00
Daniel Giger 7acb93f0d4
gh-96448: fix documentation for _thread.lock.acquire (#96449)
* fix documentation for _thread.lock.acquire

* update formatting of _thread.lock.acquire() doc
2022-10-04 15:18:04 -07:00
Inada Naoki 87679a6e60
gh-90301: Doc: Add references to PEP 686 (#96816)
Doc: Add references to PEP 686.
2022-10-04 15:04:44 -07:00
Kumar Aditya 53503ff60e
GH-82604: fix docs about configuring selector (#97755) 2022-10-04 09:45:37 -07:00
Rohan Shah d053c47bfd
Minor grammar changes to http.client docs (#96221)
Minor grammar changes
2022-10-03 16:19:39 -07:00
Géry Ogam 0c91a12511
Update http.client.rst (#24803)
* Update http.client.rst

* Apply suggestions from code review

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

* Update http.client.rst

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Senthil Kumaran <senthil@python.org>
2022-10-03 16:18:36 -07:00
Ivan Kapeykin d78aa4e11a
multiprocessing docs: Remove extra option ELLIPSIS from section with code (#96625) 2022-10-03 15:41:08 -07:00
Boris Verkhovskiy 0ea8b925d0
Document that MozillaCookieJar works for curl's cookie files (#91852)
MozillaCookieJar works for curl's cookies
2022-10-03 15:07:54 -07:00
Victor Stinner 64fe343717
gh-97681: Remove Tools/demo/ directory (#97682)
Remove the Tools/demo/ directory which contained old demo scripts. A
copy can be found in the old-demos project:
https://github.com/gvanrossum/old-demos

Remove the following old demo scripts:

* beer.py
* eiffel.py
* hanoi.py
* life.py
* markov.py
* mcast.py
* queens.py
* redemo.py
* rpython.py
* rpythond.py
* sortvisu.py
* spreadsheet.py
* vector.py

Changes:

* Remove a reference to the redemo.py script in the regex howto
  documentation.
* Remove a reference to the removed Tools/demo/ directory in the
  curses documentation.
* Update PC/layout/ to remove the reference to Tools/demo/ directory.
2022-10-03 17:09:02 +02:00
annonm e6f9ec5c03
Fix typo in unittest docs (#97742) 2022-10-03 06:35:40 -07:00
Kumar Aditya 9151bbefea
GH-85447: Clarify docs about awaiting future multiple times (#97738) 2022-10-02 15:16:51 -07:00