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

Segmentation fault when iterating over AC trie #13

Closed
stephankoe opened this issue Jul 7, 2022 · 3 comments
Closed

Segmentation fault when iterating over AC trie #13

stephankoe opened this issue Jul 7, 2022 · 3 comments

Comments

@stephankoe
Copy link

Issue

When iterating over an AC trie, a segmentation fault occurs. For example:

import cyac
trie = cyac.AC.build(['hello', 'world'])
for w in trie:
    print(w)

Output:

hello
world










Segmentation fault

However, AC.items() is works as expected.

Environment

  • Ubuntu 18.04
  • Python 3.6.9
  • Cython 0.29.21
  • cyac 1.4
@chenkovsky
Copy link
Collaborator

it seems that it's cython's bug. AC has not implemented iter method.
In my python environment, your code complains:

lib/cyac/ac.pyx in cyac.ac.AC.__getitem__()

lib/cyac/trie.pyx in cyac.trie.Trie.__getitem__()

AttributeError: 'NoneType' object has no attribute 'decode'

@chenkovsky
Copy link
Collaborator

@stephankoe please try this branch. #14

@stephankoe
Copy link
Author

Yes, that branch is working. Thanks!

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