Commit graph

117259 commits

Author SHA1 Message Date
Victor Stinner cbb9ba844f
gh-92536: Argument Clinic no longer emits PyUnicode_READY() (#105208)
Since Python 3.12, PyUnicode_READY() does nothing and always
returns 0.

Argument Clinic now also checks for .cpp files (PC/_wmimodule.cpp).
2023-06-02 01:31:58 +02:00
Eric Snow 146939306a
gh-104614: Make Sure ob_type is Always Set Correctly by PyType_Ready() (gh-105122)
When I added the relevant condition to type_ready_set_bases() in gh-103912, I had missed that the function also sets tp_base and ob_type (if necessary).  That led to problems for third-party static types.

We fix that here, by making those extra operations distinct and by adjusting the condition to be more specific.
2023-06-01 22:28:31 +00:00
Eric Snow 3698fda06e
gh-104341: Call _PyEval_ReleaseLock() with NULL When Finalizing the Current Thread (gh-105109)
This avoids the problematic race in drop_gil() by skipping the FORCE_SWITCHING code there for finalizing threads.

(The idea for this approach came out of discussions with @markshannon.)
2023-06-01 16:24:10 -06:00
Erlend E. Aasland 8a8ebf2e3d
GH-89886: Bump to GNU Autoconf v2.71 (#104925)
Co-authored-by: Christian Heimes <christian@python.org>
2023-06-01 23:44:25 +02:00
Irit Katriel 60f8117d0c
gh-105140: remove unused arg of _PyErr_ChainStackItem (#105141) 2023-06-01 20:57:28 +00:00
Gregory P. Smith ede89af605
gh-103142: Upgrade binary builds and CI to OpenSSL 1.1.1u (#105174)
Upgrade builds to OpenSSL 1.1.1u.

This OpenSSL version addresses a pile if less-urgent CVEs since 1.1.1t.

The Mac/BuildScript/build-installer.py was already updated.

Also updates _ssl_data_111.h from OpenSSL 1.1.1u, _ssl_data_300.h from 3.0.9, and adds a new _ssl_data_31.h file from 3.1.1 along with the ssl.c code to use it.

Manual edits to the _ssl_data_300.h file prevent it from removing any existing definitions in case those exist in some peoples builds and were important (avoiding regressions during backporting).

backports of this prior to 3.12 will not include the openssl 3.1 header.
2023-06-01 09:42:18 -07:00
Lysandros Nikolaou a241003d04
gh-105191: Cleanup peg generator; keep only necessary files (#105197) 2023-06-01 17:24:15 +02:00
Victor Stinner c67121ac6b
gh-105145: Deprecate Py_GetPath() function (#105179)
Deprecate old Python initialization functions:

* PySys_ResetWarnOptions()
* Py_GetExecPrefix()
* Py_GetPath()
* Py_GetPrefix()
* Py_GetProgramFullPath()
* Py_GetProgramName()
* Py_GetPythonHome()

_tkinter.c uses sys.executable instead of Py_GetProgramName()
and uses sys.prefix instead of Py_GetPrefix().
2023-06-01 12:06:32 +00:00
Victor Stinner ec0082ca46
gh-105182: Remove PyEval_AcquireLock() and PyEval_InitThreads() (#105183)
Remove functions in the C API:

* PyEval_AcquireLock()
* PyEval_ReleaseLock()
* PyEval_InitThreads()
* PyEval_ThreadsInitialized()

But keep these functions in the stable ABI.

Mention "make regen-limited-abi" in "make regen-all".
2023-06-01 13:41:56 +02:00
Erlend E. Aasland 9ab587b714
gh-89886: Rely on HAVE_SYS_TIME_H (#105058)
Quoting autoconf (v2.71):

    All current systems provide time.h; it need not be checked for.
    Not all systems provide sys/time.h, but those that do, all allow
    you to include it and time.h simultaneously.
2023-06-01 13:37:40 +02:00
Irit Katriel 76b9c0cfaa
remove unused #includes of pycore_pymem.h (#105166) 2023-06-01 12:12:53 +01:00
Artem Mukhin 85b0b0cd94
gh-103224: Use the realpath of the Python executable in test_venv (GH-103243)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-06-01 10:39:59 +01:00
Victor Stinner 27f9491c60
gh-105107: Remove PyCFunction_Call() function (#105181)
* Keep the function in the stable ABI.
* Add unit tests on PyCFunction_Call() since it remains supported in
  the stable ABI.
2023-06-01 11:25:55 +02:00
Victor Stinner 7f5afecfd7
gh-105156: Update Lib/test/clinic.test manually (#105180)
Update Lib/test/clinic.test manually for updated Py_UNICODE
converter: it now uses wchar_t type rather than Py_UNICODE.
2023-06-01 10:46:17 +02:00
Nikita Sobolev 201440e97a
Fix docstring of warnings._deprecated to show correct remove value (#105178) 2023-06-01 08:07:52 +00:00
Victor Stinner 7d07e5891d
gh-105156: Cleanup usage of old Py_UNICODE type (#105158)
* refcounts.dat:

  * Remove Py_UNICODE functions.
  * Replace Py_UNICODE argument type with wchar_t.

* _PyUnicode_ToLowercase(), _PyUnicode_ToUppercase(),
  _PyUnicode_ToTitlecase() are no longer deprecated in comments.
  It's no longer needed since they now use Py_UCS4 type, rather than
  the deprecated Py_UNICODE type.
* gdb: Remove unused char_width() method.
2023-06-01 07:18:09 +00:00
Victor Stinner 424049cc11
gh-105145: Remove old functions to config Python init (#105154)
Remove the following old functions to configure the Python
initialization, deprecated in Python 3.11:

* PySys_AddWarnOptionUnicode()
* PySys_AddWarnOption()
* PySys_AddXOption()
* PySys_HasWarnOptions()
* PySys_SetArgvEx()
* PySys_SetArgv()
* PySys_SetPath()
* Py_SetPath()
* Py_SetProgramName()
* Py_SetPythonHome()
* Py_SetStandardStreamEncoding()
* _Py_SetProgramFullPath()

Most of these functions are kept in the stable ABI, except:

* Py_SetStandardStreamEncoding()
* _Py_SetProgramFullPath()

Update Doc/extending/embedding.rst and Doc/extending/extending.rst to
use the new PyConfig API.

_testembed.c:

* check_stdio_details() now sets stdio_encoding and stdio_errors
  of PyConfig.
* Add definitions of functions removed from the API but kept in the
  stable ABI.
* test_init_from_config() and test_init_read_set() now use
  PyConfig_SetString() instead of PyConfig_SetBytesString().

Remove _Py_ClearStandardStreamEncoding() internal function.
2023-06-01 09:14:02 +02:00
Victor Stinner 8ed705c083
gh-105156: Deprecate the old Py_UNICODE type in C API (#105157)
Deprecate the old Py_UNICODE and PY_UNICODE_TYPE types in the C API:
use wchar_t instead.

Replace Py_UNICODE with wchar_t in multiple C files.

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2023-06-01 08:56:35 +02:00
Bar Harel f332594dd4
gh-105172: Fixed functools.lru_cache typed argument docstring. (GH-105173) 2023-05-31 17:56:06 -05:00
sunmy2019 a99b9d911e
gh-102251: Explicitly free state for test modules with state in test_import (#105085)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-31 23:12:10 +02:00
Pablo Galindo Salgado 60cfc6d1ae
Clarify that error messages are better with PEP 701 (#105150)
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2023-05-31 22:01:29 +01:00
Tian Gao d944d873b2
gh-103464: Add checks for arguments of pdb commands (GH-103465) 2023-05-31 20:51:46 +00:00
Steve Dower ed86e14b16
gh-105146: Update links at end of Windows installer (uninstall/repair) (GH-105147) 2023-05-31 21:42:54 +01:00
Irit Katriel f990bb8b2d
gh-105148: make _PyASTOptimizeState internal to ast_opt.c (#105149) 2023-05-31 20:21:46 +01:00
Victor Stinner dd29ae26f8
gh-105156: Argument Clinic avoids Py_UNICODE type (#105161)
Argument Clinic now uses "const wchar_t*" type instead of
"const Py_UNICODE*" type for the "Py_UNICODE" format.
2023-05-31 17:52:33 +00:00
Alex Waygood c05c31db8c
gh-105144: Runtime-checkable protocols: move all 'sanity checks' to _ProtocolMeta.__subclasscheck__ (#105152) 2023-05-31 17:02:25 +00:00
Guido van Rossum df396b59af
gh-104909: Split BINARY_OP into micro-ops (#104910)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2023-05-31 08:09:23 -07:00
Irit Katriel fbc9d0dbb2
gh-105111: remove deprecated macros Py_TRASHCAN_SAFE_BEGIN and Py_TRASHCAN_SAFE_END (#105112) 2023-05-31 15:44:11 +01:00
Victor Stinner 0430e97097
gh-104773: cgi: Fix typo in What's New in Python 3.13 (#105139) 2023-05-31 14:54:07 +02:00
Victor Stinner 03ad6624c2
gh-105096: Deprecate wave getmarkers() method (#105098)
wave: Deprecate the getmark(), setmark() and getmarkers() methods of
the Wave_read and Wave_write classes. They will be removed in Python
3.15.
2023-05-31 12:09:41 +00:00
Victor Stinner 58a2e09816
gh-62948: IOBase finalizer logs close() errors (#105104) 2023-05-31 11:41:19 +00:00
Victor Stinner 85e5d03163
gh-105096: Reformat wave documentation (#105136)
Add ".. class::" markups in the wave documentation.

* Reformat also wave.py (minor PEP 8 changes).
* Remove redundant "import struct": it's already imported at top
  level.
* Remove wave.rst from .nitignore
2023-05-31 11:29:10 +00:00
Victor Stinner 579c41c102
gh-105107: Remove PyEval_CallFunction() function (#105108)
Remove 4 functions from the C API, deprecated in Python 3.9:

* PyEval_CallObjectWithKeywords()
* PyEval_CallObject()
* PyEval_CallFunction()
* PyEval_CallMethod()

Keep 3 functions in the stable ABI:

* PyEval_CallObjectWithKeywords()
* PyEval_CallFunction()
* PyEval_CallMethod()
2023-05-31 11:17:06 +00:00
Inada Naoki adccff3b3f
gh-104922: Make PY_SSIZE_T_CLEAN not mandatory again (#105051) 2023-05-31 18:38:55 +09:00
Ned Deily f90d3f68db
gh-103142: Update macOS installer to use OpenSSL 1.1.1u. (GH-105130) 2023-05-31 05:44:10 +00:00
Carl Meyer 5701799067
gh-97933: add LOAD_FAST_AND_CLEAR to 3.12 What's New bytecode section (#105126) 2023-05-30 20:19:25 -06:00
Carl Meyer 7fbac51baf
gh-87729: add LOAD_SUPER_ATTR to 3.12 What's New (#105125) 2023-05-30 20:19:04 -06:00
Eric Snow 7be667dfaf
gh-105020: Share tp_bases and tp_mro Between Interpreters For All Static Builtin Types (gh-105115)
In gh-103912 we added tp_bases and tp_mro to each PyInterpreterState.types.builtins entry.  However, doing so ignored the fact that both PyTypeObject fields are public API, and not documented as internal (as opposed to tp_subclasses).  We address that here by reverting back to shared objects, making them immortal in the process.
2023-05-31 00:13:35 +00:00
Eric Snow 26e7bbf66e
gh-102304: Fix 2 New Stable ABI Functions (gh-104762) 2023-05-30 22:40:07 +00:00
Lysandros Nikolaou 70f315c2d6
gh-105042: Disable unmatched parens syntax error in python tokenize (#105061) 2023-05-30 22:52:52 +01:00
Pablo Galindo Salgado 9216e69a87
gh-105069: Add a readline-like callable to the tokenizer to consume input iteratively (#105070) 2023-05-30 22:43:34 +01:00
Erlend E. Aasland 2ea34cfb3a
gh-89886: Properly quote Autoconf macro arguments (#105062)
Autoconf 2.70 macros are picky about argument quotation.
2023-05-30 21:13:08 +00:00
Carl Meyer 68c75c3153
gh-105035: fix super() calls on unusual types (e.g. meta-types) (#105094) 2023-05-30 14:36:24 -06:00
Barney Gale 49f90ba1ea
GH-73435: Implement recursive wildcards in pathlib.PurePath.match() (#101398)
`PurePath.match()` now handles the `**` wildcard as in `Path.glob()`, i.e. it matches any number of path segments.

We now compile a `re.Pattern` object for the entire pattern. This is made more difficult by `fnmatch` not treating directory separators as special when evaluating wildcards (`*`, `?`, etc), and so we arrange the path parts onto separate *lines* in a string, and ensure we don't set `re.DOTALL`.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-30 20:18:09 +00:00
Hugo van Kemenade 4c770617c0
CI: Temporarily skip paths with spaces to avoid error (#105110)
* CI: Temporarily skip paths with spaces to avoid "Error: One of your files includes a space"

* Dummy NEWS file to test the action. Will be deleted before merge.

* Revert "Dummy NEWS file to test the action. Will be deleted before merge."

This reverts commit 05cd028fd4.
2023-05-30 23:01:58 +03:00
Irit Katriel 4571eedca2
gh-105071: add missing versionadded directive (#105097) 2023-05-30 18:03:20 +01:00
Victor Stinner 4b65d5638c
gh-80064: Fix is_valid_wide_char() return type (#105099)
Return a classical int, rather than size_t. The size_t type was
kept from copied/pasted code related to mbstowcs().
2023-05-30 18:36:20 +02:00
Raymond Hettinger 18cfc1eea5
Small speedup for dataclass __eq__ and __repr__ (#104904)
Faster __repr__ with str.__add__ moved inside the f-string. For __eq__ comp;are field by field instead of building temporary tuples.

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-30 12:35:30 -04:00
Alex Waygood c8c1e73d95
gh-103921: Minor PEP-695 fixes to the ast module docs (#105093) 2023-05-30 09:19:10 -07:00
Petr Viktorin 0656d23d82
gh-105091: stable_abi.py: Remove "Unixy" check from --all on other platforms (GH-105092) 2023-05-30 17:45:56 +02:00