summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 24a72983875..b9043f35024 100644
--- a/eval.c
+++ b/eval.c
@@ -92,9 +92,9 @@ static int scope_vmode;
int ruby_safe_level = 0;
/* safe-level:
0 - strings from streams/environment/ARGV are tainted (default)
- 1 - no dangerous operation by tainted string
+ 1 - no dangerous operation by tainted value
2 - process/file operations prohibited
- 3 - all genetated strings are tainted
+ 3 - all genetated objects are tainted
4 - no global (non-tainted) variable modification/no direct output
*/
@@ -5223,6 +5223,10 @@ rb_mod_modfunc(argc, argv, module)
ID id;
NODE *body;
+ if (TYPE(module) != T_MODULE) {
+ rb_raise(rb_eTypeError, "module_function must be called for modules");
+ }
+
if (argc == 0) {
SCOPE_SET(SCOPE_MODFUNC);
return module;