Commit Graph

28328 Commits

Author SHA1 Message Date
sobolevn 84a5597b08
gh-121567: Improve `slice` C-API docs by mentioning exceptions (#121568)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-07-10 13:56:44 +03:00
sobolevn 649d5b6d7b
gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions (#121534)
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-09 18:47:35 +03:00
Rafael Fontenelle 9ba2a4638d
Docs: fix typo and duplicate word in configure.rst (#121410) 2024-07-09 14:24:37 +02:00
AN Long facf9862da
gh-121333: Clarify what is the default executor for asyncio.run_in_executor (#121335)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-07-09 14:52:07 +05:30
Hugo van Kemenade 006b53a42f
NEWS: Fix Sphinx warnings and increase threshold for new news nits (#121482)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-08 14:30:05 -06:00
CBerJun bf74db731b
gh-121461: Fix os.path.normpath documentation indentation (#121466) 2024-07-08 03:51:03 +00:00
Kirill Podoprigora 53e12025cd
Regen ``Doc/requirements-oldest-sphinx.txt`` (#121437)
regen dependencies
2024-07-06 20:04:41 +02:00
Bénédikt Tran ada964fba0
[docs] fix a Sphinx directive in `c-api/object.rst` (#121430) 2024-07-06 19:57:26 +02:00
Barney Gale 88fc0655d4
GH-73991: Support preserving metadata in `pathlib.Path.copy()` (#120806)
Add *preserve_metadata* keyword-only argument to `pathlib.Path.copy()`, defaulting to false. When set to true, we copy timestamps, permissions, extended attributes and flags where available, like `shutil.copystat()`. The argument has no effect on Windows, where metadata is always copied.

Internally (in the pathlib ABCs), path types gain `_readable_metadata` and `_writable_metadata` attributes. These sets of strings describe what kinds of metadata can be retrieved and stored. We take an intersection of `source._readable_metadata` and `target._writable_metadata` to minimise reads/writes. A new `_read_metadata()` method accepts a set of metadata keys and returns a dict with those keys, and a new `_write_metadata()` method accepts a dict of metadata. We *might* make these public in future, but it's hard to justify while the ABCs are still private.
2024-07-06 17:18:39 +01:00
Yuxin Wu 892e3a1b70
Update example of str.split, bytes.split (#121287)
In `{str,bytes}.strip(chars)`, multiple characters are not treated as a
prefix/suffix, but as individual characters. This may make users confuse
whether `split` has similar behavior.
Users may incorrectly expect that
`'Good morning, John.'.split(', .') == ['Good', 'morning', 'John']`

Adding a bit of clarification in the doc.

Co-authored-by: Yuxin Wu <ppwwyyxx@users.noreply.github.com>
2024-07-05 13:08:29 -07:00
Sergey B Kirpichev d4faa7bd32
gh-121149: improve accuracy of builtin sum() for complex inputs (gh-121176) 2024-07-05 10:01:05 -05:00
Ali Tavallaie cb688bab08
gh-90437: Fix __main__.py documentation wording (GH-116309)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Frank Dana <ferdnyc@gmail.com>
2024-07-04 15:49:14 -07:00
Jongbum Won 715ec630dd
gh-121355: Fix incorrect word in simple_stmts.rst (#121356) 2024-07-04 06:34:34 -07:00
Bénédikt Tran 9728ead361
gh-121141: add support for `copy.replace` to AST nodes (#121162) 2024-07-03 20:10:54 -07:00
Vinay Sajip 26d24eeb90
gh-121035: Update PNG image for logging flow diagram. (GH-121323) 2024-07-03 12:33:28 +01:00
Sergey B Kirpichev 51c4a324c0
gh-61103: Support float and long double complex types in ctypes module (#121248)
This amends 6988ff02a5: memory allocation for
stginfo->ffi_type_pointer.elements in PyCSimpleType_init() should be
more generic (perhaps someday fmt->pffi_type->elements will be not a
two-elements array).

It should finally resolve #61103.

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-03 11:08:11 +02:00
Amin Alaee 9d3c9b822c
Docs: Add `os.splice` flags argument (#109847)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
2024-07-03 13:40:57 +05:30
da-woods 4232976b02
docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (#112237) 2024-07-03 13:35:02 +05:30
AN Long ff5751a208
gh-111872: Document the max_children attribute for `socketserver.ForkingMixIn` (#118134) 2024-07-03 13:16:57 +05:30
Serhiy Storchaka ff5806c78e
gh-121027: Make the functools.partial object a method descriptor (GH-121089)
Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
2024-07-03 09:02:15 +03:00
Barney Gale f09d184821
GH-73991: Support copying directory symlinks on older Windows (#120807)
Check for `ERROR_INVALID_PARAMETER` when calling `_winapi.CopyFile2()` and
raise `UnsupportedOperation`. In `Path.copy()`, handle this exception and
fall back to the `PathBase.copy()` implementation.
2024-07-03 04:30:29 +01:00
Vinay Sajip 089835469d
gh-121035: Further improve logging flow diagram with respect to dark/light modes. (GH-121265) 2024-07-02 18:57:34 +01:00
Vinay Sajip bfe0e4d769
gh-121035: Improve logging flow diagram for dark/light modes. (GH-121254) 2024-07-02 09:13:37 +01:00
Rafael Fontenelle 4f1e1dff89
Fix phrasing in paragraphs with leading "similar" (#121135) 2024-07-01 17:36:27 -07:00
sobolevn 1dc9a4f6b2
gh-121196: Document `dict.fromkeys` params as pos-only (#121197) 2024-07-01 23:27:04 +03:00
Danny Yang 91313afdb3
gh-114104: clarify asynchronous comprehension docs to match runtime behavior (#121175) 2024-07-01 22:04:39 +05:30
Victor Stinner d44c550f7e
gh-120743: Soft deprecate os.popen() function (#120744)
Soft deprecate os.popen() and os.spawn*() functions.
2024-07-01 18:27:50 +02:00
Sergey B Kirpichev 6988ff02a5
gh-61103: Support double complex (_Complex) type in ctypes (#120894)
Example:

```pycon
>>> import ctypes
>>> ctypes.__STDC_IEC_559_COMPLEX__
1
>>> libm = ctypes.CDLL('libm.so.6')
>>> libm.clog.argtypes = [ctypes.c_double_complex]
>>> libm.clog.restype = ctypes.c_double_complex
>>> libm.clog(1+1j)
(0.34657359027997264+0.7853981633974483j)
```

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-01 10:54:33 +02:00
Kirill Podoprigora 1a84bdc237
gh-121163: Add "all" as an valid alias for "always" in warnings.simplefilter() (#121164)
Add support for ``all`` as an valid alias for ``always`` in ``warnings.simplefilter()``
and ``warnings.filterswarnings()``.
2024-06-30 19:48:00 +02:00
Vinay Sajip 2a455bbe8f
[doc] Update element positions and styles in logging flow diagram. (GH-121182)
Update element positions and styles.
2024-06-30 14:38:49 +01:00
Russell Keith-Magee 48cd104b0c
gh-120522: Add a `--with-app-store-compliance` configure option to patch out problematic code (#120984)
* Add --app-store-compliance configuration option.

* Added blurb.

* Correct tab-vs-spaces formatting issue.

* Correct source file name in docs.

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>

* Correct source code reference in Mac docs

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>

* Only apply the patch forward, and ensure the working directory is correct.

* Make patching reslient to multiple builds.

* Documentation fixes found during review

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>

* Documentation and configure.ac syntax improvements

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>

* Regenerate configure script.

* Silence the patch echo output.

---------

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-06-30 08:34:35 +08:00
Barney Gale 6b280a8498
GH-119054: Add alt text to pathlib inheritance diagram (#121158)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-29 17:46:53 +00:00
Barney Gale d6d8707ff2
GH-119054: Add "Expanding and resolving paths" section to pathlib docs. (#120970)
Add dedicated subsection for `home()`, `expanduser()`, `cwd()`,
`absolute()`, `resolve()` and `readlink()`. The position of this section
keeps all the `Path` constructors (`Path()`, `Path.from_uri()`,
`Path.home()` and `Path.cwd()`) near the top. Within the section, closely
related methods are kept adjacent. Specifically:

-.`home()` and `expanduser()` (the former calls the latter)
- `cwd()` and `absolute()` (the former calls the latter)
- `absolute()` and `resolve()` (both make paths absolute)
- `resolve()` and `readlink()` (both read symlink targets)
- Ditto `cwd()` and `absolute()`
- Ditto `absolute()` and `resolve()`

The "Other methods" section is removed.
2024-06-29 16:09:47 +01:00
Wim Jeantine-Glenn 0a1e8ff9c1
gh-121101: Document -Wall option (an alias for -Walways) (#121102) 2024-06-29 12:10:13 +05:30
Steve Dower 2894aa14f2
gh-121115: Skip __index__ in PyLong_AsNativeBytes by default (GH-121118) 2024-06-28 16:26:21 +01:00
Kumar Aditya 58a3580836
gh-107803: add whatsnew for asyncio double linked list implementation (#120995) 2024-06-28 14:33:31 +05:30
Alexander Bessman 237baf4d7a
gh-121035: Update logging flow chart to include the lastResort handler. (GH-121036) 2024-06-27 22:11:40 +01:00
Kerim Kabirov 0890ad7c02
gh-115986 Improve pprint docs formatting (GH-117401)
* Move pprinter parameters description to the table

The change improves readability.
Suggested in the GH#116085 PR discussion.

* Make pprint doc with params markup

* Fix formatting
Indentation of code blocks made them nested
"Version changed" is better placed after the code block

* Fix formatting for tests

* fix code indentation for autotests

* Fix identation for autotests

* Remove duplication of the parameters' description

* Rearrange parameters description in a correct order

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-27 16:32:50 +02:00
Serhiy Storchaka db96edd6d1
gh-121027: Add a future warning in functools.partial.__get__ (#121086) 2024-06-27 11:47:20 +00:00
chaen 1c13b29d54
gh-120937: Reference weakref from the `__del__` documentation (#120940)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-26 23:07:09 +03:00
Hugo van Kemenade ead676516d
Doc/README: Document 'make htmllive' (#120692)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-06-25 12:08:55 +03:00
Bénédikt Tran bb057ea107
gh-120661: improve example for basic type hints (#120934) 2024-06-25 07:59:56 +00:00
Barney Gale e4a97a7fb1
GH-119054: Add "Permissions and ownership" section to pathlib docs. (#120505)
Add dedicated subsection for `pathlib.owner()`, `group()`, `chmod()` and
`lchmod()`.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-24 19:05:24 +00:00
Sam Gross 375b723d58
gh-120858: PyDict_Next should not lock the dict (#120859)
PyDict_Next no longer locks the dictionary in the free-threaded build. Locking
around individual PyDict_Next calls is not sufficient because the function
returns borrowed references and because it allows concurrent modifications
during the iteraiton loop.

The internal locking also interferes with correct external synchronization
because it may suspend outer critical sections created by the caller.
2024-06-24 14:15:15 -04:00
Victor Stinner 2e157851e3
gh-119182: Add PyUnicodeWriter_WriteUCS4() function (#120849) 2024-06-24 17:40:39 +02:00
Christian Clauss 22b8a35d6e
docs: puremagic.what() as replacement for imghdr.what() (#120871) 2024-06-24 15:32:13 +02:00
Pablo Galindo Salgado ac61d58db0
gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-06-24 14:08:12 +02:00
Alek Kowalczyk fc297b4ba4
gh-112169: Documented getaddrinfo/getnameinfo default loop executor usage and implications. (#112191)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-06-24 08:35:02 +00:00
Barney Gale 35e998f560
GH-73991: Add `pathlib.Path.copytree()` (#120718)
Add `pathlib.Path.copytree()` method, which recursively copies one
directory to another.

This differs from `shutil.copytree()` in the following respects:

1. Our method has a *follow_symlinks* argument, whereas shutil's has a
   *symlinks* argument with an inverted meaning.
2. Our method lacks something like a *copy_function* argument. It always
   uses `Path.copy()` to copy files.
3. Our method lacks something like a *ignore_dangling_symlinks* argument.
   Instead, users can filter out danging symlinks with *ignore*, or
   ignore exceptions with *on_error*
4. Our *ignore* argument is a callable that accepts a single path object,
   whereas shutil's accepts a path and a list of child filenames.
5. We add an *on_error* argument, which is a callable that accepts
   an `OSError` instance. (`Path.walk()` also accepts such a callable).

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-06-23 22:01:12 +01:00
Hugo van Kemenade bc37ac7b44
Docs makefile/RTD: Use uv if installed (#120711) 2024-06-23 13:23:27 -06:00