Anonymous | Login | Signup for a new account | 2019-02-20 02:09 CET | ![]() |
Main | My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||
0003214 | OCaml | ~DO NOT USE (was: OCaml general) | public | 2004-10-14 00:02 | 2008-01-22 12:03 | |||
Reporter | administrator | |||||||
Assigned To | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | |||
Status | closed | Resolution | fixed | |||||
Platform | OS | OS Version | ||||||
Product Version | ||||||||
Target Version | Fixed in Version | 3.10+dev | ||||||
Summary | 0003214: Exception printing bug? | |||||||
Description | Hi, there seems to be a bug printing exceptions. First of all, the implementations of the module Printexc and of byterun/printexc.c don't match. E.g.: --------------------------------------------------------------------------- exception E of (int * string) let () = let exc = E (42, "bla") in print_endline (Printexc.to_string exc); raise exc --------------------------------------------------------------------------- As can be seen the C-function does a better job printing the escaping exception. In addition to this we have also complicated applications that sometimes print out exceptions containing only one string argument without the contents of the string, e.g.: exception SomeException of string Leads to the exception string: SomeException (_) instead of: SomeException ("explanation of error") I haven't yet managed to reproduce this error reliably. Maybe you have an idea why this can happen? Best regards, Markus -- Markus Mottl http://www.oefai.at/~markus [^] markus@oefai.at | |||||||
Tags | No tags attached. | |||||||
Attached Files | ||||||||
![]() |
|
(0003089) administrator (administrator) 2004-11-18 10:19 |
> there seems to be a bug printing exceptions. First of all, the > implementations of the module Printexc and of byterun/printexc.c don't > match. E.g.: > exception E of (int * string) > [...] Right, exceptions that take a tuple of arguments are special-cased differently in Printexc and in the runtime system. Note however that the code in the runtime system sometimes goes too far, e.g. exception E of string list let () = raise (E ["foo"]) prints Fatal error: exception Foo.E("foo", 0) so it's unclear we want to reproduce this bug in Printexc... Also, "exception E of int * string" would work fine in both printers. > In addition to this we have also complicated applications that sometimes > print out exceptions containing only one string argument without the > contents of the string, e.g.: > > exception SomeException of string > > Leads to the exception string: > > SomeException (_) > > instead of: > > SomeException ("explanation of error") > > I haven't yet managed to reproduce this error reliably. Maybe you have > an idea why this can happen? How is the printing done? At the toplevel, via Printexc or by the runtime system? The only case that I know of is at the toplevel: # exception E of string list;; exception E of string list # let f () = raise (E ["hello"]);; val f : unit -> 'a = <fun> # exception E of int;; exception E of int # f ();; Exception: E _. It's due to the shadowing of the declaration of E. But even in this case, exceptions that carry a string are special-cased and print correctly: # exception E of string;; exception E of string # let f () = raise (E "hello");; val f : unit -> 'a = <fun> # exception E of int;; exception E of int # f ();; Exception: E "hello". Best wishes, - Xavier Leroy |
(0003090) administrator (administrator) 2004-11-22 21:09 |
On Thu, 18 Nov 2004, Xavier Leroy wrote: > > In addition to this we have also complicated applications that sometimes > > print out exceptions containing only one string argument without the > > contents of the string, e.g.: > > > > exception SomeException of string > > > > Leads to the exception string: > > > > SomeException (_) > > > > instead of: > > > > SomeException ("explanation of error") > > > > I haven't yet managed to reproduce this error reliably. Maybe you have > > an idea why this can happen? > > How is the printing done? At the toplevel, via Printexc or by the > runtime system? The only case that I know of is at the toplevel: [snip] > It's due to the shadowing of the declaration of E. But even in this > case, exceptions that carry a string are special-cased and print > correctly: [snip] It's actually also Failure-exceptions which are sometimes printed without argument. It happens very rarely, I hope we will be able to reliably reproduce this problem in a short code snippet. Thanks anyway for investigating this. Best regards, Markus |
(0003091) administrator (administrator) 2005-01-31 17:28 |
Waiting for repro case. |
(0004412) gerd (reporter) 2008-01-11 16:33 |
I don't have a repro case for Failure, but for Invalid_argument. Separately reported as 0004476. |
(0004424) doligez (administrator) 2008-01-22 12:03 |
fixed in 3.10.2+dev2 |
![]() |
|||
Date Modified | Username | Field | Change |
2005-11-18 10:14 | administrator | New Issue | |
2008-01-11 16:33 | gerd | Note Added: 0004412 | |
2008-01-17 17:08 | doligez | Relationship added | related to 0004476 |
2008-01-22 12:03 | doligez | Note Added: 0004424 | |
2008-01-22 12:03 | doligez | Status | acknowledged => closed |
2008-01-22 12:03 | doligez | Resolution | unable to reproduce => fixed |
2008-01-22 12:03 | doligez | Fixed in Version | => 3.10+dev |
2008-01-22 12:03 | doligez | Description Updated | |
2017-02-23 16:36 | doligez | Category | OCaml general => -OCaml general |
2017-03-03 17:55 | doligez | Category | -OCaml general => -(deprecated) general |
2017-03-03 18:01 | doligez | Category | -(deprecated) general => ~deprecated (was: OCaml general) |
2017-03-06 17:04 | doligez | Category | ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general) |
Copyright © 2000 - 2011 MantisBT Group |