SIGSEV in `datetime.timedelta` (possibly from datetime's C `delta_new`)
Open
Nobody has claimed this yet.
extension-modules
type-crash
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
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
- gh-132599
- gh-132665
- gh-133111
- gh-136152
- gh-136321
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal reproducer in the issue and read the linked PRs gh-132599, gh-132665, gh-133111, gh-136152, and gh-136321. Then inspect the datetime C delta_new path named in the report. Done means the Python 3.13 reproducer no longer causes a SIGSEV on Linux.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100