In defense of TS, the code won’t work with a list per the other topic but should do with a numpy array.
There was a recent thread and bug report about incorrect array converters being selected: the selection is on element size, not element type as numpy arrays don’t carry a typecode as an attribute (but do as part of the buffer info). See:
As @wlav has pointed out this is a bug about types. ROOT interprets your array as one with floats, even though it contains integers and you should have received an error. Specifying dtype when defining your array will resolve the issue until the bug is resolved.
import numpy as np
import ROOT
#Must explicit declare variable type
bin_edges = np.array([2, 4, 8, 9], dtype='float64')
h = ROOT.TH1F("","",len(bin_edges)-1, bin_edges)
for bin_num in range(len(bin_edges)-1):
print h.GetBinWidth(bin_num)