Commit graph

119780 commits

Author SHA1 Message Date
Hugo van Kemenade 0229d2a9b1
Docs: Use sphinx-notfound-page to show a nicer 404 page (#111084) 2023-12-02 17:41:40 +00:00
Nikita Sobolev a35a305098
gh-112618: Make Annotated cache typed (#112619)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-02 16:10:19 +00:00
Nikita Sobolev a74daba7ca
gh-112316: Improve docs of inspect.signature and Signature.from_callable (#112317)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-02 13:13:44 +00:00
William Wen 939fc6d6ea
gh-106922: Support multi-line error locations in traceback (attempt 2) (#112097) 2023-12-01 22:18:16 +00:00
Victor Stinner 5c5022b862
gh-112567: Add _PyTimeFraction C API (#112568)
Use a fraction internally in the _PyTime API to reduce the risk of
integer overflow: simplify the fraction using Greatest Common
Divisor (GCD). The fraction API is used by time functions:
perf_counter(), monotonic() and process_time().

For example, QueryPerformanceFrequency() usually returns 10 MHz on
Windows 10 and newer. The fraction SEC_TO_NS / frequency =
1_000_000_000 / 10_000_000 can be simplified to 100 / 1.

* Add _PyTimeFraction type.
* Add functions:

  * _PyTimeFraction_Set()
  * _PyTimeFraction_Mul()
  * _PyTimeFraction_Resolution()

* No longer check "numer * denom <= _PyTime_MAX" in
  _PyTimeFraction_Set(). _PyTimeFraction_Mul() uses _PyTime_Mul()
  which handles integer overflow.
2023-12-01 19:50:10 +01:00
Victor Stinner 05a370abd6
gh-112567: Add _Py_GetTicksPerSecond() function (#112587)
* Move _PyRuntimeState.time to _posixstate.ticks_per_second and
  time_module_state.ticks_per_second.
* Add time_module_state.clocks_per_second.
* Rename _PyTime_GetClockWithInfo() to py_clock().
* Rename _PyTime_GetProcessTimeWithInfo() to py_process_time().
* Add process_time_times() helper function, called by
  py_process_time().
* os.times() is now always built: no longer rely on HAVE_TIMES.
2023-12-01 17:05:56 +01:00
Victor Stinner a9073564ee
gh-110481: Fix typo in Py_SET_REFCNT() (#112595) 2023-12-01 15:54:40 +00:00
Zackery Spytz 0daf555c6f
bpo-37013: Fix the error handling in socket.if_indextoname() (GH-13503)
* Fix a crash when pass UINT_MAX.
* Fix an integer overflow on 64-bit non-Windows platforms.
2023-12-01 15:16:49 +00:00
Alex Waygood 70a38ffb3d
gh-109413: libregrtest: enable mypy's --strict-optional check on most files (#112586)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-01 14:54:33 +00:00
Victor Stinner 5f6ac2d88a
gh-110481: Fix Py_SET_REFCNT() integer overflow (#112174)
If Py_NOGIL is defined and Py_SET_REFCNT() is called with a reference
count larger than UINT32_MAX, make the object immortal.

Set _Py_IMMORTAL_REFCNT constant type to Py_ssize_t to fix the
following compiler warning:

Include/internal/pycore_global_objects_fini_generated.h:14:24:
warning: comparison of integers of different signs: 'Py_ssize_t'
(aka 'long') and 'unsigned int' [-Wsign-compare]

    if (Py_REFCNT(obj) < _Py_IMMORTAL_REFCNT) {
        ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~
2023-12-01 15:50:16 +01:00
Tian Gao c2982380f8
gh-112510: Add readline.backend for the backend readline uses (GH-112511)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Donghee Na <donghee.na92@gmail.com>
2023-12-01 14:05:55 +00:00
Victor Stinner f8ff80f635
gh-109413: regrtest: add WorkerRunTests class (#112588) 2023-12-01 13:46:50 +00:00
Zackery Spytz 058444308a
gh-82565: Add tests for pickle and unpickle with bad files (GH-16606) 2023-12-01 13:36:37 +00:00
Pablo Galindo Salgado a73aa48e6b
gh-112367: Only free perf trampoline arenas at shutdown (#112368)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2023-12-01 13:20:51 +00:00
Irit Katriel bfb576ee23
gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed coroutine/generator. (#112428) 2023-12-01 12:57:31 +00:00
Rémi Lapeyre a65a3d4806
bpo-39912: Raise appropriate exceptions in filterwarnings() and simplefilter() (GH-18878) 2023-12-01 11:17:47 +00:00
dependabot[bot] 847e4fe0e8
build(deps): bump hypothesis from 6.88.1 to 6.91.0 in /Tools (#112580)
Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.88.1 to 6.91.0.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.88.1...hypothesis-python-6.91.0)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 11:17:24 +00:00
dependabot[bot] f21e2f4b12
build(deps): bump actions/github-script from 6 to 7 (#112584)
Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 11:41:09 +01:00
Yang Hau 707c37e373
Fix typos in variable names, function names, and comments (GH-101868) 2023-12-01 09:37:40 +00:00
dependabot[bot] 467e3f9417
build(deps-dev): bump types-setuptools from 68.2.0.0 to 69.0.0.0 in /Tools (#112582)
build(deps-dev): bump types-setuptools in /Tools

Bumps [types-setuptools](https://github.com/python/typeshed) from 68.2.0.0 to 69.0.0.0.
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-setuptools
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 09:29:04 +00:00
dependabot[bot] 19a86148e6
build(deps-dev): bump mypy from 1.7.0 to 1.7.1 in /Tools (#112581)
Bumps [mypy](https://github.com/python/mypy) from 1.7.0 to 1.7.1.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 09:21:45 +00:00
William Andrea f6afa426d8
Add links under "generator expression" in glossary (#112537) 2023-12-01 00:41:11 -08:00
Terry Jan Reedy e44f1940bd
gh-66819: More IDLE htest updates (#112574)
Revise htest.py docstring and move 2 specs to alphabetical position.
2023-12-01 07:02:31 +00:00
Donghee Na 5b0629966f
gh-112205: Update stringio module to use AC for the thread-safe (gh-112549) 2023-12-01 08:37:30 +09:00
Alex Waygood 674c288b1c
gh-109413: Run mypy on libregrtest in CI (#112558)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-11-30 23:00:14 +00:00
Brett Cannon 6d5e0dc0e3
Clarify a comment for test.support.Py_C_RECURSION_LIMIT to point out where a value came from but that it doesn't need to stay in sync (#112224) 2023-11-30 13:38:10 -08:00
Alperen Serkan Aksöz 730d450d43
gh-112502: Docs: Improve docs for gc.collect method (#112562)
* Docs: Improve docs for gc.collect method

* Update gc.rst
2023-11-30 21:04:00 +00:00
Brett Cannon 482b0ee8f6
Clarify that WASI tool requirements are included in the devcontainer (GH-112561) 2023-11-30 13:01:07 -08:00
Serhiy Storchaka 2223899adc
gh-104231: Add more tests for str(), repr(), ascii(), and bytes() (GH-112551) 2023-11-30 17:22:04 +02:00
Matt Prodani 1ff212debd
gh-111699: Move smtpd note to dedicated section in What's New Python 3.12 doc (GH-112544)
Relocate smtpd deprecation notice to it's own section rather than under
'locale' in docs for What's New in Python 3.12 doc
2023-11-30 14:53:19 +02:00
Irit Katriel 07ebd46f9e
gh-112519: Make it possible to specify instruction flags for pseudo instructions in bytecodes.c (#112520) 2023-11-30 11:03:30 +00:00
Donghee Na 7eeea13403
gh-112205: Support @getter annotation from AC (gh-112396) 2023-11-30 19:40:53 +09:00
Kirill Podoprigora 0785c68559
gh-111972: Make Unicode name C APIcapsule initialization thread-safe (#112249) 2023-11-30 11:12:49 +01:00
Terry Jan Reedy 81261fa67f
IDLE: fix config_key htest (#112545)
Change 'Dialog' to 'Window' in two places to match the name of the config_key class being tested.
2023-11-30 07:08:44 +00:00
Brett Cannon 37589d76bb
GH-103065, GH-106704, GH-105253: Provide a Tools/wasm/wasi.py script to simplify doing a WASI build (GH-112473) 2023-11-29 16:18:25 -08:00
Jelle Zijlstra d4a6229afe
gh-104003: Implement PEP 702 (#104004)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-29 09:38:29 -08:00
Jelle Zijlstra 4038869423
gh-112509: Fix keys being present in both required_keys and optional_keys in TypedDict (#112512)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-29 09:36:48 -08:00
Serhiy Storchaka e0449b9a7f
Add more C API tests (GH-112522)
Add tests for PyObject_Str(), PyObject_Repr(), PyObject_ASCII() and
PyObject_Bytes().
2023-11-29 17:37:05 +02:00
Ethan Furman f9e6ce0395
[Enum] update class creation for RuntimeError changes (GH-111815) 2023-11-28 20:40:12 -08:00
Guido van Rossum e723700190
Rename ...Uop... to ...UOp... (uppercase O) for consistency (#112327)
* Rename _PyUopExecute to _PyUOpExecute (uppercase O) for consistency
* Also rename _PyUopName and _PyUOp_Replacements, and some output strings
2023-11-28 17:10:11 -08:00
Grant Ramsay e413daf5f6
gh-112454: Disable TLS-PSK if OpenSSL was built without PSK support (#112491)
If OpenSSL was built without PSK support, the python TLS-PSK
methods will raise "NotImplementedError" if called.

Add a constant "ssl.HAS_PSK" to check if TLS-PSK is supported
2023-11-28 16:15:39 -08:00
Itamar Oren 48dfd74a9d
GH-112245: Promote free threaded CI (#112246) 2023-11-28 08:45:03 -07:00
Hugo van Kemenade 3fdf7ae3d1
gh-110930: Correct book title by Alan D. Moore (#112490) 2023-11-28 16:46:00 +02:00
James Morris a194938f33
gh-112431: Unconditionally call hash -r (GH-112432)
The `activate` script calls `hash -r` in two places to make sure the shell picks
up the environment changes the script makes. Before that, it checks to
see if the shell running the script is bash or zsh.

`hash -r` is specified by POSIX and is not exclusive to bash and zsh.
This guard prevents the script from calling `hash -r` in other
`#!/bin/sh`-compatible shells like dash.
2023-11-28 14:54:59 +05:30
Sergey B Kirpichev f14d741daa
gh-109802: Increase test coverage for complexobject.c (GH-112452) 2023-11-28 10:18:33 +02:00
Irit Katriel 2c68011780
gh-112332: Deprecate TracebackException.exc_type, add exc_type_str. (#112333) 2023-11-28 08:03:25 +00:00
Tian Gao 2df26d8348
gh-112105: Make completer delims work on libedit (gh-112106) 2023-11-28 06:23:23 +00:00
Radislav Chugunov ac4b44266d
gh-112071: Make _random.Random methods thread-safe in --disable-gil builds (gh-112128)
Co-authored-by: Donghee Na <donghee.na@python.org>
2023-11-28 03:27:39 +00:00
Anthony Shaw 154f099e61
gh-112292 : Catch import error conditions with readline hooks (gh-112313)
Prevents a segmentation fault in registered hooks for the readline library, but only when the readline module is loaded inside an isolated sub interpreter.  The module is single-phase init so loading it fails, but not until the module init function has already run, where the readline hooks get registered.

The readlinestate_global macro was error-prone to PyImport_FindModule returning NULL and crashing in about 18 places.  I could reproduce 1 easily, but this PR replaces the macro with a function and adds error conditions to the other functions.
2023-11-27 18:58:53 -07:00
Alex Waygood 2e632fa07d
Docs: fix markup for importlib.machinery.NamespaceLoader (#112479) 2023-11-28 00:15:23 +00:00