PetscBool not mapped to Python <class 'bool'>

Issue #63 resolved
Prof Garth Wells created an issue

See http://lists.mcs.anl.gov/pipermail/petsc-users/2017-April/032413.html for description.

Cython appears to have trouble mapping PetscBool to Python <class 'bool'> via bint. Maybe a toBool function is required as the same lines and toReal?

C int types appear to be cast correctly when using bint.

This issue is pretty serious because the Pythonic syntax a is True leads to erroneous results.

Comments (5)

  1. Lisandro Dalcin

    A quick fix would be to add a toBool() utility routine to make the proper conversion PetscBool -> bool. What do you think? After grepping, it seems there are no so many places in the code where we need to apply this fix.

  2. Log in to comment