(fenicsx) subdomain integral fails depending on form of meshtags

The code below does an integral over a subdomain defined by a MeshTags instance. When the mesh tags are generated using a constant, the integration works fine. When the mesh tags are generated using array data, the integration fails with a TypeError in forms.py. Below is a short script demonstrating this. This is on mac Catalina (10.15.7) installed via conda, dolfinx version 0.5.0.

"""Subdomain Integration Example"""
import numpy as np

import dolfinx
from dolfinx import fem, mesh
from dolfinx.fem import assemble_scalar, form
import ufl
from mpi4py import MPI


# Create Mesh

msh = mesh.create_rectangle(
    comm=MPI.COMM_WORLD,
    points=((0.0, 0.0), (2.0, 1.0)),
    n=(30, 20),
    cell_type=mesh.CellType.triangle,
)
bdim = (cdim := msh.topology.dim) - 1

# Create a function to integrate

def f_(x):
    return x[0, :] - 3 * x[1, :]

V = fem.FunctionSpace(msh, ("Lagrange", 1))
f = fem.Function(V)
f.interpolate(f_)

# Volume Integration
cells_bot = dolfinx.mesh.locate_entities(
    msh, cdim, lambda x: x[1, :] < 0.5 + 1e-4
)

mtbot = dolfinx.mesh.meshtags(msh, cdim, cells_bot, 1)
dx1 = ufl.Measure("dx", subdomain_data=mtbot)
int_f1 = msh.comm.allreduce(assemble_scalar(form(f * dx1(1))), op=MPI.SUM)
print(f"integral of f over subdomain 1: {np.array(int_f1)}")

# Now try using array data instead of a constant
tag_data = np.ones(len(cells_bot), dtype=int)
mtbot2 = dolfinx.mesh.meshtags(msh, cdim, cells_bot, tag_data)
dx2 = ufl.Measure("dx", subdomain_data=mtbot2)
int_f1 = msh.comm.allreduce(assemble_scalar(form(f * dx2(1))), op=MPI.SUM)
print(f"integral of f over subdomain 1: {np.array(int_f1)}")

Here is the output when running it:

(fenicsx)  1206. python example_integration.py
integral of f over subdomain 1: 0.2500000000000002
Traceback (most recent call last):
  File "/Users/deboyce/Projects/fenicsX/run/learn/example_integration.py", line 44, in <module>
    int_f1 = msh.comm.allreduce(assemble_scalar(form(f * dx2(1))), op=MPI.SUM)
  File "/Users/deboyce/miniconda3/envs/fenicsx/lib/python3.10/site-packages/dolfinx/fem/forms.py", line 166, in form
    return _create_form(form)
  File "/Users/deboyce/miniconda3/envs/fenicsx/lib/python3.10/site-packages/dolfinx/fem/forms.py", line 161, in _create_form
    return _form(form)
  File "/Users/deboyce/miniconda3/envs/fenicsx/lib/python3.10/site-packages/dolfinx/fem/forms.py", line 155, in _form
    return formcls(ufcx_form, V, coeffs, constants, subdomains, mesh, module.ffi, code)
  File "/Users/deboyce/miniconda3/envs/fenicsx/lib/python3.10/site-packages/dolfinx/fem/forms.py", line 51, in __init__
    super().__init__(ffi.cast("uintptr_t", ffi.addressof(self._ufcx_form)),
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. dolfinx.cpp.fem.Form_float64(spaces: List[dolfinx::fem::FunctionSpace], integrals: Dict[dolfinx::fem::IntegralType, Tuple[List[Tuple[int, object]], dolfinx.cpp.mesh.MeshTags_int32]], coefficients: List[dolfinx.cpp.fem.Function_float64], constants: List[dolfinx.cpp.fem.Constant_float64], need_permutation_data: bool, mesh: dolfinx.cpp.mesh.Mesh = None)
    2. dolfinx.cpp.fem.Form_float64(form: int, spaces: List[dolfinx::fem::FunctionSpace], coefficients: List[dolfinx.cpp.fem.Function_float64], constants: List[dolfinx.cpp.fem.Constant_float64], subdomains: Dict[dolfinx::fem::IntegralType, dolfinx.cpp.mesh.MeshTags_int32], mesh: dolfinx.cpp.mesh.Mesh)

Invoked with: <cdata 'uintptr_t' 6342831776>, [], [<dolfinx.cpp.fem.Function_float64 object at 0x17968a5b0>], [], {<IntegralType.cell: 0>: <dolfinx.mesh.MeshTagsMetaClass object at 0x179fe24d0>, <IntegralType.exterior_facet: 1>: None, <IntegralType.interior_facet: 2>: None, <IntegralType.vertex: 3>: None}, <dolfinx.mesh.Mesh object at 0x17987e700>
(fenicsx)  1207. 

Try using dtype=np.int32 or np.intc, as this is what form supports.
See for instance

and

Thanks! This solves my issue.