Project

General

Profile

Actions

Bug #15597

closed

syscall not returning true from private_method_defined?

Added by AaronLasseigne (Aaron Lasseigne) almost 6 years ago. Updated almost 6 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:91505]

Description

syscode is a private method on Object but when checked with private_method_defined? it returns false.

Ruby 2.6.1

irb(main):001:0> Object.new.private_methods.sort.select { |pm| !Object.private_method_defined?(pm) }
=> [:syscall]

Ruby 2.5.3

irb(main):001:0> Object.new.private_methods.sort.select { |pm| !Object.private_method_defined?(pm) }
=> []

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #14944: Support optional inherit argument for Module#method_defined?ClosedActions
Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

  • Related to Feature #14944: Support optional inherit argument for Module#method_defined? added

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

  • Status changed from Open to Feedback

What is your OS?
Doesn't syscall method always raise a NotImplementedError?

Updated by AaronLasseigne (Aaron Lasseigne) almost 6 years ago

I'm on MacOS 10.14.3 and yes it does raise a NotImplementedError. Even so, shouldn't it be shown as a private method?

Updated by Hanmac (Hans Mackowiak) almost 6 years ago

@nobu (Nobuyoshi Nakada) : this commit changed it

https://github.com/ruby/ruby/commit/67d87b192b23a75092280b534570580df0f8f7a5

specially this line:

if (me->def->type == VM_METHOD_TYPE_NOTIMPLEMENTED) return METHOD_VISI_UNDEF;

means for each not implemented method, the visibility is undef, and the checks does fail

another question would be if #private_methods should return such not implemented methods?

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

  • Status changed from Feedback to Rejected

It's same as that respond_to?(:syscall, true) returns false.

Updated by Hanmac (Hans Mackowiak) almost 6 years ago

@nobu (Nobuyoshi Nakada) should we change what the #methods returns? or is that to much work?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0