Add the ability to override dynamic class tracking id generation. #583
+597
−333
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.
This adds a new CloudPickleConfig argument that is meant to override the default behaviors for users with specific needs like deterministic hash (at the cost of performance regression).
The default config maintains behavior prior to this PR.
The first CloudPickleConfig option is to pass an id_generator that is used to create ID's for dynamic classes and typevars (to maintain isinstance semantics).
If the id_generator is omitted then new types will always be defined and isinstance semantics is lost.
Also included is a hash_dynamic_classdef function that can be passed via CloudPickleConfig.id_generator that pickles the classdef as mentioned in #568 (comment)
The unit test setup is refactored a bit to allow passing configs between processes.
This PR is related to #510 and #453