pymupdf/PyMuPDF

Bug with IRect contains method

Closed this issue · 2 comments

Description of the bug

The IRect contains method seems to be absent.

How to reproduce the bug

I'm doing:

import pymupdf

irectA = pymupdf.IRect(0,0,100,100)
irectB = pymupdf.IRect(150,150,100,100)

contains = irectA.contains(irectB)

print(f"contains={contains}")

But it has an error with: AttributeError: 'IRect' object has no attribute 'contains'

PyMuPDF version

1.26.1

Operating system

MacOS

Python version

3.13

We should mirror the corresponding Rect method, which has normally been done.
As a circumvention, you can use the alternative x in irect. This is implemented and does exactly what one would expect from the missing irect.contains(x).

Fixed in PyMuPDF-1.26.3.