Project

General

Profile

Actions

Bug #16607

closed

retried require does not raise Exception even if a library has SyntaxError

Added by gotoken (Kentaro Goto) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
[ruby-core:97057]

Description

From shell:

% echo "class C" > c.rb
% ruby -e 'begin p require "./c" ; rescue SyntaxError; end; p require "./c"; C'

expected result: SyntaxError
2.7 and current master output:

false
Traceback (most recent call last):
-e:1:in `<main>': uninitialized constant C (NameError)
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED
Actions #2

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|7d6903dc476f982e7b432adbeef3a3d9372a309f.


Add the loaded feature after no exception raised

Retrying after rescued require should try to load the same
library again. [Bug #16607]

Updated by naruse (Yui NARUSE) over 4 years ago

  • Backport changed from 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE

ruby_2_7 c7e0ce67430b5e312eb626a2c2f4b6a810b3b68b.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0