[ruby-core:95038] [Ruby master Bug#16173] ENV.delete returns nil when name does not exist and block given

From: eregontp@...
Date: 2019-09-22 18:40:17 UTC
List: ruby-core #95038
Issue #16173 has been updated by Eregon (Benoit Daloze).


IMHO it's better to fix behavior to be consistent with Hash#delete.
And the compatibility risk seems non existent here.

So I think we should change behavior, and not change documentation which would be inconsistent with Hash#delete.
+1 for @nobu's patch.

----------------------------------------
Bug #16173: ENV.delete returns nil when name does not exist and block given
https://bugs.ruby-lang.org/issues/16173#change-81669

* Author: burdettelamar@yahoo.com (Burdette Lamar)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.4p104 (2019-08-28 revision 67798) [x64-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Attached diff.txt:

* ENV.delete for nonexistent name and block given:
  * Test enhanced to verify return value is nil.
  * Documentation corrected to say that return value is nil, not value.


---Files--------------------------------
diff.txt (2.22 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next