Show More
@@ -2322,11 +2322,21 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2322 | 2322 | kwargs = {} |
|
2323 | 2323 | # Grab local namespace if we need it: |
|
2324 | 2324 | if getattr(fn, "needs_local_scope", False): |
|
2325 |
kwargs['local_ns'] = s |
|
|
2325 | kwargs['local_ns'] = self.get_local_scope(stack_depth) | |
|
2326 | 2326 | with self.builtin_trap: |
|
2327 | 2327 | result = fn(*args, **kwargs) |
|
2328 | 2328 | return result |
|
2329 | 2329 | |
|
2330 | def get_local_scope(self, stack_depth): | |
|
2331 | """Get local scope at given stack depth. | |
|
2332 | ||
|
2333 | Parameters | |
|
2334 | ---------- | |
|
2335 | stack_depth : int | |
|
2336 | Depth relative to calling frame | |
|
2337 | """ | |
|
2338 | return sys._getframe(stack_depth + 1).f_locals | |
|
2339 | ||
|
2330 | 2340 | def run_cell_magic(self, magic_name, line, cell): |
|
2331 | 2341 | """Execute the given cell magic. |
|
2332 | 2342 |
General Comments 0
You need to be logged in to leave comments.
Login now