Papal Infallibility and teaching heresy? I had a question that I hoped the Catholics on the board could help me out with.  My understanding of the doctrine of Papal Infallibility is that speaking in his official capacity as the "Vicar of Christ" and the Spiritual leader of the Christian Church, the Pope is considered infallible by the Catholic Church.  

This is a purely hypothetical example, because in the real world, I imagine a cardinal or bishop would be anathemized (sp) before he could ascend to the level of Pope, but what would happen if the Pope taught a heresy such as Modalism or Docetism, speaking in his capacity as the church, from the chair of Peter?  Would Catholics be compelled to agree with the same heresies former councils had violently condemned in the past?  If the heresy was damnable enough, would it be possible to revoke the doctrine or reformulate it, just as it was initially put in place and formulated by the Church?  Or would the tradition of the Church, which it has maintained since Apostolic times, overrule the Pope's proclamation?
This is not completely hypothetical.  

In the mid-300s, Pope Liberius may have signed a statement supporting what later became known as Arian heresy. That he did so in exile and possibly under torture is mitigation, and the story is complex, but it is a more concrete version of this question. In any event, there was clear pressure from the Emperor that came into play.

A similar situation occurred in the 600s with the anathemazation of Pope Honorious I in regards to Christ's nature and monothelitism. There were questions about whether or not the letter was spoken ex cathedra, and ultimately, this became a big discussion point when the dogma of papal infallability was promulgated.

The answer in both cases is basically that the church, having later repudiated his position, went to great lengths to say that the statement was not made under a condition in which papal infallibility is present. This article by Carroll explains the exact nuances of Liberius.  Vatcan I in the 1870's, formulating the doctrine of papal infallability said that Honorious never spoke ex cathedra.  

This basically would suggest that a mitigated sedevacantism is a logical possibility, but that it is ultimately a “nuclear weapon” option that must be avoided at all costs. 

Most likely, any other such heresy later pronounced by the Magisterium would need to prove a similar circumstance.