Skip to content

Commit f918241

Browse files
committed
Merge branch 'main' into windows-add-sysconfig-abiflags
2 parents 4f22ff3 + 1e3ec33 commit f918241

31 files changed

Lines changed: 770 additions & 486 deletions

Doc/library/uuid.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,29 @@ which relays any information about the UUID's safety, using this enumeration:
103103
- Meaning
104104

105105
* - .. attribute:: UUID.time_low
106-
- The first 32 bits of the UUID.
106+
- The first 32 bits of the UUID. Only relevant to version 1.
107107

108108
* - .. attribute:: UUID.time_mid
109-
- The next 16 bits of the UUID.
109+
- The next 16 bits of the UUID. Only relevant to version 1.
110110

111111
* - .. attribute:: UUID.time_hi_version
112-
- The next 16 bits of the UUID.
112+
- The next 16 bits of the UUID. Only relevant to version 1.
113113

114114
* - .. attribute:: UUID.clock_seq_hi_variant
115-
- The next 8 bits of the UUID.
115+
- The next 8 bits of the UUID. Only relevant to versions 1 and 6.
116116

117117
* - .. attribute:: UUID.clock_seq_low
118-
- The next 8 bits of the UUID.
118+
- The next 8 bits of the UUID. Only relevant to versions 1 and 6.
119119

120120
* - .. attribute:: UUID.node
121-
- The last 48 bits of the UUID.
121+
- The last 48 bits of the UUID. Only relevant to version 1.
122122

123123
* - .. attribute:: UUID.time
124-
- The 60-bit timestamp.
124+
- The 60-bit timestamp for version 1 and 6,
125+
or the 48-bit timestamp for version 7.
125126

126127
* - .. attribute:: UUID.clock_seq
127-
- The 14-bit sequence number.
128+
- The 14-bit sequence number. Only relevant to versions 1 and 6.
128129

129130

130131
.. attribute:: UUID.hex

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_ids.h

Lines changed: 97 additions & 96 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/functools.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -516,22 +516,6 @@ def _unwrap_partialmethod(func):
516516

517517
_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
518518

519-
class _HashedSeq(list):
520-
""" This class guarantees that hash() will be called no more than once
521-
per element. This is important because the lru_cache() will hash
522-
the key multiple times on a cache miss.
523-
524-
"""
525-
526-
__slots__ = 'hashvalue'
527-
528-
def __init__(self, tup, hash=hash):
529-
self[:] = tup
530-
self.hashvalue = hash(tup)
531-
532-
def __hash__(self):
533-
return self.hashvalue
534-
535519
def _make_key(args, kwds, typed,
536520
kwd_mark = (object(),),
537521
fasttypes = {int, str},
@@ -561,7 +545,7 @@ def _make_key(args, kwds, typed,
561545
key += tuple(type(v) for v in kwds.values())
562546
elif len(key) == 1 and type(key[0]) in fasttypes:
563547
return key[0]
564-
return _HashedSeq(key)
548+
return key
565549

566550
def lru_cache(maxsize=128, typed=False):
567551
"""Least-recently-used cache decorator.

Lib/test/test_capi/test_opt.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,24 @@ def testfunc(n):
15811581
self.assertNotIn("_COMPARE_OP_INT", uops)
15821582
self.assertIn("_POP_TWO_LOAD_CONST_INLINE_BORROW", uops)
15831583

1584+
def test_remove_guard_for_known_type_str(self):
1585+
def f(n):
1586+
for i in range(n):
1587+
false = i == TIER2_THRESHOLD
1588+
empty = "X"[:false]
1589+
empty += "" # Make JIT realize this is a string.
1590+
if empty:
1591+
return 1
1592+
return 0
1593+
1594+
res, ex = self._run_with_optimizer(f, TIER2_THRESHOLD)
1595+
self.assertEqual(res, 0)
1596+
self.assertIsNotNone(ex)
1597+
uops = get_opnames(ex)
1598+
self.assertIn("_TO_BOOL_STR", uops)
1599+
self.assertNotIn("_GUARD_TOS_UNICODE", uops)
1600+
1601+
15841602
def global_identity(x):
15851603
return x
15861604

0 commit comments

Comments
 (0)