Skip to content
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

fix Struct#inspect with recursion #2285

Closed
wants to merge 2 commits into from
Closed

fix Struct#inspect with recursion #2285

wants to merge 2 commits into from

Conversation

lumeet
Copy link
Contributor

@lumeet lumeet commented Dec 6, 2014

Referring to #2142 the details regarding differences between MRI and JRuby recursion guards are way beyond my understanding. If the code changes suck, I hope this PR at least explains what the problem is. :)

@headius
Copy link
Member

headius commented Jan 12, 2015

PR looks fine to me. Will try it locally.

@headius
Copy link
Member

headius commented Jan 12, 2015

Well the changes look fine, but they don't make the test I reported in #2142 pass:

~/projects/jruby $ jruby test/mri/runner.rb test_pp.rb
Run options: 

# Running tests:

[ 7/20] PPTestModule::PPCycleTest#test_withinspect = 0.01 s      
  1) Failure:
PPTestModule::PPCycleTest#test_withinspect [/Users/headius/projects/jruby/test/mri/test_pp.rb:157]:
<"[<inspect:[...]>]\n"> expected but was
<"[<inspect:[<inspect:[...]>]>]\n">.

Seems like it's doubling up the "inspect:" part.

@lumeet
Copy link
Contributor Author

lumeet commented Jan 15, 2015

@headius Don't know how I missed that one. It also seems to be a completely other story, which extends beyond the beginner level, I think. I've been investigating the issue quite a bit but don't know how to continue. Array#inspect should perhaps be more like that in Struct, which I tried with little success.

As far as I know the first line should be affected by the latter:
https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/Ruby.java#L4094
https://github.com/jruby/jruby/blob/master/lib/ruby/stdlib/pp.rb#L164

This seems not to be the case and maybe it's the root of the problem? In MRI, the behavior is the same as in JRuby now if the latter line is left out.

I think I'm going to leave the last part of the issue to someone with a bit more experience of the subject.

@kares
Copy link
Member

kares commented Nov 14, 2015

adapted your commit to fit with master updates: 33bb8d2?w=1 ... Struct#inspect now behaves as MRI the pp test fails the same but as you already find out its a fix to be made elsewhere (not in Struct)

@kares kares closed this Nov 14, 2015
@enebo enebo modified the milestone: Non-Release May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants