Mid to Late Summer, it's NOT unusual to have 40C days here for a week to two weeks in length, often without rain. I too vent the hives as best as possible, but good hive management helps to keep the BEARDING to a minimal - but when it gets THAT HOT for THAT LONG it can be hard to keep the bees in the hive.
Bearding (small to large number of bees clinging to the landing-board and clustering outside the hive) is fairly normal into the evenings when temps are high - But bees aren't really good at hanging outside in direct strong sunlight and if you have bearding heavily in the daytime hours and around the clock, chances are you need to get an additional super on that hive to give them some elbow room - they are just too crowded and can't maintain around 35C temps in the hive.
My hives get strong sun to the front of the hive in the morning, shade by 11am and most of the afternoon - and filtered sun throughout the late afternoon.