Skip to content

Commit 90f6514

Browse files
authored
Merge branch 'main' into pep-765
2 parents d344fba + b93b7e5 commit 90f6514

File tree

14 files changed

+315
-279
lines changed

14 files changed

+315
-279
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Objects/exceptions.c @iritkatriel
106106

107107
# Hashing & cryptographic primitives
108108
**/*hashlib* @gpshead @tiran @picnixz
109+
**/*hashopenssl* @gpshead @tiran @picnixz
109110
**/*pyhash* @gpshead @tiran
110111
**/sha* @gpshead @tiran @picnixz
111112
Modules/md5* @gpshead @tiran @picnixz

Doc/library/pickle.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,15 @@ The :mod:`pickle` module exports three classes, :class:`Pickler`,
401401

402402
Use :func:`pickletools.optimize` if you need more compact pickles.
403403

404+
.. method:: clear_memo()
405+
406+
Clears the pickler's "memo".
407+
408+
The memo is the data structure that remembers which objects the
409+
pickler has already seen, so that shared or recursive objects
410+
are pickled by reference and not by value. This method is
411+
useful when re-using picklers.
412+
404413

405414
.. class:: Unpickler(file, *, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)
406415

Lib/cmd.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@
4242
functions respectively.
4343
"""
4444

45-
import inspect, string, sys
45+
import sys
4646

4747
__all__ = ["Cmd"]
4848

4949
PROMPT = '(Cmd) '
50-
IDENTCHARS = string.ascii_letters + string.digits + '_'
50+
IDENTCHARS = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
51+
'abcdefghijklmnopqrstuvwxyz'
52+
'0123456789'
53+
'_')
5154

5255
class Cmd:
5356
"""A simple framework for writing line-oriented command interpreters.
@@ -303,9 +306,11 @@ def do_help(self, arg):
303306
try:
304307
func = getattr(self, 'help_' + arg)
305308
except AttributeError:
309+
from inspect import cleandoc
310+
306311
try:
307312
doc=getattr(self, 'do_' + arg).__doc__
308-
doc = inspect.cleandoc(doc)
313+
doc = cleandoc(doc)
309314
if doc:
310315
self.stdout.write("%s\n"%str(doc))
311316
return

Lib/pathlib/_abc.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from abc import ABC, abstractmethod
1515
from glob import _PathGlobber, _no_recurse_symlinks
1616
from pathlib import PurePath, Path
17-
from pathlib._os import magic_open, CopyReader, CopyWriter
17+
from pathlib._os import magic_open, CopyWriter
1818

1919

2020
def _explode_path(path):
@@ -302,16 +302,6 @@ def glob(self, pattern, *, case_sensitive=None, recurse_symlinks=True):
302302
select = globber.selector(parts)
303303
return select(self.joinpath(''))
304304

305-
def rglob(self, pattern, *, case_sensitive=None, recurse_symlinks=True):
306-
"""Recursively yield all existing files (of any kind, including
307-
directories) matching the given relative pattern, anywhere in
308-
this subtree.
309-
"""
310-
if not isinstance(pattern, JoinablePath):
311-
pattern = self.with_segments(pattern)
312-
pattern = '**' / pattern
313-
return self.glob(pattern, case_sensitive=case_sensitive, recurse_symlinks=recurse_symlinks)
314-
315305
def walk(self, top_down=True, on_error=None, follow_symlinks=False):
316306
"""Walk the directory tree from this directory, similar to os.walk()."""
317307
paths = [self]
@@ -353,8 +343,6 @@ def readlink(self):
353343
"""
354344
raise NotImplementedError
355345

356-
_copy_reader = property(CopyReader)
357-
358346
def copy(self, target, follow_symlinks=True, dirs_exist_ok=False,
359347
preserve_metadata=False):
360348
"""

Lib/pathlib/_local.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
except ImportError:
2020
grp = None
2121

22-
from pathlib._os import LocalCopyReader, LocalCopyWriter, PathInfo, DirEntryInfo
22+
from pathlib._os import LocalCopyWriter, PathInfo, DirEntryInfo, ensure_different_files
2323

2424

2525
__all__ = [
@@ -1079,7 +1079,6 @@ def replace(self, target):
10791079
os.replace(self, target)
10801080
return self.with_segments(target)
10811081

1082-
_copy_reader = property(LocalCopyReader)
10831082
_copy_writer = property(LocalCopyWriter)
10841083

10851084
def copy(self, target, follow_symlinks=True, dirs_exist_ok=False,
@@ -1125,7 +1124,7 @@ def move(self, target):
11251124
else:
11261125
if not hasattr(target, '_copy_writer'):
11271126
target = self.with_segments(target_str)
1128-
target._copy_writer._ensure_different_file(self)
1127+
ensure_different_files(self, target)
11291128
try:
11301129
os.replace(self, target_str)
11311130
return target

0 commit comments

Comments
 (0)