James Gandolfini, in one of his final roles before his death in June, is so sweetly funny in this rueful comedy that you wish he had been given more chances to tap his talent for the lighter side. As Albert, a divorced dad about to send his only daughter off to college, Gandolfini connects strongly with Julia Louis-Dreyfus as Eva, a masseuse who’s also divorced and also shipping off a daughter to higher education. It’s a strange affair. She worries that he’s a bit of a slob. He worries that his weight might be too much on her when they have sex. Of course, they’re made for each other. The catch comes when Eva finds her new BFF in Marianne (Catherine Keener), a poet with the kind of exquisite taste that Eva aspires to. Of course, Marianne turns out to be Albert’s ex-wife.

It sounds like rom-com hell. And it would be if Gandolfini and Louis-Dreyfus weren’t such an appealing pair of misfits. It’s a pleasure just to watch them spar. An equal pleasure is the writing and directing of Nicole Holofcener, whose four previous films (Walking and Talking, Lovely and Amazing, Friends With Money and Please Give) are models of how a gifted talent can make magic out of small moments. And Gandolfini and Louis-Dreyfus really are lovely and amazing.