Commit Graph

26314 Commits

Author SHA1 Message Date
Mark Dickinson 0672a6c23b
Revert "gh-89381: Fix invalid signatures of math/cmath.log (#101404)" (#101580)
This reverts commit 0ef92d9793.
2023-02-05 16:36:33 +00:00
busywhitespace 9b60ee976a
gh-101221: Add options in the documentation of timeit command (#101222) 2023-02-05 15:25:36 +05:30
alnoki 6e4a521c2a
Add missing preposition in argparse docs (#101548) 2023-02-05 15:15:07 +05:30
Furkan Onder cef9de62b8
GH-56426: Add cross-reference to the documentation for faulthandler, traceback, and pdb. (#101157)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-02-04 09:19:29 +05:30
Max Bachmann f11a3d1ebe
Add missing `versionadded` directive for `PyCode_Addr2Location` (#101347) 2023-02-04 09:03:28 +05:30
Gregory P. Smith d4c410f0f9
gh-84559: Remove the new multiprocessing warning, too disruptive. (#101551)
This reverts the core of #100618 while leaving relevant documentation
improvements and minor refactorings in place.
2023-02-03 15:20:46 -08:00
François Magimel 45d014e03b
docs: replace PyPI description with link (#101506) 2023-02-03 12:53:11 +05:30
Viet Than 5c39daf50b
gh-100920: Update documentation for `asyncio.StreamWriter.wait_closed` (#101514) 2023-02-03 12:48:39 +05:30
C.A.M. Gerlach 1b6045668d
gh-100925: Move array methods under class in array doc (#101485)
* Move array methods under class in array doc

* Fix a few internal references related to the touched lines
2023-02-03 08:03:27 +08:00
Gregory P. Smith 0ca67e6313
GH-84559: Deprecate fork being the multiprocessing default. (#100618)
This starts the process. Users who don't specify their own start method
and use the default on platforms where it is 'fork' will see a
DeprecationWarning upon multiprocessing.Pool() construction or upon
multiprocessing.Process.start() or concurrent.futures.ProcessPool use.

See the related issue and documentation within this change for details.
2023-02-02 15:50:35 -08:00
Peter Gessler 24cbc7a2a0
docs: Fix enum reassign `str` documentation (GH-101507) 2023-02-02 12:12:57 -08:00
Marcos Pereira ee21110086
Docs: improve accuracy of sqlite3 `check_same_thread` parameter (#101351)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-02-02 00:52:29 +01:00
Steve Dower eda60916bc
gh-101467: Correct py.exe handling of prefix matches and cases when only one runtime is installed (GH-101468) 2023-02-01 21:06:56 +00:00
Raj 95fb0e0258
gh-101498 : Fix asyncio.Timeout example in docs (#101499)
Doc/library/asyncio-task.rst#timeout
2023-02-01 10:08:31 -08:00
Irit Katriel 62251c3da0
gh-101454: fix documentation for END_ASYNC_FOR (#101455) 2023-02-01 12:49:59 +00:00
beavailable cc407b9de6
gh-101317: Add `ssl_shutdown_timeout` parameter for `asyncio.StreamWriter.start_tls` (#101335)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-02-01 16:33:59 +05:30
John Belmonte 75227fba1d
datetime.rst: fix combine() signature (#101490)
The default `tzinfo` param of the `combine()` signature pseudocode was erroneously `self.tzinfo`.

`self` has no meaning in the context of a classmethod, and the datetime class itself has no `tzinfo` attribute.  The correct default pseudocode is `time.tzinfo`, reflecting that the default is the `tzinfo` attribute of the `time` parameter.
2023-02-01 14:01:28 +04:00
Peter Jiping Xie 20c11f2e60
gh-101440: fix json snippet error in logging-cookbook.rst (#101439) 2023-01-31 17:30:38 +02:00
Raj df0068ce48
gh-99276 - Updated Doc/faq/general.rst (#101396)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-01-31 17:16:17 +02:00
Christophe Nanteuil 1a62ae84c6
Add JOBS parameter to docs Makefile (#101395) 2023-01-31 15:29:29 +02:00
Shantanu 909a674693
gh-77607: Improve accuracy of os.path.join docs (#101406)
This is a follow-up to #100811.

One of the changes in that PR isn't accurate in that
`os.path.join('', '')` will not end in a separator.

This reverts that change to the previous wording that used "only", but
explicitly calls out the case where the last part ends in a separator,
which is what caused confusin in #77607 and motivated the change
in #100811.
2023-01-30 21:39:30 -08:00
Ben ef09bf63d2
Fixes typo in asyncio.TaskGroup context manager code example (#101449) 2023-01-30 21:36:40 -08:00
Owain Davies ea232716d3
gh-101422: (docs) TarFile default errorlevel argument is 1, not 0 (GH-101424) 2023-01-30 09:56:33 -08:00
Sergey B Kirpichev 0ef92d9793
gh-89381: Fix invalid signatures of math/cmath.log (#101404) 2023-01-29 11:50:10 -08:00
socal-nerdtastic 666c0840dc
Fix trivial typo in shebang example (GH-101385)
The example was showing the current version, but should be pinned to 3.7 to match the example command.
2023-01-28 15:18:04 +02:00
Peter Jiping Xie db757f0e44
gh-101386: fix typos found by codespell (#101387) 2023-01-28 11:57:40 +02:00
Gregory P. Smith 052f53d65d
gh-39615: Add warnings.warn() skip_file_prefixes support (#100840)
`warnings.warn()` gains the ability to skip stack frames based on code
filename prefix rather than only a numeric `stacklevel=` via a new
`skip_file_prefixes=` keyword argument.
2023-01-27 18:35:14 -08:00
Vinay Sajip b5c4d6064c
[doc] Add a section on logging handler configuration order. (GH-101380) 2023-01-27 19:01:30 +00:00
Vinay Sajip d083df39fa
[doc] Add some notices to logging configuration documentation. (GH-101373) 2023-01-27 14:50:09 +00:00
Barney Gale e5b08ddddf
gh-101000: Add os.path.splitroot() (#101002)
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-01-27 00:28:27 +00:00
John Belmonte f5ad63f79a
datetime.rst: improve combine() docs (#101338)
The explanation on handling of datetime as the date arg was confusingly mixed with an unrelated
item, and lacked proper arg name formatting.
2023-01-26 11:25:43 +04:00
achhina 952a1d9cc9
GH-88597: Rename uuid's new CLI args to be in line with uuidgen. (#101248)
this way they match an existing uuidgen command line tool.
2023-01-25 09:39:42 -08:00
Mark Shannon f02fa64bf2
GH-100762: Don't call `gen.throw()` in `gen.close()`, unless necessary. (GH-101013)
* Store exception stack depth in YIELD_VALUE's oparg and use it avoid expensive gen.throw() in gen.close() where possible.
2023-01-24 17:25:37 +00:00
ram vikram singh 7f95ec3e74
gh-101152: Implement PEP 699 (GH-101193)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ken Jin <kenjin@python.org>
2023-01-24 17:29:22 +08:00
Gregory P. Smith e244401ce5
[docs] Mention how to get/set a bigint PyLong via the C API (#101270)
We don't need direct C APIs to get at a bigint representation of PyLong but we
do want the few people who need to understand how.

Additional Author:  CAM-Gerlach
2023-01-23 21:20:53 -08:00
Carlton Gibson 5d868efde9
Added asyncio REPL example to docs. (#101243)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-23 17:01:13 +05:30
Jacob Walls d717be04dc
gh-83122: Deprecate testing element truth values in `ElementTree` (#31149)
When testing element truth values, emit a DeprecationWarning in all implementations.

This had emitted a FutureWarning in the rarely used python-only implementation since ~2.7 and has always been documented as a behavior not to rely on.

Matching an element in a tree search but having it test False can be unexpected. Raising the warning enables making the choice to finally raise an exception for this ambiguous behavior in the future.
2023-01-22 17:16:48 -08:00
Andrew Hong 8bcd4a6ec7
GH-101097: Switch from standard interval notation to greater or less than signs for random.random()'s documentation (#101119) 2023-01-22 14:58:36 -06:00
Mark Dickinson 3e09f3152e
gh-67790: Support float-style formatting for Fraction instances (#100161)
This PR adds support for float-style formatting for `Fraction` objects: it supports the `"e"`, `"E"`, `"f"`, `"F"`, `"g"`, `"G"` and `"%"` presentation types, and all the various bells and whistles of the formatting mini-language for those presentation types. The behaviour almost exactly matches that of `float`, but the implementation works with the exact `Fraction` value and does not do an intermediate conversion to `float`, and so avoids loss of precision or issues with numbers that are outside the dynamic range of the `float` type.

Note that the `"n"` presentation type is _not_ supported. That support could be added later if people have a need for it.

There's one corner-case where the behaviour differs from that of float: for the `float` type, if explicit alignment is specified with a fill character of `'0'` and alignment type `'='`, then thousands separators (if specified) are inserted into the padding string:

```python
>>> format(3.14, '0=11,.2f')
'0,000,003.14'
```

The exact same effect can be achieved by using the `'0'` flag:

```python
>>> format(3.14, '011,.2f')
'0,000,003.14'
```

For `Fraction`, only the `'0'` flag has the above behaviour with respect to thousands separators: there's no special-casing of the particular `'0='` fill-character/alignment combination. Instead, we treat the fill character `'0'` just like any other:

```python
>>> format(Fraction('3.14'), '0=11,.2f')
'00000003.14'
>>> format(Fraction('3.14'), '011,.2f')
'0,000,003.14'
```

The `Fraction` formatter is also stricter about combining these two things: it's not permitted to use both the `'0'` flag _and_ explicit alignment, on the basis that we should refuse the temptation to guess in the face of ambiguity. `float` is less picky:

```python
>>> format(3.14, '0<011,.2f')
'3.140000000'
>>> format(Fraction('3.14'), '0<011,.2f')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mdickinson/Repositories/python/cpython/Lib/fractions.py", line 414, in __format__
    raise ValueError(
ValueError: Invalid format specifier '0<011,.2f' for object of type 'Fraction'; can't use explicit alignment when zero-padding
```
2023-01-22 18:44:49 +00:00
achhina 95f5b05a8c
GH-88597: Added command line interface to UUID module. (#99463)
The `uuid` module now supports command line usage.

```python
❯ ./python.exe -m uuid             
5f2d57b1-90e8-417c-ba5d-69b9b6f74289

❯ ./python.exe -m uuid -h          
usage: uuid.py [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-ns NAMESPACE] [-n NAME]
...
```
2023-01-21 22:59:31 -08:00
Kamil Turek b4e11a7985
gh-99266: ctypes: Preserve more detailed exception in `ArgumentError`
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-21 19:14:43 +05:30
scrazzz 120cb18c72
Fix rst formatting in 3.12 What's New (#101110) 2023-01-21 14:23:54 +05:30
Barney Gale 01093b8203
gh-86610: Use attribute directive in docs for pathlib.PurePath (#101114) 2023-01-20 23:13:58 +01:00
Jürgen Gmach 9a155138c5
GH-101111: Disambigaute origin of const for store_const and append_const (#101121)
While the documentation for `optparse` mentioned that both `store_const` and
`append_const` store a constant value, it was not clear where this value was
coming from.

A link to `Option.const` makes this explicit.
2023-01-20 23:13:07 +01:00
Jürgen Gmach 61f338a005
GH-101112: Specify type of pattern for Path.rglob (#101132)
The documentation for `rglob` did not mention what `pattern` actually
is.

Mentioning and linking to `fnmatch` makes this explicit, as the
documentation for `fnmatch` both shows the syntax and some explanation.
2023-01-20 23:11:31 +01:00
caozhanhao f1d0711dd3
Fix a typo in whatsnew/3.12.rst (#101150) 2023-01-20 23:10:08 +01:00
Simon Robinson 73497690b5
Fix minor typos in SSL documentation (#101158) 2023-01-20 23:08:45 +01:00
Shantanu 783d1bc51b
gh-91485: Avoid unnecessary use of non-Python syntax in io docs (#101177) 2023-01-20 23:06:10 +01:00
Vladimir Malinovskii 8cdbc46090
Provided better example for logging cookbook (GH-101164)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2023-01-20 08:54:48 +00:00
richardhob 3fa8fe7177
gh-88324: Clarify documentation for redirected stdout/stderr when using subprocess in Linux (#94035)
* Update description of stdout, stderr, and stdin.

Changes:
- Move the ``None`` option (which is default) to the front of the list
  of input options
- Move the ``None`` option description up to make the default behavior
  more clear (No redirection)
- Remove mention of Child File Descriptors from ``None`` option description
2023-01-19 23:56:13 -08:00
Gregory P. Smith 5927013e47
gh-101144: Allow open and read_text encoding to be positional. (#101145)
The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only.

Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time.
2023-01-19 23:04:30 -08:00
Nikita Sobolev 9e025d305f
gh-101100: [Enum] Fix sphinx warnings in docs (GH-101122)
* gh-101100: [Enum] Fix sphinx warnings in 

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-01-19 18:16:21 -08:00
Tushar Sadhwani d65f485070
fix typo in 3.12 What's New (#101105) 2023-01-18 21:54:56 +05:30
Erlend E. Aasland b84be8d9c0
Docs: improve sqlite3 placeholders example (#101092) 2023-01-18 10:36:17 +01:00
Viicos c5660ae96f
Fix typo in `ReprEnum` documentation (#101079) 2023-01-17 16:21:56 +05:30
Steve Dower 30753c37c6
gh-100247: Improve documentation for custom shebang commands in py.exe launcher (GH-101083) 2023-01-16 17:01:04 +00:00
Mark Shannon 7b14c2ef19
GH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983) 2023-01-16 12:35:21 +00:00
scrazzz b82049993f
Docs: Remove duplicate `TraversableResources` reference (#101068) 2023-01-16 16:14:50 +05:30
Oleg Iarygin 8e9d08b062
gh-101041: Fix a misspelled name of `utctimetuple` in a doc warning (GH-101042) 2023-01-15 12:36:31 -08:00
Cristián Maureira-Fredes 5e9df888dd
Fix `ctypes` typo in `set_exception` (#101040) 2023-01-15 20:42:37 +05:30
Erlend E. Aasland 206f05a46b
gh-100668: Clarify how sqlite3 maps parameters onto placeholders (#100960)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-01-14 23:58:06 +01:00
Bob Kline 49cae39ef0
gh-101021: Document binary parameters as bytes (#101024) 2023-01-14 11:01:27 -08:00
JustAnotherArchivist ef633e5000
Sync-up parameter name in equivalent code snippet of `enumerate` (GH-101029) 2023-01-13 23:55:35 -06:00
Raymond Hettinger 6bde3d2fd3
Add recipes to showcase tee(), zip*, batched, starmap, and product. (GH-101023) 2023-01-13 19:01:22 -06:00
Raymond Hettinger 010576c6ea
Fix typo in docs (GH-101025) 2023-01-13 18:53:06 -06:00
Serhiy Storchaka e5bd5ad70d
gh-100160: Restore and deprecate implicit creation of an event loop (GH-100410)
Partially revert changes made in GH-93453.

asyncio.DefaultEventLoopPolicy.get_event_loop() now emits a
DeprecationWarning and creates and sets a new event loop instead of
raising a RuntimeError if there is no current event loop set.

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2023-01-13 14:40:29 +02:00
Steve Dower 468c3bf798
gh-100247: Fix py.exe launcher not using entire shebang command for finding custom commands (GH-100944) 2023-01-13 11:49:01 +00:00
Steve Dower b5d4347950
gh-86682: Adds sys._getframemodulename as an alternative to using _getframe (GH-99520)
Also updates calls in collections, doctest, enum, and typing modules to use _getframemodulename first when available.
2023-01-13 11:31:06 +00:00
Matthieu Dartiailh eecd422d1b
gh-96461: Improve docs for bytecode instructions (GH-96462)
* Clarify the meaning of the oparg for CACHE and COPY opcode in dis doc

* Use STACK to describe stack operation in analogy with a Python list

* Remove (delta) from BEFORE_WITH since BEFORE_WITH does not take an argument

* Fix the description of the stack impact of multiple opcodes
2023-01-12 18:23:50 +00:00
Noam Cohen 2161bbf243
Fix typo in `enum` module documentation (#100992) 2023-01-12 21:10:29 +05:30
ram vikram singh d9dff4c8b5
GH-100894: Updated the doc for `sys.winver` to clarify its usual contents (GH-100913) 2023-01-12 00:11:12 +00:00
Mariusz Felisiak 847d7708ba
gh-98763: Prefer "python" over "python3" for command line examples in docs. (#98761) 2023-01-11 15:35:41 +05:30
Yao-Ching Huang b2f7b2ef0b
gh-100916: Convert argument to appropriate type (GH-100917) 2023-01-10 10:17:57 +00:00
Semen Zhydenko 35650f2538
Fix typos in Doc folder (#100880) 2023-01-10 11:04:06 +02:00
Ryan Ozawa e098137cd3
bpo-28356: Document os.rename() behavior on Windows for differing volumes (GH-27376) 2023-01-09 21:43:09 +00:00
dsentinel 7a50d6b5b0
GH-100813: Add `socket.IP_PKTINFO` constant (#10294) 2023-01-09 14:30:40 +05:30
Nikita Sobolev bc0a686f82
gh-87447: Fix walrus comprehension rebind checking (#100581)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-01-08 15:51:29 -07:00
Raymond Hettinger b139bcd892
GH-100485: Tweaks to sumprod() (GH-100857) 2023-01-08 13:38:24 -06:00
Benjamin Peterson 11f99323c2
Update copyright years to 2023. (gh-100848) 2023-01-08 09:13:25 -06:00
Shantanu 53455a319f
gh-100783: fix os.path.join documentation (#100811)
- Use "drive", not "drive letter", because of UNC paths
- Previous components are not thrown away from relative drive letters
- Use "segment" instead of "component" for consistency with pathlib
- Other miscellaneous improvements
2023-01-08 00:51:30 -08:00
busywhitespace 6d3bc4a795
gh-100824: Fix typo in the documentation of unittest.TestLoader.testNamePatterns (#100825) 2023-01-08 13:37:16 +05:30
Raymond Hettinger 47b9f83a83
GH-100485: Add math.sumprod() (GH-100677) 2023-01-07 12:46:35 -06:00
FrozenBob deaf090699
gh-100673: Removed erroneous note in the get_type_hints docs (#100701)
Removed erroneous note in the get_type_hints docs

typing.get_type_hints still includes base class type hints.
2023-01-07 17:31:47 +00:00
Mark Shannon 78068126a1
GH-99005: More intrinsics (GH-100774)
* Remove UNARY_POSITIVE, LIST_TO_TUPLE and ASYNC_GEN_WRAP, replacing them with intrinsics.
2023-01-06 14:47:57 +00:00
Akshit Tyagi 659c2607f5
gh-99026 update dataclasses docs for when annotations are inspected (gh-100798)
update dataclasses docs for when annotations are inspected
2023-01-06 09:26:44 -05:00
Shantanu 2f2fa03ff3
gh-87691: clarify use of anchor in pathlib docs (#100782)
This is feedback from https://github.com/python/cpython/pull/100737#discussion_r1062968696

This matches the wording from the `os.path.join` docs better:
https://docs.python.org/3/library/os.path.html#os.path.join

In particular, the previous use of "anchor" was incorrect given the
pathlib definition of "anchor".

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-01-05 17:49:33 -08:00
Shantanu 1ae619c911
gh-87691: add an absolute path pathlib example in / operator docs (GH-100737)
The behaviour is fully explained a couple paragraphs above, but it may be useful to have a brief example to cover the behaviour.

Automerge-Triggered-By: GH:hauntsaninja
2023-01-05 14:55:35 -08:00
Mark Shannon 28187141cc
GH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)
* Remove PRINT_EXPR instruction

* Remove STOPITERATION_ERROR instruction

* Remove IMPORT_STAR instruction
2023-01-05 16:05:51 +00:00
Tzu-ping Chung 105e37395d
GH-100766: Note that locale.LC_MESSAGES is not universal (GH-100702) 2023-01-05 03:34:30 +00:00
David Lechner 5fb1c08e15
docs: fix `ssizeobjargproc` parameters (#100736) 2023-01-04 13:47:42 +05:30
Ethan Furman a286caa937
gh-91219: http - use subclassing to override index_pages attribute (GH-100731)
Remove previously added parameter to `__init__`, and recommend subclassing to modify the `index_pages` attribute instead.
2023-01-03 15:20:08 -08:00
Christophe Nanteuil 64ed609c53
[Enum] docs: replace 'last value' by 'highest value' for Flag auto (GH-100709) 2023-01-03 14:08:50 -08:00
Zachary Ware e196d8c10a
gh-100700: Remove Date and Release fields in past whatsnews (GH-100728) 2023-01-03 16:00:26 -06:00
4l4k4z4m 8b1f125121
gh-81611: Improve `range` paragraph in 8.3 of language reference (#98353)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-01-03 13:46:51 +05:30
Kumar Aditya 7feb6d2f85
fix `grammer` -> `grammar` typo in expressions.rst (GH-100683)
Automerge-Triggered-By: GH:AlexWaygood
2023-01-02 03:49:06 -08:00
Alexander Shadchin 254ab42240
Fix deprecation doc for `PyEval_InitThreads` (#100667) 2023-01-02 16:43:55 +05:30
Shantanu edfbf56f4c
gh-100428: Make int documentation more accurate (#100436)
- Remove first link to lexical definition of integer literal, since it
  doesn't apply (differs in handling of leading zeros, base needs to be
  explicitly specified, unicode digits are allowed)
- Better describe handling of leading zeros, unicode digits, underscores
- Base 0 does not work exactly as like a code literal, since it allows
  Unicode digits. Link code literal to lexical definition of integer
  literal.
2023-01-01 19:14:18 -08:00
Erlend E. Aasland b7a68ab824
gh-99953: Purge mention of numeric param style from sqlite3 docs (#100630)
The PEP-249 numeric style has never been supported by sqlite3.
2023-01-01 23:26:23 +01:00
Jason R. Coombs 447d061bc7
gh-97930: Apply changes from importlib_resources 5.10. (GH-100598) 2023-01-01 11:07:32 -05:00
ram vikram singh 1aab269d4a
gh-100201: Document behavior with a bare `yield` statement (#100416)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-01-01 21:06:13 +05:30