Skip to content

msvs.py _EscapeCommandLineArgumentForMSBuild() TypeError: can't multiply sequence by non-int of type 'float' #3296

@kuenzign

Description

@kuenzign

In msvs.py, _EscapeCommandLineArgumentForMSBuild() is dividing by 2: return (len(match.group(1)) / 2 * 4) * "\\" + '\\"', however this division results in a float, which causes the multiplication by the string "\\" to throw this error. To fix this, I believe that the division should be changed to use floor division (//), which should correctly return an integer: return (len(match.group(1)) // 2 * 4) * "\\" + '\\"'

This issue causes problems when a define in GYP has backslashes that need to be escaped. For example:

"defines": [
  "TEST_STRING=\\\"TEST\\\"",
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions