Skip to content

Commit be7f556

Browse files
authored
Merge branch 'main' into subscope
2 parents 4c0bfd1 + 9777e8a commit be7f556

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎Doc/library/pathlib.rst‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,11 @@ we also call *flavours*:
131131
>>> PurePath(Path('foo'), Path('bar'))
132132
PurePosixPath('foo/bar')
133133

134-
When *pathsegments* is empty, the current directory is assumed::
134+
When *pathsegments* is empty or consists only of empty strings,
135+
the current directory is assumed::
135136

136-
>>> PurePath()
137-
PurePosixPath('.')
137+
>>> PurePath(), PurePath('')
138+
(PurePosixPath('.'), PurePosixPath('.'))
138139

139140
If a segment is an absolute path, all previous segments are ignored
140141
(like :func:`os.path.join`)::
@@ -1040,15 +1041,17 @@ Querying file type and status
10401041

10411042
.. method:: Path.exists(*, follow_symlinks=True)
10421043

1043-
Return ``True`` if the path points to an existing file or directory.
1044-
``False`` will be returned if the path is invalid, inaccessible or missing.
1044+
Return ``True`` if the path points to an existing file or directory and
1045+
``False`` if the path is invalid, inaccessible or missing.
10451046
Use :meth:`Path.stat` to distinguish between these cases.
10461047

10471048
This method normally follows symlinks; to check if a symlink exists, add
10481049
the argument ``follow_symlinks=False``.
10491050

10501051
::
10511052

1053+
>>> Path('').exists() # The current directory.
1054+
True
10521055
>>> Path('.').exists()
10531056
True
10541057
>>> Path('setup.py').exists()

‎Lib/test/test_external_inspection.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,14 +447,15 @@ def test_long_task_name_is_truncated(self):
447447
async def main():
448448
asyncio.create_task(asyncio.sleep(10_000), name="x" * 300)
449449
await asyncio.sleep(0)
450-
return [
450+
names = [
451451
task.task_name
452452
for info in RemoteUnwinder(os.getpid()).get_all_awaited_by()
453453
for task in info.awaited_by
454454
]
455+
return asyncio.current_task().get_name(), names
455456

456-
names = asyncio.run(main())
457-
self.assertIn("Task-1", names)
457+
main_name, names = asyncio.run(main())
458+
self.assertIn(main_name, names)
458459
self.assertEqual([len(n) for n in names if n.startswith("x")], [255])
459460

460461
@skip_if_not_supported

‎Lib/test/test_shutil.py‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,7 @@ def raiser(fn, *args, **kwargs):
552552
os.lstat = orig_lstat
553553

554554
def test_rmtree_uses_safe_fd_version_if_available(self):
555-
_use_fd_functions = ({os.open, os.stat, os.unlink, os.rmdir} <=
556-
os.supports_dir_fd and
557-
os.listdir in os.supports_fd and
558-
os.stat in os.supports_follow_symlinks)
559-
if _use_fd_functions:
555+
if shutil._use_fd_functions:
560556
self.assertTrue(shutil.rmtree.avoids_symlink_attacks)
561557
tmp_dir = self.mkdtemp()
562558
d = os.path.join(tmp_dir, 'a')

0 commit comments

Comments
 (0)