Project

General

Profile

Bug #16607

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

Added by gotoken (Kentaro Goto) 8 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
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)
#1

Updated by nobu (Nobuyoshi Nakada) 8 months ago

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

Updated by nobu (Nobuyoshi Nakada) 8 months 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) 7 months 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.

Also available in: Atom PDF