Skip to content

Automatically initialize the global context when adding one #5

@Terseus

Description

@Terseus

Right now we need two context managers to use the library:

  • initialize the global context with global_context_initialized.
  • add the context with add_global_context.

It would be great if add_global_context can manage the context automatically:

  • detect if the context is initialized.
  • if it isn't, initialize and save the state.
  • when add_global_context ends, close the global context.

It's important to be reentrant to an add_global_context within another add_global_context doesn't close the context too soon.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions