[1.5.x] Fixed #21869 -- Fixed docs building with Sphinx 1.2.1.

Thanks tragiclifestories for the report.

Backport of e1d18b9d2e from master