From YOUCAT, fact 143:
143: Is the Pope really infallible?
Yes. But the POPE speaks infallibly only when he defines a dogma in a solemn ecclesiastical act (“ex cathedra”), in other words, makes an authoritative decision in doctrinal questions of faith and morals. Magisterial decisions of the college of bishops in communion with the Pope also possess an infallible character, for example, decisions of an ecumenical council. [888-892]
The infallibility of the POPE has nothing to do with his moral integrity or his intelligence. What is infallible is actually the Church, for Jesus promised her the Holy Spirit, who keeps her in the truth and leads her ever deeper into it. When a truth of faith that has been taken for granted is suddenly denied or misinterpreted, the Church must have one final voice that authoritatively says what is true and what is false. This is the foice of the Pope. As the successor of Peter and the first among the bishops, he has the authority to formulate the disputed truth according to the Church’s Tradition of faith in such a way that it is presented to the faithful for all times as something “to be believed with certainty.” We say then that the Pope defines a dogma. Therefore such a dogma can never contact something substantially “new.” Very rarely is a dogma defined. The last time was in 1950.