If a person dying after the effective date of this Code directs in his will the purchase of an annuity, the person or persons to whom the income thereof is directed to be paid shall not have the right to elect to take the capital sum directed to be used for such purchase in lieu of such annuity except to the extent the will expressly provides for such right, or except to the extent that the will expressly provides that an assignable annuity be purchased. But nothing herein contained shall affect or lessen the rights of election by a surviving spouse against, or in absence of, testamentary provision as provided under section 10 of this title.