Thanks Ivan. I did not know about ` .Internal(printDeferredWarnings())`. It does provide a solution for what I need. Best, Laurent
Le mer. 26 avr. 2023 à 06:23, Ivan Krylov <krylov.r...@gmail.com> a écrit : > В Sun, 23 Apr 2023 13:33:16 -0400 > Laurent Gautier <lgaut...@gmail.com> пишет: > > > When tracing what happens during an error I found that > > verrorcall_dflt() in src/main/errors.c calls PrintWarnings(). That > > function is not part of R's C-API though. > > I've tried reading the source code and came to a similar conclusion. > > PrintWarnings() is required for warnings() to work because it creates > the last.warning variable for warnings() to access. When driving an > embedded R, R_ReplDLLdo1() will call it for you between expressions it > processes, but there doesn't seem to be a way to call it yourself. > > Interestingly, there is .Internal(printDeferredWarnings()) which > eventually calls PrintWarnings(), but it's not exported as an API, only > used in a few places like try(). > > Would it help to run with options(warn = 1)? I think that a different > code path is taken in this case, which should emit warnings even > without a working REPL. warnings() would still be empty, unfortunately. > > -- > Best regards, > Ivan > [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel