[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    [ruby-core:110537] [Ruby master Misc#19088] Complex() method with `exception: false` option still ra
From:       "andrykonchin (Andrew Konchin)" <noreply () ruby-lang ! org>
Date:       2022-10-28 15:53:24
Message-ID: redmine.journal-99863.20221028155323.13553 () ruby-lang ! org
[Download RAW message or body]

Issue #19088 has been updated by andrykonchin (Andrew Konchin).


Got it. Thank you.

----------------------------------------
Misc #19088: Complex() method with `exception: false` option still raises exception \
when String argument is in non-ASCII-compatible encoding \
https://bugs.ruby-lang.org/issues/19088#change-99863

* Author: andrykonchin (Andrew Konchin)
* Status: Closed
* Priority: Normal
----------------------------------------
I've noticed a minor inconsistency of the `Complex()` method. When it is called with \
`exception: false` option I suppose it shouldn't raise any exception.

For instance it doesn't raise error in the following cases:

```ruby
Complex("1+2ifoobar", exception: false) # => nil
Complex("1+2i\0", exception: false) # => nil
```

But it still raises error when argument is in non-ASCII-compatible encoding:

```ruby
Complex("1+2i".encode("UTF-16"), exception: false)
(irb):4:in `Complex': ASCII incompatible encoding: UTF-16 \
(Encoding::CompatibilityError) ```

I am wondering if `exception: false` is supposed to suppress this exception as well.



-- 
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>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic