Raise RTE from `limit_plds()` on no `curr_ctx`
Since it should only be used from within a `Portal.open_context()` scope, make sure the caller knows that! Also don't hide the frame in tb if the immediate function errors..ext_type_plds_XPS_BACKUP
							parent
							
								
									9ec63f8187
								
							
						
					
					
						commit
						8fa23fcccd
					
				|  | @ -461,11 +461,16 @@ def limit_plds( | |||
| 
 | ||||
|     ''' | ||||
|     __tracebackhide__: bool = True | ||||
|     curr_ctx: Context|None = current_ipc_ctx() | ||||
|     if curr_ctx is None: | ||||
|         raise RuntimeError( | ||||
|             'No IPC `Context` is active !?\n' | ||||
|             'Did you open `limit_plds()` from outside ' | ||||
|             'a `Portal.open_context()` scope-block?' | ||||
|         ) | ||||
|     try: | ||||
|         curr_ctx: Context = current_ipc_ctx() | ||||
|         rx: PldRx = curr_ctx._pld_rx | ||||
|         orig_pldec: MsgDec = rx.pld_dec | ||||
| 
 | ||||
|         with rx.limit_plds( | ||||
|             spec=spec, | ||||
|             **dec_kwargs, | ||||
|  | @ -475,6 +480,11 @@ def limit_plds( | |||
|                 f'{pldec}\n' | ||||
|             ) | ||||
|             yield pldec | ||||
| 
 | ||||
|     except BaseException: | ||||
|         __tracebackhide__: bool = False | ||||
|         raise | ||||
| 
 | ||||
|     finally: | ||||
|         log.runtime( | ||||
|             'Reverted to previous payload-decoder\n\n' | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue