Page MenuHomeVyOS Platform

Use regex pattern \s+ to split strings on whitespace in Python 3.7
Closed, ResolvedPublic

Description

Python 3.7 considers r'\s*' an empty pattern match, instead of the previous behavior of matching whitespace, consequently, the pattern r'\s+' should be used in equuleus.

The had been addressed in vyos-1x, commit 69a14678de1c4f9b35414cbb00f33330478e4c58, but is documented here for reference.

Example:
Python 3.6 and below:

>>> import re
>>> path = 'some path'
>>> path_list = re.split(r'\s*', path)
>>> path_list
['some', 'path']

Python 3.7 (equuleus):

>>> import re
>>> path = 'some path'
>>> path_list = re.split(r'\s*', path)
>>> path_list
['', 's', 'o', 'm', 'e', '', 'p', 'a', 't', 'h', '']

Details

Difficulty level
Unknown (require assessment)
Version
vyos-1.3
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Internal change (not visible to end users)

Event Timeline

jestabro triaged this task as Normal priority.Dec 6 2019, 8:59 PM
jestabro created this task.
jestabro created this object in space S1 VyOS Public.
jestabro reopened this task as In progress.
jestabro changed Version from - to vyos-1.3.
erkin set Issue type to Internal change (not visible to end users).Aug 31 2021, 6:08 PM