PierreQuentel / PyDbLite

A fast, pure Python in-memory database engine
BSD 3-Clause "New" or "Revised" License
104 stars 14 forks source link

Class: Base, extensibility bug. __call__() has self reference to public function #3

Closed demogorgonzola closed 6 years ago

demogorgonzola commented 6 years ago

Currently, there is a bug when extending Base.

Bug:
return [self[_id] for _id in res]

This makes it so that any attempt to rewriting getitem() to express another primary key fails. I noticed you guys were really good about not coupling a lot of your public functions already and I already made a fix from observing that you just used the getitem() internal function.

Fix:
return [self.records[_id] for _id in res]

P.S. Thanks for the library! It's been really helpful for liteweight projects!

PierreQuentel commented 6 years ago

Thanks for the report, I have fixed the bug as you suggested.

It's been a long time since I last worked on PyDbLite so I also fixed a few bugs and made some cleanings in the code.

bendikro commented 6 years ago

@ritualsfinal I tried to reproduce the issue to create a test for this. Can you give a short example on how to reproduce (for the old version with the bug)?