Commit Graph

120293 Commits

Author SHA1 Message Date
Barney Gale ca6cf56330
Add `pathlib._abc.PathModuleBase` (#113893)
Path modules provide a subset of the `os.path` API, specifically those
functions needed to provide `PurePathBase` functionality. Each
`PurePathBase` subclass references its path module via a `pathmod` class
attribute.

This commit adds a new `PathModuleBase` class, which provides abstract
methods that unconditionally raise `UnsupportedOperation`. An instance of
this class is assigned to `PurePathBase.pathmod`, replacing `posixpath`.
As a result, `PurePathBase` is no longer POSIX-y by default, and
all its methods raise `UnsupportedOperation` courtesy of `pathmod`.

Users who subclass `PurePathBase` or `PathBase` should choose the path
syntax by setting `pathmod` to `posixpath`, `ntpath`, `os.path`, or their
own subclass of `PathModuleBase`, as circumstances demand.
2024-01-14 21:49:53 +00: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
Erlend E. Aasland 5dbcdfdeb8
gh-113317: Move global utility functions into libclinic (#113986)
Establish Tools/clinic/libclinic/utils.py and move the following
functions over there:

- compute_checksum()
- create_regex()
- write_file()
2024-01-14 18:26:09 +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 21f83efd10
Add module docstring for `pathlib._abc`. (#113691) 2024-01-13 08:47:00 +00:00
Barney Gale f20b151a1c
pathlib ABCs: add `_raw_path` property (#113976)
It's wrong for the `PurePathBase` methods to rely so much on `__str__()`.
Instead, they should treat the raw path(s) as opaque objects and leave the
details to `pathmod`.

This commit adds a `PurePathBase._raw_path` property and uses it through
many of the other ABC methods. These methods are all redefined in
`PurePath` and `Path`, so this has no effect on the public classes.
2024-01-13 08:03:21 +00: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
Stanley 3aa4b839e4
gh-89159: Document missing TarInfo members (#91564) 2024-01-12 23:19:57 +00: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
InSync a47353d587
datamodel: Fix a typo in ``object.__init_subclass__`` (#111599) 2024-01-12 22:59:24 +00:00
Pierre Equoy e97da8677f
Link to the glossary for "magic methods" in ``MagicMock`` (#111292)
The MagicMock documentation mentions magic methods several times without
actually pointing to the term in the glossary. This can be helpful for
people to fully understand what those magic methods are.
2024-01-12 22:54:36 +00:00
Andrew Zipperer 32f3684b8f
Tutorial: Clarify 'nonzero exit status' in the appendix (#112039) 2024-01-12 22:42:51 +00:00
Joseph Pearson 9a71750a29
Fix a grammatical error in `pycore_pymem.h` (#112993) 2024-01-12 22:25:52 +00: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
Serhiy Storchaka e02c15b3f1
gh-113980: Fix resource warnings in test_asyncgen (GH-113984) 2024-01-12 17:30:26 +02:00
Steve Dower ed066481c7
gh-111877: Fixes stat() handling for inaccessible files on Windows (GH-113716) 2024-01-12 15:27:56 +00:00
Ned Batchelder e68806c712
Docs: Amend codeobject.co_lines docs; end number is exclusive (#113970)
The end number should be exclusive, not inclusive.
2024-01-12 16:04:14 +01:00
Brandt Bucher 30e6cbdba2
GH-113860: Get rid of `_PyUOpExecutorObject` (GH-113954) 2024-01-12 11:58:23 +00:00
Pablo Galindo Salgado 29e2839cd6
gh-113027: Fix timezone check in test_variable_tzname in test_email (GH-113835)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-12 11:46:17 +01: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
Petr Viktorin fcb4c8d31a
gh-113858: Cut down ccache size (GH-113945)
Cut down ccache size

- Only save the ccache in the main reusable builds, not on builds that
  don't use special build options:
  - Generated files check
  - OpenSSL tests
  - Hypothesis tests
- Halve the max cache size, to 200M
2024-01-12 10:48:25 +01:00
Peter Lazorchak e58334e4c9
gh-113937 Fix failures in type cache tests due to re-running (GH-113953) 2024-01-12 13:18:19 +08: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
Donghee Na efa738e862
gh-111968: Explicit handling for finalized freelist (gh-113929) 2024-01-12 00:31:28 +00:00
Raymond Hettinger 53d2e1f26c
Improve kde graph with better caption and number formatting (gh-113967) 2024-01-11 18:25:18 -06:00
Adam Turner c9b8a22f34
GH-107678: Improve Unicode handling clarity in ``library/re.rst`` (#107679) 2024-01-11 23:56:10 +00: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
Raymond Hettinger 2f126a70f3
Update KDE recipe to match the standard use of the h parameter (gh-#113958) 2024-01-11 16:21:21 -06:00
Donghee Na 2e7577b622
gh-111968: Use per-thread freelists for tuple in free-threading (gh-113921) 2024-01-12 03:46:28 +09:00
Serhiy Storchaka 8717f7b495
gh-113845: Fix a compiler warning in Python/suggestions.c (GH-113949) 2024-01-11 20:31:24 +02: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
Victor Stinner 7ed76fc368
gh-91960: Remove Cirrus CI configuration (#113938)
Remove .cirrus.yml which was already disabled by being renamed to
.cirrus-DISABLED.yml. In total, Cirrus CI only run for less than one
month.
2024-01-11 14:33:24 +01:00
Kirill Podoprigora 9f088336b2
gh-113932: assert ``SyntaxWarning`` in test_compile.TestSpecifics.test_… (#113933) 2024-01-11 11:25:07 +00:00
AN Long ec23e90082
gh-112419: Document removal of sys.meta_path's 'find_module' fallback (#112421)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-01-11 09:43:35 +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
Donghee Na c65ae26f2b
gh-111968: Unify naming scheme for freelist (gh-113919) 2024-01-11 08:51:51 +09:00
Kirill Podoprigora 9d33c23857
gh-113896: Fix test_builtin.BuiltinTest.test___ne__() (#113897)
Fix DeprecationWarning in test___ne__().

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-01-11 00:39:48 +01:00
AN Long fafb3275f2
gh-87868: Skip `test_one_environment_variable` in `test_subprocess` when the platform or build cannot do that (#113867)
* improve the assert for test_one_environment_variable
* skip some test in test_subprocess when python is configured with shared
* also skip the test if AddressSanitizer is enabled

---------

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2024-01-10 15:17: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