Bug 21592 – two stack traces if high surrogate is printed

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Other
Creation time
2021-01-29T20:33:13Z
Last change time
2021-03-03T12:46:34Z
Keywords
pull
Assigned to
No Owner
Creator
kdevel

Comments

Comment #0 by kdevel — 2021-01-29T20:33:13Z
```unpsur.d import std.stdio: writeln; import std.utf: byCodeUnit; void main () { wstring w = "\U00010400"; wchar wc = w.byCodeUnit [0]; // take high surrogate writeln (wc); // let it throw a UTFException } ``` Application output std.utf.UTFException@std/stdio.d(2910): unpaired surrogate UTF-16 value ---------------- ??:? @safe void std.stdio.File.LockingTextWriter.highSurrogateShouldBeEmpty() [0x5616f092907f] /dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:2992 @safe void std.stdio.File.LockingTextWriter.put!(char).put(char) [0x5616f0922407] /dlang/dmd/linux/bin64/../../src/phobos/std/range/primitives.d:277 @safe void std.range.primitives.doPut!(std.stdio.File.LockingTextWriter, char).doPut(ref std.stdio.File.LockingTextWriter, ref char) [0x5616f09223ea] /dlang/dmd/linux/bin64/../../src/phobos/std/range/primitives.d:380 @safe void std.range.primitives.put!(std.stdio.File.LockingTextWriter, char).put(ref std.stdio.File.LockingTextWriter, char) [0x5616f09223bf] /dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:1567 @safe void std.stdio.File.write!(wchar, char).write(wchar, char) [0x5616f0921bfe] /dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:3911 @safe void std.stdio.writeln!(wchar).writeln(wchar) [0x5616f0921b82] onlineapp.d:8 _Dmain [0x5616f0921736] std.utf.UTFException@std/stdio.d(2910): unpaired surrogate UTF-16 value ---------------- ??:? @safe void std.stdio.File.LockingTextWriter.highSurrogateShouldBeEmpty() [0x5616f092907f] ??:? @trusted void std.stdio.File.LockingTextWriter.__dtor() [0x5616f0929197] ??:? @trusted void std.stdio.File.LockingTextWriter.__aggrDtor() [0x5616f09291f0] /dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:1541 @safe void std.stdio.File.write!(wchar, char).write(wchar, char) [0x5616f0921c1d] /dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d:3911 @safe void std.stdio.writeln!(wchar).writeln(wchar) [0x5616f0921b82] onlineapp.d:8 _Dmain [0x5616f0921736] expected: only one trace
Comment #1 by bugzilla — 2021-02-15T19:38:29Z
The first trace is the expected one, the second trace is created, when the destructor is called.
Comment #2 by dlang-bot — 2021-02-17T17:41:22Z
@aG0aep6G created dlang/phobos pull request #7801 "fix issue 21592 - two stack traces if high surrogate is printed" fixing this issue: - fix issue 21592 - two stack traces if high surrogate is printed https://github.com/dlang/phobos/pull/7801
Comment #3 by dlang-bot — 2021-03-03T12:46:34Z
dlang/phobos pull request #7801 "fix issue 21592 - two stack traces if high surrogate is printed" was merged into master: - 95acbbd658a62d4724abf5b3a53b26430a1bf312 by aG0aep6G: fix issue 21592 - two stack traces if high surrogate is printed https://github.com/dlang/phobos/pull/7801