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

macOS Mojave cannot get already set key passwords since v23.1.0 #583

Closed
atomiechen opened this issue Jun 30, 2022 · 4 comments
Closed

macOS Mojave cannot get already set key passwords since v23.1.0 #583

atomiechen opened this issue Jun 30, 2022 · 4 comments

Comments

@atomiechen
Copy link

Describe the bug
On macOS Mojave (other macOS version not tested), the README demo steps fail:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType bytes]: unrecognized selector sent to instance 0x101ed5d10'

when calling keyring.get_password in python or keyring get in command line after setting a password. In system app Keychain I can confirm that the key password is set.

The problem disappears when downgrade to version 23.0.1 and shows up since version 23.1.0.

To Reproduce
Steps to reproduce the behavior: follow README demo steps

Expected behavior
The console log is as follows:

Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:59:38)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import keyring
>>> keyring.set_password("system", "username", "password")
>>> keyring.get_password("system", "username")
2022-07-01 01:06:33.844 Python[1990:80102] -[__NSCFType bytes]: unrecognized selector sent to instance 0x101ed5d10
2022-07-01 01:06:33.845 Python[1990:80102] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType bytes]: unrecognized selector sent to instance 0x101ed5d10'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001000f3cf9 __exceptionPreprocess + 256
	1   libobjc.A.dylib                     0x0000000100a9ea17 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010016db06 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00000001000960ef ___forwarding___ + 1485
	4   CoreFoundation                      0x0000000100095a98 _CF_forwarding_prep_0 + 120
	5   _ctypes.cpython-37m-darwin.so       0x0000000105dd90c7 ffi_call_unix64 + 79
	6   Python                              0x00007fff5bffdcb0 Python + 140730441915568
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1]    1990 abort      python3

Environment

  • OS: macOS Mojave 10.14.4
  • keyring version: 23.1.0 and up
$ pip list | grep keyring
keyring                                 23.1.0
$ keyring --list-backends
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.macOS.Keyring (priority: 5)
keyring.backends.chainer.ChainerBackend (priority: -1)

Additional context
I encountered this when trying notion-scholar on my Macbook Pro before I realized that the cause is rooted here.

@atomiechen
Copy link
Author

Update: after I upgrade my MacBook Pro to Monterey, the problem no longer exists.

@atomiechen atomiechen changed the title On macOS cannot get already set key passwords since v23.1.0 macOS Mojave cannot get already set key passwords since v23.1.0 Jul 1, 2022
@jaraco
Copy link
Owner

jaraco commented Jul 14, 2022

There were several compatibility issues between Python and macOS and the ARM transition (which happened in Python 3.7/3.8).

As you can see in the changelog, v23.1.0 introduced one change as found in #519, where the API was updated.

Probably Mojave didn't have that API yet. My recommendation - if you're using an older version of macOS, you may need to use an older keyring.

@jaraco jaraco closed this as completed Jul 14, 2022
@AlexanderVR
Copy link

Having the exact same issue with MacOS 12.5.1, Python 3.10.5 (and 3.9.13) on an ARM M1 Max.

Tried keyring 23.6.0 and 23.8.2.
Reverting to 23.0.1 is still a workaround.

@AlexanderVR
Copy link

Update: issue was due to compiling python through asdf/pyenv with outdated clang (bundled with llvm@11).

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

3 participants