Skip to content

Always call finalize and deprep - #668

Merged
tompng merged 1 commit into
ruby:masterfrom
tompng:ensure_finalize
Apr 4, 2024
Merged

tompng merged 1 commit into
ruby:masterfrom
tompng:ensure_finalize

Conversation

@tompng

@tompng tompng commented Mar 26, 2024

Copy link
Copy Markdown
Member

We should use ensure to ensure finalize and deprep always called.
If we don't use ensure, these cleanup can be skipped if ->{return}.call or throw is used.

This seems to reduce SystemStackError of #667
But does not solve it. ruby -Ilib -rreline -e "Thread.new{p Reline.readline'>'};sleep 0.1; p Reline.readline'>' still raise SystemStackError

Comment thread lib/reline.rb Outdated
@@ -366,18 +366,14 @@ def readline(prompt = '', add_hist = false)
rescue Errno::EIO
# Maybe the I/O has been closed.
rescue StandardError => e

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to rescue StandardError separately after this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍
No need. updated

Also removed rescue Exception which is added in #404, looks like only to run finalize and deprep

@tompng
tompng force-pushed the ensure_finalize branch from 2903451 to 8a06eae Compare April 4, 2024 15:53
@tompng
tompng force-pushed the ensure_finalize branch from 8a06eae to 8992e29 Compare April 4, 2024 15:58
@tompng
tompng merged commit 91b030c into ruby:master Apr 4, 2024
@tompng
tompng deleted the ensure_finalize branch April 4, 2024 16:15
@ima1zumi ima1zumi added the bug Something isn't working label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants