ruby / csv

CSV Reading and Writing
https://ruby.github.io/csv/
BSD 2-Clause "Simplified" License
178 stars 113 forks source link

Improve Ractor-compliance #218

Closed rm155 closed 2 years ago

rm155 commented 3 years ago

In order to become Ractor-compliant, CSV should avoid relying on class variables and global variables.

Additionally, since Converters and HeaderConverters are not accessible from Ractors, defining get_converters and get_header_converters (which access Ractor-local versions) can allow for an alternative within Ractors.

kou commented 3 years ago

How did you confirm that these changes are needed to use in Ractor? Can we create test cases for Ractor?

rm155 commented 3 years ago

How did you confirm that these changes are needed to use in Ractor? Can we create test cases for Ractor?

If CSV tries to parse a file from a Ractor, it looks for the converters, but since they are unfrozen shared constants, it can't access them.

I've written some tests for using CSV in Ractors. I can upload them soon.

rm155 commented 2 years ago

Thank you so much for your suggestions! I will update the pull request and rebase within the next few days.

rm155 commented 2 years ago

I have made the updates and done the rebasing. I hope it is okay! Please let me know if there is any way I can improve it.

kou commented 2 years ago

I'll merge this. Thanks!

rm155 commented 2 years ago

I'll merge this. Thanks!

Thanks so much for your support and patience!