In the Catholic Church, is there a punishment for "heresy"? Things are often referred to as "heretical" in Catholic literature and doctrine. As a lifelong Protestant (Pentecostal), I am very very inexperienced with the way the Catholic Church is run. 

The only knowledge that I have of the proceedings with someone who commits heresy is of things like what took place during the Inquisition, and torture chambers and devices used by the Catholics in the Dark Ages.

My question is, What happens to a Catholic who commits heresy in modern times?
The 1983 Code of Canon Law says


  
  &sect;1 An apostate from the faith, a heretic or a schismatic incurs a latae sententiae excommunication, without prejudice to the provisions of can. 194 &sect;1 n.2; a cleric, moreover, may be punished with the penalties mentioned in can. 1336 &sect;1, nn.1, 2 and 3.
  
  
  &ndash; CIC (The online translation is slightly different from my hardback book)


A latae sentitiae excommunication means that the person is excommuicated by the very act; no explicit decree of excommunication is necessary.

Canon 1331 &sect;1 lays down what happens to excommunicated persons, and &sect;2 what happens once the excommunication is formally recognised to have occurred:


  
  §1. An excommunicated person is forbidden:
  
  
  to have any ministerial participation in celebrating the sacrifice of the Eucharist or any other ceremonies of worship whatsoever;
  to celebrate the sacraments or sacramentals and to receive the sacraments;
  to exercise any ecclesiastical offices, ministries, or functions whatsoever or to place acts of governance.
  
  
  §2. If the excommunication has been imposed or declared, the offender:
  
  
  who wishes to act against the prescript of §1, n. 1 must be prevented from doing so, or the liturgical action must be stopped unless a grave cause precludes this;
  invalidly places acts of governance which are illicit according to the norm of §1, n. 3;
  is forbidden to benefit from privileges previously granted;
  cannot acquire validly a dignity, office, or other function in the Church;
  does not appropriate the benefits of a dignity, office, any function, or pension, which the offender has in the Church.
  
  


Canon 1336 as mentioned above allows an ordained minister to be further constrained by any or all of the following:


  
  a prohibition or an order concerning residence in a certain place or territory;
  privation of a power, office, function, right, privilege, faculty, favor, title, or insignia, even merely honorary;
  a prohibition against exercising those things listed under n. 2, or a prohibition against exercising them in a certain place or outside a certain place; these prohibitions are never under pain of nullity;
  


Note that excommunication is not a punishment. It's a recognition that the person is outside the Church, it's a separation. Canon Law shows what the result of that separation is: basically, the heretic is cut off from receiving the benefits of the Church, including its ministries &mdash; the one exception to that would be Reconciliation (Penance).