Bug 13967 - warnings handled oddly in functions with browser calls
Summary: warnings handled oddly in functions with browser calls
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: old
Hardware: ix86 (32-bit) Windows 32-bit
: P5 normal
Assignee: Jitterbug compatibility account
URL:
Depends on:
Blocks:
 
Reported: 2009-09-23 23:44 UTC by Jitterbug compatibility account
Modified: 2009-09-23 23:44 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jitterbug compatibility account 2009-09-23 23:44:07 UTC
From: richcalaway@revolution-computing.com
Full_Name: Rich Calaway
Version: 2.9.2
OS: Windows Vista
Submission from: (NULL) (65.47.30.18)


Consider the following function:

myfun <- function(){
	print(log(-1))
	browser()
	print("Good-bye!")
}

In the default case, with options(warn=0), if I call this function and type
nothing but standard browser commands (c, n, where, Q) at the browser prompt,
the warning produced by log(-1) is shown at the completion of the function, as
expected:

> myfun()
[1] NaN
Called from: myfun()
Browse[1]> c
[1] "Good-bye!"
Warning message:
In log(-1) : NaNs produced


However, if I type any other sort of R expression at the browser prompt, the
warning is issued immediately after that expression's output:

> myfun()
[1] NaN
Called from: myfun()
Browse[1]> print("hello")
[1] "hello"
Warning message:
In log(-1) : NaNs produced
Browse[1]> c
[1] "Good-bye!"

The warnings should be stored until myfun() returns.

This bug has been present at least since 2.7.2, and persists in the current
R-devel build.

Here's the sessionInfo():

> sessionInfo()
R version 2.10.0 Under development (unstable) (2009-09-21 r49780) 
i386-pc-mingw32 

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base