Pandas version checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of pandas.

  • [X] I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
import io
t=pd.read_csv(io.StringIO('''
1
2
3
-
1
2
3
'''),sep='\n',lineterminator='-',header=None)

Issue Description

The example returns the following error in the new version (1.5.3)

ValueError: Specified \n as separator or delimiter. This forces the python engine which does not accept a line terminator. Hence it is not allowed to use the line terminator as separator.

while it did work fine in the previous one (1.3.5).

Moreover, it works fine if I pass lineterminator='\r' and use the same input saved into a file with Windows terminations.

Expected Behavior

It should parse the input just fine.

Installed Versions

INSTALLED VERSIONS ------------------ commit : 2e218d10984e9919f0296931d92ea851c6a6faf5 python : 3.10.9.final.0 python-bits : 64 OS : Darwin OS-release : 21.3.0 Version : Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8 pandas : 1.5.3 numpy : 1.24.2 pytz : 2022.7 dateutil : 2.8.2 setuptools : 65.6.3 pip : 23.0 Cython : 0.29.32 pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.2 html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.7.0 pandas_datareader: None bs4 : 4.11.1 bottleneck : None brotli : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.7.1 numba : None numexpr : None odfpy : None openpyxl : 3.0.10 pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : 1.9.3 snappy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlwt : None zstandard : None tzdata : None

Comment From: phofl

Hi, thanks for your report. The error message is deliberate, this behavior is not supported. We should probably raise on windows as well

Comment From: gsportelli

Since it actually worked on earlier versions, why not restricting the error to the specific case that is not supported? Also some note or deprecation due to the different behaviour between versions might help users.