-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jruby 1.7.16 and 4.2.0.beta2 ActiveSupport::Duration issue #2041
Comments
JRuby should handle this - I think it's a bug in packing rather than a JRuby limitation. Specifically it might be related to how The JRuby pack code isn't something I know well and it's quite complicated, but I would guess that MRI is using a more general type check and method lookup in converting the object to a I couldn't immediately reduce the Thanks very much for the bug report. |
Minimal test case: class Test
def method_missing(method, *args, &block)
14.send(method, *args, &block)
end
end
p [Test.new].pack('N') |
It looks like JRuby checks |
@chrisseaton It looks like that issue may have been fixed since Rails 4.2.0 beta 2. See this commit - rails/rails@f976751 . Let me run the same tests against Rails master and see if the problem is resolved. |
Ok - we still have a different in behaviour for my test case though - so whether or not that Rails class works there is still a bug here. |
So it doesn't work with master rails, even though the respond_to? call is properly deferred. From my tests:
|
I'll wait for someone from the core team to weigh in on this - they will probably understand quicker than I how this conversion to integer is supposed to work and what the problem is likely to be. |
@chrisseaton Sounds good. Thanks for investigating. |
This smells like it might be related to #1856 |
this bug has been fixed, somewhere along the line of JRuby 1.7.x releases :
|
In Rails 4.2 a new class, ActiveSupport::Duration was introduced. So where previously an expression like:
would have type Fixnum, it now has type
ActiveSupport::Duration
. As you'd expect, callingto_i
on theActiveSupport::Duration
object gives you the old Fixnum value.With JRuby 1.7.16 I'm seeing an issue using
pack
with arrays containingActiveSupport::Duration
objects. Specifically, if I do the following:I get an error that looks like this:
Now one can certainly argue that this isn't a JRuby problem, it's a Rails issue. But:
7.days
to be serialized. So it impacts ActiveRecord, Dalli, etc.So ideally it would be nice if JRuby handled this transparently. Any thoughts?
The text was updated successfully, but these errors were encountered: