Week #10: Finishing up the PR

Published: 08/15/2021

What did you do this week?

Last week I got stuck at some failures on Linux Python3.7-dbg (debug builds). I was able to replicate it locally and thankfully also found a fix for it. Turns out, I was accessing a Python attribute while a live exception was set in Python. This is not allowed because the Python objects of the class might have been destroyed or garbage collected and my attribute lookup might fail with a segmentation fault. This was caught by the debug build of Python 3.7 and was fairly simple to fix: just removed the offending line and the tests passed again! To ensure this doesn't happen again, I refactored some code to make more careful use of PyErr_Occurred().

There was also some discussion around what to name the seed parameter: the new Generator API favors something other than random_state which has been well-established in SciPy. As there was no consensus among what to name it - some favored consistency while others wanted to differ between the new and the old API - we decided to go with the plain old random_state and change its name in some other PR at all places in SciPy.

What is coming up next?

Almost all the reviews have now been addressed, the CI is green, and I am happy with the current state of the PR. It seems like a good starting point and if things stay this way, we might merge by the end of this week. Once that's done, adding new methods is fairly straightforward. I will try to add as many methods as possible before the end of GSoC.

Did you get stuck anywhere?

No blockers this week.