PetscBool is indeed an int. So there is nothing wrong. PETSc does not use bool in order to support C89.
Hong (Mr.) > On Apr 25, 2017, at 11:48 AM, Garth N. Wells <[email protected]> wrote: > > I'm seeing some behaviour with bool types in petsc4py that I didn't > expect. In the Python interface, returned Booleans have type '<class > 'int'>', where I expected them to have type ' <class 'bool'>'. Below > program illustrates issue. Seems to be related to bint in cython. Am I > doing something wrong? > > Garth > > > from petsc4py import PETSc > A = PETSc.Mat() > A.createAIJ((2, 2)) > A.setOption(PETSc.Mat.Option.SYMMETRIC, True) > symm = A.isSymmetricKnown() > print("Symmetry set:", symm[0] is True) > print("Symmetry set:", symm[0] == True) > print("Bool type:", type(symm[0]))
