Skip to content

_osx_support.py: misplaced flags in re.sub() #74253

Closed

Description

@jwilk
mannequin
BPO 30067
Nosy @vstinner, @jwilk, @serhiy-storchaka, @JackMc, @zhangyangyu
PRs
  • bpo-30067: Fix misplaced positional argument in OS X support library #1134
  • bpo-30067 [backport 3.5]: Fix misplaced positional argument in OS X support library #1135
  • bpo-30067 [backport 3.6]: Fix misplaced positional argument in OS X support library #1136
  • bpo-30067 [backport 3.6]: Fix misplaced positional argument in OS X support library #1137
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2017-04-14.14:48:14.293>
    created_at = <Date 2017-04-13.20:04:13.195>
    labels = ['3.7', 'easy', 'type-bug', 'library']
    title = '_osx_support.py: misplaced flags in re.sub()'
    updated_at = <Date 2017-04-14.14:48:14.292>
    user = 'https://github.com/jwilk'

    bugs.python.org fields:

    activity = <Date 2017-04-14.14:48:14.292>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2017-04-14.14:48:14.293>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2017-04-13.20:04:13.195>
    creator = 'jwilk'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30067
    keywords = ['easy']
    message_count = 5.0
    messages = ['291631', '291651', '291652', '291654', '291656']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'jwilk', 'serhiy.storchaka', 'Jack.McCracken', 'xiang.zhang']
    pr_nums = ['1134', '1135', '1136', '1137']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30067'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    Activity

    1. jwilk commented on Apr 13, 2017

      jwilkmannequin
      MannequinAuthor

      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

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Apr 13, 2017
    3. vstinner commented on Apr 14, 2017

      @vstinner
      Member

      I created the issue bpo-30072: "re functions: convert count and flags parameters to keyword-only?".

    4. JackMc commented on Apr 14, 2017

      JackMcmannequin
      Mannequin

      Resolved in GitHub #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.

    5. JackMc commented on Apr 14, 2017

      JackMcmannequin
      Mannequin

      #1135 and #1137 backport it to 3.5 and 3.6, respectively.

    6. zhangyangyu commented on Apr 14, 2017

      @zhangyangyu
      Member

      My fault.

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    3.7 (EOL)end of lifeeasystdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions