Commit Graph

28391 Commits

Author SHA1 Message Date
Bradley Reynolds b1374aa1c2
gh-110383: Remove references to removed popen[234] (GH-112783)
Signed-off-by: Bradley Reynolds <bradley.reynolds@darbia.dev>
2024-05-30 12:21:37 +00:00
Lincoln db009348b4
gh-118055: Update the finder glossary entry (GH-118278) 2024-05-30 08:51:23 +00:00
Petr Viktorin 48f21b3631
gh-118235: Move RAISE_SYNTAX_ERROR actions to invalid rules and make sure they stay there (GH-119731)
The Full Grammar specification in the docs omits rule actions, so grammar rules that raise a syntax error looked like valid syntax.
This was solved in ef940de by hiding those rules in the custom syntax highlighter.

This moves all syntax-error alternatives to invalid rules, adds a validator that ensures that actions containing RAISE_SYNTAX_ERROR are in invalid rules, and reverts the syntax highlighter hack.
2024-05-30 09:27:32 +02:00
Zachary Ware 2cc3502f98
subprocess docs: Fix semantically important typo (GH-119752)
GH-25416 accidentally replaced a reference to the *stderr* argument of
`subprocess.run` with a reference to the *stdin* argument.  *stdin* is
not affected by the `check_output` option.
2024-05-29 22:19:54 +00:00
Aditya Borikar bf4ff3ad2e
gh-119260: Clarify is_dataclass Behavior for Subclasses in Documentation and Tests (#119480)
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-05-29 17:26:22 +00:00
Hugo van Kemenade 0751511d24
gh-93963: Remove deprecated names from importlib.abc (#119720)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2024-05-29 11:08:27 -06:00
Sergey B Kirpichev 0cdc5c8d54
gh-119613: Soft deprecate Py_IS_NAN/INFINITY/FINITE (#119701)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-29 10:45:14 +00:00
Matthias Görgens 18c1a8d3a8
gh-97588: Align ctypes struct layout to GCC/MSVC (GH-97702)
Structure layout, and especially bitfields, sometimes resulted in clearly
wrong behaviour like overlapping fields. This fixes

Co-authored-by: Gregory P. Smith <gps@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-29 12:02:53 +02:00
Nikita Sobolev f912e5a2f6
gh-118824: Remove deprecated `master_open` and `slave_open` from `pty` (#118826)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-28 16:42:35 +03:00
Justin Kunimune b407ad38fb
[doc] Clarify the nature of the root logger in the `logging` documentation (GH-119440)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2024-05-28 11:31:20 +01:00
Raymond Hettinger 0bd0d4072a
Misc cleanups and wording improvements for the itertools docs (gh-119626) 2024-05-27 13:22:57 -05:00
Hugo van Kemenade eea26c4a73
Docs: Move inline JavaScript to own file to reduce duplication (#119541) 2024-05-27 18:04:34 +00:00
Tian Gao 3dfa364cf2
gh-119580: Improve version added section for convenience variable (#119583) 2024-05-27 17:54:23 +00:00
Hugo van Kemenade 88e3fee3f8
Docs: Only install sphinx-autobuild for `make htmllive` (#119607) 2024-05-27 11:29:27 -06:00
Rafael Fontenelle 59630f92d8
Docs: Add class role for IPV{4,6}Address and fix a typo (#118059)
Add class role for IPV{4,6}Address and fix a typo

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-05-27 12:39:59 +00:00
Savannah Ostrowski 041a566f3f
GH-117283: Add doc warning for `PyTuple_SetItem` refcount > 1 (#117916) 2024-05-27 17:50:28 +05:30
Aditya Borikar 3b26cd8ca0
gh-119467: Fix Py_buffer.format type and correct documentation typo (#119475) 2024-05-27 17:46:13 +05:30
Alex Waygood 008bc04dcb
gh-119562: Remove AST nodes deprecated since Python 3.8 (#119563) 2024-05-26 12:34:48 +00:00
Wulian233 b5b7dc98c9
Update README and layout.html from 3.13 to 3.14 (#119539)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-26 11:26:59 +00:00
Ned Batchelder d25954dff5
docs: fix a few typos identified by codespell (#119516) 2024-05-25 18:13:31 -07:00
Barney Gale e418fc3a6e
GH-82805: Fix handling of single-dot file extensions in pathlib (#118952)
pathlib now treats "`.`" as a valid file extension (suffix). This brings
it in line with `os.path.splitext()`.

In the (private) pathlib ABCs, we add a new `ParserBase.splitext()` method
that splits a path into a `(root, ext)` pair, like `os.path.splitext()`.
This method is called by `PurePathBase.stem`, `suffix`, etc. In a future
version of pathlib, we might make these base classes public, and so users
will be able to define their own `splitext()` method to control file
extension splitting.

In `pathlib.PurePath` we add optimised `stem`, `suffix` and `suffixes`
properties that don't use `splitext()`, which avoids computing the path
base name twice.
2024-05-25 21:01:36 +01:00
Hugo van Kemenade a531fd7fdb
FAQ: Add reference to Python version numbering scheme (#119225) 2024-05-25 08:13:17 -06:00
Serhiy Storchaka 08e65430aa
gh-111999: Fix the signature of str.format_map() (#119540) 2024-05-25 06:21:11 -07:00
Raymond Hettinger 49c3ade4f3
Misc improvement to the docs for itertools (gh-119529) 2024-05-24 16:58:24 -05:00
Barney Gale 81d6336230
GH-119054: Add "Querying file type and status" section to pathlib docs (#119055)
Add a dedicated subsection for `Path.stat()`-related methods, specifically
`stat()`, `lstat()`, `exists()`, `is_*()`, and `samefile()`.
2024-05-24 19:35:13 +00:00
Kirill Podoprigora 045e195c76
Regen ``Doc/requirements-oldest-sphinx.txt`` (#119520) 2024-05-24 13:30:32 -06:00
Carlos Meza 0867bce457
gh-119317: findall instead of traverse for docutils nodes (#119319) 2024-05-24 05:04:12 +03:00
Petr Viktorin ffa24aab10
Clarify base64.a85encode docs: *wrapcols* doesn't count the newline (GH-119409) 2024-05-24 00:11:45 +02:00
uıɐɾ ʞ ʇɐɯɐs 2fbea81d64
gh-70795: Rework RLock documentation (#103853)
Attempted to simultaneously reduce verbosity, while more descriptively
describing behavior.

Fix links (RLock acquire/release previously linking to Lock
acquire/release, seems like bad copy pasta).

Add a seealso for with-locks.

Switch section to use bullet points.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2024-05-22 16:15:11 -04:00
Jacob Walls aee8f03abb
Fix version number in use_load_tests deprecation reference (GH-119151)
Deprecation took place in d78742a260 (3.5)
2024-05-22 12:43:56 +03:00
Mathijs Mortimer 5adf78f546
Clarify that dklen is expected in bytes for the hashlib functions (GH-106624) 2024-05-22 11:51:25 +03:00
Alyssa Coghlan 31d61a75c9
DOCS: fix error in exec namespace note (gh-119378)
When updating the new exec note added in gh-119235 as part of the
PEP 667 general docs PR, I suggested a workaround that isn't valid.

The first half of the note is still reasonable, so just omit the invalid text.
2024-05-22 06:38:06 +00:00
Batuhan Taskaya d065edfb66
gh-60191: Implement ast.compare (#19211)
* bpo-15987: Implement ast.compare

Add a compare() function that compares two ASTs for structural equality. There are two set of attributes on AST node objects, fields and attributes. The fields are always compared, since they represent the actual structure of the code. The attributes can be optionally be included in the comparison. Attributes capture things like line numbers of column offsets, so comparing them involves test whether the layout of the program text is the same. Since whitespace seems inessential for comparing ASTs, the default is to compare fields but not attributes.

ASTs are just Python objects that can be modified in arbitrary ways. The API for ASTs is under-specified in the presence of user modifications to objects. The comparison respects modifications to fields and attributes, and to _fields and _attributes attributes. A user could create obviously malformed objects, and the code will probably fail with an AttributeError when that happens. (For example, adding "spam" to _fields but not adding a "spam" attribute to the object.) 

Co-authored-by: Jeremy Hylton <jeremy@alum.mit.edu>
2024-05-22 01:39:26 +00:00
Landon Wood 0e3c8cda1f
gh-110383: Align dict.get(), .fromkeys(), and .setdefault() docs with docstrings (#119330) 2024-05-22 01:15:40 +00:00
Jelle Zijlstra 98e855fcc1
gh-119180: Add LOAD_COMMON_CONSTANT opcode (#119321)
The PEP 649 implementation will require a way to load NotImplementedError
from the bytecode. @markshannon suggested implementing this by converting
LOAD_ASSERTION_ERROR into a more general mechanism for loading constants.

This PR adds this new opcode. I will work on the rest of the implementation
of the PEP separately.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-05-22 00:46:39 +00:00
Brett Simmers 9fa206aaec
Docs: Add central references to free-threading-related options (#119017) 2024-05-21 17:49:23 -04:00
Irit Katriel 6e9863d7a3
gh-118692: Avoid creating unnecessary StopIteration instances for monitoring (#119216) 2024-05-21 20:42:51 +00:00
Josh Cannon e3ed574f6a
gh-90562: Mention slots pitfall in dataclass docs (#107391)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-21 19:37:32 +00:00
Victor Stinner f6da790122
gh-111389: Add PyHASH_MULTIPLIER constant (#119214) 2024-05-21 19:51:51 +02:00
Blaise Pabon 9db2fd7eda
GH-110383: Improve Tutorial for Input Ouput (#119230)
Co-authored-by: edson duarte <eduarte.uatach@gmail.com>
2024-05-21 16:25:37 +00:00
Daniel Williams 62a29be5bb
gh-110383: Document `socket.makefile()` accepts combined modes (#119150)
The supported mode values are 'r', 'w', and 'b', or a combination of those.
2024-05-21 16:23:50 +00:00
Alyssa Coghlan e870c852c0
gh-74929: PEP 667 general docs update (gh-119201)
* expand on What's New entry for PEP 667 (including porting notes)
* define 'optimized scope' as a glossary term
* cover comprehensions and generator expressions in locals() docs
* review all mentions of "locals" in documentation (updating if needed)
* review all mentions of "f_locals" in documentation (updating if needed)
2024-05-21 03:32:15 +00:00
Melanie Arbor 172690227e
gh-102136: Add -m to options that work with -i (GH-119271)
* GH-102136: Add -m to options that work with -i

* Linting
2024-05-20 19:38:33 -04:00
Alex Waygood 423bbcbbc4
gh-108267 Fix another dataclasses docs typo (#119277) 2024-05-20 22:34:57 +00:00
Shauna 7e57640c7e
gh-118912: Remove description of issue fixed in 3.5 from autospeccing guide (#119232)
* Remove description of issue fixed in 3.5 from autospeccing guide

* Make autospeccing note text more succint and lint whitespace

* Add linting changes (missed in last commit)

---------

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-05-20 20:10:53 +00:00
Hugo van Kemenade 034cf0c316
Docs: Ensure no warnings are found in the NEWS file before a given line number (#119221) 2024-05-20 13:31:38 -06:00
Serhiy Storchaka e188527c34
gh-118760: Restore the default value of tkinter.wantobjects to 1 (GH-118784)
It was set to 2 in 65f5e586a1 (GH-98592).
2024-05-20 22:21:04 +03:00
Tialo 6b80a5b20f
Use correct markup in unittest.mock.reset_mock documentation (GH-119207) 2024-05-20 21:17:44 +02:00
Hood Chatham 7e1a130b8f
DOCS: Suggest always calling exec with a globals argument and no locals argument (GH-119235)
Many users think they want a locals argument for various reasons but they do not
understand that it makes code be treated as a class definition. They do not want
their code treated as a class definition and get surprised. The reason not
to pass locals specifically is that the following code raises a `NameError`:

```py
exec("""
def f():
    print("hi")

f()

def g():
    f()
g()
""", {}, {})
```

The reason not to leave out globals is as follows:

```py
def t():
    exec("""
def f():
    print("hi")

f()

def g():
    f()
g()
    """)
```
2024-05-20 17:42:15 +00:00
Sebastian Rittau e406b399f9
[docs] TypeVarTuple default is keyword-only (#119215) 2024-05-20 15:31:45 +00:00
David Foster 72d07dd30b
typing docs: Fix formatting issue (#119210) 2024-05-20 14:32:51 +00:00
Jelle Zijlstra 697465ff88
marshal docs: Remove reference to "Sun" (#119161)
Nobody has been using a Sun machine for a long time. When I saw
this sentence in a lightning talk just now, I thought it was talking
about sending Python code on a spacecraft.
2024-05-18 22:15:14 -04:00
Rafael Fontenelle 691429702f
docs: make mimalloc license text literal (#119046) 2024-05-18 12:22:54 -04:00
Nice Zombies 0f5e8bed63
gh-119078: Clarify venv tutorial (GH-119129) 2024-05-18 12:44:02 +01:00
Raymond Hettinger 81c3130c51
Minor improvements to the docs for itertools.tee() (gh-119135) 2024-05-18 01:32:34 -05:00
Lysandros Nikolaou 447edb6e98
gh-112066: Fix versionadded in PyDict_SetDefaultRef docs (#118696) 2024-05-17 12:10:21 -04:00
Shantanu 17cba55786
gh-108267: Fix object.__setattr__ regression in dataclasses docs (#119082) 2024-05-16 09:39:37 -04:00
Rafael Fontenelle 66b73e9724
Use literal syntax in origin property (#119029) 2024-05-15 22:13:47 -07:00
Rafael Fontenelle fb0cf7d140
gh-119009: Add gettext target (#119006) 2024-05-15 12:13:52 -06:00
Jelle Zijlstra ee13797dec
3.13 What's New: Add PEP 702 (#118922)
I honestly forgot this slipped into 3.13, but I think it's worth highlighting more, as it is a PEP-sized change that makes the type system significantly more powerful.

@Yhg1s I think it's also worth mentioning in your release announcements.
2024-05-14 22:39:12 -04:00
Barney Gale 7d8725ac6f
GH-74033: Drop deprecated `pathlib.Path` keyword arguments (#118793)
Remove support for supplying keyword arguments to `pathlib.Path()`. This
has been deprecated since Python 3.12.
2024-05-14 20:14:07 +00:00
Barney Gale fbe6a0988f
GH-101357: Suppress `OSError` from `pathlib.Path.exists()` and `is_*()` (#118243)
Suppress all `OSError` exceptions from `pathlib.Path.exists()` and `is_*()`
rather than a selection of more common errors as we do presently. Also
adjust the implementations to call `os.path.exists()` etc, which are much
faster on Windows thanks to GH-101196.
2024-05-14 17:53:15 +00:00
Erlend E. Aasland d8e0e00919
gh-118928: sqlite3: disallow sequences of params with named placeholders (#118929)
Follow-up of gh-101693. The previous DeprecationWarning is replaced with 
raising sqlite3.ProgrammingError.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-14 16:10:55 +00:00
Raymond Hettinger 7a97ee570f
Misc improvements to the itertools docs (gh-119040) 2024-05-14 10:18:19 -05:00
Nikita Sobolev b04c497f18
gh-119010: Adds docs about `__type_params__` to `functools.update_wrapper` (#119012)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-13 20:01:05 +00:00
Nikita Sobolev b4ca389281
Improve the `rmtree` doc for `dir_fd` param addition in 3.11 (#118964) 2024-05-13 05:04:14 -06:00
pochmann3 a705c1e449
Itertools docs: fix parameter names and indentation in Python equivalents (gh-118977) 2024-05-12 16:11:38 -05:00
Nice Zombies 7e894c2f38
Docs: Fix SOURCE_URI (#118945) 2024-05-11 05:47:45 -06:00
Hugo van Kemenade a019347947
gh-118924: Remove `sqlite3.version` and `sqlite3.version_info` (#118925) 2024-05-10 20:42:34 +00:00
Barney Gale f772d0d08a
GH-78707: Drop deprecated `pathlib.PurePath.[is_]relative_to()` arguments (#118780)
Remove support for supplying additional positional arguments to
`PurePath.relative_to()` and `is_relative_to()`. This has been deprecated
since Python 3.12.
2024-05-10 15:53:46 +00:00
Adam Dangoor c444362c6e
Correct the argument names for `secrets.choice` and `secrets.randbelow` in `secrets.rst` (GH-118098)
Correct the argument names for `secrets.choice` and `secrets.randbelow` in `secrets.rst`.
2024-05-10 14:30:42 +00:00
Inada Naoki 7ac933e260
gh-118689: Doc: fix ePub build (#118690) 2024-05-10 19:24:02 +09:00
Dobatymo e85e8deaf3
gh-118209: Add Windows structured exception handling to mmap module (GH-118213) 2024-05-10 10:47:30 +01:00
Xie Yanbo 17a2cc199d
Docs: fix typos in documentation (GH-118815) 2024-05-10 09:11:50 +01:00
Jelle Zijlstra 68fbc00dc8
gh-118851: Default ctx arguments to AST constructors to Load() (#118854)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-09 15:30:14 -07:00
Jelle Zijlstra 35b5eaa176
gh-118767: Improve tests and docs for bool(NotImplemented) (#118813) 2024-05-09 13:52:08 +00:00
Nikita Sobolev da090f1658
gh-118805: Remove type, choices, metavar params of `BooleanOptionalAction` (#118806)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-09 11:46:45 +00:00
Hugo van Kemenade c68acb1384
gh-118798: Remove deprecated isdst parameter from `email.utils.localtime` (#118799) 2024-05-09 03:17:02 -06:00
Raymond Hettinger e8cbcf4955
GH-101588: Remove deprecated pickle/copy/deepcopy from itertools (gh-118816) 2024-05-09 03:31:47 -05:00
Nikita Sobolev 2f4db5a04d
gh-118803: Remove `ByteString` from `typing` and `collections.abc` (#118804) 2024-05-09 00:37:55 +01:00
Serhiy Storchaka 05c2fe1acd
Format None, True, False and NotImplemented as literals (GH-118758) 2024-05-08 22:35:16 +03:00
Ned Batchelder bcb435ee8f
docs: module page titles should not start with a link to themselves (#117099) 2024-05-08 20:34:40 +01:00
Xie Yanbo 7b0c247f1c
Docs: fix typos in documentation (#118752) 2024-05-08 12:20:40 -06:00
Jelle Zijlstra 3c079a0203
gh-118767: Make bool(NotImplemented) raise TypeError (#118775) 2024-05-08 11:12:00 -07:00
Jelle Zijlstra 6d419db10c
Fix file extensions for 3.14 Whats New (#118770) 2024-05-08 16:40:40 +00:00
Steve Dower 66f8bb76a1
gh-118486: Update docs for CVE-2024-4030 reference (GH-118737) 2024-05-08 15:52:39 +00:00
Thomas Wouters 7768ff1e41 Python 3.14.0a0 2024-05-08 16:57:05 +02:00
Thomas Wouters 2268289a47 Python 3.13.0b1 2024-05-08 11:21:00 +02:00
trag1c c4f9823be2
gh-118671: Updated dead ActiveState links (#118730)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-05-08 01:06:38 -06:00
Kirill Podoprigora fcf52d7cee
Regen ``Doc/requirements-oldest-sphinx.txt`` (#118736)
Regen dependencies
2024-05-08 08:59:17 +03:00
T. Wouters f548855061
gh-109975: Make a rough editorial pass over What's New (#118711)
Make a rough editorial pass over Python 3.13's What's New document. Add the
release highlights, remove or merge some duplicated entries, and reorder
some of the sections (removals should really go before future deprecations).
2024-05-07 23:00:25 +02:00
chrysn f58833ebf8
gh-118650: Document `Enum._repr_*` reservation exclusion (GH-118698) 2024-05-07 11:11:18 -07:00
Pablo Galindo Salgado b9caa0977c
gh-118518: Improve perf docs (#118708) 2024-05-07 17:25:15 +01:00
Jelle Zijlstra 71080b8a0f
gh-118660: Add second type parameter to (Async)ContextManager (#118681)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-07 14:16:05 +00:00
Kerim Kabirov a855f824a2
Remove Python 3.5 hardcoded version in the tutorial appendix (GH-117612) 2024-05-07 15:28:16 +02:00
Serhiy Storchaka 65f5e586a1
gh-66410: Do not stringify arguments of Tkinter callback (GH-98592)
Callbacks registered in the tkinter module now take arguments as
various Python objects (int, float, bytes, tuple), not just str.
To restore the previous behavior set tkinter module global wantobject to 1
before creating the Tk object or call the wantobject() method of the Tk object
with argument 1.
Calling it with argument 2 restores the current default behavior.
2024-05-07 12:07:32 +00:00
Hugo van Kemenade 04859228aa
gh-118518: Rename `PYTHONPERFJITSUPPORT` and `-X perfjit` with underscores (#118693) 2024-05-07 11:47:21 +00:00
Momo Eissenhauer 48e52fe2c9
gh-118310: Fix documentation for `enum.Enum.__new__` (GH-118311)
The provided example was incorrect:
- The example enum was missing the `int` mixin as implied by the context
- The value of `int('1a', 16)` was incorrectly given as 17
  (should be 26)
2024-05-07 13:42:18 +02:00
Alex Waygood 44a9f3db2b
gh-109653: What's new: Note improved import times for several stdlib modules in Python 3.13 (#118697) 2024-05-07 11:34:19 +00:00
Hugo van Kemenade 6cf70678e2
gh-109975: Update 'What's New in Python 3.13' for beta (#118694) 2024-05-07 12:35:32 +02:00
Xie Yanbo 9762122235
Fix several typos in documentation (GH-118625) 2024-05-07 09:23:06 +00:00
Sam Gross 60bd111844
Docs: add whatsnew for free-threading (#118679)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-06 21:48:28 -04:00
Jelle Zijlstra e0422198fb
gh-117486: Improve behavior for user-defined AST subclasses (#118212)
Now, such classes will no longer require changes in Python 3.13 in the normal case.
The test suite for robotframework passes with no DeprecationWarnings under this PR.

I also added a new DeprecationWarning for the case where `_field_types` exists
but is incomplete, since that seems likely to indicate a user mistake.
2024-05-06 15:57:27 -07:00
Jelle Zijlstra 8419f01673
gh-118647: Add defaults to typing.Generator and typing.AsyncGenerator (#118648)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-06 22:35:06 +00:00
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