Commit graph

119244 commits

Author SHA1 Message Date
Victor Stinner 232465204e
gh-85283: Add PySys_Audit() to the limited C API (#108571)
The PySys_Audit() function was added in Python 3.8 by the PEP 578
"Python Runtime Audit Hooks".

Add also PySys_AuditTuple() to the limited C API, function added
to Python 3.13.

Move non-limited "PerfMap" C API from Include/sysmodule.h to
Include/cpython/sysmodule.h.
2023-10-17 16:02:23 +02:00
Victor Stinner 6db6b30ac2
gh-85283: Build winsound extension with limited C API (#110978)
Replace type->tp_name with PyType_GetQualName().
2023-10-17 15:57:10 +02:00
Matthieu Dartiailh 198aa67d4c
gh-107457: update dis documentation with changes in 3.12 (#108900) 2023-10-17 12:59:34 +00:00
Pablo Galindo Salgado 24e4ec7766
gh-110938: Fix error messages for indented blocks with functions and classes with generic type parameters (#110973) 2023-10-17 13:45:13 +01:00
Victor Stinner be5e8a0103
gh-110964: Remove private _PyArg functions (#110966)
Move the following private functions and structures to
pycore_modsupport.h internal C API:

* _PyArg_BadArgument()
* _PyArg_CheckPositional()
* _PyArg_NoKeywords()
* _PyArg_NoPositional()
* _PyArg_ParseStack()
* _PyArg_ParseStackAndKeywords()
* _PyArg_Parser structure
* _PyArg_UnpackKeywords()
* _PyArg_UnpackKeywordsWithVararg()
* _PyArg_UnpackStack()
* _Py_ANY_VARARGS()

Changes:

* Python/getargs.h now includes pycore_modsupport.h to export
  functions.
* clinic.py now adds pycore_modsupport.h when one of these functions
  is used.
* Add pycore_modsupport.h includes when a C extension uses one of
  these functions.
* Define Py_BUILD_CORE_MODULE in C extensions which now include
  directly or indirectly (via code generated by Argument Clinic)
  pycore_modsupport.h:

  * _csv
  * _curses_panel
  * _dbm
  * _gdbm
  * _multiprocessing.posixshmem
  * _sqlite.row
  * _statistics
  * grp
  * resource
  * syslog

* _testcapi: bad_get() no longer uses METH_FASTCALL calling
  convention but METH_VARARGS. Replace _PyArg_UnpackStack() with
  PyArg_ParseTuple().
* _testcapi: add PYTESTCAPI_NEED_INTERNAL_API macro which is defined
  by _testcapi sub-modules which need the internal C API
  (pycore_modsupport.h): exceptions.c, float.c, vectorcall.c,
  watchers.c.
* Remove Include/cpython/modsupport.h header file.
  Include/modsupport.h no longer includes the removed header file.
* Fix mypy clinic.py
2023-10-17 14:30:31 +02:00
Victor Stinner 054f496bd4
gh-85283: Fix Argument Clinic for md5 extension (#110976)
Limited C API supports the defining class under some conditions.
2023-10-17 13:46:16 +02:00
Victor Stinner 4dba0a6d87
gh-85283: Build md5 extension with limited C API (#110967)
* Replace _Py_strhex() with few lines of code.
* Replace _PyType_GetModuleState() with PyType_GetModuleState().
* Fix make check-c-globals.
2023-10-17 10:57:41 +00:00
Nikita Sobolev b75b1f389f
Bump test deps: ruff and pre-commit-hooks (#110972) 2023-10-17 10:32:29 +00:00
Victor Stinner db15fc23c6
gh-110968: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED new in 3.13. (#110969)
* Only add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED to limited C API
  version 3.13.
* errno, xxlimited and _ctypes_test extensions now need the limited C
  API version 3.13 to get Py_MOD_PER_INTERPRETER_GIL_SUPPORTED.  They
  now include standard header files explicitly: <errno.h>, <string.h>
  and <stdio.h>.
* xxlimited_35: Remove Py_mod_multiple_interpreters slot,
  incompatible with limited C API version 3.5.
2023-10-17 12:27:16 +02:00
Victor Stinner 9a9fba825f
gh-110695: test_asyncio uses 50 ms for clock resolution (#110952)
Before utils.CLOCK_RES constant was added (20 ms), test_asyncio
already used 50 ms.
2023-10-17 11:34:04 +02:00
Alex Waygood 78e4a6de48
Bump sphinx-lint to v0.8.1 (#110933) 2023-10-16 23:26:06 -06:00
Victor Stinner 37bd8726b8
gh-85283: Build errno and _ctypes_test with limited C API (#110955)
_testimportmultiple is now built with limited C API version 3.2.
2023-10-17 01:05:20 +00:00
Victor Stinner cc71cc9256
gh-85283: Add PyMem_RawMalloc() to the limited C API (#108570)
Add PyMem_RawMalloc(), PyMem_RawCalloc(), PyMem_RawRealloc() and
PyMem_RawFree() to the limited C API.

These functions were added by Python 3.4 and are needed to port
stdlib extensions to the limited C API, like grp and pwd.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-10-17 02:41:51 +02:00
Victor Stinner cf9c25c719
gh-85283: Build _testimportmultiple with limited C API (#110954) 2023-10-17 02:27:15 +02:00
Donghee Na 86559ddfec
gh-109693: Update _gil_runtime_state.locked to use pyatomic.h (gh-110836) 2023-10-17 07:32:50 +09:00
Eric Snow 06f844eaa0
gh-84570: Factor Out _channel_send_wait() (gh-110949)
This makes several subsequent changes cleaner.
2023-10-16 21:42:57 +00:00
Lysandros Nikolaou f46333b9f5
gh-107450: Remove unnecessary overflow check in parser error handler (#110940) 2023-10-16 22:41:01 +02:00
Pieter Eendebak a77180e663
gh-110905: [Enum] minor fixes and cleanup (GH-110906) 2023-10-16 13:37:54 -07:00
Mienxiu f07ca27709
C-API docs: Clarify the size of arenas (#110895)
Clarify the size of arenas

From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
2023-10-16 19:52:13 +01:00
Nikita Sobolev 6a4528d70c
gh-110864: TypeVar constructor: Partially revert gh-110784, constraints cannot be NULL (#110922) 2023-10-16 15:01:04 +00:00
Alex Waygood 02d26c4bef
Enable ruff on several more files in Lib/test (#110929) 2023-10-16 15:57:01 +01:00
Lysandros Nikolaou a1ac5590e0
gh-107450: Check for overflow in the tokenizer and fix overflow test (#110832)
Co-authored-by: Filipe Laíns <lains@riseup.net>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-10-16 16:42:49 +02:00
Pablo Galindo Salgado b3c9faf056
gh-110912: Correctly display tracebacks for MemoryError exceptions using the traceback module (#110921) 2023-10-16 15:39:23 +01:00
Nikita Sobolev bad7a35055
gh-110907: AC: Disallow using * with vararg (#110908) 2023-10-16 15:26:11 +01:00
Alex Waygood 14d2d1576d
gh-110923: Fix silently skipped tests in test__opcode.py (#110926) 2023-10-16 13:30:35 +00:00
Nikita Sobolev bfc1cd8145
gh-110527: Improve PySet_Clear docs (#110528) 2023-10-16 15:05:09 +02:00
Nikita Sobolev c2192a2bee
gh-110864: Fix _PyArg_UnpackKeywordsWithVararg overwriting vararg with NULL (#110868) 2023-10-16 13:42:44 +02:00
Karolina Surma db656aebc6
sysconfig docs: fix broken link to the source code (#110920)
It's now a package. See: 4a53a397c3
2023-10-16 12:27:12 +01:00
Radislav Chugunov 162213f2db
gh-108791: Fix pdb CLI invalid argument handling (#108816) 2023-10-16 10:38:07 +01:00
Zachary Ware b75186f69e
regrtest: Prepend 'use' options in --{fast,slow}-ci (GH-110363)
This allows individual resources to be disabled without having to explicitly re-enable all others.
2023-10-15 20:34:28 +02:00
partev 42a5d21d46
gh-110886 Doc: add a link to BNF Wikipedia article (#110887)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-10-15 10:52:13 -06:00
Hugo van Kemenade 9608704cde
Lint: Include test_monitoring.py for Ruff (#110898) 2023-10-15 17:48:00 +01:00
Tian Gao fa18b0afe4
gh-84583: Make pdb enter post-mortem mode even for SyntaxError (#110883) 2023-10-15 11:55:00 +01:00
Łukasz Langa 84b7e9e3fa
gh-110722: Add PYTHON_PRESITE to import a module before site.py is run (#110769) 2023-10-14 23:32:57 +02:00
Serhiy Storchaka ab08ff7882
bpo-42663: Fix parsing TZ strings in zoneinfo module (GH-23825)
zipinfo now supports the full range of values in the TZ string
determined by RFC 8536 and detects all invalid formats.
Both Python and C implementations now raise exceptions of the same
type on invalid data.
2023-10-14 23:24:33 +03:00
Nikita Sobolev 12deda7633
gh-101100: Fix sphinx warnings in library/time.rst (#110862) 2023-10-14 16:20:19 +02:00
Thomas Grainger 596589104f
remove redundant call to attach_loop in watcher (#110847) 2023-10-14 10:24:02 +02:00
Kirill Podoprigora 4110cfec12
gh-110715: Add missing import in zipfile (gh-110822) 2023-10-14 16:17:47 +09:00
Serhiy Storchaka e2b3d831fd
gh-109747: Improve errors for unsupported look-behind patterns (GH-109859)
Now re.error is raised instead of OverflowError or RuntimeError for
too large width of look-behind pattern.

The limit is increased to 2**32-1 (was 2**31-1).
2023-10-14 09:13:02 +03:00
Serhiy Storchaka ca0f3d858d
gh-107705: Fix file leak in test_tkinter in the C locale (GH-110507) 2023-10-14 09:09:07 +03:00
Serhiy Storchaka 38bd2c520a
gh-88434: Emit deprecation warnings for non-integer numbers in gettext if translation not found (GH-110574) 2023-10-14 09:07:02 +03:00
Nikita Sobolev 45cfabb842
gh-101100: Fix sphinx warnings in usage/cmdline.rst (#110841) 2023-10-14 08:05:46 +02:00
Serhiy Storchaka 9d40ebf190
gh-110628: Add tests for PyLong C API (GH-110629) 2023-10-14 08:53:57 +03:00
Serhiy Storchaka 84e2096fbd
gh-110392: Fix tty functions (GH-110642)
* tty.setraw() and tty.setcbreak() previously returned partially modified
  list of the original tty attributes. Now they return the correct list of
  the original tty attributes

* tty.cfmakeraw() and tty.cfmakecbreak() now make a copy of the list of
  special characters before modifying it.
2023-10-14 08:50:41 +03:00
Serhiy Storchaka 7284e0ef84
gh-110815: Support non-ASCII keyword names in PyArg_ParseTupleAndKeywords() (GH-110816)
It already mostly worked, except in the case when invalid keyword
argument with non-ASCII name was passed to function with non-ASCII
parameter names. Then it crashed in the debug mode.
2023-10-14 08:50:03 +03:00
Victor Stinner ce298a1c15
regrtest: --fast-ci/slow-ci no longer imply --rerun-fail (#110849) 2023-10-14 00:25:38 +00:00
Donghee Na b2ab210aae
gh-109693: Update pyruntimestate._finalizing to use pyatomic.h (gh-110837) 2023-10-13 16:40:15 +00:00
Victor Stinner 8f07b6e4e3
gh-110697: test_os TimerfdTests uses selectors (#110789)
Replace select.epoll() with selectors.DefaultSelector to support
FreeBSD 14 and newer.

* Merge common code between test_timerfd_epoll()
  test_timerfd_ns_epoll().
* Replace "_ = func()" with "func()".
* Add TimerfdTests.read_count_signaled() method.
2023-10-13 16:20:18 +02:00
Russell Keith-Magee a7e2a10a85
gh-110771: Decompose run_forever() into parts (#110773)
Effectively introduce an unstable, private (really: protected) API for subclasses that want to override `run_forever()`.
2023-10-13 14:12:32 +00:00
Alex Waygood 0ed2329a16
Bump sphinx-lint to 0.7.0 (#110830) 2023-10-13 13:58:26 +00:00