]> Cypherpunks repositories - gostls13.git/commit
runtime: don't discard value from panic while panicking
authorhopehook <hopehook.com@gmail.com>
Tue, 12 Apr 2022 09:46:36 +0000 (17:46 +0800)
committerGopher Robot <gobot@golang.org>
Fri, 15 Apr 2022 01:08:38 +0000 (01:08 +0000)
commit5a4f0b6f1e6d3c022ee30884590526ab7d3f580b
tree65ed5695981923bf38fc2c9fd56d9804e1798d5e
parent78bea702cd38ac5004a97f110e7f659336a04d57
runtime: don't discard value from panic while panicking

In issue #17671, there are a endless loop if printing
the panic value panics, CL 30358 has fixed that.

As issue #52257 pointed out, above change should not
discard the value from panic while panicking.

With this CL, when we recover from a panic in error.Error()
or stringer.String(), and the recovered value is string,
then we can print it normally.

Fixes #52257

Change-Id: Icfcc4a1a390635de405eea04904b4607ae9e3055
Reviewed-on: https://go-review.googlesource.com/c/go/+/399874
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/runtime/crash_test.go
src/runtime/panic.go
src/runtime/testdata/testprog/crash.go