Cut angular section (pie section) out of cylinder
Below is a quick and dirty method using a circle and solidify modifier with operators.
import bpy
from math import pi

verts_total = 8
verts_fill = 7
my_radius = 1.0
my_location = (0.0, 0.0, 0.0)
my_rotation = (0.0, 0.0, 0.0)  # use radians
my_depth = 2.0

def make_pacman(verts_total, verts_fill, my_radius, my_location, my_rotation, my_depth):
    # create a circle mesh and create triangle fan fill
    bpy.ops.mesh.primitive_circle_add(
        vertices=verts_total,
        radius=my_radius,
        fill_type='TRIFAN',
        calc_uvs=True,
        location=my_location,
        rotation=my_rotation)

    obj = bpy.context.object
    # add solidify modifier to simulate cylinder
    mod = obj.modifiers.new(&quot;SOLIDIFY&quot;, type='SOLIDIFY')
    mod.thickness = my_depth 
    mod.offset = 0
    # if full cylinder then done
    if verts_total == verts_fill:
        return
    # select vertices to delete
    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.mesh.select_all(action='DESELECT')
    bpy.ops.object.mode_set(mode='OBJECT')
    for i, vert in enumerate(obj.data.vertices):
        if i &lt;= verts_fill:
            continue
        vert.select = True
    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.mesh.delete(type='VERT')
    bpy.ops.object.mode_set(mode='OBJECT')

make_pacman(verts_total, verts_fill, my_radius, my_location, my_rotation, my_depth)