1030. All who die in God’s grace and friendship, but still imperfectly purified, are indeed assured of their eternal salvation; but after death they undergo purification, so as to achieve the holiness necessary to enter the joy of heaven.
1031. The Church gives the name Purgatory to this final purification of the elect, which is entirely different from the punishment of the damned. The Church formulated her doctrine of faith on Purgatory especially at the Councils of Florence and Trent. The tradition of the Church, by reference to certain texts of Scripture, speaks of a cleansing fire: (1Cor 3:15, 1Pt 1:17)
…
The punishments of sin
1472. To understand this doctrine and practice of the Church (about Indulgences), it is necessary to understand that sin has a double consequence. Grave sin deprives us of communion with God and therefore makes us incapable of eternal life, the privation of which is called the “eternal punishment” of sin. On the other hand every sin, even venial, entails an unhealthy attachment to creatures, which must be purified either here on earth, or after death in the state called Purgatory. This purification frees one from what is called the “temporal punishment” of sin. These two punishments must not be conceived of as a kind of vengeance inflicted by God from without, but as following from the very nature of sin. A conversion which proceeds from a fervent charity can attain the complete purification of the sinner in such a way that no punishment would remain.
1473. The forgiveness of sin and restoration of communion with God entail the remission of the eternal punishment of sin, but temporal punishment of sin remains. While patiently bearing sufferings and trials of all kinds and, when the day comes, serenely facing death, the Christian must strive to accept this temporal punishment of sin as a grace. He should strive by works of mercy and charity, as well as by prayer and the various practices of penance, to put off completely the “old man” and to put on the “new man.”