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

Infinite Loop when the input is {" #8

Closed
brianineza01 opened this issue Nov 22, 2023 · 1 comment
Closed

Infinite Loop when the input is {" #8

brianineza01 opened this issue Nov 22, 2023 · 1 comment
Assignees

Comments

@brianineza01
Copy link

Describe the bug
I was trying the json response streaming from openai api and fix it using this library. When the json input was {" it got my program stuck for some reason. After deep investigation, I found it was an infinite loop in this library. Attached below are some screenshots with what's happening and the function that it's happening in. I added some print() in the library code to check what's happening.

To Reproduce
Steps to reproduce the behavior:

  1. Import the library
  2. make your JSON string {"
  3. use the repair_json function from the library
  4. You will have a stuck program with an infinite loop.

Expected behavior
Should throw an error or have an empty object like {}.

Screenshots
CleanShot 2023-11-22 at 07 01 50@2x
CleanShot 2023-11-22 at 07 00 37@2x

Desktop (please complete the following information):

  • OS: MacOS Sonoma
  • Version 0.4.1
@mangiucugna
Copy link
Owner

Thanks for reporting the bug, I have released 0.4.2 with the fix

mangiucugna added a commit that referenced this issue Dec 5, 2023
- Relates to the fix done for #8.
- Tests updated.
- Release 0.4.4
@mangiucugna mangiucugna self-assigned this Apr 25, 2024
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