Skip to content

Commit 6cb25f4

Browse files
committed
Raise TypeError without String argument same as C version
1 parent a9ef32e commit 6cb25f4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/pathname.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ class Pathname
239239
#
240240
def initialize(path)
241241
path = path.to_path if path.respond_to? :to_path
242+
243+
raise TypeError unless path.is_a?(String) # Compatibility for C version
244+
242245
if path.include?("\0")
243246
raise ArgumentError, "pathname contains \\0: #{path.inspect}"
244247
end

0 commit comments

Comments
 (0)