@@ -386,7 +386,7 @@ async def do_execute(
386386 if hasattr (shell , "run_cell_async" ) and hasattr (shell , "should_run_async" ):
387387 run_cell = shell .run_cell_async
388388 should_run_async = shell .should_run_async
389- accepts_params = _accepts_parameters (run_cell , ["cell_id" ])
389+ accepts_params = _accepts_parameters (run_cell , ["cell_id" , "cell_meta" ])
390390 else :
391391 should_run_async = lambda cell : False # noqa: ARG005, E731
392392 # older IPython,
@@ -395,7 +395,7 @@ async def do_execute(
395395 async def run_cell (* args , ** kwargs ):
396396 return shell .run_cell (* args , ** kwargs )
397397
398- accepts_params = _accepts_parameters (shell .run_cell , ["cell_id" ])
398+ accepts_params = _accepts_parameters (shell .run_cell , ["cell_id" , "cell_meta" ])
399399 try :
400400 # default case: runner is asyncio and asyncio is already running
401401 # TODO: this should check every case for "are we inside the runner",
@@ -406,6 +406,11 @@ async def run_cell(*args, **kwargs):
406406 except Exception :
407407 transformed_cell = code
408408 preprocessing_exc_tuple = sys .exc_info ()
409+ do_execute_args = {}
410+ if accepts_params ["cell_meta" ]:
411+ do_execute_args ["cell_meta" ] = cell_meta
412+ if self ._do_exec_accepted_params ["cell_id" ]:
413+ do_execute_args ["cell_id" ] = cell_id
409414
410415 if (
411416 _asyncio_runner # type:ignore[truthy-bool]
@@ -424,7 +429,7 @@ async def run_cell(*args, **kwargs):
424429 silent = silent ,
425430 transformed_cell = transformed_cell ,
426431 preprocessing_exc_tuple = preprocessing_exc_tuple ,
427- cell_id = cell_id ,
432+ ** do_execute_args ,
428433 )
429434 else :
430435 coro = run_cell (
@@ -433,6 +438,7 @@ async def run_cell(*args, **kwargs):
433438 silent = silent ,
434439 transformed_cell = transformed_cell ,
435440 preprocessing_exc_tuple = preprocessing_exc_tuple ,
441+ ** do_execute_args ,
436442 )
437443
438444 coro_future = asyncio .ensure_future (coro )
@@ -454,15 +460,7 @@ async def run_cell(*args, **kwargs):
454460 # runner isn't already running,
455461 # make synchronous call,
456462 # letting shell dispatch to loop runners
457- if accepts_params ["cell_id" ]:
458- res = shell .run_cell (
459- code ,
460- store_history = store_history ,
461- silent = silent ,
462- cell_id = cell_id ,
463- )
464- else :
465- res = shell .run_cell (code , store_history = store_history , silent = silent )
463+ res = shell .run_cell (code , store_history = store_history , silent = silent , ** do_execute_args )
466464 finally :
467465 self ._restore_input ()
468466
0 commit comments