Deprecate instantiation of subclass specs in Any and missing --print_%s deprecation warning - #955
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #955 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 8444 8464 +20
=========================================
+ Hits 8444 8464 +20 ☔ View full report in Codecov by Harness. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What does this PR do?
Two deprecations for v5.0.0:
Instantiation of subclass specs in
AnyWhen a value for a type that accepts anything (
AnyorUnvalidated<...>) is a validsubclass spec,
instantiate_classescurrently builds the class. This is deprecated: fromv5.0.0 the subclass spec will be kept as is, leaving it to the code that receives it to
decide whether to instantiate. Instantiating is a security risk, since it means a config
can instantiate any class.
A new
instantiate_subclass_spec_in_anysetting inset_parsing_settingsallows optinginto the future behavior now (
False, silencing the warning) or keeping the current one(
True, discouraged). The setting defaults toNone, which behaves asTrueand emitsthe deprecation warning; in v5.0.0 the default becomes
Falseand the deprecated path isremoved.
--print_configto--print_%sThe name change announced in v4.35.0 never emitted a warning. One is now raised (under
JSONARGPARSE_DEPRECATION_WARNINGS=all) when the config argument is not namedconfig,so the print config argument name will change in v5.0.0.
Before submitting