Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python to C++ pointer conversion issue in moldrawFromQPainter #4182

Merged
merged 1 commit into from
May 28, 2021

Conversation

rachelnwalker
Copy link
Contributor

On 64-bit windows, I noticed that the value of ptr/pointer_to_QPainter can exceed the maximum unsigned long int value. In some cases, this caused an OverflowError when using MolDraw2DFromQPainter to make a PNG. I think that changing the ptr type to size_t should prevent this issue on all platforms, but there might be a better approach.

Here is the traceback I was getting:

    drawer = MolDraw2DFromQPainter(cpp_qp, options.width, options.height)
...\rdkit\Chem\Draw\__init__.py:177: in MolDraw2DFromQPainter
    d2d = rdMolDraw2DQt.MolDraw2DFromQPainter_(width, height, ptr, panelWidth, panelWidth)
E   OverflowError: Python int too large to convert to C unsigned long
--------------------- Captured stdout call -----------------------------
QPainter address: <PyQt5.QtGui.QPainter object at 0x000002A0856282E0>

On 64-bit windows, I noticed the value of the QPainter pointer can exceed the
maximum unsigned long int value, which caused a python OverflowError.
Changing the type to size_t should prevent this.
@greglandrum greglandrum added this to the 2021_03_3 milestone May 28, 2021
@greglandrum greglandrum merged commit 33b5762 into rdkit:master May 28, 2021
@greglandrum
Copy link
Member

Thanks @rachelnwalker!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants