|
1 | 1 | # File src/library/utils/R/objects.R |
2 | 2 | # Part of the R package, https://www.R-project.org |
3 | 3 | # |
4 | | -# Copyright (C) 1995-2024 The R Core Team |
| 4 | +# Copyright (C) 1995-2025 The R Core Team |
5 | 5 | # |
6 | 6 | # This program is free software; you can redistribute it and/or modify |
7 | 7 | # it under the terms of the GNU General Public License as published by |
@@ -419,7 +419,7 @@ function(x, value) |
419 | 419 | S3names <- S3[, 3L] |
420 | 420 | if(x %in% S3names) { |
421 | 421 | i <- match(x, S3names) |
422 | | - genfun <- get(S3[i, 1L], mode = "function", envir = parent.frame()) |
| 422 | + genfun <- get(S3[i, 1L], mode = "function", envir = ns) |
423 | 423 | if(.isMethodsDispatchOn() && methods::is(genfun, "genericFunction")) |
424 | 424 | genfun <- methods::slot(genfun, "default")@methods$ANY |
425 | 425 | defenv <- .defenv_for_S3_registry(genfun) |
@@ -479,7 +479,7 @@ function(x, value, ns, pos = -1, envir = as.environment(pos)) |
479 | 479 | S3names <- S3[, 3L] |
480 | 480 | if(x %in% S3names) { |
481 | 481 | i <- match(x, S3names) |
482 | | - genfun <- get(S3[i, 1L], mode = "function", envir = parent.frame()) |
| 482 | + genfun <- get(S3[i, 1L], mode = "function", envir = ns) |
483 | 483 | if(.isMethodsDispatchOn() && methods::is(genfun, "genericFunction")) |
484 | 484 | genfun <- methods::slot(genfun, "default")@methods$ANY |
485 | 485 | defenv <- .defenv_for_S3_registry(genfun) |
|
0 commit comments