Open
Description
Crash report
What happened?
I was testing some AI code with ollama and stumbled across a really weird crash.
The fact that it happens during an IndexError and a specific function has to be there leads me to believe that this is a CPython bug and not an ollama bug.
from ollama import chat
# Has to be here to segfault???
def colorSwitch(color):
print(color, end="", flush=True)
stream = chat(
model="llama3.2", # I think it works with any but this is what I used.
messages=[{"role": "user", "content": ""}],
options={"seed":0}, # Does not need this but I figured it would be helpful
stream=True,
)
# Any iteration works. I just simplified it down to this.
part = next(iter(stream))['message']['content']
temp = part.split("</think>", 1)
# Crash Here
temp[1]
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.13.2 (main, Feb 5 2025, 08:05:21) [GCC 14.2.1 20250128]
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
No status