omry / omegaconf

Flexible Python configuration system. The last one you will ever need.
BSD 3-Clause "New" or "Revised" License
1.95k stars 107 forks source link

fix: `get_attr_data` doesn't handle default factory correctly #1134

Open bzczb opened 11 months ago

bzczb commented 11 months ago

Motivation

get_attr_data() didn't check default values for "factory" types, which need to be called in order to get the real default value, so several use cases that worked with dataclasses were broken for attrs classes.

Test Plan

New fixture parameter added for "factory" variant of the tests/structured_conf/data/ attrs classes, similar to the post-Python 3.11 dataclass tests. New test added for error on takes_self parameter to factory (does not exist in dataclasses).

Fixes

Fixes #945 get_attr_data doesn't handle default factory correctly

michaelvay commented 8 months ago

Hi, Is there an expected release date for this PR?

odelalleau commented 8 months ago

Hi, Is there an expected release date for this PR?

No, there's no ETA yet for the next Hydra release.

omry commented 2 months ago

@Jasha10, good to merge?