No, gravity does not directly affect the speed of light. According to Einstein's theory of general relativity, the speed of light in a vacuum, denoted by "c," is considered a fundamental constant of nature. It is believed to be constant regardless of the presence or absence of gravity.
However, gravity can indirectly influence the path of light and its behavior through the bending of spacetime. According to general relativity, massive objects such as stars, planets, or black holes can curve the fabric of spacetime around them. When light passes through this curved spacetime, its path appears to bend or deviate from what it would be in flat spacetime.
This bending of light due to gravity is known as gravitational lensing. It was first observed and confirmed during a solar eclipse in 1919, when the light from distant stars passing near the Sun was observed to be deflected by its gravitational field.
Although gravity affects the path of light, it does not alter its speed. Regardless of the gravitational field it passes through, light continues to propagate at the constant speed of approximately 299,792,458 meters per second (or about 186,282 miles per second) in a vacuum. This constancy of the speed of light is a fundamental principle in physics and is one of the key postulates of Einstein's theory of relativity.