[all-commits] [llvm/llvm-project] d6e805: [lldb] Improve error message for modules with dots...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Wed Feb 17 10:00:49 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d6e80578fc5e5199d5783671bd0c8ce1050925f9
      https://github.com/llvm/llvm-project/commit/d6e80578fc5e5199d5783671bd0c8ce1050925f9
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2021-02-17 (Wed, 17 Feb 2021)

  Changed paths:
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
    A lldb/test/Shell/ScriptInterpreter/Python/command_import.test

  Log Message:
  -----------
  [lldb] Improve error message for modules with dots or dashes

LLDB does not like to import Python files with dashes or dots in their
name. While the former are technically allowed, it is discouraged. Dots
are allowed for subpackages but not in module names. This patch improves
the user experience by printing a useful error.

Before this patch:

  error: module importing failed: SyntaxError('invalid syntax',
  ('<string>', 1, 11, 'import foo-bar\n'))

After this patch:

  error: module importing failed: Python discourages dashes in module
  names: foo-bar

rdar://74263511

[1] https://www.python.org/dev/peps/pep-0008/#package-and-module-names

Differential revision: https://reviews.llvm.org/D96833




More information about the All-commits mailing list