# Buggy code
def configuration(parent_package="", top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, BlasNotFoundError

    config = Configuration("svm", parent_package, top_path)

    config.add_subpackage("tests")

    # Section LibSVM

    # we compile both libsvm and libsvm_sparse
    config.add_library(
        "libsvm-skl",
        sources=[join("src", "libsvm", "libsvm_template.cpp")],
        depends=[join("src", "libsvm", "svm.cpp"), join("src", "libsvm", "svm.h")],
        # Force C++ linking in case gcc is picked up instead
        # of g++ under windows with some versions of MinGW
        extra_link_args=["-lstdc++"],
    )

    libsvm_sources = ["libsvm.c"]
    libsvm_depends = [
        join("src", "libsvm", "libsvm_helper.c"),
        join("src", "libsvm", "libsvm_template.cpp"),
        join("src", "libsvm", "svm.cpp"),
        join("src", "libsvm", "svm.h"),
    ]

    config.add_extension(
        "libsvm",
        sources=libsvm_sources,
        include_dirs=[numpy.get_include(), join("src", "libsvm")],
        libraries=["libsvm-skl"],
        depends=libsvm_depends,
    )

    ### liblinear module
    cblas_libs, blas_info = get_blas_info()
    if os.name == "posix":
        cblas_libs.append("m")

    liblinear_sources = ["liblinear.c", join("src", "liblinear", "*.cpp")]

    liblinear_depends = [
        join("src", "liblinear", "*.h"),
        join("src", "liblinear", "liblinear_helper.c"),
    ]

    config.add_extension(
        "liblinear",
        sources=liblinear_sources,
        libraries=cblas_libs,
        include_dirs=[
            join("..", "src", "cblas"),
            numpy.get_include(),
            blas_info.pop("include_dirs", []),
        ],
        extra_compile_args=blas_info.pop("extra_compile_args", []),
        depends=liblinear_depends,
        # extra_compile_args=['-O0 -fno-inline'],
        **blas_info,
    )

    ## end liblinear module

    # this should go *after* libsvm-skl
    libsvm_sparse_sources = ["libsvm_sparse.c"]
    config.add_extension(
        "libsvm_sparse",
        libraries=["libsvm-skl"],
        sources=libsvm_sparse_sources,
        include_dirs=[numpy.get_include(), join("src", "libsvm")],
        depends=[
            join("src", "libsvm", "svm.h"),
            join("src", "libsvm", "libsvm_sparse_helper.c"),
        ],
    )

    return config


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def configuration(parent_package="", top_path=None):
    from numpy.distutils.misc_util import Configuration

    config = Configuration("svm", parent_package, top_path)

    config.add_subpackage("tests")

    # Section LibSVM

    # we compile both libsvm and libsvm_sparse
    config.add_library(
        "libsvm-skl",
        sources=[join("src", "libsvm", "libsvm_template.cpp")],
        depends=[join("src", "libsvm", "svm.cpp"), join("src", "libsvm", "svm.h")],
        # Force C++ linking in case gcc is picked up instead
        # of g++ under windows with some versions of MinGW
        extra_link_args=["-lstdc++"],
    )

    libsvm_sources = ["libsvm.c"]
    libsvm_depends = [
        join("src", "libsvm", "libsvm_helper.c"),
        join("src", "libsvm", "libsvm_template.cpp"),
        join("src", "libsvm", "svm.cpp"),
        join("src", "libsvm", "svm.h"),
    ]

    config.add_extension(
        "libsvm",
        sources=libsvm_sources,
        include_dirs=[numpy.get_include(), join("src", "libsvm")],
        libraries=["libsvm-skl"],
        depends=libsvm_depends,
    )

    ### liblinear module
    cblas_libs, blas_info = get_blas_info()
    if os.name == "posix":
        cblas_libs.append("m")

    liblinear_sources = ["liblinear.c", join("src", "liblinear", "*.cpp")]

    liblinear_depends = [
        join("src", "liblinear", "*.h"),
        join("src", "liblinear", "liblinear_helper.c"),
    ]

    config.add_extension(
        "liblinear",
        sources=liblinear_sources,
        libraries=cblas_libs,
        include_dirs=[
            join("..", "src", "cblas"),
            numpy.get_include(),
            blas_info.pop("include_dirs", []),
        ],
        extra_compile_args=blas_info.pop("extra_compile_args", []),
        depends=liblinear_depends,
        # extra_compile_args=['-O0 -fno-inline'],
        **blas_info,
    )

    ## end liblinear module

    # this should go *after* libsvm-skl
    libsvm_sparse_sources = ["libsvm_sparse.c"]
    config.add_extension(
        "libsvm_sparse",
        libraries=["libsvm-skl"],
        sources=libsvm_sparse_sources,
        include_dirs=[numpy.get_include(), join("src", "libsvm")],
        depends=[
            join("src", "libsvm", "svm.h"),
            join("src", "libsvm", "libsvm_sparse_helper.c"),
        ],
    )

    return config