I'm making a singleton with an arbitrary number of keyword arguments. While debugging the class, the exception shown after execution don't match with how the debugging trace develops.
I'm using a implementation pretty similar to what I found in this web and also in this question.
I have tried to play around with / and *, because in the official documentation there is a reference to some special cases, but it didn't work.
class A:
    class B:
        def __init__(self, *, arg1, arg2, arg3, arg4='default'):
            self.arg1 = arg1
            self.arg2 = arg2
            self.arg3 = arg3
            self.arg4 = arg4
    _singleton_instance = None
    def __init__(self, **args):
        if not A._singleton_instance:
            _singleton_instance = A.B(**args)
    def __getattribute__(self, name):
        getattr(self._instance, name)
A(arg1=1, arg2=2, arg3=3)
A.arg1
The exception after the execution says:
AttributeError: type object 'A' has no attribute 'arg1'.
The exception that only appears while debugging says:
RecursionError('maximum recursion depth exceeded',)
 
    