Page MenuHomePhabricator

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?
Perfectly compatible

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 updated the task description. (Show Details)Dec 6 2019, 9:09 PM
jestabro closed this task as Resolved.Dec 6 2019, 9:14 PM
jestabro reopened this task as In progress.
jestabro changed Version from - to vyos-1.3.
jestabro closed this task as Resolved.Wed, Jan 29, 8:48 PM
c-po moved this task from In Progress to Finished on the VyOS 1.3 Equuleus board.Thu, Jan 30, 8:22 PM