Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
1981 commits
Select commit Hold shift + click to select a range
e2924c0
gh-102936: typing: document performance pitfalls of protocols decorat…
miss-islington Mar 23, 2023
202e16e
gh-98239: Document that `inspect.getsource()` can raise `TypeError` (…
miss-islington Mar 23, 2023
60b2b58
[3.11] Minor readability improvement to the factor() recipe (GH-10297…
miss-islington Mar 23, 2023
8132aef
gh-102558: [Enum] fix AttributeError during member repr() (GH-102601)
miss-islington Mar 23, 2023
a4a039c
GH-100989: Revert Improve the accuracy of collections.deque docstring…
miss-islington Mar 24, 2023
fd43fb6
GH-100989: remove annotation from docstring (GH-102991)
miss-islington Mar 24, 2023
e075631
[3.11] gh-96931: Fix incorrect results in ssl.SSLSocket.shared_cipher…
miss-islington Mar 24, 2023
6716139
[3.11] gh-102027: Fix macro name (GH-102124) (#102916)
miss-islington Mar 24, 2023
c834a4c
gh-102873: logging.LogRecord docs: improve description of `msg` param…
miss-islington Mar 24, 2023
a08b65f
gh-102980: Add tests for pdf's display, alias and where commands (GH-…
miss-islington Mar 24, 2023
85c686a
[3.11] gh-101100: Document PyObject_ClearWeakRefs, gzip's name, and a…
hugovk Mar 25, 2023
aae91fa
[3.11] gh-103025: fix a ctypes doc typo (GH-103026) (#103029)
miss-islington Mar 25, 2023
e1094c6
Update pdb docs for arguments (GH-102965)
miss-islington Mar 25, 2023
b28f919
[3.11] gh-102281: Fix potential nullptr dereference + use of uninitia…
maxbachmann Mar 25, 2023
13df5d3
[3.11] GH-95494: Fix transport EOF handling in OpenSSL 3.0 (GH-95495)…
miss-islington Mar 27, 2023
5ba5ce4
gh-102558: [Enum] better handling of non-Enum EnumType classes (GH-10…
miss-islington Mar 27, 2023
abd6e97
[3.11] GH-102711: Fix warnings found by clang (GH-102712) (#103075)
miss-islington Mar 28, 2023
766038d
gh-103054: typing: Improve `Callable` type substitution tests (GH-103…
miss-islington Mar 29, 2023
d189e2d
[3.11] gh-102582: Fix invalid JSON in Doc/howto/logging-cookbook.rst …
miss-islington Mar 29, 2023
cbe14c8
gh-103097: Add workaround for Windows ARM64 compiler bug (GH-103098)
zooba Mar 29, 2023
ae42c1d
[3.11] gh-103112: Add http.client.HTTPResponse.read docstring and fix…
miss-islington Mar 29, 2023
1b40618
gh-103099: Link mypy docs from typing.rst (GH-103100)
miss-islington Mar 30, 2023
41e3ea1
Minor docs improvements fix for `codeop` (GH-103123)
miss-islington Mar 30, 2023
4664a7c
Quote literal tokens in standard format specifier grammar (GH-102902)
miss-islington Mar 31, 2023
0854bdf
gh-103109: Document ignore_warnings() test support helper (GH-103110)
miss-islington Apr 2, 2023
8236222
gh-102994: Profile docs has typo in example (GH-103074)
miss-islington Apr 2, 2023
cf72cc2
gh-98298, gh-74730: [Enum] update docs (GH-103163)
miss-islington Apr 3, 2023
5342f5e
gh-102549: [Enum] fail enum creation when data type raises in __init_…
miss-islington Apr 3, 2023
6abd048
[3.11] gh-103207: Add instructions to the macOS installer welcome dis…
ned-deily Apr 4, 2023
f3909b8
Python 3.11.3
pablogsal Apr 4, 2023
6258c3c
Improve some grammar in the socket docs (GH-103254)
miss-islington Apr 4, 2023
ff844aa
Post 3.11.3
pablogsal Apr 5, 2023
bd769d7
Merge remote-tracking branch 'upstream/3.11' into 3.11
pablogsal Apr 5, 2023
9357fc9
gh-81762: Clarify and simplify description of print's flush param (GH…
miss-islington Apr 5, 2023
09fb27f
gh-102899: Fix doc link for getting filesystem error handler (GH-102901)
miss-islington Apr 5, 2023
851e744
gh-99069: Consolidate checks for static_assert (GH-94766)
miss-islington Apr 5, 2023
0291397
[3.11] gh-103207: Fix Welcome formatting issues when macOS Installer …
ned-deily Apr 6, 2023
58e330a
[3.11] gh-93910: [Enum] remove member.member deprecation (GH-103236) …
ethanfurman Apr 6, 2023
123680f
[3.11] GH-102700: allow built-in modules to be submodules (GH-103162)…
miss-islington Apr 6, 2023
bbe04d9
gh-103266: Fix a typo in example code for bisect() function (GH-103267)
miss-islington Apr 7, 2023
8740fd8
gh-103256: Fix hmac algorithm to support fallback implementation (gh-…
miss-islington Apr 7, 2023
ecb09a8
[3.11] bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (G…
ambv Apr 7, 2023
1b1f016
gh-74690: Add more tests for runtime-checkable protocols (GH-103347)
miss-islington Apr 7, 2023
b8d1623
gh-103272: regression test for getattr exception in property (GH-103336)
miss-islington Apr 7, 2023
70bc8c9
[3.11] GH-88013: Fix TypeError raised by ntpath.realpath in some case…
miss-islington Apr 7, 2023
29a1e89
gh-103329: Add regression test for PropertyMock with side effect (GH-…
miss-islington Apr 8, 2023
b4f3318
gh-75729: Fix os.spawn tests not handling spaces on Windows (GH-99150)
miss-islington Apr 8, 2023
31bec91
Docs: use Node.findall to avoid a deprecation warning (GH-99403)
miss-islington Apr 8, 2023
7b03d0f
gh-100574: add examples/links to the `strptime`/`strftime` docs (GH-1…
miss-islington Apr 8, 2023
77359a8
gh-103373: Improve documentation for `__mro_entries__` (GH-103374)
miss-islington Apr 8, 2023
4fa5fda
gh-103242: Migrate SSLContext.set_ecdh_curve not to use deprecated AP…
miss-islington Apr 8, 2023
da3b77b
CI: Do not allow merge if labelled DO-NOT-MERGE (GH-103337)
miss-islington Apr 9, 2023
4e284ff
gh-103395: Improve `typing._GenericAlias.__dir__` coverage (GH-103396)
miss-islington Apr 10, 2023
0f6319f
gh-97797: Mention `__metadata__` in docstrings of `typing.{_Annotated…
miss-islington Apr 10, 2023
b80e4c8
[3.11] gh-103059: Clarify gc.freeze documentation (GH-103058) (#103416)
miss-islington Apr 10, 2023
4a05392
Doc: Avoid error lexing multiprocessing docs code block on Pygments 2…
miss-islington Apr 11, 2023
a836d79
Docs: don't render files in includes/, they're for embedding only (GH…
miss-islington Apr 11, 2023
254494c
gh-99553: add tests for ExceptionGroup wrapping (GH-99615)
miss-islington Apr 11, 2023
07a2851
gh-103373: `__mro_entries__` docs: improve cross references (GH-103398)
miss-islington Apr 11, 2023
e715da6
gh-87864: Use correct function definition syntax in the docs (GH-103312)
miss-islington Apr 11, 2023
b5fe28d
gh-103237: Polish pdb docs (GH-103238)
miss-islington Apr 12, 2023
e643412
gh-103417: use time.monotonic in the example for sched.scheduler (GH-…
miss-islington Apr 12, 2023
804a973
gh-103365: [Enum] STRICT boundary corrections (GH-103494)
miss-islington Apr 13, 2023
3b929a7
[3.11] gh-103479: [Enum] require __new__ to be considered a data type…
ethanfurman Apr 13, 2023
2e0ead5
gh-103406: Modernize pos-only arguments usage in `test_signature` (GH…
miss-islington Apr 14, 2023
a3242c7
[3.11] gh-103180: Add CI timeouts to all GitHub Actions jobs (GH-1034…
sobolevn Apr 15, 2023
9f3f109
gh-103553: Improve `test_inspect`: add more assertions, remove unused…
miss-islington Apr 15, 2023
4c4ef50
GH-83893: Cross reference env. vars and -X command line options (GH-1…
miss-islington Apr 16, 2023
1dad3d1
GH-103484: Docs: add linkcheck allowed redirects entries for most cas…
miss-islington Apr 18, 2023
5a81a24
gh-103582: Remove last references to `argparse.REMAINDER` from docs (…
miss-islington Apr 19, 2023
2b5dbd1
Doc: Fix broken link to emscripten networking website (GH-99531)
miss-islington Apr 19, 2023
b2fdae9
[3.11] gh-103556: [inspect.Signature] disallow pos-or-kw params witho…
miss-islington Apr 22, 2023
7f6710b
[3.11] GH-103475: cache() and lru_cache() do not have a "call once" g…
miss-islington Apr 22, 2023
050b6b3
[3.11] Revert "Avoid error lexing multiprocessing docs code block on …
miss-islington Apr 22, 2023
a43dbe1
[3.11] gh-68654: Clarify subdirectories used by pkgutil.extend_path (…
miss-islington Apr 23, 2023
6e25228
[3.11] gh-81403: Fix for CacheFTPHandler in urllib (GH-13951) (#103705)
miss-islington Apr 23, 2023
ec29d0c
[3.11] gh-103449: Fix a bug in dataclass docstring generation (GH-103…
miss-islington Apr 23, 2023
4e9635e
[3.11] gh-103592: Add tests of `Literal` with `Enum` and `Union` of `…
miss-islington Apr 23, 2023
8642fdc
[3.11] GH-103484: Fix broken links reported by linkcheck (GH-103608) …
rffontenelle Apr 23, 2023
7b2ac6c
[3.11] gh-102310: Change error range for invalid bytes literals (GH-1…
miss-islington Apr 23, 2023
5054459
[3.11] gh-103668: Run pyugrade on idlelib (GH-103671) (#103730)
miss-islington Apr 24, 2023
dc08c7a
[3.11] gh-103685: Fix tkinter.Menu.index() for Tk 8.7 (GH-103686) (#1…
miss-islington Apr 24, 2023
16dabf9
[3.11] GH-78530: clarify docs for generators yielding tasks in `async…
kumaraditya303 Apr 24, 2023
e40db6e
[3.11] Descriptor HowTo: Update to include attributes added in Pytho…
miss-islington Apr 24, 2023
34df9e7
[3.11] Change 'dependant' to 'dependent' (GH-103745) (#103754)
miss-islington Apr 24, 2023
25406e5
[3.11] Add tests for empty range equality (GH-103751) (#103760)
miss-islington Apr 24, 2023
e0e1bee
[3.11] gh-103746: Test `types.UnionType` and `Literal` types together…
miss-islington Apr 24, 2023
a8489f7
[3.11] Revert "Add tests for empty range equality (GH-103751)" (GH-10…
miss-islington Apr 24, 2023
c8de883
[3.11] gh-99184: Bypass instance attribute access in `repr` of `weakr…
miss-islington Apr 24, 2023
6f92d3f
[3.11] gh-103765: Fix 'Warning: py:class reference target not found: …
miss-islington Apr 24, 2023
9f43643
[3.11] gh-101100: Fix Sphinx warnings in `argparse` module (#103289) …
hugovk Apr 24, 2023
56d50dd
[3.11] gh-103810: Fix broken references in dataclasses (GH-103811) (#…
ambv Apr 24, 2023
99db23d
[3.11] Also fail DO-NOT-MERGE when "awaiting changes" or "awaiting ch…
ambv Apr 25, 2023
a59dc1f
[3.11] gh-103559: Update bundled pip version to 23.1.1 (gh-103560) (#…
pfmoore Apr 25, 2023
03f8d8f
[3.11] ctypes docs: fix missing `not` in variadic functions section (…
miss-islington Apr 25, 2023
05a2586
[3.11] gh-87452: Improve the Popen.returncode docs (#103771)
miss-islington Apr 25, 2023
026c3e9
[3.11] gh-91687: modernize dataclass example typing (GH-103773) (#103…
miss-islington Apr 25, 2023
93a9535
[3.11] gh-101517: fix line number propagation in code generated for e…
iritkatriel Apr 25, 2023
d9aafe2
[3.11] gh-103721: Improve cross-references for generic-alias docs (GH…
miss-islington Apr 25, 2023
f11ba1c
[3.11] gh-103578: Fix pdb reading code with non-utf8 encoding (GH-103…
miss-islington Apr 26, 2023
57c9634
[3.11] gh-103872: Update bundled pip version to 23.1.2 (gh-103874)
pfmoore Apr 26, 2023
97711de
[3.11] Docs build: Add upper bounds to transitive dependencies (GH-10…
miss-islington Apr 26, 2023
bce93c2
[3.11] gh-101879: docs - italicize argument in smtplib.SMPT() descrip…
miss-islington Apr 26, 2023
410c2ce
[3.11] gh-94300: Update datetime.strptime documentation (GH-95318) (#…
miss-islington Apr 26, 2023
c0b538b
[3.11] gh-101786: Clarify docs that asyncio.Server.sockets is a socke…
hauntsaninja Apr 26, 2023
4041251
gh-103883: Doc: Move PyUnicode_FromObject doc (GH-103913)
methane Apr 27, 2023
2cd1b9c
[3.11] gh-103607: Fix `pause_reading` to work when called from `conne…
miss-islington Apr 27, 2023
7f70f1c
[3.11] gh-103880: Fix `assertRaises` usage in `test_genericalias` (GH…
sobolevn Apr 27, 2023
d20758c
[3.11] gh-51574: Document behaviour of `mkdtemp` on 3.11 and lower (#…
AlexWaygood Apr 27, 2023
838bc90
[3.11] gh-98822: Add missing test directories to TESTSUBDIRS (#103942…
erlend-aasland Apr 27, 2023
dbc44fa
[3.11] GH-103903: Test the minimum Sphinx version in CI (#103904) (#1…
AA-Turner Apr 27, 2023
57d198e
gh-103935: Use `io.open_code()` when executing code in trace and prof…
zooba Apr 27, 2023
294398c
[3.11] Docs: fix dunders with too many underscores (#103955) (#103957)
erlend-aasland Apr 27, 2023
b3faf8c
[3.11] gh-100021: Document that sqlite3's executemany() discards resu…
erlend-aasland Apr 28, 2023
241f2e5
[3.11] gh-102950: Implement PEP 706 – Filter for tarfile.extractall (…
encukou Apr 28, 2023
4219074
[3.11] gh-98822: Correct a few TESTSUBDIRS entries (GH-103970)
zware Apr 28, 2023
fee3c91
[3.11] GH-103971: Fix incorrect locations for code following case blocks
gaogaotiantian Apr 28, 2023
9fbb614
[3.11] gh-99032: datetime docs: Encoding is no longer relevant (GH-93…
miss-islington Apr 29, 2023
86ef1ce
[3.11] Fix description of MAKE_CELL (#103986)
hauntsaninja Apr 29, 2023
ba16324
[3.11] Update name in acknowledgements and add mailmap (GH-103696) (#…
miss-islington Apr 30, 2023
2be3656
[3.11] Improve int test coverage (GH-104024) (#104026)
miss-islington May 1, 2023
2e5f1a1
[3.11] gh-88496: Fix IDLE test hang on macOS (GH-104025) (#104027)
miss-islington May 1, 2023
d8055b8
[3.11] Adjust expression from `==` to `!=` in alignment with the mean…
miss-islington May 1, 2023
1be8bed
[3.11] gh-104036: Fix direct invocation of test_typing (GH-104037) (#…
miss-islington May 1, 2023
0df7c3a
[3.11] gh-104035: Do not ignore user-defined `__{get,set}state__` in …
miss-islington May 1, 2023
723aacb
[3.11] gh-100458: Clarify Enum.__format__() change of mixed-in types …
miss-islington May 1, 2023
10db28b
[3.11] gh-104018: disallow "z" format specifier in %-format of byte s…
miss-islington May 1, 2023
9f191a1
[3.11] gh-88496: IDLE - fix another test on macOS (GH-104075) (#104076)
miss-islington May 2, 2023
6805e49
[3.11] gh-102997: Update macOS installer to SQLite 3.41.2. (GH-104080)
miss-islington May 2, 2023
b07bae6
[3.11] Replace Netlify with Read the Docs build previews (#103843) (#…
hugovk May 2, 2023
0d40264
[3.11] GH-103472: close response in HTTPConnection._tunnel (GH-103473…
miss-islington May 2, 2023
3e7e50e
[3.11] Improve assert_type phrasing (GH-104081) (#104084)
miss-islington May 2, 2023
61f1fbd
[3.11] gh-102997: Update Windows installer to SQLite 3.41.2. (#102999…
erlend-aasland May 2, 2023
5e76305
[3.11] GH-103484: Fix redirected permanently URLs (GH-104001) (#104088)
rffontenelle May 2, 2023
f9231a0
[3.11] gh-65022: Fix description of tuple return value in copyreg (GH…
hauntsaninja May 2, 2023
5386730
[3.11] gh-103590: do not wrap a single exception raised from a try-ex…
iritkatriel May 2, 2023
4536b2e
[3.11] gh-104049: do not expose on-disk location from SimpleHTTPReque…
miss-islington May 3, 2023
365e077
[3.11] gh-101100: Fix Sphinx warnings in `curses` and `curses.ascii` …
miss-islington May 3, 2023
8f94c94
[3.11] GH-97950: Allow translation of index directive content (GH-104…
miss-islington May 4, 2023
0056369
[3.11] GH-97950: Use new-style index directive ('module') (GH-103996)…
AA-Turner May 4, 2023
a9fcf01
[3.11] GH-97950: Use new-style index directive ('keyword') (GH-104153…
miss-islington May 4, 2023
693ef48
[3.11] GH-97950: Use new-style index directive ('operator') (GH-10415…
miss-islington May 4, 2023
c463796
[3.11] GH-97950: Use new-style index directive ('object') (GH-104158)…
miss-islington May 4, 2023
99e6314
[3.11] GH-97950: Use new-style index directive ('exception') (GH-1041…
AA-Turner May 4, 2023
6a970ae
[3.11] GH-97950: Use new-style index directive ('statement') (GH-1041…
miss-islington May 4, 2023
bb4369e
[3.11] gh-104112: link from cached_property docs to method-caching FA…
miss-islington May 4, 2023
81902d3
[3.11] gh-104106: Add gcc fallback of mkfifoat/mknodat for macOS (gh-…
corona10 May 5, 2023
a635d63
[3.11] gh-64658: Expand Argument Clinic return converter docs (#10417…
erlend-aasland May 5, 2023
4b11af0
[3.11] GH-97950: Use new-style index directive ('builtin') (GH-104164…
miss-islington May 6, 2023
10ee19b
[3.11] Rewrite the turtledemo makeGraphFrame method (GH-104224) (#104…
miss-islington May 6, 2023
cf1c25f
[3.11] gh-101640: Make argparse _print_message catch any write error …
miss-islington May 6, 2023
8f23cad
[3.11] gh-103886: Improve `builtins.__doc__` (GH-104179) (#104257)
miss-islington May 7, 2023
efcd4bc
[3.11] gh-104254: Document the optional keyword-only "context" argume…
miss-islington May 7, 2023
15ffcf7
[3.11] gh-104018: remove unused format "z" handling in string formatf…
miss-islington May 7, 2023
c5dafea
[3.11] Re-enable commented-out test in test_generators.py (GH-104130)…
miss-islington May 7, 2023
a09d390
[3.11] gh-96670: Raise SyntaxError when parsing NULL bytes (GH-97594)…
lysnikolaou May 7, 2023
19abf69
[3.11] gh-103225: Fixed zero lineno issue for pdb (#103265) (#104262)
gaogaotiantian May 7, 2023
681d502
[3.11] gh-100370: fix OverflowError in sqlite3.Connection.blobopen fo…
erlend-aasland May 8, 2023
065e2ae
[3.11] gh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Wr…
miss-islington May 8, 2023
499b79d
[3.11] gh-102500: Remove mention of bytes shorthand (#104281) (#104288)
AlexWaygood May 8, 2023
d54f644
[3.11] gh-103193: Improve `getattr_static` test coverage (GH-104286) …
miss-islington May 8, 2023
8a6ff59
[3.11] GH-104145: Use fully-qualified cross reference types for the b…
miss-islington May 8, 2023
2ee2503
[3.11] GH-104284: Fix documentation gettext build (GH-104296) (#104299)
miss-islington May 8, 2023
b7622e7
[3.11] GH-104308: socket.getnameinfo should release the GIL (GH-10430…
miss-islington May 8, 2023
15624b4
[3.11] gh-102500: collections.abc.Buffer doesn't exist in 3.11 (#104317)
hauntsaninja May 9, 2023
97e1e43
[3.11] [doc] logging.rst - Change link to point directly to the Googl…
miss-islington May 9, 2023
4ed59b1
[3.11] gh-99889: Fix directory traversal security flaw in uu.decode()…
miss-islington May 9, 2023
663b321
[3.11] gh-104328: Fix typo in ``typing.Generic`` multiple inheritance…
miss-islington May 9, 2023
fffdbf4
[3.11] gh-102327: Extend docs for "url" and "headers" parameters to H…
miss-islington May 9, 2023
2fa14d4
[3.11] gh-48241: Clarify URL needs to be encoded when provided to url…
miss-islington May 9, 2023
b2171a2
[3.11] gh-103848: Adds checks to ensure that bracketed hosts found by…
miss-islington May 10, 2023
03abac2
[3.11] gh-103960: Dark mode: invert image brightness (GH-103983) (#10…
miss-islington May 10, 2023
a8e902d
[3.11] gh-104010: Separate and improve docs for `typing.get_origin` a…
miss-islington May 10, 2023
1cbf844
[3.11] gh-103247: clear the module cache in a test in test_importlib/…
miss-islington May 10, 2023
846a23d
[3.11] GH-87695: Fix OSError from `pathlib.Path.glob()` (GH-104292) (…
miss-islington May 10, 2023
7055088
[3.11] gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#…
erlend-aasland May 11, 2023
b4c1ca2
[3.11] gh-103204: `http.server` - Enforce that HTTP version numbers m…
miss-islington May 12, 2023
b90c922
[3.11] GH-94841: Fix usage of Py_ALWAYS_INLINE (GH-104439)
brandtbucher May 12, 2023
4ade7c3
[3.11] Fix refleak in super_descr_get (GH-104440)
brandtbucher May 12, 2023
fbb6def
[3.11] GH-104405: Add missing PEP 523 checks (GH-104441)
brandtbucher May 12, 2023
328b5dd
[3.11] gh-99836: IDLE - update news.txt for 3.11+ (#104445)
terryjreedy May 13, 2023
e794d46
[3.11] Add a mention of PYTHONBREAKPOINT to breakpoint() docs (GH-104…
miss-islington May 13, 2023
b87ccc3
[3.11] gh-75710: IDLE - add docstrings and comments to editor module …
miss-islington May 13, 2023
03f0d75
[3.11] GH-71383: IDLE - Document testing subsets of modules (GH-10446…
miss-islington May 14, 2023
f5f9975
[3.11] Minor improvements to typing docs (GH-104465) (#104475)
miss-islington May 14, 2023
8e79414
[3.11] gh-104337: Clarify random.gammavariate doc entry (GH-104410) …
miss-islington May 14, 2023
1afc0a9
[3.11] gh-98539: Make _SSLTransportProtocol.abort() safe to call when…
miss-islington May 14, 2023
a712c5f
[3.11] gh-67056: document that registering/unregistering an atexit fu…
miss-islington May 15, 2023
7779027
[3.11] gh-104461: Run tkinter test_configure_screen on X11 only (GH-1…
miss-islington May 16, 2023
52a18fe
[3.11] gh-104482: Fix error handling bugs in ast.c (#104514)
iritkatriel May 16, 2023
9cac6c4
[3.11] gh-104539: Fix indentation error in logging.config.rst (GH-104…
miss-islington May 16, 2023
f748fc9
[3.11] gh-75367: Fix data descriptor detection in inspect.getattr_sta…
miss-islington May 16, 2023
dece9c0
[3.11] gh-104494: Update certain Tkinter pack/place tests for Tk 8.7 …
miss-islington May 17, 2023
3ce7d57
[3.11] gh-87474: Fix file descriptor leaks in subprocess.Popen (GH-96…
miss-islington May 17, 2023
133bf09
[3.11] gh-103861: Fix Zip64 extensions not being properly applied in …
gpshead May 17, 2023
f106aef
[3.11] typing: Add more tests for TypeVar (GH-104571) (#104577)
JelleZijlstra May 17, 2023
0560fd3
[3.11] gh-104496: IDLE - fix About for mixed tcl/tk versions (GH-1045…
miss-islington May 17, 2023
610cc0a
[3.11] gh-102153: Start stripping C0 control and space chars in `urls…
miss-islington May 17, 2023
a8fc8b7
[3.11] gh-104340: Suppress warning about unawaited exception for clos…
miss-islington May 18, 2023
e96fb39
[3.11] gh-104499: IDLE - fix completions for tk aqua 8.7 (GH-104591) …
miss-islington May 18, 2023
99a162a
[3.11] gh-104499: Fix typo. (GH-104598) (#104599)
miss-islington May 18, 2023
3d52f7e
[3.11] gh-104629: Don't skip test_clinic if _testclinic is missing (G…
miss-islington May 18, 2023
ba39ea4
[3.11] gh-104623: Update Windows installer to use SQLite 3.42.0 (#104…
erlend-aasland May 18, 2023
d1bfefd
[3.11] gh-104623: Update macOS installer to SQLite 3.42.0 (GH-104643)
miss-islington May 19, 2023
aaeaf01
[3.11] gh-85984: Utilize new "winsize" functions from termios in pty …
miss-islington May 19, 2023
702ce87
[3.11] gh-96522: Fix deadlock in pty.spawn (GH-96639) (#104655)
ambv May 19, 2023
d78c3bc
[3.11] gh-104645: fix error handling in marshal tests (GH-104646) (#1…
miss-islington May 19, 2023
667e4ec
[3.11] gh-104615: don't make unsafe swaps in apply_static_swaps (GH-1…
carljm May 19, 2023
7b3bc95
[3.11] GH-102818: Do not call PyTraceBack_Here in sys.settrace trampo…
markshannon May 19, 2023
cd13f73
[3.11] gh-104659: Consolidate python examples in enum documentation (…
hugovk May 19, 2023
e5b6f38
[3.11] docs: fix wrong indentation causing rendering error in dis pag…
miss-islington May 19, 2023
2801b3f
[3.11] gh-104472: Skip `test_subprocess.ProcessTestCase.test_empty_en…
miss-islington May 19, 2023
dbb011a
[3.11] gh-103987: fix several crashes in mmap module (GH-103990) (#10…
miss-islington May 20, 2023
795b20e
[3.11] gh-56276: Add tests to test_compare (GH-3199) (#104694)
miss-islington May 20, 2023
89bd454
[3.11] gh-104679 Fixed syntax highlighting in turtle docs (GH-104682)…
millefalcon May 20, 2023
d45c1df
[3.11] gh-49174: document that the effect of calling gc.collect() dur…
miss-islington May 20, 2023
2e457bc
[3.11] gh-101857: Allow xattr detection on musl libc (GH-101858) (#10…
miss-islington May 21, 2023
b2e0201
[3.11] gh-104698: Fix reference leak in mmapmodule.c (GH-104700) (#10…
miss-islington May 21, 2023
dc0c41b
[3.11] Corrected identifier (GH-104713) (#104714)
miss-islington May 21, 2023
abb32de
[3.11] typing docs: Move some classes out of the "Generics" section (…
JelleZijlstra May 21, 2023
e033eda
[3.11] gh-104719: IDLE - delete useless monkeypatch of tokenize (GH-1…
miss-islington May 21, 2023
2ade563
[3.11] gh-103606: Improve error message from logging.config.FileConfi…
Agent-Hellboy May 21, 2023
d691de1
[3.11] gh-104683: `clinic.py`: Improve coverage for the `parse_conver…
AlexWaygood May 21, 2023
1692a16
[3.11] Add IPv6 into to the docstring for socket.getsockname (GH-1029…
miss-islington May 22, 2023
e95ca78
[3.11] gh-102978: Fix mock.patch function signatures for class and st…
miss-islington May 22, 2023
6f94bbf
[3.11] gh-104536: Improve `multiprocessing.process._cleanup` logic (G…
miss-islington May 22, 2023
be20e9c
[3.11] howto/urllib2: remove link to an outdated french translation (…
miss-islington May 22, 2023
ac12a6b
[3.11] gh-103726: Set up gcc-10 for ASAN (gh-103728) (#104794)
miss-islington May 23, 2023
582aadc
[3.11] gh-104271: Fix auto() fallback in case of mixed type Enum (GH-…
miss-islington May 23, 2023
6d00ae3
[3.11] gh-104372: Cleanup _posixsubprocess make_inheritable for async…
gpshead May 24, 2023
22618a8
[3.11] gh-104719: IDLE - test existence of all tokenize references. (…
miss-islington May 24, 2023
fa7d8ce
[3.11] gh-103207: The macOS 13 Ventura Installer.app permission probl…
ned-deily May 24, 2023
5e91167
[3.11] Improve test coverage for is_typeddict (GH-104884) (#104888)
miss-islington May 24, 2023
3b3f2e1
[3.11] gh-104874: Document NewType.__supertype__ (GH-104875) (#104907)
miss-islington May 24, 2023
76873ca
[3.11] Fix test_importlib.test_side_effect_import() (GH-104840) (#104…
miss-islington May 25, 2023
161fc18
[3.11] gh-104479: Update outdated tutorial floating-point reference (…
hauntsaninja May 26, 2023
b764347
[3.11] Fix typo in the tokenizer (GH-104950) (#104952)
miss-islington May 26, 2023
1342474
[3.11] gh-104943: Remove mentions of old Python versions (GH-104945) …
miss-islington May 26, 2023
f585ed1
[3.11] gh-104924: Fix `read()able` in `http.client` log messages (gh-…
miss-islington May 26, 2023
ca55247
[3.11] Remove raw asserts in test_typing.py (GH-104951) (#104979)
miss-islington May 26, 2023
4af56ec
[3.11] CI: Cache config.cache across runs to speed up build (GH-10480…
hugovk May 26, 2023
a632697
[3.11] gh-104984: remove kwargs and starargs from Call & ClassDef (GH…
miss-islington May 26, 2023
b9e2d80
[3.11] gh-104992: [What's New in 3.11] Document unittest.TestProgram.…
miss-islington May 27, 2023
d1a7d66
[3.11] CI: Precompute hash for config cache key in check_source job (…
itamaro May 27, 2023
dcfa816
[3.11] gh-104497: Make tkinter test pass with tk 8.7 (GH-104789) (#10…
miss-islington May 27, 2023
d34e58a
[3.11] gh-103921: Improve typing documentation (GH-104642) (#105007)
JelleZijlstra May 27, 2023
4fb9923
Add missing 3.10/11 attributes to traceback module docs
Jackenmen May 28, 2023
7dd1d8e
Add versionadded
Jackenmen May 28, 2023
a8a2af6
Update traceback.py
Jackenmen May 28, 2023
e3ea1f2
Add max_group_width/depth
Jackenmen May 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[3.11] gh-103810: Fix broken references in dataclasses (GH-103811) (#…
…103813)

(cherry picked from commit 0f23eda)

Co-authored-by: Olga Matoula <olgamatoula@gmail.com>
  • Loading branch information
ambv and olgarithms authored Apr 24, 2023
commit 56d50dd9fb9f7d0ef36a4dacebcb99cb1938fe24
146 changes: 74 additions & 72 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
--------------

This module provides a decorator and functions for automatically
adding generated :term:`special method`\s such as :meth:`__init__` and
:meth:`__repr__` to user-defined classes. It was originally described
adding generated :term:`special method`\s such as :meth:`~object.__init__` and
:meth:`~object.__repr__` to user-defined classes. It was originally described
in :pep:`557`.

The member variables to use in these generated methods are defined
Expand All @@ -31,7 +31,7 @@ using :pep:`526` type annotations. For example, this code::
def total_cost(self) -> float:
return self.unit_price * self.quantity_on_hand

will add, among other things, a :meth:`__init__` that looks like::
will add, among other things, a :meth:`~object.__init__` that looks like::

def __init__(self, name: str, unit_price: float, quantity_on_hand: int = 0):
self.name = name
Expand Down Expand Up @@ -86,105 +86,105 @@ Module contents

The parameters to :func:`dataclass` are:

- ``init``: If true (the default), a :meth:`__init__` method will be
- ``init``: If true (the default), a :meth:`~object.__init__` method will be
generated.

If the class already defines :meth:`__init__`, this parameter is
If the class already defines :meth:`~object.__init__`, this parameter is
ignored.

- ``repr``: If true (the default), a :meth:`__repr__` method will be
- ``repr``: If true (the default), a :meth:`~object.__repr__` method will be
generated. The generated repr string will have the class name and
the name and repr of each field, in the order they are defined in
the class. Fields that are marked as being excluded from the repr
are not included. For example:
``InventoryItem(name='widget', unit_price=3.0, quantity_on_hand=10)``.

If the class already defines :meth:`__repr__`, this parameter is
If the class already defines :meth:`~object.__repr__`, this parameter is
ignored.

- ``eq``: If true (the default), an :meth:`__eq__` method will be
- ``eq``: If true (the default), an :meth:`~object.__eq__` method will be
generated. This method compares the class as if it were a tuple
of its fields, in order. Both instances in the comparison must
be of the identical type.

If the class already defines :meth:`__eq__`, this parameter is
If the class already defines :meth:`~object.__eq__`, this parameter is
ignored.

- ``order``: If true (the default is ``False``), :meth:`__lt__`,
:meth:`__le__`, :meth:`__gt__`, and :meth:`__ge__` methods will be
- ``order``: If true (the default is ``False``), :meth:`~object.__lt__`,
:meth:`~object.__le__`, :meth:`~object.__gt__`, and :meth:`~object.__ge__` methods will be
generated. These compare the class as if it were a tuple of its
fields, in order. Both instances in the comparison must be of the
identical type. If ``order`` is true and ``eq`` is false, a
:exc:`ValueError` is raised.

If the class already defines any of :meth:`__lt__`,
:meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`, then
If the class already defines any of :meth:`~object.__lt__`,
:meth:`~object.__le__`, :meth:`~object.__gt__`, or :meth:`~object.__ge__`, then
:exc:`TypeError` is raised.

- ``unsafe_hash``: If ``False`` (the default), a :meth:`__hash__` method
- ``unsafe_hash``: If ``False`` (the default), a :meth:`~object.__hash__` method
is generated according to how ``eq`` and ``frozen`` are set.

:meth:`__hash__` is used by built-in :meth:`hash()`, and when objects are
:meth:`~object.__hash__` is used by built-in :meth:`hash()`, and when objects are
added to hashed collections such as dictionaries and sets. Having a
:meth:`__hash__` implies that instances of the class are immutable.
:meth:`~object.__hash__` implies that instances of the class are immutable.
Mutability is a complicated property that depends on the programmer's
intent, the existence and behavior of :meth:`__eq__`, and the values of
intent, the existence and behavior of :meth:`~object.__eq__`, and the values of
the ``eq`` and ``frozen`` flags in the :func:`dataclass` decorator.

By default, :func:`dataclass` will not implicitly add a :meth:`__hash__`
By default, :func:`dataclass` will not implicitly add a :meth:`~object.__hash__`
method unless it is safe to do so. Neither will it add or change an
existing explicitly defined :meth:`__hash__` method. Setting the class
existing explicitly defined :meth:`~object.__hash__` method. Setting the class
attribute ``__hash__ = None`` has a specific meaning to Python, as
described in the :meth:`__hash__` documentation.
described in the :meth:`~object.__hash__` documentation.

If :meth:`__hash__` is not explicitly defined, or if it is set to ``None``,
then :func:`dataclass` *may* add an implicit :meth:`__hash__` method.
If :meth:`~object.__hash__` is not explicitly defined, or if it is set to ``None``,
then :func:`dataclass` *may* add an implicit :meth:`~object.__hash__` method.
Although not recommended, you can force :func:`dataclass` to create a
:meth:`__hash__` method with ``unsafe_hash=True``. This might be the case
:meth:`~object.__hash__` method with ``unsafe_hash=True``. This might be the case
if your class is logically immutable but can nonetheless be mutated.
This is a specialized use case and should be considered carefully.

Here are the rules governing implicit creation of a :meth:`__hash__`
method. Note that you cannot both have an explicit :meth:`__hash__`
Here are the rules governing implicit creation of a :meth:`~object.__hash__`
method. Note that you cannot both have an explicit :meth:`~object.__hash__`
method in your dataclass and set ``unsafe_hash=True``; this will result
in a :exc:`TypeError`.

If ``eq`` and ``frozen`` are both true, by default :func:`dataclass` will
generate a :meth:`__hash__` method for you. If ``eq`` is true and
``frozen`` is false, :meth:`__hash__` will be set to ``None``, marking it
generate a :meth:`~object.__hash__` method for you. If ``eq`` is true and
``frozen`` is false, :meth:`~object.__hash__` will be set to ``None``, marking it
unhashable (which it is, since it is mutable). If ``eq`` is false,
:meth:`__hash__` will be left untouched meaning the :meth:`__hash__`
:meth:`~object.__hash__` will be left untouched meaning the :meth:`~object.__hash__`
method of the superclass will be used (if the superclass is
:class:`object`, this means it will fall back to id-based hashing).

- ``frozen``: If true (the default is ``False``), assigning to fields will
generate an exception. This emulates read-only frozen instances. If
:meth:`__setattr__` or :meth:`__delattr__` is defined in the class, then
:meth:`~object.__setattr__` or :meth:`~object.__delattr__` is defined in the class, then
:exc:`TypeError` is raised. See the discussion below.

- ``match_args``: If true (the default is ``True``), the
``__match_args__`` tuple will be created from the list of
parameters to the generated :meth:`__init__` method (even if
:meth:`__init__` is not generated, see above). If false, or if
parameters to the generated :meth:`~object.__init__` method (even if
:meth:`~object.__init__` is not generated, see above). If false, or if
``__match_args__`` is already defined in the class, then
``__match_args__`` will not be generated.

.. versionadded:: 3.10

- ``kw_only``: If true (the default value is ``False``), then all
fields will be marked as keyword-only. If a field is marked as
keyword-only, then the only effect is that the :meth:`__init__`
keyword-only, then the only effect is that the :meth:`~object.__init__`
parameter generated from a keyword-only field must be specified
with a keyword when :meth:`__init__` is called. There is no
with a keyword when :meth:`~object.__init__` is called. There is no
effect on any other aspect of dataclasses. See the
:term:`parameter` glossary entry for details. Also see the
:const:`KW_ONLY` section.

.. versionadded:: 3.10

- ``slots``: If true (the default is ``False``), :attr:`__slots__` attribute
- ``slots``: If true (the default is ``False``), :attr:`~object.__slots__` attribute
will be generated and new class will be returned instead of the original one.
If :attr:`__slots__` is already defined in the class, then :exc:`TypeError`
If :attr:`~object.__slots__` is already defined in the class, then :exc:`TypeError`
is raised.

.. versionadded:: 3.10
Expand Down Expand Up @@ -215,7 +215,7 @@ Module contents
b: int = 0 # assign a default value for 'b'

In this example, both ``a`` and ``b`` will be included in the added
:meth:`__init__` method, which will be defined as::
:meth:`~object.__init__` method, which will be defined as::

def __init__(self, a: int, b: int = 0):

Expand Down Expand Up @@ -256,13 +256,13 @@ Module contents
error to specify both ``default`` and ``default_factory``.

- ``init``: If true (the default), this field is included as a
parameter to the generated :meth:`__init__` method.
parameter to the generated :meth:`~object.__init__` method.

- ``repr``: If true (the default), this field is included in the
string returned by the generated :meth:`__repr__` method.
string returned by the generated :meth:`~object.__repr__` method.

- ``hash``: This can be a bool or ``None``. If true, this field is
included in the generated :meth:`__hash__` method. If ``None`` (the
included in the generated :meth:`~object.__hash__` method. If ``None`` (the
default), use the value of ``compare``: this would normally be
the expected behavior. A field should be considered in the hash
if it's used for comparisons. Setting this value to anything
Expand All @@ -275,8 +275,8 @@ Module contents
is excluded from the hash, it will still be used for comparisons.

- ``compare``: If true (the default), this field is included in the
generated equality and comparison methods (:meth:`__eq__`,
:meth:`__gt__`, et al.).
generated equality and comparison methods (:meth:`~object.__eq__`,
:meth:`~object.__gt__`, et al.).

- ``metadata``: This can be a mapping or None. None is treated as
an empty dict. This value is wrapped in
Expand All @@ -287,7 +287,7 @@ Module contents
namespace in the metadata.

- ``kw_only``: If true, this field will be marked as keyword-only.
This is used when the generated :meth:`__init__` method's
This is used when the generated :meth:`~object.__init__` method's
parameters are computed.

.. versionadded:: 3.10
Expand Down Expand Up @@ -431,21 +431,21 @@ Module contents
Class, raises :exc:`TypeError`. If values in ``changes`` do not
specify fields, raises :exc:`TypeError`.

The newly returned object is created by calling the :meth:`__init__`
The newly returned object is created by calling the :meth:`~object.__init__`
method of the dataclass. This ensures that
:meth:`__post_init__`, if present, is also called.
:ref:`__post_init__ <post-init-processing>`, if present, is also called.

Init-only variables without default values, if any exist, must be
specified on the call to :func:`replace` so that they can be passed to
:meth:`__init__` and :meth:`__post_init__`.
:meth:`~object.__init__` and :ref:`__post_init__ <post-init-processing>`.

It is an error for ``changes`` to contain any fields that are
defined as having ``init=False``. A :exc:`ValueError` will be raised
in this case.

Be forewarned about how ``init=False`` fields work during a call to
:func:`replace`. They are not copied from the source object, but
rather are initialized in :meth:`__post_init__`, if they're
rather are initialized in :ref:`__post_init__ <post-init-processing>`, if they're
initialized at all. It is expected that ``init=False`` fields will
be rarely and judiciously used. If they are used, it might be wise
to have alternate class constructors, or perhaps a custom
Expand Down Expand Up @@ -476,7 +476,7 @@ Module contents
:const:`KW_ONLY` is otherwise completely ignored. This includes the
name of such a field. By convention, a name of ``_`` is used for a
:const:`KW_ONLY` field. Keyword-only fields signify
:meth:`__init__` parameters that must be specified as keywords when
:meth:`~object.__init__` parameters that must be specified as keywords when
the class is instantiated.

In this example, the fields ``y`` and ``z`` will be marked as keyword-only fields::
Expand All @@ -497,20 +497,22 @@ Module contents

.. exception:: FrozenInstanceError

Raised when an implicitly defined :meth:`__setattr__` or
:meth:`__delattr__` is called on a dataclass which was defined with
Raised when an implicitly defined :meth:`~object.__setattr__` or
:meth:`~object.__delattr__` is called on a dataclass which was defined with
``frozen=True``. It is a subclass of :exc:`AttributeError`.

.. _post-init-processing:

Post-init processing
--------------------

The generated :meth:`__init__` code will call a method named
:meth:`__post_init__`, if :meth:`__post_init__` is defined on the
The generated :meth:`~object.__init__` code will call a method named
:meth:`!__post_init__`, if :meth:`!__post_init__` is defined on the
class. It will normally be called as ``self.__post_init__()``.
However, if any ``InitVar`` fields are defined, they will also be
passed to :meth:`__post_init__` in the order they were defined in the
class. If no :meth:`__init__` method is generated, then
:meth:`__post_init__` will not automatically be called.
passed to :meth:`!__post_init__` in the order they were defined in the
class. If no :meth:`~object.__init__` method is generated, then
:meth:`!__post_init__` will not automatically be called.

Among other uses, this allows for initializing field values that
depend on one or more other fields. For example::
Expand All @@ -524,10 +526,10 @@ depend on one or more other fields. For example::
def __post_init__(self):
self.c = self.a + self.b

The :meth:`__init__` method generated by :func:`dataclass` does not call base
class :meth:`__init__` methods. If the base class has an :meth:`__init__` method
The :meth:`~object.__init__` method generated by :func:`dataclass` does not call base
class :meth:`~object.__init__` methods. If the base class has an :meth:`~object.__init__` method
that has to be called, it is common to call this method in a
:meth:`__post_init__` method::
:meth:`!__post_init__` method::

@dataclass
class Rectangle:
Expand All @@ -541,12 +543,12 @@ that has to be called, it is common to call this method in a
def __post_init__(self):
super().__init__(self.side, self.side)

Note, however, that in general the dataclass-generated :meth:`__init__` methods
Note, however, that in general the dataclass-generated :meth:`~object.__init__` methods
don't need to be called, since the derived dataclass will take care of
initializing all fields of any base class that is a dataclass itself.

See the section below on init-only variables for ways to pass
parameters to :meth:`__post_init__`. Also see the warning about how
parameters to :meth:`!__post_init__`. Also see the warning about how
:func:`replace` handles ``init=False`` fields.

Class variables
Expand All @@ -569,8 +571,8 @@ if the type of a field is of type ``dataclasses.InitVar``. If a field
is an ``InitVar``, it is considered a pseudo-field called an init-only
field. As it is not a true field, it is not returned by the
module-level :func:`fields` function. Init-only fields are added as
parameters to the generated :meth:`__init__` method, and are passed to
the optional :meth:`__post_init__` method. They are not otherwise used
parameters to the generated :meth:`~object.__init__` method, and are passed to
the optional :ref:`__post_init__ <post-init-processing>` method. They are not otherwise used
by dataclasses.

For example, suppose a field will be initialized from a database, if a
Expand All @@ -597,12 +599,12 @@ Frozen instances
It is not possible to create truly immutable Python objects. However,
by passing ``frozen=True`` to the :meth:`dataclass` decorator you can
emulate immutability. In that case, dataclasses will add
:meth:`__setattr__` and :meth:`__delattr__` methods to the class. These
:meth:`~object.__setattr__` and :meth:`~object.__delattr__` methods to the class. These
methods will raise a :exc:`FrozenInstanceError` when invoked.

There is a tiny performance penalty when using ``frozen=True``:
:meth:`__init__` cannot use simple assignment to initialize fields, and
must use :meth:`object.__setattr__`.
:meth:`~object.__init__` cannot use simple assignment to initialize fields, and
must use :meth:`~object.__setattr__`.

Inheritance
-----------
Expand Down Expand Up @@ -630,14 +632,14 @@ example::
The final list of fields is, in order, ``x``, ``y``, ``z``. The final
type of ``x`` is ``int``, as specified in class ``C``.

The generated :meth:`__init__` method for ``C`` will look like::
The generated :meth:`~object.__init__` method for ``C`` will look like::

def __init__(self, x: int = 15, y: int = 0, z: int = 10):

Re-ordering of keyword-only parameters in :meth:`__init__`
----------------------------------------------------------
Re-ordering of keyword-only parameters in :meth:`~object.__init__`
------------------------------------------------------------------

After the parameters needed for :meth:`__init__` are computed, any
After the parameters needed for :meth:`~object.__init__` are computed, any
keyword-only parameters are moved to come after all regular
(non-keyword-only) parameters. This is a requirement of how
keyword-only parameters are implemented in Python: they must come
Expand All @@ -658,7 +660,7 @@ fields, and ``Base.x`` and ``D.z`` are regular fields::
z: int = 10
t: int = field(kw_only=True, default=0)

The generated :meth:`__init__` method for ``D`` will look like::
The generated :meth:`~object.__init__` method for ``D`` will look like::

def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: int = 0):

Expand All @@ -667,7 +669,7 @@ the list of fields: parameters derived from regular fields are
followed by parameters derived from keyword-only fields.

The relative ordering of keyword-only parameters is maintained in the
re-ordered :meth:`__init__` parameter list.
re-ordered :meth:`~object.__init__` parameter list.


Default factory functions
Expand All @@ -679,10 +681,10 @@ example, to create a new instance of a list, use::

mylist: list = field(default_factory=list)

If a field is excluded from :meth:`__init__` (using ``init=False``)
If a field is excluded from :meth:`~object.__init__` (using ``init=False``)
and the field also specifies ``default_factory``, then the default
factory function will always be called from the generated
:meth:`__init__` function. This happens because there is no other
:meth:`~object.__init__` function. This happens because there is no other
way to give the field an initial value.

Mutable default values
Expand Down