backport modules fixes from master

Status Job ID Name Coverage
  Build
canceled #18481
build:2.7

canceled #18482
build:3

 
  Test
canceled #18484
allowed to fail
lint:2.7

canceled #18488
allowed to fail
lint:3

canceled #18483
pyflakes:2.7

canceled #18487
pyflakes:3

canceled #18485
unittests:2.7

canceled #18489
unittests:3

canceled #18486
allowed to fail
unittests-modules:2.7

canceled #18490
allowed to fail
unittests-modules:3

 
  Deploy
canceled #18491
doc:2.7

canceled #18492
doc:3