As he descends a staircase in the opening scene of “Vicious,” a new comedy making its PBS debut on Sunday, Ian McKellen overhears his lover, played by Derek Jacobi, reacting to bad news he received on the telephone.

“For a moment, I thought those high-pitched, piercing shrieks were coming from a gaggle of schoolgirls,” says Mr. McKellen’s character, a veteran actor named Freddie. “But now I see it’s just you.”

“Who do you think you are?” Mr. Jacobi’s character, Stuart, retorts. “The Earl of Grantham?”

If it is surprising to see esteemed actors like Mr. McKellen and Mr. Jacobi trading barbs in a traditional, multicamera sitcom recorded in front of a studio audience, “Vicious” further astonished British audiences, when it ran on ITV last year, with its very premise. It cast Mr. McKellen (of the “X-Men” and “Hobbit” movies) and Mr. Jacobi (“I, Claudius”) as two fussy, feuding partners in a gay relationship of nearly 50 years.

“Vicious” was successful enough to earn a second season, but it was also criticized by British publications like The Stage, which said that its “gay characters are nothing more than camp stereotypes” and that the scenarios “bear no resemblance to the lives of the viewers at home,” while The Guardian wrote that the series “cheerfully trades in clichés of homosexuality.”