summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2024-05-16 15:55:51 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2024-05-16 15:55:51 (GMT)
commit2e5880feb8ff4b7611a286fdb6ed161bc34efd74 (patch)
tree4c5dfc35a0e86f21934bd60b9e730e0b4acbca26
parent9b8a77b23318d5a8a3cbcff05f4416c463c44c34 (diff)
parent25c627ac37f116c6abd704522d4daf578f142ebc (diff)
downloadtcl-2e5880feb8ff4b7611a286fdb6ed161bc34efd74.zip
tcl-2e5880feb8ff4b7611a286fdb6ed161bc34efd74.tar.gz
tcl-2e5880feb8ff4b7611a286fdb6ed161bc34efd74.tar.bz2
Apply emergency workaround for [87271f7cd6]; not fixed yet, but no longer crashes
-rw-r--r--generic/tclCmdIL.c7
-rw-r--r--tests/oo.test41
2 files changed, 47 insertions, 1 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 37c9822..13f16b6 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -1382,7 +1382,12 @@ TclInfoFrame(
* Procedure CallFrame.
*/
- if (procPtr != NULL) {
+ if (procPtr != NULL
+#ifndef AVOID_EMERGENCY_HACKS
+ /* Emergency band-aid fix for [87271f7cd6] */
+ && procPtr->cmdPtr != NULL
+#endif
+ ) {
Tcl_HashEntry *namePtr = procPtr->cmdPtr->hPtr;
if (namePtr) {
diff --git a/tests/oo.test b/tests/oo.test
index aaea4c2..ac3019f 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -3465,6 +3465,47 @@ test oo-22.2 {OO and info frame: Bug 3001438} -setup {
} -match glob -cleanup {
c destroy
} -result {* cmd {info frame 0} method test class ::c level 0}
+# BUG: second call is missing info (caused by workaround in tclCmdIL.c)
+test oo-22.3 {OO and coroutines and info frame} -constraints knownBug -setup {
+ oo::class create A {
+ self method run {nworkers} {
+ set ::result {}
+ set workers {}
+ for {set n 1} {$n <= $nworkers} {incr n} {
+ set worker [A create a$n]
+ lappend workers $worker
+ $worker schedule
+ }
+ after 250 [namespace code {variable forever false}]
+ variable forever true
+ vwait [my varname forever]
+ foreach worker $workers {
+ $worker destroy
+ }
+ return $::result
+ }
+ method schedule {} {
+ set coro coro-[namespace tail [self]]
+ if {[llength [info commands $coro]] == 0} {
+ coroutine $coro my Work
+ }
+ }
+ method Work {} {
+ after 0 [info coroutine]
+ yield
+ lappend ::result [dump]
+ }
+ }
+} -body {
+ # Triggers a crash with incorrectly restored procPtr->cmdPtr
+ proc dump {} {
+ info frame [expr {[info frame] - 1}]
+ }
+ A run 2
+} -cleanup {
+ catch {rename dump {}}
+ catch {A destroy}
+} -match glob -result {{* method Work class ::A *} {* method Work class ::A *}}
# Prove that the issue in [Bug 1865054] isn't an issue any more
test oo-23.1 {Self-like derivation; complex case!} -setup {