Commit Graph

28387 Commits

Author SHA1 Message Date
Erlend E. Aasland 325a1da18d
gh-115119: Default to --with-system-libmpdec=yes (#118539)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2024-05-06 21:16:08 +02:00
Petr Viktorin 417dd3aca7
gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645) 2024-05-06 18:59:36 +02:00
Kerim Kabirov 3ed3bc379a
GH-115577 Clarify netloc term usage in urllib.parse docs (GH-117632) 2024-05-06 18:55:22 +02:00
Serhiy Storchaka 709ca90a00
gh-118271: Support more options for reading/writing images in Tkinter (GH-118273)
* Add PhotoImage.read() to read an image from a file.
* Add PhotoImage.data() to get the image data.
* Add background and grayscale parameters to PhotoImage.write().
2024-05-06 15:06:06 +00:00
Xie Yanbo fc50f1bdba
Fix typo in Doc/library/asyncio-task.rst (GH-118627) 2024-05-06 08:00:31 -07:00
Serhiy Storchaka 1b639a04ca
gh-118225: Support more options for copying images in Tkinter (GH-118228)
* Add the PhotoImage method copy_replace() to copy a region
  from one image to other image, possibly with pixel zooming and/or
  subsampling.
* Add from_coords parameter to PhotoImage methods copy(), zoom() and subsample().
* Add zoom and subsample parameters to PhotoImage method copy().
2024-05-06 17:33:15 +03:00
Serhiy Storchaka d6fa1d4bee
gh-66543: Add mimetypes.guess_file_type() (GH-117258) 2024-05-06 15:50:52 +03:00
Alyssa Coghlan 757fd3e010
gh-74929: locals() documentation update for PEP 667 (#118265)
Documentation wording taken from the
withdrawn PEP 558 (which had switched to the
Python level semantics proposed in PEP 667 prior
to its withdrawal).
2024-05-06 20:06:07 +10:00
Serhiy Storchaka 153b3f7530
gh-118465: Add __firstlineno__ attribute to class (GH-118475)
It is set by compiler with the line number of the first line of
the class definition.
2024-05-06 12:02:37 +03:00
Gregory P. Smith b744fa5d3e
gh-111140: minor docs typos cleanup in the C example API calls. (#118612) 2024-05-05 21:43:42 +00:00
Pablo Galindo Salgado f27f8c790a
gh-111201: A new Python REPL (GH-111567)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-05 21:32:23 +02:00
Guido van Rossum 9c13d9e37a
gh-74929: Rudimentary docs for PEP 667 (#118581)
This is *not* sufficient for the final 3.13 release, but it will do for beta 1:

- What's new entry
- Updated changelog entry (news blurb)
- Mention the proxy for f_globals in the datamodel and Python frame object docs

This doesn't have any C API details (what's new refers to the PEP).
2024-05-05 15:31:26 +00:00
Tian Gao 5a0022a1d7
GH-111744: Make breakpoint() enter the debugger immediately (GH-118579) 2024-05-05 07:05:01 -07:00
Raymond Hettinger c7c9b913c0
gh-118476: Fix corner cases in islice() rough equivalent. (Gh-118559) 2024-05-05 01:42:30 -05:00
Hugo van Kemenade 3b32575ed6
gh-118131: Command-line interface for the `random` module (#118132) 2024-05-05 06:30:03 +00:00
Pablo Galindo Salgado 1b22d801b8
gh-118518: Allow perf to work without frame pointers (#112254) 2024-05-05 03:07:29 +02:00
Tian Gao b034f14a4b
gh-74929: Implement PEP 667 (GH-115153) 2024-05-04 12:12:10 +01:00
Irit Katriel 85af789961
gh-111997: C-API for signalling monitoring events (#116413) 2024-05-04 08:23:50 +00:00
Raymond Hettinger 42dc5b4ace
gh-115532 Add kde_random() to the statistic module (#118210) 2024-05-03 23:13:36 -05:00
Raymond Hettinger 6d9e8e989e
Minor improvements to the itertools recipes (#118563) 2024-05-03 17:07:47 -05:00
Ned Batchelder 9d67b72a49
docs: clarify csv.DictReader's treatment of the first data row (#118549) 2024-05-03 08:48:27 -07:00
Brett Simmers c2627d6eea
gh-116322: Add Py_mod_gil module slot (#116882)
This PR adds the ability to enable the GIL if it was disabled at
interpreter startup, and modifies the multi-phase module initialization
path to enable the GIL when loading a module, unless that module's spec
includes a slot indicating it can run safely without the GIL.

PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went
with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148.

A warning will be issued up to once per interpreter for the first
GIL-using module that is loaded. If `-v` is given, a shorter message
will be printed to stderr every time a GIL-using module is loaded
(including the first one that issues a warning).
2024-05-03 11:30:55 -04:00
Sam Gross 2dae505e87
gh-117514: Add `sys._is_gil_enabled()` function (#118514)
The function returns `True` or `False` depending on whether the GIL is
currently enabled. In the default build, it always returns `True`
because the GIL is always enabled.
2024-05-03 11:09:57 -04:00
Jelle Zijlstra ca269e58c2
gh-116126: Implement PEP 696 (#116129)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-05-03 06:17:32 -07:00
Nice Zombies 852263e108
gh-117492: Clarify documentation of `typing.Never` (#117678)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-05-03 06:02:11 -07:00
Tian Gao 4e2caf2aa0
gh-118500: Add pdb support for zipapp (#118501) 2024-05-02 21:53:27 +01:00
Pablo Galindo Salgado 6bcbee09df
gh-93502: Add new C-API functions to trace object creation and destruction (#115945) 2024-05-02 19:30:00 +02:00
Raphael Gaschignard 2770d5caca
gh-105879: Add support for keyword arguments to eval and exec (#105885)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-02 08:55:29 -07:00
Steve Dower 81939dad77
gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) 2024-05-02 15:20:43 +01:00
Serhiy Storchaka b3372481b6
gh-117903: Clarify that the staticmethod descriptor is callable (GH-117925) 2024-05-02 16:56:33 +03:00
Crowthebird 7c97dc8c95
gh-118216: Don't consider dotted `__future__` imports (#118267) 2024-05-02 06:32:20 -07:00
Andrew Zipperer a6b610a94b
docs: typo: tiny grammar change: "pointed by" -> "pointed to by" (#118411)
* docs: tiny grammar change: "pointed by" -> "pointed to by"

This commit uses "file pointed to by" to replace "file pointed by" in
 - doc for shutil.copytree
 - docstring for shutil.copytree
 - docstring _abc.PathBase.open
 - docstring for pathlib.Path.open
 - doc for os.copy_file_range
 - doc for os.splice

The docs use "file pointed to by" more frequently than
"file pointed by". So, this commit replaces the uses of
"file pointed by" in order to make the uses consistent
through the docs.

```bash
$ grep -ri 'pointed to by' cpython/
```
yields more results than
```bash
$ grep -ri 'pointed by' cpython/
```

Separately:

There are two occurrences of "tree pointed by":
 - cpython/Doc/library/xml.etree.elementtree.rst for
     `xml.etree.ElementInclude.include`
 - cpython/Lib/xml/etree/ElementInclude.py for `include`

For those uses of "tree pointed by", I expect "tree pointed to by"
instead. However, I found enough uses online of (a) "tree pointed by"
rather than (b) "tree pointed to by" to convince me that (a) is in
common use.

So, this commit does not replace those occurrences of "tree pointed by"
to "tree pointed to by". But I will replace them if a reviewer
believes it is correct to replace them.

* docs: typo: "exists and executable" -> "exists and is executable"

---------

Co-authored-by: Andrew-Zipperer <atzipperer@gmail.com>
2024-05-02 05:37:12 +00:00
Guido van Rossum a37b093228
gh-118335: Rename --experimental-interpreter on Windows to --experimental-jit-interpreter (#118497)
Also fix docs for this in whatsnew.
2024-05-02 00:48:34 +00:00
Filipe Laíns 97feb4a78b
GH-118174: specify the type for the path argument of shutil.which 2024-05-02 00:13:32 +01:00
Hugo van Kemenade 164e2c31c0
gh-117225: Document colour use in `doctest` (#118268) 2024-05-01 12:25:11 -06:00
Victor Stinner b52c753e0f
gh-110850: Add PyTime_TimeRaw() function (#118394)
Add "Raw" variant of PyTime functions:

* PyTime_MonotonicRaw()
* PyTime_PerfCounterRaw()
* PyTime_TimeRaw()

Changes:

* Add documentation and tests. Tests release the GIL while calling
  raw clock functions.
* py_get_system_clock() and py_get_monotonic_clock() now check that
  the GIL is hold by the caller if raise_exc is non-zero.
* Reimplement "Unchecked" functions with raw clock functions.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-01 18:05:01 +00:00
Jason R. Coombs a8bcf3ec32
Expand the 'Extending' docs with an example. (#113187)
* Expand the 'Extending' docs to provide a minimal example. Closes python/importlib_metadata#427.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-01 17:04:02 +00:00
Guido van Rossum 7d83f7bcc4
gh-118335: Configure Tier 2 interpreter at build time (#118339)
The code for Tier 2 is now only compiled when configured
with `--enable-experimental-jit[=yes|interpreter]`.

We drop support for `PYTHON_UOPS` and -`Xuops`,
but you can disable the interpreter or JIT
at runtime by setting `PYTHON_JIT=0`.
You can also build it without enabling it by default
using `--enable-experimental-jit=yes-off`;
enable with `PYTHON_JIT=1`.

On Windows, the `build.bat` script supports
`--experimental-jit`, `--experimental-jit-off`,
`--experimental-interpreter`.

In the C code, `_Py_JIT` is defined as before
when the JIT is enabled; the new variable
`_Py_TIER2` is defined when the JIT *or* the
interpreter is enabled. It is actually a bitmask:
1: JIT; 2: default-off; 4: interpreter.
2024-04-30 18:26:34 -07:00
Miro Hrončok f7747f73a9
gh-109975: Document crypt_r as a possible replacement of crypt (#118439) 2024-04-30 21:25:25 +03:00
Tian Gao d7ac427a79
gh-117618: Make package.module searchable for breakpoints and clean up docs (#117619) 2024-04-30 18:18:01 +00:00
edson duarte 0f797402bc
gh-85453: Consistent backquotes on None occurences across datetime.rst (#118282) 2024-04-30 10:34:15 +02:00
Donghee Na 11cbf77f97
gh-118392: Add note about random.random for multi thread app (gh-118396) 2024-04-30 13:42:13 +09:00
Tian Gao 8e4fb5d260
gh-118359: Improve docs for Bdb.user_call (#118368)
The `argument_list` parameter of bdb.Bdb.user_call has been useless for 25 years. It is retained for backwards compatibility, but it will always be None.
2024-04-29 21:57:49 +01:00
Hugo van Kemenade 8d4b756fd3
Docs: Upgrade to Sphinx 7.3 (#118397) 2024-04-29 11:40:50 -06:00
Xie Yanbo 98739c9078
Fix typo in Doc/c-api/exceptions.rst (GH-118371) 2024-04-29 14:02:54 +03:00
Xie Yanbo 0315521c52
Fix typo in Doc/howto/timerfd.rst (GH-118376) 2024-04-29 14:01:03 +03:00
Xie Yanbo 030fcc47fb
Fix typo in Doc/c-api/typeobj.rst (GH-118377) 2024-04-29 10:59:38 +00:00
Erlend E. Aasland c7e7bfc4ca
gh-115119: Detect _decimal dependencies using pkg-config (#115406)
pkg-config is supported for libmpdec 4.0.0 and newer.
2024-04-29 08:58:57 +02:00
Henrik Tunedal 133c1a7cdb
gh-118293: Suppress mouse cursor feedback when launching Windows processes with multiprocessing (GH-118315) 2024-04-28 21:10:44 +00:00
Hugo van Kemenade f5b7e397c0
gh-101100: Fix Sphinx warnings in `whatsnew/3.10.rst` (#118356) 2024-04-28 18:12:25 +00:00
Hugo van Kemenade 33c6cf3148
gh-101100: Fix Sphinx warnings in `library/faulthandler.rst` (#118353) 2024-04-28 12:06:45 -06:00
Hugo van Kemenade e0ab642436
gh-101100: Fix Sphinx warnings in `whatsnew/3.9.rst` (#118364) 2024-04-28 20:31:22 +03:00
Jelle Zijlstra 2326d6c868
gh-109118: Make comprehensions work within annotation scopes, but without inlining (#118160)
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-04-28 06:21:28 -07:00
Cheryl Sabella 194fd17bc6
bpo-32839: Add the after_info() method for Tkinter widgets (GH-5664) 2024-04-27 00:27:58 +03:00
Philipp A 5a4d3df2fa
Fix note in Enum.__new__ docs (#118284) 2024-04-26 07:06:53 -07:00
Kirill Podoprigora 463c20dae9
gh-117928: Bump the minimum Sphinx version to 6.2.1 (#117853)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-04-26 13:10:16 +03:00
Petr Viktorin ef940dec40
gh-118235: Skip RAISE_SYNTAX_ERROR rules in the grammar spec (GH-118237) 2024-04-26 11:01:30 +02:00
Serhiy Storchaka 93b7ed7c6b
gh-108191: Add support of positional argument in SimpleNamespace constructor (GH-108195)
SimpleNamespace({'a': 1, 'b': 2}) and SimpleNamespace([('a', 1), ('b', 2)])
are now the same as SimpleNamespace(a=1, b=2).
2024-04-25 00:39:54 +03:00
edson duarte 59a4d52973
gh-85453: Make numeric literals consistent across datetime.rst (#118245)
Remove code formatting from remaining numeric literals.
2024-04-24 20:19:54 +00:00
edson duarte 809aa9a682
gh-85453: Adapt datetime.rst to devguide recommendations for code snippets and variables (#118068)
Also remove formatting from numeric literals.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-04-24 19:53:52 +00:00
Alex Waygood 8227883d1f
gh-118013: Use weakrefs for the cache key in `inspect._shadowed_dict` (#118202) 2024-04-24 15:55:02 +01:00
Nikita Sobolev 692e902c74
gh-116023: Add `show_empty=False` to `ast.dump` (#116037)
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-04-24 11:02:38 +03:00
Animesh Kumar 0d221e9a19
Fix typo in py_compile.rst (GH-118102) 2024-04-23 17:12:49 +00:00
Shantanu 8e86579cae
gh-95754: Better error when script shadows a standard library or third party module (#113769) 2024-04-22 18:24:21 -07:00
Jelle Zijlstra 85f727c5fb
gh-109118: Allow lambdas in annotation scopes in classes (#118019) 2024-04-22 12:50:26 -07:00
tahia 8974a63f5e
bpo-18108: Adding dir_fd and follow_symlinks keyword args to shutil.chown (GH-15811)
* Adding dir_fd and follow_symlinks keyword args to shutil.chown
* Extending test_shutil.TestShutil.test_chown to include new kwargs
* Updating shutil.chown documentation

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2024-04-22 18:23:36 +00:00
Nice Zombies 78ba4cb758
gh-118030: Group definitions for `ParamSpecArgs` and `ParamSpecKwargs` in `typing.rst` (#118154) 2024-04-22 14:57:46 +00:00
Kerim Kabirov ceb6038b05
gh-115986 Improve pprint documentation accuracy (#117403)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-04-22 12:28:21 +02:00
Clément Robert 1446024124
Docs: replace Harry Potter reference with Monty Python (#118130) 2024-04-21 19:03:46 +01:00
Serhiy Storchaka 51ef89cd9a
gh-115961: Add name and mode attributes for compressed file-like objects (GH-116036)
* Add name and mode attributes for compressed and archived file-like objects
  in modules bz2, lzma, tarfile and zipfile.
* Change the value of the mode attribute of GzipFile from integer (1 or 2)
  to string ('rb' or 'wb').
* Change the value of the mode attribute of ZipExtFile from 'r' to 'rb'.
2024-04-21 11:46:39 +03:00
Russell Keith-Magee df987331d8
gh-114099: Formalize Tier 3 status of iOS (GH-118020) 2024-04-20 23:04:08 -04:00
Quazi Irfan 1558d99316
Clarifying nonlocal doc: SyntaxError is raised if nearest enclosing scope is global (#114009)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-04-20 18:42:51 -07:00
Nikita Sobolev 2aa11cca11
gh-118100: Improve links in `ast.rst` (#118101)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-04-19 21:25:54 +03:00
Alex Waygood 1e3e7ce11e
gh-114053: Fix bad interaction of PEP-695, PEP-563 and ``get_type_hints`` (#118009)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-04-19 13:03:44 +00:00
lyc8503 15b3555e4a
gh-116931: Add fileobj parameter check for Tarfile.addfile (GH-117988)
Tarfile.addfile now throws an ValueError when the user passes
in a non-zero size tarinfo but does not provide a fileobj,
instead of writing an incomplete entry.
2024-04-19 11:41:51 +00:00
Irit Katriel 8a01fd7b9b
gh-115775: Add whatsnew entry about __static_attributes__ (GH-117909)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-04-19 12:57:31 +02:00
Savannah Ostrowski 5d54436574
gh-116935: Document that heap types need to support garbage collection (GH-118021) 2024-04-19 09:29:23 +00:00
Victor Stinner 4605a197bd
gh-117518: Clarify PyTuple_GetItem() borrowed reference in the doc (GH-117920) 2024-04-19 10:41:37 +02:00
Mariusz Felisiak fefd5d9711
gh-64588: Clarify the difference between mu and xbar in statistics docs (#117333)
Thanks Davin Potts for the clarification idea.
2024-04-18 22:36:24 -07:00
Jelle Zijlstra 60787b8a4e
Docs: Fix CVE link (#118077) 2024-04-18 21:31:53 -07:00
Rafael Fontenelle 398abdd6fa
Use "Contributed by" in a couple of occurrences of 3.12 whatsnew (#118070) 2024-04-19 03:28:12 +00:00
Shreyan Avigyan 81a926bd20
gh-87969: Align docs and docstrings with implementation for ctypes' [w]string_at() (#25384)
The implementation uses 'ptr' for the name of the first parameter of 
ctypes.string_at() and ctypes.wstring_at(). Align docs and docstrings 
with the naming used in the implementation.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-04-18 14:57:37 +00:00
Victor Stinner 340a02b590
gh-117987: Restore several functions removed in Python 3.13 alpha 1 (GH-117993)
Restore these functions removed in Python 3.13 alpha 1:

* Py_SetPythonHome()
* Py_SetProgramName()
* PySys_SetArgvEx()
* PySys_SetArgv()
2024-04-18 15:20:38 +02:00
Miro Hrončok f70395786f
gh-90815: Document bundled mimalloc in What’s New In Python 3.13 (GH-117811) 2024-04-18 11:04:20 +02:00
lyc8503 468b9aeb92
gh-116932: Add note on how to report python documentation theme bugs (GH-117989) 2024-04-18 10:45:25 +02:00
Steve Dower a4b44d39cd
gh-114539: Clarify implicit launching of shells by subprocess (GH-117996) 2024-04-17 19:32:47 +01:00
Manuel Kaufmann ae8dfd2761
Doc: Render version/language selector on Read the Docs (#116966) 2024-04-17 18:40:56 +03:00
Nice Zombies fccedbda93
gh-117977: Amend version changed annotation for os.chmod, os.chown, and os.listdir (#117978) 2024-04-17 14:59:02 +00:00
Victor Stinner 75eed5b373
gh-117929: Restore removed PyEval_InitThreads() function (#117931) 2024-04-17 15:01:28 +02:00
Serhiy Storchaka 438b7c3071
gh-73231: Update documentation for PyErr_SetFromWindowsErr() (GH-117226) 2024-04-17 13:03:26 +03:00
Nice Zombies a23fa3368e
gh-117945: Fix `os.path.ismount()` documentation (#117947) 2024-04-16 15:55:53 -07:00
Hugo van Kemenade 3284b84c43
Docs: Add classes to C API return value annotations (#117926)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-04-16 15:56:15 +00:00
Douglas Thor 1316692e8c
gh-102402: Fix floating point math issue by using `time.time_ns()` in `logging.LogRecord` (GH-102412) 2024-04-16 10:44:57 +01:00
Inada Naoki 6dc661bc9f
gh-77102: site: try utf-8 and fallback to locale encoding when reading .pth file (#117802) 2024-04-16 12:56:16 +09:00
Erlend E. Aasland 757891ee8a
gh-117804: Document how to suppress PGO unprofiled source warnings (#117859) 2024-04-15 23:17:28 +02:00
Hugo van Kemenade 3375282bb8
Docs: add link roles with Sphinx extlinks (#117850)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-04-15 21:22:00 +03:00
Hugo van Kemenade 78da154067
gh-109975: Copyedit "What's New in Python 3.13" (#117902)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-04-15 17:20:40 +00:00
Alex Waygood 106e9ddc43
Docs: make the `whatsnew-typing-py312` anchor point to things that were new in the typing module (#117904) 2024-04-15 16:48:13 +00:00
Raymond Hettinger 0823f43618
gh-115532: Minor tweaks to kde() (gh-117897) 2024-04-15 10:08:21 -05:00
Serhiy Storchaka 10f1a2687a
gh-115664: Reorganize versionadded directives for -X options (GH-116304)
Add the versionadded directives just under the description of the
corresponding option.
2024-04-15 18:01:17 +03:00
Hugo van Kemenade 7d0be7aea5
Add 'The Python 2.3 Method Resolution Order' (#116435) 2024-04-15 13:01:15 +03:00
Galen Rice 74b0658e6a
docs: typo in 3.13 release notes (#117866) 2024-04-14 14:04:59 -07:00
Erlend E. Aasland e01831760e
Doc: mark up classes, attributes, parameters, and methods in dataclasses.rst (#117820) 2024-04-14 16:29:01 +00:00
Jelle Zijlstra c99d374fc7
dataclasses docs: add some link anchors (#117601) 2024-04-14 01:03:16 -07:00
Gouvernathor f303651b45
Simpler example of shallow dict export of a dataclass (#117812) 2024-04-13 17:14:43 -07:00
Gouvernathor e7cce2a9c6
Tweak wording for dataclasses.replace (gh-117758) 2024-04-13 20:03:09 -04:00
Barney Gale a74f117dab
GH-115060: Speed up `pathlib.Path.glob()` by omitting initial `stat()` (#117831)
Since 6258844c, paths that might not exist can be fed into pathlib's
globbing implementation, which will call `os.scandir()` / `os.lstat()` only
when strictly necessary. This allows us to drop an initial `self.is_dir()`
call, which saves a `stat()`.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-04-14 00:08:03 +01:00
Hugo van Kemenade 56ed979d04
gh-68583: webbrowser: replace `getopt` with `argparse`, add long options (#117047) 2024-04-13 08:56:56 -06:00
Michiel W. Beijen 022ba6d161
gh-102247: http: support rfc9110 status codes (GH-117611)
rfc9110 obsoletes the earlier rfc 7231. This document also includes some
status codes that were previously only used for WebDAV and assigns more
generic names to these status codes.

ref: https://www.rfc-editor.org/rfc/rfc9110.html#name-changes-from-rfc-7231

- http.HTTPStatus.CONTENT_TOO_LARGE (413, previously
  REQUEST_ENTITY_TOO_LARGE)
- http.HTTPStatus.URI_TOO_LONG (414, previously REQUEST_URI_TOO_LONG)
- http.HTTPStatus.RANGE_NOT_SATISFYABLE (416, previously
  REQUEST_RANGE_NOT_SATISFYABLE)
- http.HTTPStatus.UNPROCESSABLE_CONTENT (422, previously
  UNPROCESSABLE_ENTITY)

The new constants are added to http.HTTPStatus and the old constant names are
preserved for backwards compatibility.

References in documentation to the obsoleted rfc 7231 are updated
2024-04-13 07:33:20 -07:00
Hugo van Kemenade dd724239dd
gh-117840: Fix indent to fix shlex syntax highlighting (#117843) 2024-04-13 05:31:01 -06:00
Shantanu 37a4cbd872
gh-114466: explicitly define heap invariant (#117778)
I think the choice of wording in these docs is great and doesn't
need to change. However, it could be useful to explicitly define
this term / the cost of doing so seems relatively low.
2024-04-13 00:05:27 -07:00
Savannah Ostrowski a97650912e
gh-117739: Update definition of global interpreter lock for 3.13 (#117740)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-04-12 14:19:41 -04:00
Hugo van Kemenade 94e9c35cd0
Fix version directive indents (#117719) 2024-04-12 13:30:42 +03:00
Tomas R c06be6bbb8
gh-104269: Document `glob.glob` duplicates when using multiple `**` patterns (#105406) 2024-04-11 15:16:39 +00:00
Bruce Merry 01a51f9494
gh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723)
gh-16429 introduced support for an iterable of separators in
Stream.readuntil. Since bytes-like types are themselves iterable, this
can introduce ambiguities in deciding whether the argument is an
iterator of separators or a singleton separator. In gh-16429, only 'bytes'
was considered a singleton, but this will break code that passes other
buffer object types.

Fix it by only supporting tuples rather than arbitrary iterables.

Closes gh-117722.
2024-04-11 07:41:55 -07:00
Mikhail B 898f6de63f
gh-101549: fix documentation of xml.etree.ElementInclude (#101550)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-04-11 14:23:52 +00:00
Nikita Sobolev be82058064
Fix markup of `win32_ver` in `platform.rst` (#116492) 2024-04-11 17:13:53 +03:00
Barney Gale 630df37116
GH-117546: Fix symlink resolution in `os.path.realpath('loop/../link')` (#117568)
Continue resolving symlink targets after encountering a symlink loop, which
matches coreutils `realpath` behaviour.
2024-04-10 18:17:18 +01:00
Laurie O 6bc0b33a91
gh-117531: Unblock getters after non-immediate queue shutdown (#117532)
(This is a small tweak of the original gh-104750 which added shutdown.)
2024-04-10 08:01:42 -07:00
Nice Zombies 73906d5c90
gh-117360: Clearer wording in os.path.lexists() docs (#117679)
Co-authored-by: Zachary Ware <zach@python.org>
2024-04-09 23:00:41 +02:00
Nice Zombies a05068db0c
gh-117597: Clarify exception handling in the tutorial (#117681) 2024-04-09 20:59:45 +00:00
Victor Stinner a25c02eaf0
Revert "gh-106023: Update What's New in 3.13: _PyObject_FastCall() (#117633)" (#117676)
This reverts commit 9a12f5d1c1.

I was wrong: the _PyObject_FastCall() function was removed. But we
kept the _PyObject_FastCallDict() function.
2024-04-09 18:26:35 +02:00
Guido van Rossum fa58e75a86
gh-116720: Fix corner cases of taskgroups (#117407)
This prevents external cancellations of a task group's parent task to
be dropped when an internal cancellation happens at the same time.
Also strengthen the semantics of uncancel() to clear self._must_cancel
when the cancellation count reaches zero.

Co-Authored-By: Tin Tvrtković <tinchester@gmail.com>
Co-Authored-By: Arthur Tacca
2024-04-09 08:17:28 -07:00
Jelle Zijlstra f2132fcd2a
gh-117516: Implement typing.TypeIs (#117517)
See PEP 742.

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-04-09 10:50:37 +00:00
Bruce Merry 775912a51d
gh-81322: support multiple separators in StreamReader.readuntil (#16429) 2024-04-08 09:58:02 -07:00
Serhiy Storchaka 24a2bd0481
gh-117642: Fix PEP 737 implementation (GH-117643)
* Fix implementation of %#T and %#N (they were implemented as %T# and
  %N#).
* Restore tests removed in gh-116417.
2024-04-08 16:27:25 +00:00
Laurie O e16062dd34
gh-96471: Correct documentation for asyncio queue shutdown (#117621) 2024-04-08 14:50:54 +00:00
Victor Stinner 9a12f5d1c1
gh-106023: Update What's New in 3.13: _PyObject_FastCall() (#117633)
The function _PyObject_FastCall() was restored.
2024-04-08 12:19:43 +00:00
Nikita Sobolev a7702663e3
gh-111726: Explicitly close database connections in sqlite3 doctests (#111730)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-04-08 09:29:47 +00:00
Erlend E. Aasland e338e1a4ec
gh-111726: Remove some doctests from sqlite3 docs (#117623)
* remove load extension doctest since we cannot skip it conditionally
* remove sys.unraisablehook example; using unraisable hooks is not "an
  improved debug experience"
2024-04-08 08:11:08 +00:00
Hugo van Kemenade a453f5ef9d
gh-111726: Cleanup test files after running sqlite3 doctest (#117604)
Remove all temporary databases in a dedicated 'testcleanup' step
at the end of the file.
2024-04-08 08:35:48 +02:00
Anita Hammer fd3679025d
Fix reference in code.rst (#117615)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-04-07 22:58:57 +00:00
Laurie O df4d84c3cd
gh-96471: Add asyncio queue shutdown (#104228)
Co-authored-by: Duprat <yduprat@gmail.com>
2024-04-06 07:27:13 -07:00
Barney Gale 6150bb2412
GH-77609: Add recurse_symlinks argument to `pathlib.Path.glob()` (#117311)
Replace tri-state `follow_symlinks` with boolean `recurse_symlinks` argument. The new argument controls whether symlinks are followed when expanding recursive `**` wildcards. The possible argument values correspond as follows:

    follow_symlinks  recurse_symlinks
    ===============  ================
    False            N/A
    None             False
    True             True

We therefore drop support for not following symlinks when expanding non-recursive pattern parts; it wasn't requested in the original issue, and it's a feature not found in any shells.

This makes the API a easier to grok by eliminating `None` as an option.

No news blurb as `follow_symlinks` was new in 3.13.
2024-04-05 18:51:54 +00:00
Steve Dower 687616877b
gh-111140: PyLong_From/AsNativeBytes: Take *flags* rather than just *endianness* (GH-116053) 2024-04-05 16:21:16 +02:00
Petr Viktorin 9ceaee74db
gh-116608: importlib.resources: Un-deprecate functional API & add subdirectory support (GH-116609) 2024-04-05 13:55:59 +02:00
Sam Gross 42205143f8
gh-117478: Add `@support.requires_gil_enabled` decorator (#117479)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-04-04 14:10:46 -04:00
Vinay Sajip df912c913a
[doc] Update logging documentation to improve grammar and elucidate an example. (GH-117541) 2024-04-04 13:14:44 +01:00
Zackery Spytz fc5f68e58e
gh-59215: unittest: restore _top_level_dir at end of discovery (GH-15242) 2024-04-03 16:17:13 +02:00
Gregory P. Smith 33ee5cb3e9
GH-70647: Deprecate strptime day of month parsing without a year present to avoid leap-year bugs (GH-117107) 2024-04-03 14:19:49 +02:00
Petr Viktorin e569f9132b
gh-117074: Update Traversable.joinpath docs to the 3.11+ protocol (GH-117113) 2024-04-02 16:08:16 +02:00
Moshe Kaplan 9dae05ee59
Docs: specify XML document name in xml.etree.elementtree example (#24223) 2024-04-01 19:53:00 +00:00
Matthew Davis fc2071687b
Docs: add more links to PIPE in subprocess docs (#25416) 2024-04-01 21:49:14 +02:00
Barney Gale fc8007ee36
GH-117337: Deprecate `glob.glob0()` and `glob.glob1()`. (#117371)
These undocumented functions are no longer used by `msilib`, so there's no
reason to keep them around.
2024-04-01 19:37:41 +00:00
Justin Turner Arthur c741ad3537
gh-77714: Provide an async iterator version of as_completed (GH-22491)
* as_completed returns object that is both iterator and async iterator
* Existing tests adjusted to test both the old and new style
* New test to ensure iterator can be resumed
* New test to ensure async iterator yields any passed-in Futures as-is

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2024-04-01 20:07:29 +03:00
Adorilson Bezerra 56e99307c4
Doc: printf-style library/stdtype improvements (#16741) 2024-03-31 22:34:54 +00:00
Shantanu 262445358e
Link to the Python type system specification (#117400) 2024-03-31 12:02:48 -07:00
Barney Gale 752e18389e
GH-114575: Rename `PurePath.pathmod` to `PurePath.parser` (#116513)
And rename the private base class from `PathModuleBase` to `ParserBase`.
2024-03-31 19:14:48 +01:00
Pedro Lacerda 54f7e14500
gh-66449: configparser: Add support for unnamed sections (#117273)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-03-29 15:05:00 +00:00
Christopher Chianelli a17f313e39
gh-117339: Use NULL instead of None for LOAD_SUPER_ATTR in dis docs (GH-117343) 2024-03-29 06:26:56 +08:00
Malcolm Smith 29829b58a8
gh-117294: Report DocTestCase as skipped if all examples in the doctest are skipped (GH-117297) 2024-03-28 21:59:12 +02:00
Joachim Wuttke 9a388b9a64
bpo-43848: explain optional argument mtime in gzip.py. (GH-25410)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-03-28 13:43:07 +00:00
Russell Keith-Magee 0f27672c50
gh-114099: Add documentation for iOS platform (GH-117057)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Ned Deily <nad@python.org>
2024-03-28 04:13:13 -04:00
Russell Keith-Magee f006338017
gh-114099: Additions to standard library to support iOS (GH-117052)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Ned Deily <nad@python.org>
2024-03-28 03:59:33 -04:00
Tim Hatch b44898299a
gh-89739: gh-77140: Support zip64 in zipimport (GH-94146)
* Reads zip64 files as produced by the zipfile module
* Include tests (somewhat slow, however, because of the need to create "large" zips)
* About the same amount of strictness reading invalid zip files as zipfile has
* Still works on files with prepended data (like pex)

There are a lot more test cases at https://github.com/thatch/zipimport64/ that give me confidence that this works for real-world files.

Fixes #89739 and #77140.

---------

Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
Reviewed-by: Gregory P. Smith <greg@krypto.org>
2024-03-28 06:54:51 +00:00
Malcolm Smith 74c8568d07
gh-71042: Add `platform.android_ver` (#116674) 2024-03-27 17:53:27 +01:00
Hugo van Kemenade ce00de4c8c
gh-117225: doctest: only print "and X failed" when non-zero, don't pluralise "1 items" (#117228) 2024-03-27 16:46:35 +02:00
Raymond Hettinger 92397d5ead
Add statistics recipe for sampling from an estimated probability density distribution (#117221) 2024-03-27 09:04:32 -05:00
Adorilson Bezerra 48c0b05cf0
Change links on the index page (#117230) 2024-03-26 13:08:08 -06:00
Raymond Hettinger 7ebad77ad6
Sync main docs and docstring for median_grouped(). (gh-117214) 2024-03-25 23:49:44 +00:00
Nice Zombies 0821923aa9
gh-117114: Make os.path.isdevdrive available on all platforms (GH-117115) 2024-03-25 22:55:11 +00:00
Adorilson Bezerra c2276176d5
Add information about negative indexes to sequence datamodel doc (#110903)
Co-authored by Terry Jan Reedy
2024-03-25 18:34:20 -04:00
Victor Stinner 507896d97d
gh-116936: Add PyType_GetModuleByDef() to the limited C API (#116937) 2024-03-25 16:32:20 +00:00
Serhiy Storchaka 0c1a42cf9c
gh-87193: Support bytes objects with refcount > 1 in _PyBytes_Resize() (GH-117160)
Create a new bytes object and destroy the old one if it has refcount > 1.
2024-03-25 16:32:11 +01:00
Raymond Hettinger 9db2a8f914
Minor markup and grammar fixes in the statistics docs (gh-117216) 2024-03-25 09:26:42 -05:00
Terry Jan Reedy 78a651fd7f
gh-117194: Properly format 'base64' header in What's New (#117198)
It needs 6, not 3, '-'s.
2024-03-24 11:38:34 -04:00
Kerim Kabirov f267d5bf2a
GH-115986 Docs: promote pprint.pp usage as a default (#116614)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-03-24 07:59:14 -06:00
LilKS 39df773217
gh-101760: Improve the imaplib.IMAP4 example (#101764)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-03-24 04:01:07 -06:00
Raymond Hettinger a1e948edba
Add cumulative option for the new statistics.kde() function. (#117033) 2024-03-24 04:35:58 -05:00
Barney Gale 72eea512b8
GH-106747: Document another difference between `glob` and `pathlib`. (#116518)
Document that `path.glob()` might return *path*, whereas
`glob.glob(root_dir=path)` will never return an empty string corresponding
to *path*.
2024-03-22 19:14:09 +00:00
Serhiy Storchaka e2e0b4b4b9
gh-113024: C API: Add PyObject_GenericHash() function (GH-113025) 2024-03-22 20:19:10 +02:00
Vinay Sajip 00baaa21de
[docs] Fix typo in docstring and add example to logging cookbook. (GH-117157) 2024-03-22 17:25:51 +00:00
Jakub Stasiak 40d75c2b7f
GH-113171: Fix "private" (non-global) IP address ranges (GH-113179)
* GH-113171: Fix "private" (really non-global) IP address ranges

The _private_networks variables, used by various is_private
implementations, were missing some ranges and at the same time had
overly strict ranges (where there are more specific ranges considered
globally reachable by the IANA registries).

This patch updates the ranges with what was missing or otherwise
incorrect.

I left 100.64.0.0/10 alone, for now, as it's been made special in [1]
and I'm not sure if we want to undo that as I don't quite understand the
motivation behind it.

The _address_exclude_many() call returns 8 networks for IPv4, 121
networks for IPv6.

[1] https://github.com/python/cpython/issues/61602
2024-03-22 17:49:56 +01:00
Ned Batchelder 0907871d43
docs: fix over-linking in dataclasses.rst (#117005) 2024-03-21 12:47:09 -07:00
Victor Stinner abdd1f938f
gh-85283: Build _testconsole extension with limited C API (#117125) 2024-03-21 17:45:43 +01:00
Victor Stinner 8bea6c411d
gh-115754: Add Py_GetConstant() function (#116883)
Add Py_GetConstant() and Py_GetConstantBorrowed() functions.

In the limited C API version 3.13, getting Py_None, Py_False,
Py_True, Py_Ellipsis and Py_NotImplemented singletons is now
implemented as function calls at the stable ABI level to hide
implementation details. Getting these constants still return borrowed
references.

Add _testlimitedcapi/object.c and test_capi/test_object.py to test
Py_GetConstant() and Py_GetConstantBorrowed() functions.
2024-03-21 16:07:00 +00:00
Malcolm Smith 1f8b24ef69
gh-71052: Implement `ctypes.util.find_library` on Android (GH-116379) 2024-03-21 14:20:57 +01:00
Carol Willing 7d446548ef
Fix sort order for "locale encoding" glossary item (#115794)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2024-03-20 15:00:59 -06:00
Russell Keith-Magee 44fbab43d8
gh-117058: Update GUI and packaging recommendations for macOS. (#117059) 2024-03-20 17:32:56 +02:00
Mark Shannon 15309329b6
GH-108362: Incremental Cycle GC (GH-116206) 2024-03-20 08:54:42 +00:00
Ned Batchelder 332ac46c09
docs: announce venv creation before installing packages (#117036) 2024-03-19 21:55:20 +02:00
Hugo van Kemenade 9080e9ed50
gh-101100: Fix Sphinx warnings in `library/pydoc.rst` (#116913) 2024-03-19 21:48:08 +02:00
Terry Jan Reedy 025ef7a5f7
gh-56374: Clarify documentation of nonlocal (#116942)
Define 'nonlocal scopes' in a way that excludes class scopes.
Rearrange the rest of the doc.  Add "Programmer's note".
2024-03-19 13:55:21 -04:00
Sunghyun Kim 7f64ae30dd
gh-107607: Update comment about utf-8 BOM being ignored (#107858)
---------
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-03-19 11:51:12 -04:00
Russell Keith-Magee 408e127159
gh-114099 - Add iOS framework loading machinery. (GH-116454)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-03-19 08:36:19 -04:00
Bogdan Romanyuk a8e93d3dca
gh-115756: make PyCode_GetFirstFree an unstable API (GH-115781) 2024-03-19 09:20:38 +00:00
Pierre Ossman (ThinLinc team) 4159644177
gh-113538: Add asycio.Server.{close,abort}_clients (redo) (#116784)
These give applications the option of more forcefully terminating client
connections for asyncio servers. Useful when terminating a service and
there is limited time to wait for clients to finish up their work.

This is a do-over with a test fix for gh-114432, which was reverted.
2024-03-18 13:15:53 -07:00
Victor Stinner 1d95451be1
gh-63207: Use GetSystemTimePreciseAsFileTime() in time.time() (#116822) 2024-03-18 17:13:01 +01:00
Victor Stinner f6cdc6b4a1
Revert "gh-96844: Improve error message of list.remove (gh-106455)" (#116956)
This reverts commit 217f47d6e5.
2024-03-18 13:54:45 +00:00
Jakub Stasiak 2a4cbf17af
GH-65056: Improve the IP address' is_global/is_private documentation (GH-113186)
* GH-65056: Improve the IP address' is_global/is_private documentation

It wasn't clear what the semantics of is_global/is_private are and, when
one gets to the bottom of it, it's not quite so simple (hence the
exceptions listed).

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-03-18 13:57:00 +01:00
Terry Jan Reedy 4e45c6c54a
gh-116881: Remove erroneous or redundant grammar NULL (GH-116885)
In Lexical Analysis f-strings section, NULL in the description
of 'literal character' means '\0'.  In the format_spec grammar
production, it is wrong with that meaning and redundant if
instead interpreted as <nothing>.  Remove it there.
2024-03-18 10:31:13 +01:00
Victor Stinner 2982bdb936
gh-85283: Build _statistics extension with the limited C API (#116927)
Argument Clinic now inlines _PyArg_CheckPositional() for the limited
C API. The generated code should be as fast or even a little bit
faster.
2024-03-17 18:59:02 +01:00
Barney Gale 0634201f53
GH-116377: Stop raising `ValueError` from `glob.translate()`. (#116378)
Stop raising `ValueError` from `glob.translate()` when a `**` sub-string
appears in a non-recursive pattern segment. This matches `glob.glob()`
behaviour.
2024-03-17 17:09:35 +00:00
Victor Stinner 1cf0301086
gh-85283: Build termios extension with the limited C API (#116928) 2024-03-17 15:12:29 +00:00
Victor Stinner 8e3c953b3a
gh-73468: Add math.fma() function (#116667)
Added new math.fma() function, wrapping C99's ``fma()`` operation:
fused multiply-add function.

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2024-03-17 13:58:26 +00:00
Carol Willing c514a975ab
Update titles and subtitles on landing page template (#116914)
* Update titles and subtitles on landing page template

* address review from gvanrossum

* Edits from hugovk review

* Change word order back. Down the road we should split license and history
2024-03-17 00:01:56 +00:00
jnchen 744c077795
gh-116851: Remove "from ctypes import *" from a ctypes example (GH-116852)
It is confusing, because libc is not imported from ctypes,
but defined in previous examples, which already contain the import.
2024-03-16 15:01:45 +02:00
Nikita Sobolev 16349868d3
gh-116782: Mention `__type_params__` in `inspect.getmembers` docs (#116783)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-03-15 18:47:46 +03:00
Tian Gao a50cf6c3d7
gh-90095: Ignore empty lines and comments in `.pdbrc` (#116834) 2024-03-15 09:36:04 +00:00
Victor Stinner 8fc8fbb43a
gh-85283: Build pwd extension with the limited C API (#116841)
Argument Clinic now uses the PEP 737 "%T" format to format type name
for the limited C API.
2024-03-15 08:49:58 +01:00
Raymond Hettinger 41e844a4ac
gh-116842: Improve test comment and fix a doctest (gh-116846) 2024-03-14 21:40:36 -05:00
Barney Gale 1904f0a224
GH-113838: Add "Comparison to os.path" section to pathlib docs (#115926) 2024-03-15 00:11:49 +00:00
Victor Stinner 7bbb9b57e6
gh-111696, PEP 737: Add %T and %N to PyUnicode_FromFormat() (#116839) 2024-03-14 22:23:00 +00:00
Raymond Hettinger ab9e322ae1
Minor improvements to the itertools documentation (gh-116833) 2024-03-14 16:39:50 -05:00
Victor Stinner c432df6d56
gh-111696, PEP 737: Add PyType_GetModuleName() function (#116824)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-03-14 18:17:43 +00:00
Victor Stinner 19c3a2ff91
gh-111696, PEP 737: Add PyType_GetFullyQualifiedName() function (#116815)
Rewrite tests on type names in Python, they were written in C.
2024-03-14 16:19:36 +00:00
Victor Stinner 846ad5a26a
gh-88494: Use QueryPerformanceCounter() for time.monotonic() (#116781)
On Windows, time.monotonic() now uses the QueryPerformanceCounter()
clock to have a resolution better than 1 us, instead of the
gGetTickCount64() clock which has a resolution of 15.6 ms.
2024-03-14 16:42:41 +01:00
Victor Stinner 97b80af897
gh-85283: Build fcntl extension with the limited C API (#116791) 2024-03-14 12:01:13 +00:00
Sergey B Kirpichev e39795f2cb
Docs: PyUnstable_Long_IsCompact() docs now mention PyLong_AsNativeBytes() (#116634) 2024-03-14 00:01:13 +01:00
Raymond Hettinger 5ff012a449
Better presentation order for recipes. (gh-116755) 2024-03-13 15:02:56 -05:00
Nir Friedman 7f418fb111
gh-98731: Improvements to the logging documentation (GH-101618)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2024-03-13 15:58:30 +00:00
Vinay Sajip 186af3cf21
[doc]: Update cookbook recipe for Qt6. (GH-116719) 2024-03-13 13:22:47 +00:00
Serhiy Storchaka 33662d4e01
gh-90300: Fix cmdline.rst (GH-116721)
* Fix the description of the "-b" option.
* Add references to environment variables for "-s" and "-X dev" options.
2024-03-13 15:03:13 +02:00
Raymond Hettinger e82f6dfae5
Modernize roundrobin() recipe and improve variable names (gh-116710) 2024-03-13 02:12:30 -05:00
Terry Jan Reedy 43986f5567
gh-111307: Update design FAQ 'switch' entry (#115899) 2024-03-13 01:30:39 -04:00
Mariusz Felisiak 3f1b6efee9
Docs: fix broken links (#116651) 2024-03-12 21:19:33 -07:00
Raymond Hettinger 93a687a373
Minor clarity improvement for the iter_index() recipe. Also add value subsequence tests. (gh-116696) 2024-03-12 21:33:42 -05:00
Tushar Sadhwani 149f7f7ae2
Add `typing.NamedTuple` in glossary section for named tuples (#108327) 2024-03-12 15:46:42 -07:00
Raymond Hettinger 126186674e
Beef-up tests for the itertool docs. (gh-116679) 2024-03-12 17:19:58 -05:00
Jelle Zijlstra 290330714b
gh-89547: typing.rst: Add note about change in behavior with ClassVar/Final (#116686) 2024-03-12 15:17:53 -07:00
Nikita Sobolev df4784b3b7
gh-116127: PEP-705: Add `ReadOnly` support for `TypedDict` (#116350)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-03-12 07:49:39 -07:00
Guido van Rossum ba13215eb1
gh-113538: Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)" (#116632)
Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)"

Reason: The new test doesn't always pass:
https://github.com/python/cpython/pull/116423#issuecomment-1989425489

This reverts commit 1d0d49a7e8.
2024-03-12 00:31:49 +00:00
Terry Jan Reedy 3e45030076
gh-116563: Update tutorial error example (#116569)
There now may be multiple carets pointing at a token
rather than just a character.  Fix the sentence about
possible causes.
2024-03-11 18:01:08 -04:00
Pierre Ossman (ThinLinc team) 1d0d49a7e8
gh-113538: Add asycio.Server.{close,abort}_clients (#114432)
These give applications the option of more forcefully terminating client
connections for asyncio servers. Useful when terminating a service and
there is limited time to wait for clients to finish up their work.
2024-03-11 12:43:30 -07:00
Malcolm Smith 872c0714fc
gh-71052: Change Android's `sys.platform` from "linux" to "android"
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-03-11 19:25:39 +00:00
Brett Simmers 2731913dd5
gh-116167: Allow disabling the GIL with `PYTHON_GIL=0` or `-X gil=0` (#116338)
In free-threaded builds, running with `PYTHON_GIL=0` will now disable the
GIL. Follow-up issues track work to re-enable the GIL when loading an
incompatible extension, and to disable the GIL by default.

In order to support re-enabling the GIL at runtime, all GIL-related data
structures are initialized as usual, and disabling the GIL simply sets a flag
that causes `take_gil()` and `drop_gil()` to return early.
2024-03-11 11:02:58 -04:00
Declan db8f423f58
gh-116535: Fix distracting "TypeError" in example code (gh-116538) 2024-03-09 16:52:57 -05:00
Sergey B Kirpichev 1e68c4b876
gh-111389: expose PyHASH_INF/BITS/MODULUS/IMAG macros as public (#111418)
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-03-09 21:32:05 +01:00
Kerim Kabirov 03f86b1b62
GH-116218 Docs: Add availability information for the 'resource' module (#116256)
Add availability data to 'resource' module Docs
2024-03-09 10:00:37 +01:00
Nicolas A. Oyarzabal 601f3a7b33
gh-105535 Document potential performance trap during enum creation (GH-107119)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-03-08 11:22:17 -08:00
infohash 735fc2cbbc
gh-75988: Fix issues with autospec ignoring wrapped object (#115223)
* set default return value of functional types as _mock_return_value

* added test of wrapping child attributes

* added backward compatibility with explicit return

* added docs on the order of precedence

* added test to check default return_value
2024-03-08 19:14:32 +00:00
Nikita Sobolev 0b647141d5
gh-116349: Deprecate `platform.java_ver` function (#116471)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-03-08 11:14:17 +03:00
Skip Montanaro d9ccde28c4
gh-106259: Add minimal help target to Makefile (#106260)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-03-07 18:21:28 +01:00
Serhiy Storchaka 808a77612f
gh-115664: Fix ordering of more versionadded and versionchanged directives (GH-116298) 2024-03-07 10:05:03 +02:00
William Woodruff 0876b921b2
gh-107361: strengthen default SSL context flags (#112389)
This adds `VERIFY_X509_STRICT` to make the default
SSL context perform stricter (per RFC 5280) validation, as well
as `VERIFY_X509_PARTIAL_CHAIN` to enforce more standards-compliant
path-building behavior.

As part of this changeset, I had to tweak `make_ssl_certs.py`
slightly to emit 5280-conforming CA certs. This changeset includes
the regenerated certificates after that change.

Signed-off-by: William Woodruff <william@yossarian.net>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-03-06 13:44:58 -08:00
Jason Zhang ce0ae1d784
gh-115957: Close coroutine if TaskGroup.create_task() raises an error (#116009) 2024-03-06 12:20:26 -08:00
Sebastian Pipping 73807eb634
gh-115398: Suggest use of `hasattr` with checking for 3.13 Expat API availability (GH-116278)
Suggest use of "hasattr" with checking for 3.13 Expat API availability
2024-03-06 11:08:25 -08:00
Prince Roshan e800265aa1
gh-107625: configparser: Raise error if a missing value is continued (GH-107651)
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-03-06 14:05:54 +00:00
Kerim Kabirov e205c5cd8f
gh-115986: Fix inaccuracies in pprint docs (#116104)
Amend wording after gh-116019 was merged.
2024-03-05 22:14:52 +01:00
cui fliter e7ba6e9dbe
chore: fix typos (#116345)
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-03-05 09:05:52 -07:00
Serhiy Storchaka df59401108
Fix the PyGetSetDef documentation (GH-116056)
closure is not a function pointer, it is a user data pointer.
2024-03-05 17:48:20 +02:00
Serhiy Storchaka 0064dfa091
gh-115777: Fix double versionadded directives (GH-116269) 2024-03-05 17:41:53 +02:00
Tobias Rautenkranz 60743a9a7e
gh-57141: Add dircmp shallow option (GH-109499)
Co-authored-by: Steve Ward <planet36@gmail.com>
Co-authored-by: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com>
2024-03-04 17:27:43 +00:00
Raymond Hettinger 15dc2979bc
Consistently spell out *predicate* instead of *pred*. (gh-116308) 2024-03-04 15:51:29 +00:00
pan324 0dfa7ce346
gh-115256: Remove refcycles from tarfile writing (GH-115257) 2024-03-04 13:26:32 +00:00
Kerim Kabirov 45a92436c5
GH-116271 Docs: provide clarification for object assignments in the Tutorial section (#116283)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-03-04 12:22:13 +00:00
Iman Tabrizian 3383d6afa3
gh-116010: Remove link to deprecated PEP 6 in FAQ guide (#116246)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-03-03 12:50:18 -07:00
HarryLHW 4859ecb860
gh-116281: Remove wrong '\' from '\*' in some doc signatures (#116282) 2024-03-03 14:32:32 -05:00
Hugo van Kemenade 4d3ee77aef
Docs: update using/configure.rst (#116274) 2024-03-03 08:40:02 -07:00
Gouvernathor 67f742e03a
gh-72971: Clarify the special no-TypeError behavior for equality (#110729) 2024-03-03 00:45:48 +00:00
AN Long dac8ff4c40
gh-104711: Add security warning to the CGIHTTPRequestHandler document (GH-115915) 2024-03-01 17:25:14 +00:00
Serhiy Storchaka 05b04903a1
gh-116035: Document that both tzinfo and fold are ignored in comparisons if tzinfo is the same (GH-116187)
This mostly restores information removed in c12240ed28 (GH-114749).
2024-03-01 19:16:29 +02:00
Gouvernathor 2713c2abc8
gh-104219: Document that idunders can return NotImplemented (#104220)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-03-01 16:51:47 +01:00
Sebastian Pipping 6a95676bb5
gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) (GH-115623)
Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods:

- `xml.etree.ElementTree.XMLParser.flush`
- `xml.etree.ElementTree.XMLPullParser.flush`
- `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`
- `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`
- `xml.sax.expatreader.ExpatParser.flush`

Based on the "flush" idea from https://github.com/python/cpython/pull/115138#issuecomment-1932444270 .

### Notes

- Please treat as a security fix related to CVE-2023-52425.

Includes code suggested-by: Snild Dolkow <snild@sony.com>
and by core dev Serhiy Storchaka.
2024-02-29 14:52:50 -08:00
Shantanu c04a981ff4
Fix rendering of null character in ast.rst (#116080) 2024-02-29 14:09:06 -08:00
Carl Bordum Hansen 91c3c64237
gh-73580: Docs for tunnelling TLS through TLS (GH-22539) 2024-02-29 22:56:04 +02:00
Erlend E. Aasland dbe44f150c
Docs: mark up NotImplemented using the :data: role throughout the docs (#116135) 2024-02-29 20:46:12 +00:00
Vinay Sajip 3b6f4cadf1
gh-115811: Update documentation to add some Logger attributes. (GH-116109) 2024-02-29 10:53:19 -08:00
Raymond Hettinger a81d9509ee
Make the iter_except() recipe more compact. (gh-116132)
Only one example is needed
2024-02-29 11:30:18 -06:00
Shantanu bea2795be2
gh-115881: Document feature_version limitations (#115980) 2024-02-29 11:09:09 +00:00
Erlend E. Aasland fb2e17b642
gh-115937: Remove implementation details from inspect.signature() docs (#116086)
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-02-29 09:42:28 +00:00
Ethan Furman 3ea78fd5bc
gh-115821: [Enum] better error message for calling super().__new__() (GH-116063)
docs now state to not call super().__new__
if super().__new__ is called, a better error message is now used
2024-02-28 15:17:49 -08:00
Raymond Hettinger f484a2a748
Update an out-of-date example in the itertools recipe intro (gh-116082) 2024-02-28 17:11:05 -06:00
Raymond Hettinger 67c19e57b5
Improve all_equal() recipe (gh-116081)
Replace conjuction of next() calls with simpler len()/take() logic. Add key function.
2024-02-28 17:04:56 -06:00
Kerim Kabirov 6c1c94dc51
GH-115986 Reorder pprint docs and amend some references (#116019)
Introduce a new subsubsection, 'Functions', for module level functions,                                   
and place it before the PrettyPrinter class reference.                                                    
                                                                                                          
Also:
- Fix pprint.pprint() references so they properly link to the module                                   
  level function.
- Add links to sys.stdout.
2024-02-28 20:43:05 +01:00
Jan Max Meyer 647053fed1
doc: Use super() in subclassed JSONEncoder examples (GH-115565)
Replace calls to `json.JSONEncoder.default(self, obj)`
by `super().default(obj)` within the examples of the documentation.
2024-02-28 14:54:12 +01:00
Erlend E. Aasland a71e32ce8e
gh-78612: Mark up eval() using param list (#115212)
Also mention that the 'expression' parameter can be a string.
2024-02-28 14:03:50 +01:00
Jelle Zijlstra ed4dfd8825
gh-105858: Improve AST node constructors (#105880)
Demonstration:

>>> ast.FunctionDef.__annotations__
{'name': <class 'str'>, 'args': <class 'ast.arguments'>, 'body': list[ast.stmt], 'decorator_list': list[ast.expr], 'returns': ast.expr | None, 'type_comment': str | None, 'type_params': list[ast.type_param]}
>>> ast.FunctionDef()
<stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'name'. This will become an error in Python 3.15.
<stdin>:1: DeprecationWarning: FunctionDef.__init__ missing 1 required positional argument: 'args'. This will become an error in Python 3.15.
<ast.FunctionDef object at 0x101959460>
>>> node = ast.FunctionDef(name="foo", args=ast.arguments())
>>> node.decorator_list
[]
>>> ast.FunctionDef(whatever="you want", name="x", args=ast.arguments())
<stdin>:1: DeprecationWarning: FunctionDef.__init__ got an unexpected keyword argument 'whatever'. Support for arbitrary keyword arguments is deprecated and will be removed in Python 3.15.
<ast.FunctionDef object at 0x1019581f0>
2024-02-27 18:13:03 -08:00
Tahoma Software 3a72fc36f9
gh-115315: Update time.rst to include microseconds field (%f) in chart (#115316)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-02-27 15:33:05 +02:00
Phil Elson 37f5d06b1b
Doc: Clarify the return type of Event.wait when timeout is used (GH-104168) 2024-02-26 11:53:20 +02:00
Antti Haapala 915d7dd090
gh-115091: Remove a left-over sentence that refers to Py_OptimizeFlag from ctypes documentation (GH-115092)
Remove a left-over sentence that refers to Py_OptimizeFlag 

Remove a left-over sentence that refers to an example that was present in Python 3.10 and was using ``Py_OptimizeFlag``.
2024-02-26 10:22:54 +01:00
Hugo van Kemenade 8e8ab75d97
gh-101100: Fix Sphinx warnings in `whatsnew/2.1.rst` (#112357)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-02-25 23:49:04 -07:00
Terry Jan Reedy de0b4f95cb
gh-115921: Change 'equation' to 'expression' in random.rst (#115927)
In uniform function entry.
2024-02-25 22:50:49 -05:00
Barney Gale e921f09c8a
GH-101112: Add "pattern language" section to pathlib docs (#114030)
Explain the `full_match()` / `glob()` / `rglob()` pattern language in its own section. Move `rglob()` documentation under `glob()` and reduce duplicated text.
2024-02-26 00:19:03 +00:00
Raymond Hettinger 6d34eb0e36
gh-115532: Add kernel density estimation to the statistics module (gh-115863) 2024-02-25 17:46:47 -06:00
bssyousefi 6a3236fe2e
gh-115799: Add missing double-quote in docs (#115884) 2024-02-25 14:07:08 -08:00
Skip Montanaro 84a275c4a2
gh-101100: Fix broken xrefs in fcntl module doc (#115691)
* clean up fcntl module doc

* simplify

* a few changes, based on suggestion by CAM-Gerlach

* nitpick ignore for a couple other C functions mentioned in the fcntl module doc

* more changes, especially related to LOCK_* constants

* :data: back to :const:

* Apply suggestions from code review

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

---------

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2024-02-25 12:02:18 -08:00
Matan Perelman c40b5b97fd
bpo-31116: Add Z85 variant to base64 (GH-30598)
Z85  specification: https://rfc.zeromq.org/spec/32/
2024-02-25 19:17:54 +02:00
Laurie O 9402ea63f7
gh-96471: Correct docs for queue shutdown (#115838) 2024-02-25 16:53:21 +00:00
Raymond Hettinger a0a8d9ffe0
gh-113479: Link to workaround for subtle issue with takewhile() (gh-115890) 2024-02-25 06:32:14 -06:00
mauricelambert cb287d3421
gh-103417: Fix the scheduler example (GH-111497)
Arguments to enterabs() are specified as Unix time.
If the scheduler use the time.monotonic timer, the code will take
decades to complete.
2024-02-25 13:55:57 +02:00
Hugo van Kemenade a00b41b9e9
gh-101100: Fix Sphinx warnings in `whatsnew/2.0.rst` (#112351)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-02-25 02:45:56 -07:00
Oh seungmin 5770006ffa
Add an example of of custom `__repr__` (#112761)
Added to repr entry in Doc/library/functions.rst.

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-02-25 02:59:35 -05:00
Adorilson Bezerra f7455864f2
Erase some unnecessary quotes on data model doc (#113521)
Thanks to Pedro Arthur Duarte (pedroarthur.jedi at gmail.com) for help with this bug.
2024-02-24 19:16:19 -05:00
Raymond Hettinger 53c5c17e0a
gh-113202: Add whatsnew entry for the batched() strict option. (gh-115889) 2024-02-24 12:03:11 -06:00
partev 5251711868
gh-115872: Doc: remove obsolete reference to MSI packages (#115873) 2024-02-23 23:53:26 -07:00
jmcb ef6074b352
Insert missing apostrophes in ctypes documentation (#115090) 2024-02-23 14:55:47 -08:00
Stanley 462a2fc09d
gh-54358: Clarify data chunking in pyexpat (GH-31629)
Co-authored-by: Éric Araujo <merwok@netwok.org>
2024-02-23 18:57:08 +00:00
Pablo Galindo Salgado 59057ce55a
gh-89480: Document the gdb helpers (GH-115657)
Content adapted from https://devguide.python.org/development-tools/gdb/#
and https://wiki.python.org/moin/DebuggingWithGdb.

The original content on the Wiki page came from gdb debug help used by
the Launchpad (https://launchpad.net/) team. 
Thanks to Anatoly Techtonik and user `rmf` for substantial improvements to the Wiki page.


The history of the Devguide page follows
(with log entries expanded for major content contributions):

Hugo van Kemenade, Sat Dec 30 21:22:04 2023 +0200
Hugo van Kemenade, Fri Dec 8 12:04:32 2023 +0200
Erlend E. Aasland & Hugo van Kemenade, Tue Aug 8 22:05:34 2023 +0200
Satish Mishra, Sat Feb 11 13:54:57 2023 +0530
Hugo van Kemenade, Fri Dec 23 17:33:33 2022 +0200
Skip Montanaro, Hugo, Erlend, & Ezio, Fri Nov 4 05:04:23 2022 -0500

    Add a GDB tips section to Advanced Tools (#977)
    
Adam Turner, Wed Jun 15 21:19:23 2022 +0100
Adam Turner, Tue Jun 14 11:12:26 2022 +0100
Suriyaa, Fri Jun 8 19:39:23 2018 +0200
Jeff Allen, Tue Oct 24 18:12:53 2017 +0100
Jeff Allen, Fri Oct 13 13:43:43 2017 +0100
Mariatta, Wed Jan 4 09:14:55 2017 -0800
Carol Willing, Mon Sep 26 14:50:54 2016 -0700
Zachary Ware, Thu Jul 21 10:42:23 2016 -0500
Georg Brandl, Mon Nov 3 11:28:19 2014 +0100

    Add instruction how to activate python-gdb.py

Georg Brandl, Sun Mar 9 10:32:01 2014 +0100
Georg Brandl, Tue Apr 3 09:12:53 2012 +0200
Georg Brandl, Sat Mar 5 17:32:35 2011 +0100
Dave Malcolm, Fri Jan 21 12:34:09 2011 -0500

    Add documentation on the gdb extension commands provided in libpython.py
    
    I adapted this from documentation I wrote for the Fedora wiki:
      https://fedoraproject.org/wiki/Features/EasierPythonDebugging#New_gdb_commands
    reformatting it as rst, and making other minor changes

Brett Cannon, Thu Jan 20 15:16:52 2011 -0800
Dave Malcolm, Thu Jan 20 16:17:23 2011 -0500

    Add some notes on the gdb pretty-printer hooks

Antoine Pitrou, Thu Jan 20 21:17:49 2011 +0100

    Give an example backtrace

Antoine Pitrou, Thu Jan 20 21:03:06 2011 +0100

    Expand explanations about gdb support

Brett Cannon, Thu Jan 20 11:33:36 2011 -0800

    Tweak the gdb support title to fit in better with the devguide.

Brett Cannon, Mon Jan 17 21:12:54 2011 +0000

    Short README on gdb support.


Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: anatoly techtonik <techtonik@gmail.com>
Co-authored-by: Antoine Pitrou <solipsis@pitrou.net>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Dave Malcolm <dmalcolm@redhat.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Georg Brandl <georg@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
Co-authored-by: Mariatta <Mariatta@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Satish Mishra <7506satish@gmail.com>
Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com>
Co-authored-by: Suriyaa <isc.suriyaa@gmail.com>
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2024-02-23 17:13:45 +01:00
NewUserHa a3859422d1
Update http.cookiejar document for cookie object attributes (GH-101885) 2024-02-22 19:08:04 +00:00
partev 7bc79371a6
gh-115795: Doc: fix obsolete URL (#115749) 2024-02-22 08:45:26 +02:00
Gregory P. Smith fac99b8b0d
gh-111140: Improve PyLong_AsNativeBytes API doc example & improve the test (#115380)
This expands the examples to cover both realistic use cases for the API.
    
I noticed thing in the test that could be done better so I added those as well: We need to guarantee that all bytes of the result are overwritten and that too many are not written.  Tests now pre-fills the result with data in order to ensure that.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2024-02-22 03:27:16 +00:00
Sebastian Pipping fbd40ce46e
gh-115399: Document CVE-2023-52425 under "XML vulnerabilities" (GH-115400)
Doc/library/xml.rst: Document CVE-2023-52425 under "XML vulnerabilities"
2024-02-21 12:26:16 +01:00
Bogdan Romanyuk 10fc4675fd
gh-115653: Document PyCode_GetFirstFree() (#115654)
Correct the return type of the PyCode_GetNumFree() documentation.
2024-02-21 10:01:36 +01:00
Victor Westerhuis e1fdc3c323
gh-104061: Add socket.SO_BINDTOIFINDEX constant (GH-104062)
Add socket.SO_BINDTOIFINDEX constant

This socket option avoids a race condition between SO_BINDTODEVICE and network interface renaming.
2024-02-20 23:08:15 +02:00
Eugene Toder c0b0c2f201
gh-101860: Expose __name__ on property (GH-101876)
Useful for introspection and consistent with functions and other
descriptors.
2024-02-20 17:14:34 +02:00
talcs e71468ba4f
gh-112020: Document the meaning of empty bytes returned by socket.recv() (GH-112055) 2024-02-20 16:54:33 +02:00
Raymond Hettinger acda1757bc
gh-113157: Document and test __get__ for MethodType (gh-115492) 2024-02-20 01:53:25 -06:00
Raymond Hettinger 2aaef56236
Make the title match the content (GH-115702) 2024-02-20 01:51:56 -06:00
Raymond Hettinger 9f8a9e8ac7
Modernize the Sorting HowTo guide (gh-115479) 2024-02-19 21:22:07 -06:00
Naglis Jonaitis 57d31ec359
Fix typo in multiprocessing docs (#115650) 2024-02-19 18:19:14 +00:00
Serhiy Storchaka 8f602981ba
gh-115664: Fix versionadded and versionchanged directives in multiprocessing.rst (GH-115665) 2024-02-19 18:03:42 +00:00
Brian Schubert b02ab65e80
gh-115664: Fix chronological ordering of versionadded and versionchanged directives (#115676) 2024-02-19 17:54:54 +00:00
Daniel Haag d504968983
gh-115652: Fix indentation in the documentation of multiprocessing.get_start_method (GH-115658) 2024-02-19 14:26:23 +00:00
0xflotus cbe809dfa9
gh-83648: Add missing `deprecated` arg in argparse.rst (GH-115640) 2024-02-19 10:29:32 +02:00
Masayuki Moriyama 1476ac2c58
gh-102388: Add windows_31j to aliases for cp932 codec (#102389)
The charset name "Windows-31J" is registered in the IANA Charset Registry[1]
and is implemented in Python as the cp932 codec.

[1] https://www.iana.org/assignments/charset-reg/windows-31J

Signed-off-by: Masayuki Moriyama <masayuki.moriyama@miraclelinux.com>
2024-02-19 17:01:35 +09:00
Simon A. Eugster 177b9cb52e
Docs: Add explanation about little/big endian (#109841)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-02-18 23:50:09 -08:00
Shantanu edea0e7d99
gh-114709: Mark commonpath behaviour as changed in 3.13 (#115639) 2024-02-18 14:08:50 -08:00
Daler 0c80da4c14
gh-115572: Move `codeobject.replace()` docs to the data model (#115631) 2024-02-18 14:13:46 +00:00
Sebastian Rittau 371c970886
gh-114709: Fix exceptions raised by posixpath.commonpath (#114710)
Fix the exceptions raised by posixpath.commonpath

Raise ValueError, not IndexError when passed an empty iterable. Raise
TypeError, not ValueError when passed None.
2024-02-18 00:24:58 -08:00
Thomas Grainger 04005f5021
Document use of ANY in test assertions (GH-94060) 2024-02-17 13:13:34 +00:00
Matthew Hughes e88ebc1c40
gh-97590: Update docs and tests for ftplib.FTP.voidcmd() (GH-96825)
Since 2f3941d743 this function returns the
response string, rather than nothing.
2024-02-17 11:57:51 +00:00
Furkan Onder d5a30a1777
gh-56499: Update the pickle library's note section for the __setstate__ function (GH-101062) 2024-02-17 10:51:43 +00:00
Rami debb1386be
gh-87688: Amend SSLContext.hostname_checks_common_name docs (GH-100517) 2024-02-17 10:22:19 +00:00
Hugo van Kemenade 4dff48d1f4
gh-101100: Fix Sphinx warnings in `whatsnew/3.2.rst` (#115580)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-17 03:03:20 -07:00
Hugo van Kemenade 30fce5f228
gh-101100: Fix Sphinx warnings in `whatsnew/3.1.rst` (#115575) 2024-02-17 02:39:07 -07:00
Stevoisiak d2d7808853
gh-101699: Explain using Match.expand with \g<0> (GH-101701)
Update documentation for re library to explain that a backreference `\g<0>` is
expanded to the entire string when using Match.expand().
Note that numeric backreferences to group 0 (`\0`) are not supported.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-17 08:33:28 +00:00
Jamie Phan 73e8637002
gh-113812: Allow DatagramTransport.sendto to send empty data (#115199)
Also include the UDP packet header sizes (8 bytes per packet)
in the buffer size reported to the flow control subsystem.
2024-02-16 18:38:07 -08:00
Brian Schubert 318f2190bc
docs: Add glossary term references to shutil docs (#115559)
Add glossary term references to shutil docs
2024-02-16 16:04:17 -06:00
Sam Gross 5903190727
gh-115103: Implement delayed memory reclamation (QSBR) (#115180)
This adds a safe memory reclamation scheme based on FreeBSD's "GUS" and
quiescent state based reclamation (QSBR). The API provides a mechanism
for callers to detect when it is safe to free memory that may be
concurrently accessed by readers.
2024-02-16 15:25:19 -05:00
Furkan Onder 2a7a0020c9
gh-69990: Make Profile.print_stats support sorting by multiple values (GH-104590)
Co-authored-by: Chiu-Hsiang Hsu
2024-02-16 12:03:46 +00:00
Hugo van Kemenade cfb26401f6
gh-100734: What's New in 3.x: Add missing detail from 3.x branch (#114689) 2024-02-15 17:32:33 +02:00
monkeyman192 298bcdc185
gh-112433: Add optional _align_ attribute to ctypes.Structure (GH-113790) 2024-02-15 16:40:20 +02:00
Martijn Pieters edb59d5718
bpo-38364: unwrap partialmethods just like we unwrap partials (#16600)
* bpo-38364: unwrap partialmethods just like we unwrap partials

The inspect.isgeneratorfunction, inspect.iscoroutinefunction and inspect.isasyncgenfunction already unwrap functools.partial objects, this patch adds support for partialmethod objects as well.

Also: Rename _partialmethod to __partialmethod__.
Since we're checking this attribute on arbitrary function-like objects,
we should use the namespace reserved for core Python.

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-02-15 12:08:45 +01:00
David Hewitt 9e3729bbd7
gh-114626: add PyCFunctionFast and PyCFunctionFastWithKeywords (GH-114627)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-02-15 11:05:20 +01:00
Ned Batchelder 474204765b
docs: use consistent .append() in dis.rst (#115434)
The STACK variable is described as like a Python list, so pushing to it should be done with .append() consistently throughout.
2024-02-15 02:14:03 -05:00
Victor Stinner 3e7b7df5cb
gh-114570: Add PythonFinalizationError exception (#115352)
Add PythonFinalizationError exception. This exception derived from
RuntimeError is raised when an operation is blocked during the Python
finalization.

The following functions now raise PythonFinalizationError, instead of
RuntimeError:

* _thread.start_new_thread()
* subprocess.Popen
* os.fork()
* os.fork1()
* os.forkpty()

Morever, _winapi.Overlapped finalizer now logs an unraisable
PythonFinalizationError, instead of an unraisable RuntimeError.
2024-02-14 23:35:06 +01:00
Erlend E. Aasland 49e8fdc1df
Docs: spell out sentence about ndbm/gdbm file formats (#115470) 2024-02-14 19:03:20 +01:00
Erlend E. Aasland 81e140d10b
Docs: reword sentences about dbm submodule traits (#114609)
Don't repeatedly say that keys and values are coerced into bytes.
2024-02-14 16:36:13 +01:00
Stanislav Lyu 6755c4e0c8
gh-115403: Remove extra colon after "Examples" in datetime documentation (#115452) 2024-02-14 13:52:42 +00:00
Erlend E. Aasland 6d9141ed76
gh-100414: Make dbm.sqlite3 the preferred dbm backend (#115447) 2024-02-14 13:47:19 +00:00
Erlend E. Aasland dd5e4d9078
gh-100414: Add SQLite backend to dbm (#114481)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2024-02-14 11:14:56 +00:00
Alex Waygood 3fd2ad8241
ftplib docs: `timeout` doesn't have to be a whole number (#115443) 2024-02-14 10:41:17 +00:00
Hugo van Kemenade 46245b0d83
Docs: Use substitutions instead of manual version updates (#115416) 2024-02-13 23:55:00 -07:00
Christophe Papazian de07941729
gh-115405: add versionadded tag for co_qualname in code objects documentation (#115411) 2024-02-13 16:10:00 +00:00
qqwqqw689 5719aa23ab
gh-113437: Update documentation about PyUnicode_AsWideChar() function (GH-113455) 2024-02-13 15:23:10 +01:00
Hugo van Kemenade 0a6e1a4119
Update "Using Python on a Mac" (#115024) 2024-02-13 08:31:49 +02:00
Steve Dower 10756b10ff
gh-111140: Minor doc fixes for PyLong_AsNativeBytes (GH-115375) 2024-02-12 22:28:36 +00:00
Hugo van Kemenade 341d7874f0
gh-115317: Rewrite changelog filter to use vanilla JavaScript (#115324)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-02-12 22:17:33 +00:00
Steve Dower 7861dfd26a
gh-111140: Adds PyLong_AsNativeBytes and PyLong_FromNative[Unsigned]Bytes functions (GH-114886) 2024-02-12 20:13:13 +00:00
Petr Viktorin 879f4546bf
gh-110850: Add PyTime_t C API (GH-115215)
* gh-110850: Add PyTime_t C API

Add PyTime_t API:

* PyTime_t type.
* PyTime_MIN and PyTime_MAX constants.
* PyTime_AsSecondsDouble(), PyTime_Monotonic(),
  PyTime_PerfCounter() and PyTime_GetSystemClock() functions.

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-02-12 18:13:10 +01:00
Serhiy Storchaka 91822018ee
gh-115233: Fix an example in the Logging Cookbook (GH-115325)
Also add more tests for LoggerAdapter.

Also support stacklevel in LoggerAdapter._log().
2024-02-12 18:24:45 +02:00
Hugo van Kemenade 92483b21b3
gh-101100: Fix Sphinx warnings in `whatsnew/2.7.rst` and related (#115319)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-12 14:40:41 +02:00
Nikita Sobolev 705c76d4a2
gh-114785: Remove content from `Porting from Python2` how-to (#114805)
Keep the page though, because people might still rely on it (the traffic shows that they do).
Instead of our own manual we now give links to the 3rd-party ones.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-02-12 14:59:58 +03:00
Brandt Bucher 235cacff81
GH-114695: Add `sys._clear_internal_caches` (GH-115152) 2024-02-12 09:04:36 +00:00
Skip Montanaro e1552fd19d
gh-101100: Clean up Doc/c-api/exceptions.rst and Doc/c-api/sys.rst (GH-114825) 2024-02-11 18:51:07 +00:00
Serhiy Storchaka b104360788
gh-49766: Make date-datetime comparison more symmetric and flexible (GH-114760)
Now the special comparison methods like `__eq__` and `__lt__` return
NotImplemented if one of comparands is date and other is datetime
instead of ignoring the time part and the time zone or forcefully
return "not equal" or raise TypeError.

It makes comparison of date and datetime subclasses more symmetric
and allows to change the default behavior by overriding
the special comparison methods in subclasses.

It is now the same as if date and datetime was independent classes.
2024-02-11 13:06:43 +02:00
Serhiy Storchaka d2c4baa41f
gh-97928: Partially restore the behavior of tkinter.Text.count() by default (GH-115031)
By default, it preserves an inconsistent behavior of older Python
versions: packs the count into a 1-tuple if only one or none
options are specified (including 'update'), returns None instead of 0.
Except that setting wantobjects to 0 no longer affects the result.

Add a new parameter return_ints: specifying return_ints=True makes
Text.count() always returning the single count as an integer
instead of a 1-tuple or None.
2024-02-11 12:43:14 +02:00
Serhiy Storchaka 573acb30f2
gh-115172: Fix explicit index extries for the C API (GH-115173) 2024-02-11 12:23:30 +02:00
Skip Montanaro 1b89591474
gh-101100: Fix dangling refs in bdb.rst (#114983)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-02-11 11:21:10 +02:00