Commit Graph

26538 Commits

Author SHA1 Message Date
Barney Gale 6716254e71
GH-101362: Optimise PurePath(PurePath(...)) (GH-101667)
The previous `_parse_args()` method pulled the `_parts` out of any supplied `PurePath` objects; these were subsequently joined in `_from_parts()` using `os.path.join()`. This is actually a slower form of joining than calling `fspath()` on the path object, because it doesn't take advantage of the fact that the contents of `_parts` is normalized!

This reduces the time taken to run `PurePath("foo", "bar")` by ~20%, and the time taken to run `PurePath(p, "cheese")`, where `p = PurePath("/foo", "bar", "baz")`, by ~40%.

Automerge-Triggered-By: GH:AlexWaygood
2023-03-05 15:50:21 -08:00
Sergey B Kirpichev 5da379ca7d
Move around example in to_bytes() to avoid confusion (#101595)
Moves an example to be closer to the sentence that refers to it.
2023-03-05 09:31:56 +00:00
Matthias Görgens eff9f43924
gh-96821: Add config option `--with-strict-overflow` (#96823)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Shantanu <hauntsaninja@gmail.com>
2023-03-04 13:39:52 -08:00
Wagner Alberto cb944d0be8
Add import of `unittest.mock.Mock` in documentation (#102346) 2023-03-03 22:55:31 +05:30
Nikita Sobolev 7b9132057d
gh-102383: [docs] Arguments of `PyObject_CopyData` are `PyObject *` (#102390) 2023-03-03 22:46:50 +05:30
Owain Davies 4e7c0cbf59
gh-101754: Document that Windows converts keys in `os.environ` to uppercase (GH-101840) 2023-03-03 10:51:32 +00:00
Michael K 73250000ac
Fix typos in documentation and comments (GH-102374)
Found some duplicate `to`s in the documentation and some code comments and fixed them.


[Misc/NEWS.d/3.12.0a1.rst](ed55c69ebd/Misc/NEWS.d/3.12.0a1.rst) also contains two duplicate `to`s, but I wasn't sure if it's ok to touch that file.  Looks auto generated.  I'm happy to amend the PR if requested. :)

Automerge-Triggered-By: GH:AlexWaygood
2023-03-02 07:26:49 -08:00
Stefan Pochmann eaae563b68
gh-102088 Optimize iter_index itertools recipe (GH-102360) 2023-03-01 21:16:23 -06:00
Hyunkyun Moon 2f62a5da94
gh-95672 skip fcntl when pipesize is smaller than pagesize (gh-102163) 2023-03-01 23:56:19 +09:00
Inada Naoki 7d1d663418
Doc: Fix minor error in ePub (GH-100614)
Fix issue reported https://mail.python.org/archives/list/docs@python.org/message/KE7OIAO53P4XRC4ZOWPDHA63ZQJCHEC3/
2023-03-01 09:48:15 +09:00
Furkan Onder 85b1fc1fc5
GH-90744: Fix erroneous doc links in the sys module (#101319)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-02-28 13:43:00 +02:00
Petr Viktorin 6b2d7c0ddb
gh-101101: Unstable C API tier (PEP 689) (GH-101102) 2023-02-28 09:31:01 +01:00
Steven Troxler 0f89acf6cc
gh-101561: Add typing.override decorator (#101564)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-02-27 13:16:11 -08:00
Sergey B Kirpichev 4624987b29
gh-101825: Clarify that as_integer_ratio() output is always normalized (#101843)
Make docstrings for `as_integer_ratio` consistent across types, and document that
the returned pair is always normalized (coprime integers, with positive denominator).

---------

Co-authored-by: Owain Davies <116417456+OTheDev@users.noreply.github.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2023-02-27 19:11:28 +00:00
Gouvernathor 0db6f44259
gh-102296 Document that inspect.Parameter kinds support ordering (GH-102297)
Automerge-Triggered-By: GH:AlexWaygood
2023-02-27 07:13:18 -08:00
Nikita Sobolev 101a12c576
gh-101100: Fix sphinx warnings in `types` module (#102274)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-02-27 07:26:21 +00:00
Rotzbua f3cb15c88a
gh-91038: Change default argument value to `False` instead of `0` (#31621)
The argument is used as a switch and corresponds to a boolean logic. Therefore it is more intuitive to use the corresponding constant `False` as default value instead of the integer `0`.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-02-26 18:10:34 -08:00
VMan 6daf42b28e
[doc] Improve grammar/fix missing word (GH-102060) 2023-02-26 18:45:27 +05:30
Skip Montanaro bcadcde712
gh-102259: Fix re doc issue regarding right square brackets (#102264)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-02-25 21:22:16 -05:00
Nikita Sobolev a498de4c0e
gh-101100: Fix sphinx warnings in `typing` module docs (#102260) 2023-02-25 21:48:00 +00:00
Jelle Zijlstra 207e1c5cae
asyncio docs: Fix dangling hyphen (#102227)
Currently this gets rendered with a dangling hyphen.
2023-02-25 05:21:32 -08:00
Hugo van Kemenade b7c1126447
gh-101100: Fix Sphinx warnings in `decimal` module (#102125)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-02-25 11:42:45 +02:00
Stefan Pochmann 81bf10e4f2
gh-102105 Fix wording in filterfalse/quantify/filter (GH-102189) 2023-02-24 10:13:05 -06:00
Yeojin Kim 347f7406df
gh-81652: Add MAP_ALIGNED_SUPER FreeBSD and MAP_CONCEAL OpenBSD constants (gh-102191) 2023-02-24 19:26:51 +09:00
Tanner Firl 9bba8035bd
Fix typo in `Py_GetPythonHome` signature (#102168) 2023-02-23 18:58:33 +05:30
Erlend E. Aasland 5b9573eed4
gh-101578: Fixup NEWS and add What's New entry for new exception APIs (#102157) 2023-02-23 13:19:21 +01:00
Carl Meyer 056dfc71dc
gh-87634: remove locking from functools.cached_property (GH-101890)
Remove the undocumented locking capabilities of functools.cached_property.
2023-02-22 17:49:22 -08:00
Terry Jan Reedy 8f647477f0
Fix syntax error in struct doc example (#102160)
Missing closing ) reported on Discuss by Chukwudi Nwachukwu.
2023-02-22 18:55:03 -05:00
Owain Davies 96bf24380e
GH-101777: `queue.rst`: use 2 spaces after a period to be consistent. (#102143) 2023-02-22 14:21:38 -06:00
somebody 8d46c7ed5e
gh-102135: Update turtle docs to rename wikipedia demo to rosette (#102137) 2023-02-22 12:11:30 +02:00
ram vikram singh b40dd71241
gh-100556: Improve clarity of `or` docs (#100589)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-02-21 11:34:56 +01:00
Owain Davies 350ba7c07f
gh-101777: Make `PriorityQueue` docs slightly clearer (#102026)
Adjust wording slightly, and use min(entries) instead of
sorted(list(entries))[0] as an example.
2023-02-21 11:24:33 +01:00
Erlend E. Aasland 02d9f1504b
gh-101578: Amend exception docs (#102057)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-02-21 09:15:49 +01:00
Irit Katriel 4d3bc89a3f
gh-102011: use sys.exception() instead of sys.exc_info() in docs where possible (#102012) 2023-02-20 21:54:19 +00:00
Filipe Laíns 84181c1404
GH-99818: improve the documentation for zipfile.Path and Traversable (GH-101589)
Automerge-Triggered-By: GH:FFY00
2023-02-20 11:21:10 -08:00
Erlend E. Aasland 60bbed7f17
gh-101578: Amend PyErr_{Set,Get}RaisedException docs (#101962)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-02-19 21:22:29 +01:00
Raymond Hettinger 3b264df470
Misc improvements to the float tutorial (GH-102052) 2023-02-19 13:21:37 -06:00
Mark Dickinson b513c46d99
gh-85417: Clarify behaviour on branch cuts in cmath module (#102046)
This PR updates the cmath module documentation to reflect the reality that Python is almost always (and as far as I can tell, that "almost" can be omitted) running on a machine whose C double supports signed zeros.

* Removes misleading references to functions being continuous from above / below / the left / the right at branch cuts
* Expands the note on branch cuts at the top of the module documentation to explain the double-sided sign-of-zero-based behaviour
2023-02-19 19:15:44 +00:00
neuralstring 32df540635
gh-100425: Update tutorial docs related to sum() accuracy (FH-101854) 2023-02-19 10:39:03 -06:00
Patricio Paez 6aab56f3c2
gh-99735: Use required=True in argparse subparsers example (#100927) 2023-02-18 17:06:03 -08:00
Reza Rastak 36b670908b
Fix incorrectly documented attribute in csv docs (#101250) 2023-02-18 16:55:43 -08:00
Furkan Onder 61f1e67c6f
GH-84783: Make the slice object hashable (GH-101264) 2023-02-18 18:22:02 -06:00
Nikita Sobolev af446bbb76
gh-101536: [docs] Improve attributes of `urllib.error.HTTPError` (#101612)
* gh-101536: [docs] Improve attributes of `urllib.error.HTTPError`

* Address review
2023-02-18 12:46:33 -03:00
Owain Davies 7f1c721756
gh-101739: [Enum] update docs - default boundary for Flag is CONFORM (GH-101746) 2023-02-17 13:36:47 -08:00
Jan Gosmann 77d95c8373
gh-100226: Clarify StreamReader.read behavior (#101807) 2023-02-17 13:01:26 -08:00
Dustin Rodrigues a1723caabf
gh-101992: update plistlib examples to be runnable (#101994)
* gh-101992: update plistlib examples to be runnable

* Update Doc/library/plistlib.rst

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-02-17 14:30:29 -05:00
Yeojin Kim 3c0a31cbfd
Docs: fix typos in PyFunction_WatchCallback docs and in 3.12 NEWS (GH-101980)
- possitibility => possibility
- disaallowed => disallowed
2023-02-17 00:47:02 -08:00
Oleg Iarygin a3bb7fbe7e
gh-101973: Fix parameter reference for PyModule_FromDefAndSpec (#101976) 2023-02-17 09:43:07 +01:00
sblondon 924a3bfa28
gh-93573: Replace wrong example domains in configparser doc (GH-93574)
* Replace bitbucket.org domain by forge.example
* Update example to python.org
* Use explicitly invalid domain

topsecret.server.com domain is not controled by PSF. It's replaced by invalid topsecret.server.example domain. It follows RFC 2606, which advise .example as TLD for documentation.
2023-02-16 16:13:21 +01:00
Rayyan Ansari 739c026f44
gh-101881: Support (non-)blocking read/write functions on Windows pipes (GH-101882)
* fileutils: handle non-blocking pipe IO on Windows

Handle erroring operations on non-blocking pipes by reading the _doserrno code.
Limit writes on non-blocking pipes that are too large.

* Support blocking functions on Windows

Use the GetNamedPipeHandleState and SetNamedPipeHandleState Win32 API functions to add support for os.get_blocking and os.set_blocking.
2023-02-16 14:52:24 +00:00
Erlend E. Aasland c1ce0d178f
gh-99138: Isolate _zoneinfo (#99218)
* Convert zone info type to heap type and add it to module state
* Add global variables to module state
2023-02-15 22:58:48 +01:00
Erlend E. Aasland 8a2b7ee64d
gh-101693: In sqlite3, deprecate using named placeholders with parameters supplied as a sequence (#101698) 2023-02-15 06:27:16 +01:00
Irit Katriel 81e3aa835c
gh-101799: implement PREP_RERAISE_STAR as an intrinsic function (#101800) 2023-02-14 11:54:13 +00:00
Furkan Onder 3690688149
GH-101898: Fix missing term references for hashable definition (#101899)
Fix missing term references for hashable definition
2023-02-14 14:20:11 +04:00
Steve Kowalik a1f08f5f19
Correct trivial grammar in reset_mock docs (#101861) 2023-02-13 11:11:43 +02:00
Jean Abou-Samra 6ef6915d35
gh-101845: pyspecific: Fix i18n for availability directive (GH-101846)
pyspecific: Fix i18n for availability directive

If the directive has content, the previous code would nest paragraph
nodes from that content inside a general paragraph node, which confuses
Sphinx and leads it to drop the content when translating. Instead, use a
container node for the body.

Also use set_source_info so that any warnings have location info.
2023-02-12 15:20:11 +01:00
busywhitespace 17143e2c30
gh-101390: Fix docs for `imporlib.util.LazyLoader.factory` to properly call it a class method (GH-101391) 2023-02-10 15:29:24 -08:00
Hugo van Kemenade 61f2be0866
Docs: Fix getstatus() -> getcode() typos (#101296) 2023-02-10 20:46:12 +02:00
Erlend E. Aasland 2037ebf81b
Docs: use parameter list for sqlite3.Cursor.execute* (#101782)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-02-10 18:54:04 +01:00
Oleg Iarygin 6d92373f50
gh-101283: Fix 'versionchanged' for the shell=True fallback on Windows in 3.12 (GH-101728) 2023-02-09 17:36:24 +00:00
Mark Shannon ecfd2d37c5
GH-99293: Document that `Py_TPFLAGS_VALID_VERSION_TAG` shouldn't be used. (#GH-101736)
Document that Py_TPFLAGS_VALID_VERSION_TAG shouldn't be used.
2023-02-09 14:05:53 +01:00
Soumendra Ganguly 244d4cd9d2
gh-85984: Remove legacy Lib/pty.py code. (#92365)
Refactored the implementation of pty.fork to use os.login_tty.

A DeprecationWarning is now raised by pty.master_open() and pty.slave_open(). They were
undocumented and deprecated long long ago in the docstring in favor of pty.openpty.

Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-02-08 17:00:17 -08:00
Steve Dower 0e0c5d8baa
gh-101283: Version was just released, so should be changed in 3.11.3 (GH-101719) 2023-02-08 23:52:03 +00:00
Oleg Iarygin 23751ed826
gh-101283: Improved fallback logic for subprocess with shell=True on Windows (GH-101286) 2023-02-08 22:12:19 +00:00
Mark Shannon feec49c407
GH-101578: Normalize the current exception (GH-101607)
* Make sure that the current exception is always normalized.

* Remove redundant type and traceback fields for the current exception.

* Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException

* Add new API functions: PyException_GetArgs, PyException_SetArgs
2023-02-08 09:31:12 +00:00
Stanley 027adf42cd
gh-47937: Note that Popen attributes are read-only (#93070)
* Note that Popen attributes aren't meant to be set by users by rewording the text about the attributes.
* Also update some universal_newlines references to mention the modern text parameter name while in the area.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-02-08 00:12:46 -08:00
penguin_wwy 753fc8a5d6
gh-101632: Add the new RETURN_CONST opcode (#101633) 2023-02-07 22:32:21 +00:00
Oleg Iarygin f87f6e2396
gh-97725: Fix documentation for the default file of `asyncio.Task.print_stack` (#101652) 2023-02-07 23:34:31 +05:30
Oleg Iarygin a687ae9eb5
Fix nesting of 'Pending Removal in Python 3.14' (#101637) 2023-02-07 16:54:47 +02:00
Hugo van Kemenade a757d72127
Doctest: Pin sphinxext-opengraph==0.7.5 to prevent importing NumPy (#101642) 2023-02-07 14:59:26 +01:00
Brian Skinn c4de6b1d52
gh-85747: Active voice & suggested edits, 'running/stopping loop' & 'callbacks' subsections of asyncio-eventloop.rst (#100270)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-02-06 21:25:42 -08:00
Mariatta Wijaya 949c58f945
GH-101616: Mention the Docs Discourse forum in the "reporting docs issues" (GH-101617)
Fixes https://github.com/python/cpython/issues/101616
2023-02-06 13:59:45 -08:00
mrh1997 f7e9fbacb2
bpo-33591: Add support for path like objects to `ctypes.CDLL` (#7032)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-02-05 23:06:57 +05:30
Eric Wieser 90d85a9b41
gh-76961: Fix the PEP3118 format string for ctypes.Structure (#5561)
The summary of this diff is that it:

* adds a `_ctypes_alloc_format_padding` function to append strings like `37x` to a format string to indicate 37 padding bytes
* removes the branches that amount to "give up on producing a valid format string if the struct is packed"
* combines the resulting adjacent `if (isStruct) {`s now that neither is `if (isStruct && !isPacked) {`
* invokes `_ctypes_alloc_format_padding` to add padding between structure fields, and after the last structure field. The computation used for the total size is unchanged from ctypes already used.

This patch does not affect any existing aligment computation; all it does is use subtraction to deduce the amount of paddnig introduced by the existing code.

---

Without this fix, it would never include padding bytes - an assumption that was only
valid in the case when `_pack_` was set - and this case was explicitly not implemented.

This should allow conversion from ctypes structs to numpy structs

Fixes https://github.com/numpy/numpy/issues/10528
2023-02-05 17:10:53 +00:00
Mark Dickinson 0672a6c23b
Revert "gh-89381: Fix invalid signatures of math/cmath.log (#101404)" (#101580)
This reverts commit 0ef92d9793.
2023-02-05 16:36:33 +00:00
busywhitespace 9b60ee976a
gh-101221: Add options in the documentation of timeit command (#101222) 2023-02-05 15:25:36 +05:30
alnoki 6e4a521c2a
Add missing preposition in argparse docs (#101548) 2023-02-05 15:15:07 +05:30
Furkan Onder cef9de62b8
GH-56426: Add cross-reference to the documentation for faulthandler, traceback, and pdb. (#101157)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-02-04 09:19:29 +05:30
Max Bachmann f11a3d1ebe
Add missing `versionadded` directive for `PyCode_Addr2Location` (#101347) 2023-02-04 09:03:28 +05:30
Gregory P. Smith d4c410f0f9
gh-84559: Remove the new multiprocessing warning, too disruptive. (#101551)
This reverts the core of #100618 while leaving relevant documentation
improvements and minor refactorings in place.
2023-02-03 15:20:46 -08:00
François Magimel 45d014e03b
docs: replace PyPI description with link (#101506) 2023-02-03 12:53:11 +05:30
Viet Than 5c39daf50b
gh-100920: Update documentation for `asyncio.StreamWriter.wait_closed` (#101514) 2023-02-03 12:48:39 +05:30
C.A.M. Gerlach 1b6045668d
gh-100925: Move array methods under class in array doc (#101485)
* Move array methods under class in array doc

* Fix a few internal references related to the touched lines
2023-02-03 08:03:27 +08:00
Gregory P. Smith 0ca67e6313
GH-84559: Deprecate fork being the multiprocessing default. (#100618)
This starts the process. Users who don't specify their own start method
and use the default on platforms where it is 'fork' will see a
DeprecationWarning upon multiprocessing.Pool() construction or upon
multiprocessing.Process.start() or concurrent.futures.ProcessPool use.

See the related issue and documentation within this change for details.
2023-02-02 15:50:35 -08:00
Peter Gessler 24cbc7a2a0
docs: Fix enum reassign `str` documentation (GH-101507) 2023-02-02 12:12:57 -08:00
Marcos Pereira ee21110086
Docs: improve accuracy of sqlite3 `check_same_thread` parameter (#101351)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-02-02 00:52:29 +01:00
Steve Dower eda60916bc
gh-101467: Correct py.exe handling of prefix matches and cases when only one runtime is installed (GH-101468) 2023-02-01 21:06:56 +00:00
Raj 95fb0e0258
gh-101498 : Fix asyncio.Timeout example in docs (#101499)
Doc/library/asyncio-task.rst#timeout
2023-02-01 10:08:31 -08:00
Irit Katriel 62251c3da0
gh-101454: fix documentation for END_ASYNC_FOR (#101455) 2023-02-01 12:49:59 +00:00
beavailable cc407b9de6
gh-101317: Add `ssl_shutdown_timeout` parameter for `asyncio.StreamWriter.start_tls` (#101335)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-02-01 16:33:59 +05:30
John Belmonte 75227fba1d
datetime.rst: fix combine() signature (#101490)
The default `tzinfo` param of the `combine()` signature pseudocode was erroneously `self.tzinfo`.

`self` has no meaning in the context of a classmethod, and the datetime class itself has no `tzinfo` attribute.  The correct default pseudocode is `time.tzinfo`, reflecting that the default is the `tzinfo` attribute of the `time` parameter.
2023-02-01 14:01:28 +04:00
Peter Jiping Xie 20c11f2e60
gh-101440: fix json snippet error in logging-cookbook.rst (#101439) 2023-01-31 17:30:38 +02:00
Raj df0068ce48
gh-99276 - Updated Doc/faq/general.rst (#101396)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-01-31 17:16:17 +02:00
Christophe Nanteuil 1a62ae84c6
Add JOBS parameter to docs Makefile (#101395) 2023-01-31 15:29:29 +02:00
Shantanu 909a674693
gh-77607: Improve accuracy of os.path.join docs (#101406)
This is a follow-up to #100811.

One of the changes in that PR isn't accurate in that
`os.path.join('', '')` will not end in a separator.

This reverts that change to the previous wording that used "only", but
explicitly calls out the case where the last part ends in a separator,
which is what caused confusin in #77607 and motivated the change
in #100811.
2023-01-30 21:39:30 -08:00
Ben ef09bf63d2
Fixes typo in asyncio.TaskGroup context manager code example (#101449) 2023-01-30 21:36:40 -08:00
Owain Davies ea232716d3
gh-101422: (docs) TarFile default errorlevel argument is 1, not 0 (GH-101424) 2023-01-30 09:56:33 -08:00
Sergey B Kirpichev 0ef92d9793
gh-89381: Fix invalid signatures of math/cmath.log (#101404) 2023-01-29 11:50:10 -08:00
socal-nerdtastic 666c0840dc
Fix trivial typo in shebang example (GH-101385)
The example was showing the current version, but should be pinned to 3.7 to match the example command.
2023-01-28 15:18:04 +02:00
Peter Jiping Xie db757f0e44
gh-101386: fix typos found by codespell (#101387) 2023-01-28 11:57:40 +02:00
Gregory P. Smith 052f53d65d
gh-39615: Add warnings.warn() skip_file_prefixes support (#100840)
`warnings.warn()` gains the ability to skip stack frames based on code
filename prefix rather than only a numeric `stacklevel=` via a new
`skip_file_prefixes=` keyword argument.
2023-01-27 18:35:14 -08:00
Vinay Sajip b5c4d6064c
[doc] Add a section on logging handler configuration order. (GH-101380) 2023-01-27 19:01:30 +00:00
Vinay Sajip d083df39fa
[doc] Add some notices to logging configuration documentation. (GH-101373) 2023-01-27 14:50:09 +00:00
Barney Gale e5b08ddddf
gh-101000: Add os.path.splitroot() (#101002)
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-01-27 00:28:27 +00:00
John Belmonte f5ad63f79a
datetime.rst: improve combine() docs (#101338)
The explanation on handling of datetime as the date arg was confusingly mixed with an unrelated
item, and lacked proper arg name formatting.
2023-01-26 11:25:43 +04:00
achhina 952a1d9cc9
GH-88597: Rename uuid's new CLI args to be in line with uuidgen. (#101248)
this way they match an existing uuidgen command line tool.
2023-01-25 09:39:42 -08:00
Mark Shannon f02fa64bf2
GH-100762: Don't call `gen.throw()` in `gen.close()`, unless necessary. (GH-101013)
* Store exception stack depth in YIELD_VALUE's oparg and use it avoid expensive gen.throw() in gen.close() where possible.
2023-01-24 17:25:37 +00:00
ram vikram singh 7f95ec3e74
gh-101152: Implement PEP 699 (GH-101193)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ken Jin <kenjin@python.org>
2023-01-24 17:29:22 +08:00
Gregory P. Smith e244401ce5
[docs] Mention how to get/set a bigint PyLong via the C API (#101270)
We don't need direct C APIs to get at a bigint representation of PyLong but we
do want the few people who need to understand how.

Additional Author:  CAM-Gerlach
2023-01-23 21:20:53 -08:00
Carlton Gibson 5d868efde9
Added asyncio REPL example to docs. (#101243)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-23 17:01:13 +05:30
Jacob Walls d717be04dc
gh-83122: Deprecate testing element truth values in `ElementTree` (#31149)
When testing element truth values, emit a DeprecationWarning in all implementations.

This had emitted a FutureWarning in the rarely used python-only implementation since ~2.7 and has always been documented as a behavior not to rely on.

Matching an element in a tree search but having it test False can be unexpected. Raising the warning enables making the choice to finally raise an exception for this ambiguous behavior in the future.
2023-01-22 17:16:48 -08:00
Andrew Hong 8bcd4a6ec7
GH-101097: Switch from standard interval notation to greater or less than signs for random.random()'s documentation (#101119) 2023-01-22 14:58:36 -06:00
Mark Dickinson 3e09f3152e
gh-67790: Support float-style formatting for Fraction instances (#100161)
This PR adds support for float-style formatting for `Fraction` objects: it supports the `"e"`, `"E"`, `"f"`, `"F"`, `"g"`, `"G"` and `"%"` presentation types, and all the various bells and whistles of the formatting mini-language for those presentation types. The behaviour almost exactly matches that of `float`, but the implementation works with the exact `Fraction` value and does not do an intermediate conversion to `float`, and so avoids loss of precision or issues with numbers that are outside the dynamic range of the `float` type.

Note that the `"n"` presentation type is _not_ supported. That support could be added later if people have a need for it.

There's one corner-case where the behaviour differs from that of float: for the `float` type, if explicit alignment is specified with a fill character of `'0'` and alignment type `'='`, then thousands separators (if specified) are inserted into the padding string:

```python
>>> format(3.14, '0=11,.2f')
'0,000,003.14'
```

The exact same effect can be achieved by using the `'0'` flag:

```python
>>> format(3.14, '011,.2f')
'0,000,003.14'
```

For `Fraction`, only the `'0'` flag has the above behaviour with respect to thousands separators: there's no special-casing of the particular `'0='` fill-character/alignment combination. Instead, we treat the fill character `'0'` just like any other:

```python
>>> format(Fraction('3.14'), '0=11,.2f')
'00000003.14'
>>> format(Fraction('3.14'), '011,.2f')
'0,000,003.14'
```

The `Fraction` formatter is also stricter about combining these two things: it's not permitted to use both the `'0'` flag _and_ explicit alignment, on the basis that we should refuse the temptation to guess in the face of ambiguity. `float` is less picky:

```python
>>> format(3.14, '0<011,.2f')
'3.140000000'
>>> format(Fraction('3.14'), '0<011,.2f')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mdickinson/Repositories/python/cpython/Lib/fractions.py", line 414, in __format__
    raise ValueError(
ValueError: Invalid format specifier '0<011,.2f' for object of type 'Fraction'; can't use explicit alignment when zero-padding
```
2023-01-22 18:44:49 +00:00
achhina 95f5b05a8c
GH-88597: Added command line interface to UUID module. (#99463)
The `uuid` module now supports command line usage.

```python
❯ ./python.exe -m uuid             
5f2d57b1-90e8-417c-ba5d-69b9b6f74289

❯ ./python.exe -m uuid -h          
usage: uuid.py [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-ns NAMESPACE] [-n NAME]
...
```
2023-01-21 22:59:31 -08:00
Kamil Turek b4e11a7985
gh-99266: ctypes: Preserve more detailed exception in `ArgumentError`
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-21 19:14:43 +05:30
scrazzz 120cb18c72
Fix rst formatting in 3.12 What's New (#101110) 2023-01-21 14:23:54 +05:30
Barney Gale 01093b8203
gh-86610: Use attribute directive in docs for pathlib.PurePath (#101114) 2023-01-20 23:13:58 +01:00
Jürgen Gmach 9a155138c5
GH-101111: Disambigaute origin of const for store_const and append_const (#101121)
While the documentation for `optparse` mentioned that both `store_const` and
`append_const` store a constant value, it was not clear where this value was
coming from.

A link to `Option.const` makes this explicit.
2023-01-20 23:13:07 +01:00
Jürgen Gmach 61f338a005
GH-101112: Specify type of pattern for Path.rglob (#101132)
The documentation for `rglob` did not mention what `pattern` actually
is.

Mentioning and linking to `fnmatch` makes this explicit, as the
documentation for `fnmatch` both shows the syntax and some explanation.
2023-01-20 23:11:31 +01:00
caozhanhao f1d0711dd3
Fix a typo in whatsnew/3.12.rst (#101150) 2023-01-20 23:10:08 +01:00
Simon Robinson 73497690b5
Fix minor typos in SSL documentation (#101158) 2023-01-20 23:08:45 +01:00
Shantanu 783d1bc51b
gh-91485: Avoid unnecessary use of non-Python syntax in io docs (#101177) 2023-01-20 23:06:10 +01:00
Vladimir Malinovskii 8cdbc46090
Provided better example for logging cookbook (GH-101164)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2023-01-20 08:54:48 +00:00
richardhob 3fa8fe7177
gh-88324: Clarify documentation for redirected stdout/stderr when using subprocess in Linux (#94035)
* Update description of stdout, stderr, and stdin.

Changes:
- Move the ``None`` option (which is default) to the front of the list
  of input options
- Move the ``None`` option description up to make the default behavior
  more clear (No redirection)
- Remove mention of Child File Descriptors from ``None`` option description
2023-01-19 23:56:13 -08:00
Gregory P. Smith 5927013e47
gh-101144: Allow open and read_text encoding to be positional. (#101145)
The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only.

Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time.
2023-01-19 23:04:30 -08:00
Nikita Sobolev 9e025d305f
gh-101100: [Enum] Fix sphinx warnings in docs (GH-101122)
* gh-101100: [Enum] Fix sphinx warnings in 

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-01-19 18:16:21 -08:00
Tushar Sadhwani d65f485070
fix typo in 3.12 What's New (#101105) 2023-01-18 21:54:56 +05:30
Erlend E. Aasland b84be8d9c0
Docs: improve sqlite3 placeholders example (#101092) 2023-01-18 10:36:17 +01:00
Viicos c5660ae96f
Fix typo in `ReprEnum` documentation (#101079) 2023-01-17 16:21:56 +05:30
Steve Dower 30753c37c6
gh-100247: Improve documentation for custom shebang commands in py.exe launcher (GH-101083) 2023-01-16 17:01:04 +00:00
Mark Shannon 7b14c2ef19
GH-100982: Add `COMPARE_AND_BRANCH` instruction (GH-100983) 2023-01-16 12:35:21 +00:00
scrazzz b82049993f
Docs: Remove duplicate `TraversableResources` reference (#101068) 2023-01-16 16:14:50 +05:30
Oleg Iarygin 8e9d08b062
gh-101041: Fix a misspelled name of `utctimetuple` in a doc warning (GH-101042) 2023-01-15 12:36:31 -08:00
Cristián Maureira-Fredes 5e9df888dd
Fix `ctypes` typo in `set_exception` (#101040) 2023-01-15 20:42:37 +05:30
Erlend E. Aasland 206f05a46b
gh-100668: Clarify how sqlite3 maps parameters onto placeholders (#100960)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-01-14 23:58:06 +01:00
Bob Kline 49cae39ef0
gh-101021: Document binary parameters as bytes (#101024) 2023-01-14 11:01:27 -08:00
JustAnotherArchivist ef633e5000
Sync-up parameter name in equivalent code snippet of `enumerate` (GH-101029) 2023-01-13 23:55:35 -06:00
Raymond Hettinger 6bde3d2fd3
Add recipes to showcase tee(), zip*, batched, starmap, and product. (GH-101023) 2023-01-13 19:01:22 -06:00
Raymond Hettinger 010576c6ea
Fix typo in docs (GH-101025) 2023-01-13 18:53:06 -06:00
Serhiy Storchaka e5bd5ad70d
gh-100160: Restore and deprecate implicit creation of an event loop (GH-100410)
Partially revert changes made in GH-93453.

asyncio.DefaultEventLoopPolicy.get_event_loop() now emits a
DeprecationWarning and creates and sets a new event loop instead of
raising a RuntimeError if there is no current event loop set.

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2023-01-13 14:40:29 +02:00
Steve Dower 468c3bf798
gh-100247: Fix py.exe launcher not using entire shebang command for finding custom commands (GH-100944) 2023-01-13 11:49:01 +00:00
Steve Dower b5d4347950
gh-86682: Adds sys._getframemodulename as an alternative to using _getframe (GH-99520)
Also updates calls in collections, doctest, enum, and typing modules to use _getframemodulename first when available.
2023-01-13 11:31:06 +00:00
Matthieu Dartiailh eecd422d1b
gh-96461: Improve docs for bytecode instructions (GH-96462)
* Clarify the meaning of the oparg for CACHE and COPY opcode in dis doc

* Use STACK to describe stack operation in analogy with a Python list

* Remove (delta) from BEFORE_WITH since BEFORE_WITH does not take an argument

* Fix the description of the stack impact of multiple opcodes
2023-01-12 18:23:50 +00:00
Noam Cohen 2161bbf243
Fix typo in `enum` module documentation (#100992) 2023-01-12 21:10:29 +05:30
ram vikram singh d9dff4c8b5
GH-100894: Updated the doc for `sys.winver` to clarify its usual contents (GH-100913) 2023-01-12 00:11:12 +00:00
Mariusz Felisiak 847d7708ba
gh-98763: Prefer "python" over "python3" for command line examples in docs. (#98761) 2023-01-11 15:35:41 +05:30
Yao-Ching Huang b2f7b2ef0b
gh-100916: Convert argument to appropriate type (GH-100917) 2023-01-10 10:17:57 +00:00
Semen Zhydenko 35650f2538
Fix typos in Doc folder (#100880) 2023-01-10 11:04:06 +02:00
Ryan Ozawa e098137cd3
bpo-28356: Document os.rename() behavior on Windows for differing volumes (GH-27376) 2023-01-09 21:43:09 +00:00
dsentinel 7a50d6b5b0
GH-100813: Add `socket.IP_PKTINFO` constant (#10294) 2023-01-09 14:30:40 +05:30
Nikita Sobolev bc0a686f82
gh-87447: Fix walrus comprehension rebind checking (#100581)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-01-08 15:51:29 -07:00
Raymond Hettinger b139bcd892
GH-100485: Tweaks to sumprod() (GH-100857) 2023-01-08 13:38:24 -06:00
Benjamin Peterson 11f99323c2
Update copyright years to 2023. (gh-100848) 2023-01-08 09:13:25 -06:00
Shantanu 53455a319f
gh-100783: fix os.path.join documentation (#100811)
- Use "drive", not "drive letter", because of UNC paths
- Previous components are not thrown away from relative drive letters
- Use "segment" instead of "component" for consistency with pathlib
- Other miscellaneous improvements
2023-01-08 00:51:30 -08:00
busywhitespace 6d3bc4a795
gh-100824: Fix typo in the documentation of unittest.TestLoader.testNamePatterns (#100825) 2023-01-08 13:37:16 +05:30
Raymond Hettinger 47b9f83a83
GH-100485: Add math.sumprod() (GH-100677) 2023-01-07 12:46:35 -06:00
FrozenBob deaf090699
gh-100673: Removed erroneous note in the get_type_hints docs (#100701)
Removed erroneous note in the get_type_hints docs

typing.get_type_hints still includes base class type hints.
2023-01-07 17:31:47 +00:00
Mark Shannon 78068126a1
GH-99005: More intrinsics (GH-100774)
* Remove UNARY_POSITIVE, LIST_TO_TUPLE and ASYNC_GEN_WRAP, replacing them with intrinsics.
2023-01-06 14:47:57 +00:00
Akshit Tyagi 659c2607f5
gh-99026 update dataclasses docs for when annotations are inspected (gh-100798)
update dataclasses docs for when annotations are inspected
2023-01-06 09:26:44 -05:00
Shantanu 2f2fa03ff3
gh-87691: clarify use of anchor in pathlib docs (#100782)
This is feedback from https://github.com/python/cpython/pull/100737#discussion_r1062968696

This matches the wording from the `os.path.join` docs better:
https://docs.python.org/3/library/os.path.html#os.path.join

In particular, the previous use of "anchor" was incorrect given the
pathlib definition of "anchor".

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-01-05 17:49:33 -08:00
Shantanu 1ae619c911
gh-87691: add an absolute path pathlib example in / operator docs (GH-100737)
The behaviour is fully explained a couple paragraphs above, but it may be useful to have a brief example to cover the behaviour.

Automerge-Triggered-By: GH:hauntsaninja
2023-01-05 14:55:35 -08:00
Mark Shannon 28187141cc
GH-99005: Add `CALL_INTRINSIC_1` instruction (GH-100771)
* Remove PRINT_EXPR instruction

* Remove STOPITERATION_ERROR instruction

* Remove IMPORT_STAR instruction
2023-01-05 16:05:51 +00:00
Tzu-ping Chung 105e37395d
GH-100766: Note that locale.LC_MESSAGES is not universal (GH-100702) 2023-01-05 03:34:30 +00:00
David Lechner 5fb1c08e15
docs: fix `ssizeobjargproc` parameters (#100736) 2023-01-04 13:47:42 +05:30
Ethan Furman a286caa937
gh-91219: http - use subclassing to override index_pages attribute (GH-100731)
Remove previously added parameter to `__init__`, and recommend subclassing to modify the `index_pages` attribute instead.
2023-01-03 15:20:08 -08:00
Christophe Nanteuil 64ed609c53
[Enum] docs: replace 'last value' by 'highest value' for Flag auto (GH-100709) 2023-01-03 14:08:50 -08:00
Zachary Ware e196d8c10a
gh-100700: Remove Date and Release fields in past whatsnews (GH-100728) 2023-01-03 16:00:26 -06:00
4l4k4z4m 8b1f125121
gh-81611: Improve `range` paragraph in 8.3 of language reference (#98353)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-01-03 13:46:51 +05:30
Kumar Aditya 7feb6d2f85
fix `grammer` -> `grammar` typo in expressions.rst (GH-100683)
Automerge-Triggered-By: GH:AlexWaygood
2023-01-02 03:49:06 -08:00
Alexander Shadchin 254ab42240
Fix deprecation doc for `PyEval_InitThreads` (#100667) 2023-01-02 16:43:55 +05:30
Shantanu edfbf56f4c
gh-100428: Make int documentation more accurate (#100436)
- Remove first link to lexical definition of integer literal, since it
  doesn't apply (differs in handling of leading zeros, base needs to be
  explicitly specified, unicode digits are allowed)
- Better describe handling of leading zeros, unicode digits, underscores
- Base 0 does not work exactly as like a code literal, since it allows
  Unicode digits. Link code literal to lexical definition of integer
  literal.
2023-01-01 19:14:18 -08:00
Erlend E. Aasland b7a68ab824
gh-99953: Purge mention of numeric param style from sqlite3 docs (#100630)
The PEP-249 numeric style has never been supported by sqlite3.
2023-01-01 23:26:23 +01:00
Jason R. Coombs 447d061bc7
gh-97930: Apply changes from importlib_resources 5.10. (GH-100598) 2023-01-01 11:07:32 -05:00
ram vikram singh 1aab269d4a
gh-100201: Document behavior with a bare `yield` statement (#100416)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-01-01 21:06:13 +05:30
Mehrdad Moradizadeh 1d1480fefc
gh-96773 Fix documentation of socket backlog (#96778) 2023-01-01 20:36:17 +05:30
Shantanu e83f88a455
gh-100488: Add is_integer method to fractions.Fraction (#100489) 2023-01-01 01:44:48 -07:00
Shantanu 71159a8e07
gh-100546: Remove incorrect positional-only marker from eval (#100547)
All the arguments are positional-only.

The current status after #99476 seems to be to not use positional-only
markers in documentation, hence I've simply removed it.
2022-12-31 17:59:31 -07:00
Sandeep Subramanian ac7a0a9f9e
GH-87002: fix caching documentation in `struct` module (#24164) 2022-12-31 22:27:58 +05:30
Owain Davies 98308dbeb1
gh-100633 Tutorial: Fix dataclasses import (#100638)
import dataclass not dataclasses from dataclasses
2022-12-31 10:23:18 +00:00
Paolo Lammens f59c7f8edd
GH-85979: Clarify specification of `object.__await__` (#22320)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-12-31 11:54:04 +05:30
Raymond Hettinger 4ebaae8aed
Improve comments in itertools uniquification recipes (GH-100631) 2022-12-30 20:36:38 -06:00
mathieui f4fcfdf8c5
gh-100616: Document 'attr' parameter for window.vline() in curses module (#24961)
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2022-12-30 08:35:04 -08:00
ram vikram singh 7223d50b97
gh-100583: Improve the `pydoc` documentation (#100590) 2022-12-29 20:47:20 +05:30
JustAnotherArchivist cf1c098180
GH-100101: Clarify documentation of zip's strict option (GH-100103) 2022-12-28 13:24:50 -08:00
Raymond Hettinger c4c5790120
Restore early-out to factor(). Strengthen tests. (GH-100591) 2022-12-28 12:29:27 -08:00
Hugo van Kemenade 9eca7235af
gh-94172: Update docs for params removed in 3.12 (#100431)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
2022-12-28 14:43:19 -05:00
Zachary Ware 25590eb5de
gh-100540: Remove obsolete '--with-system-ffi' configure option (GH-100544)
It has had no effect on non-macOS platforms for a long time, and has had
the non-obvious effect of invoking `pkg_config` and not setting
`-DUSING_APPLE_OS_LIBFFI` on macOS since GH-22855.
2022-12-28 13:36:03 -06:00
Raymond Hettinger 2d52406835
Improve factor() recipe and fix its tests (GH-100576) 2022-12-28 03:13:58 -08:00
Stanley b95b1b3b25
gh-55688: Add note about ending backslashes for raw strings (#94768)
Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
2022-12-28 00:30:42 -05:00
Guy Yagev ad3c99e521
gh-92446: Improve argparse choices docs; revert bad change to lzma docs (#94627)
Based on the definition of the collections.abc classes, it is more accurate to use "sequence" instead of "container" when describing argparse choices.

A previous attempt at fixing this in #92450 was mistaken; this PR reverts that change.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-26 00:22:53 -06:00
Ilya Kulakov dbc1e696eb
gh-99308: Clarify re docs for byte pattern group names (#99311) 2022-12-25 12:25:27 +05:30
Shantanu 046cbc2080
gh-100472: Fix docs claim that compileall parameters could be bytes (#100473) 2022-12-24 14:22:49 -06:00
Bart Broere efccd04b9e
[Minor PR] Quotes in documentation changed into code blocks (#99536)
Minor formatting fix in documentation

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-24 12:17:39 -08:00
Shantanu 2e1a9ce989
gh-100428: Make float documentation more accurate (#100437)
Previously, the grammar did not accept `float("10")`.
Also implement mdickinson's suggestion of removing the indirection.
2022-12-24 14:09:31 -06:00
MonadChains f5b7b19bf1
gh-99535: Add test for inheritance of annotations and update documentation (#99990) 2022-12-24 12:07:14 -08:00
JosephSBoyle 00afa5066b
gh-99908: Tutorial: Modernize the 'data-record class' example (#100499)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-12-24 15:23:24 +00:00
Raymond Hettinger 0769f95751
Misc Itertools recipe tweaks (GH-100493) 2022-12-24 00:21:30 -08:00
Stanley 0f6420640c
gh-77771: Add enterabs example in sched (#92716)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-12-23 23:21:52 -06:00
Shantanu 3e46f9fe05
gh-100268: Add is_integer method to int (#100439)
This improves the lives of type annotation users of `float` - which type checkers implicitly treat as `int|float` because that is what most code actually wants. Before this change a `.is_integer()` method could not be assumed to exist on things annotated as `: float` due to the method not existing on both types.
2022-12-23 18:30:27 -08:00
Raymond Hettinger f89de679ff
Add "strict" to dotproduct(). Add docstring. Factor-out common code. (GH-100480) 2022-12-23 15:52:16 -08:00
Raymond Hettinger 5d84966cce
GH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426) 2022-12-23 14:35:58 -08:00
Nikita Sobolev 745545b5bb
gh-99482: remove `jython` compatibility parts from stdlib and tests (#99484) 2022-12-23 14:17:24 -06:00
Petr Viktorin 49f6ff719c
gh-98712: Clarify "readonly bytes-like object" semantics in C arg-parsing docs (#98710) 2022-12-23 07:00:21 -08:00
Shantanu 73c08eeaff
Fix typo in 3.12 What's New (#100449) 2022-12-23 00:22:31 -06:00
Stanley f3db68e6e6
gh-48496: Added example and link to faq for UnboundLocalError in reference (#93068) 2022-12-22 17:23:25 -06:00
Itamar Ostricher 4cc63e0d4e
gh-100344: Add C implementation for `asyncio.current_task` (#100345)
Co-authored-by: pranavtbhat
2022-12-22 19:08:12 +05:30
Stanley c615286e85
gh-91081: Add note on WeakKeyDictionary behavior when deleting a replaced entry (#91499)
Co-authored-by: Pieter Eendebak <P.T.eendebak@tudelft.nl>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-12-20 19:27:02 -08:00
Bisola Olasehinde a2bb3b7f9d
gh-99991: improve docs on str.encode and bytes.decode (#100198)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-12-20 18:02:14 -08:00
Pablo Galindo Salgado cb60b6131b
Clarify that every thread has its own default context in contextvars (#99246) 2022-12-20 11:35:48 +00:00
Brad Wolfe 39dfbb2d5d
gh-88211: Change lower-case and upper-case to match recommendations in imaplib docs (#99625) 2022-12-20 15:40:31 +05:30
Thomas Grainger 79ccc03b62
gh-89051: Add ssl.OP_LEGACY_SERVER_CONNECT (#93927)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Fixes https://github.com/python/cpython/issues/89051
2022-12-20 09:10:30 +02:00
Stanley 36a0b1d0dd
gh-69929: re docs: Add more specific definition of \w (#92015)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-12-19 19:07:31 -08:00
Carlton Gibson 532aa4e4e0
gh-94912: Added marker for non-standard coroutine function detection (#99247)
This introduces a new decorator `@inspect.markcoroutinefunction`,
which, applied to a sync function, makes it appear async to
`inspect.iscoroutinefunction()`.
2022-12-18 11:13:24 -08:00
Jeremy Paige 1cf3d78c92
Correct CVE-2020-10735 documentation (#100306) 2022-12-18 12:41:21 +05:30
Hugo van Kemenade 0264f634f7
Docs: Use `PY_VERSION_HEX` for version comparison (#100179) 2022-12-17 13:12:18 +05:30
ram vikram singh 8edcb30c3f
gh-97909: Fix markup for `PyMethodDef` members (#100089) 2022-12-17 12:42:39 +05:30
Barney Gale 5a991da329
gh-78707: deprecate passing >1 argument to `PurePath.[is_]relative_to()` (GH-94469)
This brings `relative_to()` and `is_relative_to()` more in line with other pathlib methods like `rename()` and `symlink_to()`.

Resolves #78707.
2022-12-16 16:14:27 -08:00
Ben Darnell 5234e1cbea
gh-99830: asyncio: Document returns of remove_{reader,writer} (#100302) 2022-12-16 11:04:55 -08:00
Frank Dana f23236a92d
"Compound statement" docs: Fix with-statement step indexing (#100286)
Back in commit 226e6e7d43
an item was added to the list, renumbering all the rest of the
items, but the forward-reference wasn't updated to match.
2022-12-16 18:43:43 +00:00
JustAnotherArchivist 5ee7eb9deb
Document that zipfile's pwd parameter is a `bytes` object (#100209) 2022-12-16 16:10:10 +05:30
Carl Meyer e00266f398
gh-99767: mark `PyTypeObject.tp_watched` as internal use only in table (#100271) 2022-12-16 16:02:09 +05:30
Mikhail Berkov 2cd5146f27
Fix typo in introduction.rst (#100266) 2022-12-16 15:56:30 +05:30
Raymond Hettinger b430399d41
GH-100234: Set a default value for random.expovariate() (GH-100235) 2022-12-15 12:40:45 -06:00
Raymond Hettinger 8356c14b4f
Remove uninformative itertools recipe (GH-100253) 2022-12-15 12:39:01 -06:00
Carl Meyer b7e4f1d97c
GH-99767: update PyTypeObject docs for type watchers (GH-99928) 2022-12-15 11:26:08 +00:00
busywhitespace 9663853800
gh-100248: Add missing `ssl_shutdown_timeout` parameter in `asyncio` docs (#100249) 2022-12-14 22:27:02 +05:30
Hugo van Kemenade 3192c00a3c
gh-100176: venv: Remove redundant compat code for Python <= 3.2 (#100177)
gh-100176: Remove redundant compat code for Python 3.2 and older

Python 3.2 has been EOL since 2016-02-20 and 2.7 since 2020-01-01, so we
can remove this old compatibility check and unindent the old else-block.

Also, in the unindented block, replace a .format() call with an f-string.

Plus similar changes in the documentation.
2022-12-14 11:37:11 +00:00
Filipe Laíns d3ea82aaf9
GH-100206: use versionadded for the addition of sysconfig.get_default_scheme (#100207) 2022-12-13 12:54:07 +02:00
jarrodcolburn 8711b59f7a
Fix: typo (Indention) (GH-99904)
Example needed to be indented. Was trying to call a context manger `pr` (from ` with cProfile.Profile() as pr:`) wot perform ` pr.print_stats()` once it had already exited.

Automerge-Triggered-By: GH:AlexWaygood
2022-12-12 04:25:22 -08:00
Ned Batchelder 935ef59321
clarify the 4300-digit limit on int-str conversion (#100175) 2022-12-12 13:39:54 +02:00
Shantanu 70be5e42f6
gh-70393: Clarify mention of "middle" scope (#98839) 2022-12-11 20:15:55 -08:00
Beweeted 868bab0fdc
gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)
Changed from multiples of 3 to powers of 3 to match the class name.
2022-12-11 15:20:59 -08:00
Brad Wolfe d5f8a2b6ad
gh-99728: correct typo in `datetime` format codes documentation (#99750) 2022-12-10 15:50:18 +05:30
busywhitespace e477348f36
gh-99970 Adding missing `optionflags` parameter in the documentation of `doctest` (#99971) 2022-12-10 15:42:40 +05:30
ram vikram singh 7c0fb71fbf
gh-100049: fix `repr` for `mappingproxy` in dictionary view example doc (#100052) 2022-12-10 14:46:00 +05:30
Stanley 286e3c76a9
gh-99087: Add missing newline for prompts in docs (GH-98993)
Add newline for prompts so copying to REPL does not cause errors.
2022-12-08 19:31:19 -08:00
Raymond Hettinger 35cc0ea736
GH-98363: Have batched() return tuples (GH-100118) 2022-12-08 15:08:16 -06:00
Jia Junjie 41d4ac9da3
gh-96250: Improve sqlite3 injection attack example (#99270)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-12-08 21:37:08 +01:00
Matthieu Baerts cce8362960
gh-98030: socket: add missing TCP socket options (#98031)
A few TCP socket options have been added to the Linux kernel these last
few years.

This commit adds all the ones available in Linux 6.0:

  https://elixir.bootlin.com/linux/v6.0/source/include/uapi/linux/tcp.h#L91

While at it, the TCP_FASTOPEN option has been moved lower in the list
just to keep the same order as in tcp.h to ease future synchronisations.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
2022-12-07 20:59:37 -08:00
Victor Stinner b11a384dc7
gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#100070)
The Py_CLEAR(), Py_SETREF() and Py_XSETREF() macros now only evaluate
their arguments once. If an argument has side effects, these side
effects are no longer duplicated.

Use temporary variables to avoid duplicating side effects of macro
arguments. If available, use _Py_TYPEOF() to avoid type punning.
Otherwise, use memcpy() for the assignment to prevent a
miscompilation with strict aliasing caused by type punning.

Add _Py_TYPEOF() macro: __typeof__() on GCC and clang.

Add test_py_clear() and test_py_setref() unit tests to _testcapi.
2022-12-07 15:22:38 +01:00
Ethan Furman 679efbb080
gh-94943: [Enum] improve repr() when inheriting from a dataclass (GH-99740)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-12-06 13:43:41 -08:00
Serhiy Storchaka fd38a2f0ec
gh-93453: No longer create an event loop in get_event_loop() (#98440)
asyncio.get_event_loop() now always return either running event loop or
the result of get_event_loop_policy().get_event_loop() call. The latter
should now raise an RuntimeError if no current event loop was set
instead of creating and setting a new event loop.

It affects also a number of asyncio functions and constructors which
call get_event_loop() implicitly: ensure_future(), shield(), gather(),
etc.

DeprecationWarning is no longer emitted if there is no running event loop but
the current event loop was set.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-12-06 18:42:12 +01:00
Ashwin Ramaswami 85d5a7e8ef
bpo-37860: re-add netlify.toml to set up deploy previews for docs (#92852)
* Revert "bpo-46184: remove `netlify.toml` (#30272)"

This reverts commit fbaf2e604c.

* Delete runtime.txt

* Create runtime.txt

* Delete runtime.txt

* Update netlify.toml

* Update netlify.toml

* Add netlify badge

* Update Doc/tools/templates/layout.html

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Update layout.html

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-12-06 08:37:41 -05:00
Victor Stinner 5837e5f347
gh-100008: VS 2017 is required since Python 3.11 (#100045) 2022-12-06 14:35:32 +01:00
Erik De Bonte 5c19050546
gh-99957: Add `frozen_default` parameter on `dataclass_transform` (#99958) 2022-12-05 19:35:43 -08:00
Gregory P. Smith bed15f87ea
gh-100001: Remove doc typo, add versionadded (#100042)
gh-100001: Remove new doc typo, add versionadded.
2022-12-05 15:15:13 -08:00
Hugo van Kemenade f49c735e52
Use sphinxext-opengraph to generate OpenGraph metadata (#99931)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-12-05 23:26:28 +02:00
Gregory P. Smith d8ab0a4dfa
gh-100001: Omit control characters in http.server stderr logs. (#100002)
Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
2022-12-05 12:55:45 -08:00
Ram Rachum 51ee0a29e9
dataclasses.rst: Prevent horizontal scrolling (gh-100025) 2022-12-05 13:56:13 -05:00
Victor Stinner 5ea052bb0c
gh-100008: Document Python build requirements (#100009)
Document also configure --without-freelists option added to Python
3.11.
2022-12-05 15:41:44 +01:00