[Mlir-commits] [mlir] 25d1734 - [MLIR] Rename test/python/dialects/math.py -> math_dialect.py

Uday Bondhugula llvmlistbot at llvm.org
Wed Nov 24 20:22:22 PST 2021


Author: Uday Bondhugula
Date: 2021-11-25T09:51:49+05:30
New Revision: 25d173499effd978435e433196003f964293f8d9

URL: https://github.com/llvm/llvm-project/commit/25d173499effd978435e433196003f964293f8d9
DIFF: https://github.com/llvm/llvm-project/commit/25d173499effd978435e433196003f964293f8d9.diff

LOG: [MLIR] Rename test/python/dialects/math.py -> math_dialect.py

Rename test/python/dialects/math.py -> math_dialect.py to avoid a
collision with a Python standard package of the same name. These test
scripts are run by path and are not part of a package. Python apparently
implicitly adds the containing directory to its PYTHONPATH. As such,
test scripts with common names run the risk of conflicting with global
names and resolution of an import for the latter happens to the former.

Differential Revision: https://reviews.llvm.org/D114568

Added: 
    mlir/test/python/dialects/math_dialect.py

Modified: 
    

Removed: 
    mlir/test/python/dialects/math.py


################################################################################
diff  --git a/mlir/test/python/dialects/math.py b/mlir/test/python/dialects/math_dialect.py
similarity index 83%
rename from mlir/test/python/dialects/math.py
rename to mlir/test/python/dialects/math_dialect.py
index c5985dbf36b32..08ffe0c460321 100644
--- a/mlir/test/python/dialects/math.py
+++ b/mlir/test/python/dialects/math_dialect.py
@@ -1,5 +1,8 @@
 # RUN: %PYTHON %s | FileCheck %s
 
+# Naming this file with a `_dialect` suffix to avoid a naming conflict with
+# python package's math module (coming in from random.py).
+
 from mlir.ir import *
 import mlir.dialects.builtin as builtin
 import mlir.dialects.math as mlir_math


        


More information about the Mlir-commits mailing list