Commit Graph

7562 Commits

Author SHA1 Message Date
Erlend E. Aasland 6849acb3fe
gh-105875: Require SQLite 3.15.2 or newer (#105876)
SQLite 3.15.2 was released 2016-11-28.
2023-06-19 00:29:08 +02:00
Irit Katriel 14d01262da
gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions (#105865) 2023-06-17 17:00:16 +01:00
Brandt Bucher 2beab5bdef
GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847) 2023-06-16 11:01:15 -07:00
Jelle Zijlstra 957a974d4f
gh-104799: PEP 695 backward compatibility for ast.unparse (#105846) 2023-06-16 09:31:23 -07:00
Tian Gao 25a64fd28a
GH-103124: Multiline statement support for pdb (GH-103125) 2023-06-15 23:34:42 +00:00
Brandt Bucher a4056c8f9c
GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589) 2023-06-15 15:45:13 -07:00
Lysandros Nikolaou 3af2dc7588
gh-105831: Fix NEWS blurb from gh-105828 (#105833) 2023-06-15 19:10:33 +02:00
Lysandros Nikolaou d382ad4915
gh-105820: Fix tok_mode expression buffer in file & readline tokenizer (#105828) 2023-06-15 16:21:24 +00:00
Pablo Galindo Salgado 12b6d844d8
gh-105800: Issue SyntaxWarning in f-strings for invalid escape sequences (#105801) 2023-06-15 01:08:12 +01:00
Mark Shannon 1d857da7f0
GH-77273: Better bytecodes for f-strings (GH-6132) 2023-06-14 16:15:08 +01:00
Alex Waygood 7b1f0f204a
gh-105570: Deprecate unusual ways of creating empty TypedDicts (#105780)
Deprecate two methods of creating typing.TypedDict classes with 0 fields using the functional syntax: `TD = TypedDict("TD")` and `TD = TypedDict("TD", None)`. Both will be disallowed in Python 3.15. To create a TypedDict class with 0 fields, either use `class TD(TypedDict): pass` or `TD = TypedDict("TD", {})`.
2023-06-14 14:58:41 +00:00
Mark Shannon 7199584ac8
GH-100987: Allow objects other than code objects as the "executable" of an internal frame. (GH-105727)
* Add table describing possible executable classes for out-of-process debuggers.

* Remove shim code object creation code as it is no longer needed.

* Make lltrace a bit more robust w.r.t. non-standard frames.
2023-06-14 13:46:37 +01:00
Alex Waygood ad56340b66
gh-105566: Deprecate unusual ways of creating `typing.NamedTuple` classes (#105609)
Deprecate creating a typing.NamedTuple class using keyword arguments to denote the fields (`NT = NamedTuple("NT", x=int, y=str)`). This will be disallowed in Python 3.15. Use the class-based syntax or the functional syntax instead.

Two methods of creating `NamedTuple` classes with 0 fields using the functional syntax are also deprecated, and will be disallowed in Python 3.15: `NT = NamedTuple("NT")` and `NT = NamedTuple("NT", None)`. To create a `NamedTuple` class with 0 fields, either use `class NT(NamedTuple): pass` or `NT = NamedTuple("NT", [])`.
2023-06-14 13:38:49 +01:00
Jelle Zijlstra fc8037d84c
gh-104873: Add typing.get_protocol_members and typing.is_protocol (#104878)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-14 05:35:06 -07:00
Kirill Podoprigora ba516e70c6
gh-102541: Hide traceback in help prompt (gh-102614) 2023-06-14 21:17:12 +09:00
Nikita Sobolev e5d45b7444
gh-105745: Fix open method of webbrowser.Konqueror (#105746) 2023-06-14 12:29:16 +02:00
Nikita Sobolev 67f69dba0a
gh-105687: Remove deprecated objects from `re` module (#105688) 2023-06-14 12:26:20 +02:00
Eddie Elizondo 6199fe3b32
gh-105587: Remove assertion from `_PyStaticObject_CheckRefcnt` (#105638) 2023-06-14 10:03:32 +05:30
Victor Stinner b542972dc1
gh-105387: Limited C API implements Py_INCREF() as func (#105388)
In the limited C API version 3.12, Py_INCREF() and Py_DECREF()
functions are now implemented as opaque function calls to hide
implementation details.
2023-06-14 02:33:00 +02:00
zentarim f3266c05b6
GH-104554: Add RTSPS support to `urllib/parse.py` (#104605)
* GH-104554: Add RTSPS support to `urllib/parse.py`

RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.

* 📜🤖 Added by blurb_it.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-06-13 16:45:47 -07:00
Eric Snow 757b402ea1
gh-104812: Run Pending Calls in any Thread (gh-104813)
For a while now, pending calls only run in the main thread (in the main interpreter).  This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run.
2023-06-13 15:02:19 -06:00
Victor Stinner 2211454fe2
gh-105733: Deprecate ctypes SetPointerType() and ARRAY() (#105734) 2023-06-13 18:16:26 +00:00
Eric Snow b97e14a806
gh-105603: Change the PyInterpreterConfig.own gil Field (gh-105620)
We are changing it to be more flexible that a strict bool can be for possible future expanded used cases.
2023-06-13 11:08:32 -06:00
Mark Shannon 09ffa69e2e
GH-105678: Split MAKE_FUNCTION into MAKE_FUNCTION and SET_FUNCTION_ATTRIBUTE (GH-105680) 2023-06-13 09:51:05 +01:00
Erlend E. Aasland 217589d4f3
gh-105375: Improve error handling in _Unpickler_SetInputStream() (#105667)
Prevent exceptions from possibly being overwritten in case of multiple
failures.
2023-06-13 10:38:01 +02:00
Kumar Aditya 840d02f3f0
GH-105684: Require `asyncio.Task` implementations to support `set_name` method (#105685) 2023-06-13 06:06:40 +00:00
Jay f0fb782ddb
gh-105331: Change `asyncio.sleep` to raise ``ValueError` for nan (#105641)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-06-12 20:29:02 +00:00
Dora203 4f7d3b602d
gh-105436: The environment block should end with two null wchar_t values (GH-105495) 2023-06-12 17:14:55 +01:00
Petr Viktorin 2b90796be6
gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL (GH-105386) 2023-06-12 17:45:49 +02:00
Erlend E. Aasland 20a56d8bec
gh-105375: Harden pyexpat initialisation (#105606)
Add proper error handling to add_errors_module() to prevent exceptions
from possibly being overwritten.
2023-06-11 20:18:46 +00:00
Erlend E. Aasland 41cddc2e93
gh-105375: Improve error handling in the sys extension module (#105611)
In _PySys_AddXOptionWithError() and sys_add_xoption(),
bail on first error to prevent exceptions from possibly being
overwritten.
2023-06-11 20:02:49 +00:00
Erlend E. Aasland e8998e46a7
gh-105375: Improve error handling in _ctypes (#105593)
Prevent repeated PyLong_FromVoidPtr() from possibly overwriting the
current exception.
2023-06-11 19:46:19 +00:00
Erlend E. Aasland 555be81026
gh-105375: Improve error handling in PyUnicode_BuildEncodingMap() (#105491)
Bail on first error to prevent exceptions from possibly being overwritten.
2023-06-11 21:29:19 +02:00
Erlend E. Aasland 567d6ae8e7
gh-105375: Improve PyErr_WarnExplicit() error handling (#105610)
Bail on first error to prevent exceptions from possibly being
overwritten.
2023-06-11 21:23:28 +02:00
Samet YASLAN 3f7c0810f6
bpo-44185: Added close() to mock_open __exit__ (#26902) 2023-06-11 19:51:21 +01:00
Tomas R 18d16e93b6
gh-102676: Add more convenience properties to `dis.Instruction` (#103969)
Adds start_offset, cache_offset, end_offset, baseopcode,
baseopname, jump_target and oparg to dis.Instruction.

Also slightly improves the disassembly output by allowing
opnames to overflow into the space reserved for opargs.
2023-06-11 08:50:34 -07:00
Erlend E. Aasland d4fa52934a
gh-105375: Improve error handling in the builtins extension module (#105585) 2023-06-11 12:20:43 +02:00
Erlend E. Aasland c932f72849
gh-105375: Improve _decimal error handling (#105605)
Fix a bug where an exception could end up being overwritten.
2023-06-11 12:06:06 +02:00
Erlend E. Aasland 16d49680b5
gh-105375: Harden _datetime initialisation (#105604)
Improve error handling so init bails on the first exception.
2023-06-11 12:03:09 +02:00
Erlend E. Aasland 35cff545db
gh-105375: Improve array.array exception handling (#105594)
Fix a bug where 'tp_richcompare' could end up overwriting an exception.
2023-06-11 11:58:08 +02:00
Erlend E. Aasland 01f4230460
gh-105375: Harden _ssl initialisation (#105599)
Add proper error handling to prevent reference leaks and overwritten
exceptions.
2023-06-11 11:56:32 +02:00
Hugo van Kemenade cc879481e2
gh-80480: Emit DeprecationWarning for array's 'u' type code (#95760) 2023-06-11 03:17:35 -06:00
Nikita Sobolev 33c92c4f15
gh-105375: Improve error handling in `zoneinfo` module (#105586)
Fix bugs where exceptions could end up being overwritten
because of deferred error handling.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-09 21:48:54 +00:00
Erlend E. Aasland 91441bf7cb
Docs: fix formatting in 2023-06-09-12-59-18 NEWS item (#105607) 2023-06-09 23:14:02 +02:00
Pablo Galindo Salgado b047fa5e56
gh-105549: Tokenize separately NUMBER and NAME tokens and allow 0-prefixed literals (#105555) 2023-06-09 21:39:01 +01:00
Erlend E. Aasland 00b599ab5a
gh-105375: Improve error handling in _elementtree (#105591)
Fix bugs where exceptions could end up being overwritten.
2023-06-09 22:35:03 +02:00
Erlend E. Aasland f668f73bc8
gh-105375: Improve posix error handling (#105592)
Fix a bug where an IndexError could end up being overwritten.
2023-06-09 22:07:47 +02:00
Erlend E. Aasland eede1d2f48
gh-105375: Improve errnomodule error handling (#105590)
Bail immediately if an exception is set, to prevent exceptions from
being overwritten.
2023-06-09 21:57:25 +02:00
Erlend E. Aasland 89aac6f6b7
gh-105375: Improve _pickle error handling (#105475)
Error handling was deferred in some cases, which could potentially lead
to exceptions being overwritten.
2023-06-09 19:09:53 +02:00
Erlend E. Aasland 6c832ddcf2
gh-105375: Improve error handling in compiler_enter_scope() (#105494) 2023-06-09 18:55:53 +02:00
Pablo Galindo Salgado d7f46bcd98
gh-105564: Don't include artificial newlines in the line attribute of tokens (#105565) 2023-06-09 17:01:26 +01:00
Ethan Furman 59f009e589
gh-105497: [Enum] Fix Flag inversion when alias/mask members exist. (GH-105542)
When inverting a Flag member (or boundary STRICT), only consider other canonical flags; when inverting an IntFlag member (or boundary KEEP), also consider aliases.
2023-06-09 08:56:05 -07:00
Thomas Grainger 9bf8d825a6
gh-94924: support `inspect.iscoroutinefunction` in `create_autospec(async_def)` (#94962)
* support inspect.iscoroutinefunction in create_autospec(async_def)

* test create_autospec with inspect.iscoroutine and inspect.iscoroutinefunction

* test when create_autospec functions check their signature
2023-06-09 13:29:09 +00:00
Nikita Sobolev 947ec7ab02
gh-105545: Remove deprecated `MacOSXOSAScript._name` (gh-105546) 2023-06-09 08:52:58 +00:00
Victor Stinner 3e525d2212
gh-105396: Deprecate PyImport_ImportModuleNoBlock() function (#105397)
Deprecate the PyImport_ImportModuleNoBlock() function which is just
an alias to PyImport_ImportModule() since Python 3.3.
2023-06-09 10:30:57 +02:00
Nikita Sobolev 4ff5690e59
gh-105332: [Enum] Fix unpickling flags in edge-cases (GH-105348)
* revert enum pickling from by-name to by-value

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2023-06-08 11:40:15 -07:00
Eric Snow 34c63b86d3
gh-104310: Rename the New Function in importlib.util (gh-105255)
The original name wasn't as clear as it could have been. This change includes the following:

* rename the function
* change the default value for "disable_check" to False
* add clues to the docstring that folks should probably not use the function

---------

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2023-06-08 18:19:58 +00:00
Mark Shannon e830289c52
GH-105229: Remove remaining two-codeunit superinstructions (GH-105326)
* Remove LOAD_CONST__LOAD_FAST and LOAD_FAST__LOAD_CONST superinstructions.
2023-06-08 12:35:34 +01:00
Dong-hee Na aa5b762bd3
gh-104635: Eliminate redundant STORE_FAST instructions in the compiler (gh-105320) 2023-06-08 08:39:56 +09:00
Barney Gale ffeaec7e60
GH-104996: Defer joining of `pathlib.PurePath()` arguments. (GH-104999)
Joining of arguments is moved to `_load_parts`, which is called when a
normalized path is needed.
2023-06-07 23:27:06 +01:00
Pablo Galindo Salgado 7279fb6408
gh-105435: Fix spurious NEWLINE token if file ends with comment without a newline (#105442) 2023-06-07 13:31:48 +01:00
Erlend E. Aasland a24a780d93
gh-105375: Improve error handling in sqlite3 collation callback (#105412)
Check for error after each call to PyUnicode_FromStringAndSize().
2023-06-07 13:10:28 +02:00
Pablo Galindo Salgado ffd2654550
gh-105390: Correctly raise TokenError instead of SyntaxError for tokenize errors (#105399) 2023-06-07 12:04:40 +01:00
Jeffery To 990cb3676c
gh-104692: Include commoninstall as a prerequisite for bininstall (#104693)
This ensures that `commoninstall` is completed before `bininstall` is
started when parallel builds are used (`make -j install`), and so the
`python3` symlink is only installed after all standard library modules
are installed.

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2023-06-07 08:59:56 +02:00
Barney Gale 24af45172f
GH-102613: Fast recursive globbing in `pathlib.Path.glob()` (GH-104512)
This commit introduces a 'walk-and-match' strategy for handling glob patterns that include a non-terminal `**` wildcard, such as `**/*.py`. For this example, the previous implementation recursively walked directories using `os.scandir()` when it expanded the `**` component, and then **scanned those same directories again** when expanded the `*.py` component. This is wasteful.

In the new implementation, any components following a `**` wildcard are used to build a `re.Pattern` object, which is used to filter the results of the recursive walk. A pattern like `**/*.py` uses half the number of `os.scandir()` calls; a pattern like `**/*/*.py` a third, etc.

This new algorithm does not apply if either:

1. The *follow_symlinks* argument is set to `None` (its default), or
2. The pattern contains `..` components.

In these cases we fall back to the old implementation.

This commit also replaces selector classes with selector functions. These generators directly yield results rather calling through to their successors. A new internal `Path._glob()` method takes care to chain these generators together, which simplifies the lazy algorithm and slightly improves performance. It should also be easier to understand and maintain.
2023-06-06 23:50:36 +01:00
Victor Stinner 2587b9f64e
gh-105382: Remove urllib.request cafile parameter (#105384)
Remove cafile, capath and cadefault parameters of the
urllib.request.urlopen() function, deprecated in Python 3.6.
2023-06-06 21:17:45 +00:00
Victor Stinner 6c54e5d721
gh-105376: Remove logging.Logger.warn() method (#105377) 2023-06-06 18:35:51 +00:00
Victor Stinner 0cb6b9b0db
gh-104783: Remove locale.resetlocale() function (#104784) 2023-06-06 14:55:50 +02:00
Pablo Galindo Salgado c0a6ed3934
gh-105259: Ensure we don't show newline characters for trailing NEWLINE tokens (#105364) 2023-06-06 12:52:16 +01:00
Victor Stinner 8ddf0dd264
gh-105268: Remove _PyGC_FINALIZED() macro (#105350)
Remove the old private, undocumented and untested _PyGC_FINALIZED()
macro which was kept for backward compatibility with Python 3.8 and
older.
2023-06-06 11:54:23 +02:00
Erlend E. Aasland e01c4de35d
gh-90005: Don't link with libbsd if not needed (#105236)
The regression was introduced with commit 5b946cada.
Restore pre gh-29696 behaviour.
2023-06-06 09:33:01 +00:00
Irit Katriel f4d8e10d0d
gh-105292: Add option to make traceback.TracebackException.format_exception_only recurse into exception groups (#105294)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-06-06 11:26:18 +02:00
Victor Stinner bae415ad02
gh-102304: doc: Add links to Stable ABI and Limited C API (#105345)
* Add "limited-c-api" and "stable-api" references.
* Rename "stable-abi-list" reference to "limited-api-list".
* Makefile: Document files regenerated by "make regen-limited-abi"
* Remove first empty line in generated files:

  - Lib/test/test_stable_abi_ctypes.py
  - PC/python3dll.c
2023-06-06 08:40:32 +00:00
Christopher Chavez 00d73caf80
gh-104399: Use newer libtommath APIs when necessary (GH-104407) 2023-06-06 09:52:07 +03:00
Pablo Galindo Salgado f04c16875b
gh-105324: Fix tokenize module main function for stdin (#105325) 2023-06-05 18:36:40 +02:00
Jakub Kuczys a4f72fa39a
gh-89412: Add missing attributes (added in 3.10) to traceback module docs (#105046) 2023-06-05 18:10:13 +02:00
Alex Waygood 08756dbba6
gh-105280: Ensure `isinstance([], collections.abc.Mapping)` always evaluates to `False` (#105281) 2023-06-05 14:10:49 +00:00
Alex Waygood cdfb201bfa
gh-105237: Allow calling `issubclass(X, typing.Protocol)` again (#105239) 2023-06-05 06:36:51 -07:00
Jelle Zijlstra 69d1245685
gh-105164: Detect annotations inside match blocks (#105177) 2023-06-05 06:07:17 -07:00
Mark Shannon 0689340366
GH-105229: Replace some superinstructions with single instruction equivalent. (GH-105230) 2023-06-05 11:07:04 +01:00
Tian Gao 9efaff5fd3
gh-103558: Add coverage tests for argparse (#103570)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
2023-06-05 00:14:00 -07:00
Gregory P. Smith 418befd75d
gh-98963: Restore the ability to have a dict-less property. (#105262)
Ignore doc string assignment failures in `property` as has been the
behavior of all past Python releases.
2023-06-05 03:18:15 +00:00
Inada Naoki 1237fb6a4b
gh-80480: array: Add 'w' typecode. (#105242) 2023-06-04 16:45:00 +00:00
chgnrdv ce558e69d4
gh-104690 Disallow thread creation and fork at interpreter finalization (#104826)
Disallow thread creation and fork at interpreter finalization.

in the following functions, check if interpreter is finalizing and raise `RuntimeError` with appropriate message:
* `_thread.start_new_thread` and thus `threading`
* `posix.fork`
* `posix.fork1`
* `posix.forkpty`
* `_posixsubprocess.fork_exec` when a `preexec_fn=` is supplied.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-06-04 04:06:45 +00:00
Tian Gao 9ad199ba36
gh-105080: Fixed inconsistent signature on derived classes (#105217) 2023-06-02 16:22:33 -06:00
Brett Cannon 70dc2fb973
GH-102404, GH-100956: Document how to do a WASI build (GH-105251)
Also includes a reference shell script to implements what is documented.
2023-06-02 15:15:41 -07:00
Pablo Galindo Salgado 41de54378d
gh-105194: Fix format specifier escaped characters in f-strings (#105231) 2023-06-02 13:33:26 +02:00
Mark Shannon 4bfa01b9d9
GH-104584: Plugin optimizer API (GH-105100) 2023-06-02 11:46:18 +01:00
Mark Shannon 601ae09f0c
GH-105162: Account for `INSTRUMENTED_RESUME` in gen.close/throw. (GH-105187) 2023-06-02 10:39:38 +01:00
Jelle Zijlstra 77d2579586
gh-104799: Default missing lists in AST to the empty list (#104834)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-01 18:39:39 -07:00
Inada Naoki 37498fc950
gh-85275: Remove old buffer APIs (#105137)
They are now abi-only.

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-06-02 01:12:40 +00: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
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
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
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 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
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
Alex Waygood c05c31db8c
gh-105144: Runtime-checkable protocols: move all 'sanity checks' to `_ProtocolMeta.__subclasscheck__` (#105152) 2023-05-31 17:02:25 +00: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 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 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
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
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
Irit Katriel b7aadb4583
gh-105071: add PyUnstable_Exc_PrepReraiseStar to expose except* implementation in the unstable API (#105072) 2023-05-30 15:03:36 +01:00
Miro Hrončok bd98b65e97
gh-105084: Tests: Use setuptools+wheel from sysconfig.get_config_var('WHEEL_PKG_DIR') if set (#105056) 2023-05-30 11:20:30 +01:00
Steve Dower cda1bd3c9d
gh-88745: Add _winapi.CopyFile2 and update shutil.copy2 to use it (GH-105055) 2023-05-30 11:00:29 +01:00
Jakub Kuczys 39f6a0489f
GH-89455: Add missing attributes (added in 3.11) to traceback module docs (#105044) 2023-05-29 18:28:37 +00:00
Steve Dower 6da701511e
gh-103646: Remove --include-pip-user from default APPX package build (GH-105064) 2023-05-29 17:58:23 +01:00
Barney Gale ace676e2c2
GH-77609: Add follow_symlinks argument to `pathlib.Path.glob()` (GH-102616)
Add a keyword-only *follow_symlinks* parameter to `pathlib.Path.glob()` and`rglob()`.

When *follow_symlinks* is `None` (the default), these methods follow symlinks except when evaluating "`**`" wildcards. When set to true or false, symlinks are always or never followed, respectively.
2023-05-29 16:59:52 +01:00
Steve Dower bfd20d257e
gh-104803: Implement ntpath.isdevdrive for checking whether a path is on a Windows Dev Drive (GH-104805) 2023-05-29 10:05:32 +01:00
Marta Gómez Macías 96fff35325
gh-105017: Include CRLF lines in strings and column numbers (#105030)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2023-05-28 15:15:53 +01:00
Pablo Galindo Salgado 3a5be878be
gh-105013: Fix inspect.getsource with parenthesized multiline lambdas (#105021) 2023-05-28 00:20:42 +01:00
Hugo van Kemenade b225c08de8
gh-104992: Remove deprecated unittest.TestProgram.usageExit (#104993) 2023-05-27 21:34:14 +00:00
Zachary Ware a989b73e8e
gh-75552: Remove deprecated tkinter.tix module (GH-104902) 2023-05-27 12:34:19 -05:00
Marta Gómez Macías 86d8f48935
gh-105017: Fix including additional NL token when using CRLF (#105022)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2023-05-27 16:50:43 +00:00
Pablo Galindo Salgado 46b52e6e2b
gh-104976: Ensure trailing dedent tokens are emitted as the previous tokenizer (#104980)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2023-05-26 22:02:26 +01:00
Raymond Hettinger 402ee5a68b
GH-101588: Deprecate pickle/copy/deepcopy support in itertools (GH-104965) 2023-05-26 15:32:53 -05:00
Barney Gale 328422ce61
GH-103631: Fix `PurePosixPath(PureWindowsPath(...))` separator handling (GH-104949)
For backwards compatibility, accept backslashes as path separators in
`PurePosixPath` if an instance of `PureWindowsPath` is supplied.
This restores behaviour from Python 3.11.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-26 18:05:43 +00:00
Barney Gale ad0be361c9
GH-104947: Make pathlib.PureWindowsPath comparisons consistent across platforms (GH-104948)
Use `str.lower()` rather than `ntpath.normcase()` to normalize case of
Windows paths. This restores behaviour from Python 3.11.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-26 18:04:02 +00:00
Pablo Galindo Salgado 3fdb55c482
gh-104972: Ensure that line attributes in tokens in the tokenize module are correct (#104975) 2023-05-26 15:46:22 +01:00
Hugo van Kemenade 5ab4bc05c4
gh-104804: Remove webbrowser.MacOSX class, deprecated in Python 3.11 (#104816)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-05-26 16:54:15 +03:00
Victor Stinner e399f46a77
gh-104773: PEP 594: Remove the imghdr module (#104777)
* Remove the Lib/test/imghdrdata/ directory.
* Copy 5 pictures (gif, png, ppm, pgm, xbm) from removed
  Lib/test/imghdrdata/ to a new Lib/test/tkinterdata/ directory.
* Update Sphinx from 4.5 to 6.2 in Doc/requirements.txt.
2023-05-26 13:29:45 +00:00
Jelle Zijlstra ba73473f4c
gh-104799: Move location of type_params AST fields (#104828)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-26 05:54:37 -07:00
Jelle Zijlstra 6e1eccdcce
gh-104955: Fix __release_buffer__ signature (#104956)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-05-26 05:44:23 -07:00
Kumar Aditya 7fc542c88d
GH-89091: raise `RuntimeWarning` for unawaited async generator methods (#104611) 2023-05-26 16:53:29 +05:30
Tomas R 46857d0b2a
gh-104943: Remove mentions of old Python versions (#104945) 2023-05-25 23:34:17 -07:00
Hugo van Kemenade 3f9c60f51e
gh-104886: Remove deprecated configparser.LegacyInterpolation (#104887)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-05-26 06:06:32 +00:00
Andrii Kuzmin 0242e9a57a
gh-102024: Reduced _idle_semaphore.release calls (#102025)
Reduced _idle_semaphore.release calls in concurrent.futures.thread._worker
_idle_semaphore.release() is now only called if only work_queue is empty.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-05-25 22:48:40 -07:00
Hugo van Kemenade 10c45838e1
gh-104876: Remove deprecated turtle.RawTurtle.settiltangle (#104877)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-05-26 07:25:52 +03:00
Barney Gale bd1b6228d1
GH-104898: Add __slots__ to os.PathLike (GH-104899) 2023-05-25 21:24:20 +01:00
Tomas R fea8632ec6
gh-104786: Remove kwargs-based TypedDict creation (#104891)
Deprecated since Python 3.11.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-25 21:14:58 +01:00
Gregory P. Smith d08679212d
gh-104372: Drop the GIL around the vfork() call. (#104782)
On Linux where the `subprocess` module can use the `vfork` syscall for
faster spawning, prevent the parent process from blocking other threads
by dropping the GIL while it waits for the vfork'ed child process `exec`
outcome.  This prevents spawning a binary from a slow filesystem from
blocking the rest of the application.

Fixes #104372.
2023-05-25 20:14:09 +00:00
Jelle Zijlstra 2b7027d0b2
gh-104935: typing: Fix interactions between `@runtime_checkable` and `Generic` (#104939)
---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-25 16:43:40 +00:00
Victor Stinner 77d7ec5aa9
gh-104773: PEP 594: Remove the chunk module (#104868)
The module had no tests.
2023-05-25 16:27:55 +00:00
Victor Stinner f66be6b11a
gh-104773: PEP 594: Remove the audioop module (#104937) 2023-05-25 17:59:00 +02:00
Victor Stinner 036da3bd43
gh-104773: PEP 594: Remove the aifc module (#104933)
* Remove .aifc and .aiff test files of Lib/test/audiodata/
* Remove Lib/test/Sine-1000Hz-300ms.aif test file
2023-05-25 17:20:48 +02:00
Victor Stinner dbc8216f4c
gh-104773: PEP 594: Remove the uu module (#104932)
Doc/license.rst: Keep the UUencode and UUdecode license since it's
also used by the uu codec.
2023-05-25 16:25:27 +02:00
Victor Stinner e4127eaa1e
gh-104773: PEP 594: Remove the crypt module (#104908)
Remove the crypt module and its private _crypt extension, deprecated
in Python 3.11.
2023-05-25 15:45:46 +02:00
Zachary Ware 98c4333e88
gh-104773: Remove the msilib package (GH-104911) 2023-05-24 20:06:00 -05:00
Jelle Zijlstra 41768a2bd3
gh-104874: Document NewType.__supertype__ (#104875) 2023-05-25 00:23:28 +01:00
Steve Dower 6031727a37
gh-104820: Fixes os.stat on Windows to better handle file systems that do not support FileIdInformation (GH-104892) 2023-05-25 00:16:13 +01:00