Repository: scipy/scipy

Issue:
BUG: When given invalid bounds, `_minimize_neldermead` raises `TypeError` instead of `ValueError`
### Describe your issue.

When given invalid bounds to `_minimize_neldermead`, it raises `TypeError: ValueError() takes no keyword arguments` instead of `ValueError`.

https://github.com/scipy/scipy/blob/77c78ae29eec45629a8a24ad538d3ef170f21715/scipy/optimize/_optimize.py#L743-L749

According to the current code,`ValueError` takes `stacklevel` keywords at line 749.
I believe that it may be proper solution to delete keyword.

### Reproducing Code Example

```python
from scipy.optimize._minimize import _minimize_neldermead 
from scipy.optimize._constraints import Bounds

bounds = Bounds(1, 0)
def func(x):
        return x[0] ** 2 + x[1] ** 2

_minimize_neldermead(func, [1, 1], bounds=bounds)
```


### Error message

```shell
Traceback (most recent call last):
  File "/home/wonseok/current/scipy/my_folder/my_test.py", line 8, in <module>
    _minimize_neldermead(func, [1, 1], bounds=bounds)
  File "/home/wonseok/.pyenv/versions/3.9.18/lib/python3.9/site-packages/scipy/optimize/_optimize.py", line 747, in _minimize_neldermead
    raise ValueError("Nelder Mead - one of the lower bounds "
TypeError: ValueError() takes no keyword arguments
```
```


### SciPy/NumPy/Python version and system information

```shell
1.13.0 1.26.4 sys.version_info(major=3, minor=9, micro=18, releaselevel='final', serial=0)
Build Dependencies:
  blas:
    detection method: pkgconfig
    found: true
    include directory: /usr/local/include
    lib directory: /usr/local/lib
    name: openblas
    openblas configuration: USE_64BITINT=0 DYNAMIC_ARCH=1 DYNAMIC_OLDER= NO_CBLAS=
      NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= ZEN MAX_THREADS=64
    pc file directory: /usr/local/lib/pkgconfig
    version: 0.3.26.dev
  lapack:
    detection method: pkgconfig
    found: true
    include directory: /usr/local/include
    lib directory: /usr/local/lib
    name: openblas
    openblas configuration: USE_64BITINT=0 DYNAMIC_ARCH=1 DYNAMIC_OLDER= NO_CBLAS=
      NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= ZEN MAX_THREADS=64
    pc file directory: /usr/local/lib/pkgconfig
    version: 0.3.26.dev
  pybind11:
    detection method: config-tool
    include directory: unknown
    name: pybind11
    version: 2.12.0
Compilers:
  c:
    commands: cc
    linker: ld.bfd
    name: gcc
    version: 10.2.1
  c++:
    commands: c++
    linker: ld.bfd
    name: gcc
    version: 10.2.1
  cython:
    commands: cython
    linker: cython
    name: cython
    version: 3.0.10
  fortran:
    commands: gfortran
    linker: ld.bfd
    name: gcc
    version: 10.2.1
  pythran:
    include directory: ../../tmp/pip-build-env-ao82zwrs/overlay/lib/python3.9/site-packages/pythran
    version: 0.15.0
Machine Information:
  build:
    cpu: x86_64
    endian: little
    family: x86_64
    system: linux
  cross-compiled: false
  host:
    cpu: x86_64
    endian: little
    family: x86_64
    system: linux
Python Information:
  path: /opt/python/cp39-cp39/bin/python
  version: '3.9'
```



Discussion:
right, looks like that was added accidentally by me. It would be good to check the rest of the codebase for any other occurrences of `stacklevel` inside a `ValueError`. PR welcome!

Resolving patch:
diff --git a/scipy/optimize/_optimize.py b/scipy/optimize/_optimize.py
--- a/scipy/optimize/_optimize.py
+++ b/scipy/optimize/_optimize.py
@@ -745,8 +745,7 @@ def _minimize_neldermead(func, x0, args=(), callback=None,
         # check bounds
         if (lower_bound > upper_bound).any():
             raise ValueError("Nelder Mead - one of the lower bounds "
-                             "is greater than an upper bound.",
-                             stacklevel=3)
+                             "is greater than an upper bound.")
         if np.any(lower_bound > x0) or np.any(x0 > upper_bound):
             warnings.warn("Initial guess is not within the specified bounds",
                           OptimizeWarning, stacklevel=3)


Test patch: