pluginkit 0.4.2__tar.gz → 0.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pluginkit
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: A strictly-typed, generics-first plugin framework for Python 3.13: hooks with derived return types
5
5
  Keywords: plugins,hooks,protocol,entry-points
6
6
  Author: Morten Hansen
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pluginkit"
3
- version = "0.4.2"
3
+ version = "0.4.3"
4
4
  description = "A strictly-typed, generics-first plugin framework for Python 3.13: hooks with derived return types"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Morten Hansen", email = "morten@winterop.com" }]
@@ -203,7 +203,9 @@ class HookCaller:
203
203
  if not self.spec.historic:
204
204
  raise TypeError(f"hook {self.name!r} is not historic")
205
205
  kwargs = self.check_arguments(kwargs)
206
- self._history.append((kwargs, result_callback))
206
+ # Snapshot the event so a later mutation of the caller's dict can't change
207
+ # what plugins registered after this call replay.
208
+ self._history.append((dict(kwargs), result_callback))
207
209
  for outcome in self._collect(kwargs):
208
210
  if result_callback is not None:
209
211
  result_callback(outcome)
@@ -411,6 +413,11 @@ class PluginManager:
411
413
  for name, parameter in signature.parameters.items()
412
414
  if parameter.default is not inspect.Parameter.empty
413
415
  }
416
+ if self.hook._get_caller(member_name) is not None:
417
+ raise ValueError(
418
+ f"extension point {member_name!r} is already registered; "
419
+ f"re-adding it would drop the implementations already wired to it"
420
+ )
414
421
  self._validate_spec(member_name, spec, params)
415
422
  self.hook._add_caller(self._make_caller(member_name, spec, params, defaults))
416
423
 
File without changes
File without changes