Commit Graph

119902 Commits

Author SHA1 Message Date
Serhiy Storchaka da6760bdf5
gh-65210: Add const qualifiers in PyArg_VaParseTupleAndKeywords() (GH-105958)
Change the declaration of the keywords parameter in functions
PyArg_ParseTupleAndKeywords() and PyArg_VaParseTupleAndKeywords() from `char **`
to `char * const *` in C and `const char * const *` in C++.

It makes these functions compatible with argument of type `const char * const *`,
`const char **` or `char * const *` in C++ and `char * const *` in C
without explicit type cast.

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-12-04 13:14:56 +02:00
Alex Waygood cda737924f
gh-101100: Fix Sphinx nitpicks in `library/functions.rst` (#112669) 2023-12-04 11:05:20 +00:00
Victor Stinner a74902a14c
gh-106550: Fix sign conversion in pycore_code.h (#112613)
Fix sign conversion in pycore_code.h: use unsigned integers and cast
explicitly when needed.
2023-12-04 11:42:58 +01:00
Serhiy Storchaka dee7beeb4f
bpo-34392: Add sys. _is_interned() (GH-8755) 2023-12-04 11:09:06 +02:00
chilaxan 0e732d0997
gh-112625: Protect bytearray from being freed by misbehaving iterator inside bytearray.join (GH-112626) 2023-12-04 08:15:43 +00:00
Christopher Chavez 23e001fa9f
gh-112678: Declare `Tkapp_CallDeallocArgs()` as `static` (GH-112679) 2023-12-04 08:00:27 +00:00
Terry Jan Reedy e5b0db0315
gh-66819: More IDLE htest updates(4) (#112686)
Mostly double spacing before 'if __name__...'.
2023-12-04 06:36:40 +00:00
Terry Jan Reedy 5a1b5316af
gh-66819: More IDLE htest updates(3) (#112683)
Revise spec-callable pairs from percolator to end.
2023-12-03 23:45:56 -05:00
Barney Gale 09505c5c26
GH-106747: Improve `Path.glob()` expectations in pathlib tests (#112365)
Add trailing slashes to expected `Path.glob()` results wherever a pattern
has a trailing slash. This matches what `glob.glob()` produces.

Due to another bug (GH-65238) pathlib strips all trailing slashes, so this
change is academic for now.
2023-12-03 20:35:10 +00:00
Hugo van Kemenade 489aeac3a2
gh-101100: Fix Sphinx warning in `library/gettext.rst` (#112668)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-03 20:23:09 +00:00
Alex Waygood 45650d1c47
gh-101100: Fix most Sphinx nitpicks in `inspect.rst` (#112662) 2023-12-03 17:32:49 +00:00
Marco Aurélio A. Barbosa c27b09c813
Fix link to 'The Perils of Floating Point', on the tutorial (GH-112499)
Use author link to 'The Perils of Floating Point'.
2023-12-03 17:14:14 +02:00
Irit Katriel 97857ac058
gh-112645: remove deprecation warning for use of onerror in shutil.rmtree (#112659) 2023-12-03 14:02:37 +00:00
Irit Katriel 162d3d428a
gh-112620: Fix dis error on show_cache with labels (#112621) 2023-12-03 12:12:49 +00:00
Alex Waygood 4ed46d2244
Run more `inspect.rst` code snippets in CI (#112654) 2023-12-03 11:50:22 +00:00
Victor Stinner a971574b73
gh-111545: Mention PEP 456 in PyHash_GetFuncDef() doc (#112647) 2023-12-03 11:21:48 +00:00
Victor Stinner d9e444dbb8
gh-106560: Fix redundant declarations in Python/frozen.c (#112612)
Avoid duplicated declarations of "extern" functions in
Python/frozen.c.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
2023-12-03 12:18:24 +01:00
Victor Stinner 1f2a676785
gh-106560: Fix redundant declarations in Include/ (#112611)
Don't declare PyBool_Type, PyLong_Type and PySys_Audit() twice, but
only once.

Compiler warnings seen by building Python with gcc -Wredundant-decls.
2023-12-03 12:16:31 +01:00
Shantanu 29e6c7b68a
gh-112578: Fix RuntimeWarning when running zipfile (GH-112579) 2023-12-03 13:09:29 +02:00
Alex Waygood fc9e24b01f
gh-112316: improve docs for `inspect.signature` and `inspect.Signature` (#112631) 2023-12-03 01:37:34 -08:00
Terry Jan Reedy 3855b45874
gh-66819: More IDLE htest updates(2) (#112642)
Examine and update spec -- callable pairs.
Revise run method.
2023-12-03 09:28:37 +00:00
Nikita Sobolev a9574c68f0
gh-112139: Add `inspect.Signature.format` and use it in `pydoc` (#112143)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-12-02 15:39:43 -08:00
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