Skip to content

Commit 27bdda9

Browse files
authored
Merge pull request #522 from python/main
Sync Fork from Upstream Repo
2 parents 1b43b32 + a055105 commit 27bdda9

7 files changed

Lines changed: 13 additions & 5 deletions

File tree

Doc/library/fnmatch.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ module. See module :mod:`glob` for pathname expansion (:mod:`glob` uses
4646
a period are not special for this module, and are matched by the ``*`` and ``?``
4747
patterns.
4848

49+
Also note that :func:`functools.lru_cache` with the *maxsize* of 32768 is used to
50+
cache the compiled regex patterns in the following functions: :func:`fnmatch`,
51+
:func:`fnmatchcase`, :func:`filter`.
4952

5053
.. function:: fnmatch(filename, pattern)
5154

Lib/_pydecimal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@ def _power_exact(self, other, p):
22302230
if xe != 0 and len(str(abs(yc*xe))) <= -ye:
22312231
return None
22322232
xc_bits = _nbits(xc)
2233-
if xc != 1 and len(str(abs(yc)*xc_bits)) <= -ye:
2233+
if len(str(abs(yc)*xc_bits)) <= -ye:
22342234
return None
22352235
m, n = yc, 10**(-ye)
22362236
while m % 2 == n % 2 == 0:
@@ -2243,7 +2243,7 @@ def _power_exact(self, other, p):
22432243
# compute nth root of xc*10**xe
22442244
if n > 1:
22452245
# if 1 < xc < 2**n then xc isn't an nth power
2246-
if xc != 1 and xc_bits <= n:
2246+
if xc_bits <= n:
22472247
return None
22482248

22492249
xe, rem = divmod(xe, n)

Lib/distutils/msvccompiler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"necessary compiler setting\n"
4545
"Make sure that Python modules winreg, "
4646
"win32api or win32con are installed.")
47-
pass
4847

4948
if _can_read_reg:
5049
HKEYS = (hkey_mod.HKEY_USERS,

Lib/fnmatch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def fnmatch(name, pat):
4141
pat = os.path.normcase(pat)
4242
return fnmatchcase(name, pat)
4343

44-
@functools.lru_cache(maxsize=256, typed=True)
44+
@functools.lru_cache(maxsize=32768, typed=True)
4545
def _compile_pattern(pat):
4646
if isinstance(pat, bytes):
4747
pat_str = str(pat, 'ISO-8859-1')

Lib/sysconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def joinuser(*args):
111111
'platstdlib': '{userbase}/lib/python',
112112
'purelib': '{userbase}/lib/python/site-packages',
113113
'platlib': '{userbase}/lib/python/site-packages',
114-
'include': '{userbase}/include',
114+
'include': '{userbase}/include/python{py_version_short}',
115115
'scripts': '{userbase}/bin',
116116
'data': '{userbase}',
117117
},
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
In :mod:`fnmatch`, the cache size for compiled regex patterns
2+
(:func:`functools.lru_cache`) was bumped up from 256 to 32768, affecting
3+
functions: :func:`fnmatch.fnmatch`, :func:`fnmatch.fnmatchcase`,
4+
:func:`fnmatch.filter`.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The framework build's user header path in sysconfig is changed to add a
2+
'pythonX.Y' component to match distutils's behavior.

0 commit comments

Comments
 (0)