In _cubic_bezier_closed and _cubic_bezier_open the number of points to add is calculated with an expression that will yield a float type answer of an integer if all is well. The member function add of curve.splines.new('BEZIER').bezier_points requires an int type and will raise an exception if a float is given.
This fix will convert the value to an int and also make sure it is an integer to catch any problems with the input data.