Skip to content

Commit 9d65bb9

Browse files
committed
Merge remote-tracking branch 'origin/main' into generate-all-uops
2 parents d403040 + 2f3ee02 commit 9d65bb9

30 files changed

Lines changed: 350 additions & 101 deletions

.coveragerc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[run]
2+
branch = True
3+
4+
[report]
5+
# Regexes for lines to exclude from consideration
6+
exclude_lines =
7+
# Don't complain if non-runnable code isn't run:
8+
if 0:
9+
if __name__ == .__main__.:
10+
11+
.*# pragma: no cover
12+
.*# pragma: no branch
13+
14+
# Additions for IDLE:
15+
.*# htest #
16+
if not (_htest or _utest):
17+
if not .*_utest:
18+
if .*_htest:
19+

Doc/library/typing.rst

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,6 +2849,9 @@ Functions and decorators
28492849
This wraps the decorator with something that wraps the decorated
28502850
function in :func:`no_type_check`.
28512851

2852+
.. deprecated-removed:: 3.13 3.15
2853+
No type checker ever added support for ``@no_type_check_decorator``. It
2854+
is therefore deprecated, and will be removed in Python 3.15.
28522855

28532856
.. decorator:: override
28542857

@@ -3648,18 +3651,20 @@ Certain features in ``typing`` are deprecated and may be removed in a future
36483651
version of Python. The following table summarizes major deprecations for your
36493652
convenience. This is subject to change, and not all deprecations are listed.
36503653

3651-
+----------------------------------+---------------+-------------------+----------------+
3652-
| Feature | Deprecated in | Projected removal | PEP/issue |
3653-
+==================================+===============+===================+================+
3654-
| ``typing`` versions of standard | 3.9 | Undecided | :pep:`585` |
3655-
| collections | | | |
3656-
+----------------------------------+---------------+-------------------+----------------+
3657-
| ``typing.ByteString`` | 3.9 | 3.14 | :gh:`91896` |
3658-
+----------------------------------+---------------+-------------------+----------------+
3659-
| ``typing.Text`` | 3.11 | Undecided | :gh:`92332` |
3660-
+----------------------------------+---------------+-------------------+----------------+
3661-
| ``typing.Hashable`` and | 3.12 | Undecided | :gh:`94309` |
3662-
| ``typing.Sized`` | | | |
3663-
+----------------------------------+---------------+-------------------+----------------+
3664-
| ``typing.TypeAlias`` | 3.12 | Undecided | :pep:`695` |
3665-
+----------------------------------+---------------+-------------------+----------------+
3654+
+-------------------------------------+---------------+-------------------+----------------+
3655+
| Feature | Deprecated in | Projected removal | PEP/issue |
3656+
+=====================================+===============+===================+================+
3657+
| ``typing`` versions of standard | 3.9 | Undecided | :pep:`585` |
3658+
| collections | | | |
3659+
+-------------------------------------+---------------+-------------------+----------------+
3660+
| ``typing.ByteString`` | 3.9 | 3.14 | :gh:`91896` |
3661+
+-------------------------------------+---------------+-------------------+----------------+
3662+
| ``typing.Text`` | 3.11 | Undecided | :gh:`92332` |
3663+
+-------------------------------------+---------------+-------------------+----------------+
3664+
| ``typing.Hashable`` and | 3.12 | Undecided | :gh:`94309` |
3665+
| ``typing.Sized`` | | | |
3666+
+-------------------------------------+---------------+-------------------+----------------+
3667+
| ``typing.TypeAlias`` | 3.12 | Undecided | :pep:`695` |
3668+
+-------------------------------------+---------------+-------------------+----------------+
3669+
| ``typing.no_type_check_decorator`` | 3.13 | 3.15 | :gh:`106309` |
3670+
+-------------------------------------+---------------+-------------------+----------------+

Doc/whatsnew/3.13.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ Deprecated
161161
``NT = NamedTuple("NT", [])``. To create a TypedDict class with 0 fields, use
162162
``class TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``.
163163
(Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)
164+
* :func:`typing.no_type_check_decorator` is deprecated, and scheduled for
165+
removal in Python 3.15. After eight years in the :mod:`typing` module, it
166+
has yet to be supported by any major type checkers.
167+
(Contributed by Alex Waygood in :gh:`106309`.)
164168

165169
* :mod:`array`'s ``'u'`` format code, deprecated in docs since Python 3.3,
166170
emits :exc:`DeprecationWarning` since 3.13

Include/internal/pycore_opcode_metadata.h

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

Lib/asyncio/base_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ def call_later(self, delay, callback, *args, context=None):
727727
always relative to the current time.
728728
729729
Each callback will be called exactly once. If two callbacks
730-
are scheduled for exactly the same time, it undefined which
730+
are scheduled for exactly the same time, it is undefined which
731731
will be called first.
732732
733733
Any positional arguments after the callback will be passed to

Lib/asyncio/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ class AbstractEventLoopPolicy:
617617
def get_event_loop(self):
618618
"""Get the event loop for the current context.
619619
620-
Returns an event loop object implementing the BaseEventLoop interface,
620+
Returns an event loop object implementing the AbstractEventLoop interface,
621621
or raises an exception in case no event loop has been set for the
622622
current context and the current policy does not specify to create one.
623623

Lib/email/feedparser.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
headerRE = re.compile(r'^(From |[\041-\071\073-\176]*:|[\t ])')
3838
EMPTYSTRING = ''
3939
NL = '\n'
40+
boundaryendRE = re.compile(
41+
r'(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$')
4042

4143
NeedMoreData = object()
4244

@@ -327,9 +329,10 @@ def _parsegen(self):
327329
# this onto the input stream until we've scanned past the
328330
# preamble.
329331
separator = '--' + boundary
330-
boundaryre = re.compile(
331-
'(?P<sep>' + re.escape(separator) +
332-
r')(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)?$')
332+
def boundarymatch(line):
333+
if not line.startswith(separator):
334+
return None
335+
return boundaryendRE.match(line, len(separator))
333336
capturing_preamble = True
334337
preamble = []
335338
linesep = False
@@ -341,7 +344,7 @@ def _parsegen(self):
341344
continue
342345
if line == '':
343346
break
344-
mo = boundaryre.match(line)
347+
mo = boundarymatch(line)
345348
if mo:
346349
# If we're looking at the end boundary, we're done with
347350
# this multipart. If there was a newline at the end of
@@ -373,13 +376,13 @@ def _parsegen(self):
373376
if line is NeedMoreData:
374377
yield NeedMoreData
375378
continue
376-
mo = boundaryre.match(line)
379+
mo = boundarymatch(line)
377380
if not mo:
378381
self._input.unreadline(line)
379382
break
380383
# Recurse to parse this subpart; the input stream points
381384
# at the subpart's first line.
382-
self._input.push_eof_matcher(boundaryre.match)
385+
self._input.push_eof_matcher(boundarymatch)
383386
for retval in self._parsegen():
384387
if retval is NeedMoreData:
385388
yield NeedMoreData

Lib/test/test_mmap.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,27 @@ def test_find_end(self):
299299
self.assertEqual(m.find(b'one', 1, -2), -1)
300300
self.assertEqual(m.find(bytearray(b'one')), 0)
301301

302+
for i in range(-n-1, n+1):
303+
for j in range(-n-1, n+1):
304+
for p in [b"o", b"on", b"two", b"ones", b"s"]:
305+
expected = data.find(p, i, j)
306+
self.assertEqual(m.find(p, i, j), expected, (p, i, j))
307+
308+
def test_find_does_not_access_beyond_buffer(self):
309+
try:
310+
flags = mmap.MAP_PRIVATE | mmap.MAP_ANONYMOUS
311+
PAGESIZE = mmap.PAGESIZE
312+
PROT_NONE = 0
313+
PROT_READ = mmap.PROT_READ
314+
except AttributeError as e:
315+
raise unittest.SkipTest("mmap flags unavailable") from e
316+
for i in range(0, 2049):
317+
with mmap.mmap(-1, PAGESIZE * (i + 1),
318+
flags=flags, prot=PROT_NONE) as guard:
319+
with mmap.mmap(-1, PAGESIZE * (i + 2048),
320+
flags=flags, prot=PROT_READ) as fm:
321+
fm.find(b"fo", -2)
322+
302323

303324
def test_rfind(self):
304325
# test the new 'end' parameter works as expected

Lib/test/test_typing.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5794,10 +5794,14 @@ class F:
57945794
get_type_hints(clazz)
57955795

57965796
def test_meta_no_type_check(self):
5797-
5798-
@no_type_check_decorator
5799-
def magic_decorator(func):
5800-
return func
5797+
depr_msg = (
5798+
"'typing.no_type_check_decorator' is deprecated "
5799+
"and slated for removal in Python 3.15"
5800+
)
5801+
with self.assertWarnsRegex(DeprecationWarning, depr_msg):
5802+
@no_type_check_decorator
5803+
def magic_decorator(func):
5804+
return func
58015805

58025806
self.assertEqual(magic_decorator.__name__, 'magic_decorator')
58035807

Lib/typing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,6 +2395,8 @@ def no_type_check_decorator(decorator):
23952395
This wraps the decorator with something that wraps the decorated
23962396
function in @no_type_check.
23972397
"""
2398+
import warnings
2399+
warnings._deprecated("typing.no_type_check_decorator", remove=(3, 15))
23982400
@functools.wraps(decorator)
23992401
def wrapped_decorator(*args, **kwds):
24002402
func = decorator(*args, **kwds)

0 commit comments

Comments
 (0)