msiemens / tinydb

TinyDB is a lightweight document oriented database optimized for your happiness :)
https://tinydb.readthedocs.org
MIT License
6.84k stars 549 forks source link

-1073741571 (0xC00000FD) something interesting occured. #534

Closed clooj closed 1 year ago

clooj commented 1 year ago

When I use the Query class in PyCharm and set a breakpoint in the __init__()function before the super().__init__(), the program exits abruptly with the error code -1073741571 (0xC00000FD) without any error message. So I write a print("Query")at the end of the __init__() . And I find that lots of "Query" were printed on the console.

After that ,I write a print("is_cacheable queryinstance") at the QueryInstance->is_cacheable() function. Obviously, lots of "is_cacheable queryinstance" were printed.

The test code is that

from tinydb.queries import Query,QueryInstance

from tinydb.database import TinyDB
from tinydb.queries import Query

db = TinyDB('./db.json')
db.insert({'name': 'John', 'age': 22})
# db.insert({'int': 1, 'char': 'b'})
User = Query()

print(db.search(User.name == 'John'))

And my python==3.8

clooj commented 1 year ago

It maybe a problem about pycharm's debugger. I write a class: `class Query(QueryInstance): def init(self) -> None: self._path: Tuple[Union[str, Callable], ...] = ()

    def notest(_):
        raise RuntimeError('----')

    super().__init__(
        test=notest,
        hashval=(None,)
    )
    print("Query")
    print(self._path)
def __getattr__(self, item:str):
    print("attr")
    query = type(self)()
    return query`

and this problem will appear at once while I debug. and I did not do debug, that will not occur. So I think it maybe the pycharm's debuger using __getattr__ to load the attribute.

msiemens commented 1 year ago

It maybe a problem about pycharm's debugger.

That would be my guess as well. Maybe it would be worth it to create a bug ticket for PyCharm (see https://www.jetbrains.com/help/pycharm/reporting-issues.html)?