Project

General

Profile

Actions

Bug #7940

closed

Mistaken use of inline rescues in stdlib

Added by Mon_Ouie (Mon ouïe) about 11 years ago. Updated over 10 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
Backport:
[ruby-core:52813]

Description

Hey,

There are two uses of inline rescues in stdlib that look dubious. They are unlikely to ever cause any harm, but still. They've been there for a while now, and are still in trunk. I attached a patch that changes both of them.

In cgi/session.rb:

  def delete
    File::unlink @path+".lock" rescue nil
    File::unlink @path+".new" rescue nil
    File::unlink @path rescue Errno::ENOENT
  end

The rescue part should be on the next line (this has been introduced in a commit that changed indentation).

In scanf.rb:660:

seek(start_position + matched_so_far, IO::SEEK_SET) rescue Errno::ESPIPE

was more likely meant to just silence Errno::ESPIPE exceptions.


Files

inline_rescue.patch (929 Bytes) inline_rescue.patch Mon_Ouie (Mon ouïe), 02/24/2013 09:22 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #7688: Error hiding with rb_rescue() on Comparable#==, #coerce and othersClosedEregon (Benoit Daloze)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0