pg.detouring.undetoured_new¶
Accessible via pg.detouring.undetoured_new
.
- undetoured_new(cls, *args, **kwargs)[source]¶
Create a new instance of cls without detouring.
If cls.__init__ creates sub-objects, creation of sub-objects maybe detoured based on current context. For example:
class A: def __init__(self, x): if x < 0: self.child = A(x) else: self.x = x with pg.detour([A, B]): a = A(-1) assert isinstance(a, A) assert isinstance(a.child, B)
- Return type:
- Parameters:
cls – The class whose instance will be created.
*args – Positional arguments to be passed to class __init__ method.
**kwargs – Keyword arguments to be passed to class __init__ method.
- Returns:
A instance of cls.