The code snippet in #25569 reproduces the memory leak with Python 3.6.0 and 2.7.13. The current memory leak is a regression that was introduced in #26470.
Going to attach a PR on github that fixes the issue shortly.