There are old wives tales, and there are facts. This is the most comprehensive list of bears vs handgun encounters that I'm aware of. According to this it just doesn't matter much. In fact they were not able to find many instances where a handgun didn't stop a bear, brown, black or grizzly.
Update: Handgun or Pistol Against Bear Attack: 93 cases, 97% Effective (ammoland.com)
Sadly, while mostly correct, this list is a sort of old wive's tail in and of itself. Weingarten takes some very creative license in what he determines to be successful incidents of using pistols successfully in defense against bears. Take incident # 2, for example...
Johnson picked up a stick, and pummeled the brute, and the bear dropped the woman and charged him. It was waylaid by the lunch, which it began to devour.
In the meantime, Fletcher got a .22 pistol from the plane, walked to within a few feet of the animal, and killed it.
Then to add some dramatic flare to bolster the significance of the role of the pistol in the situation, he adds...
I suspect it was not a casual stroll to the plane or a slow walk back to the bear.
In reality of this story, the stick saved the day. The attack was over once the bear was dining on a pic-a-nic basket. Johnson simply walked up and executed the bear while it was eating. That is not a use of a pistol stopping a bear attack.
In example #3, the victim had the shoot several times at the attacking bear noting that the bear only got madder and madder with the first shots. Yet, the bear was eventually stopped, so Weingarten considers this to be a success. HOWEVER, when he discusses the use of bear spray, he considers attacks where the bear pressed on the attack after being sprayed as a failure despite the bear eventually being driven off by bear spray.
https://www.ammoland.com/2017/09/bear-spray-failure-bow-hunter-mauled/ In other words, what he considers to be a successful use various depending on whether or not he likes the tool being used. Weingarten is not a fan of bear spray. Of very much interest here, he also notes it was the failure of not getting the pepper spray to work (instead of using a pistol to prevent the attack) that resulted in him getting injured. However, Weingarten discounts 2 cases at the end of the article as not being relevant because the people could not get their guns to fire at the bears.
I am not going through the entire list again. I think I have made given that 2 of the first 3 examples noted are dubious evaluations as are the exclusions at the end. Weingarten's 'facts' are fraught with interpretative opinion. Weingarten has an agenda that guns are good and bear spray is bad.
There is some good information in the article, no doubt, but you can't trust the numbers and it helps, in some cases, that you go back to the original sources.