Commit Graph

26858 Commits

Author SHA1 Message Date
Terry Jan Reedy 7aa89e505d
gh-106780: Add __match_args__ to tutorial example (#106784)
Add Point definition with this attribute before example
that needs it.
2023-07-16 23:36:03 -04:00
Raymond Hettinger babb22da5a
Add more recipe tests. Make the factor recipe a bit faster and clearer. (GH-106817) 2023-07-16 21:37:07 -05:00
Jean-Baptiste Poupon 4dc593477a
Fix the french used in the email documentation (GH-106279)
* Fix the french used in the email documentation

The french used in one of the example was either machine translated a while ago or written by someone who does not speak french. Fixed it by using grammatically correct french.
2023-07-16 19:14:08 +02:00
Inada Naoki e58960160f
Doc: fix section levels of devmode doc (#106801) 2023-07-16 21:23:54 +09:00
Simone Rubino 83bd568d2b
Doc: devmode: add -Xdev option to example (#106253) 2023-07-16 16:29:58 +09:00
Hugo van Kemenade c02ee45031
Docs search: Replace jQuery with vanilla JavaScript (#106743)
* Replace jQuery with vanilla JavaScript
* Switch 'var' to 'const' or 'let'
2023-07-16 10:26:26 +03:00
Erlend E. Aasland 8c17729489
Docs: Normalize Argument Clinic How-To section capitalization (#106788) 2023-07-16 00:42:58 +02:00
Mathieu Dupuy d46a42fd8e
faq/library: remove outdated section (#105996) 2023-07-15 13:23:10 -07:00
Raymond Hettinger e2ec0bad67
Add more examples to the recipe docs (GH-106782)
Demonstrate that factor() works for large composites and large primes.
2023-07-15 14:43:09 -05:00
Inada Naoki 2566b74b26
gh-81283: compiler: remove indent from docstring (#106411)
Co-authored-by: Éric <merwok@netwok.org>
2023-07-15 19:33:32 +09:00
Alex Waygood 89ec0e9529
gh-106745: typing docs: Clarify that removal of PEP-585 aliases is not currently planned (#106748) 2023-07-14 19:49:02 +01:00
Jason R. Coombs 243fdcb40e
gh-106531: Remove importlib.resources._legacy (#106532)
* gh-106531: Remove importlib.resources._legacy

Syncs with importlib_resources 6.0.

* Remove documentation for removed functionality.
2023-07-14 13:38:28 -04:00
Charlie Zhao 89867d2491
gh-106446: Fix failed doctest in stdtypes (#106447)
---------
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-07-14 03:38:03 -04:00
Nikita Sobolev 490295d651
gh-105626: Change the default return value of `HTTPConnection.get_proxy_response_headers` (#105628) 2023-07-13 23:55:49 -07:00
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
Victor Stinner 42bc485a24
gh-105373: Elaborate Pending Removal in What's New in Python 3.13 (#106675)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-07-12 12:28:10 +02:00
Hugo van Kemenade e8ab0096a5
Add Plausible for docs metrics (#106644) 2023-07-12 05:35:24 +03: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
Serhiy Storchaka 4bf43710d1
gh-106307: C API: Add PyMapping_GetOptionalItem() function (GH-106308)
Also add PyMapping_GetOptionalItemString() function.
2023-07-11 23:04:12 +03:00
Serhiy Storchaka 579aa89e68
gh-106521: Add PyObject_GetOptionalAttr() function (GH-106522)
It is a new name of former _PyObject_LookupAttr().

Add also PyObject_GetOptionalAttrString().
2023-07-11 22:13:27 +03:00
RustyNail d0b7e18262
gh-106625 : Add missing code to tutorial 4.6 example (#106623)
* Added missing import statement.

* Update Doc/tutorial/controlflow.rst

* Update Doc/tutorial/controlflow.rst

* Update controlflow.rst

* Make point regular class with __init__.

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-07-11 13:22:07 -04:00
Petr Viktorin af5cf1e751
gh-103968: What's New: Add porting hints for PyType_From with metaclasses (GH-105698) 2023-07-11 13:20:29 +02:00
Victor Stinner 1f2921b72c
gh-106572: Convert PyObject_DelAttr() to a function (#106611)
* Convert PyObject_DelAttr() and PyObject_DelAttrString() macros to
  functions.
* Add PyObject_DelAttr() and PyObject_DelAttrString() functions to
  the stable ABI.
* Replace PyObject_SetAttr(obj, name, NULL) with
  PyObject_DelAttr(obj, name).
2023-07-11 11:38:22 +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
Eric Snow a840806d33
gh-105227: Add PyType_GetDict() (GH-105747)
This compensates for static builtin types having `tp_dict` set to `NULL`.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2023-07-10 18:41:02 +02:00
Riahiamirreza 43389e4a3a
Fix typo in datamodel.rst (#106587) 2023-07-10 17:22:41 +05:30
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
Ned Batchelder dac1e36490
Clarify how topics.py gets created. (#106121)
When changing docs, it was easy to find text in topics.py, and I
wondered whether I was supposed to edit it.  Thankfully, the top of the
file says it's auto-generated, so I knew I didn't have to edit it. But I
didn't know what started the auto-generation process.

It's part of the release process, so I'll leave a note here for future
editors.
2023-07-09 20:41:31 -07:00
Victor Stinner 970982e03d
gh-105733: Fix ctypes What's New entry (#106576) 2023-07-10 04:05:38 +02:00
Alex Waygood ca8b55c7f5
gh-106461: typing: Consolidate docs on `Callable` (#106462) 2023-07-09 21:46:15 +01:00
Victor Stinner ee46cb6aa9
gh-105927: PyWeakref_GetRef() returns 1 on success (#106561)
PyWeakref_GetRef() now returns 1 on success, and return 0 if the
reference is dead.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-07-09 15:50:26 +00:00
Victor Stinner 1e12c8cfa3
gh-105373: Doc lists pending removals (#106540) 2023-07-09 17:26:26 +02: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 ffe70c4d1c
gh-105373: Remove C API global config vars in Python 3.14 (#106538)
Schedule the removal of C API global configuration variables in
Python 3.14. Announce the removal to help C extension maintainers to
upgrade their code.
2023-07-08 01:49:20 +02:00
Victor Stinner 1b2938122d
gh-105373: Doc lists pending C API removals (#106537) 2023-07-08 00:50:51 +02: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
Carl Meyer 13aefd175e
gh-105256: What's New note for comprehension over locals() (#106378) 2023-07-05 18:12:21 -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
Jelle Zijlstra ad075682ba
tp_flags docs: fix indentation (#106420) 2023-07-05 05:08:25 +00: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
Ned Batchelder 987b712b4a
Replace the esoteric term 'datum' when describing dict comprehensions (#106119) 2023-07-02 20:22:40 -07:00