Because you were married for some time in 2021, you may file a joint return for the year for you and your deceased spouse, provided you did not remarry before the end of 2021. If there is an executor or estate representative other than yourself, that representative must agree to the joint return.
When debts are cancelled in bankruptcy cases, the cancelled amount is excluded from gross income. Tax attributes are certain losses, credits, and property basis that must be reduced to the extent of the exclusion.