Commit c4bf632
committed
Improve async detection mechanism with blacklist
Because the async repl works by wrapping any code that raises
SyntaxError in an async function and trying to execute it again, cell
bodies that are invalid at the top level but valid in functions and
methods (e.g. return and yield statements) currently allow executing
invalid code.
This patch blacklists return and yield statements outside of a function
or method to restore the proper SyntaxError behavior.1 parent 8d38b3c commit c4bf632
1 file changed
Lines changed: 40 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
83 | 117 | | |
84 | 118 | | |
85 | 119 | | |
| |||
99 | 133 | | |
100 | 134 | | |
101 | 135 | | |
102 | | - | |
103 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
104 | 142 | | |
105 | 143 | | |
106 | 144 | | |
| |||
0 commit comments