Abstract : Results are presented of a search for compositeness in electrons and muons using a data sample of pp collisions at a center-of-mass energy sqrt(s) = 7 TeV collected with the CMS detector at the LHC and corresponding to an integrated luminosity of 5.0 inverse femtobarns. Excited leptons (lstar) are assumed to be produced via contact interactions in conjunction with a standard model lepton and to decay via lstar to l gamma, yielding a final state with two energetic leptons and a photon. The number of events observed in data is consistent with that expected from the standard model. The 95% confidence upper limits for the cross section for the production and decay of excited electrons (muons), with masses ranging from 0.6 to 2 TeV, are 1.48 to 1.24 fb (1.31 to 1.11 fb). Excited leptons with masses below 1.9 TeV are excluded for the case where the contact interaction scale equals the excited lepton mass. These are the best limits published to date.