* [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
@ 2024-06-10 23:36 tenderlovemaking (Aaron Patterson) via ruby-core
2024-06-10 23:37 ` [ruby-core:118280] " tenderlovemaking (Aaron Patterson) via ruby-core
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: tenderlovemaking (Aaron Patterson) via ruby-core @ 2024-06-10 23:36 UTC (permalink / raw)
To: ruby-core; +Cc: tenderlovemaking (Aaron Patterson)
Issue #20573 has been reported by tenderlovemaking (Aaron Patterson).
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ruby-core:118280] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
@ 2024-06-10 23:37 ` tenderlovemaking (Aaron Patterson) via ruby-core
2024-06-11 6:23 ` [ruby-core:118285] " byroot (Jean Boussier) via ruby-core
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tenderlovemaking (Aaron Patterson) via ruby-core @ 2024-06-10 23:37 UTC (permalink / raw)
To: ruby-core; +Cc: tenderlovemaking (Aaron Patterson)
Issue #20573 has been updated by tenderlovemaking (Aaron Patterson).
Oops, I send this before pasting the output of the script:
```
$ ./miniruby test.rb
false
{"test.rb:8: warning: variable $= is no longer effective\n"=>:deprecated}
```
You can see that "deprecated" warnings are not enabled, but `Warning.warn` is still called.
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573#change-108773
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ruby-core:118285] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
2024-06-10 23:37 ` [ruby-core:118280] " tenderlovemaking (Aaron Patterson) via ruby-core
@ 2024-06-11 6:23 ` byroot (Jean Boussier) via ruby-core
2024-06-11 6:56 ` [ruby-core:118286] " byroot (Jean Boussier) via ruby-core
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: byroot (Jean Boussier) via ruby-core @ 2024-06-11 6:23 UTC (permalink / raw)
To: ruby-core; +Cc: byroot (Jean Boussier)
Issue #20573 has been updated by byroot (Jean Boussier).
Agreed, `Warning.warn` patches shouldn't be called for disabled categories.
I was actually 100% convinced this was the behavior, and this fix is consistent with `Warning.warn` not being invoked for verbose warnings when `$VERBOSE = false`.
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573#change-108780
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ruby-core:118286] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
2024-06-10 23:37 ` [ruby-core:118280] " tenderlovemaking (Aaron Patterson) via ruby-core
2024-06-11 6:23 ` [ruby-core:118285] " byroot (Jean Boussier) via ruby-core
@ 2024-06-11 6:56 ` byroot (Jean Boussier) via ruby-core
2024-06-11 7:46 ` [ruby-core:118287] " byroot (Jean Boussier) via ruby-core
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: byroot (Jean Boussier) via ruby-core @ 2024-06-11 6:56 UTC (permalink / raw)
To: ruby-core; +Cc: byroot (Jean Boussier)
Issue #20573 has been updated by byroot (Jean Boussier).
In [Feature #16345] it was stated:
> We chose Warning.disable(:deprecated) instead of
re-defining Warning.warn in order to avoid string object generation.
The intent was clearly for `Warning.warn` not to be called.
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573#change-108787
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ruby-core:118287] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
` (2 preceding siblings ...)
2024-06-11 6:56 ` [ruby-core:118286] " byroot (Jean Boussier) via ruby-core
@ 2024-06-11 7:46 ` byroot (Jean Boussier) via ruby-core
2024-06-11 16:00 ` [ruby-core:118291] " tenderlovemaking (Aaron Patterson) via ruby-core
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: byroot (Jean Boussier) via ruby-core @ 2024-06-11 7:46 UTC (permalink / raw)
To: ruby-core; +Cc: byroot (Jean Boussier)
Issue #20573 has been updated by byroot (Jean Boussier).
On Ruby 2.7.8 when `Warning[:deprecated] = false` was introduced:
```ruby
def Warning.warn(message, **)
p [:warn, message]
end
def foo(a, **b)
[a, b]
end
hash = {bar: 2}
foo(1, hash)
```
Produces no output, `Warning.warn` isn't called. I think this was the intent all along.
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573#change-108789
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ruby-core:118291] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
` (3 preceding siblings ...)
2024-06-11 7:46 ` [ruby-core:118287] " byroot (Jean Boussier) via ruby-core
@ 2024-06-11 16:00 ` tenderlovemaking (Aaron Patterson) via ruby-core
2024-06-12 8:30 ` [ruby-core:118300] " byroot (Jean Boussier) via ruby-core
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tenderlovemaking (Aaron Patterson) via ruby-core @ 2024-06-11 16:00 UTC (permalink / raw)
To: ruby-core; +Cc: tenderlovemaking (Aaron Patterson)
Issue #20573 has been updated by tenderlovemaking (Aaron Patterson).
byroot (Jean Boussier) wrote in #note-6:
> In [Feature #16345] it was stated:
>
> > We chose Warning.disable(:deprecated) instead of
> re-defining Warning.warn in order to avoid string object generation.
>
> The intent was clearly for `Warning.warn` not to be called.
I'm reading the ticket the same way. It sounds like this is a bug.
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573#change-108795
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ruby-core:118300] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
` (4 preceding siblings ...)
2024-06-11 16:00 ` [ruby-core:118291] " tenderlovemaking (Aaron Patterson) via ruby-core
@ 2024-06-12 8:30 ` byroot (Jean Boussier) via ruby-core
2024-07-02 11:24 ` [ruby-core:118414] " Eregon (Benoit Daloze) via ruby-core
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: byroot (Jean Boussier) via ruby-core @ 2024-06-12 8:30 UTC (permalink / raw)
To: ruby-core; +Cc: byroot (Jean Boussier)
Issue #20573 has been updated by byroot (Jean Boussier).
Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: WONTFIX, 3.2: REQUIRED, 3.3: REQUIRED
Given it's a bug fix I think we should mark it for backport. But of course it's up to branch maintainers to decide whether the fix is worth backporting.
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573#change-108806
* Author: tenderlovemaking (Aaron Patterson)
* Status: Closed
* Backport: 3.1: WONTFIX, 3.2: REQUIRED, 3.3: REQUIRED
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ruby-core:118414] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
` (5 preceding siblings ...)
2024-06-12 8:30 ` [ruby-core:118300] " byroot (Jean Boussier) via ruby-core
@ 2024-07-02 11:24 ` Eregon (Benoit Daloze) via ruby-core
2024-07-08 22:59 ` [ruby-core:118505] " k0kubun (Takashi Kokubun) via ruby-core
2024-07-20 6:04 ` [ruby-core:118645] " nagachika (Tomoyuki Chikanaga) via ruby-core
8 siblings, 0 replies; 10+ messages in thread
From: Eregon (Benoit Daloze) via ruby-core @ 2024-07-02 11:24 UTC (permalink / raw)
To: ruby-core; +Cc: Eregon (Benoit Daloze)
Issue #20573 has been updated by Eregon (Benoit Daloze).
As a small note on this, it's typically better to check `$VERBOSE` level and if the category is enabled before even generating/formatting the message String, for performance reasons.
So if that's always done the check in Warning.warn would be basically redundant.
But I agree it makes sense conceptually to check and also in some cases where e.g. the message String is static + frozen and then there is no cost for that message String.
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573#change-108930
* Author: tenderlovemaking (Aaron Patterson)
* Status: Closed
* Backport: 3.1: WONTFIX, 3.2: REQUIRED, 3.3: REQUIRED
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ruby-core:118505] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
` (6 preceding siblings ...)
2024-07-02 11:24 ` [ruby-core:118414] " Eregon (Benoit Daloze) via ruby-core
@ 2024-07-08 22:59 ` k0kubun (Takashi Kokubun) via ruby-core
2024-07-20 6:04 ` [ruby-core:118645] " nagachika (Tomoyuki Chikanaga) via ruby-core
8 siblings, 0 replies; 10+ messages in thread
From: k0kubun (Takashi Kokubun) via ruby-core @ 2024-07-08 22:59 UTC (permalink / raw)
To: ruby-core; +Cc: k0kubun (Takashi Kokubun)
Issue #20573 has been updated by k0kubun (Takashi Kokubun).
Backport changed from 3.1: WONTFIX, 3.2: REQUIRED, 3.3: REQUIRED to 3.1: WONTFIX, 3.2: REQUIRED, 3.3: DONE
ruby_3_3 commit:a3eb5e5c70eaee12964cdd807b8f19950003141f.
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573#change-109027
* Author: tenderlovemaking (Aaron Patterson)
* Status: Closed
* Backport: 3.1: WONTFIX, 3.2: REQUIRED, 3.3: DONE
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* [ruby-core:118645] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
` (7 preceding siblings ...)
2024-07-08 22:59 ` [ruby-core:118505] " k0kubun (Takashi Kokubun) via ruby-core
@ 2024-07-20 6:04 ` nagachika (Tomoyuki Chikanaga) via ruby-core
8 siblings, 0 replies; 10+ messages in thread
From: nagachika (Tomoyuki Chikanaga) via ruby-core @ 2024-07-20 6:04 UTC (permalink / raw)
To: ruby-core; +Cc: nagachika (Tomoyuki Chikanaga)
Issue #20573 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 3.1: WONTFIX, 3.2: REQUIRED, 3.3: DONE to 3.1: WONTFIX, 3.2: DONE, 3.3: DONE
ruby_3_2 commit:4f1e047f86b159528055d37ee0da2ad6e5a38c23 merged revision(s) commit:a3eb5e5c70eaee12964cdd807b8f19950003141f.
----------------------------------------
Bug #20573: Warning.warn shouldn't be called for disabled warnings
https://bugs.ruby-lang.org/issues/20573#change-109173
* Author: tenderlovemaking (Aaron Patterson)
* Status: Closed
* Backport: 3.1: WONTFIX, 3.2: DONE, 3.3: DONE
----------------------------------------
Currently `Warning.warn` will be called for all warnings, even if that particular category is disabled.
For example
```ruby
module Warning
def warn(message, category:)
p message => category
end
end
def get_var
$=
end
p Warning[:deprecated]
get_var
```
I think that internally we should _not_ call `Warning.warn` unless the category is enabled.
I've sent a PR here: https://github.com/ruby/ruby/pull/10960
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-07-20 6:05 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-10 23:36 [ruby-core:118279] [Ruby master Bug#20573] Warning.warn shouldn't be called for disabled warnings tenderlovemaking (Aaron Patterson) via ruby-core
2024-06-10 23:37 ` [ruby-core:118280] " tenderlovemaking (Aaron Patterson) via ruby-core
2024-06-11 6:23 ` [ruby-core:118285] " byroot (Jean Boussier) via ruby-core
2024-06-11 6:56 ` [ruby-core:118286] " byroot (Jean Boussier) via ruby-core
2024-06-11 7:46 ` [ruby-core:118287] " byroot (Jean Boussier) via ruby-core
2024-06-11 16:00 ` [ruby-core:118291] " tenderlovemaking (Aaron Patterson) via ruby-core
2024-06-12 8:30 ` [ruby-core:118300] " byroot (Jean Boussier) via ruby-core
2024-07-02 11:24 ` [ruby-core:118414] " Eregon (Benoit Daloze) via ruby-core
2024-07-08 22:59 ` [ruby-core:118505] " k0kubun (Takashi Kokubun) via ruby-core
2024-07-20 6:04 ` [ruby-core:118645] " nagachika (Tomoyuki Chikanaga) via ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).