Commit Graph

27974 Commits

Author SHA1 Message Date
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
Nikita Sobolev 4821f08674
gh-101100: Fix sphinx warnings in `c-api/gcsupport.rst` (#114786) 2024-02-10 15:59:23 -07:00
Mike Zimin 9d1a353230
gh-114894: add array.array.clear() method (#114919)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-02-10 07:59:46 -08:00
Nikita Sobolev e19103a346
gh-114552: Update `__dir__` method docs: it allows returning an iterable (#114662) 2024-02-10 08:34:23 +00:00
Laurie O b2d9d134dc
gh-96471: Add shutdown() method to queue.Queue (#104750)
Co-authored-by: Duprat <yduprat@gmail.com>
2024-02-09 20:58:30 -08:00
Erlend E. Aasland 769d444826
Docs: correctly link to code objects (#115214) 2024-02-09 15:11:36 +01:00
Brett Cannon c968dc7ff3
GH-113632: update configure.ac for WebAssembly support tiers (#115192)
Move WASI to tier 2 and drop Emscripten.
2024-02-09 09:21:49 +01:00
Nikita Sobolev 553c90ccc2
gh-101100: Fix sphinx warnings in `library/enum.rst` (#114696)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-02-08 23:40:28 -07:00
Shantanu 17689e3c41
gh-107944: Improve error message for getargs with bad keyword arguments (#114792) 2024-02-08 01:04:41 -08:00
Mark Shannon 8a3c499ffe
GH-108362: Revert "GH-108362: Incremental GC implementation (GH-108038)" (#115132)
Revert "GH-108362: Incremental GC implementation (GH-108038)"

This reverts commit 36518e69d7.
2024-02-07 12:38:34 +00:00
Skip Montanaro d0322fdf2c
gh-101100: Fix Py_DEBUG dangling Sphinx references (#115003) 2024-02-07 10:48:42 +00:00
Edgar Ramírez Mondragón 60375a3809
gh-115114: Add missing slash to file URI prefix `file:/` (#115115)
Add missing slash to file URI prefix `file:/`
2024-02-07 05:22:47 +00:00
Finite State Machine 3f71c416c0
gh-115106 docs: 'enum.Flag.__iter__()' did not exist prior to Python 3.11 (GH-115107)
change versionchanged to versionadded
2024-02-06 17:28:01 -08:00
Sam Gross de61d4bd4d
gh-112066: Add `PyDict_SetDefaultRef` function. (#112123)
The `PyDict_SetDefaultRef` function is similar to `PyDict_SetDefault`,
but returns a strong reference through the optional `**result` pointer
instead of a borrowed reference.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-02-06 11:36:23 -05:00