DONOSTIA-SAN SEBASTIÁN, Spain — In Luis Buñuel’s “The Exterminating Angel,” one of the canonical European classics that is directly referenced in Woody Allen’s “Rifkin’s Festival,” guests at a bourgeois dinner in a lavish mansion find themselves unable to leave. Supplies dwindle. Tempers fray. Some odd stuff happens with a bear. It’s an exaggeration to suggest that, except for the bear part, the situation might be at all similar to that of the jobbing film critic, or the completist filmgoer, when it comes to Allen’s late-period movies. But then again, it is true that no matter how much, and for what precise reasons, one may long to leave this party — one that started winding down quite some time ago — a new Allen movie shows up year after year (almost without fail, 2018 being an anomaly).

So it’s a relief to report that “Rifkin’s Festival” is, to the ravenous captive, like finding an unexpected stash of dessert: not substantial and not nutritious, but sweet enough to remind you in passing of the good times you once had, despite all that’s happened in the interim.

Even so, the ex-film professor and struggling novelist Mort Rifkin (Wallace Shawn, one of the more endearingly self-effacing of Allen avatars) is not enjoying himself. The surroundings are lovely — so lovely that the veteran cinematographer Vittorio Storaro’s decision to add even more amber oomph to the images is somewhat questionable when there’s so much readily available Spanish sunshine — but Mort is miserable. As he tells his therapist in voice-over, he only went to San Sebastián to keep an eye on his publicist wife, Sue (Gina Gershon, relishing a better role than she’s had in a while). Sue is taking a bit too much care of her client, a hotshot director played with sexy hateability by France’s most sexily hateable actor, Louis Garrel, and named Philippe, just like Louis’s own director father.

Sue and Philippe’s flirtation has two effects on hypochondriac Mort. First he imagines he’s having heart problems, so he visits a cardiologist, Dr. Jo Rojas (Elena Anaya). “I didn’t know you were a woman,” marvels Mort, apparently the sole person in existence who has never heard the old “The doctor is a woman!” riddle. He’s instantly infatuated, even more so when he discovers she too loves classic film, despises Philippe’s movie, is conversant with New York City and is experiencing marital woes. These are caused by her unfaithful painter husband, Paco, played by Sergi López in a fantastic, bottle-smashing, self-harm-threatening parody of the passionate, artistic Spaniard archetype that Allen so embraced in “Vicky Cristina Barcelona.”

Second, each night Mort dreams vividly literal reinterpretations of the classic films he loves, recast with himself, Sue, Philippe and Jo playing the pivotal roles. And while it’s a little strange that Mort’s ostensibly obscure and snobby tastes should be represented basically by the top 10 tracks on Now That’s What I Call the Greats of Cinema Vol. 1, and some of these black-and-white interludes are overworked — the “Citizen Kane” Rosebud gag is particularly forced — a few are pretentiousness-puncturing fun. In moments like the “Breathless” “Why are we under this sheet?” sequence, or the “Persona” riff in which Sue and Jo lapse into Swedish to complain about Mort’s love of subtitles, there are glimmers of the more anarchic cinephilia of early Allen.

Sometimes he even lands an honest-to-God zinger that wouldn’t feel out of place in one of his own classics. In a dream, a rabbi berates Mort for not being observant enough. What would he say to God if he met him? “God? After all he’s done, he should talk to my lawyer,” replies Mort. “Who but a Jew would think of suing God?” sighs the rabbi sadly. “Who but a Jew would have such a slam-dunk case?” retorts Mort as he wakes up.

But as much as Mort gets to be witty or catty on occasion — on hearing Philippe has won an award in Cologne, he mutters, “Isn’t that where Eichmann was from?” — perhaps the most salutary and surprising aspect of “Rifkin’s Festival” is that he is also made properly ridiculous, and not just in the wistfully tragic register in which Allen’s unlucky-in-love stand-ins often operate. Whatever Mort may think, at no point does Jo, 30 years his junior, regard him even remotely as a viable romantic option. Instead, she’s just a very nice woman trying to be friendly and professional toward a boring old guy in granddad jeans who keeps wittering on about Shakespeare in the Park while her actual life is falling apart.

“Life is meaningless, not empty,” chides Death, when Mort finally meets him in the inevitable “Seventh Seal” pastiche. “Don’t confuse the two.” And as thin on real meaning as it is, “Rifkin’s Festival,” viewed charitably, is actually quite full — of a rueful acknowledgment of the lateness of the hour, and the silliness of an old man applying old-man values to a world that’s getting younger around him by the day.

Dawning awareness of one’s own irrelevance is not quite the same thing as relevance, but it’s a small breakthrough. And it’s infinitely preferable to 2019’s “A Rainy Day in New York,” in which obsessions and behaviors of a musty vintage were forcibly decanted into an anachronistic Gen Z cast. “Rifkin’s Festival” is far less objectionable, and though that is praise so faint it needs smelling salts, with latter-day Woody Allen, we must be thankful for small mercies, and this bauble is, at least, a mercy of the smallest kind.