Skip to content

Add populate_target flag to Store.proxy() and other proxy methods #499

@gpauloski

Description

@gpauloski

Describe the Request

When a proxy is going to be immediately used on the local process that created the proxy, the default behavior is that the proxy is going to be resolved. This is pretty inefficient if we already have the target object on the local process. Let's expose a populate_target flag in Store.proxy() that will set __wrapped__ on the returned proxy to the input object that was proxied.

The populate_target flag will default to False to (1) maintain the existing functionality by default and (2) because setting __wrapped__ will cause the proxy to hold a reference to the target which could cause extra memory usage (probably pretty unlikely, but still...).

This will not effect pickling a Proxy because Proxy only pickles its factory.

Sample Code

No response

Metadata

Metadata

Assignees

Labels

enhancementNew features or improvements to existing functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions