summaryrefslogtreecommitdiff
path: root/ext/psych
AgeCommit message (Collapse)Author
2025-05-12[ruby/psych] Bump version for releaseAaron Patterson
https://github.com/ruby/psych/commit/b9dec9f811
2025-05-12[ruby/psych] Fix dumping `StringIO` (and potentially others) on Ruby <= 2.7Earlopain
In Ruby < 3.0, the superclass of StringIO was actually already `Data`, but it doesn't have the expected shape. So, on these earlier versions it errors: > NoMethodError: undefined method `members' for #<StringIO:0x00005641dd5f2880> > vendor/bundle/ruby/2.6.0/gems/psych-5.2.5/lib/psych/visitors/yaml_tree.rb:170:in `visit_Data' This test doesn't fail on 2.7, presumably because it can pull in a newer `stringio` version. https://github.com/ruby/psych/commit/0f40f56268
2025-05-09[ruby/psych] Bump version for releaseAaron Patterson
https://github.com/ruby/psych/commit/dbf9e36583
2025-05-09[ruby/psych] add first test for safe load streamOrenGitHub
https://github.com/ruby/psych/commit/336553b412
2025-05-09[ruby/psych] fixed bugs from testingOrenGitHub
https://github.com/ruby/psych/commit/e954f96639
2025-05-09[ruby/psych] Add safe version for load_streamOrenGitHub
https://github.com/ruby/psych/commit/30a2a5ee94
2025-05-08[ruby/psych] Refine Ruby 3.5 Set support.Jean Boussier
Use feature testing to detect native Set, and don't rely on `Set#to_h` which wasn't intended as a public method. https://github.com/ruby/psych/commit/d58cff11af
2025-05-02[ruby/psych] Use `rb_struct_initialize` to initialize Datanick evans
https://github.com/ruby/psych/commit/3573fb356e
2025-05-01[ruby/psych] fix error in @dispatch_catchSam Rawlins
https://github.com/ruby/psych/commit/9df5501fdc
2025-05-01Add support for Data objects with ivarsnick evans
This sets the ivars _before_ calling initialize, which feels wrong. But Data doesn't give us any mechanism for setting the members other than 1) initialize, or 2) drop down into the C API. Since initialize freezes the object, we need to set the ivars before that. I think this is a reasonable compromise—if users need better handling, they can implement their own `encode_with` and `init_with`. But it will lead to unhappy surprises for some users. Alternatively, we could use the C API, similarly to Marshal. Psych _is_ already using the C API for path2class and build_exception. This would be the least surprising behavior for users, I think.
2025-05-01[ruby/psych] Add support for ruby 3.2 Data objectsnick evans
https://github.com/ruby/psych/commit/788b844c83
2025-05-01[ruby/psych] Fix loading/parsing regular expressionsMartin Meyerhoff
This fixes the issue where regular expression would come back slightly different after going through a YAML load/dump cycle. Because we're used to having to escape forward slashes in regular expression literals (because the literal is delimited by slashes), but the deserializer takes the literal output from `Regexp#inspect` and feeds it as a string into `Regexp.new`, which expects a string, not a Regexp literal, cycling did not properly work before this commit. I've also changed the code to be a bit more readable, I hope this doesn't affect performance. https://github.com/ruby/psych/commit/f4dd8dadad
2025-05-01[ruby/psych] Bump version for releaseAaron Patterson
https://github.com/ruby/psych/commit/bb63f91825
2025-04-30[ruby/psych] Handle Ruby 3.5 new Set classJean Boussier
Since `Set` no longer is a regular object class holding a Hash it needs to be specially handled. https://github.com/ruby/psych/commit/c2d185d27c
2025-03-27[ruby/psych] Format Date in ISO-8601 explicitlyNobuyoshi Nakada
Fix https://github.com/ruby/psych/pull/644 https://github.com/ruby/psych/commit/b1ade765ba
2025-02-14[ruby/psych] Avoid calls to `require` in hotspotsJean Boussier
Followup: https://github.com/ruby/psych/pull/686 This single call shows up as 4% of some controller actions in the lobsters benchmark. Profile: https://share.firefox.dev/3EqKnhS https://github.com/ruby/psych/commit/b77bfee092
2025-01-17[ruby/psych] Bump version for releaseCharles Oliver Nutter
https://github.com/ruby/psych/commit/2af9f6ac02
2025-01-15[ruby/psych] Update to SnakeYAML-Engine 2.9Charles Oliver Nutter
Fixes ruby/psych#689 https://github.com/ruby/psych/commit/ac887cdc76
2025-01-15[ruby/psych] remove vim settingsAaron Patterson
https://github.com/ruby/psych/commit/2f46abf4e1
2024-12-18[ruby/psych] Bump up v5.2.2Hiroshi SHIBATA
https://github.com/ruby/psych/commit/746e1ad24d
2024-12-16[ruby/psych] Don't autolink Exception in psych module docszzak
https://docs.ruby-lang.org/en/master/Psych.html#module-Psych-label-Exception+handling https://github.com/ruby/psych/commit/c53c298222
2024-12-09[ruby/psych] Bump up 5.2.1Hiroshi SHIBATA
https://github.com/ruby/psych/commit/7c81f7db53
2024-12-04[ruby/psych] Do not depend on the evaluation order of C argumentsYusuke Endoh
The evaluation order of C arguments is unspecified. `RSTRING_LEN(value)` would fail if the conversion to a String by `StringValuePtr(value)` is not done yet. Coverity Scan found this issue. https://github.com/ruby/psych/commit/d1e6bf323a
2024-11-20[ruby/psych] Eagerly require `date`.Thierry Deo
https://github.com/ruby/psych/commit/b2aa0032c0
2024-11-11[ruby/psych] Bump up v5.2.0Hiroshi SHIBATA
https://github.com/ruby/psych/commit/6ea07fdadd
2024-11-11[ruby/psych] Bump up v5.2.0.beta7Hiroshi SHIBATA
https://github.com/ruby/psych/commit/6609955e68
2024-11-11[ruby/psych] Bump up v5.2.0.beta6Hiroshi SHIBATA
https://github.com/ruby/psych/commit/b89064efa5
2024-11-11[ruby/psych] Bump up v5.2.0.beta5Hiroshi SHIBATA
https://github.com/ruby/psych/commit/48e5af8454
2024-11-11[ruby/psych] Bump up v5.2.0.beta4Hiroshi SHIBATA
https://github.com/ruby/psych/commit/288febbc87
2024-11-07[ruby/psych] Bump up v5.2.0.beta3Hiroshi SHIBATA
https://github.com/ruby/psych/commit/d9e18aaab7
2024-11-07[ruby/psych] Bump up v5.2.0.beta2Hiroshi SHIBATA
https://github.com/ruby/psych/commit/a0c353ec97
2024-09-24[ruby/psych] Use `String#match?` over `String#=~` when applicableJean Boussier
Save on allocating useless `MatchData` instances. https://github.com/ruby/psych/commit/b2d9f16e58
2024-09-11[ruby/psych] Ensure strings with only underscores are not processed as IntegerJohn Meade
A string similar to "0x____" should be treated as a string. Currently it is processed as an Integer. This alters the regex specified by http://yaml.org/type/int.html to ensure at least one numerical symbol is present in the string before converting to Integer. https://github.com/ruby/psych/commit/81479b203e
2024-09-09[ruby/psych] Bump up 5.2.0.beta1Hiroshi SHIBATA
https://github.com/ruby/psych/commit/a8b73bb80e
2024-09-09[ruby/psych] Unlimited line_width with -1Juanjo Bazán
https://github.com/ruby/psych/commit/3b63a93dfc
2024-09-09[ruby/psych] Make to load stringio lazilyHiroshi SHIBATA
https://github.com/ruby/psych/commit/9f5392d180
2024-09-09[ruby/psych] docs: specify correct default `fallback` valueGareth Jones
https://github.com/ruby/psych/commit/ce7946981d
2024-08-09[ruby/psych] Guard from memory leak in Psych::Emitter#start_documentPeter Zhu
When an exception is raised, it can leak memory in `head`. There are two places that can leak memory: 1. `Check_Type(tuple, T_ARRAY)` can leak memory if `tuple` is not an array. 2. `StringValue(name)` and `StringValue(value)` if they are not strings and the call to `to_str` does not return a string. This commit fixes these memory leaks by wrapping the code around a rb_ensure so that the memory is freed in all cases. The following code demonstrates the memory leak: emitter = Psych::Emitter.new(StringIO.new) nil_to_string_tags = [[nil, "tag:TALOS"]] + ([1] * 1000) expected_array_tags = [1] * 1000 10.times do 1_000.times do # Raises `no implicit conversion of nil into String` emitter.start_document([], nil_to_string_tags, 0) rescue TypeError end 1_000.times do # Raises `wrong argument type Integer (expected Array)` emitter.start_document([], expected_array_tags, 0) rescue TypeError end puts `ps -o rss= -p #{$$}` end Before: 47248 79728 111968 144224 176480 208896 241104 273280 305472 337664 After: 14832 15088 15344 15344 15360 15632 15632 15632 15648 15648 https://github.com/ruby/psych/commit/053af73818
2024-08-09[ruby/psych] Convert missed tabs to spaces in C filesPeter Zhu
https://github.com/ruby/psych/commit/74a6b4d226
2024-08-09[ruby/psych] Convert tabs to spaces in C filesPeter Zhu
https://github.com/ruby/psych/commit/e7d64c9848
2024-07-19Don't call `Kernel#require` in hot loopJean Boussier
Ref: https://bugs.ruby-lang.org/issues/20641 Even without the reference bug, `require 'date'` isn't cheap. ```ruby require "benchmark/ips" require "yaml" require "date" 100.times do |i| $LOAD_PATH.unshift("/tmp/does/not/exist/#{i}") end payload = 100.times.map { Date.today }.to_yaml Benchmark.ips do |x| x.report("100 dates") { YAML.unsafe_load(payload) } end ``` Before: ``` $ ruby /tmp/bench-yaml.rb ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22] Warming up -------------------------------------- 100 dates 416.000 i/100ms Calculating ------------------------------------- 100 dates 4.309k (± 1.2%) i/s - 21.632k in 5.021003s ``` After: ``` $ ruby -Ilib /tmp/bench-yaml.rb ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22] Warming up -------------------------------------- 100 dates 601.000 i/100ms Calculating ------------------------------------- 100 dates 5.993k (± 1.8%) i/s - 30.050k in 5.016079s ```
2024-04-27ruby tool/update-deps --fix卜部昌平
2024-01-18[ruby/psych] Add :stringify_names option to convert symbol keys to string ↵Robert Schulze
for dumping https://github.com/ruby/psych/commit/3d051d89aa
2024-01-17[ruby/psych] Provide a 'Changelog' link on rubygems.org/gems/psychMark Young
By providing a 'changelog_uri' in the metadata of the gemspec a 'Changelog' link will be shown on https://rubygems.org/gems/psych which makes it quick and easy for someone to check on the changes introduced with a new version. Details of this functionality can be found on https://guides.rubygems.org/specification-reference/ https://github.com/ruby/psych/commit/28ef10edcf
2024-01-17[ruby/psych] issue #443: quote Y and N when dumpingColin Kelley
https://github.com/ruby/psych/commit/93c8fb443a
2023-12-25[ruby/psych] Remove now-unreachable rescue blockAlexander Momchilov
https://github.com/ruby/psych/commit/6905a2123c
2023-12-25[ruby/psych] Remove unused arrayAlexander Momchilov
https://github.com/ruby/psych/commit/b9e7b4a4a4
2023-12-19[ruby/psych] Bump up 5.1.2Hiroshi SHIBATA
https://github.com/ruby/psych/commit/a9ab74d132
2023-12-19[ruby/psych] Use `compare_by_identity` instead of `object_id`Alexander Momchilov
Object IDs became more expensive in Ruby 2.7. Using `Hash#compare_by_identity` let's us get the same effect, without needing to force all these objects to have object_ids assigned to them. https://github.com/ruby/psych/commit/df69e4a12e
2023-11-27[ruby/psych] Prefer each_char in Psych::Visitors::Visitor::ToRuby#deserializeMau Magnaguagno
Use safe navigation operator with each_char to remove empty strings and improve readability. https://github.com/ruby/psych/commit/5fe714b216