[petsc-users] petsc4py bool type

Lisandro Dalcin dalcinl at gmail.com
Wed Apr 26 03:06:12 CDT 2017


On 25 April 2017 at 19:48, Garth N. Wells <gnw20 at cam.ac.uk> 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?

Wow! Yes, you are right, this seems like a regression in Cython. In
the past, a <bint> cast used to coerce values to the Python `bool`
type. Damn, these casts are everywhere, it might take a while to fix
all the code, unless I can find a hacky way to workaround the issue.


-- 
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 0109
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa

Office Phone: +966 12 808-0459


More information about the petsc-users mailing list