| Age | Commit message (Collapse) | Author |
|
https://github.com/ruby/psych/commit/8345af9ffb
|
|
https://github.com/ruby/psych/commit/6a826693ba
|
|
https://github.com/ruby/psych/commit/506bf75ab2
|
|
https://github.com/ruby/psych/commit/d8053b0d16
|
|
https://github.com/ruby/psych/commit/907fd4fa97
|
|
https://github.com/ruby/psych/commit/4e9d08c285
|
|
Fixes: ruby#685
This feature can easily break how you use other gems like factory_bot or prawn.
https://github.com/ruby/psych/pull/747#issuecomment-3413139525
> But I kind of think we should leave `psych/y` around. If people really want to use it they could require the file.
If you miss the function in Kernel, you can require it interactively or add it to `.irbrc`:
```ruby
require 'psych/y'
```
https://github.com/ruby/psych/commit/f1610b3f05
|
|
values and not a Hash
* rb_struct_initialize() does not accept a Hash, and it's very brittle
to pass `[{...}]` and to rely on that C function using rb_keyword_given_p().
It basically worked accidentally, by having **members in the caller of the caller.
Such logic when Struct#initialize is defined in Ruby (as in TruffleRuby) is basically impossible to implement,
because it's incorrectly treating positional arguments as keyword arguments.
* rb_struct_initialize() is used in CRuby to set members of Data instances in marshal.c (there is no rb_data_initialize() yet).
There, the code passes an Array of members values for Data (and for Struct which are not `keyword_init: true`):
https://github.com/ruby/ruby/blob/48c7f349f68846e10d60ae77ad299a38ee014479/marshal.c#L2150-L2176
So we should do the same in psych.
* Rename to init_data since it's only used for Data.
* See https://github.com/ruby/psych/pull/692#discussion_r2483947279.
https://github.com/ruby/psych/commit/3550148378
|
|
This commit updates the Ruby version to follow the commit in Ruby master branch.
https://github.com/ruby/ruby/commit/6d81969b475262aba251e99b518181bdf7c5a523
https://github.com/ruby/psych/commit/971b7de078
|
|
https://github.com/ruby/psych/commit/b9dec9f811
|
|
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
|
|
https://github.com/ruby/psych/commit/dbf9e36583
|
|
https://github.com/ruby/psych/commit/336553b412
|
|
https://github.com/ruby/psych/commit/e954f96639
|
|
https://github.com/ruby/psych/commit/30a2a5ee94
|
|
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
|
|
https://github.com/ruby/psych/commit/3573fb356e
|
|
https://github.com/ruby/psych/commit/9df5501fdc
|
|
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.
|
|
https://github.com/ruby/psych/commit/788b844c83
|
|
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
|
|
https://github.com/ruby/psych/commit/bb63f91825
|
|
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
|
|
Fix https://github.com/ruby/psych/pull/644
https://github.com/ruby/psych/commit/b1ade765ba
|
|
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
|
|
https://github.com/ruby/psych/commit/2af9f6ac02
|
|
Fixes ruby/psych#689
https://github.com/ruby/psych/commit/ac887cdc76
|
|
https://github.com/ruby/psych/commit/746e1ad24d
|
|
https://docs.ruby-lang.org/en/master/Psych.html#module-Psych-label-Exception+handling
https://github.com/ruby/psych/commit/c53c298222
|
|
https://github.com/ruby/psych/commit/7c81f7db53
|
|
https://github.com/ruby/psych/commit/b2aa0032c0
|
|
https://github.com/ruby/psych/commit/6ea07fdadd
|
|
https://github.com/ruby/psych/commit/6609955e68
|
|
https://github.com/ruby/psych/commit/b89064efa5
|
|
https://github.com/ruby/psych/commit/48e5af8454
|
|
https://github.com/ruby/psych/commit/288febbc87
|
|
https://github.com/ruby/psych/commit/d9e18aaab7
|
|
https://github.com/ruby/psych/commit/a0c353ec97
|
|
Save on allocating useless `MatchData` instances.
https://github.com/ruby/psych/commit/b2d9f16e58
|
|
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
|
|
https://github.com/ruby/psych/commit/a8b73bb80e
|
|
https://github.com/ruby/psych/commit/3b63a93dfc
|
|
https://github.com/ruby/psych/commit/9f5392d180
|
|
https://github.com/ruby/psych/commit/ce7946981d
|
|
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
```
|
|
for dumping
https://github.com/ruby/psych/commit/3d051d89aa
|
|
https://github.com/ruby/psych/commit/93c8fb443a
|
|
https://github.com/ruby/psych/commit/6905a2123c
|
|
https://github.com/ruby/psych/commit/b9e7b4a4a4
|
|
https://github.com/ruby/psych/commit/a9ab74d132
|