pytest-dev / pytest-dev/pytest

Faulthandler traceback not shown even though Python runs in dev mode

Open
#10,307 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: help wanted
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

AFAIU, faulthandler is enabled by default by pytest. In our (PyArrow) CI tests, we also enable CPython dev mode through the environment variable PYTHONDEVMODE: https://github.com/pitrou/arrow/actions/runs/3080710517/jobs/4978383781#step:6:5654

However, it seems that in some cases this doesn't suffice to print a traceback on crash:
https://github.com/pitrou/arrow/actions/runs/3080710517/jobs/4978383781#step:6:5716

Of course, it might be the case that it happens late at interpreter shutdown at a point where faulthandler cannot do anything anymore.

(as you can see, this is when running doctests; not sure this is relevant...)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked PyArrow CI job and reproduce the doctest run with PYTHONDEVMODE enabled. Compare the crash timing with interpreter shutdown and pytest's faulthandler behavior; done means identifying why no traceback is emitted and defining a reproducible regression case or documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.