Commit c3ca843
rp2/modules/rp2.py: Don't corrupt globals on asm_pio() exception.
The rp2.asm_pio() decorator saves and temporarily replaces the globals
dictionary to allow the wrapped functions to reference PIO instructions
and register names in a natural way, restoring them before returning the
assembled program.
However, if an exception occurs while assembling the program, the globals
are not changed back, leaving them corrupted.
Wrap with try/finally to ensure they are always restored correctly.
Signed-off-by: Chris Webb <chris@arachsys.com>1 parent 06bfefe commit c3ca843
1 file changed
+15
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
| |||
0 commit comments