summaryrefslogtreecommitdiffstats
path: root/Doc/reference
Commit message (Collapse)AuthorAgeFilesLines
* gh-86298: Ensure that __loader__ and __spec__.loader agree in ↵Barry Warsaw2022-10-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Docs: Fix backtick errors found by sphinx-lint (#97998)Hugo van Kemenade2022-10-073-10/+2
| | | Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
* gh-97850: Remove the open issues section from the import reference (#97935)Brett Cannon2022-10-061-19/+0
| | | | | Remove the open issues section from the import reference Tracking in https://github.com/python/cpython/issues/97850 instead.
* gh-86482: Document assignment expression need for ()s (#23291)Terry Jan Reedy2022-10-061-0/+7
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-65961: Raise `DeprecationWarning` when `__package__` differs from ↵Brett Cannon2022-10-051-6/+24
| | | | | | | `__spec__.parent` (#97879) Also remove `importlib.util.set_package()` which was already slated for removal. Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768)Adam Turner2022-10-051-1/+1
| | | | | :c:type:`<C type>` -> :c:expr:`<C type>` Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-95975: Move except/*/finally ref labels to more precise locations (#95976)C.A.M. Gerlach2022-10-021-45/+76
| | | | | | | | | | | | | | | | | | | * gh-95975: Move except/*/finally ref labels to more precise locations * Add section headers to fix :keyword: role and aid navigation * Move see also to the introduction rather than a particular subsection * Fix other minor Sphinx syntax issues with except Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> * Suppress redundant link to same section for except too * Don't link try/except/else/finally keywords if in the same section * Format try/except/finally as keywords in modified sections Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
* gh-96348: Deprecate the 3-arg signature of coroutine.throw and ↵Ofey Chan2022-09-302-1/+17
| | | | generator.throw (GH-96428)
* Fix docs on conditional expression grouping (GH-96447)Andrew Kay2022-09-281-1/+1
|
* gh-96397: Document that keywords in calls need not be identifiers (#96393)Jeff Allen2022-09-221-2/+12
| | | | This represents the official SC stance, see https://github.com/python/steering-council/issues/142#issuecomment-1252172695
* closes gh-96734: Update to Unicode 15.0.0. (GH-96809)Benjamin Peterson2022-09-131-4/+4
|
* GH-96359: Fix docs that claim int(0|1) doesn't match False (GH-96361)Jonathan Oberländer2022-08-281-1/+1
|
* gh-95994: Clarify escaped newlines. (#96066)Ezio Melotti2022-08-261-11/+22
| | | | | | | | | | | | | * gh-95994: clarify escaped newlines. * Rephrase ambiguous sentence. Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> * Use `<newline>` in escape sequences table. Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
* gh-94619: Remove long deprecated methods module_repr() and load_module() ↵Barry Warsaw2022-08-051-16/+4
| | | | | | | | | | | | | | | (#94624) * gh-94619: Remove long deprecated methods module_repr() and load_module() Closes #94619 * Update Misc/NEWS.d/next/Library/2022-07-06-14-57-33.gh-issue-94619.PRqKVX.rst Fix typo Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Brett Cannon <brett@python.org>
* gh-91838: Use HTTPS links in docs for resources which redirect to HTTPS ↵Serhiy Storchaka2022-08-041-3/+3
| | | | | | | | | | (GH-95527) If an HTTP link is redirected to a same looking HTTPS link, the latter can be used directly without changes in readability and behavior. It protects from a men-in-the-middle attack. This change does not affect Python examples.
* Fix async method reference links in `compound_stmts` docs (GH-94935)July Tikhonov2022-07-221-2/+2
|
* gh-91181: drop support for bytes on sys.path (GH-31934)Thomas Grainger2022-07-171-4/+2
| | | | | | Support for bytes broke sometime between Python 3.2 and 3.6 and has been broken ever since. Trying to bring back supports is surprisingly difficult in the face of -b and checking for keys in sys.path_importer_cache. Since the support was broken for so long, trying to overcome the difficulty of bringing back the support has been deemed not worth it. Co-authored-by: Eryk Sun <eryksun@gmail.com> Co-authored-by: Brett Cannon <brett@python.org>
* Docs: remove redundant "adverb-adjective" hyphens from compound modifiers ↵Ned Batchelder2022-07-053-4/+4
| | | | | (GH-94551) Discussion: https://discuss.python.org/t/slight-grammar-fix-throughout-adverbs-dont-need-hyphen/17021
* gh-93675: Fix typos in `Doc/` (GH-93676)luzpaz2022-06-211-1/+1
| | | Closes #93675
* bpo-45393: help() on operator precedence has misleading entries (GH-31246)Zackery Spytz2022-05-191-2/+2
| | | | Fix the formatting for "await x" and "not x" in the operator precedence table.
* gh-80143: Add clarification for escape characters (#92292)slateny2022-05-101-3/+7
|
* gh-87304: Improve comments in language reference for imports (#92164)Robert Yang2022-05-031-3/+3
|
* gh-81548: Deprecate octal escape sequences with value larger than 0o377 ↵Serhiy Storchaka2022-04-301-0/+5
| | | | (GH-91668)
* bpo-21761: Clarify __file__/__cached__ in import reference (GH-31565)slateny2022-04-261-4/+5
| | | Automerge-Triggered-By: GH:brettcannon
* gh-89885: Improve import example in language reference (#91523)slateny2022-04-171-6/+4
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* Language reference: Remove duplicated text about iterable unpacking (GH-25212)Jiashuo Li2022-04-031-3/+1
|
* bpo-46033: Clarify for-statement execution (GH-30025)Michał D2022-04-031-11/+8
| | | | Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-24563: Link encoding names to encoding declarations (GH-32274)Terry Jan Reedy2022-04-031-3/+2
|
* bpo-14911: Corrected generator.throw() documentation (GH-32207)Dave Goncalves2022-03-312-3/+17
| | | Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-12029: [doc] clarify that except does not match virtual subclasses of ↵Irit Katriel2022-03-212-5/+7
| | | | the specified exception type (GH-32027)
* bpo-46013: Fix confusing kerning on period in docs (GH-29989)jmcb2022-03-201-1/+1
|
* Removed confusing reference to sys (GH-31638)David Gilbertson2022-03-081-3/+3
|
* Removed ambiguity in __init_subclass__ docs (GH-31540)David Gilbertson2022-03-081-1/+1
|
* bpo-45680: Improve docs on subscriptions w.r.t. `GenericAlias` objects ↵Alex Waygood2022-03-081-20/+30
| | | | (GH-29479)
* bpo-46725: Document starred expressions in for statements (GH-31481)Pablo Galindo Salgado2022-02-221-8/+13
| | | Automerge-Triggered-By: GH:pablogsal
* bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)Zackery Spytz2022-02-031-0/+3
| | | | | Calling int(a) when type(a) implements __trunc__ but not __int__ or __index__ now raises a DeprecationWarning.
* bpo-23556: [doc] Fix inaccuracy in documentation for raise without args. ↵Kinshuk Dua2022-01-271-8/+10
| | | | Improve tests for context in nested except handlers. (GH-29236)
* [doc]: Spotted errors while working on rstlint. (GH-30879)Julien Palard2022-01-271-1/+1
| | | | Also ignored some `make suspicious` false positives while assuring true positives were properly seen by rstlint.
* bpo-24650: Use full term "generator function" in yield expressions docs ↵Jacob Walls2022-01-071-2/+2
| | | | (GH-24663)
* bpo-45292: [PEP-654] exception groups and except* documentation (GH-30158)Irit Katriel2022-01-061-1/+47
|
* bpo-46095: Improve SeqIter documentation. (GH-30316)Raymond Hettinger2022-01-011-21/+0
|
* bpo-46076: Improve documentation for per-attribute docstrings with ↵Alex Waygood2021-12-191-3/+6
| | | | `__slots__` (GH-30109)
* Fix some false positives of documentation syntax problemsPablo Galindo2021-12-081-1/+1
|
* bpo-20751: Match variable name to the example. (GH-29980)Raymond Hettinger2021-12-081-4/+8
|
* bpo-45840: Improve cross-references in the data model documentation (GH-29633)Alex Waygood2021-12-051-54/+76
|
* bpo-20751: Replace method example with attribute example, matching the ↵Raymond Hettinger2021-12-041-4/+32
| | | | descriptor howto (GH-29909)
* bpo-45711: Change exc_info related APIs to derive type and traceback from ↵Irit Katriel2021-11-301-0/+6
| | | | the exception instance (GH-29780)
* bpo-45619: documentation of execution model: clarify and update binding ↵Arthur Milchior2021-11-261-9/+19
| | | | | | | | | | | summary (#29232) This does two changes that are quite related. 0. it add that variable binding can occur in pattern matching, an update of 3.10 which seems to have been omitted from the list of bindings 1. Given how long the sentence already was, with even subcases in the middle of the sentence, the commit breaks the sentence into an actual list.
* [doc] Clarify MRO precedence in descriptor super binding section (GH-29539)Jouke Witteveen2021-11-201-1/+1
| | | | A similar sentence is present in the 'Invocation from super' section of the descriptor HOWTO, where it is already correct.
* bpo-45250: fix docs regarding `__iter__` and iterators being inconsistently ↵Brett Cannon2021-11-201-14/+12
| | | | | required by CPython (GH-29170) It is now considered a historical accident that e.g. `for` loops and the `iter()` built-in function do not require the iterators they work with to define `__iter__`, only `__next__`.