wrapt
wrapt copied to clipboard
A Python module for decorators, wrappers and monkey patching.
The following raises `TypeError: expected an object with a writable buffer interface`: ``` ctypes.c_char.from_buffer(wrapt.ObjectProxy(bytearray(b'12345'))) ``` This is a corner case I've encountered in my own proxy implementation which also doesn't...
When checking for '_self_' prefix, currently invoking starts with() method of the string object. It would be more efficient where the name is a string object to use PyString_AsString() to...
1. Add a missing lock to ImportHookFinder.find_spec(). It should have the same lock as find_module() since it accesses _post_import_hooks. 2. Fix a deadlock between notify_module_loaded() and ImportHookFinder. This occurs because...
Hello! I've come up against this while working on an asyncio job library. Maybe it's best if I paste a code example. ```python from wrapt import decorator @decorator async def...
Hi there, I tested with python 3.12 & python 3.12.1 (x64) on windows 10 22H2. When I debug with pycharm 2023.3 and wrapt-1.16.0, I get this error: ` File "C:\Users\endmarsfr\AppData\Local\Programs\Python\Lib\site-packages\wrapt\decorators.py",...
For the developers of packages that make use of wrapt, it would be helpful for user-facing objects to have type hint annotations. As an example use case, I'm adding static...
Simple reproduction: ``` import wrapt @wrapt.decorator def passthrough(wrapped, instance, args, kwargs): return wrapped(*args, **kwargs) @passthrough def foo(): print('foo') class A: _foo = foo print(type(A._foo)) A._foo() ``` This returns: ``` ---------------------------------------------------------------------------...
Current my implementation works like this: ```python DATA_DB = weakref.WeakKeyDictionary() def set_data_db(wrapper_instance, data): DATA_DB[id(wrapper_instance)] = data def get_data_db(wrapper_instance): return DATA_DB.get(id(wrapper_instance), None) class Wrapper(wrapt.ObjectProxy): def __init__(self, wrapped, extra_data=None): super().__init__(wrapped) # Set...
After `p = ObjectProxy(obj)` has been constructed, is there any way to retrieve `p.__dict__` of the `ProxyObject` and not the `__wrapped__`? I have found that I can set attributes to...
Is it possible next time on release new version make the github release to have entry on https://github.com/GrahamDumpleton/wrapt/releases? 🤔 I'm asking because only on make gh release is spread notification...