[all-commits] [llvm/llvm-project] 22fea1: [mlir] Better error message in PybindAdaptors.h

ftynse via All-commits all-commits at lists.llvm.org
Tue Feb 1 08:49:33 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 22fea18e5f4e693376f288b598273352cd4ab99f
      https://github.com/llvm/llvm-project/commit/22fea18e5f4e693376f288b598273352cd4ab99f
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2022-02-01 (Tue, 01 Feb 2022)

  Changed paths:
    M mlir/include/mlir/Bindings/Python/PybindAdaptors.h
    M mlir/test/python/dialects/python_test.py

  Log Message:
  -----------
  [mlir] Better error message in PybindAdaptors.h

When attempting to cast a pybind11 handle to an MLIR C API object through
capsules, the binding code would attempt to directly access the "_CAPIPtr"
attribute on the object, leading to a rather obscure AttributeError when the
attribute was missing, e.g., on non-MLIR types. Check for its presence and
throw a TypeError instead.

Depends On D117646

Reviewed By: stellaraccident

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




More information about the All-commits mailing list