messed up dlopenflags if import fails

Reported by Daniel Smertnig on 2012-08-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyOpenSSL
New
Undecided
Unassigned

Bug Description

Hi,

in __init__.py there is:

    sys.setdlopenflags(flags)
    from OpenSSL import crypto
    sys.setdlopenflags(orig)

But if the import fails, the dlopenflags won't be reset, potentially messing them up and causing unintended side-effects for libraries loaded later in the program.
It should probably by replaced by:

    sys.setdlopenflags(flags)
    try:
        from OpenSSL import crypto
    finally:
        sys.setdlopenflags(orig)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers