Papal Infallibility

The Council proclaimed a doctrine which had been believed true for quite some time before the council. And it applied ex post facto. Prior popes who had made a solemn proclamation on faith or morals would be held by the council to be infallible.

But the answer to the meat of the question is a different matter. Papal infallibility in no way implies papal impeccability. A pope can sin - and, all too often, have.