]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Fix new mypy error in blib2to3 (#3674)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Wed, 3 May 2023 15:43:20 +0000 (08:43 -0700)
committerGitHub <noreply@github.com>
Wed, 3 May 2023 15:43:20 +0000 (08:43 -0700)
See python/mypy#15174

src/blib2to3/pgen2/tokenize.py
tests/data/simple_cases/fstring.py

index a6353d154c93d99290d2520966e0ce680d19d1bd..82ac5130badd92724779136362bdb235a37bf757 100644 (file)
@@ -163,7 +163,6 @@ endprogs: Final = {
     '"""': double3prog,
     **{f"{prefix}'''": single3prog for prefix in _strprefixes},
     **{f'{prefix}"""': double3prog for prefix in _strprefixes},
-    **{prefix: None for prefix in _strprefixes},
 }
 
 triple_quoted: Final = (
@@ -599,11 +598,13 @@ def generate_tokens(
                 ):
                     if token[-1] == "\n":  # continued string
                         strstart = (lnum, start)
-                        endprog = (
-                            endprogs[initial]
-                            or endprogs[token[1]]
-                            or endprogs[token[2]]
+                        maybe_endprog = (
+                            endprogs.get(initial)
+                            or endprogs.get(token[1])
+                            or endprogs.get(token[2])
                         )
+                        assert maybe_endprog is not None, f"endprog not found for {token}"
+                        endprog = maybe_endprog
                         contstr, needcont = line[start:], 1
                         contline = line
                         break
index 4b33231c01c08701c1f2fa47de9cfe8a1f0388c9..60560309376351e79d53d505dd3f89b1745eae7b 100644 (file)
@@ -7,6 +7,8 @@ f"{f'''{'nested'} inner'''} outer"
 f"\"{f'{nested} inner'}\" outer"
 f"space between opening braces: { {a for a in (1, 2, 3)}}"
 f'Hello \'{tricky + "example"}\''
+f"Tried directories {str(rootdirs)} \
+but none started with prefix {parentdir_prefix}"
 
 # output
 
@@ -19,3 +21,5 @@ f"{f'''{'nested'} inner'''} outer"
 f"\"{f'{nested} inner'}\" outer"
 f"space between opening braces: { {a for a in (1, 2, 3)}}"
 f'Hello \'{tricky + "example"}\''
+f"Tried directories {str(rootdirs)} \
+but none started with prefix {parentdir_prefix}"