From Pope Pius XII’s encyclical Mystici Corporis Christi (1943):
Nor must one imagine that the Body of the Church, just because it bears the name of Christ, is made up during the days of its earthly pilgrimage only of members conspicuous for their holiness, or that it consists only of those whom God has predestined to eternal happiness. It is owing to the Savior’s infinite mercy that place is allowed in His Mystical Body here below for those whom, of old, He did not exclude from the banquet.20 For not every sin, however grave it may be, is such as of its own nature to sever a man from the Body of the Church, as does schism or heresy or apostasy. Men may lose charity and divine grace through sin, thus becoming incapable of supernatural merit, and yet not be deprived of all life if they hold fast to faith and Christian hope, and if, illumined from above, they are spurred on by the interior promptings of the Holy Spirit to salutary fear and are moved to prayer and penance for their sins.
Let every one then abhor sin, which defiles the mystical members of our Redeemer; but if anyone unhappily falls and his obstinacy has not made him unworthy of communion with the faithful, let him be received with great love, and let eager charity see in him a weak member of Jesus Christ. For, as the Bishop of Hippo remarks, it is better “to be cured within the Church’s community than to be cut off from its body as incurable members.”21 “As long as a member still forms part of the body there is no reason to despair of its cure; once it has been cut off, it can be neither cured nor healed.”22
20 Cf. Matth., IX, 11; Mark, II, 16; Luke, XV, 2.
21 August., Epist., CLVII, 3, 22: Migne, Patrologiæ Cursus completus, Series Latina [PL], XXXIII, 686.
22 August., Serm., CXXXVII, 1: PL XXXVIII, 754.
— Mystici Corporis Christi 23-24