Commit 8139b4e
Fix panic in code.replace() with non-interned strings
code.replace() called as_interned_str().unwrap() on its string
arguments, which panics when the caller passes a string that has not
been interned. modulefinder's replace_paths_in_code() builds a fresh
co_filename, so any use of ModuleFinder(replace_paths=...) aborted the
interpreter.
Intern the incoming strings instead, and raise TypeError rather than
panicking when a non-string appears in co_names/co_varnames/
co_cellvars/co_freevars.
Unskips test_modulefinder.test_replace_paths.1 parent 1819677 commit 8139b4e
2 files changed
Lines changed: 19 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
394 | | - | |
395 | 393 | | |
396 | 394 | | |
397 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1366 | 1366 | | |
1367 | 1367 | | |
1368 | 1368 | | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
1369 | 1381 | | |
1370 | | - | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
| 1382 | + | |
1374 | 1383 | | |
1375 | 1384 | | |
1376 | 1385 | | |
1377 | 1386 | | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
| 1387 | + | |
1382 | 1388 | | |
1383 | 1389 | | |
1384 | 1390 | | |
| |||
1411 | 1417 | | |
1412 | 1418 | | |
1413 | 1419 | | |
1414 | | - | |
| 1420 | + | |
1415 | 1421 | | |
1416 | | - | |
1417 | | - | |
| 1422 | + | |
| 1423 | + | |
1418 | 1424 | | |
1419 | 1425 | | |
1420 | 1426 | | |
1421 | 1427 | | |
1422 | 1428 | | |
1423 | 1429 | | |
1424 | 1430 | | |
1425 | | - | |
1426 | | - | |
1427 | | - | |
1428 | | - | |
1429 | | - | |
1430 | | - | |
1431 | | - | |
1432 | | - | |
| 1431 | + | |
| 1432 | + | |
1433 | 1433 | | |
1434 | 1434 | | |
1435 | 1435 | | |
| |||
0 commit comments