Show More
@@ -443,12 +443,6 b' class InteractiveShell(Configurable, Magic):' | |||||
443 | # ipython names that may develop later. |
|
443 | # ipython names that may develop later. | |
444 | self.meta = Struct() |
|
444 | self.meta = Struct() | |
445 |
|
445 | |||
446 | # Object variable to store code object waiting execution. This is |
|
|||
447 | # used mainly by the multithreaded shells, but it can come in handy in |
|
|||
448 | # other situations. No need to use a Queue here, since it's a single |
|
|||
449 | # item which gets cleared once run. |
|
|||
450 | self.code_to_run = None |
|
|||
451 |
|
||||
452 | # Temporary files used for various purposes. Deleted at exit. |
|
446 | # Temporary files used for various purposes. Deleted at exit. | |
453 | self.tempfiles = [] |
|
447 | self.tempfiles = [] | |
454 |
|
448 | |||
@@ -2210,21 +2204,20 b' class InteractiveShell(Configurable, Magic):' | |||||
2210 | raise ValueError("Interactivity was %r" % interactivity) |
|
2204 | raise ValueError("Interactivity was %r" % interactivity) | |
2211 |
|
2205 | |||
2212 | exec_count = self.execution_count |
|
2206 | exec_count = self.execution_count | |
2213 | if to_run_exec: |
|
2207 | ||
2214 |
|
|
2208 | for i, node in enumerate(to_run_exec): | |
2215 |
|
|
2209 | mod = ast.Module([node]) | |
2216 |
|
|
2210 | code = self.compile(mod, cell_name, "exec") | |
2217 |
|
|
2211 | if self.run_code(code): | |
2218 |
|
|
2212 | return True | |
2219 |
|
2213 | |||
2220 |
|
|
2214 | for i, node in enumerate(to_run_interactive): | |
2221 | for i, node in enumerate(to_run_interactive): |
|
2215 | mod = ast.Interactive([node]) | |
2222 | mod = ast.Interactive([node]) |
|
2216 | code = self.compile(mod, cell_name, "single") | |
2223 | self.code_to_run = code = self.compile(mod, cell_name, "single") |
|
2217 | if self.run_code(code): | |
2224 | if self.run_code(code) == 1: |
|
2218 | return True | |
2225 | return 1 |
|
2219 | ||
2226 |
|
2220 | return False | ||
2227 | return 0 |
|
|||
2228 |
|
2221 | |||
2229 |
|
2222 | |||
2230 | # PENDING REMOVAL: this method is slated for deletion, once our new |
|
2223 | # PENDING REMOVAL: this method is slated for deletion, once our new | |
@@ -2321,13 +2314,8 b' class InteractiveShell(Configurable, Magic):' | |||||
2321 | return True |
|
2314 | return True | |
2322 |
|
2315 | |||
2323 | # Case 3 |
|
2316 | # Case 3 | |
2324 | # We store the code object so that threaded shells and |
|
|||
2325 | # custom exception handlers can access all this info if needed. |
|
|||
2326 | # The source corresponding to this can be obtained from the |
|
|||
2327 | # buffer attribute as '\n'.join(self.buffer). |
|
|||
2328 | self.code_to_run = code |
|
|||
2329 | # now actually execute the code object |
|
2317 | # now actually execute the code object | |
2330 |
if self.run_code(code) |
|
2318 | if not self.run_code(code): | |
2331 | return False |
|
2319 | return False | |
2332 | else: |
|
2320 | else: | |
2333 | return None |
|
2321 | return None | |
@@ -2350,8 +2338,8 b' class InteractiveShell(Configurable, Magic):' | |||||
2350 |
|
2338 | |||
2351 | Returns |
|
2339 | Returns | |
2352 | ------- |
|
2340 | ------- | |
2353 |
|
|
2341 | False : successful execution. | |
2354 |
|
|
2342 | True : an error occurred. | |
2355 | """ |
|
2343 | """ | |
2356 |
|
2344 | |||
2357 | # Set our own excepthook in case the user code tries to call it |
|
2345 | # Set our own excepthook in case the user code tries to call it | |
@@ -2384,8 +2372,6 b' class InteractiveShell(Configurable, Magic):' | |||||
2384 | if softspace(sys.stdout, 0): |
|
2372 | if softspace(sys.stdout, 0): | |
2385 |
|
2373 | |||
2386 |
|
2374 | |||
2387 | # Flush out code object which has been run (and source) |
|
|||
2388 | self.code_to_run = None |
|
|||
2389 | return outflag |
|
2375 | return outflag | |
2390 |
|
2376 | |||
2391 | # For backwards compatibility |
|
2377 | # For backwards compatibility |
General Comments 0
You need to be logged in to leave comments.
Login now