зеркало из https://github.com/github/ruby.git
[Bug #20023] Resurrect fake string feature name before raising
This commit is contained in:
Родитель
2e4a0a4d90
Коммит
ca4755b59a
11
load.c
11
load.c
|
@ -935,7 +935,7 @@ load_unlock(rb_vm_t *vm, const char *ftptr, int done)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE rb_require_string_internal(VALUE fname);
|
static VALUE rb_require_string_internal(VALUE fname, bool resurrect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
|
@ -998,7 +998,7 @@ rb_f_require_relative(VALUE obj, VALUE fname)
|
||||||
rb_loaderror("cannot infer basepath");
|
rb_loaderror("cannot infer basepath");
|
||||||
}
|
}
|
||||||
base = rb_file_dirname(base);
|
base = rb_file_dirname(base);
|
||||||
return rb_require_string_internal(rb_file_absolute_path(fname, base));
|
return rb_require_string_internal(rb_file_absolute_path(fname, base), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef int (*feature_func)(rb_vm_t *vm, const char *feature, const char *ext, int rb, int expanded, const char **fn);
|
typedef int (*feature_func)(rb_vm_t *vm, const char *feature, const char *ext, int rb, int expanded, const char **fn);
|
||||||
|
@ -1336,11 +1336,11 @@ ruby_require_internal(const char *fname, unsigned int len)
|
||||||
VALUE
|
VALUE
|
||||||
rb_require_string(VALUE fname)
|
rb_require_string(VALUE fname)
|
||||||
{
|
{
|
||||||
return rb_require_string_internal(FilePathValue(fname));
|
return rb_require_string_internal(FilePathValue(fname), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_require_string_internal(VALUE fname)
|
rb_require_string_internal(VALUE fname, bool resurrect)
|
||||||
{
|
{
|
||||||
rb_execution_context_t *ec = GET_EC();
|
rb_execution_context_t *ec = GET_EC();
|
||||||
int result = require_internal(ec, fname, 1, RTEST(ruby_verbose));
|
int result = require_internal(ec, fname, 1, RTEST(ruby_verbose));
|
||||||
|
@ -1349,6 +1349,7 @@ rb_require_string_internal(VALUE fname)
|
||||||
EC_JUMP_TAG(ec, result);
|
EC_JUMP_TAG(ec, result);
|
||||||
}
|
}
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
if (resurrect) fname = rb_str_resurrect(fname);
|
||||||
load_failed(fname);
|
load_failed(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1360,7 +1361,7 @@ rb_require(const char *fname)
|
||||||
{
|
{
|
||||||
struct RString fake;
|
struct RString fake;
|
||||||
VALUE str = rb_setup_fake_str(&fake, fname, strlen(fname), 0);
|
VALUE str = rb_setup_fake_str(&fake, fname, strlen(fname), 0);
|
||||||
return rb_require_string_internal(str);
|
return rb_require_string_internal(str, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Загрузка…
Ссылка в новой задаче