Wrapt

Latest version: v1.17.2

Safety actively analyzes 706267 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 8

1.7.0

-------------

**New Features**

* Provide wrapt.getcallargs() for determining how arguments mapped to a
wrapped function. For Python 2.7 this is actually inspect.getcallargs()
with a local copy being used in the case of Python 2.6.

* Added wrapt.wrap_object_attribute() as a way of wrapping or otherwise
modifying the result of trying to access the attribute of an object
instance. It works by adding a data descriptor with the same name as
the attribute, to the class type, allowing reading of the attribute
to be intercepted. It does not affect updates to or deletion of the
attribute.

**Bugs Fixed**

* Need to explicitly proxy special methods __bytes__(), __reversed__()
and __round__() as they are only looked up on the class type and not
the instance, so can't rely on __getattr__() fallback.

* Raise more appropriate TypeError, with corresponding message, rather
than IndexError, when a decorated instance or class method is called via
the class but the required 1st argument of the instance or class is not
supplied.

1.6.0

-------------

**Bugs Fixed**

* The ObjectProxy class would return that the __call__() method existed
even though the wrapped object didn't have one. Similarly, callable()
would always return True even if the wrapped object was not callable.

This resulted due to the existence of the __call__() method on the
wrapper, required to support the possibility that the wrapped object
may be called via the proxy object even if it may not turn out that
the wrapped object was callable.

Because checking for the existence of a __call__() method or using
callable() can sometimes be used to indirectly infer the type of an
object, this could cause issues. To ensure that this now doesn't
occur, the ability to call a wrapped object via the proxy object has
been removed from ObjectProxy. Instead, a new class CallableObjectProxy
is now provided, with it being necessary to make a conscious choice as
to which should be used based on whether the object to be wrapped is
in fact callable.

Note that neither before this change, or with the introduction of the
class CallableObjectProxy, does the object proxy perform binding. If
binding behaviour is required it still needs to be implemented
explicitly to match the specific requirements of the use case.
Alternatively, the FunctionWrapper class should be used which does
implement binding, but also enforces a wrapper mechanism for
manipulating what happens at the time of the call.

1.5.1

-------------

**Bugs Fixed**

* Instance method locking for the synchronized decorator was not correctly
locking on the instance but the class, if a synchronized class method
had been called prior to the synchronized instance method.

1.5.0

-------------

**New Features**

* Enhanced wrapt.transient_function_wrapper so it can be applied to
instance methods and class methods with the self/cls argument being
supplied correctly. This allows instance and class methods to be used for
this type of decorator, with the instance or class type being able to
be used to hold any state required for the decorator.

**Bugs Fixed**

* If the wrong details for a function to be patched was given to the
decorator wrapt.transient_function_wrapper, the exception indicating
this was being incorrectly swallowed up and mutating to a different
more obscure error about local variable being access before being set.

1.4.2

-------------

**Bugs Fixed**

* A process could crash if the C extension module was used and when using
the ObjectProxy class a reference count cycle was created that required
the Python garbage collector to kick in to break the cycle. This was
occurring as the C extension had not implemented GC support in the
ObjectProxy class correctly.

1.4.1

-------------

**Bugs Fixed**

* Overriding __wrapped__ attribute directly on any wrapper more than once
could cause corruption of memory due to incorrect reference count
decrement.

Page 6 of 8

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.