Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.fielded gets maximum recursion error in Python3 #19

Open
versae opened this issue Dec 16, 2013 · 2 comments
Open

.fielded gets maximum recursion error in Python3 #19

versae opened this issue Dec 16, 2013 · 2 comments

Comments

@versae
Copy link
Contributor

versae commented Dec 16, 2013

I am trying this code:

>>> from lucenequerybuilder import Q
>>> Q("do*", wildcard=True).fielded

And then I get:

RuntimeError: maximum recursion depth exceeded

Same code works as expected in Python 2.7:

>>> from lucenequerybuilder import Q
>>> Q("do*", wildcard=True).fielded
False
@mhluongo
Copy link
Member

Thanks for the catch @versae - any interest in fixing it? :)

@versae
Copy link
Contributor Author

versae commented Dec 30, 2013

I think that the problem comes from this line:

    # [...]
    @staticmethod
    def _has_field(val):
        if hasattr(val, '__iter__'):  # <- HERE! In Python 3 't' always has '__iter__', I think
            return any(Q._has_field(t) for t in val)
        else:
            return hasattr(val, 'field') and val.field is not None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants