Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monkey pluggability enhancements and bugs #1447

Open
arcivanov opened this issue Aug 14, 2019 · 0 comments · May be fixed by #1449
Open

Monkey pluggability enhancements and bugs #1447

arcivanov opened this issue Aug 14, 2019 · 0 comments · May be fixed by #1449
Labels
Status: in progress Type: Enhancement We can do better through adding this

Comments

@arcivanov
Copy link
Contributor

arcivanov commented Aug 14, 2019

  1. _check_repatching intentionally deletes kwargs that contain patch_all settings from external plugins, resulting in loss of state: https://github.com/gevent/gevent/blob/master/src/gevent/monkey.py#L957

  2. Similarly, would be nice need to expose that patch_all state to external plugin through public API.

  3. _patch_module has two problems (https://github.com/gevent/gevent/blob/master/src/gevent/monkey.py#L362):
    a. gevent. is hardcoded.
    b. the construct is only capable of handling one level, i.e. gevent.a. If used with gevent.a.b, the expression fails to evaluate properly.

  4. In cases where an item of a module is being reduced it may be necessary to substitute the __module__ of a newitem during patching to make sure that the pickle encodes the proper module name into its stream, i.e. the name of the module being patched, not the name of the module hosting a patch.

Patch is incoming.

arcivanov added a commit to arcivanov/gevent that referenced this issue Aug 15, 2019
1. `_check_repatching` now merges kwargs into state
2. `_get_patch_all_state` allows to retrieve the patch_all configuration state
3.a `_patch_module` now allows to specific `_package_prefix` parameter that defaults to 'gevent.'
3.b `import_module` is now used in `_patch_module` to allow handling of package names of any depth.
4. `patch_item` and both `patch_modules` now accept argument `_patch_module` for item's `__module__` override.

fixes gevent#1447
arcivanov added a commit to arcivanov/gevent that referenced this issue Aug 15, 2019
1. `_check_repatching` now merges kwargs into state
2. `_get_patch_all_state` allows to retrieve the patch_all configuration state
3.a `_patch_module` now allows to specific `_package_prefix` parameter that defaults to 'gevent.'
3.b `import_module` is now used in `_patch_module` to allow handling of package names of any depth.
4. `patch_item` and both `patch_modules` now accept argument `_patch_module` for item's `__module__` override.

fixes gevent#1447
@jamadden jamadden added Type: Enhancement We can do better through adding this Status: in progress labels Sep 13, 2019
@jamadden jamadden added this to the 1.5.0 milestone Sep 13, 2019
@jamadden jamadden removed this from the 1.5.0 milestone Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: in progress Type: Enhancement We can do better through adding this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants