Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2013-08-29
19:20 • Closed ticket [2502002fff]: Tcl_NRCmdSwap prevents exception handling plus 9... artifact: 8aeb2fe0dd user: dgp
2013-04-09
03:08 • Ticket [2502002fff]: 4 changes artifact: bbf52c8dbf user: dgp
2013-03-19
20:52 • Ticket [2502002fff]: 4 changes artifact: 6c9ec71aa4 user: msofer
20:35 • Ticket [2502002fff]: 4 changes artifact: 65f6a158d2 user: dgp
2009-05-01
08:26 • Ticket [2502002fff]: 1 change artifact: c57fde0d48 user: msofer
08:24 • Ticket [2502002fff]: 1 change artifact: f544685a41 user: msofer
2009-01-13
11:21 • Ticket [2502002fff]: 4 changes artifact: 2023ebec7a user: dgp
08:19 • Ticket [2502002fff]: 5 changes artifact: f72e576d44 user: kennykb
04:53 • Ticket [2502002fff]: 4 changes artifact: 70f62d3f16 user: dgp
04:41 • Ticket [2502002fff]: 4 changes artifact: a9a41751f6 user: dgp
02:50 • Ticket [2502002fff]: 4 changes artifact: 8c01f3a13a user: msofer
2009-01-12
18:01 • New ticket [2502002fff]. artifact: fc60492d24 user: dgp

Tcl_NRCmdSwap prevents exception handling

Closed / Accepted2502002fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 13 years ago
Descriptionplain2009-01-12 18:01:17
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.
msoferplain2009-01-13 02:50:48
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.
dgpplain2009-01-13 04:41:08
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 .
dgpplain2009-01-13 04:53:39
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.
kennykbplain2009-01-13 08:19:33
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.
dgpplain2009-01-13 11:21:59
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.
msofer Ticket [2502002fff]: 1 change [History diff]2009-05-01 08:24:16
msofer Ticket [2502002fff]: 1 change [History diff]2009-05-01 08:26:40
dgpplain2013-03-19 20:35:49
status?
msoferplain2013-03-19 20:52:30
dgp's proposed solution sounds good.
dgpplain2013-04-09 03:08:16
See branch bug-2502002 for work in progress.
dgpplain2013-08-29 19:20:37
merged to trunk.
Log in (anonymous is fine) to add a comment.