Commit Graph

8613 Commits

Author SHA1 Message Date
Mariusz Felisiak 1a10437a14
gh-91602: Add iterdump() support for filtering database objects (#114501)
Add optional 'filter' parameter to iterdump() that allows a "LIKE"
pattern for filtering database objects to dump.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-02-06 12:34:56 +01:00
Erlend E. Aasland 13eb5215c9
gh-115009: Update macOS installer to use SQLite 3.45.1 (#115066)
Co-authored-by: Ned Deily <nad@python.org>
2024-02-06 11:04:35 +01:00
Ned Deily 299e16ca0f
gh-109991: Update GitHub CI workflows to use OpenSSL 3.0.13. (#115050)
Also update multissltests to use 1.1.1w, 3.0.13, 3.1.5, and 3.2.1.
2024-02-05 21:10:11 -05:00
Ned Deily 638e811a3c
gh-109991: Update macOS installer to use OpenSSL 3.0.13. (GH-115052) 2024-02-05 20:59:25 -05:00
Zachary Ware 01dceba13e
gh-109991: Update Windows build to use OpenSSL 3.0.13 (#115043) 2024-02-05 23:10:55 +00:00
Serhiy Storchaka bb57ffdb38
gh-83648: Support deprecation of options, arguments and subcommands in argparse (GH-114086) 2024-02-06 00:41:34 +02:00
mpage c32bae5290
gh-114944: Fix race between `_PyParkingLot_Park` and `_PyParkingLot_UnparkAll` when handling interrupts (#114945)
Fix race between `_PyParkingLot_Park` and `_PyParkingLot_UnparkAll` when handling interrupts

There is a potential race when `_PyParkingLot_UnparkAll` is executing in
one thread and another thread is unblocked because of an interrupt in
`_PyParkingLot_Park`. Consider the following scenario:

1. Thread T0 is blocked[^1] in `_PyParkingLot_Park` on address `A`.
2. Thread T1 executes `_PyParkingLot_UnparkAll` on address `A`. It
   finds the `wait_entry` for `T0` and unlinks[^2] its list node.
3. Immediately after (2), T0 is woken up due to an interrupt. It
   then segfaults trying to unlink[^3] the node that was previously
   unlinked in (2).

To fix this we mark each waiter as unparking before releasing the bucket
lock. `_PyParkingLot_Park` will wait to handle the coming wakeup, and not
attempt to unlink the node, when this field is set. `_PyParkingLot_Unpark`
does this already, presumably to handle this case.
2024-02-05 13:48:37 -08:00
Serhiy Storchaka 652fbf88c4
gh-82626: Emit a warning when bool is used as a file descriptor (GH-111275) 2024-02-05 22:51:11 +02:00
Erlend E. Aasland 09096a1647
gh-115015: Argument Clinic: fix generated code for METH_METHOD methods without params (#115016) 2024-02-05 21:49:17 +01:00
Serhiy Storchaka 4aa4f0906d
gh-109475: Fix support of explicit option value "--" in argparse (GH-114814)
For example "--option=--".
2024-02-05 22:42:43 +02:00
Mark Shannon 36518e69d7
GH-108362: Incremental GC implementation (GH-108038) 2024-02-05 18:28:51 +00:00
Serhiy Storchaka b4ba0f73d6
gh-43457: Tkinter: fix design flaws in wm_attributes() (GH-111404)
* When called with a single argument to get a value, it allow to omit
  the minus prefix.
* It can be called with keyword arguments to set attributes.
* w.wm_attributes(return_python_dict=True) returns a dict instead of 
  a tuple (it will be the default in future).
* Setting wantobjects to 0 no longer affects the result.
2024-02-05 18:24:54 +02:00
Mark Shannon 992446dd5b
GH-113462: Limit the number of versions that a single class can use. (GH-114900) 2024-02-05 16:20:54 +00:00
Terry Jan Reedy e207cc181f
gh-114628: Display csv.Error without context (#115005)
When cvs.Error is raised when TypeError is caught,
the TypeError display and 'During handling' note is just noise
with duplicate information.  Suppress with 'from None'.
2024-02-04 20:57:54 -05:00
Russell Keith-Magee 391659b3da
gh-114099: Add test exclusions to support running the test suite on iOS (#114889)
Add test annotations required to run the test suite on iOS (PEP 730).

The majority of the change involve annotating tests that use subprocess,
but are skipped on Emscripten/WASI for other reasons, and including
iOS/tvOS/watchOS under the same umbrella as macOS/darwin checks.

`is_apple` and `is_apple_mobile` test helpers have been added to
identify *any* Apple platform, and "any Apple platform except macOS",
respectively.
2024-02-05 01:04:57 +01:00
Nikita Sobolev 929d44e15a
gh-114685: PyBuffer_FillInfo() now raises on PyBUF_{READ,WRITE} (GH-114802) 2024-02-04 19:16:43 +00:00
Serhiy Storchaka 7e42fddf60
gh-113951: Tkinter: "tag_unbind(tag, sequence, funcid)" now only unbinds "funcid" (GH-113955)
Previously, "tag_unbind(tag, sequence, funcid)" methods of Text and
Canvas widgets destroyed the current binding for "sequence", leaving
"sequence" unbound, and deleted the "funcid" command.

Now they remove only "funcid" from the binding for "sequence", keeping
other commands, and delete the "funcid" command.
They leave "sequence" unbound only if "funcid" was the last bound command.
2024-02-04 17:49:42 +02:00
Serhiy Storchaka 3ddc515255
gh-114388: Fix warnings when assign an unsigned integer member (GH-114391)
* Fix a RuntimeWarning emitted when assign an integer-like value that
  is not an instance of int to an attribute that corresponds to a C
  struct member of type T_UINT and T_ULONG.
* Fix a double RuntimeWarning emitted when assign a negative integer value
  to an attribute that corresponds to a C struct member of type T_UINT.
2024-02-04 17:32:25 +02:00
Serhiy Storchaka 0ea366240b
gh-113280: Always close socket if SSLSocket creation failed (GH-114659)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2024-02-04 15:28:07 +00:00
Serhiy Storchaka ecabff98c4
gh-113267: Revert "gh-106584: Fix exit code for unittest in Python 3.12 (#106588)" (GH-114470)
This reverts commit 8fc071345b.
2024-02-04 17:27:42 +02:00
Serhiy Storchaka ca715e56a1
gh-69893: Add the close() method for xml.etree.ElementTree.iterparse() iterator (GH-114534) 2024-02-04 17:25:21 +02:00
Serhiy Storchaka fc06096911
gh-83383: Always mark the dbm.dumb database as unmodified after open() and sync() (GH-114560)
The directory file for a newly created database is now created
immediately after opening instead of deferring this until synchronizing
or closing.
2024-02-04 17:23:26 +02:00
Ethan Furman ff7588b729
gh-114071: [Enum] update docs and code for tuples/subclasses (GH-114871)
Update documentation with `__new__` and `__init__` entries.

Support use of `auto()` in tuple subclasses on member assignment lines.  Previously, auto() was only supported on the member definition line either solo or as part of a tuple:

    RED = auto()
    BLUE = auto(), 'azul'

However, since Python itself supports using tuple subclasses where tuples are expected, e.g.:

    from collections import namedtuple
    T = namedtuple('T', 'first second third')

    def test(one, two, three):
        print(one, two, three)

    test(*T(4, 5, 6))
    # 4 5 6

it made sense to also support tuple subclasses in enum definitions.
2024-02-04 07:22:55 -08:00
Stéphane Bidoul a4c298c149
gh-114965: Updated bundled pip to 24.0 (gh-114966)
Updated bundled pip to 24.0
2024-02-03 17:45:09 +00:00
Travis Howse 94ec2b9c9c
gh-114887 Reject only sockets of type SOCK_STREAM in create_datagram_endpoint() (#114893)
Also improve exception message.

Co-authored-by: Donghee Na <donghee.na92@gmail.com>
2024-02-03 17:14:02 +00:00
Kristján Valur Jónsson 6b53d5fe04
gh-112202: Ensure that condition.notify() succeeds even when racing with Task.cancel() (#112201)
Also did a general cleanup of asyncio locks.py comments and docstrings.
2024-02-03 08:19:37 -08:00
Serhiy Storchaka 96bce033c4
gh-114959: tarfile: do not ignore errors when extract a directory on top of a file (GH-114960)
Also, add tests common to tarfile and zipfile.
2024-02-03 16:18:46 +00:00
Malcolm Smith f35c7c070c
gh-114875: Require getgrent for building the grp extension module (#114876)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-02-03 00:30:52 +01:00
Jokimax c4a2e8a2c5
gh-101599: argparse: simplify the option help string (GH-103372)
If the option with argument has short and long names,
output argument only once, after the long name:

   -o, --option ARG    description

instead of

   -o ARG, --option ARG    description
2024-02-02 22:13:00 +00:00
Andrew Rogers b3f0b698da
gh-104530: Enable native Win32 condition variables by default (GH-104531) 2024-02-02 13:50:51 +00:00
Sam Gross d0f1307580
gh-114329: Add `PyList_GetItemRef` function (GH-114504)
The new `PyList_GetItemRef` is similar to `PyList_GetItem`, but returns
a strong reference instead of a borrowed reference. Additionally, if the
passed "list" object is not a list, the function sets a `TypeError`
instead of calling `PyErr_BadInternalCall()`.
2024-02-02 14:03:15 +01:00
Christopher Chavez d25d4ee60c
gh-103820: IDLE: Do not interpret buttons 4/5 as scrolling on non-X11 (GH-103821)
Also fix test_mousewheel: do not skip a check which was broken due to incorrect
delta on Aqua and XQuartz, and probably not because of `.update_idletasks()`.
2024-02-02 10:38:43 +00:00
Zachary Ware 618d7256e7
gh-111239: Update Windows build to use zlib 1.3.1 (GH-114877) 2024-02-01 17:54:02 -06:00
Sam Gross 587d480203
gh-112529: Remove PyGC_Head from object pre-header in free-threaded build (#114564)
* gh-112529: Remove PyGC_Head from object pre-header in free-threaded build

This avoids allocating space for PyGC_Head in the free-threaded build.
The GC implementation for free-threaded CPython does not use the
PyGC_Head structure.

 * The trashcan mechanism uses the `ob_tid` field instead of `_gc_prev`
   in the free-threaded build.
 * The GDB libpython.py file now determines the offset of the managed
   dict field based on whether the running process is a free-threaded
   build. Those are identified by the `ob_ref_local` field in PyObject.
 * Fixes `_PySys_GetSizeOf()` which incorrectly incorrectly included the
   size of `PyGC_Head` in the size of static `PyTypeObject`.
2024-02-01 12:29:19 -08:00
Mark Shannon e66d0399cc
GH-114806. Don't specialize calls to classes with metaclasses. (GH-114870) 2024-02-01 19:39:32 +00:00
Ayappan Perumal 4dbb198d27
gh-105089: Fix test_create_directory_with_write test failure in AIX (GH-105228) 2024-02-01 11:52:54 +00:00
technillogue 5ce193e65a
gh-114364: Fix awkward wording about mmap.mmap.seekable (#114374)
---------
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-02-01 06:03:58 +00:00
Jamie Phan 80aa7b3688
gh-109534: fix reference leak when SSL handshake fails (#114074) 2024-01-31 16:42:17 -08:00
Albert Zeyer 78c254582b
gh-113939: Frame clear, clear locals (#113940) 2024-01-31 19:14:44 +00:00
Nachtalb b905fad838
gh-111741: Recognise image/webp as a standard format in the mimetypes module (GH-111742)
Previously it was supported as a non-standard type.
2024-01-31 17:33:46 +02:00
Tian Gao 765b9ce9fb
gh-59013: Set breakpoint on the first executable line of function when using `break func` in pdb (#112470) 2024-01-31 13:03:05 +00:00
Serhiy Storchaka b7688ef71e
gh-114685: Check flags in PyObject_GetBuffer() (GH-114707)
PyObject_GetBuffer() now raises a SystemError if called with
PyBUF_READ or PyBUF_WRITE as flags. These flags should
only be used with the PyMemoryView_* C API.
2024-01-31 13:11:35 +02:00
Daniel Hollas 5e390a0fc8
gh-109653: Speedup import of threading module (#114509)
Avoiding an import of functools leads to 50% speedup of import time.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-01-31 09:29:44 +00:00
Diego Russo a06b606462
gh-110190: Fix ctypes structs with array on Windows ARM64 (GH-114753) 2024-01-30 23:53:04 +00:00
Barney Gale fda7445ca5
GH-70303: Make `pathlib.Path.glob('**')` return both files and directories (#114684)
Return files and directories from `pathlib.Path.glob()` if the pattern ends
with `**`. This is more compatible with `PurePath.full_match()` and with
other glob implementations such as bash and `glob.glob()`. Users can add a
trailing slash to match only directories.

In my previous patch I added a `FutureWarning` with the intention of fixing
this in Python 3.15. Upon further reflection I think this was an
unnecessarily cautious remedy to a clear bug.
2024-01-30 19:52:53 +00:00
Eugene Toder 1f515e8a10
gh-112919: Speed-up datetime, date and time.replace() (GH-112921)
Use argument clinic and call new_* functions directly. This speeds up
these functions 6x to 7.5x when calling with keyword arguments.
2024-01-30 15:19:46 +00:00
Serhiy Storchaka ea30a28c3e
gh-113732: Fix support of QUOTE_NOTNULL and QUOTE_STRINGS in csv.reader (GH-113738) 2024-01-30 14:21:12 +02:00
Serhiy Storchaka aa3402ad45
gh-114678: Fix incorrect deprecation warning for 'N' specifier in Decimal format (GH-114683)
Co-authored-by: Stefan Krah <skrah@bytereef.org>
2024-01-29 19:58:31 +02:00
Steven Ward 2c089b09ac
gh-112240: Add option to calendar module CLI to specify the weekday to start each week (GH-112241) 2024-01-29 16:58:21 +00:00
Serhiy Storchaka 39c766b579
Fix more references to datetime and time classes (GH-114717)
They could be confused with references to datetime and time modules.
2024-01-29 18:20:13 +02:00
Soumendra Ganguly e351ca3c20
gh-85984: Add POSIX pseudo-terminal functions. (GH-102413)
Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-01-29 16:10:28 +00:00
mpage c87233fd3f
gh-112050: Adapt collections.deque to Argument Clinic (#113963) 2024-01-29 15:08:23 +00:00
Shantanu 2124a3ddcc
gh-109653: Improve import time of importlib.metadata / email.utils (#114664)
My criterion for delayed imports is that they're only worth it if the
majority of users of the module would benefit from it, otherwise you're
just moving latency around unpredictably.

mktime_tz is not used anywhere in the standard library and grep.app
indicates it's not got much use in the ecosystem either.

Distribution.files is not nearly as widely used as other
importlib.metadata APIs, so we defer the csv import.

Before:
```
λ hyperfine -w 8 './python -c "import importlib.metadata"'
Benchmark 1: ./python -c "import importlib.metadata"
  Time (mean ± σ):      65.1 ms ±   0.5 ms    [User: 55.3 ms, System: 9.8 ms]
  Range (min … max):    64.4 ms …  66.4 ms    44 runs
```

After:
```
λ hyperfine -w 8 './python -c "import importlib.metadata"'
Benchmark 1: ./python -c "import importlib.metadata"
  Time (mean ± σ):      62.0 ms ±   0.3 ms    [User: 52.5 ms, System: 9.6 ms]
  Range (min … max):    61.3 ms …  62.8 ms    46 runs
```

for about a 3ms saving with warm disk cache, maybe 7-11ms with cold disk
cache.
2024-01-29 01:30:22 -08:00
Brandt Bucher f6d9e5926b
GH-113464: Add a JIT backend for tier 2 (GH-113465)
Add an option (--enable-experimental-jit for configure-based builds
or --experimental-jit for PCbuild-based ones) to build an
*experimental* just-in-time compiler, based on copy-and-patch (https://fredrikbk.com/publications/copy-and-patch.pdf).

See Tools/jit/README.md for more information on how to install the required build-time tooling.
2024-01-28 18:48:48 -08:00
Furkan Onder f7c05d7ad3
gh-55664: Add warning when creating a type using a namespace dictionary with non-string keys. (GH-105338)
Co-authored-by: Daniel Urban <durban@users.noreply.github.com>
2024-01-29 01:05:29 +02:00
Hugo van Kemenade b6623d61d4
gh-101100: Fix Sphinx warnings in `whatsnew/3.11.rst` and related (#114531) 2024-01-27 06:06:59 -07:00
Neil Schemenauer 7a7bce5a0a
gh-113055: Use pointer for interp->obmalloc state (gh-113412)
For interpreters that share state with the main interpreter, this points
to the same static memory structure.  For interpreters with their own
obmalloc state, it is heap allocated.  Add free_obmalloc_arenas() which
will free the obmalloc arenas and radix tree structures for interpreters
with their own obmalloc state.

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-01-26 19:38:14 -08:00
Aiden Fox Ivey b5c7c84673
gh-114490: Add check for Mach-O linkage in Lib/platform.py (#114491)
``platform.architecture()`` now returns the format of binaries (e.g. Mach-O) instead of the default empty string.

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2024-01-26 21:36:50 +01:00
Barney Gale 7e31d6dea2
gh-88569: add `ntpath.isreserved()` (#95486)
Add `ntpath.isreserved()`, which identifies reserved pathnames such as "NUL", "AUX" and "CON".

Deprecate `pathlib.PurePath.is_reserved()`.

---------

Co-authored-by: Eryk Sun <eryksun@gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2024-01-26 18:14:24 +00:00
Rito Takeuchi 504334c7be
gh-77749: Fix inconsistent behavior of non-ASCII handling in EmailPolicy.fold() (GH-6986)
It now always encodes non-ASCII characters in headers if utf8 is false.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-26 15:19:41 +00:00
Mariusz Felisiak 456e274578
gh-112451: Prohibit subclassing of datetime.timezone. (#114190)
This is consistent with C-extension datetime.timezone.
2024-01-26 09:33:13 +01:00
Nikita Sobolev d96358ff9d
gh-114315: Make `threading.Lock` a real class, not a factory function (#114479)
`threading.Lock` is now the underlying class and is constructable rather than the old
factory function. This allows for type annotations to refer to it which had no non-ugly
way to be expressed prior to this.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-01-25 19:46:32 +00:00
Sam Gross b52fc70d1a
gh-112529: Implement GC for free-threaded builds (#114262)
* gh-112529: Implement GC for free-threaded builds

This implements a mark and sweep GC for the free-threaded builds of
CPython. The implementation relies on mimalloc to find GC tracked
objects (i.e., "containers").
2024-01-25 10:27:36 -08:00
Tian Gao 8278fa2f56
gh-111051: Check if file is modifed during debugging in `pdb` (#111052) 2024-01-25 16:48:50 +00:00
Vincent Cunningham d5c21c12c1
gh-100107: Make py.exe launcher ignore app aliases that launch Microsoft Store (GH-114358) 2024-01-25 00:23:28 +00:00
Mark Shannon 981d172f7f
GH-112354: `END_FOR` instruction to only pop one value. (GH-114247)
* Compiler emits END_FOR; POP_TOP instead of END_FOR. To support tier 2 side exits in loops.
2024-01-24 15:10:17 +00:00
Brett Cannon f59f90b5bc
GH-114456: lower the recursion limit under WASI for debug builds (GH-114457)
Testing under wasmtime 16.0.0 w/ code from https://github.com/python/cpython/issues/114413 is how the value was found.
2024-01-23 15:48:14 -08:00
Serhiy Storchaka d22c066b80
gh-114492: Initialize struct termios before calling tcgetattr() (GH-114495)
On Alpine Linux it could leave some field non-initialized.
2024-01-23 23:27:04 +02:00
Sam Gross ce01ab536f
gh-101438: Avoid reference cycle in ElementTree.iterparse. (GH-114269)
The iterator returned by ElementTree.iterparse() may hold on to a file
descriptor. The reference cycle prevented prompt clean-up of the file
descriptor if the returned iterator was not exhausted.
2024-01-23 20:14:46 +00:00
mpage 925907ea36
gh-113884: Make queue.SimpleQueue thread-safe when the GIL is disabled (#114161)
* use the ParkingLot API to manage waiting threads
* use Argument Clinic's critical section directive to protect queue methods
* remove unnecessary overflow check

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-01-23 20:25:41 +01:00
Fabio Zadrozny 5a1ecc8cc7
gh-114423: Remove DummyThread from threading._active when thread dies (GH-114424) 2024-01-23 14:12:50 +02:00
AN Long 7fc51c3f6b
gh-114257: Ignore the FileNotFound error in ctypes.util._is_elf() (GH-114394) 2024-01-22 17:15:29 +00:00
Irit Katriel ed30a3c337
gh-114083: apply optimization of LOAD_CONST instructions to the whole CFG before optimize_basic_block. (#114408) 2024-01-22 17:12:06 +00:00
Serhiy Storchaka a53e56e7d8
gh-75128: Ignore EADDRNOTAVAIL error in asyncio.BaseEventLoop.create_server() (GH-114420)
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
2024-01-22 18:40:35 +02:00
Serhiy Storchaka 1b719b39b9
gh-114321: Expose more constants in the fcntl module (GH-114322) 2024-01-22 18:09:22 +02:00
Serhiy Storchaka 49785b06de
gh-102512: Turn _DummyThread into _MainThread after os.fork() called from a foreign thread (GH-113261)
Always set a _MainThread as a main thread after os.fork() is called from
a thread started not by the threading module.

A new _MainThread was already set as a new main thread after fork if
threading.current_thread() was not called for a foreign thread before fork.
Now, if it was called before fork, the implicitly created _DummyThread will
be turned into _MainThread after fork.

It fixes, in particularly, an incompatibility of _DummyThread with
the threading shutdown logic which relies on the main thread
having tstate_lock.

Co-authored-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2024-01-22 16:14:42 +02:00
Serhiy Storchaka c8351a617b
gh-113796: Add more validation checks in the csv.Dialect constructor (GH-113797)
ValueError is now raised if the same character is used in different roles.
2024-01-22 15:34:16 +02:00
Gregory P. Smith fd49e22670
gh-114328: tty cbreak mode should not alter ICRNL (#114335)
The terminal CR -> NL mapping setting should be inherited in cbreak mode as OSes do not specify altering it as part of their stty cbreak mode definition.
2024-01-21 15:25:52 -08:00
Nikita Sobolev 0554a9594e
gh-114281: Remove incorrect type hints from `asyncio.staggered` (#114282)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-01-20 16:49:48 +00:00
Barney Gale 1e610fb05f
GH-113225: Speed up `pathlib.Path.walk(top_down=False)` (#113693)
Use `_make_child_entry()` rather than `_make_child_relpath()` to retrieve
path objects for directories to visit. This saves the allocation of one
path object per directory in user subclasses of `PathBase`, and avoids a
second loop.

This trick does not apply when walking top-down, because users can affect
the walk by modifying *dirnames* in-place.

A side effect of this change is that, in bottom-up mode, subdirectories of
each directory are visited in reverse order, and that this order doesn't
match that of the names in *dirnames*. I suspect this is fine as the
order is arbitrary anyway.
2024-01-20 03:06:00 +00:00
Barney Gale 6313cdde58
GH-79634: Accept path-like objects as pathlib glob patterns. (#114017)
Allow `os.PathLike` objects to be passed as patterns to `pathlib.Path.glob()` and `rglob()`. (It's already possible to use them in `PurePath.match()`)

While we're in the area:

- Allow empty glob patterns in `PathBase` (but not `Path`)
- Speed up globbing in `PathBase` by generating paths with trailing slashes only as a final step, rather than for every intermediate directory.
- Simplify and speed up handling of rare patterns involving both `**` and `..` segments.
2024-01-20 02:10:25 +00:00
Irit Katriel 7e49f27b41
gh-114265: move line number propagation before cfg optimization, remove guarantee_lineno_for_exits (#114267) 2024-01-19 14:49:26 +00:00
Skip Montanaro 72abb8c5d4
gh-114123: Migrate docstring from _csv to csv (#114124)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
2024-01-18 22:18:42 +00:00
keithasaurus 2d3f6b56c5
gh-114087: Speed up dataclasses._asdict_inner (#114088) 2024-01-18 09:03:20 -07:00
Phillip Schanely 339fc3c224
gh-114198: Rename dataclass __replace__ argument to 'self' (gh-114251)
This change renames the dataclass __replace__ method's first argument
name from 'obj' to 'self'.
2024-01-18 11:01:17 -05:00
Christopher Chavez b8f29b1293
gh-110345: show Tcl/Tk patchlevel in `tkinter._test()` (GH-110350) 2024-01-18 17:46:58 +02:00
kcatss a571a2fd3f
gh-114050: Fix crash when more than two arguments are passed to int() (GH-114067)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-01-18 13:27:44 +02:00
Terry Jan Reedy 6f4b242a03
gh-96905: In IDLE code, stop redefining built-ins 'dict' and 'object' (#114227)
Prefix 'dict' with 'o', 'g', or 'l' for 'object', 'global', or 'local'.
Suffix 'object' with '_'.
2024-01-18 04:39:12 +00:00
Serhiy Storchaka e2c097ebde
gh-104522: Fix OSError raised when run a subprocess (#114195)
Only set filename to cwd if it was caused by failed chdir(cwd).

_fork_exec() now returns "noexec:chdir" for failed chdir(cwd).

Co-authored-by: Robert O'Shea <PurityLake@users.noreply.github.com>
2024-01-17 16:52:42 -08:00
Steve Dower f56d132deb
gh-112984 Update Windows build and installer for free-threaded builds (GH-113129) 2024-01-17 21:52:23 +00:00
buermarc 78fcde039a
gh-38807: Fix race condition in Lib/trace.py (GH-110143)
Instead of checking if a directory does not exist and thereafter
creating it, directly call os.makedirs() with the exist_ok=True.
2024-01-17 22:02:14 +02:00
Sheidan 0b541f64c4
gh-105102: Fix nested unions in structures when the system byteorder is the opposite (GH-105106) 2024-01-17 18:20:39 +00:00
Ethan Furman 33b47a2c28
gh-114149: [Enum] fix tuple subclass handling when using custom __new__ (GH-114160) 2024-01-17 09:47:11 -08:00
Thomas Wouters 8cf37f244f Merge branch 'main' of https://github.com/python/cpython 2024-01-17 16:19:08 +01:00
Tian Gao 5c351fc85a
gh-112343: pdb: Use tokenize to replace convenience variables (#112380) 2024-01-17 14:50:31 +00:00
Radislav Chugunov 0154405350
gh-104282: Fix null pointer dereference in `lzma._decode_filter_properties` (GH-104283) 2024-01-17 13:15:44 +00:00
Thomas Wouters f009305a7d Python 3.13.0a3 2024-01-17 13:14:40 +01:00
Terry Jan Reedy 4a32275389
gh-72284: Revise lists in IDLE doc (#114174)
Tkinter is a fact, not necessarily a feature.

Reorganize editor key bindings in a logical order
and remove those that do not work, at least on Windows.

Improve shell bindings list.
2024-01-17 07:52:32 +00:00
Brett Cannon 03f7839703
GH-114013: fix setting `HOSTRUNNER` for `Tools/wasm/wasi.py` (GH-114097)
Also fix tests found failing under a pydebug build of WASI thanks to `make test` working due to this change.
2024-01-16 11:36:41 -08:00
Serhiy Storchaka 74208ed0c4
gh-113659: Skip hidden .pth files (GH-113660)
Skip .pth files with names starting with a dot or hidden file attribute.
2024-01-16 20:23:05 +02:00
Steve Dower de4ced54eb
gh-114096: Restore privileges in _winapi.CreateJunction after creating the junction (GH-114089)
This avoids impact on later parts of the application which may be able to do things they otherwise shouldn't.
2024-01-16 16:40:02 +00:00
Serhiy Storchaka d2d8332f71
gh-113626: Add allow_code parameter in marshal functions (GH-113648)
Passing allow_code=False prevents serialization and de-serialization of
code objects which is incompatible between Python versions.
2024-01-16 18:05:15 +02:00
Serhiy Storchaka d4dfad2aa9
gh-114077: Fix OverflowError in socket.sendfile() when pass count >2GiB (GH-114079) 2024-01-16 11:31:34 +00:00
Mike Zimin c85c0026a6
gh-113238: add Anchor to importlib.resources (#113801)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-01-16 10:55:59 +00:00
Jérome Perrin 04fabe22dd
gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-01-16 09:49:24 +00:00
Mark Shannon 17b73ab99e
GH-113655: Lower the C recursion limit on various platforms (GH-113944) 2024-01-16 09:32:01 +00:00
Zackery Spytz 8fd287b18f
gh-78502: Add a trackfd parameter to mmap.mmap() (GH-25425)
If *trackfd* is False, the file descriptor specified by *fileno*
will not be duplicated.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-16 08:51:46 +01:00
Raphaël Marinier 5094690efd
gh-91539: Small performance improvement of urrlib.request.getproxies_environment() (#108771)
Small performance improvement of getproxies_environment() when there are many environment variables. In a benchmark with 5k environment variables not related to proxies, and 5 specifying proxies, we get a 10% walltime improvement.
2024-01-15 15:45:01 -08:00
Kamil Turek d457345bbc
gh-99437: runpy: decode path-like objects before setting globals 2024-01-15 16:58:50 +00:00
Sergey B Kirpichev 0f2fa6150b
gh-109598: make PyComplex_RealAsDouble/ImagAsDouble use __complex__ (GH-109647)
`PyComplex_RealAsDouble()`/`PyComplex_ImagAsDouble` now try to convert
an object to a `complex` instance using its `__complex__()` method
before falling back to the ``__float__()`` method.

PyComplex_ImagAsDouble() also will not silently return 0.0 for
non-complex types anymore.  Instead we try to call PyFloat_AsDouble()
and return 0.0 only if this call is successful.
2024-01-15 16:04:17 +01:00
Ronald Oussoren 2010d45327
gh-113666: Adding missing UF_ and SF_ flags to module 'stat' (#113667)
Add some constants to module 'stat' that are used on macOS.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-15 12:22:43 +01:00
Hugo van Kemenade c2808431b3
gh-101100: Fix Sphinx warnings in `howto/urllib2.rst` and `library/http.client.rst` (#114060) 2024-01-14 20:38:53 +00:00
Serhiy Storchaka 77b45fa6d0
gh-111803: Support loading more deeply nested lists in binary plist format (GH-114024)
It no longer uses the C stack. The depth of nesting is only limited by
Python recursion limit setting.
2024-01-13 15:26:55 +02:00
Crowthebird dd56b57483
gh-114014: Update `fractions.Fraction()`'s rational parsing regex (#114015)
Fix a bug in the regex used for parsing a string input to the `fractions.Fraction` constructor. That bug led to an inconsistent exception message being given for some inputs.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2024-01-13 12:02:39 +00:00
Ronald Oussoren c7d59bd8cf
gh-101225: Increase the socket backlog when creating a multiprocessing.connection.Listener (#113567)
Increase the backlog for multiprocessing.connection.Listener` objects created
 by `multiprocessing.manager` and `multiprocessing.resource_sharer` to
 significantly reduce the risk of getting a connection refused error when creating
 a `multiprocessing.connection.Connection` to them.
2024-01-13 10:48:33 +01:00
Barney Gale e4ff131e01
GH-44626, GH-105476: Fix `ntpath.isabs()` handling of part-absolute paths (#113829)
On Windows, `os.path.isabs()` now returns `False` when given a path that
starts with exactly one (back)slash. This is more compatible with other
functions in `os.path`, and with Microsoft's own documentation.

Also adjust `pathlib.PureWindowsPath.is_absolute()` to call
`ntpath.isabs()`, which corrects its handling of partial UNC/device paths
like `//foo`.

Co-authored-by: Jon Foster <jon@jon-foster.co.uk>
2024-01-13 07:36:05 +00:00
Brett Cannon dac1da2121
GH-111798: skip `test_super_deep()` from `test_call` under pydebug builds on WASI (GH-114010) 2024-01-12 16:29:16 -08:00
Brett Cannon 3c19ee0422
GH-111801: set a lower recursion limit for `test_infintely_many_bases()` in `test_isinstance` (#113997) 2024-01-12 15:19:21 -08:00
Hugo van Kemenade 794983cd61
gh-101100: Fix Sphinx Lint warnings in `Misc/` (#113946)
Fix Sphinx Lint warnings in Misc/
2024-01-13 00:25:04 +02:00
Alois Klink dce30c9cbc
gh-95649: Document that asyncio contains uvloop code (#107536)
Some of the asyncio SSL changes in GH-31275 [1] were taken from
v0.16.0 of the uvloop project [2]. In order to comply with the MIT
license, we need to just need to document the copyright information.

[1]: https://github.com/python/cpython/pull/31275
[2]: https://github.com/MagicStack/uvloop/tree/v0.16.0
2024-01-12 22:21:13 +00:00
Brett Cannon 8aa126354d
GH-111802: set a low recursion limit for `test_bad_getattr()` in `test.pickletester` (GH-113996) 2024-01-12 14:14:09 -08:00
Gregory P. Smith b44b9d9900
gh-113971: Make `zipfile.ZipInfo._compresslevel` public as `.compress_level` (#113969)
Make zipfile.ZipInfo.compress_level public.

A property is used to retain the behavior of the ._compresslevel.

People constructing zipfile.ZipInfo instances to pass into existing APIs to control per-file compression levels already treat this as public, there was never a reason for it not to be.

I used the more modern name compress_level instead of compresslevel as the keyword argument on other ZipFile APIs is called to be consistent with compress_type and a general long term preference of not runningwordstogether without a separator in names.
2024-01-12 20:15:05 +00:00
Ken Jin ac92527c08
gh-113710: Add types to the interpreter DSL (#113711)
Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-01-13 01:30:27 +08:00
Ronald Oussoren 79970792fd
gh-113868: Add a number of MAP_* flags from macOS to module mmap (#113869)
The new flags were extracted from the macOS 14.2 SDK.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-12 16:56:18 +01:00
Irit Katriel 8aa0088ea2
gh-107901: duplicate blocks with no lineno that have an eval break and multiple predecessors (#113950) 2024-01-12 15:38:09 +00:00
Steve Dower ed066481c7
gh-111877: Fixes stat() handling for inaccessible files on Windows (GH-113716) 2024-01-12 15:27:56 +00:00
Mariusz Felisiak de777e490f
gh-108364: In sqlite3, disable foreign keys before dumping SQL schema (#113957)
sqlite3.Connection.iterdump now ensures that foreign key support is
disabled before dumping the database schema, if there is any foreign key
violation.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-01-12 10:50:37 +01:00
Terry Jan Reedy c4992f4106
gh-113903: Fix an IDLE configdialog test (#113973)
test_configdialog.HighPageTest.test_highlight_target_text_mouse fails
if a line of the Highlight tab text sample is not visible. If so, bbox()
in click_char() returns None and the unpacking iteration fails.

This occurred on a Devuan Linux system. Fix by moving the
'see character' call inside click_char, just before the bbox call.

Also, reduce the click_char calls to just one per tag name and
replace the other nested function with a dict comprehension.
2024-01-11 22:10:00 -05:00
Zackery Spytz b4d4aa9e8d
gh-81489: Use Unicode APIs for mmap tagname on Windows (GH-14133)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-01-11 22:39:47 +00:00
Mark Shannon 55824d01f8
GH-113853: Guarantee forward progress in executors (GH-113854) 2024-01-11 18:20:42 +00:00
Irit Katriel 0d8fec79ca
gh-107901: jump leaving an exception handler doesn't need an eval break check (#113943) 2024-01-11 14:27:41 +00:00
Nikita Sobolev 2ac4cf4743
gh-112640: Add `kwdefaults` parameter to `types.FunctionType.__new__` (#112641) 2024-01-11 00:42:30 -08:00
Peter Lazorchak f653caa5a8
gh-89811: Check for valid tp_version_tag in specializer (GH-113558) 2024-01-11 13:33:05 +08:00
Victor Stinner 1d75fa43a2
gh-77046: os.pipe() sets _O_NOINHERIT flag on fds (#113817)
On Windows, set _O_NOINHERIT flag on file descriptors
created by os.pipe() and io.WindowsConsoleIO.

Add test_pipe_spawnl() to test_os.

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2024-01-10 23:02:17 +01:00
Sam Gross 73ae2023a7
gh-113753: Clear finalized bit when putting PyAsyncGenASend back into free list (#113754) 2024-01-10 10:18:38 -08:00
Serhiy Storchaka 66363b9a7b
gh-109858: Protect zipfile from "quoted-overlap" zipbomb (GH-110016)
Raise BadZipFile when try to read an entry that overlaps with other entry or
central directory.
2024-01-10 15:55:36 +02:00
Serhiy Storchaka 89cee94b31
gh-89850: Add default C implementations of persistent_id() and persistent_load() (GH-113579)
Previously the C implementation of pickle.Pickler and pickle.Unpickler
classes did not have such methods and they could only be used if
they were overloaded in subclasses or set as instance attributes.

Fixed calling super().persistent_id() and super().persistent_load() in
subclasses of the C implementation of pickle.Pickler and pickle.Unpickler
classes. It no longer causes an infinite recursion.
2024-01-10 15:30:37 +02:00
Serhiy Storchaka a8629816c6
gh-113664: Improve style of Big O notation (GH-113695)
Use cursive to make it looking like mathematic formulas.
2024-01-10 15:01:18 +02:00
Serhiy Storchaka e9d5b6ea2d
gh-113594: Fix UnicodeEncodeError in TokenList.fold() (GH-113730)
It occurred when try to re-encode an unknown-8bit part combined with non-unknown-8bit part.
2024-01-10 14:54:36 +02:00
Serhiy Storchaka aef4a1203c
gh-96037: Always insert TimeoutError when exit an expired asyncio.timeout() block (GH-113819)
If other exception was raised during exiting an expired
asyncio.timeout() block, insert TimeoutError in the exception context
just above the CancelledError.
2024-01-10 12:50:31 +02:00
Serhiy Storchaka 1b7e0024a1
gh-113877: Fix Tkinter method winfo_pathname() on 64-bit Windows (GH-113900)
winfo_id() converts the result of "winfo id" command to integer, but
"winfo pathname" command requires an argument to be a hexadecimal number
on Win64.
2024-01-10 12:36:03 +02:00
Jamie Phan 4826d52338
gh-112182: Replace StopIteration with RuntimeError for future (#113220)
When an `StopIteration` raises into `asyncio.Future`, this will cause
a thread to hang. This commit address this by not raising an exception
and silently transforming the `StopIteration` with a `RuntimeError`,
which the caller can reconstruct from `fut.exception().__cause__`
2024-01-09 21:21:00 -08:00
AN Long 623b338adf
gh-66060: Use actual class name in _io type's __repr__ (#30824)
Use the object's actual class name in the following _io type's __repr__:
- FileIO
- TextIOWrapper
- _WindowsConsoleIO
2024-01-09 21:39:36 +01:00
Stefano Rivera 3a9096c337
GH-113661: unittest runner: Don't exit 5 if tests were skipped (#113856)
The intention of exiting 5 was to detect issues where the test suite
wasn't discovered at all. If we skipped tests, it was correctly
discovered.
2024-01-09 19:50:01 +00:00
Serhiy Storchaka 0297418cac
gh-113781: Silence AttributeError in warning module during Python finalization (GH-113813)
The tracemalloc module can already be cleared.
2024-01-09 21:44:05 +02:00
Serhiy Storchaka a5db6a3351
gh-113848: Handle CancelledError subclasses in asyncio TaskGroup() and timeout() (GH-113850) 2024-01-09 21:41:31 +02:00
AN Long c31be58da8
gh-87868: Sort and remove duplicates in getenvironment() (GH-102731)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-01-09 15:58:26 +00:00
Kristján Valur Jónsson 52161781a6
GH-111693: Propagate correct asyncio.CancelledError instance out of asyncio.Condition.wait() (#111694)
Also fix a race condition in `asyncio.Semaphore.acquire()` when cancelled.
2024-01-08 11:57:48 -08:00
Ronald Oussoren c6ca562138
gh-113791: Expose CLOCK_MONOTONIC_RAW_APPROX and CLOCK_UPTIME_RAW_APROX on macOS in the time module (#113792) 2024-01-08 20:44:00 +01:00
Zackery Spytz 73c9326563
gh-80109: Fix io.TextIOWrapper dropping the internal buffer during write() (GH-22535)
io.TextIOWrapper was dropping the internal decoding buffer
during read() and write() calls.
2024-01-08 12:33:34 +02:00
Zackery Spytz f19b93fce0
gh-73965: New environment variable PYTHON_HISTORY (#13208)
It can be used to set the location of a .python_history file

---------

Co-authored-by: Levi Sabah <0xl3vi@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-01-06 22:30:12 -08:00
AN Long 541c5dbb81
gh-112795: Allow `/` folder in a zipfile (#112932)
Allow extraction (no-op) of a "/" folder in a zipfile, they are commonly added by some archive creation tools.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-01-07 01:14:18 +00:00
Rami 84d1f76092
gh-89532: Remove LibreSSL workarounds (#28728)
Remove LibreSSL specific workaround ifdefs from `_ssl.c` and delete the non-version-specific `_ssl_data.h` file (relevant for OpenSSL < 1.1.1, which we no longer support per PEP 644).

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-01-06 23:25:58 +00:00
Irit Katriel d36a365118
gh-107901: synthetic jumps which are not at end of loop no longer check the eval breaker (#113721) 2024-01-06 14:20:08 +00:00
Grigoriev Semyon bb4c167060
gh-111488: Changed error message in case of no 'in' keyword after 'for' in cmp (#113656) 2024-01-06 10:27:49 +00:00
AN Long bbf214df23
gh-113537: support loads str in plistlib.loads (#113582)
Add support for loading XML plists from a string value instead of a only bytes value.
2024-01-06 10:26:59 +01:00
Ronald Oussoren 66f3964815
gh-113729: Fix IDLE's Help -> "IDLE Help" menu bug in 3.12.1 and 3.11.7 (#113731)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-01-06 06:23:26 +00:00
Barney Gale 3375dfed40
GH-113568: Stop raising deprecation warnings from pathlib ABCs (#113757) 2024-01-05 22:56:04 +00:00
Serhiy Storchaka bd754b93ca
gh-85567: Fix resouce warnings in pickle and pickletools CLIs (GH-113618)
Explicitly open and close files instead of using FileType.
2024-01-06 00:12:34 +02:00
Barney Gale 3c4e972d6d
GH-113568: Stop raising auditing events from pathlib ABCs (#113571)
Raise auditing events in `pathlib.Path.glob()`, `rglob()` and `walk()`,
but not in `pathlib._abc.PathBase` methods. Also move generation of a
deprecation warning into `pathlib.Path` so it gets the right stack level.
2024-01-05 21:41:19 +00:00
Zackery Spytz 5e1916ba1b
gh-80532: Do not set ipv6type when cross-compiling (#17956)
Co-authored-by: Xavier de Gaye <xdegaye@gmail.com>
2024-01-05 15:34:25 +00:00
Pablo Galindo Salgado 3003fbbf00
gh-113703: Correctly identify incomplete f-strings in the codeop module (#113709) 2024-01-05 12:16:46 +00:00
Mark Shannon 0ae60b66de
GH-113486: Do not emit spurious PY_UNWIND events for optimized calls to classes. (GH-113680) 2024-01-05 09:45:22 +00:00
Alex Waygood ed6ea3ea79
gh-113320: Reduce the number of dangerous `getattr()` calls when constructing protocol classes (#113401)
- Only attempt to figure out whether protocol members are "method members" or not if the class is marked as a runtime protocol. This information is irrelevant for non-runtime protocols; we can safely skip the risky introspection for them.
- Only do the risky getattr() calls in one place (the runtime_checkable class decorator), rather than in three places (_ProtocolMeta.__init__, _ProtocolMeta.__instancecheck__ and _ProtocolMeta.__subclasscheck__). This reduces the number of locations in typing.py where the risky introspection could go wrong.
- For runtime protocols, if determining whether a protocol member is callable or not fails, give a better error message. I think it's reasonable for us to reject runtime protocols that have members which raise strange exceptions when you try to access them. PEP-544 clearly states that all protocol member must be callable for issubclass() calls against the protocol to be valid -- and if a member raises when we try to access it, there's no way for us to figure out whether it's a callable member or not!
2024-01-05 01:01:48 +00:00
Barney Gale c2e8298eba
GH-113225: Speed up `pathlib.Path.glob()` (#113226)
Use `os.DirEntry.path` as the string representation of child paths, unless
the parent path is empty, in which case we use the entry `name`.
2024-01-04 20:48:26 +00:00
Guido van Rossum 4681a5271a
gh-113538: Don't error in stream reader protocol callback when task is cancelled (#113690) 2024-01-04 12:20:21 -08:00
wookie184 1600d78e2d
gh-113569: Display calls in Mock.assert_has_calls failure when empty (GH-113573) 2024-01-04 21:11:34 +02:00
Filip Łapkiewicz 4c4b08dd2b
gh-52161: Enhance Cmd support for docstrings (#110987)
In `cmd.Cmd.do_help` call `inspect.cleandoc()`,
to clean indentation and remove leading/trailing empty
lines from a dosctring before printing.
2024-01-03 19:37:34 +00:00
Alex Waygood f1f8392432
Document the `co_lines` method on code objects (#113682)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-01-03 19:29:24 +00:00
Itamar Oren 178919cf21
gh-113258: Write frozen modules to the build tree on Windows (GH-113303)
This ensures the source directory is not modified at build time, and different builds (e.g. different versions or GIL vs no-GIL) do not have conflicts.
2024-01-03 17:30:20 +00:00
Irit Katriel 7d01fb4808
gh-113603: Compiler no longer tries to maintain the no-empty-block invariant (#113636) 2024-01-03 16:57:48 +00:00
Hugo van Kemenade fab7ad62ce
gh-101100: Fix Sphinx warnings for removed dead batteries (#113669)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-01-03 13:04:26 +00:00
Brandt Bucher b0fb074d59
GH-113657: Add back missing _SET_IP uops in tier two (GH-113662) 2024-01-02 14:09:57 -08:00
Pablo Galindo Salgado 9ed36d533a
gh-113602: Bail out when the parser tries to override existing errors (#113607)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-01-02 13:00:52 +00:00
Hugo van Kemenade 7595380347
gh-101100: Fix Sphinx warnings from removed `~!` references (#113629)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-01-02 00:37:37 -07:00
Neil Schemenauer b2566d89ce
GH-113633: Use module state structure for _testcapi. (GH-113634)
Use module state structure for _testcapi.
2024-01-01 23:04:09 +00:00
AN Long b4b2cc1012
gh-53502: add a new option aware_datetime in plistlib to loads or dumps aware datetime. (#113363)
* add options to loads and dumps aware datetime in plistlib
2024-01-01 19:51:24 +01:00
Ronald Oussoren d0b0e3d2ef
gh-113536: Expose `os.waitid` on macOS (#113542)
* gh-113536: Expose `os.waitid` on macOS

This API has been available on macOS for a long time, but was
explicitly excluded due to unspecified problems with the API
in ancient versions of macOS.

* Document that the API is available on macOS starting in Python 3.13
2024-01-01 19:38:29 +01:00
Jeffrey Kintscher 5f3cc90a12
gh-62260: Fix ctypes.Structure subclassing with multiple layers (GH-13374)
The length field of StgDictObject for Structure class contains now
the total number of items in ffi_type_pointer.elements (excluding
the trailing null).

The old behavior of using the number of elements in the parent class can
cause the array to be truncated when it is copied, especially when there
are multiple layers of subclassing.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-01 18:24:24 +02:00
Hugo van Kemenade 30a6d79fb8
gh-101100: Fix Sphinx warnings in `library/configparser.rst` (#113598)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-31 10:57:33 -07:00
Samet YASLAN 88cb972000
gh-112536: Add support for thread sanitizer (TSAN) (gh-112648) 2023-12-30 17:17:02 +09:00
Ankit Kumar Pandey f46987b828
gh-103708: Make directory layout in sysconfig implementation configurable (#103709) 2023-12-29 17:55:17 +00:00
Nikita Sobolev fba324154e
gh-113543: Make sure that `MacOSXOSAScript` sends `webbrowser.open` audit event (#113544) 2023-12-28 19:58:06 +01:00
Zackery Spytz f108468970
bpo-11102: Make configure enable major(), makedev(), and minor() on HP-UX (GH-19856)
Always include <sys/types.h> before <sys/sysmacros.h>.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-28 12:47:44 +02:00
Ronald Oussoren cc13eabc7c
gh-110459: Make sure --with-openssl-rpath works on macOS (#113441)
* gh-110459: Make sure --with-openssl-rpath works on macOS

On macOS the `-rpath` linker flag is spelled differently
than on on platforms.
2023-12-28 09:42:05 +01:00
Inada Naoki bfee2f77e1
gh-73427: deprecate `_enablelegacywindowsfsencoding` (#107729) 2023-12-28 17:31:19 +09:00
Jeffrey Kintscher c66b577d9f
bpo-26791: Update shutil.move() to provide the same symlink move behavior as the mv shell when moving a symlink into a directory that is the target of the symlink (GH-21759) 2023-12-27 16:23:42 +00:00
Zackery Spytz 712afab5ac
gh-57795: IDLE: Enter the selected text when opening the "Replace" dialog (GH-17593)
Co-authored-by: Roger Serwy <roger.serwy@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-27 16:27:40 +02:00
Zackery Spytz 1ddd773293
gh-64020: Deprecate pydoc.ispackage() (GH-20908)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-27 14:04:31 +00:00
Vinay Sajip 67655d8ad5
gh-111615: Fix regression in QueueHandler configuration. (GH-111638) 2023-12-27 09:35:15 +00:00
Gordon P. Hemsley 4b2c3e8e43
bpo-36959: Fix error messages for invalid ISO format string in _strptime() (GH-13408)
Previously some error messages complained about incompatible
combinations of directives that are not contained in the format string.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-26 19:26:17 +00:00
Serhiy Storchaka e87cadc1ce
gh-66515: mailbox.MH now supports folders withou the ".mh_sequences" file (GH-804)
(for example Claws Mail IMAP-cache folders).
2023-12-26 11:15:14 +02:00
Yilei Yang 48c49739f5
gh-106905: Use separate structs to track recursion depth in each PyAST_mod2obj call. (GH-113035)
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-12-25 19:36:59 +02:00
Zackery Spytz 3f5eb3e6c7
bpo-21360: mailbox.Maildir now ignores files with a leading dot (GH-11833)
The maildir format specification states that files with a leading dot
should be ignored.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-25 17:07:51 +02:00
Serhiy Storchaka 0c574540e0
gh-113407: Fix import of unittest.mock when CPython is built without docstrings (GH-113408) 2023-12-24 13:38:56 +02:00
Serhiy Storchaka 1f06baeabd
gh-113191: Add support of os.fchmod() on Windows (GH-113192)
Also support a file descriptor in os.chmod().
2023-12-24 10:57:11 +00:00
Xu Song ce77ee5035
gh-113421: Fix multiprocessing logger for "%(filename)s" (GH-113423) 2023-12-24 12:04:12 +02:00
Jeff Allen 08398631a0
gh-113028: Correctly memoize str in pickle when escapes added (GH-113436)
This fixes a divergence between the Python and C implementations of pickle
for protocol 0, such that it pickle.py fails to re-use the first pickled
representation of strings involving characters that have to be escaped.
2023-12-24 11:43:44 +02:00
Kirill Podoprigora 894f0e573d
gh-111784: Fix two segfaults in the elementtree module (GH-113405)
First fix resolve situation when pyexpat module (which contains expat_CAPI
capsule) deallocates before _elementtree, so we need to hold a strong
reference to pyexpat module to.

Second fix resolve situation when module state is deallocated before
deallocation of XMLParser instances, which uses module state to clear
some stuff.
2023-12-24 10:57:41 +02:00
Yilei Yang 050783cb37
gh-112559: Avoid unnecessary conversion attempts to enum_klass in signal.py (#113040) 2023-12-23 17:07:52 -08:00