in the hands of the person acquiring such property is not determined— (I) in whole or in part by reference to the adjusted basis of such property in the hands of the person from whom acquired, or (II) under section 1014(a) (relating to property acquired from a decedent). (B) Construction A residence which is constructed by the taxpayer shall be treated as purchased by the taxpayer on the date the taxpayer first occupies such residence. (5) Purchase price The term purchase price means the adjusted basis of the principal residence on the date such residence is purchased. (6) Related persons A person shall be treated as related to another person if the relationship between such persons would result in the disallowance of losses under section 267 or 707(b) (but, in applying section 267(b) and (c) for purposes of this section, paragraph (4) of section 267(c) shall be treated as providing that the family of an individual shall include only his spouse, ancestors, and lineal descendants). (7) Exception for long-time residents of same principal residence In the case of an individual (and, if married, such individual's spouse) who has owned and used the same residence as such individual’s principal residence for any 5-consecutive-year period during the 8-year period ending on the date of the purchase of a subsequent principal residence, such individual shall be treated as a first-time homebuyer for purposes of this section with respect to the purchase of such subsequent residence. (d) Exceptions No credit under subsection (a) shall be allowed to any taxpayer for any taxable year with respect to the purchase of a residence if— (1) the taxpayer is a nonresident alien, (2) the taxpayer disposes of such residence (or such residence ceases to be the principal residence of the taxpayer (and, if married, the taxpayer's spouse)) before the close of such taxable year, (3) a deduction under section 151 with respect to such taxpayer is allowable to another taxpayer for such taxable year, or (4) the taxpayer fails to attach to the