boost: don't use deprecated python object

Fixes #26706.