Backport of gh-33179

Comment From: snicoll

There are more harmonizations to backport from 6.x so we'll use this issue to do that.

Comment From: github-actions[bot]

Fixed via ee10640f424173c920ba851fbd2cd35b3391ec6d

Comment From: github-actions[bot]

Fixed via c8e9ad6289fd0d3551f34aaad0c814aef33c68c6