It means a priest can’t absolve his own mistress of adultery. This canon’s application is very limited.
If a priest commits a sexual sin with someone, he cannot then absolve the same person from the sin. That is the basic meaning of canon 977. This prohibition applies to all priests. If the priest attempts to absolve the person, then the absolution is invalid. The only exception is danger of death.
For example, a priest has gone on a trip with a woman and they get sexually involved in the sin of fornication. She regrets doing this and attempts to go to confession to him. If he imparts absolution, it would be invalid. He would also incur an excommunication imposed by the law that can only be remitted by the Apostolic See (the Vatican).
However, if on the flight back, the plane is about to crash and she then is sorry and seeks absolution, then the absolution would be valid due to danger of death and the priest would not incur the excommunication.
The woman who the priest has sinned with sexually can go to another priest for valid absolution at any time. And hopefully the priest would go too.