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

different behaviour for PyObjCFFI_ParseArguments between Intel/M1 macs? #472

Closed
rndblnch opened this issue May 12, 2022 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@rndblnch
Copy link
Contributor

I have a bug report for my app written in python using pyobjc Présentation.app that i can not reproduce.

The bug report is about macOS 11, which I could only install in a virtual machine (virtualbox) on my Intel MacBookPro.
In this environment, I can not reproduce the bug, I only have this information coming from the original report:

objc.internal_error: PyObjC: internal error in PyObjCFFI_ParseArguments at Modules/objc/libffi_support.m:3278: assertion failed: argbuf_cur <= argbuf_len

This happens when calling a function from the CGPDF family (low level C functions wrapped in the Quartz module, presumably CGPDFDictionaryGetObject, CGPDFArrayGetObject, CGPDFDictionaryGetObject or CGPDFStreamGetDictionary).

The pyobjc version that is shipped with the app is 8.5, the python3 version should normally come from the command line developers tools.

The bug report comes from someone owning a M1 mac (but the code I ship is Intel only, so it should run through some emulation layer).
Could the libffi_support.m (or higher level wrapping) behave differently on Intel/M1 macs ?

Thank you!

@rndblnch rndblnch added the bug Something isn't working label May 12, 2022
@ronaldoussoren
Copy link
Owner

I'll try to reproduce this locally. This code shouldn't behave differently on M1 when you ship as x86_64, but is an indication of a bug in PyObjC.

@ronaldoussoren
Copy link
Owner

Time to spin up a VM running macOS 11 as I cannot reproduce this on macOS 12.3, both using your installation package and /usr/bin/python and when cloning the repository and installing the requirements manually (using Python 3.10 using the python.org installer, both arm64 and x86_64). PyObjC was installed from PyPI for testing.

@ronaldoussoren
Copy link
Owner

This might be related to #456, but that should have been fixed in PyObjC 8.5.

8.5 also changed the internal description for a number of relevant APIs:

  • Quartz.CGPDFArrayGetName
  • Quartz.CGPDFContentStreamGetResource
  • Quartz.CGPDFDictionaryGetArray
  • Quartz.CGPDFDictionaryGetBoolean
  • Quartz.CGPDFDictionaryGetName
  • Quartz.CGPDFDocumentUnlockWithPassword
  • Quartz.CGPDFScannerPopName
  • Quartz.CGPDFTagTypeGetName

But that change shouldn't result in the error you're seeing here. Those changes were for #463 and ensure you don't get errors for names that contain non-ascii values.

@ronaldoussoren
Copy link
Owner

Time to spin up a VM running macOS 11 as I cannot reproduce this on macOS 12.3, both using your installation package and /usr/bin/python and when cloning the repository and installing the requirements manually (using Python 3.10 using the python.org installer, both arm64 and x86_64). PyObjC was installed from PyPI for testing.

Likewise for macOS 11 in a x86_64 VM. That said, the report in the Présentation tracker mentions a problem with a PDF that contains a movie, and the PDF attached to that issue doesn't play any movies (which is mentioned in the comment).

I do get the error when I install PyObjC 8.4 instead of the latest release, which is. probably related to #456 as mentioned in an earlier comment.

@rndblnch
Copy link
Contributor Author

Thank you for the time you took investigating that.
Looking closer at the error message reported, the line number is Modules/objc/libffi_support.m:3278, and in the 8.5 branch, there is no such assert on that line, while in the 8.4 branch the assert is there.
So the reporter probably has a 8.4 version installed on his system that is found before the 8.5 version that I ship with the application.
I will correct the sys.path order to fix that.
Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants