jaraco / keyring

MIT License
1.24k stars 152 forks source link

Python version 3.12rc1 - cannot find backend (Windows 11) and fatal exception in set #648

Open johns1c opened 1 year ago

johns1c commented 1 year ago
  1. keyring list-backends gives nothing when installed on a Python 3.12-rc1 virtual environment.
  2. calling get_password cause an exit from the Python interpreter

they work perfectly under Python 3.8.10 with previous and the latest versions of keyring

o/s is Microsoft Window 11 pro (10.0.22621) and I am NOT working in a VM or Linux just a command shell I am not running with admin privs

having just hound the Python -X faulthandler option I get this when running a trivial set and get program, the fault happening in the set call.

(z312) C:\Users\****************\Python\z312>py  -X faulthandler ..\zzzz\test_keyring.py
Starting....
Windows fatal exception: access violation

Current thread 0x000055c4 (most recent call first):
Windows fatal exception: access violation

The trivial code is

import keyring
print( 'Starting....' , flush=True ) 
keyring.set_password("mySystem", "myUsername", "S3CR3T_P455W0RD")
print( 'password should be set' , flush=True ) 
saved_password = keyring.get_password("system", "myUsername")
print( f'{saved_password=} which I believe is a generic password set above ' )
mfinky commented 10 months ago

installed python 3.12, downloaded on 2023-10-10 and keyring stopped working. I had been using python 3.11 release until this morning.

micahellison commented 10 months ago

I was curious if this problem existed on Windows 10 Pro so I tried to reproduce it in Python 3.12. I didn't get the same crash, however, I also didn't get the expected result because there's a problem in the script in this issue: set_password uses "mySystem" as the first arg while get_password uses "system" as the first arg, so it can never get that password. Once I fixed that, it was fine (though I can't speak for Windows 11).

Here's the corrected script, if anyone would like to try this on Windows 11 Pro to repro the issue:

import keyring
print( 'Starting....' , flush=True ) 
keyring.set_password("mySystem", "myUsername", "S3CR3T_P455W0RD")
print( 'password should be set' , flush=True ) 
saved_password = keyring.get_password("mySystem", "myUsername")
print( f'{saved_password=} which I believe is a generic password set above ' )
jaraco commented 9 months ago

It does sound as if maybe there's a problem on some copies of Python 3.12 on Windows. The test suite does pass on Windows on Python 3.12, so the issue isn't universal. If I get time, I may try to repro on my Windows VM. In the meantime, if anyone can help ascertain exactly what factors are necessary to cause the error, it's appreciated.

mfinky commented 9 months ago

I apologize. I was (and still am) involved on a very busy/critical project at work, so I downgraded to Python 3.11 to make things work. i will need to find some free time to grab a personal Windows PC to reproduce the issue. Not sure when. again, my apologies!!

Marcelo

On Nov 12, 2023, at 17:01, Jason R. Coombs @.***> wrote:



It does sound as if maybe there's a problem on some copies of Python 3.12 on Windows. The test suitehttps://urldefense.com/v3/__https://github.com/jaraco/keyring/actions/runs/6843496239/job/18606142348__;!!MtWvt2UVEQ!AM5l7qcBAfEUXCCgWDn2H-uZXCCPkgL4rgHPx768x9AAIetjY-hTUow967MX3FGEAUCZS-0hEawL2YoMKzHvFjBvvKUIxDE$ does pass on Windows on Python 3.12, so the issue isn't universal. If I get time, I may try to repro on my Windows VM. In the meantime, if anyone can help ascertain exactly what factors are necessary to cause the error, it's appreciated.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/jaraco/keyring/issues/648*issuecomment-1807271635__;Iw!!MtWvt2UVEQ!AM5l7qcBAfEUXCCgWDn2H-uZXCCPkgL4rgHPx768x9AAIetjY-hTUow967MX3FGEAUCZS-0hEawL2YoMKzHvFjBvjrCAqIU$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AB5RW2JF5W7JJNTQ3OAJFXLYEFIODAVCNFSM6AAAAAA4C3JRXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBXGI3TCNRTGU__;!!MtWvt2UVEQ!AM5l7qcBAfEUXCCgWDn2H-uZXCCPkgL4rgHPx768x9AAIetjY-hTUow967MX3FGEAUCZS-0hEawL2YoMKzHvFjBvChCZuts$. You are receiving this because you are subscribed to this thread.Message ID: @.***>

tcumby commented 7 months ago

I was able to replicate this on a Window 10 Pro VM with Python 3.12.1.

$ set PYTHONMALLOC=debug
$ set PYTHONASYNCIODEBUG=1
$ python -W default -X faulthandler
Python 3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import keyring
>>> keyring.get_password("<server>", "<username>")
<frozen importlib._bootstrap>:918: ImportWarning: BackendLoader.exec_module() not found; falling back to load_module()
Windows fatal exception: access violation

Current thread 0x000061dc (most recent call first):
  <no Python frame>