Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions mlir/lib/Bindings/Python/IRAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,12 +774,6 @@ std::unique_ptr<nb_buffer_info> PyDenseElementsAttribute::accessBuffer() {
}

void PyDenseElementsAttribute::bindDerived(ClassTy &c) {
#if PY_VERSION_HEX < 0x03090000
PyTypeObject *tp = reinterpret_cast<PyTypeObject *>(c.ptr());
tp->tp_as_buffer->bf_getbuffer = PyDenseElementsAttribute::bf_getbuffer;
tp->tp_as_buffer->bf_releasebuffer =
PyDenseElementsAttribute::bf_releasebuffer;
#endif
c.def("__len__", &PyDenseElementsAttribute::dunderLen)
.def_static(
"get", PyDenseElementsAttribute::getFromBuffer, nb::arg("array"),
Expand Down Expand Up @@ -931,13 +925,10 @@ MlirAttribute PyDenseElementsAttribute::getAttributeFromBuffer(
}

PyType_Slot PyDenseElementsAttribute::slots[] = {
// Python 3.8 doesn't allow setting the buffer protocol slots from a type spec.
#if PY_VERSION_HEX >= 0x03090000
{Py_bf_getbuffer,
reinterpret_cast<void *>(PyDenseElementsAttribute::bf_getbuffer)},
{Py_bf_releasebuffer,
reinterpret_cast<void *>(PyDenseElementsAttribute::bf_releasebuffer)},
#endif
{0, nullptr},
};

Expand Down
24 changes: 0 additions & 24 deletions mlir/lib/Bindings/Python/IRCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2714,30 +2714,6 @@ namespace {

#endif // Python 3.10.0a3

// Python 3.9.0b1
#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION)

// bpo-40429 added PyThreadState_GetFrame()
PyFrameObject *PyThreadState_GetFrame(PyThreadState *tstate) {
assert(tstate != _Py_NULL && "expected tstate != _Py_NULL");
return _Py_CAST(PyFrameObject *, Py_XNewRef(tstate->frame));
}

// bpo-40421 added PyFrame_GetBack()
PyFrameObject *PyFrame_GetBack(PyFrameObject *frame) {
assert(frame != _Py_NULL && "expected frame != _Py_NULL");
return _Py_CAST(PyFrameObject *, Py_XNewRef(frame->f_back));
}

// bpo-40421 added PyFrame_GetCode()
PyCodeObject *PyFrame_GetCode(PyFrameObject *frame) {
assert(frame != _Py_NULL && "expected frame != _Py_NULL");
assert(frame->f_code != _Py_NULL && "expected frame->f_code != _Py_NULL");
return _Py_CAST(PyCodeObject *, Py_NewRef(frame->f_code));
}

#endif // Python 3.9.0b1

using namespace mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN;

MlirLocation tracebackToLocation(MlirContext ctx) {
Expand Down