8000 [ENH]: Turn widgets.LockDraw into a context manager · Issue #24703 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
[ENH]: Turn widgets.LockDraw into a context manager #24703
Closed as not planned
thiagoluisbecker/matplotlib
#1
@timhoffm

Description

@timhoffm

Problem

lock(obj)
...
lock.release(obj)

will not release the lock properly if an exception occurs in between.

Proposed solution

We therefore should aim at

with lock(obj):
    ...

by implementing __enter__ and __exit__.

Alternative: I'm quite unsure what the owner/available mechanism brings here. If that was not needed, we could use a standard threading.Lock.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0