Menu

#4254 Tcl_NRCmdSwap prevents exception handling

obsolete: 8.6b1
open
7
2009-05-01
2009-01-12
Don Porter
No

When Tcl_NRCmdSwap() is called, there
is no call to TEOV_PushExceptionHandlers(),
so no handling of toplevel exception and
no appending to -errorinfo when TCL_ERROR
arises.

This seems to be the right feature set
for [namespace import]ed commands, which
is the sole Tcl_NRCmdSwap() caller in
our sources.

It's less clear that other T_NRCS() callers
want the same thing. At least the docs
need to be clearer about it.

Discussion

  • miguel sofer

    miguel sofer - 2009-01-12

    I call a possible doc bug: T_NCRS is meant to do precisely what imports do, replace the original command with a new one. In particular, the swap should not add new exception handlers - exceptions are treated only by the original command, not by the replacement.

    If both the original and the replacement commands are meant to handle exceptions the proper approach is to mimic what aliases do: eval a new objc/objv.

     
  • Don Porter

    Don Porter - 2009-01-12

    Thanks for commenting miguel.

    The matter arises as I look into
    Tcl Bug 2486550. TclObjInvoke()
    directly calls a cmdPtr->objProc
    just like the InvokeImportedCmd()
    used to do. Since T_NCRS() solved
    one, it's a candidate to solve the
    other as well. But TOI does include
    code to append to the -errorinfo .

     
  • Don Porter

    Don Porter - 2009-01-12

    If TclNREvalObjv() were revised
    so that a T_NCRS() call still
    tried a TEOV_PEH() call before
    skipping the command resolution
    stuff, then InvokeImportedCmd()
    could still run exactly as it
    does now by just passing the
    TCL_EVAL_NOERR flag, and TOI
    could use the same routine
    not passing it.

     
  • Kevin B KENNY

    Kevin B KENNY - 2009-01-13

    Is there a reason this is assigned to me?
    I committed the NRE documentation while miguel
    was _hors de combat_, but I think he'd be a
    better choice to examine it first.

     
  • Kevin B KENNY

    Kevin B KENNY - 2009-01-13
    • assigned_to: kennykb --> msofer
     
  • Don Porter

    Don Porter - 2009-01-13

    when I first filed, I assumed
    miguel was still incommunicado,
    and also assumed this was basically
    a docs bug. Neither is turning
    out to be completely true.

     
  • miguel sofer

    miguel sofer - 2009-05-01
    • priority: 5 --> 6
     
  • miguel sofer

    miguel sofer - 2009-05-01
    • priority: 6 --> 7
     
  • Don Porter

    Don Porter - 2013-03-19

    status?

     
  • miguel sofer

    miguel sofer - 2013-03-19

    dgp's proposed solution sounds good.

     
  • Don Porter

    Don Porter - 2013-04-08

    See branch bug-2502002 for work in progress.