Commit Graph

25109 Commits

Author SHA1 Message Date
Kurt McKee c07ca1aab6
Fix some typos in whatsnew (GH-32098)
* Fix some typos and phrasing

* Convert the `hash()` text to a link

* Remove definite article
2022-03-25 10:32:05 -07:00
Mark Shannon d7163bb35d
bpo-42197: Don't create `f_locals` dictionary unless we actually need it. (GH-32055)
* `PyFrame_FastToLocalsWithError` and `PyFrame_LocalsToFast` are no longer called during profile and tracing.
 (Contributed by Fabio Zadrozny)

* Make accesses to a frame's `f_locals` safe from C code, not relying on calls to `PyFrame_FastToLocals` or `PyFrame_LocalsToFast`.

* Document new `PyFrame_GetLocals` C-API function.
2022-03-25 12:57:50 +00:00
Andrew Svetlov 4119d2d7c9
bpo-47062: Implement asyncio.Runner context manager (GH-31799)
Co-authored-by: Zachary Ware <zach@python.org>
2022-03-24 21:51:16 +02:00
Tomáš Hrnčiar 12c0012cf9
bpo-40465: Document random module changes in 3.11 What's new (#31818) 2022-03-24 15:22:58 +02:00
Shantanu 3354245daf
bpo-46480: rephrase typing.assert_type docs (GH-32069)
The goal here is to reduce potential confusion between
`assert_type(val, type)` and `assert isinstance(val, typ)`.

The former is meant to ask a type checker to confirm a fact, the latter
is meant to tell a type checker a fact. The behaviour of the latter more
closely resembles what I'd expect from the prior phrasing of
"assert [something] to the type checker".
2022-03-23 19:15:06 -07:00
Russel Webber c62b944dfc
bpo-31582: Created a new documentation section describing sys.path initialization (GH-31082) 2022-03-23 17:29:40 +00:00
Steve Dower fe010605f8
bpo-47086: Remove dead link to old CHM documentation (GH-32075) 2022-03-23 16:13:55 +00:00
Andrew Svetlov 0360e9f346
bpo-46829: Deprecate passing a message into Future.cancel() and Task.cancel() (GH-31840)
After a long deliberation we ended up feeling that the message argument for Future.cancel(), added in 3.9, was a bad idea, so we're deprecating it in 3.11 and plan to remove it in 3.13.
2022-03-23 08:43:05 -07:00
slateny 624e3986fb
Correctly document class instead of function (GH-32016) 2022-03-23 14:39:07 +00:00
Victor Stinner b0f886d1bc
bpo-46836: Add Doc/c-api/frame.rst (GH-32051)
Reorganize the documentation of the PyFrameObject C API.
2022-03-23 13:19:13 +01:00
Julien Palard 3ac4e783e0
[doc] configparser: avoid inline comments. (GH-31247)
People are testing those blocs with the default
inline_comment_prefixes of None, leading to a:

configparser.InterpolationSyntaxError: '$' must be followed by '$' or '{', found: '$ sign ($ is the only character that needs to be escaped)'
2022-03-23 09:35:33 +01:00
Julien Palard ec8906fb59
bpo-42238: [doc] Some lines moved in rst, but had hardcoded lineno in susp-ignored.csv. (GH-32070) 2022-03-23 09:34:30 +01:00
Matt Williams 795b365e8a
Fix typo in Path.iterdir docs (GH-31822) 2022-03-22 19:51:41 -07:00
Serhiy Storchaka a25a985535
bpo-28080: Add support for the fallback encoding in ZIP files (GH-32007)
* Add the metadata_encoding parameter in the zipfile.ZipFile constructor.
* Add the --metadata-encoding option in the zipfile CLI.

Co-authored-by: Stephen J. Turnbull <stephen@xemacs.org>
2022-03-22 11:52:55 +02:00
Serhiy Storchaka c6cd3cc93c
bpo-47081: Replace "qualifiers" with "quantifiers" in the re module documentation (GH-32028)
It is a more commonly used term.
2022-03-22 11:44:47 +02:00
Christian Heimes 4f97d64c83
bpo-45150: Add hashlib.file_digest() for efficient file hashing (GH-31930) 2022-03-22 02:37:00 -07:00
Brett Cannon 9ac2de922a
bpo-47061: document module deprecations due to PEP 594 (GH-31984)
Also removed asynchat, asyncore, and smtpd from their respective toctree entries so they are only  in the superceded subtree.
2022-03-21 16:16:37 -07:00
Irit Katriel 45833b50f0
bpo-12029: [doc] clarify that except does not match virtual subclasses of the specified exception type (GH-32027) 2022-03-21 20:41:35 +00:00
Serhiy Storchaka 345b390ed6
bpo-433030: Add support of atomic grouping in regular expressions (GH-31982)
* Atomic grouping: (?>...).
* Possessive quantifiers: x++, x*+, x?+, x{m,n}+.
  Equivalent to (?>x+), (?>x*), (?>x?), (?>x{m,n}).

Co-authored-by: Jeffrey C. Jacobs <timehorse@users.sourceforge.net>
2022-03-21 18:28:22 +02:00
jmcb 3af68fc77c
bpo-46013: Fix confusing kerning on period in docs (GH-29989) 2022-03-20 09:58:13 +00:00
Ma Lin b3f2d4c8ba
bpo-47040: improve document of checksum functions (gh-31955)
Clarifies a versionchanged note on crc32 & adler32 docs that the workaround is only needed for Python 2 and earlier.
Also cleans up an unnecessary intermediate variable in the implementation.

Authored-By: Ma Lin / animalize
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-03-19 14:42:04 -07:00
Arie Bovenberg 82e9b0bb0a
bpo-46382 dataclass(slots=True) now takes inherited slots into account (GH-31980)
Do not include any members in __slots__ that are already in a base class's __slots__.
2022-03-19 17:01:17 -04:00
Serhiy Storchaka 92a6abf72e
bpo-47066: Convert a warning about flags not at the start of the regular expression into error (GH-31994) 2022-03-19 16:10:44 +02:00
andrei kulakov cb7874f49d
bpo-44544: add textwrap placeholder arg (GH-27671) 2022-03-19 14:27:37 +02:00
Hugo van Kemenade 7747384643
bpo-47022: Document asynchat, asyncore and smtpd removals in 3.12 (GH-31891)
Document the deprecation of asyncore, asynchat, and smtpd with a slated removal in Python 3.12 thanks to PEP 594.
2022-03-18 12:45:37 -07:00
Julien Palard f1683173aa
[doc] Some more make suspicious false positives. (GH-31977) 2022-03-18 14:48:58 +01:00
Miro Hrončok 48d9262699
bpo-45413: Define "posix_venv", "nt_venv" and "venv" sysconfig installation schemes (GH-31034)
Define *posix_venv* and *nt_venv* sysconfig installation schemes
to be used for bootstrapping new virtual environments.
Add *venv* sysconfig installation scheme to get the appropriate one of the above.
The schemes are identical to the pre-existing
*posix_prefix* and *nt* install schemes.
The venv module now uses the *venv* scheme to create new virtual environments
instead of hardcoding the paths depending only on the platform. Downstream
Python distributors customizing the *posix_prefix* or *nt* install
scheme in a way that is not compatible with the install scheme used in
virtual environments are encouraged not to customize the *venv* schemes.
When Python itself runs in a virtual environment,
sysconfig.get_default_scheme and
sysconfig.get_preferred_scheme with `key="prefix"` returns
*venv*.
2022-03-18 10:53:29 +01:00
Andrew Svetlov 903f0a02c1
bpo-34790: Remove passing coroutine objects to asyncio.wait() (GH-31964)
Co-authored-by: Yury Selivanov <yury@edgedb.com>
2022-03-17 22:51:40 +02:00
David CARLIER 33698e8ff4
bpo-46030: socket module add couple of FreeBSD constants. (GH-30018)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-17 22:40:00 +02:00
Mark Shannon 3011a097bd
Use low bit of LOAD_GLOBAL's oparg to indicate whether it should push an additional NULL. (GH-31933) 2022-03-17 16:14:57 +00:00
Serhiy Storchaka c2e3c06139
bpo-46996: Remove support of Tcl/Tk < 8.5.12 (GH-31839) 2022-03-17 13:05:52 +02:00
Jelle Zijlstra 96568e995d
bpo-46480: add typing.assert_type (GH-30843)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: David Foster <david@dafoster.net>
2022-03-16 20:02:26 -07:00
Alex Waygood 81b425d4dc
bpo-46769: Improve documentation for `typing.TypeVar` (GH-31712)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-16 08:51:26 -07:00
slateny 879fbd9472
bpo-30677: [doc] mention that os.mkdir() can raise FileNotFoundError (GH-31548) 2022-03-14 19:57:10 +00:00
Victor Stinner 29624e769c
bpo-31415: importtime was made by Inada Naoki (GH-31875) 2022-03-14 10:39:33 -07:00
Victor Stinner 11c25b87ae
bpo-46906: Mention native endian in PyFloat_Pack8() doc (GH-31866) 2022-03-14 16:51:51 +01:00
Andrew Svetlov 9523c0d84f
bpo-46994: Accept explicit contextvars.Context in asyncio create_task() API (GH-31837) 2022-03-14 13:54:13 +02:00
Jason R. Coombs b1e2868607
bpo-47004: Sync with importlib_metadata 4.11.3. (#31854) 2022-03-13 15:53:29 -04:00
Alex Grönholm 9f04ee569c
bpo-46805: Add low level UDP socket functions to asyncio (GH-31455) 2022-03-13 18:42:29 +02:00
Illia Volochii 3543ddb4c4
bpo-43215: Document Happy Eyeballs args of asyncio.open_connection (GH-24525)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-13 01:54:59 +02:00
Victor Stinner 882d8096c2
bpo-46906: Add PyFloat_Pack8() to the C API (GH-31657)
Add new functions to pack and unpack C double (serialize and
deserialize):

* PyFloat_Pack2(), PyFloat_Pack4(), PyFloat_Pack8()
* PyFloat_Unpack2(), PyFloat_Unpack4(), PyFloat_Unpack8()

Document these functions and add unit tests.

Rename private functions and move them from the internal C API
to the public C API:

* _PyFloat_Pack2() => PyFloat_Pack2()
* _PyFloat_Pack4() => PyFloat_Pack4()
* _PyFloat_Pack8() => PyFloat_Pack8()
* _PyFloat_Unpack2() => PyFloat_Unpack2()
* _PyFloat_Unpack4() => PyFloat_Unpack4()
* _PyFloat_Unpack8() => PyFloat_Unpack8()

Replace the "unsigned char*" type with "char*" which is more common
and easy to use.
2022-03-12 00:10:02 +01:00
Victor Stinner dc374ac7b0
bpo-46968: Add os.sysconf_names['SC_MINSIGSTKSZ'] (GH-31824) 2022-03-11 23:01:40 +01:00
slateny c83fc9c02c
bpo-31327: Update time documentation to reflect possible errors (GH-31460)
As per the comments, this mirrors the [datetime documentation](https://docs.python.org/3/library/datetime.html#datetime.datetime.fromtimestamp). 

```
>>> import time
>>> time.localtime(999999999999999999999)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: timestamp out of range for platform time_t
>>> time.localtime(-3600)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] Invalid argument 
```
2022-03-11 11:05:51 -08:00
Erlend Egeberg Aasland 2d5835a019
sqlite3: normalise pre-acronym determiners (GH-31772)
For consistency, replace "a SQL" with "an SQL".
2022-03-10 17:52:47 -08:00
Raymond Hettinger a0eb69c1a2
Remove print race from task_done example. (GH-31795) 2022-03-10 11:01:23 -06:00
Victor Stinner 7854012077
bpo-46917: math.nan is now always available (GH-31793) 2022-03-10 17:47:18 +01:00
Charlie Zhao 8a207e0321
bpo-46677: Add examples of inheritance and attributes to `TypedDict` docs (GH-31349)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-10 08:40:54 -08:00
Victor Stinner 9b51fd5d13
bpo-46917: Require IEEE 754 to build Python (GH-31790)
Building Python now requires support of IEEE 754 floating point
numbers.
2022-03-10 14:37:19 +01:00
Erlend Egeberg Aasland e801e88744
bpo-45138: Revert GH-28240: Expand traced SQL statements (GH-31788)
This reverts commit d1777515f9.

Automerge-Triggered-By: GH:JelleZijlstra
2022-03-09 09:39:49 -08:00
Serhiy Storchaka 02fbaf4887
bpo-46245: Add optional parameter dir_fd in shutil.rmtree() (GH-30365) 2022-03-09 14:29:33 +02:00
Ken Jin 5eb03b1b51
Fix 3.11 what's new formatting (GH-31763) 2022-03-09 19:31:56 +08:00
Erlend Egeberg Aasland d1777515f9
bpo-45138: Expand traced SQL statements in `sqlite3` trace callback (GH-28240) 2022-03-08 18:46:40 -08:00
Erlend Egeberg Aasland b33a1ae703
Docstring: replace pysqlite with sqlite3 (GH-31758)
Replace two instances of "pysqlite" with "sqlite3" in sqlite3
docstrings. Also reword "is a no-op" to "does nothing" for clarity.
2022-03-08 18:45:48 -08:00
David Gilbertson 28f84c72b6
Removed confusing reference to sys (GH-31638) 2022-03-08 07:43:27 -08:00
Taneli Hukkinen 591f6754b5
bpo-40059: Add tomllib (PEP-680) (GH-31498)
This adds a new standard library module, `tomllib`, for parsing TOML.

The implementation is based on Tomli (https://github.com/hukkin/tomli).

## Steps taken (converting `tomli` to `tomllib`)

- Move everything in `tomli:src/tomli` to `Lib/tomllib`. Exclude `py.typed`.
- Remove `__version__ = ...` line from `Lib/tomllib/__init__.py`
- Move everything in `tomli:tests` to `Lib/test/test_tomllib`. Exclude the following test data dirs recursively:
  - `tomli:tests/data/invalid/_external/`
  - `tomli:tests/data/valid/_external/`
- Create `Lib/test/test_tomllib/__main__.py`:

  ```python
  import unittest

  from . import load_tests


  unittest.main()
  ```


- Add the following to `Lib/test/test_tomllib/__init__.py`:

  ```python
  import os
  from test.support import load_package_tests

  def load_tests(*args):
      return load_package_tests(os.path.dirname(__file__), *args)
  ```

  Also change `import tomli as tomllib` to `import tomllib`.

- In `cpython/Lib/tomllib/_parser.py` replace `__fp` with `fp` and `__s` with
  `s`. Add the `/` to `load` and `loads` function signatures.

- Run `make regen-stdlib-module-names`

- Create `Doc/library/tomllib.rst` and reference it in `Doc/library/fileformats.rst`
2022-03-08 09:26:13 +01:00
William Andrea badb637c8c
docs: Don't use code formatting for emphasis (GH-30519) 2022-03-07 20:14:47 -08:00
David Gilbertson ab014978ae
Removed ambiguity in __init_subclass__ docs (GH-31540) 2022-03-07 20:13:01 -08:00
Meer Suri 8debeed307
bpo-46494: Mention the typing_extensions pkg in typing docs (GH-31260) 2022-03-07 20:04:04 -08:00
Ned Batchelder 13331a12c3
importlib.metadata: Remove empty footnote section (GH-30451) 2022-03-07 19:55:41 -08:00
Alex Waygood 50731297a9
bpo-45680: Improve docs on subscriptions w.r.t. `GenericAlias` objects (GH-29479) 2022-03-07 19:49:28 -08:00
Inada Naoki 2d8b764210
bpo-46864: Deprecate PyBytesObject.ob_shash. (GH-31598) 2022-03-06 11:39:10 +09:00
Géry Ogam 46a116c1c9
bpo-38738: Fix formatting of True and False in the threading documentation (GH-31678)
* Fix formatting of True and False in the threading documentation
* Update threading.rst
2022-03-04 12:13:09 -08:00
slateny cedd2473a9
bpo-25415: Remove confusing sentence from IOBase docstrings (PR-31631) 2022-03-04 12:35:52 -05:00
Brandt Bucher 586b24d3be
bpo-46841: Fix error message hacks in `GET_AWAITABLE` (GH-31664) 2022-03-04 12:41:17 +00:00
Victor Stinner ec4a580f7c
bpo-46355: Update pythoncapi_compat project URL (GH-31670) 2022-03-04 00:46:56 +01:00
vidhya 10117f1d8c
bpo-6634: [doc] clarify that sys.exit() does not always exit the interpreter (GH-31639) 2022-03-03 14:23:47 +00:00
slateny a8c87a239e
bpo-21910: Clarify docs for codecs writelines method (GH-31245)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-02 17:21:41 -08:00
slateny 3257d49d23
bpo-45492: Corrected documentation for co_names in inspect library doc (GH-31456) 2022-03-02 19:03:38 +00:00
Nikita Sobolev 20a1c8ee4b
bpo-46195: Do not add `Optional` in `get_type_hints` (GH-30304)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-01 21:29:46 -08:00
Inada Naoki 9833bb91e4
bpo-46845: Reduce dict size when all keys are Unicode (GH-31564) 2022-03-02 08:09:28 +09:00
Brandt Bucher 422fdb3717
Add missing "to" to two tp_flags notes (GH-31624) 2022-02-28 17:20:14 -08:00
Yuxin Wu fc44b8136f
[doc] Add a note in howto/logging.rst about "do not log to root logger in libraries" (GH-31271) 2022-02-26 18:29:51 +00:00
Kumar Aditya 41ddcd3f40
bpo-44011: Document ssl_shutdown_timeout added by revisited asyncio SSL implementation (GH-31597) 2022-02-26 15:06:43 +02:00
Charlie Zhao e466faa9df
bpo-45735: Promise the long-time truth that `args=list` works (GH-30982)
For threads, and for multiprocessing, it's always been the case that ``args=list`` works fine when passed to ``Process()`` or ``Thread()``, and such code is common in the wild. But, according to the docs, only a tuple can be used. This brings the docs into synch with reality.

Doc changes by Charlie Zhao.
Co-authored-by: Tim Peters <tim.peters@gmail.com>
2022-02-25 22:17:13 -06:00
Victor Stinner 5ab745fc51
bpo-46852: Remove the float.__set_format__() method (GH-31585)
Remove the undocumented private float.__set_format__() method,
previously known as float.__set_format__() in Python 3.7. Its
docstring said: "You probably don't want to use this function. It
exists mainly to be used in Python's test suite."
2022-02-26 00:53:27 +01:00
Kumar Aditya dd69f73421
bpo-26897: Clarify Popen stdin, stdout, stderr file object docs (GH-30231) 2022-02-25 08:41:19 -08:00
Raymond Hettinger 26aba295a9
Update dict/OrderedDict differences with code equivalents. (GH-31563) 2022-02-25 08:49:53 -06:00
Brandt Bucher 0f41aac109
bpo-46841: Use *inline* caching for `BINARY_OP` (GH-31543) 2022-02-25 12:11:34 +00:00
Victor Stinner 18b5dd68c6
bpo-46836: Move PyFrameObject to pycore_frame.h (GH-31530)
Move the PyFrameObject type definition (struct _frame) to the
internal C API pycore_frame.h header file.
2022-02-25 12:53:19 +01:00
slateny 53ecf9e08d
bpo-34429: Noted TemporaryFile behavior on non-Posix/non-Cygwin systems (GH-31547) 2022-02-25 11:07:52 +00:00
Victor Stinner 1b2611eb02
bpo-46656: Remove Py_NO_NAN macro (GH-31160)
Building Python now requires support for floating point Not-a-Number
(NaN): remove the Py_NO_NAN macro.
2022-02-25 01:32:57 +01:00
Victor Stinner 5f8b5e2f21
bpo-46656: Building Python now requires a C11 compiler (GH-31557)
See PEP 7:
https://python.github.io/peps/pep-0007/#c-dialect
2022-02-25 01:31:30 +01:00
Victor Stinner 4fccf91073
bpo-46659: Enhance LocaleTextCalendar for C locale (GH-31214)
If the LC_TIME locale is "C", use the user preferred locale.
2022-02-24 14:29:08 +01:00
Victor Stinner 8a716bc62c
bpo-40421: What's New in Python 3.11: PyFrameObject.f_lasti (GH-31536)
Suggest replacing PyCode_Addr2Line() with PyFrame_GetLineNumber().
2022-02-23 20:20:03 +01:00
Victor Stinner 78859e58e4
bpo-40421: Fix PyFrame_GetCode() documentation (GH-31535)
Fix PyFrame_GetBack() and PyFrame_GetCode() return type in
the documentation.
2022-02-23 19:49:21 +01:00
Victor Stinner 9bbdde2180
bpo-45412: Add _PY_SHORT_FLOAT_REPR macro (GH-31171)
Remove the HAVE_PY_SET_53BIT_PRECISION macro (moved to the internal
C API).

* Move HAVE_PY_SET_53BIT_PRECISION macro to pycore_pymath.h.
* Replace PY_NO_SHORT_FLOAT_REPR macro with _PY_SHORT_FLOAT_REPR
  macro which is always defined. gcc -Wundef emits a warning when
  using _PY_SHORT_FLOAT_REPR but the macro is not defined, if
  pycore_pymath.h include was forgotten.
2022-02-23 18:16:23 +01:00
Jelle Zijlstra 43cf44ddcc
Minor fixes to C API docs (GH-31501)
* C API docs: move PyErr_SetImportErrorSubclass docs

It was in the section about warnings, but it makes more sense to
put it with PyErr_SetImportError.

* C API docs: document closeit argument to PyRun_AnyFileExFlags

It was already documented for PyRun_SimpleFileExFlags.

* textual fixes to unicode docs

* Move paragraph about tp_dealloc into tp_dealloc section

* __aiter__ returns an async iterator, not an awaitable
2022-02-22 20:34:17 -08:00
Victor Stinner b899126094
bpo-46659: Deprecate locale.getdefaultlocale() (GH-31206)
The locale.getdefaultlocale() function is deprecated and will be
removed in Python 3.13. Use locale.setlocale(),
locale.getpreferredencoding(False) and locale.getlocale() functions
instead.
2022-02-22 22:06:43 +01:00
vidhya bba8008f99
bpo-20923 : [doc] Explain ConfigParser 'valid section name' and .SECTCRE (GH-31413) 2022-02-22 18:06:41 +00:00
slateny 9a0d941df4
bpo-36557: Updated wording for using/windows (GH-31457) 2022-02-22 17:36:13 +00:00
Pablo Galindo Salgado 7fb94fd7a8
bpo-46725: Document starred expressions in for statements (GH-31481)
Automerge-Triggered-By: GH:pablogsal
2022-02-22 09:26:46 -08:00
Andrew Svetlov 4140bcb1cd
bpo-45390: Propagate CancelledError's message from cancelled task to its awaiter (GH-31383)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-02-21 22:59:04 +02:00
Mark Shannon 59585d6b2e
bpo-46329: Streamline calling sequence a bit. (GH-31465)
* Move handling of bound-methods to PRECALL.

* Remove call_shape.postcall_shrink

* Remove call_shape.callable

* Remove call_shape.callable. Change CALL oparg to match PRECALL oparg.

* Move KW_NAMES before PRECALL.

* Update opcode docs in dis.rst
2022-02-21 18:26:47 +00:00
Raymond Hettinger 12a2e41e8a
Improve discussion about how __getattr__ is invoked. (GH-31435) 2022-02-19 23:02:30 -06:00
Charles Brunet 99331fcf17
Counter doc mentions three methods, but lists four (GH-30706)
Was probably caused by the addition of the `total()` method
2022-02-18 18:23:53 -08:00
Nikita Sobolev 395029b0bd
bpo-46571: improve `typing.no_type_check` to skip foreign objects (GH-31042)
There are several changes:
1. We now don't explicitly check for any base / sub types, because new name check covers it
2. I've also checked that `no_type_check` do not modify foreign functions. It was the same as with `type`s
3. I've also covered `except TypeError` in `no_type_check` with a simple test case, it was not covered at all
4. I also felt like adding `lambda` test is a good idea: because `lambda` is a bit of both in class bodies: a function and an assignment

<!-- issue-number: [bpo-46571](https://bugs.python.org/issue46571) -->
https://bugs.python.org/issue46571
<!-- /issue-number -->
2022-02-18 17:53:29 -08:00
Jörn Heissler f80a97b492
[docs] Correct typos in SSLContext.sni_callback (GH-30623)
Co-authored-by: Jörn Heissler <nosuchaddress@joern-heissler.de>
2022-02-18 17:49:04 -08:00
Mark Shannon cf345e945f
bpo-46329: Change calling sequence (again) (GH-31373)
* Change calling sequence: Add PUSH_NULL. Merge PRECALL_FUNCTION and PRECALL_METHOD into PRECALL.
2022-02-18 17:19:08 +00:00
Serhiy Storchaka 2923d87ca2
bpo-46777: Fix incorrect use of directives in asyncio documentation (GH-31388) 2022-02-18 10:58:48 +02:00
William Andrea 35f55cc5c6
docs: Link `match` statement in tutorial (GH-31396)
Add a link to the `match` statement from its section in the tutorial.

This should be backported to 3.10.

[Initially submitted as #31395 but against the wrong branch. Thanks @Mariatta]

Automerge-Triggered-By: GH:Mariatta
2022-02-17 16:02:42 -08:00
Hakan Çelik 02815d9393
bpo-29418: Add inspect.ismethodwrapper to whatsnew (GH-31377) 2022-02-17 22:45:55 +03:00
Géry Ogam 2945f5a7c5
Update html.parser.rst (GH-30678)
This PR for the documentation of the [html.parser](https://docs.python.org/3/library/html.parser.html) module will

- fix a terminology mistake (‘start of a tag’ -> ‘start tag of an element’);
- mention the parameter names of the `HTMLParser.handle_*` methods where missing.
2022-02-17 04:20:40 -08:00
97littleleaf11 de6043e596
bpo-46066: Deprecate kwargs syntax for TypedDict definitions (GH-31126)
Closes python/typing#981

https://bugs.python.org/issue46066
2022-02-16 19:26:07 -08:00
Hakan Çelik 562c13f573
bpo-29418: Implement inspect.ismethodwrapper and fix inspect.isroutine for cases where methodwrapper is given (GH-19261)
Automerge-Triggered-By: GH:isidentical
2022-02-16 04:46:20 -08:00
Alex-Blade 0cb765b2ce
bpo-46730: Add more info to @property AttributeError messages (GH-31311)
On `obj.read_only_property = x`, raise `AttributeError: property 'read_only_property' of 'A' object has no setter`.
2022-02-16 02:07:34 -05:00
Zackery Spytz 08ec80113b
bpo-46737: Add default arguments to random.gauss and normalvariate (GH-31360) 2022-02-15 17:12:15 -06:00
David Gilbertson 04215a4272
Update the OMG link (GH-30383) 2022-02-14 13:49:11 -08:00
Leo ad4e8d2b87
Fix missing import in dataclass code snippet (GH-29214)
field was not imported. It has been added now.
2022-02-14 12:01:53 -08:00
Rafael Fontenelle 6b9f27dd0b
doc: use colon for all color's rangs (GH-28998) 2022-02-14 11:46:40 -08:00
180909 5d53cf30f9
bpo-38619: Update the documentation for UUID.hex (GH-29830)
Explicitly state that it is lowercase.

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-02-14 10:58:22 -08:00
David Gilbertson 4e4e7c2684
Update __main__.rst (GH-30896)
The reference to `venv` appears in the paragraph below, instead of above.
Fixed the documentation.
2022-02-14 10:53:16 -08:00
Cooper Lees ff5a167597
Fix a typo in Doc/faq/programming.rst (GH-31243)
is not longer used -> is no longer used
2022-02-14 10:49:28 -08:00
Scott Noyes 0d29e7a06f
Fix minor grammar error (#31325)
"an" followed by consonant should be "a"
2022-02-14 10:45:48 -08:00
Zackery Spytz 96084f4256
bpo-46747: Add missing key parameters in the bisect docs (GH-31323)
Added *key* parameter to `bisect.bisect()` and `bisect.insort()` in bisect module docs.
2022-02-14 11:16:49 -05:00
John Belmonte 1d6ce67c29
Corrections to format precision description. (GH-31291)
* `precision` field is a decimal integer
  * clarify that stated limitations are on presentation type
    rather than input value type.  Especially misleading is
    "precision is not allowed for integer values", since integer
    value input to a format like `.1f` is fine.
  * regarding max field size, replace "non-number" with "string",
    which is the only non-numeric presentation type

Automerge-Triggered-By: GH:ericvsmith
2022-02-13 16:00:32 -08:00
Terry Jan Reedy 6331c08d1c
bpo-45447: Fix entry in What's New 3.11 (GH-31307) 2022-02-12 21:12:21 -05:00
Terry Jan Reedy cef91ca80c
bpo-45447: Add entry to What's new 3.9 (GH-31305) 2022-02-12 21:11:19 -05:00
Terry Jan Reedy 2d98433549
bpo-45447: Add entry to What's new 3.10 (GH-31304) 2022-02-12 21:10:29 -05:00
Alex Waygood 50cf4991c4
bpo-45447: Add syntax highlighting for `.pyi` files in IDLE (GH-28950)
Also add .pyi to the python extensions in the "File-open" and "File-save" dialogues.
Add util.py to contain objects that are used in multiple idlelib modules
and have no dependencies on any of them.

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2022-02-12 19:04:48 -05:00
Meer Suri 9d9cfd61ec
bpo-46586: Fix documentation links (GH-31216)
* Fix enum.property documentation link
2022-02-11 20:21:38 -08:00
Erlend Egeberg Aasland ba5725171d
bpo-46355: Amend What's New in Python 3.11 C API wording (GH-31288) 2022-02-12 01:48:26 +01:00
Alex Waygood e0bc8ee945
bpo-46483: [doc] pathlib classes no longer support parameterized generics (GH-31281)
Remove pathlib classes from the list in stdtypes.rst of classes
that can be parameterized at runtime.
2022-02-11 22:39:37 +02:00
Petr Viktorin 204946986f
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
* Make PyType_GetModuleByDef public (remove underscore)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-02-11 17:22:11 +01:00
Géry Ogam 4f9386661d
Fix the signature of multiprocessing.set_executable (GH-31276)
Automerge-Triggered-By: GH:merwok
2022-02-11 06:42:54 -08:00
Julien Palard b878b3af0b
bpo-42238: [doc] moving from rstlint.py to sphinx-lint. (GH-31097) 2022-02-10 08:59:04 +01:00
Henry Schreiner 5a3f97291e
bpo-43532: add version added to KW_ONLY (GH-31235)
Minor missing version note mentioned at the end of  (and affected me independently before reading that note).

Automerge-Triggered-By: GH:ericvsmith
2022-02-09 12:56:10 -08:00
Jelle Zijlstra 243436f377
bpo-46475: Add typing.Never and typing.assert_never (GH-30842) 2022-02-08 10:50:26 -08:00
Victor Stinner 7a0486eaa9
bpo-46659: calendar uses locale.getlocale() (GH-31166)
The calendar.LocaleTextCalendar and calendar.LocaleHTMLCalendar
classes module now use locale.getlocale(), instead of using
locale.getdefaultlocale(), if no locale is specified.
2022-02-08 00:24:09 +01:00
James Hilton-Balfe 7ba1cc8049
bpo-46534: Implement PEP 673 Self in typing.py (GH-30924)
Co-authored-by: Pradeep Kumar Srinivasan <gohanpra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-07 12:47:48 -08:00
Victor Stinner a89772c791
bpo-46166: Fix compiler warnings in What's New in Python 3.11 (GH-31198)
Fix compiler warnings on PyObject_GetAttrString() calls in the What's
New in Python 3.11 doc of PyFrameObject changes.
2022-02-07 17:46:22 +01:00
Hugo van Kemenade 6c4e44ef8a
bpo-23952: Document cgi module's maxlen variable (GH-30338) 2022-02-06 05:59:32 -08:00
Julien Palard fa90e48c53
[doc] Enhance readability by avoiding big blocks for small numbers. (GH-31157)
Initially reported by Gregory Jacob on the docs@ mailing list:

https://mail.python.org/archives/list/docs@python.org/thread/VPSFGLOZOHSPF7TGPOI65AOH25TCPSVR/
2022-02-06 13:44:04 +01:00
Victor Stinner 54842e4311
bpo-46640: Py_NAN now uses the C99 NAN constant (GH-31134)
Building Python now requires a C99 <math.h> header file providing a
NAN constant, or the __builtin_nan() built-in function. If a platform
does not support Not-a-Number (NaN), the Py_NO_NAN macro can be
defined in the pyconfig.h file.
2022-02-06 13:13:04 +01:00
Christophe Nanteuil f1e29cea85
Allows to specify the port on which serve documentation (GH-31145)
[user@localhost]$ make serve      # default configuration, no change
python3 ../Tools/scripts/serve.py build/html
Serving build/html on port 8000, control-C to stop
^CShutting down.

[user@localhost]$ make serve SERVE_PORT=8080 # new option
python3 ../Tools/scripts/serve.py build/html 8080
Serving build/html on port 8080, control-C to stop
2022-02-06 11:22:06 +01:00
andrei kulakov fea7290a0e
bpo-31369: include ``RegexFlag`` in ``re.__all__`` (GH-30279)
* added RegexFlag to re.__all__; added RegexFlag.NOFLAG

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-04 19:54:28 -08:00
Kumar Aditya bf95ff91f2
bpo-46608: exclude marshalled-frozen data if deep-freezing to save 300 KB space (GH-31074)
This reduces the size of the data segment by **300 KB** of the executable because if the modules are deep-frozen then the marshalled frozen data just wastes space. This was inspired by comment by @gvanrossum in https://github.com/python/cpython/pull/29118#issuecomment-958521863. Note: There is a new option `--deepfreeze-only` in `freeze_modules.py` to change this behavior, it is on be default to save disk space.
```console 
# du -s ./python before
27892   ./python
# du -s ./python after
27524   ./python
```

Automerge-Triggered-By: GH:ericsnowcurrently
2022-02-04 09:57:03 -08:00
Manish Kumar ⛄ ba650af7d6
Optimize images by IMGbot (GH-21348)
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
2022-02-04 15:49:43 +09:00
Nikita Sobolev 734b1f119b
bpo-46569: [Enum] fix typo in `StrEnum` docs (GH-31007) 2022-02-03 07:22:41 -08:00
Miro Hrončok 6baa98e538
bpo-46624: Defer to 3.12: "Remove deprecated support for non-integer values" (GH-31098) 2022-02-03 07:48:13 -06:00
Zackery Spytz b4bd1e1422
bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)
Calling int(a) when type(a) implements __trunc__ but not __int__
or __index__ now raises a DeprecationWarning.
2022-02-03 11:43:25 +02:00
Nikita Sobolev 7ffe7ba30f
bpo-46483: Remove `__class_getitem__` from `pathlib.PurePath` (GH-30848)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-02-03 11:25:10 +02:00
Hugo van Kemenade e8659b47de
bpo-45173: Keep configparser deprecations until Python 3.12 (GH-30952)
* Revert "bpo-45173 Remove configparser deprecations"

This reverts commit df2284bc41.

* bpo-45173: Note these configparser deprecations will be removed in 3.12
2022-02-02 08:59:39 -08:00
Christian Heimes f66c857572
bpo-45459: Add Py_buffer to limited API (GH-29991)
- [x] ``Py_buffer`` struct
- [x] ``PyBuffer_*()`` API functions
- [x] ``PyBUF_*`` constants
- [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots
- [x] ``PyMemoryView_FromBuffer()`` API
- [x] tests for limited API
- [x] ``make regen-limited-abi``
- [x] documentation update
- [ ] export ``PyPickleBuffer*()`` API ???
2022-02-02 07:03:10 -08:00
Raymond Hettinger 06a491179f
Add recipe for subslices (GH-31028) 2022-02-01 22:18:52 -06:00
Raymond Hettinger f77beacf01
Fix minor details in the Counter docs (GH-31029) 2022-02-01 22:18:11 -06:00
Jelle Zijlstra abcc3d75f6
bpo-46414: Add typing.reveal_type (#30646)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-01 18:48:55 -08:00
Petr Viktorin a4cb31927a
bpo-46355: What's New: Note that PyFrameObject are private (GH-31032)
This adds a slightly more detailed explanation of the change.
The most important point is that the changed/removed fields
were "subject to change" to begin with.
2022-02-01 02:22:34 -08:00
Barney Gale 18cb2ef46c
bpo-29688: document and test `pathlib.Path.absolute()` (GH-26153)
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Brian Helba <brian.helba@kitware.com>
2022-01-28 15:40:55 -08:00
Mark Shannon 89fd7c3452
bpo-46329: Split calls into precall and call instructions. (GH-30855)
* Add PRECALL_FUNCTION opcode.

* Move 'call shape' varaibles into struct.

* Replace CALL_NO_KW and CALL_KW with KW_NAMES and CALL instructions.

* Specialize for builtin methods taking using the METH_FASTCALL | METH_KEYWORDS protocol.

* Allow kwnames for specialized calls to builtin types.

* Specialize calls to tuple(arg) and str(arg).
2022-01-28 12:42:30 +00:00
Julien Palard 44afdbd5af
bpo-42238: [doc] Avoid hardcoding fast-moving lines in susp-ignored.csv. (GH-30981) 2022-01-28 10:50:58 +01:00