Commit graph

12460 commits

Author SHA1 Message Date
Ned Batchelder
f014f1567c
docs: clarify Path.suffix (GH-106650) 2023-07-13 20:24:54 +01:00
Alex Waygood
32718f908c
gh-106309: Deprecate typing.no_type_check_decorator (#106312) 2023-07-13 14:30:35 +01:00
Mariusz Felisiak
f520804b03
gh-96165: Clarify passing ":memory:" in sqlite3.connect() (#106451) 2023-07-11 22:18:19 +02:00
Mariusz Felisiak
fc7ff1af45
gh-96165: Clarify omitting the FROM clause in SQLite queries (#106513) 2023-07-11 22:09:04 +02:00
Thomas Dwyer
18dfbd0357
gh-102988: Detect email address parsing errors and return empty tuple to indicate the parsing error (old API) (#105127)
Detect email address parsing errors and return empty tuple to indicate the parsing error (old API). This fixes or at least ameliorates CVE-2023-27043.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-07-10 23:00:55 +00:00
Hugo van Kemenade
34c14147a2
gh-106487: Allow the 'count' argument of str.replace to be a keyword (#106488) 2023-07-10 12:52:36 +03:00
Alex Waygood
ca8b55c7f5
gh-106461: typing: Consolidate docs on Callable (#106462) 2023-07-09 21:46:15 +01:00
Victor Stinner
dcc028d924
gh-105376: Remove logging.warn() and LoggerAdapter.warn() (#106553) 2023-07-09 10:32:50 +02:00
Victor Stinner
da98ed0aa0
gh-106535: Soft deprecate the getopt module (#105735)
The getopt module exists since the initial revision of the Python
source code (1990). The optparse module was added to Python 2.3. When
Python 2.7 added the 3rd argparse module, the optparse module was
soft deprecated. Soft deprecate the getopt module.
2023-07-08 17:51:45 +02:00
Owain Davies
ec7180bd1b
gh-101880: add link to object.__hash__() in hash() builtin documentation (#101883) 2023-07-08 08:48:33 +00:00
Victor Stinner
d524b6f61f
gh-106535: Document PEP 387 Soft Deprecation (#106536)
Mark the optparse module as soft deprecated.
2023-07-08 00:03:51 +02:00
C.A.M. Gerlach
38aa89a52e
Doc: Add missing ref labels to exception groups/notes sections (#106465) 2023-07-05 23:41:04 -06:00
Dong-hee Na
217f47d6e5
gh-96844: Improve error message of list.remove (gh-106455) 2023-07-06 07:19:49 +09:00
Jelle Zijlstra
c16ea94abc
shlex docs: remove outdated note (#106463)
As the versionchanged notice says, this note is no longer true on 3.12+.
2023-07-05 13:38:53 -07:00
Kristján Valur Jónsson
12a9813808
Clarify state of CancelledError in doc (#106453)
This change makes it explicit that asyncio.CancelledError is not a subclass of Exception.
2023-07-05 08:07:02 -07:00
Mario Corchero
2dfc7fae78
gh-61215: Rename wait_until_any_call to wait_until_any_call_with (#106414)
mock: Rename `wait_until_any_call` to `wait_until_any_call_with`

Rename the method to be more explicit that it expects the args and
kwargs to wait for.
2023-07-04 18:34:43 +01:00
Raymond Hettinger
7709037095
Small speed-up for the convolve() recipe. (GH-106371) 2023-07-03 15:38:38 -05:00
Mario Corchero
d65b783b69
gh-61215: New mock to wait for multi-threaded events to happen (#16094)
mock: Add `ThreadingMock` class

Add a new class that allows to wait for a call to happen by using
`Event` objects. This mock class can be used to test and validate
expectations of multithreading code.

It uses two attributes for events to distinguish calls with any argument
and calls with specific arguments.

The calls with specific arguments need a lock to prevent two calls in
parallel from creating the same event twice.

The timeout is configured at class and constructor level to allow users
to set a timeout, we considered passing it as an argument to the
function but it could collide with a function parameter. Alternatively
we also considered passing it as positional only but from an API
caller perspective it was unclear what the first number meant on the
function call, think `mock.wait_until_called(1, "arg1", "arg2")`, where
1 is the timeout.

Lastly we also considered adding the new attributes to magic mock
directly rather than having a custom mock class for multi threading
scenarios, but we preferred to have specialised class that can be
composed if necessary. Additionally, having added it to `MagicMock`
directly would have resulted in `AsyncMock` having this logic, which
would not work as expected, since when if user "waits" on a
coroutine does not have the same meaning as waiting on a standard
call.

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
2023-07-03 07:56:54 +01:00
Terry Jan Reedy
04dfc6fa90
gh-106232: Make timeit doc command lines compatible with Windows. (#106296)
Command Prompt (CMD Shell) and older versions of PowerShell
require double quotes and single quotes inside the string.
This form also works on linux and macOS.
2023-06-30 22:34:31 -04:00
F3eQnxN3RriK
a8ae73965b
gh-101100: Docs: Fix references to several numeric dunders (#106278)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-30 15:27:09 +01:00
Brandt Bucher
7b2d94d875
GH-106008: Make implicit boolean conversions explicit (GH-106003) 2023-06-29 13:49:54 -07:00
hms
8bff940ad6
gh-105775: Convert LOAD_CLOSURE to a pseudo-op (#106059)
This enables super-instruction formation,
removal of checks for uninitialized variables,
and frees up an instruction.
2023-06-29 09:34:00 -07:00
F3eQnxN3RriK
18f51f91e2
gh-101100: Fix reference to parse_args in optparse.rst (#105265) 2023-06-28 15:30:26 +03:00
F3eQnxN3RriK
bbf722dcd3
gh-101100: Fix reference to asynchronous methods (#106172) 2023-06-28 10:43:11 +00:00
Sam Bull
6b52a581c1
gh-105993: Add possible None return type to asyncio.EventLoop.start_tls docs (#105995) 2023-06-28 16:08:15 +05:30
lightdrk
541a10f9ed
Refer to TimeoutError instead of asyncio.TimeoutError in asyncio-task.rst (#106136)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-06-27 23:21:38 -06:00
Nikita Sobolev
33608fd67d
gh-92788: Add docs for ast.Module, ast.Expression, and others (#101055) 2023-06-27 06:43:49 -07:00
Raymond Hettinger
a8210b6df1
GH-105774: Clarify operation of normalize() (GH-106093) 2023-06-26 23:12:22 -05:00
Łukasz Langa
d3af83b934
Revert "GH-96145: Add AttrDict to JSON module for use with object_hook (#96146)" (#105948)
This reverts commit 1f0eafa844.
2023-06-26 20:35:53 +02:00
Roderich Schupp
512f299e55
gh-106107: document correct error that's raised when a mutable default value for a field is detected (gh-106109) 2023-06-26 14:00:21 -04:00
Barney Gale
219effa876
GH-105793: Add follow_symlinks argument to pathlib.Path.is_dir() and is_file() (GH-105794)
Brings `pathlib.Path.is_dir()` and `in line with `os.DirEntry.is_dir()`, which
will be important for implementing generic path walking and globbing.
Likewise `is_file()`.
2023-06-26 17:58:17 +01:00
Paul Moore
5d4dbf0e30
gh-106111: Remove zipapp documentation on creating a Windows executable (#106112)
Remove zipapp documentation on creating a Windows executable
2023-06-26 18:14:20 +02:00
Alex Waygood
3eeb8c8906
Improve typing docs on the type of class objects (#106081) 2023-06-26 00:13:48 -07:00
Erlend E. Aasland
bef1c8761e
Docs: add links to 'callable' term in sqlite3 docs (#106072) 2023-06-25 02:02:59 +02:00
Barney Gale
4a6c84fc1e
GH-104375: Use versionchanged to describe new arguments in pathlib docs (GH-104376) 2023-06-24 16:14:09 +01:00
Eamon Tracey
8ef0ee4ebc
Typing docs: fix typo in annotating tuples comment (#106048) 2023-06-23 21:34:05 +01:00
Irit Katriel
d8ca5a11bc
gh-105730: support more callables in ExceptionGroup.split() and subgroup() (#106035) 2023-06-23 19:47:47 +01:00
Alex Waygood
968435ddb1
Typing docs: improve the guidance on annotating tuples (#106021) 2023-06-23 15:33:20 +01:00
Barney Gale
a8006706f7
GH-89812: Add pathlib.UnsupportedOperation (GH-105926)
This new exception type is raised instead of `NotImplementedError` when
a path operation is not supported. It can be raised from `Path.readlink()`,
`symlink_to()`, `hardlink_to()`, `owner()` and `group()`. In a future
version of pathlib, it will be raised by `AbstractPath` for these methods
and others, such as `AbstractPath.mkdir()` and `unlink()`.
2023-06-22 14:35:51 +01:00
Mathieu Dupuy
c5a722be5f
stdtypes.rst: remove a period (#105959) 2023-06-21 15:21:37 +01:00
Alex Waygood
4426279a43
typing docs: Improve the intro to each section (#105901) 2023-06-19 00:54:29 +01:00
Erlend E. Aasland
6849acb3fe
gh-105875: Require SQLite 3.15.2 or newer (#105876)
SQLite 3.15.2 was released 2016-11-28.
2023-06-19 00:29:08 +02:00
Irit Katriel
14d01262da
gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions (#105865) 2023-06-17 17:00:16 +01:00
Carl Meyer
b356a4749a
gh-105678: document SET_FUNCTION_ATTRIBUTE (#105843) 2023-06-16 12:36:59 -05:00
Alex Doe
486b52a315
bpo-44530: Document the change in MAKE_FUNCTION behavior (#93189)
* bpo-44530: Document the change in MAKE_FUNCTION behavior

Fixes dis module documentation for MAKE_FUNCTION due to 2f180ce2cb (bpo-44530, released as part of 3.11) removes the qualified name at TOS
2023-06-15 19:04:57 -05:00
Alex Waygood
da911a6b22
More reorganisation of the typing docs (#105787) 2023-06-15 06:52:18 +01:00
Alex Waygood
006a453205
Improve docs for typing.dataclass_transform (#105792) 2023-06-15 06:51:42 +01:00
Mark Shannon
1d857da7f0
GH-77273: Better bytecodes for f-strings (GH-6132) 2023-06-14 16:15:08 +01:00
Alex Waygood
7b1f0f204a
gh-105570: Deprecate unusual ways of creating empty TypedDicts (#105780)
Deprecate two methods of creating typing.TypedDict classes with 0 fields using the functional syntax: `TD = TypedDict("TD")` and `TD = TypedDict("TD", None)`. Both will be disallowed in Python 3.15. To create a TypedDict class with 0 fields, either use `class TD(TypedDict): pass` or `TD = TypedDict("TD", {})`.
2023-06-14 14:58:41 +00:00
Alex Waygood
4a113e24a3
Typing docs: move the deprecated stuff below the non-deprecated stuff (#105781) 2023-06-14 15:19:27 +01:00