Context: python/cpython#31781
Snippets below are unsupported and currently raise an error:
>>> from typing import NamedTuple
...
... class Foo(NamedTuple):
... x: int
...| --- before 2026-09-18 21:18:06 | |
| +++ after 2026-09-18 21:18:12 | |
| @@ -3,9 +3,11 @@ | |
| File "<yield-review>", line 1 | |
| def f(): print(yield) | |
| ^^^^^ | |
| -SyntaxError: invalid syntax | |
| +SyntaxError: yield expression must be parenthesized | |
| location: (1, 16, 1, 21) | |
| highlight: 'yield' |
| import builtins | |
| import token | |
| import tokenize | |
| import keyword | |
| import re | |
| import traceback | |
| from ast import PyCF_ONLY_AST | |
| from codeop import PyCF_DONT_IMPLY_DEDENT, PyCF_ALLOW_INCOMPLETE_INPUT | |
| from collections.abc import Generator, Iterable | |
| from pathlib import Path |
Context: python/cpython#31781
Snippets below are unsupported and currently raise an error:
>>> from typing import NamedTuple
...
... class Foo(NamedTuple):
... x: int
...| import asyncio | |
| import os | |
| async def task_inner(): | |
| with open("/dev/urandom", "rb") as urandom: | |
| feed = await asyncio.to_thread(urandom.read, 128) | |
| print(feed[:16].hex(), "\r", end="") | |
| async def task(): | |
| async with asyncio.TaskGroup() as tg: |
| { | |
| "python.analysis.extraPaths": ["Lib/"], | |
| "C_Cpp.files.exclude": { "PC/pyconfig.h": true, "Apple/iOS/Resources/pyconfig.h": true }, | |
| "C_Cpp.exclusionPolicy": "checkFilesAndFolders", | |
| "editor.formatOnSave": false, | |
| "editor.codeActionsOnSave": {"source.fixAll": "never", "source.unusedImports": "never", "source.organizeImports.ruff": "never"} | |
| } |
| # from bulmenisaurus on Python Discord | |
| # this prints hello | |
| print( | |
| "" | |
| .encode("utf_8_sig") | |
| .decode("mac_croatian") | |
| .encode("037") | |
| .decode("maclatin2") |
| #!/usr/bin/env bash | |
| set -Eeuxo pipefail | |
| rg $1 -no --no-heading -r '' | sed 's/:$//' | xargs -l echo break > $2.gdb |