Commit graph

25899 commits

Author SHA1 Message Date
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
Christopher Chianelli 6592a62ec2
gh-71316: Update dis documentation to include changes to jump arguments (GH-95798) 2022-10-07 14:54:21 +01:00
Raymond Hettinger e500cc0451
Misc updates to the itertools recipes and tests (GH-98018) 2022-10-07 03:37:21 -05:00
Julien Palard 66cc46b2e4
Doc: sphinx-lint finds two other default roles. (GH-98019) 2022-10-07 09:10:51 +02:00
Barry Warsaw 13d4489142
gh-86298: Ensure that __loader__ and __spec__.loader agree in warnings.warn_explicit() (GH-97803)
In `_warnings.c`, in the C equivalent of `warnings.warn_explicit()`, if the module globals are given (and not None), the warning will attempt to get the source line for the issued warning.  To do this, it needs the module's loader.

Previously, it would only look up `__loader__` in the module globals.  In https://github.com/python/cpython/issues/86298 we want to defer to the `__spec__.loader` if available.

The first step on this journey is to check that `loader == __spec__.loader` and issue another warning if it is not.  This commit does that.

Since this is a PoC, only manual testing for now.

```python
# /tmp/foo.py
import warnings

import bar

warnings.warn_explicit(
    'warning!',
    RuntimeWarning,
    'bar.py', 2,
    module='bar knee',
    module_globals=bar.__dict__,
    )
```

```python
# /tmp/bar.py
import sys
import os
import pathlib

# __loader__ = pathlib.Path()
```

Then running this: `./python.exe -Wdefault /tmp/foo.py`

Produces:

```
bar.py:2: RuntimeWarning: warning!
  import os
```

Uncomment the `__loader__ = ` line in `bar.py` and try it again:

```
sys:1: ImportWarning: Module bar; __loader__ != __spec__.loader (<_frozen_importlib_external.SourceFileLoader object at 0x109f7dfa0> != PosixPath('.'))
bar.py:2: RuntimeWarning: warning!
  import os
```

Automerge-Triggered-By: GH:warsaw
2022-10-06 19:32:53 -07:00
Hugo van Kemenade fa2d43e518
Docs: Fix backtick errors found by sphinx-lint (#97998)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2022-10-06 18:01:30 -07:00