filter-repo: cleanup callback scope
Callbacks currently inherit the global scope from the library, which exposes private implementation details and imports. Some imports are useful for user callbacks, such as `re`, but others are questionable. This change limits callback globals to the public API and conservatively keeps all imports. When `callback` is defined by `exec`, it adds it the locals dict, but since none is supplied, it falls back to the passed globals and modifies filter-repo's globals. (This is relatively minor, as it just adds one symbol to `__main__`.) Now, it supplies a fresh locals dict, so the callback can be retrieved from it. Signed-off-by: Thalia Archibald <thalia@archibald.dev>pull/543/head
parent
4bc9022afc
commit
2cb3bcb85c
Loading…
Reference in New Issue