BUG: merge_asof raising ValueError for read-only ndarrays
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/v2.1.0.rst` file if fixing a bug or adding a new feature.


```
import pandas as pd

left = pd.Series([2], index=[2], name="left")
right = pd.Series([1], index=[1], name="right")

# setting read-only here results in the error below
left.index.values.flags.writeable = False

# ValueError: buffer source array is read-only
pd.merge_asof(left, right, left_index=True, right_index=True)
```
Does setting the memory views to const not have the same effect? For a while I thought we were trying to use memoryviews over numpy arrays in the Cython layer so would be better to stick to that design if it works. If not though still lgtm Worth adding a test for this  > Does setting the memory views to const not have the same effect? For a while I thought we were trying to use memoryviews over numpy arrays in the Cython layer so would be better to stick to that design if it works. If not though still lgtm

I just tried setting const on the memory views and I got a compile error. Looking through the rest of that file it looks like most funcs use numpy arrays for numeric. There is a 3rd as_of join in that file (asof_join_nearest_on_X_by_Y) that already uses numpy arrays. > Worth adding a test for this

I did include a test in this PR. Is there an additional test you'd like to see? Ah sorry - missed the test looking from phone. And makes sense - the theory was to always use memoryviews but I don't think we ever got the practice to follow No worries, thanks for reviewing Thanks @lukemanley 