Skip to content

Commit 0619982

Browse files
committed
DOC: add section on bisect GH35685
1 parent cfeed03 commit 0619982

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

doc/source/development/maintaining.rst

+40
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,46 @@ Here's a typical workflow for triaging a newly opened issue.
121121
unless it's know that this issue should be addressed in a specific release (say
122122
because it's a large regression).
123123

124+
.. _maintaining.regressions:
125+
126+
Investigating regressions
127+
-------------------------
128+
129+
Regressions are bugs that unintentionally break previously working pandas code.
130+
The common way to investigate regressions is by using `git bisect <https://git-scm.com/docs/git-bisect>`_,
131+
which finds the first commit after the bug appears.
132+
133+
For example: a user reports that ``pd.Series([1, 1]).sum()`` returns ``3``
134+
in pandas version ``1.5.0`` while in version ``1.4.0`` it returned ``2``. To begin,
135+
create a file ``t.py`` in your pandas directory, which contains
136+
137+
.. code-block:: python
138+
139+
import pandas as pd
140+
assert pd.Series([1, 1]).sum() == 2
141+
142+
and then run::
143+
144+
git bisect start
145+
git bisect good v1.4.0
146+
git bisect bad v1.5.0
147+
git bisect run bash -c "python setup.py build_ext -j 4; python t.py"
148+
149+
This finds the first commit that changed the behavior. To finish, exit bisect and
150+
rebuilt the latest C extensions with::
151+
152+
git bisect reset
153+
python setup.py build_ext -j 4
154+
155+
Lastly, report your findings under the corresponding issue and ping the commit author to
156+
get their input.
157+
158+
.. note::
159+
The ``run`` command above will treat commits where ``t.py`` exits with ``0`` as good and other
160+
exits as bad. When raising an error is the desired behavior, wrap the code in an appropriate
161+
``try/except`` statement. See `GH35650 <https://github.com/pandas-dev/pandas/issues/35685>`_ for
162+
more examples.
163+
124164
.. _maintaining.closing:
125165

126166
Closing issues

0 commit comments

Comments
 (0)