ruby / ruby/psych

Hash default values are not serialized

Open
#407 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
597
Forks
223
Avg merge
11h 23m
Merged PRs (30d)
3

Description

> YAML.unsafe_load(YAML.dump(Hash.new(false))).default
=> nil

This is particularly troublesome since the built in Set class uses a Hash internally with a default of false. Ideally if a Hash has a default, it should serialize specially like #43 does for subclasses of Hash with ivars.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the YAML.unsafe_load(YAML.dump(Hash.new(false))).default example and inspect the Hash serialization path in Psych. Compare it with the behavior described for Hash subclasses with instance variables in issue #43; done means a Hash default survives dump and load, including the built-in Set case.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, yaml
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.