classification
Title: _osx_support.py: misplaced flags in re.sub()
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Jack.McCracken, jwilk, serhiy.storchaka, vstinner, xiang.zhang
Priority: normal Keywords: easy

Created on 2017-04-13 20:04 by jwilk, last changed 2017-04-14 14:48 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1134 merged python-dev, 2017-04-14 11:56
PR 1135 merged Jack.McCracken, 2017-04-14 12:43
PR 1136 closed Jack.McCracken, 2017-04-14 12:44
PR 1137 merged Jack.McCracken, 2017-04-14 12:46
Messages (5)
msg291631 - (view) Author: Jakub Wilk (jwilk) Date: 2017-04-13 20:04
Lib/_osx_support.py contains the following line:

    flags = re.sub(r'-arch\s+\w+\s', ' ', flags, re.ASCII)

But the 4th re.sub() argument is the maximum number of substitutions, so this is equivalent to:

    flags = re.sub(r'-arch\s+\w+\s', ' ', flags, count=256)

It was probably meant to be:

    flags = re.sub(r'-arch\s+\w+\s', ' ', flags, flags=re.ASCII)


This bug was found using pydiatra:
http://jwilk.net/software/pydiatra
msg291651 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-04-14 12:36
I created the issue #30072: "re functions: convert count and flags parameters to keyword-only?".
msg291652 - (view) Author: Jack McCracken (Jack.McCracken) * Date: 2017-04-14 12:39
Resolved in GitHub https://github.com/python/cpython/pull/1134.

In 2.7, the flag re.ASCII is not passed due to 2.7's default ASCII strings.

Backporting to 3.5 and 3.6.
msg291654 - (view) Author: Jack McCracken (Jack.McCracken) * Date: 2017-04-14 12:47
https://github.com/python/cpython/pull/1135 and https://github.com/python/cpython/pull/1137 backport it to 3.5 and 3.6, respectively.
msg291656 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-04-14 12:51
My fault.
History
Date User Action Args
2017-04-14 14:48:14serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
assignee: serhiy.storchaka
resolution: fixed
stage: backport needed -> resolved
2017-04-14 12:51:15xiang.zhangsetnosy: + xiang.zhang

messages: + msg291656
versions: - Python 2.7
2017-04-14 12:47:23Jack.McCrackensetmessages: + msg291654
2017-04-14 12:46:25Jack.McCrackensetpull_requests: + pull_request1271
2017-04-14 12:44:20Jack.McCrackensetpull_requests: + pull_request1270
2017-04-14 12:43:40Jack.McCrackensetpull_requests: + pull_request1269
2017-04-14 12:39:15Jack.McCrackensetnosy: + Jack.McCracken
messages: + msg291652
2017-04-14 12:36:33vstinnersetnosy: + vstinner
messages: + msg291651
2017-04-14 12:33:22serhiy.storchakasetstage: needs patch -> backport needed
2017-04-14 11:56:15python-devsetpull_requests: + pull_request1268
2017-04-14 11:23:20xiang.zhangsetversions: + Python 2.7
2017-04-13 20:14:32serhiy.storchakasetkeywords: + easy
stage: needs patch
type: behavior
versions: + Python 3.5, Python 3.6, Python 3.7
2017-04-13 20:04:13jwilkcreate