Skip to content

Commit a5d391f

Browse files
author
maechler
committed
str(<eternalptr>) now uses format()
git-svn-id: https://svn.r-project.org/R/trunk@88043 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent e0907f8 commit a5d391f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

doc/NEWS.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
\subsection{NEW FEATURES}{
1616
\itemize{
17-
\item .
17+
\item \code{str()} now shows more via \code{format()} for external pointers.
1818
}
1919
}
2020

src/library/utils/R/str.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# File src/library/utils/R/str.R
22
# Part of the R package, https://www.R-project.org
33
#
4-
# Copyright (C) 1995-2024 The R Core Team
4+
# Copyright (C) 1995-2025 The R Core Team
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License as published by
@@ -470,14 +470,14 @@ str.default <-
470470
paste(" #>#>", mod, NULL)
471471
)
472472
}
473-
} else if(typeof(object) %in%
474-
c("externalptr", "weakref", "environment", "bytecode", "object")) {
473+
} else if((typ <- typeof(object)) %in%
474+
c("externalptr", "weakref", "environment", "bytecode", "object")) {
475475
## Careful here, we don't want to change pointer objects
476476
if(has.class)
477477
cat(pClass(cl))
478478
le <- v.len <- 0
479-
str1 <-
480-
if(is.environment(object)) format(object)
479+
str1 <- ## FIXME?: ideally use format() for all
480+
if(typ %in% c("externalptr", "environment")) format(object)
481481
else paste0("<", typeof(object), ">")
482482
has.class <- TRUE # fake for later
483483
std.attr <- "class"

0 commit comments

Comments
 (0)