rogerbinns / apsw

Another Python SQLite wrapper
https://rogerbinns.github.io/apsw/
Other
715 stars 96 forks source link

Prevent calling constructors multiple times #488

Closed rogerbinns closed 9 months ago

rogerbinns commented 9 months ago

For example this is possible:

class RandomVFSUpper(apsw.VFS):
    def __init__(self):
        apsw.VFS.__init__(self, "randomupper")
        apsw.VFS.__init__(self, "foo", "randomupper", True)

Detect and exception if that happens. This was discovered when doing test case minimization.

While it could be made to work, the implementation would have to do the equivalent of ruining the destructor, and reinitializing everything. That would be error prone and pointless work.