Bezier-Spline with Python adds unwanted point
A new splines starts with a single point, it is not empty:

import bpy

curvedata = bpy.data.curves.new(name="Curve", type='CURVE')
ob = bpy.data.objects.new("CurveObj", curvedata)
bpy.context.scene.objects.link(ob)

spline = curvedata.splines.new('BEZIER')
print(len(spline.bezier_points))
# Output: 1


The bezier spline has already a point, so you need to
.add() number of points you want to add minus 1.

polyline.bezier_points.add(len(points)-1)


By the way - you can assign the coordinates more efficiently like this:

from bpy_extras.io_utils import unpack_list
# ...
polyline.bezier_points.foreach_set("co", unpack_list(points))