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

Cancelling with command-period crahses hard #501

Open
justvanrossum opened this issue Dec 27, 2022 · 8 comments
Open

Cancelling with command-period crahses hard #501

justvanrossum opened this issue Dec 27, 2022 · 8 comments

Comments

@justvanrossum
Copy link
Collaborator

import time

for i in range(100):
    print(i)
    time.sleep(0.2)

Type command-period while the above is running. It exists with a hard crash Illegal instruction: 4

@typemytype
Copy link
Owner

when CheckEventQueueForUserCancel is True it fails and crashes

https://github.com/typemytype/drawbot/blob/master/drawBot/scriptTools.py#L110

the rest of the code in side that if statement seems to work fine (did this silly test):
image

@justvanrossum
Copy link
Collaborator Author

I currently cannot get it to not crash, even with Python 3.7, even though the 3.128 release works perfectly.

@typemytype
Copy link
Owner

typemytype commented Dec 28, 2022

what OS?

it crashes every time when esc or cmd . on M1 Ventura

@justvanrossum
Copy link
Collaborator Author

Ok, this is unfortunately related to py2app: it works with py2app==0.25 but crashes with py2app==0.26 and later.

@justvanrossum
Copy link
Collaborator Author

Browsing through ronaldoussoren/py2app@v0.25...v0.26 so far doesn't give me any clues.

@justvanrossum
Copy link
Collaborator Author

it crashes every time when esc or cmd . on M1 Ventura

Same here, unless I downgrade py2app to 0.25 (which also requires downgrading setuptools to something older).

@typemytype
Copy link
Owner

strange, DB is building the function from the Carbon library with ctypes

https://github.com/typemytype/drawbot/blob/master/drawBot/scriptTools.py#L24-L26

the minimal setup to make it crash, in the main loop, however this works in terminal

import ctypes
from ctypes.util import find_library

_carbonPath = find_library("Carbon")
CheckEventQueueForUserCancel = ctypes.CFUNCTYPE(ctypes.c_bool)(('CheckEventQueueForUserCancel', ctypes.CDLL(_carbonPath)))

while not CheckEventQueueForUserCancel():
    pass

@justvanrossum
Copy link
Collaborator Author

In terminal there is no event loop, so that is to be expected.

I've been trying to make a minimal Cocoa app to reproduce, but I'm failing so far.

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

No branches or pull requests

2 participants