When I went to Catechism we were taught the Pope never lies and cannot make a mistake on a matter of Scripture.
The only time the Pope can't make a mistake is when he says he is speaking infallibly on faith or morals (not specifically Scripture), which has happened only three times in 2000 years that I'm aware of (1854, 1950, and 1994).
Then you were taught heresy.