[#118415] [Ruby master Bug#20601] Configuration flags are not properly propagated to assembler — "vo.x (Vit Ondruch) via ruby-core" <ruby-core@...>

Issue #20601 has been reported by vo.x (Vit Ondruch).

7 messages 2024/07/02

[#118467] [Ruby master Feature#20610] Float::INFINITY as IO.select timeout argument — "akr (Akira Tanaka) via ruby-core" <ruby-core@...>

Issue #20610 has been reported by akr (Akira Tanaka).

8 messages 2024/07/07

[#118483] [Ruby master Bug#20614] Integer#size returns incorrect values on 64-bit Windows — surusek via ruby-core <ruby-core@...>

SXNzdWUgIzIwNjE0IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHN1cnVzZWsgKMWBdWthc3ogU3VyKS4N

10 messages 2024/07/08

[#118577] [Ruby master Bug#20631] Build failure with Xcode 16 beta and macOS 15 (Sequoia) Beta — "hsbt (Hiroshi SHIBATA) via ruby-core" <ruby-core@...>

Issue #20631 has been reported by hsbt (Hiroshi SHIBATA).

9 messages 2024/07/12

[#118682] [Ruby master Misc#20652] Memory allocation for gsub has increased from Ruby 2.7 to 3.3 — "orisano (Nao Yonashiro) via ruby-core" <ruby-core@...>

Issue #20652 has been reported by orisano (Nao Yonashiro).

28 messages 2024/07/25

[ruby-core:118449] [Ruby master Bug#20606] Thread#thread_variable_get, Thread#thread_variable? and Thread#[] methods handle non-String/Symbol parameter values differently

From: "jeremyevans0 (Jeremy Evans) via ruby-core" <ruby-core@...>
Date: 2024-07-05 16:29:30 UTC
List: ruby-core #118449
Issue #20606 has been updated by jeremyevans0 (Jeremy Evans).


Eregon (Benoit Daloze) wrote in #note-4:
> > I'm not opposed to changing the behavior, but raising an exception when one was not previously raised presents backwards compatibility issues. We would probably have to warn in 3.4 and not raise until 3.5 (or later).
> 
> I don't think anyone uses `thread_variable_get`/`thread_variable?` with non-String non-#to_str, non-Symbol keys (and these 2 methods are very rarely used).
> i.e. I think it should be fine to raise an error in 3.4 for this.
> It's already an error when using them and there is one thread-local variable set:
> ```
> > Thread.current.thread_variable_set :a, 1
> > Thread.current.thread_variable_get 12
> (irb):3:in `thread_variable_get': 12 is not a symbol (TypeError)
> ```
> 
> (obviously if others feel it deserves a warning, fine by me, but it seems overkill for this)

I agree that since you already get a TypeError when a thread variable is already set, this is a bug and does not require warning or dev meeting review.  Apologies that I missed the "When no thread-local variables were assigned to a thread" part in my initial review.  Seems odd that specs were added only for the buggy case (no thread variables set), but not added for the correct case (thread variables set).  I added a pull request to fix the issue: https://github.com/ruby/ruby/pull/11109

----------------------------------------
Bug #20606: Thread#thread_variable_get, Thread#thread_variable? and Thread#[] methods handle non-String/Symbol parameter values differently
https://bugs.ruby-lang.org/issues/20606#change-108963

* Author: andrykonchin (Andrew Konchin)
* Status: Open
* ruby -v: 3.2.4
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The `Thread#thread_variable_get`, `Thread#thread_variable?` and `Thread#[]` methods handle the `key` parameter that is not a String or a Symbol in different way but I would expect them to be consistent and raise an exception.

When no thread-local variables were assigned to a thread the `Thread#thread_variable_get` and `Thread#thread_variable?` methods don't raise `TypeError` when argument is of incorrect type. But `Thread#[]` does raise `TypeError` exception:

```ruby
t = Thread.new {}.join

puts t.thread_variable_get(123).inspect # nil
puts t.thread_variable?(123).inspect # false

t[123] # `[]': 123 is not a symbol nor a string (TypeError)
```



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


In This Thread

Prev Next