Commit Graph

26304 Commits

Author SHA1 Message Date
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
Ethan Furman e3a3863cb9
gh-93464: [Enum] Add versionchanged tag (#99997)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-12-05 12:35:31 +02:00
Géry Ogam 2ae894b6d1
[Enum] Fix typos in the documentation (GH-99960) 2022-12-04 11:49:31 -08:00
Brian Skinn bf26bdf6ac
gh-85747: "Preface" section of asyncio-eventloop.rst: Switch to active voice and suggest other edits (#99784) 2022-12-03 16:48:41 -08:00
Serhiy Storchaka a87c46eab3
bpo-15999: Accept arbitrary values for boolean parameters. (#15609)
builtins and extension module functions and methods that expect boolean values for parameters now accept any Python object rather than just a bool or int type. This is more consistent with how native Python code itself behaves.
2022-12-03 11:52:21 -08:00
Itamar Ostricher 3c137dc613
GH-91054: Add code object watchers API (GH-99859)
* Add API to allow extensions to set callback function on creation and destruction of PyCodeObject

Co-authored-by: Ye11ow-Flash <janshah@cs.stonybrook.edu>
2022-12-02 17:28:27 +00:00
C.A.M. Gerlach d460c8ec52
Doc: Add summary line to isolation_level & autocommit sqlite3.connect params (#99917)
Add summary lines to isolation_level and autocommit connect() params

Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
2022-12-01 08:19:41 +01:00
ram vikram singh e0f91deb59
GH-98906 ```re``` module: ```search() vs. match()``` section should mention ```fullmatch()``` (GH-98916)
Mention fullmatch along with search and match.
2022-11-30 17:52:21 -05:00
Géry Ogam 9628136fac
bpo-47220: Document the optional callback parameter of weakref.WeakMethod (GH-25491) 2022-11-30 13:44:10 -06:00
Géry Ogam 19c38801ba
gh-99824: Document that sqlite3.connect implicitly open a transaction if autocommit=False (#99825)
Authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-11-30 12:33:50 +01:00
Dong-hee Na 8bb2303fd7
gh-99127: Allow some features of syslog to the main interpreter only (gh-99128) 2022-11-30 07:58:20 +09:00
Géry Ogam 052bc128ac
Docs: improve accuracy of socketserver reference (#24767) 2022-11-29 21:34:52 +01:00
Yilei "Dolee" Yang d74a58872c
whatsnew-3.10: Mention PEP 647 in the Release highlights section. (#99853)
Mention PEP 647 in the Release highlights section.

Also re-ordered the list so it matches the order in the details sections below.
2022-11-29 20:30:58 +00:00
Sam Ezeh 05dfc539c2
gh-90717: Update the documentation for the altchars paremeter in base64 library (GH-94187) 2022-11-29 16:21:01 +00:00
Matthew Hughes ca3e611b1f
`fnmatch` docs: link to `fnmatch.filter()`, not `builtins.filter()` (#99819) 2022-11-28 18:08:08 +00:00
David Miguel Susano Pinto 65417988a5
Grammatical improvements for ctypes 'winmode' documentation (GH-19167) 2022-11-28 16:05:21 +00:00
Georg Brandl 492dc02b01
bpo-41825: restructure docs for the os.wait*() family (GH-22356) 2022-11-28 09:41:24 +00:00
Petr Viktorin 219696abb2
gh-99249: Clarify "read-only" slots tp_bases & tp_mro (GH-99342)
These slots are marked "should be treated as read-only" in the
table at the start of the document.  That doesn't say anything about
setting them in the static struct.

`tp_bases` docs did say that it should be ``NULL`` (TIL!). If you
ignore that, seemingly nothing bad happens. However, some slots
may not be inherited, depending on which sub-slot structs are present.
(FWIW, NumPy sets tp_bases and is affected by the quirk -- though to
be fair, its DUAL_INHERIT code probably predates tp_bases docs, and
also the result happens to be benign.)

This patch makes things explicit.
It also makes the summary table legend easier to scan.

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-11-28 09:22:08 +01:00
Erlend E. Aasland 276643e207
Docs: both sqlite3 "point examples" now adapt to str (#99823) 2022-11-27 22:08:30 +01:00
Sam Ezeh dfc2732a57
gh-91340: Document multiprocessing.set_start_method force parameter (GH-32339)
#91340


https://bugs.python.org/issue47184

Automerge-Triggered-By: GH:kumaraditya303
2022-11-27 09:58:39 -08:00
Hugo van Kemenade 969620d59a
Docs: Move .PHONY to each section to avoid copy/paste omissions (#99396) 2022-11-27 19:48:29 +02:00
Brad Wolfe 65629399bc
gh-85988: Change documentation for sys.float_info.rounds (GH-99675)
* Change documentation for sys.float_info.rounds

Change the documentation for sys.float_info.rounds to remove
references to C99 section 5.2.4.2.2 and instead place the
available values inline.

* Correction to previous documentation change

Newlines were not preserved in generated HTML on previous
commit. I have changes the list to a comma-separated list
of values and their meanings.

* Clarify source for value of FLT_ROUNDS

Clarify the source of the FLT_ROUNDS value and
change 'floating-point addition' to 'floating-point
arithmetic' to indicate that the rounding mode
applies to all arithmetic operations.
2022-11-27 10:25:12 +00:00
George Zhang 22860dbbc8
doc: Remove backslashes in doctest grammar docs (#29346) 2022-11-27 12:08:39 +05:30
Zackery Spytz 62a5dc13e9
bpo-43327: Fix the docs for PyImport_ImportFrozenModuleObject() (#24659)
The docs stated that PyImport_ImportFrozenModuleObject() returns a
new reference, but it actually returns an int.

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-11-27 11:57:41 +05:30
Jason R. Coombs 7f005749b2
gh-88330: Add more detail about what is a resource. (#99801) 2022-11-26 16:57:20 -05:00
busywhitespace 5f8898216e
gh-99795: Fix typo in importlib.resources.abc (GH-99796)
Changing TraversableReader to TraversableResources at one place of the documentation.

See #99795 for more details.
2022-11-26 10:01:08 -08:00
Nikita Sobolev 47d673d81f
gh-99502: mention bytes-like objects as input in `secrets.compare_digest` (GH-99512)
Now it is in sync with https://docs.python.org/3/library/hmac.html#hmac.compare_digest
It is the same function, just re-exported. So, I guess they should mention the same input types.
2022-11-26 01:33:48 -08:00
Terry Jan Reedy a86d854522
Fix typo in `__match_args__` doc (#99785)
A opy of #98549, whose author (@icecream17) uses a school computer that blocks the CLA site. I did not mention this in commit comment above so CLA bot does not pick up the name and request the CLA again.
2022-11-26 00:03:16 +00:00
Stanley 7d2dcc53d0
gh-64019: Have attribute table in `inspect` docs link to module attributes instead of listing them (GH-98116)
Co-authored-by: Michael Anckaert <michael.anckaert@sinax.be>
2022-11-25 11:10:22 -08:00
Erlend E. Aasland 8749121b07
gh-96168: Add sqlite3 row factory how-to (#99507)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-11-25 14:07:28 +01:00
Victor Stinner 3a803bcaac
Revert "gh-98724: Fix Py_CLEAR() macro side effects" (#99737)
Revert "gh-98724: Fix Py_CLEAR() macro side effects (#99100)"

This reverts commit c03e05c2e7.
2022-11-24 22:17:33 +01:00
Zachary Ware b5b3904f05
Fix rendering of audioop license in Doc/license.rst (GH-99752)
Also some cosmetic blank line additions for consistency with the
formatting of the rest of the file.
2022-11-24 10:18:40 -06:00
Illia Volochii 9dc08361be
gh-96828: Add an `ssl.OP_ENABLE_KTLS` option (GH-96830)
Expose the constant when OpenSSL defines it.
2022-11-23 18:24:09 -08:00
Irit Katriel 5d9183c7ad
gh-99619: fix error in documentation of ExceptionGroup.derive() (GH-99621) 2022-11-23 10:59:52 +00:00
ram vikram singh f5fea22886
gh-99650 : Updated argparse docs (GH-99653) 2022-11-22 13:16:06 -08:00
Skip Montanaro 22d91c16bb
gh-99146 struct module documentation should have more predictable examples/warnings (GH-99141)
* nail down a couple examples to have more predictable output

* update a number of things, but this is really just a stash...

* added an applications section to describe typical uses for native and machine-independent formats

* make sure all format strings use a format prefix character

* responding to comments from @gpshead. Not likely finished yet.

* This got more involved than I expected...

* respond to several PR comments
* a lot of wordsmithing
* try and be more consistent in use of ``x`` vs ``'x'``
* expand examples a bit
* update the "see also" to be more up-to-date
* original examples relied on import * so present all examples as if

* reformat based on @gpshead comment (missed before)

* responding to comments

* missed this

* one more suggested edit

* wordsmithing
2022-11-22 18:06:36 +00:00
Charles Machalow 1b2de89bce
gh-99547: Add isjunction methods for checking if a path is a junction (GH-99548) 2022-11-22 17:19:34 +00:00
Petr Viktorin d15b9f19ac
gh-93937: Document PyFrame_Check and PyFrame_Type (GH-99695) 2022-11-22 16:41:57 +01:00
Victor Stinner 7e3f09cad9
gh-99537: Use Py_SETREF() function in C code (#99656)
Fix potential race condition in code patterns:

* Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
* Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
* Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"

Other changes:

* Replace "old = var; var = new; Py_DECREF(var)"
  with "Py_SETREF(var, new);"
* Replace "old = var; var = new; Py_XDECREF(var)"
  with "Py_XSETREF(var, new);"
* And remove the "old" variable.
2022-11-22 14:22:22 +01:00
mpage 3db0a21f73
gh-91053: Add an optional callback that is invoked whenever a function is modified (#98175) 2022-11-22 13:06:44 +01:00
Ronald Oussoren bc3a11d21d
GH-92892: Add section about variadic functions to ctypes documentation (#99529)
On some platforms, and in particular macOS/arm64, the calling
convention for variadic arguments is different from the regular
calling convention. Add a section to the documentation to document
this.
2022-11-22 11:33:37 +01:00
Petr Viktorin 4d82f628c4
gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014)
The ``structmember.h`` header is deprecated, though it continues to be available
and there are no plans to remove it. There are no deprecation warnings. Old code
can stay unchanged (unless the extra include and non-namespaced macros bother
you greatly). Specifically, no uses in CPython are updated -- that would just be
unnecessary churn.
The ``structmember.h`` header is deprecated, though it continues to be
available and there are no plans to remove it.

Its contents are now available just by including ``Python.h``,
with a ``Py`` prefix added if it was missing:

- `PyMemberDef`, `PyMember_GetOne` and`PyMember_SetOne`
- Type macros like `Py_T_INT`, `Py_T_DOUBLE`, etc.
  (previously ``T_INT``, ``T_DOUBLE``, etc.)
- The flags `Py_READONLY` (previously ``READONLY``) and
  `Py_AUDIT_READ` (previously all uppercase)

Several items are not exposed from ``Python.h``:

- `T_OBJECT` (use `Py_T_OBJECT_EX`)
- `T_NONE` (previously undocumented, and pretty quirky)
- The macro ``WRITE_RESTRICTED`` which does nothing.
- The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of
  `Py_AUDIT_READ`.
- In some configurations, ``<stddef.h>`` is not included from ``Python.h``.
  It should be included manually when using ``offsetof()``.

The deprecated header continues to provide its original
contents under the original names.
Your old code can stay unchanged, unless the extra include and non-namespaced
macros bother you greatly.

There is discussion on the issue to rename `T_PYSSIZET` to `PY_T_SSIZE` or
similar. I chose not to do that -- users will probably copy/paste that with any
spelling, and not renaming it makes migration docs simpler.


Co-Authored-By: Alexander Belopolsky <abalkin@users.noreply.github.com>
Co-Authored-By: Matthias Braun <MatzeB@users.noreply.github.com>
2022-11-22 08:25:43 +01:00
GabrielAnguita 1bf983ce7e
gh-99662: fix typo in typing.TypeVarTuple docs (#99672) 2022-11-21 20:02:55 -08:00
Ronald Oussoren 1cae31d26b
GH-95815: Document less specific error for os.remove (#99571)
os.remove can raise PermissionError instead of IsADirectoryError,
when the object to be removed is a directory (in particular on
macOS).

This reverts a change done in #14262.
2022-11-21 11:08:06 +01:00
Julien Palard 858cb79486
Doc: Make functions.html readable again. (GH-99476) 2022-11-19 11:25:45 +01:00
Nikita Sobolev a3360facba
gh-99284: [ctypes] remove `_use_broken_old_ctypes_structure_semantics_` (GH-99285)
It was untested and undocumented. No code has been found in the wild that ever used it.
2022-11-18 22:25:32 -08:00
Stanley 27d8dc2c9d
gh-85073: Add some missing links to source (GH-99363)
Add some missing links to source from Python docs
2022-11-18 11:33:40 -08:00
Rafael Fontenelle 0e09d2cc59
Doc: Replace question mark with fullstop (#99558)
The sentence "Set the LC_CTYPE locale to the user preferred locale." should end with a period
instead of a question mark.
2022-11-18 11:24:23 -08:00
Alexander Ryabov ed206e39f0
Doc: Fix broken link to emscripten networking website (#99531)
There was an extra `>` in the url.
2022-11-18 10:57:04 -08:00
Irit Katriel c8c6113398
gh-99553: fix bug where an ExceptionGroup subclass can wrap a BaseException (GH-99572) 2022-11-18 15:44:43 +00:00
Adorilson Bezerra a0d940d6ac
Misc copyedits in docs on built-in types (GH-24466)
# DOC: Improvements in library/stdtypes

This PR does the following:

1. Replaces :meth: by :func: around repr function
2. Adds links to Unicode Standard site
3. Makes explicit "when" you can call the `iskeyword` function. The previous text could cause confusion to readers, especially those with English as a second language. The reader could understand that the `isidentifier` method calls the `iskeyword` function. Now, it is explicit that the dev can do it.
4. Replaces a URL with an inline link.

Automerge-Triggered-By: GH:AlexWaygood
2022-11-17 08:06:00 -08:00
Steve Dower 5fdd49dc65
gh-99377: Revert audit events for thread state creation and free, because the GIL is not properly held at these times (GH-99543) 2022-11-17 00:24:16 +00:00
Steve Dower 19c1462e8d
gh-99377: Add audit events for thread creation and clear (GH-99378) 2022-11-16 17:15:52 +00:00
Kumar Aditya f63002755d
GH-99388: add `loop_factory` parameter to `asyncio.run` (#99462) 2022-11-14 10:18:51 -08:00
Victor Stinner 1089bdc81a
gh-99300: Use Py_NewRef() in Doc/ directory (#99480)
Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in test C files of the Doc/ directory.

Replace PyModule_AddObject() with PyModule_AddObjectRef() to simplify
reference counting.
2022-11-14 18:49:14 +01:00
Victor Stinner 9a7e9f9921
gh-99289: Add COMPILEALL_OPTS to Makefile (#99291)
Add COMPILEALL_OPTS variable in Makefile to override compileall
options (default: -j0) in "make install". Also merge the compileall
commands into a single command building PYC files for the all
optimization levels (0, 1, 2) at once.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-11-14 13:43:45 +01:00
Matt Harasymczuk f0d12ca0e0
Fix misspelling in docs for http.HTTPMethod (#99376)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-13 12:46:28 -08:00
ram vikram singh 88385b8564
gh-98930: improve the docstring of signal.strsignal (#99290)
Improves the docstring on signal.strsignal to make it explain when it returns a message, None, or when it raises ValueError.

Closes #98930

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-11-13 11:41:23 -08:00
Victor Stinner 6788303f5c
gh-91248: Optimize PyFrame_GetVar() (#99252)
PyFrame_GetVar() no longer creates a temporary dictionary to get a
variable.
2022-11-13 15:37:03 +01:00
Erlend E. Aasland c95f554a40
gh-83638: Add sqlite3.Connection.autocommit for PEP 249 compliant behaviour (#93823)
Introduce the autocommit attribute to Connection and the autocommit
parameter to connect() for PEP 249-compliant transaction handling.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
2022-11-12 23:44:41 +01:00
naglis dfc1b17a23
gh-99392: Fix sqlite3 converter recipes (#99393) 2022-11-12 20:39:37 +01:00
Ethan Furman 73a921b070
gh-99304: [Enum] clarify what constitutes a flag alias (GH-99395)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-11-12 10:39:47 -08:00
Kumar Aditya aa874326d8
GH-94597: add deprecation warnings for subclassing `AbstractChildWatcher` (#99386) 2022-11-11 23:17:53 -08:00
Steve Dower c3c3871415
gh-87604: Clarify in docs that sys.addaudithook is not for sandboxes (GH-99372) 2022-11-11 13:35:02 +00:00
Samuel Sloniker 97c493dd35
gh-84522: Add for-loop to apply-method-to-sequence FAQ (#94660) 2022-11-10 22:16:16 -06:00
Wei-Hsiang (Matt) Wang d26ee8a0a5
gh-98366: use sphinx.locale._ as gettext() in pyspecific.py (#98437)
fix(doc-tools): use sphinx.locale._ as gettext() for backward-compatibility in pyspecific.py

[why] spinix 5.3 changed locale.translators from a defaultdict(gettext.NullTranslations) to a dict, which leads to failure of pyspecific.py. Use sphinx.locale._ as gettext to fix the issue.
2022-11-11 02:18:11 +01:00
Raymond Hettinger 2f4af2d99c
GH-99183: Document behavior of count() for empty substrings (GH-99339) 2022-11-10 15:20:01 -06:00
jmcb 58ee5d8677
Update reference to the size of PyPI (#99076)
Update reference to the size of PyPI

Last changed in 2008 (528576031d).
2022-11-09 11:26:46 -08:00
Victor Stinner c03e05c2e7
gh-98724: Fix Py_CLEAR() macro side effects (#99100)
The Py_CLEAR(), Py_SETREF() and Py_XSETREF() macros now only evaluate
their argument once. If an argument has side effects, these side
effects are no longer duplicated.

Add test_py_clear() and test_py_setref() unit tests to _testcapi.
2022-11-09 14:06:36 +01:00
Bruno Neyra b3bd69c1bf
[Enum] Typo: fix DuplicateFreeEnum example docs (GH-99265) 2022-11-08 16:39:56 -08:00
Gregory P. Smith 2eee9d9cd7
gh-99238: clarify the type of the env dict. (#99253) 2022-11-08 13:00:31 -08:00
Victor Stinner 4d5fcca273
gh-91248: Add PyFrame_GetVar() function (#95712)
Add PyFrame_GetVar() and PyFrame_GetVarString() functions to get a
frame variable by its name.

Move PyFrameObject C API tests from test_capi to test_frame.
2022-11-08 17:40:27 +01:00
Mikael Koli acf4d5d5bd
Fix broken link in `asyncio-subprocesses` doc (GH-99214)
# Fix broken link in Doc/library/asyncio-subprocess.rst

This is a trivial fix in documentation to fix a broken link.

There is a broken link in [Doc/library/asyncio-subprocess.rst](https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process) for the function ``wait_for``:

![image](https://user-images.githubusercontent.com/37690409/200388894-fb6b7c42-b2cc-49ec-a239-e3472890db1f.png)

I suppose this refers to the function ``asyncio.wait_for`` which is not clear in the docs.

This PR fixes the link and the result looks like the following:

![image](https://user-images.githubusercontent.com/37690409/200389483-b4a92105-7d2c-4285-b0fc-78a6dc0be39c.png)

Automerge-Triggered-By: GH:AlexWaygood
2022-11-08 08:26:06 -08:00
Nikita Sobolev e56e33d271
gh-72719: Remove asyncore and asynchat modules (#96580)
Remove modules asyncore and asynchat, which were deprecated by PEP 594.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-08 16:48:58 +01:00
Kamil Turek b9dedfe61d
gh-92119: ctypes: Print exception class name instead of its representation (#98302) 2022-11-07 20:53:59 -08:00
Petr Viktorin 1438b77997
gh-96746: Docs: Clear up Py_TPFLAGS_DISALLOW_INSTANTIATION inheritance (GH-99002)
The flag is not inherited, but its effect -- a NULL tp_new -- is.

Drop hints for people who come here wanting to “disallow instantiation”.
2022-11-07 19:45:50 +01:00
Noam Cohen 80c08d1cd6
gh-95389: expose popular ETHERTYPE_* constants in the socket module (#95390)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-11-07 15:27:37 +01:00
Pablo Galindo Salgado 6168e714be
gh-98254: Add what's new entry for the improvement in commit bb56dead33 (#99197) 2022-11-07 13:37:14 +00:00
Pablo Galindo Salgado be31ecf8b3
gh-91058: Add what's new entry for the improvement in commit 7cfbb49fcd (#99198) 2022-11-07 13:36:48 +00:00
Erlend E. Aasland e02f1e2df9
Docs: add argument spec to sqlite3 CLI docs (#99200) 2022-11-07 14:18:36 +01:00
jmcb 728e42fcf5
doc: Formatting and typo fixes (#98974) 2022-11-06 20:55:55 -08:00
Wenzel Jakob 57a405213c
gh-98586: Add What's New entry and update docs (#99056)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-11-06 23:54:55 +01:00
Nouran Ali 2db55e0c00
gh-94286 Fix documentation of print default param (GH-94297) 2022-11-06 20:14:58 +00:00
Pablo Galindo Salgado 99e2e60cb2
gh-99139: Improve NameError error suggestion for instances (#99140) 2022-11-06 13:52:06 +00:00
Ethan Furman 8feb7ab77c
gh-93464: [Enum] fix auto() failure during multiple assignment (GH-99148)
* fix auto() failure during multiple assignment

i.e. `ONE = auto(), 'text'` will now have `ONE' with the value of `(1,
'text')`.  Before it would have been `(<an auto instance>, 'text')`
2022-11-05 18:01:08 -07:00
Doj 586b07e1f9
[doc] fix typo (GH-99143) 2022-11-05 21:03:29 +00:00
Skip Montanaro c0bf7607a1
minor edits to locale doc (#98537) 2022-11-04 06:02:11 -07:00
Michael Droettboom 2844aa6a8e
Support comparing two sets of pystats (GH-98816)
This adds support for comparing pystats collected from two different builds.

- The `--json-output` can be used to load in a set of raw stats and output a
  JSON file.
- Two of these JSON files can be provided on the next run, and then comparative
  results between the two are output.
2022-11-04 10:15:54 +00:00
Nick Pope 016c7d37b6
Docs: add `named` to the list of styles in the sqlite3.paramstyle attr docs (#99078) 2022-11-04 00:21:01 +01:00
Victor Stinner 0faa0ba240
gh-92584: Remove the distutils package (#99061)
Remove the distutils package. It was deprecated in Python 3.10 by PEP
632 "Deprecate distutils module". For projects still using distutils
and cannot be updated to something else, the setuptools project can
be installed: it still provides distutils.

* Remove Lib/distutils/ directory
* Remove test_distutils
* Remove references to distutils
* Skip test_check_c_globals and test_peg_generator since they use
  distutils
2022-11-03 19:27:27 +01:00
Victor Stinner ef0e72b31d
gh-94172: Remove keyfile, certfile and check_hostname parameters (#94173)
Remove the keyfile, certfile and check_hostname parameters,
deprecated since Python 3.6, in modules: ftplib, http.client,
imaplib, poplib and smtplib. Use the context parameter (ssl_context
in imaplib) instead.

Parameters following the removed parameters become keyword-only
parameters.

ftplib: Remove the FTP_TLS.ssl_version class attribute: use the
context parameter instead.
2022-11-03 18:32:25 +01:00
Johnny11502 00b6745f16
gh-97909: PyMemberDef & PyGetSetDef members are not marked up (GH-98810) 2022-11-03 17:57:30 +01:00
Victor Stinner a60ddd31be
gh-98401: Invalid escape sequences emits SyntaxWarning (#99011)
A backslash-character pair that is not a valid escape sequence now
generates a SyntaxWarning, instead of DeprecationWarning.  For
example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an
invalid escape sequence), use raw strings for regular expression:
re.compile(r"\d+\.\d+"). In a future Python version, SyntaxError will
eventually be raised, instead of SyntaxWarning.

Octal escapes with value larger than 0o377 (ex: "\477"), deprecated
in Python 3.11, now produce a SyntaxWarning, instead of
DeprecationWarning. In a future Python version they will be
eventually a SyntaxError.

codecs.escape_decode() and codecs.unicode_escape_decode() are left
unchanged: they still emit DeprecationWarning.

* The parser only emits SyntaxWarning for Python 3.12 (feature
  version), and still emits DeprecationWarning on older Python
  versions.
* Fix SyntaxWarning by using raw strings in Tools/c-analyzer/ and
  wasm_build.py.
2022-11-03 17:53:25 +01:00
Victor Stinner cff1c20667
gh-94199: Remove ssl.wrap_socket() documentation (#99023)
The function has been removed. In the ssl documentation, replace
references to the ssl.wrap_socket() function with references to the
ssl.SSLContext.wrap_socket() method.

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2022-11-03 13:33:33 +01:00
Mark Shannon f4adb97506
GH-96793: Implement PEP 479 in bytecode. (GH-99006)
* Handle converting StopIteration to RuntimeError in bytecode.

* Add custom instruction for converting StopIteration into RuntimeError.
2022-11-03 11:38:51 +00:00
Serhiy Storchaka e9ac890c02
gh-98740: Fix validation of conditional expressions in RE (GH-98764)
In very rare circumstances the JUMP opcode could be confused with the
argument of the opcode in the "then" part which doesn't end with the
JUMP opcode. This led to incorrect detection of the final JUMP opcode
and incorrect calculation of the size of the subexpression.

NOTE: Changed return value of functions _validate_inner() and
_validate_charset() in Modules/_sre/sre.c.  Now they return 0 on success,
-1 on failure, and 1 if the last op is JUMP (which usually is a failure).
Previously they returned 1 on success and 0 on failure.
2022-11-03 09:23:46 +02:00
Hugo van Kemenade 26720fffd0
Docs: Add 'as, match statement' to the index (#99001) 2022-11-02 19:15:00 -07:00
Skip Montanaro 1fd20d0b57
argparse howto: Use f-string in preference to "...".format() (#98883) 2022-11-02 19:08:08 -07:00
Pablo Galindo Salgado c053284e39
gh-96997: Clarify the contract of PyMem_SetAllocator() (#98977) 2022-11-02 21:49:12 +00:00
Stanley 0689b99bb8
gh-96265: Formatting changes for faq/programming (#98242)
* Formatting changes for faq/programming

* Add missing method formatting, use non-literal formatting

* Fix sphinx warnings

* Some extra formatting missed earlier

* More formatting suggestions from review

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

* Add missing colon, avoid referening external module

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-11-01 21:58:44 -07:00
Oleg Iarygin 898d0d9ad8
gh-92679: Clarify asyncio.loop.start_tls parameters (#92682) 2022-11-01 21:52:19 -07:00
Sebastian Rittau 65d1407737
gh-92871: Postpone the removal of typing.{io,re} to 3.13 (#98958) 2022-11-01 20:51:45 -07:00
Vinay Sajip 50a9b037a6
[doc] Update cookbook example for socket-based logging in a production sett… (GH-98922)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-11-01 23:00:17 +00:00
Manuel Kaufmann f042646595
Doc: use "unnumbered" footnotes (#98954)
Use unnumbered footnote in this file to avoid reseting the footnotes numbering.

Example: when building the tutorial into a PDF and using `latex_show_urls = "footnotes"`; this footnote become the number 8. However, without this change, the footnote shows the number 1.
2022-11-01 13:25:33 +00:00
Pablo Galindo Salgado 395d4285bf
gh-98931: Improve error message when the user types 'import x from y' instead of 'from y import x' (#98932) 2022-11-01 13:01:20 +00:00
Jelle Zijlstra 5cf317ade1
gh-98658: Add __class_getitem__ to array.array (#98661)
Closes #98658
2022-10-31 21:10:18 -07:00
partev f4d56292e9
Fix wording in Functional Programming HOWTO (GH-98939) 2022-10-31 21:49:27 -05:00
Manuel Kaufmann d22bde983e
Missing PS1 prompt in tutorial example (GH-98921) 2022-10-31 21:24:26 -05:00
Steve Dower 88297e2a8a
gh-98692: Enable treating shebang lines as executables in py.exe launcher (GH-98732) 2022-10-31 21:05:50 +00:00
partev 3b86538661
Fix typo in sorting HOWTO (#98888) 2022-10-31 12:58:13 -05:00
Julien Palard c1c3be0f9d
Doc: Fix sphinx-lint issues (GH-98911)
They were introduced right between GH-98441 and GH-98408.
2022-10-31 16:30:29 +01:00
Shantanu 880bafc574
gh-98576: Fix types in dataclass.InitVar example (gh-98577) 2022-10-31 11:02:02 -04:00
David Hewitt e98923c0be
gh-98410: move getbufferproc and releasebufferproc to buffer.h (#31158)
This adds them to the Limited API.
2022-10-31 15:01:32 +01:00
Jason R. Coombs 018b2483c4
gh-97966: Update uname docs to clarify the special nature of the platform attribute and to indicate when it became late-bound. (#97972) 2022-10-30 11:53:58 -04:00
ab fc94d55ff4
glossary.rst: Fix typo in package definition (GH-98865)
This is a tiny typo fix of package definition in glossary. 
According to https://devguide.python.org/documentation/help-documenting/ simple typos don’t require issues of their own, but, instead, a pull request can by submitted directly.

Automerge-Triggered-By: GH:AlexWaygood
2022-10-29 15:42:59 -07:00
Yuvi Panda bfecff5f73
Fix typo in docs (GH-98863) 2022-10-29 15:44:06 -05:00
Erlend E. Aasland e063c23c65
gh-93358: Fix python-config docs for how to embed Python (#98649) 2022-10-29 20:46:34 +02:00
FC Stegerman d10c2b9742
dataclasses docs: consistent indentation (4 spaces) in examples (#98855) 2022-10-29 18:06:52 +01:00
Mateusz 0023f51deb
gh-98240: Updated Path.rename docs, when it is atomic (GH-98245) 2022-10-28 16:31:37 -07:00
domragusa e089f23bbb
gh-84538: add strict argument to pathlib.PurePath.relative_to (GH-19813)
By default, :meth:`pathlib.PurePath.relative_to` doesn't deal with paths that are not a direct prefix of the other, raising an exception in that instance. This change adds a *walk_up* parameter that can be set to allow for using ``..`` to calculate the relative path.

example:
```
>>> p = PurePosixPath('/etc/passwd')
>>> p.relative_to('/etc')
PurePosixPath('passwd')
>>> p.relative_to('/usr')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pathlib.py", line 940, in relative_to
    raise ValueError(error_message.format(str(self), str(formatted)))
ValueError: '/etc/passwd' does not start with '/usr'
>>> p.relative_to('/usr', strict=False)
PurePosixPath('../etc/passwd')
```


https://bugs.python.org/issue40358

Automerge-Triggered-By: GH:brettcannon
2022-10-28 16:20:14 -07:00
cburroughs 72fa57a8fe
Fix typo in contextvars docs (#98823) 2022-10-28 22:13:48 +01:00
Skip Montanaro b27b57c6e4
`argparse` docs: normalize constant references (#98765) 2022-10-28 13:15:39 +01:00
Nikita Sobolev c144e57b31
gh-98657: [docs] `array.typecodes` is a module-level attribute (#98729)
* gh-98657: [docs] `array.typecodes` is a module-level attribute

* Update array.rst
2022-10-28 12:26:01 +02:00
Stanley 8cd21c2c5d
gh-65002: Make note that null bytes are used to pad bytes (#98635) 2022-10-28 12:21:28 +02:00
Erlend E. Aasland 723ebe76e7
gh-96143: Improve perf profiler docs (#96445) 2022-10-27 14:06:48 +01:00
Mark Shannon 22863df7ca
GH-96793: Change `FOR_ITER` to not pop the iterator on exhaustion. (GH-96801)
Change FOR_ITER to have the same stack effect regardless of whether it branches or not.
Performance is unchanged as FOR_ITER (and specialized forms jump over the cleanup code).
2022-10-27 11:55:03 +01:00
Wenzel Jakob e60892f9db
gh-98586: Add vector call APIs to the Limited API (GH-98587)
Expose the facilities for making vector calls through Python's limited API.
2022-10-27 11:45:42 +02:00
Gerardwx d578aaea62
Python documents state elsewhere that a comma is not an operator, so … (GH-98736)
…calling it an operator here is confusing. See https://docs.python.org/3/reference/lexical_analysis.html#operators and https://docs.python.org/3/faq/programming.html#id22.
2022-10-26 23:33:42 -07:00
Eric Snow f32369480d
gh-98608: Change _Py_NewInterpreter() to _Py_NewInterpreterFromConfig() (gh-98609)
(see https://github.com/python/cpython/issues/98608)

This change does the following:

1. change the argument to a new `_PyInterpreterConfig` struct
2. rename the function to `_Py_NewInterpreterFromConfig()`, inspired by `Py_InitializeFromConfig()` (takes a `_PyInterpreterConfig`  instead of `isolated_subinterpreter`)
3. split up the boolean `isolated_subinterpreter` into the corresponding multiple granular settings
   * allow_fork
   * allow_subprocess
   * allow_threads
4. add `PyInterpreterState.feature_flags` to store those settings
5. add a function for checking if a feature is enabled on an opaque `PyInterpreterState *`
6. drop `PyConfig._isolated_interpreter`

The existing default (see `Py_NewInterpeter()` and `Py_Initialize*()`) allows fork, subprocess, and threads and the optional "isolated" interpreter (see the `_xxsubinterpreters` module) disables all three.  None of that changes here; the defaults are preserved.

Note that the given `_PyInterpreterConfig` will not be used outside `_Py_NewInterpreterFromConfig()`, nor preserved.  This contrasts with how `PyConfig` is currently preserved, used, and even modified outside `Py_InitializeFromConfig()`.  I'd rather just avoid that mess from the start for `_PyInterpreterConfig`.  We can preserve it later if we find an actual need.

This change allows us to follow up with a number of improvements (e.g. stop disallowing subprocess and support disallowing exec instead).

(Note that this PR adds "private" symbols.  We'll probably make them public, and add docs, in a separate change.)
2022-10-26 11:16:30 -06:00
Erlend E. Aasland 365852a03a
gh-98716: Revert gh-96081: Escape lone stars in sqlite3 docs (#98720) 2022-10-26 16:53:46 +02:00
Philipp A 5e74bad93c
gh-98644: point people to tomllib from configparser’s docs (#98645)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-26 07:06:20 -07:00
fancidev 216f45e4fe
gh-98348: Mention ReferenceError in weakref.proxy documentation (#98355) 2022-10-25 20:48:24 -07:00
Stanley 268129a74f
docs: Change links to label refs (#98454)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-25 20:26:28 -07:00
Stanley 0ca6a4d640
gh-77753: Add example for values that compare equal in stdtypes (#98497)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-25 19:54:27 -07:00
Stanley 4196ee5c8b
gh-84747: Add `async for` comment for StreamReader (#98633) 2022-10-25 19:16:18 -07:00
July Tikhonov 45644905ea
fix a typo in whatsnew/3.11 (#98603) 2022-10-25 16:42:54 -07:00
Jacob Walls faea6a131a
Fix typos in deprecation section of 3.11 What's New (#98628) 2022-10-25 16:35:53 -07:00
Jelle Zijlstra 5d8bf2b106
gh-97937: dis docs: add adaptive=False (#97939)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2022-10-25 15:58:04 -07:00
Eclips4 be0cf82ae4
gh-98602: [typing docs] Use quotes for forward reference in TypeVarTuple example (#98605) 2022-10-25 16:32:52 +01:00
Nikita Sobolev 5076108872
gh-98623: Fix base classes in `typing.rst` (#98626) 2022-10-25 07:06:13 -07:00
C.A.M. Gerlach dd13b23e49
gh-95913: Prepare Improved Modules in 3.11 WhatsNew for final edits (#98631)
* Add two line breaks and ref target labels to remaining subsections

* Fix a few out of order Improved Modules

* Fix a few minor textual formatting issues in sections

* Fix remaining Sphinx warnings in the Improved Modules section
2022-10-25 06:19:44 -07:00
Nikita Sobolev e3b9dd8e87
gh-98507: [typing docs] Rephrase "now supports `[]`" to "now supports subscripting" (#98508) 2022-10-24 19:10:25 +01:00
Kumar Aditya 2fdcc6f2cb
GH-91635: clarify docs about closing of transport in asyncio (#98563) 2022-10-24 10:52:02 -07:00
Nikita Sobolev 1a217f9ffc
gh-98500: Fix typing docs for `*View` classes (#98511) 2022-10-24 10:47:32 -07:00
Jelle Zijlstra c5a9d3f67f
gh-95913: Fix grammar for SpooledTemporaryFile 3.11 whatsnew entry (#98604)
Followup from #98312.
2022-10-24 09:45:43 -07:00
Johnny11502 c237076379
gh-97909: Mark up members of PyMemberDef (GH-98473)
Co-authored-by: T <tnie@tuta.io>
2022-10-24 16:13:38 +02:00
C.A.M. Gerlach e19c2b979f
gh-95913: Fix, sort & expand pending removal sect in 3.11 WhatsNew (GH-98583)
* Fix names/references of pending removal APIs

* Sort list of APIs pending removal alphabetically

* Add missing modules/submodules pending removal in 3.12

* Add table of unittest deprecated aliases to 3.11 What's New

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2022-10-24 15:35:28 +02:00
C.A.M. Gerlach f3f8b6fca5
gh-95913: Add io support for SpooledTemporaryFile in 3.11 Whatsnew (#98312) 2022-10-24 06:05:14 -07:00
C.A.M. Gerlach dfb5d272e6
gh-95913: Edit & expand Deprecated section of 3.11 WhatsNew (#98581)
* Refine Sphinx syntax and grammar/phrasing in Deprecated section items
* Organize into lang/builtins, modules & stdlib sections
* Convert PEP 594 module list into a grid to not waste as much space
* Add importlib.resources deprecated functions to section
2022-10-24 05:58:27 -07:00
C.A.M. Gerlach 22739a0e05
gh-95913: Edit, expand & format Bytecode sect in 3.11 WhatsNew (GH-98559) 2022-10-24 13:51:25 +01:00
C.A.M. Gerlach e81fad6b8a
gh-95913: Edit, link and sort 3.11 WhatsNew Build section (#98588) 2022-10-24 13:34:05 +01:00
C.A.M. Gerlach 43bef54a32
gh-95913: Edit, sort & expand 3.11 WhatsNew Porting section (#98585) 2022-10-24 13:33:31 +01:00
C.A.M. Gerlach 8dbec4dbe5
gh-95913: Edit, xref & sort 3.11 WhatsNew Removed section (#98584) 2022-10-24 13:33:16 +01:00
C.A.M. Gerlach e2dc223004
gh-95913 Add string section to Whatsnew with new Template methods (#98311) 2022-10-24 13:33:04 +01:00
Serhiy Storchaka 75a6fadf36
gh-91524: Speed up the regular expression substitution (#91525)
Functions re.sub() and re.subn() and corresponding re.Pattern methods
are now 2-3 times faster for replacement strings containing group references.

Closes #91524

Primarily authored by serhiy-storchaka Serhiy Storchaka
Minor-cleanups-by: Gregory P. Smith [Google] <greg@krypto.org>
2022-10-23 15:57:30 -07:00
Omkaar b6d5d5b60a
gh-98561: Fix a typo in typing (GH-98562) 2022-10-23 22:05:08 +08:00
wim glenn 833f275840
no-issue: typo fix in c-api/tuple.rst (gh-98560) 2022-10-23 19:46:56 +09:00
C.A.M. Gerlach f58631be11
gh-95913: Edit & expand Optimizations in 3.11 WhatsNew (#98426) 2022-10-22 20:14:11 +01:00
C.A.M. Gerlach 8f30267ab4
gh-95913: Copyedit & xref FrameInfo in Whatsnew inspect section (#98304) 2022-10-22 20:12:04 +01:00
Clément Robert 327fc1c6fa
[Enum docs]: fix order of arguments to isinstance() (#98542) 2022-10-22 12:29:00 +01:00
Stanley d9407b174c
gh-51511: Note that codecs.open()'s encoding parameter affects automatic conversion to binary mode (#94370) 2022-10-21 16:01:05 -07:00
Furkan Onder 4c1145bb37
bpo-2716: add license for audioop module (#19972) 2022-10-21 15:43:20 -07:00
Ethan Furman 3e95ffc7ae
gh-98298: [Enum] document ReprEnum, global_enum, and show_flag_values (GH-98455)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-21 15:36:41 -07:00
Carl Meyer 82ccbf69a8
gh-91051: allow setting a callback hook on PyType_Modified (GH-97875) 2022-10-21 14:41:51 +01:00
Irit Katriel 8367ca136e
gh-98172: [doc] mention that except* handles naked exceptions (GH-98496) 2022-10-21 11:35:20 +01:00
Vinay Sajip a956c2fd55
[doc] Improve logging cookbook example. (GH-98481) 2022-10-20 12:46:03 +01:00
Noam Cohen a371a7e03e
gh-95023: Added os.setns and os.unshare functions (#95046)
Added os.setns and os.unshare to easily switch between namespaces
on Linux.

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-20 11:08:54 +02:00
Rafael Fontenelle 52fcba6512
Doc: Remove title text from internal links (#98409)
Rely on the title of the linked internal page instead of putting the title. Sphinx will render with the title correctly, and this will reduce work for translators
2022-10-19 08:36:07 -07:00
Phil Elson 1a6bacb31f
[doc] Refresh the venv introduction documentation, and correct the statement about VIRTUAL_ENV (GH-98350)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-19 15:49:34 +01:00
Hugo van Kemenade 50553004fe
Docs: Bump sphinx-lint and fix unbalanced inline literal markup (#98441)
Bump sphinx-lint and fix unbalanced inline literal markup
2022-10-19 14:00:28 +02:00
C.A.M. Gerlach ed827d5608
gh-95913: Edit zipfile Whatsnew section & add new APIs (#98314)
* Link ZipFile in What's New entry discussing it

* Add entry for new ZipFile.mkdir method

* Add entry for new zipfile.Path.stem/suffix/suffixes methods

* Add missing line breaks between zipfile bullet list items
2022-10-19 06:33:50 +02:00
C.A.M. Gerlach 251b8ccd2a
gh-95913: Add WhatsNew section for new logging APIs (#98320)
* Add entry for new logging.getLevelNamesMapping function

* Add entry for SysLogHandler.createSocket to whatsnew

* Add missing line break between logging bullet list items
2022-10-19 06:25:58 +02:00
Raymond Hettinger a53f637368
Fix markup indentation (GH-98424)
Fix markup
2022-10-18 20:14:41 -05:00
C.A.M. Gerlach fcae1954a2
gh-95914: Add links to 3.11 WhatsNew Summary items (#98416)
Add links to Summary items to where readers can learn more
2022-10-19 01:10:35 +02:00
Raymond Hettinger f4ead4874b
General improvements to the itertools docs (GH-98408) 2022-10-18 14:09:34 -05:00
Victor Stinner db03c8066a
gh-98393: os module reject bytes-like, only accept bytes (#98394)
The os module and the PyUnicode_FSDecoder() function no longer accept
bytes-like paths, like bytearray and memoryview types: only the exact
bytes type is accepted for bytes strings.
2022-10-18 17:52:31 +02:00
Julien Palard 2eb503e4dd
Doc: Found some remaining default roles. (GH-98392) 2022-10-18 15:46:18 +02:00
Julien Palard 0bbea545e3
Doc: missing underscore in hyperlink. (GH-98391) 2022-10-18 15:28:19 +02:00
C.A.M. Gerlach 73e5180faf
gh-95913: Copyedit, xref and organize enum section (#98295)
* Whatsnew: Convert literals in enum section to actual x-references

* Whatsnew: Rewrite enum section for clear and consistant phrasing

* Whatsnew: Combine directly related enum items instead of seperating them

* gh-98250: Describe __str__/__format__ changes more clearly/accurately

* Tweak enum section language per feedback from Ethan
2022-10-18 11:26:24 +02:00
C.A.M. Gerlach 0a0c7e5a7a
gh-95913: Prepare remaining Whatsnew sections for editing (#98342)
* Add line breaks & ref targets to Whatsnew to prepare for future changes

* Use standard heading underbar symbols for H4 sections

* Flatten Porting subsection; clarify scope of/link Python->CAPI sections

* Move C API pending deprecations to C API section, to match the others
2022-10-18 10:41:57 +02:00
Raymond Hettinger de3ece769a
GH-98363: Add itertools.batched() (GH-98364) 2022-10-17 18:53:45 -05:00
Raymond Hettinger 70732d8a4c
Move random selection recipes from itertools.rst to random.rst (GH-98369) 2022-10-17 17:30:49 -05:00
C.A.M. Gerlach 5fe0431474
gh-95913: Move subinterpreter exper removal to 3.11 WhatsNew (GH-98345)
Part of #95913
Forward port of #93306, which was a backport of #93185, to address #84694

This adds the What's New entry for the removal of the subinterpreter-related env variable, build-time flag, etc. As @ericsnowcurrently  was author of the original changes, I added him as a co-author to the commit.

This addition to the Python 3.11 What's New document were only made to the Python 3.11 branch during the backport process, and not added to the version in `main`. Forward-porting it ensures the docs retain these additions for the future, rather than being lost in a legacy Python versions, allows it to be be edited as part of #95913 , and avoids merge conflicts with routine back-ports of PRs touching it.

I've pulled in the addition exactly as-is with no modifications; any editing will be done in future PRs (and therefore can be reviewed and backported accordingly).

The one other such addition is forward-ported in #98344
2022-10-17 12:59:22 -07:00
C.A.M. Gerlach aafc53c0a6
gh-95914: Add What's New item describing PEP 670 changes (#98315) 2022-10-17 21:16:37 +02:00
Victor Stinner 1863302d61
gh-97669: Create Tools/build/ directory (#97963)
Create Tools/build/ directory. Move the following scripts from
Tools/scripts/ to Tools/build/:

* check_extension_modules.py
* deepfreeze.py
* freeze_modules.py
* generate_global_objects.py
* generate_levenshtein_examples.py
* generate_opcode_h.py
* generate_re_casefix.py
* generate_sre_constants.py
* generate_stdlib_module_names.py
* generate_token.py
* parse_html5_entities.py
* smelly.py
* stable_abi.py
* umarshal.py
* update_file.py
* verify_ensurepip_wheels.py

Update references to these scripts.
2022-10-17 12:01:00 +02:00
C.A.M. Gerlach bb38b39b33
gh-95913: Forward-port int/str security change to 3.11 What's New in main (#98344)
Add int/str security change from issue gh-95778 PRs gh-96499 / gh-95800

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
2022-10-16 18:43:13 -07:00
Raymond Hettinger ae19217867
GH-91415: Mention alphabetical sort ordering in the Sorting HOWTO (GH-98336) 2022-10-16 14:34:25 -05:00
Joannah Nanjekye 5c9302d03a
gh-85525: Remove extra row in doc (#98337)
* remove extra row

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2022-10-16 13:43:31 -04:00
Stanley 79fd6ccdbe
gh-85299: Add note warning about entry point guard for asyncio example (#93457) 2022-10-16 10:04:43 -07:00
Vinay Sajip f6b1e4048d
gh-98307: Add docstring and documentation for SysLogHandler.createSocket (GH-98319)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-16 09:15:46 +01:00
Kumar Aditya 660f10248b
GH-94597: Deprecate child watcher getters and setters (#98215)
This is the next step for deprecating child watchers.

Until we've removed the API completely we have to use it, so this PR is mostly suppressing a lot of warnings when using the API internally.

Once the child watcher API is totally removed, the two child watcher implementations we actually use and need (Pidfd and Thread) will be turned into internal helpers.
2022-10-15 16:09:30 -07:00
Raymond Hettinger 3a639bbeac
Improve speed. Reduce auxiliary memory to 16.6% of the main array. (GH-98294) 2022-10-15 16:05:28 -05:00
Vinay Sajip 11c25a402d
[doc] Update logging cookbook with an example of custom handling of levels. (GH-98290)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-15 21:23:06 +01:00
Simon Legner 02389658a4
docs(typing): harmonize "See PEP x for more details" (#97927) 2022-10-15 12:17:51 -07:00
Raymond Hettinger f4370318d6
Faster sieve() recipe (#98287) 2022-10-15 12:43:58 -05:00
BiscuitCandy 146f168fbf
gh-98227: executionmodel.rst: except* can also bind names (#98256)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-15 09:04:08 -07:00
QuakeIV 4e2bd58af4
gh-96258: move Py_REFCNT and Py_SET_REFCNT to reference counting page (#96259) 2022-10-15 07:56:14 -07:00
Joannah Nanjekye bf786e6901
gh-85455: Add missing doc strings and improve docs (#21573)
* Add missing doc strings and improve docs

* Use imperative form

* Modify docstring wording
2022-10-15 09:31:06 -04:00
Joannah Nanjekye 05c042e707
gh-85525: Indicate supported sound header formats (#21575)
* Indicate supported sound header formats

* modify file names

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-15 09:30:05 -04:00
Julien Palard 3c4cbd177f
gh-91485: Doc: Using Python syntax to document builtin Python functions. (GH-96579) 2022-10-15 12:19:35 +02:00
Nikita Sobolev 4414586172
Mark all targets in `Doc/Makefile` as `PHONY` (GH-98189) 2022-10-12 21:40:47 +02:00
Stanley e9569ec43e
gh-96265: Formatting changes for faq/general (#98129)
* Some formatting changes for general faq

* Use list for Python versioning

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>

* New line for list, list for a/b/rc

* Line wrap for 80 chars

* More line wrap

* Remove PythonWin mention.

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-12 18:04:41 +02:00
Jelle Zijlstra 5f8ca1b796
tutorial: remove "with single quotes" (#98204)
Closes #91856.

On Windows double quotes are sometimes better, on Unix usually
single quotes. It's not our place to explain that, so just don't.
2022-10-12 09:00:51 -07:00
Shantanu c39a0c3354
gh-65046: Link to logging cookbook from asyncio docs (#98207) 2022-10-11 21:42:57 -07:00
Stanley 3b33c2010a
Formatting fixes in contextlib docs (#98111) 2022-10-11 20:56:32 -07:00
MonadChains e3bf125c81
gh-95276: Add callable entry to the glossary (#95738) 2022-10-11 19:41:08 -07:00
Shantanu ed6344eed0
gh-96130: Rephrase use of "typecheck" verb for clarity (#98144)
I'm sympathetic to the issue report, especially in case this helps
clarify to new users that Python itself does not do type checking at runtime
2022-10-11 19:37:58 -07:00
Jelle Zijlstra 5ecf961640
gh-98172: Fix formatting in `except*` docs (#98173) 2022-10-11 09:13:56 -07:00
Julien Palard 4067c6d7fe
gh-86404: Doc: Drop now unused make suspicious and rstlint. (GH-98179)
They have been replaced by
[sphinx-lint](https://github.com/sphinx-contrib/sphinx-lint).
2022-10-11 15:31:33 +02:00
Stanley f0a680007f
gh-71616: Add note to warn against general translation of saxutils.escape() (#93450)
* Add note to warn against general translation of saxutils.escape()

* Use more direct wording
2022-10-11 05:27:49 -04:00
Vinay Sajip 6a757da080
gh-88452: Add a warning about non-portability of environments. (GH-98155) 2022-10-10 19:27:52 +01:00
Stanley 187e853690
gh-83940: os docs: Improve wording for getenv/getenvb (#98113) 2022-10-10 06:43:01 -07:00
Julien Palard 571e23d991
doc: remove a misleading statement. (GH-98093) 2022-10-10 09:01:16 +02:00
da-woods c459fedf7c
Fix types in buffer/memoryview docs (#98118)
The definition of obj in the `Py_buffer` struct is as a PyObject*
ec091bd47e/Include/pybuffer.h (L22)

PyMemoryView_GET_BASE returns `.obj` - thus its return type
should be a PyObject* (or at least a void*). It definitely
doesn't return `Py_buffer`
2022-10-09 17:55:53 -07:00
Stanley 281a3f18cc
gh-56133: copyreg docs: Clarify function/constructor parameter (#95497) 2022-10-09 17:51:02 -07:00
Carl Meyer f1879690aa
Update whatsnew instructions for GitHub (#98124) 2022-10-10 00:29:25 +02:00
Géry Ogam 2d2e01aa4c
Minor edits to the Descriptor HowTo Guide (GH-24901)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2022-10-08 20:54:21 -05:00
Kumar Aditya d8765284f3
GH-94597: deprecate `SafeChildWatcher`, `FastChildWatcher` and `MultiLoopChildWatcher` child watchers (#98089) 2022-10-08 13:52:19 -07:00
Pablo Galindo Salgado 83eb827247
gh-97922: Run the GC only on eval breaker (#97920) 2022-10-08 07:57:09 -07:00
Hugo van Kemenade 296313002f
gh-97913 Docs: Add walrus operator to the index (#97921)
* Add walrus operator to the index

* Add named expression to the index

Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com>

* Fix indentation and add missing newline

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>

Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-10-08 08:54:16 +02:00
partev 840fd19590
[doc] Fix broken links to C extensions accelerating stdlib modules (#96914)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-07 22:55:35 -07:00
JasonYZ 6b485629d2
gh-97822: Fix http.server documentation reference to test() function (#98027)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-07 21:46:23 -07:00
Carl Meyer e82d977eb0
gh-91052: Add PyDict_Unwatch for unwatching a dictionary (#98055) 2022-10-07 17:37:46 -07:00
Stanley 0f498f1a95
gh-57179: Add note on symlinks for os.walk (#94799) 2022-10-07 15:51:50 -07:00
Stanley 5eaf4d6101
gh-61105: Add default param, note on using cookiejar subclass (#95427) 2022-10-07 15:21:13 -07:00
Jelle Zijlstra 0f111f53c1
gh-96073: fix backticks in NEWS entry (GH-98056)
Automerge-Triggered-By: GH:JelleZijlstra
2022-10-07 14:44:56 -07:00
Stanley eed80458e8
gh-91708: Revert params note in urllib.parse.urlparse table (#96699)
Revert params note in urllib.parse.urlparse table
2022-10-07 12:19:36 -07:00
Stanley 3a7e955858
gh-96265: Fix some formatting in faq/design.rst (#96924)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-10-07 12:15:41 -07:00
Stanley fde74be61b
gh-73196: Add namespace/scope clarification for inheritance section (#92840)
Add namespace/scope clarification for inheritance section
2022-10-07 12:04:14 -07:00
Nikita Sobolev 586cfb0131
gh-97956: Mention `generate_global_objects.py` in `AC How-To` (#97957) 2022-10-07 11:54:45 -07:00
180909 c81c64ca58
gh-96959: Update HTTP links which are redirected to HTTPS (#98039) 2022-10-07 11:52:45 -07:00
Eric Wieser c7b2204996
Add a warning message about PyOS_snprintf (#95993) 2022-10-07 11:49:53 -07:00
Stanley 676d8ef380
gh-65496: Correct wording on csv's skipinitialspace argument (#96170) 2022-10-07 11:15:34 -07:00
Stanley 4a74e6ab38
gh-64921: Clarify wording for open()'s newline arg (#96171) 2022-10-07 11:12:08 -07:00
Victor Stinner 002252c4ad
gh-97669: Move difflib examples to Doc/includes/ (#97964)
Remove diff.py and ndiff.py scripts of Tools/scripts/: move them to
Doc/includes/.

* diff.py and ndiff.py files are no longer executable. Remove also
  their shebang ("#!/usr/bin/env python3").
* Remove the -profile command from ndiff.py to simply the code.
* Remove ndiff.py copyright and history command. The Python
  documentation examples are distributed under the "Zero Clause BSD
  License".
2022-10-07 10:57:48 -07:00