Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Fix exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Jul 8, 2015
1 parent f514301 commit 39f8839
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/sage/graphs/chrompoly.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ def chromatic_polynomial(G, return_tree_basis = False):
i -= 1
try:
sig_on()
contract_and_count(chords1, chords2, num_chords, nverts, tot, parent)
sig_off()
except RuntimeError:
for i from 0 <= i <= nverts:
try:
contract_and_count(chords1, chords2, num_chords, nverts, tot, parent)
finally:
sig_off()
except BaseException:
for i in range(nverts):
mpz_clear(tot[i])
raise RuntimeError("Error allocating memory for chrompoly.")
raise
for i from 0 <= i <= nverts:
mpz_init(coeffs[i]) # also sets them to 0
mpz_init(coeff)
Expand Down

0 comments on commit 39f8839

Please sign in to comment.