Skip to content

AlreadyInitilized reports new library instead of previous #193

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

Closed
msetina opened this issue Feb 13, 2025 · 3 comments
Closed

AlreadyInitilized reports new library instead of previous #193

msetina opened this issue Feb 13, 2025 · 3 comments

Comments

@msetina
Copy link

msetina commented Feb 13, 2025

def lib(so):
    """
    Wrap the main library call coming from Cython with a preemptive
    dynamic loading.
    """
    global _lib
    global _so

    if _lib:
        if _so != so:
            raise AlreadyInitialized(  # noqa: F405
-                "Already initialized with %s" % so)
+                "Already initialized with %s" % _so)
        else:
            return _lib

    from . import _pkcs11

    _lib = _pkcs11.lib(so)
    _so = so

    return _lib
@msetina
Copy link
Author

msetina commented Feb 13, 2025

Is it possible to switch to another library?

@HRio
Copy link
Contributor

HRio commented Feb 14, 2025

This happens when for instance switching between opensc and softhsm

See PR #185

@msetina
Copy link
Author

msetina commented Feb 14, 2025

Had different libraries, but I agree. I was wondering why switching is not possible. What is it protecting?
If user takes out card while running and inserts another in this case they can not switch library if needed.

@msetina msetina closed this as completed Feb 19, 2025
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