parameters: (self, code_obj, result=None, *, async_=False)
return_statement: return outflag
docstring: Execute a code object.
  
          When an exception occurs, self.showtraceback() is called to display a
          traceback.
  
          Parameters
          ----------
          code_obj : code object
            A compiled code object, to be executed
          result : ExecutionResult, optional
            An object to store exceptions that occur during execution.
          async_ :  Bool (Experimental)
            Attempt to run top-level asynchronous code in a default loop.
  
          Returns
          -------
          False : successful execution.
          True : an error occurred.
docstring_summary: Execute a code object.
docstring_tokens: Execute a code object .
function: async def run_code(self, code_obj, result=None, *, async_=False):
          """Execute a code object.
  
          When an exception occurs, self.showtraceback() is called to display a
          traceback.
  
          Parameters
          ----------
          code_obj : code object
            A compiled code object, to be executed
          result : ExecutionResult, optional
            An object to store exceptions that occur during execution.
          async_ :  Bool (Experimental)
            Attempt to run top-level asynchronous code in a default loop.
  
          Returns
          -------
          False : successful execution.
          True : an error occurred.
          """
          # special value to say that anything above is IPython and should be
          # hidden.
          __tracebackhide__ = "__ipython_bottom__"
          # Set our own excepthook in case the user code tries to call it
          # directly, so that the IPython crash handler doesn't get triggered
          old_excepthook, sys.excepthook = sys.excepthook, self.excepthook
  
          # we save the original sys.excepthook in the instance, in case config
          # code (such as magics) needs access to it.
          self.sys_excepthook = old_excepthook
          outflag = True  # happens in more places, so it's easier as default
          try:
              try:
                  self.hooks.pre_run_code_hook()
                  if async_ and sys.version_info < (3,8):
                      last_expr = (await self._async_exec(code_obj, self.user_ns))
                      code = compile('last_expr', 'fake', "single")
                      exec(code, {'last_expr': last_expr})
                  elif async_ :
                      await eval(code_obj, self.user_global_ns, self.user_ns)
                  else:
                      exec(code_obj, self.user_global_ns, self.user_ns)
              finally:
                  # Reset our crash handler in place
                  sys.excepthook = old_excepthook
          except SystemExit as e:
              if result is not None:
                  result.error_in_exec = e
              self.showtraceback(exception_only=True)
              warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
          except self.custom_exceptions:
              etype, value, tb = sys.exc_info()
              if result is not None:
                  result.error_in_exec = value
              self.CustomTB(etype, value, tb)
          except:
              if result is not None:
                  result.error_in_exec = sys.exc_info()[1]
              self.showtraceback(running_compiled_code=True)
          else:
              outflag = False
          return outflag
function_tokens: async def run_code ( self , code_obj , result = None , * , async_ = False ) : # special value to say that anything above is IPython and should be # hidden. __tracebackhide__ = "__ipython_bottom__" # Set our own excepthook in case the user code tries to call it # directly, so that the IPython crash handler doesn't get triggered old_excepthook , sys . excepthook = sys . excepthook , self . excepthook # we save the original sys.excepthook in the instance, in case config # code (such as magics) needs access to it. self . sys_excepthook = old_excepthook outflag = True # happens in more places, so it's easier as default try : try : self . hooks . pre_run_code_hook ( ) if async_ and sys . version_info < ( 3 , 8 ) : last_expr = ( await self . _async_exec ( code_obj , self . user_ns ) ) code = compile ( 'last_expr' , 'fake' , "single" ) exec ( code , { 'last_expr' : last_expr } ) elif async_ : await eval ( code_obj , self . user_global_ns , self . user_ns ) else : exec ( code_obj , self . user_global_ns , self . user_ns ) finally : # Reset our crash handler in place sys . excepthook = old_excepthook except SystemExit as e : if result is not None : result . error_in_exec = e self . showtraceback ( exception_only = True ) warn ( "To exit: use 'exit', 'quit', or Ctrl-D." , stacklevel = 1 ) except self . custom_exceptions : etype , value , tb = sys . exc_info ( ) if result is not None : result . error_in_exec = value self . CustomTB ( etype , value , tb ) except : if result is not None : result . error_in_exec = sys . exc_info ( ) [ 1 ] self . showtraceback ( running_compiled_code = True ) else : outflag = False return outflag