[3.10] Add more const modifiers. (GH-26691). (GH-26692)

(cherry picked from commit be8b631b7a587aa781245e14c8cca32970e1be5b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
7 files changed