Commit graph

13651 commits

Author SHA1 Message Date
Petr Viktorin
2a66dd33df
gh-112328: Make EnumDict usable on its own and document it (GH-123669)
Co-authored-by: Rafi <rafi.promit@gmail.com>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-12-20 11:40:58 -08:00
Md Rokibul Islam
39e69a7cd5
gh-112328: Document EnumDict in docs and release notes (GH-121720)
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-12-19 15:38:42 -08:00
mpage
255762c09f
gh-127274: Defer nested methods (#128012)
Methods (functions defined in class scope) are likely to be cleaned
up by the GC anyway.

Add a new code flag, `CO_METHOD`, that is set for functions defined
in a class scope. Use that when deciding to defer functions.
2024-12-19 13:03:14 -08:00
Mark Shannon
d2f1d917e8
GH-122548: Implement branch taken and not taken events for sys.monitoring (GH-122564) 2024-12-19 16:59:51 +00:00
RUANG (James Roy)
ea578fc6d3
gh-127688: Add SCHED_DEADLINE and SCHED_NORMAL constants to os module (GH-127689) 2024-12-19 14:51:21 +01:00
Kumar Aditya
19c5134d57
gh-122706: fix docs for asyncio ssl sockets (#128092) 2024-12-19 12:45:36 +00:00
Kumar Aditya
dbd08fb60d
gh-127949: deprecate asyncio.get_event_loop_policy (#128053)
This deprecates `asyncio.get_event_loop_policy` and will be removed in Python 3.16.
2024-12-18 18:04:20 +05:30
Kumar Aditya
5892853fb7
gh-127949: deprecate asyncio.set_event_loop_policy (#128024)
First step towards deprecating the asyncio policy system.
This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.
2024-12-18 11:35:29 +05:30
Hugo van Kemenade
401bfc69d1 Python 3.14.0a3 2024-12-17 11:50:39 +02:00
Gugubo
e4981e33b8
Fix typo in itertools docs (gh-127995) 2024-12-16 11:08:25 -06:00
Steve C
7900a85019
Clarify ast docs to use a less confusing example for ast.ParamSpec (#127955)
Fix typo in ast docs: ParamSpec defaults
2024-12-15 12:28:43 +00:00
Sergey B Kirpichev
e2325c9db0
gh-127852: add remark about ',' separator (#127854)
Specify that it is valid for floats and ints with 'd' presentation and an error otherwise.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-12-14 08:28:26 -05:00
Raymond Hettinger
292067fbc9
Minor readability improvements for the itertools recipes (gh-127928) 2024-12-13 12:12:49 -06:00
Viktor Kálmán
11ff3286b7
link to the correct output method in documentation (#127857) 2024-12-13 14:57:02 +05:30
Daniel Haag
0cbc19d59e
Fix typo in traceback docs (#127884) 2024-12-12 21:43:44 +00:00
Raymond Hettinger
8bbd379ee3
Simplify and speed-up an itertools recipe (gh-127848) 2024-12-11 21:24:56 -06:00
Yuki Kobayashi
035f512046
Docs: Fix indents in xmlrpc.client.rst (#127782) 2024-12-10 19:35:00 +02:00
Victor Stinner
c91ccbe4ac
gh-59705: Set OS thread name when Thread.name is changed (#127702)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-12-10 17:33:11 +01:00
Yuki Kobayashi
8dbdbad6e0
gh-101100: Fix sphinx warnings in whatsnew/3.0.rst (#127662) 2024-12-10 12:22:37 +02:00
Bénédikt Tran
4331832db0
gh-125420: implement Sequence.count API on memoryview objects (#125443) 2024-12-10 10:12:33 +00:00
Hugo van Kemenade
212448b162
gh-127718: Add colour to test.regrtest output (#127719) 2024-12-10 09:44:15 +02:00
Bénédikt Tran
58c753827a
gh-125420: implement Sequence.index API on memoryview objects (#125446) 2024-12-09 18:48:38 -08:00
Barney Gale
8b3cccf3f9
GH-125413: Revert addition of pathlib.Path.scandir() method (#127377)
Remove documentation for `pathlib.Path.scandir()`, and rename the method to
`_scandir()`. In the private pathlib ABCs, make `iterdir()` abstract and
call it from `_scandir()`.

It's not worthwhile to add this method at the moment - see discussion:
https://discuss.python.org/t/ergonomics-of-new-pathlib-path-scandir/71721

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2024-12-05 21:39:43 +00:00
Hugo van Kemenade
23f2e8f13c
gh-127221: Add colour to unittest output (#127223)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-12-05 21:10:46 +02:00
Bénédikt Tran
67b9a5331a
gh-127413: allow to show specialized bytecode via dis CLI (#127414) 2024-12-05 15:01:59 +00:00
RUANG (James Roy)
6bc3e830a5
gh-127481: Add EPOLLWAKEUP to the select module (GH-127482) 2024-12-04 14:30:38 +01:00
Bénédikt Tran
bc0f2e9459
gh-123378: Ensure results of PyUnicode*Error_Get{Start,End} are clamped (GH-123380)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-04 14:13:52 +01:00
Raymond Hettinger
7f882c88cf
Itertool recipe additions (gh-127483) 2024-12-03 18:20:01 -06:00
Tomas R.
8ba9f5bca9
gh-127347: Document traceback.print_list (#127348)
Previously, `traceback.print_list` didn't have a documentation entry and was not exposed in `traceback.__all__`. Now it has a documentation entry and is exposed in `__all__`.
2024-12-03 18:08:39 +02:00
Jun Komoda
412e11fe6e
gh-127255: Make CopyComPointer public and add to ctypes doc. (GH-127275) 2024-12-03 16:35:08 +01:00
RUANG (James Roy)
84ff1313d0
gh-126585: Add EHWPOISON error code (#126586) 2024-12-03 12:45:50 +00:00
Yuki Kobayashi
3e812253ab
gh-101100: Fix Sphinx warnings about list methods (#127054) 2024-12-02 15:51:35 +02:00
Giovanni Siragusa
31f16e427b
gh-109523: Raise a BlockingIOError if reading text from a non-blocking stream cannot immediately return bytes. (GH-122933) 2024-12-02 14:18:30 +01:00
Ollanta Cuba Gyllensten
15d6506d17
Link to correct class methods in asyncio primitives docs (#127270) 2024-11-29 16:20:40 +00:00
Илья Любавский
dd3a87d2a8
gh-127303: Add docs for token.EXACT_TOKEN_TYPES (#127304)
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-29 04:00:50 -05:00
Jun Komoda
49fee592a4
Touch up docs for ctypes.FormatError & WinError (GH-127210)
Reformat paragraphs, add backquotes, and directives.
2024-11-28 16:59:47 +01:00
Jelle Zijlstra
9328db7652
Fix indentation for contextlib.asynccontextmanager docs (#127333) 2024-11-27 06:38:55 -08:00
Sergey B Kirpichev
987311d42e
gh-69639: Add mixed-mode rules for complex arithmetic (C-like) (GH-124829)
"Generally, mixed-mode arithmetic combining real and complex variables should
be performed directly, not by first coercing the real to complex, lest the sign
of zero be rendered uninformative; the same goes for combinations of pure
imaginary quantities with complex variables." (c) Kahan, W: Branch cuts for
complex elementary functions.

This patch implements mixed-mode arithmetic rules, combining real and
complex variables as specified by C standards since C99 (in particular,
there is no special version for the true division with real lhs
operand).  Most C compilers implementing C99+ Annex G have only these
special rules (without support for imaginary type, which is going to be
deprecated in C2y).
2024-11-26 17:57:39 +02:00
Jelle Zijlstra
dcf629213b
gh-119180: Add VALUE_WITH_FAKE_GLOBALS format to annotationlib (#124415) 2024-11-26 15:40:13 +00:00
Filipe Laíns 🇵🇸
2b0e2b2893
GH-126985: move pyvenv.cfg detection from site to getpath (#126987) 2024-11-26 13:46:33 +00:00
Richard Hansen
ab237ff81d
Doc: Typo fix: nrace -> race (#127288) 2024-11-26 15:05:07 +02:00
Barney Gale
5bb059fe60
GH-127236: pathname2url(): generate RFC 1738 URL for absolute POSIX path (#127194)
When handed an absolute Windows path such as `C:\foo` or `//server/share`,
the `urllib.request.pathname2url()` function returns a URL with an
authority section, such as `///C:/foo` or `//server/share` (or before
GH-126205, `////server/share`). Only the `file:` prefix is omitted.

But when handed an absolute POSIX path such as `/etc/hosts`, or a Windows
path of the same form (rooted but lacking a drive), the function returns a
URL without an authority section, such as `/etc/hosts`.

This patch corrects the discrepancy by adding a `//` prefix before
drive-less, rooted paths when generating URLs.
2024-11-25 19:59:20 +00:00
Jun Komoda
f4f075b3d5
Replace :platform: with .. availability:: in socket.ioctl doc. (GH-127122)
In `socket.ioctl`, `:platform:` -> `.. availability::`
2024-11-25 13:53:17 +01:00
Barney Gale
307c633586
Improve pathname2url() and url2pathname() docs (#127125)
These functions have long sown confusion among Python developers. The
existing documentation says they deal with URL path components, but that
doesn't fit the evidence on Windows:

    >>> pathname2url(r'C:\foo')
    '///C:/foo'
    >>> pathname2url(r'\\server\share')
    '////server/share'  # or '//server/share' as of quite recently

If these were URL path components, they would imply complete URLs like
`file://///C:/foo` and `file://////server/share`. Clearly this isn't right.
Yet the implementation in `nturl2path` is deliberate, and the 
`url2pathname()` function correctly inverts it.

On non-Windows platforms, the behaviour until quite recently is to simply
quote/unquote the path without adding or removing any leading slashes. This
behaviour is compatible with *both* interpretations -- 1) the value is a
URL path component (existing docs), and 2) the value is everything
following `file:` (this commit)

The conclusion I draw is that these functions operate on everything after
the `file:` prefix, which may include an authority section. This is the
only explanation that fits both the  Windows and non-Windows behaviour.
It's also a better match for the function names.
2024-11-24 17:33:46 +00:00
Savannah Ostrowski
2104bde572
GH-127133: Remove ability to nest argument groups & mutually exclusive groups (#127186) 2024-11-24 15:20:37 +00:00
Barney Gale
cc813e10ff
GH-125866: Preserve Windows drive letter case in file URIs (#127138)
Stop converting Windows drive letters to uppercase in
`urllib.request.pathname2url()` and `url2pathname()`. This behaviour is
unnecessary and inconsistent with pathlib's file URI implementation.
2024-11-23 10:41:39 +00:00
Savannah Ostrowski
a13e94d84b
GH-127134: Add note about forward compatibility for suggest_on_error (#127137) 2024-11-22 19:18:18 -08:00
Rafael Fontenelle
39e60aeb38
Fix a few typos found in the docs (GH-127126) 2024-11-22 16:02:51 -08:00
Serhiy Storchaka
a5440d4a38
gh-86463: Fix a trailing space in argparse.rst (#127162) 2024-11-22 16:34:05 +00:00
Serhiy Storchaka
8899e85de1
gh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035)
* Name without a PATHEXT extension is only searched if the mode does not
  include X_OK.
* Support multi-component PATHEXT extensions (e.g. ".foo.bar").
* Support files without extensions in PATHEXT contains dot-only extension
  (".", "..", etc).
* Support PATHEXT extensions that end with a dot (e.g. ".foo.").
2024-11-22 17:52:15 +02:00