Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.7 fix for re.split() in version detection #687

Merged
merged 1 commit into from Apr 29, 2018

Conversation

mingwandroid
Copy link
Contributor

re.split("\s*") has changed from splitting on 1 or more spaces in Python 3.6
(with a deprecation warning) to splitting on 0 or more spaces in Python 3.7.

In Python 3.7 this means it splits at every character.

With Python 3.6:

python -c "import re; print(re.split('\s*', '#define H5_VERS_MAJOR 1'))"
/opt/conda/lib/python3.6/re.py:212: FutureWarning: split() requires a non-empty pattern match.
return _compile(pattern, flags).split(string, maxsplit)
['#define', 'H5_VERS_MAJOR', '1']

With Python 3.7b3:

python -c "import re; print(re.split('\s*', '#define H5_VERS_MAJOR 1'))"
['', '#', 'd', 'e', 'f', 'i', 'n', 'e', '', 'H', '5', '', 'V', 'E', 'R', 'S', '', 'M', 'A', 'J', 'O', 'R', '', '1', '']

re.split("\s*") has changed from splitting on 1 or more spaces in Python 3.6
(with a deprecation warning) to splitting on 0 or more spaces in Python 3.7.

In Python 3.7 this means it splits at every character.

With Python 3.6:

python -c "import re; print(re.split('\s*', '#define H5_VERS_MAJOR    1'))"
/opt/conda/lib/python3.6/re.py:212: FutureWarning: split() requires a non-empty pattern match.
  return _compile(pattern, flags).split(string, maxsplit)
['#define', 'H5_VERS_MAJOR', '1']

With Python 3.7b3:

python -c "import re; print(re.split('\s*', '#define H5_VERS_MAJOR    1'))"
['', '#', 'd', 'e', 'f', 'i', 'n', 'e', '', 'H', '5', '_', 'V', 'E', 'R', 'S', '_', 'M', 'A', 'J', 'O', 'R', '', '1', '']
@avalentino avalentino merged commit 5af5d08 into PyTables:develop Apr 29, 2018
@avalentino
Copy link
Member

Thanks @mingwandroid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants