winrt-runtime 4.1.0__tar.gz → 4.2.0__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.
Files changed (139) hide show
  1. {winrt_runtime-4.1.0/python/winrt_runtime.egg-info → winrt_runtime-4.2.0}/PKG-INFO +1 -1
  2. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/_winrt.pyi +9 -0
  3. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/runtime/_internals.py +40 -0
  4. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/runtime/interop.py +2 -0
  5. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0/python/winrt_runtime.egg-info}/PKG-INFO +1 -1
  6. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/_winrt.cpp +25 -1
  7. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.System.0.h +58 -0
  8. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.System.1.h +14 -0
  9. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.System.2.h +6 -1
  10. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/interp.cpp +285 -26
  11. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/interp.h +12 -1
  12. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/module_state.h +8 -2
  13. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/objects.cpp +343 -20
  14. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/runtime.cpp +43 -27
  15. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/runtime.h +2 -0
  16. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/types.cpp +15 -7
  17. winrt_runtime-4.2.0/version.txt +1 -0
  18. winrt_runtime-4.1.0/version.txt +0 -1
  19. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/LICENSE +0 -0
  20. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/MANIFEST.in +0 -0
  21. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/README.md +0 -0
  22. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/pyproject.toml +0 -0
  23. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/__pyinstaller/__init__.py +0 -0
  24. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/__pyinstaller/hook-winrt.py +0 -0
  25. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/py.typed +0 -0
  26. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/runtime/__init__.py +0 -0
  27. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/runtime/py.typed +0 -0
  28. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/system/__init__.py +0 -0
  29. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/system/hresult.py +0 -0
  30. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt/system/py.typed +0 -0
  31. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt_runtime.egg-info/SOURCES.txt +0 -0
  32. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt_runtime.egg-info/dependency_links.txt +0 -0
  33. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt_runtime.egg-info/entry_points.txt +0 -0
  34. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt_runtime.egg-info/requires.txt +0 -0
  35. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/python/winrt_runtime.egg-info/top_level.txt +0 -0
  36. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/requirements.txt +0 -0
  37. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/setup.cfg +0 -0
  38. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/setup.py +0 -0
  39. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/_winrt_array.cpp +0 -0
  40. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/_winrt_array.h +0 -0
  41. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/_winrt_box.cpp +0 -0
  42. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/_winrt_buffer.cpp +0 -0
  43. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/_winrt_buffer.h +0 -0
  44. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/arrays.cpp +0 -0
  45. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/arrays.h +0 -0
  46. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/async.cpp +0 -0
  47. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/async.h +0 -0
  48. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/callbacks.cpp +0 -0
  49. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/callbacks.h +0 -0
  50. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/collections.cpp +0 -0
  51. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/collections.h +0 -0
  52. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/compose.cpp +0 -0
  53. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/compose.h +0 -0
  54. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/delegates.cpp +0 -0
  55. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/delegates.h +0 -0
  56. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/enums.cpp +0 -0
  57. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/enums.h +0 -0
  58. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/errors.cpp +0 -0
  59. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/generics.cpp +0 -0
  60. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/generics.h +0 -0
  61. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/handles.cpp +0 -0
  62. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/implements.cpp +0 -0
  63. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/implements.h +0 -0
  64. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/Windows.Foundation.Collections.h +0 -0
  65. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/Windows.Foundation.Metadata.h +0 -0
  66. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/Windows.Foundation.h +0 -0
  67. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/Windows.Storage.Streams.h +0 -0
  68. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/Windows.Storage.h +0 -0
  69. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/base.h +0 -0
  70. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/base_macros.h +0 -0
  71. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Devices.Geolocation.0.h +0 -0
  72. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Devices.Geolocation.1.h +0 -0
  73. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Foundation.0.h +0 -0
  74. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Foundation.1.h +0 -0
  75. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Foundation.2.h +0 -0
  76. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Collections.0.h +0 -0
  77. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Collections.1.h +0 -0
  78. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Collections.2.h +0 -0
  79. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Metadata.0.h +0 -0
  80. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Metadata.1.h +0 -0
  81. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Metadata.2.h +0 -0
  82. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.0.h +0 -0
  83. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.1.h +0 -0
  84. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.2.h +0 -0
  85. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.FileProperties.0.h +0 -0
  86. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.FileProperties.1.h +0 -0
  87. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.FileProperties.2.h +0 -0
  88. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.Provider.0.h +0 -0
  89. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.Provider.1.h +0 -0
  90. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.Provider.2.h +0 -0
  91. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.Search.0.h +0 -0
  92. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.Search.1.h +0 -0
  93. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.Search.2.h +0 -0
  94. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.Streams.0.h +0 -0
  95. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.Streams.1.h +0 -0
  96. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.Storage.Streams.2.h +0 -0
  97. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.System.RemoteSystems.0.h +0 -0
  98. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/cppwinrt/winrt/impl/Windows.System.RemoteSystems.1.h +0 -0
  99. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pythoncapi_compat.h +0 -0
  100. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/abi.h +0 -0
  101. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/array.h +0 -0
  102. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/async.h +0 -0
  103. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/base.h +0 -0
  104. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/buffer.h +0 -0
  105. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/convert.h +0 -0
  106. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/errors.h +0 -0
  107. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/handles.h +0 -0
  108. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/prelude.h +0 -0
  109. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/throw_helpers.h +0 -0
  110. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/traits.h +0 -0
  111. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/include/pywinrt/wrappers.h +0 -0
  112. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/members.cpp +0 -0
  113. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/members.h +0 -0
  114. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/metaclass.h +0 -0
  115. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/numerics-buffer.cpp +0 -0
  116. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/numerics-buffer.h +0 -0
  117. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/numerics-statics.cpp +0 -0
  118. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/numerics-statics.h +0 -0
  119. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/numerics-traits.h +0 -0
  120. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/numerics-values.h +0 -0
  121. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/numerics.cpp +0 -0
  122. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/numerics.h +0 -0
  123. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/objects.h +0 -0
  124. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/protocols.cpp +0 -0
  125. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/protocols.h +0 -0
  126. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/pycollections.cpp +0 -0
  127. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/pycollections.h +0 -0
  128. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/pymapping.cpp +0 -0
  129. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/pymapping.h +0 -0
  130. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/pysequence.cpp +0 -0
  131. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/pysequence.h +0 -0
  132. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/shapes-generated.h +0 -0
  133. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/shapes.cpp +0 -0
  134. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/shapes.h +0 -0
  135. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/structs.cpp +0 -0
  136. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/structs.h +0 -0
  137. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/table.cpp +0 -0
  138. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/table.h +0 -0
  139. {winrt_runtime-4.1.0 → winrt_runtime-4.2.0}/src/types.h +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: winrt-runtime
3
- Version: 4.1.0
3
+ Version: 4.2.0
4
4
  Summary: The runtime that every PyWinRT projection package runs on
5
5
  License-Expression: MIT
6
6
  Project-URL: Documentation, https://pywinrt.readthedocs.io
@@ -42,6 +42,9 @@ def wrap_interface(
42
42
  def wrap_interface(capsule: InterfaceCapsule, qualified_name: str, /) -> Any: ...
43
43
  @overload
44
44
  def wrap_interface(capsule: None, type: type[Object] | str, /) -> None: ...
45
+ def interface_pointer(
46
+ obj: Object | InterfaceCapsule | _SupportsInterfaceCapsule, /
47
+ ) -> int: ...
45
48
  def hresult_error(
46
49
  hresult: SupportsIndex, error_info: InterfaceCapsule | None = None, /
47
50
  ) -> OSError: ...
@@ -95,6 +98,12 @@ class _SupportsQueryInterface(Protocol):
95
98
 
96
99
  _TQueryInterface = TypeVar("_TQueryInterface", bound=_SupportsQueryInterface)
97
100
 
101
+ # What interface_pointer() needs from an interop class instance: a method that
102
+ # returns the capsule the instance holds. It must return the same capsule for
103
+ # the life of the instance.
104
+ class _SupportsInterfaceCapsule(Protocol):
105
+ def _interface_capsule_(self) -> InterfaceCapsule: ...
106
+
98
107
  # Declared as an ABCMeta although at run time it derives from type: a type
99
108
  # checker requires an abstract member to be implemented only under ABCMeta, and
100
109
  # the members of an interface are abstract.
@@ -72,6 +72,46 @@ def load_projection(spec: ModuleSpec) -> None:
72
72
  ) from error
73
73
 
74
74
 
75
+ def note_missing_package(
76
+ error: ModuleNotFoundError, module: str, namespace: str
77
+ ) -> None:
78
+ """
79
+ Adds a note to ``error`` naming the package that provides ``module``, the
80
+ module of the WinRT namespace ``namespace``, when ``error`` is about
81
+ ``module`` or a package it sits in, ``module`` is of the Windows SDK and
82
+ ``error`` has no note yet.
83
+
84
+ The runtime calls this when it cannot import the module of a type or
85
+ delegate that a table refers to, or finds it only a namespace package. The
86
+ error is about the first module of ``module``'s packages that is missing,
87
+ which is ``module`` itself only if the packages it sits in are installed.
88
+ The note names the module when the error does not.
89
+
90
+ An error that has a note already is left as it is. The runtime meets one
91
+ when ``module`` is installed but importing it fails: a type it builds then,
92
+ such as a base class, needs a package ``module`` sits in that is missing,
93
+ and the runtime has noted that package.
94
+
95
+ Every package of the Windows SDK provides one namespace and is named after
96
+ it, as ``winrt-Windows.Storage`` provides ``winrt.windows.storage``, and
97
+ nothing else may define a ``Windows`` namespace, so the name of the module
98
+ is all it takes. The package of another family may be named after a
99
+ namespace that its own sits under, so its module does not say which it is.
100
+ """
101
+ if not module.startswith("winrt.windows."):
102
+ return
103
+
104
+ if getattr(error, "__notes__", None):
105
+ return
106
+
107
+ name = error.name
108
+ if not name or (name != module and not module.startswith(f"{name}.")):
109
+ return
110
+
111
+ subject = "it" if name == module else module
112
+ error.add_note(f"The winrt-{namespace} package provides {subject}.")
113
+
114
+
75
115
  class WinrtIntEnum(IntEnum):
76
116
  """
77
117
  The base of every projected WinRT enum that is not a set of flags.
@@ -7,6 +7,7 @@ from winrt._winrt import (
7
7
  get_activation_factory,
8
8
  hresult_error,
9
9
  initialize_with_window,
10
+ interface_pointer,
10
11
  wrap_interface,
11
12
  )
12
13
 
@@ -16,6 +17,7 @@ __all__ = [
16
17
  "get_activation_factory",
17
18
  "hresult_error",
18
19
  "initialize_with_window",
20
+ "interface_pointer",
19
21
  "wrap_interface",
20
22
  ]
21
23
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: winrt-runtime
3
- Version: 4.1.0
3
+ Version: 4.2.0
4
4
  Summary: The runtime that every PyWinRT projection package runs on
5
5
  License-Expression: MIT
6
6
  Project-URL: Documentation, https://pywinrt.readthedocs.io
@@ -731,7 +731,21 @@ namespace py::cpp::_winrt
731
731
  static PyObject* uninit_apartment(
732
732
  PyObject* /*unused*/, PyObject* /*unused*/) noexcept
733
733
  {
734
- winrt::uninit_apartment();
734
+ // The last CoUninitialize() of the process unloads the DLLs that
735
+ // implement the classes, so a factory kept past it would point into
736
+ // code that is no longer there. The runtime's own are let go of first,
737
+ // and so are the ones C++/WinRT keeps, which boxing a value asks for.
738
+ if (!py::interp::release_factories())
739
+ {
740
+ return nullptr;
741
+ }
742
+
743
+ {
744
+ auto _gil = py::release_gil();
745
+ winrt::clear_factory_cache();
746
+ winrt::uninit_apartment();
747
+ }
748
+
735
749
  Py_RETURN_NONE;
736
750
  }
737
751
 
@@ -927,6 +941,7 @@ namespace py::cpp::_winrt
927
941
  std::destroy_at(&state->type_entries);
928
942
  std::destroy_at(&state->generic_types);
929
943
  std::destroy_at(&state->buffer_exports);
944
+ std::destroy_at(&state->kept_factories);
930
945
 
931
946
  std::destroy_at(&state->projections);
932
947
  }
@@ -969,6 +984,7 @@ namespace py::cpp::_winrt
969
984
  PyObject* as_interface(PyObject* /*unused*/, PyObject* args) noexcept;
970
985
  PyObject* get_activation_factory(PyObject* /*unused*/, PyObject* args) noexcept;
971
986
  PyObject* wrap_interface(PyObject* /*unused*/, PyObject* args) noexcept;
987
+ PyObject* interface_pointer(PyObject* /*unused*/, PyObject* obj) noexcept;
972
988
  PyObject* hresult_error(PyObject* /*unused*/, PyObject* args) noexcept;
973
989
 
974
990
  static PyMethodDef module_methods[]{
@@ -1058,6 +1074,13 @@ namespace py::cpp::_winrt
1058
1074
  wrap_interface,
1059
1075
  METH_VARARGS,
1060
1076
  PyDoc_STR("The WinRT object an interface pointer capsule holds.")},
1077
+ {"interface_pointer",
1078
+ interface_pointer,
1079
+ METH_O,
1080
+ PyDoc_STR(
1081
+ "The raw COM pointer an object holds, as an int. It is borrowed: no "
1082
+ "reference is added, it is valid only while the object is alive, and "
1083
+ "a receiver that keeps it must AddRef() it.")},
1061
1084
  {"hresult_error",
1062
1085
  hresult_error,
1063
1086
  METH_VARARGS,
@@ -1089,6 +1112,7 @@ namespace py::cpp::_winrt
1089
1112
  std::construct_at(&state->type_entries);
1090
1113
  std::construct_at(&state->generic_types);
1091
1114
  std::construct_at(&state->buffer_exports);
1115
+ std::construct_at(&state->kept_factories);
1092
1116
 
1093
1117
  // The slot below says the same, but CPython only enforces it in an
1094
1118
  // interpreter configured to check, which a legacy subinterpreter on a
@@ -186,6 +186,14 @@ WINRT_EXPORT namespace winrt::Windows::System
186
186
  Unknown = 3,
187
187
  Ambiguous = 4,
188
188
  };
189
+ enum class UserAgeVerificationStatus : std::int32_t
190
+ {
191
+ NotApplicable = 0,
192
+ TemporarilyUnavailable = 1,
193
+ Unverified = 2,
194
+ OptedOut = 3,
195
+ Verified = 4,
196
+ };
189
197
  enum class UserAuthenticationStatus : std::int32_t
190
198
  {
191
199
  Unauthenticated = 0,
@@ -473,6 +481,8 @@ WINRT_EXPORT namespace winrt::Windows::System
473
481
  struct ITimeZoneSettingsStatics2;
474
482
  struct IUser;
475
483
  struct IUser2;
484
+ struct IUser3;
485
+ struct IUserAgeRange;
476
486
  struct IUserAuthenticationStatusChangeDeferral;
477
487
  struct IUserAuthenticationStatusChangingEventArgs;
478
488
  struct IUserChangedEventArgs;
@@ -523,6 +533,7 @@ WINRT_EXPORT namespace winrt::Windows::System
523
533
  struct ShutdownManager;
524
534
  struct TimeZoneSettings;
525
535
  struct User;
536
+ struct UserAgeRange;
526
537
  struct UserAuthenticationStatusChangeDeferral;
527
538
  struct UserAuthenticationStatusChangingEventArgs;
528
539
  struct UserChangedEventArgs;
@@ -604,6 +615,8 @@ WINRT_EXPORT namespace winrt::impl
604
615
  template <> struct category<winrt::Windows::System::ITimeZoneSettingsStatics2>{ using type = interface_category; };
605
616
  template <> struct category<winrt::Windows::System::IUser>{ using type = interface_category; };
606
617
  template <> struct category<winrt::Windows::System::IUser2>{ using type = interface_category; };
618
+ template <> struct category<winrt::Windows::System::IUser3>{ using type = interface_category; };
619
+ template <> struct category<winrt::Windows::System::IUserAgeRange>{ using type = interface_category; };
607
620
  template <> struct category<winrt::Windows::System::IUserAuthenticationStatusChangeDeferral>{ using type = interface_category; };
608
621
  template <> struct category<winrt::Windows::System::IUserAuthenticationStatusChangingEventArgs>{ using type = interface_category; };
609
622
  template <> struct category<winrt::Windows::System::IUserChangedEventArgs>{ using type = interface_category; };
@@ -654,6 +667,7 @@ WINRT_EXPORT namespace winrt::impl
654
667
  template <> struct category<winrt::Windows::System::ShutdownManager>{ using type = class_category; };
655
668
  template <> struct category<winrt::Windows::System::TimeZoneSettings>{ using type = class_category; };
656
669
  template <> struct category<winrt::Windows::System::User>{ using type = class_category; };
670
+ template <> struct category<winrt::Windows::System::UserAgeRange>{ using type = class_category; };
657
671
  template <> struct category<winrt::Windows::System::UserAuthenticationStatusChangeDeferral>{ using type = class_category; };
658
672
  template <> struct category<winrt::Windows::System::UserAuthenticationStatusChangingEventArgs>{ using type = class_category; };
659
673
  template <> struct category<winrt::Windows::System::UserChangedEventArgs>{ using type = class_category; };
@@ -679,6 +693,7 @@ WINRT_EXPORT namespace winrt::impl
679
693
  template <> struct category<winrt::Windows::System::ShutdownKind>{ using type = enum_category; };
680
694
  template <> struct category<winrt::Windows::System::UserAgeConsentGroup>{ using type = enum_category; };
681
695
  template <> struct category<winrt::Windows::System::UserAgeConsentResult>{ using type = enum_category; };
696
+ template <> struct category<winrt::Windows::System::UserAgeVerificationStatus>{ using type = enum_category; };
682
697
  template <> struct category<winrt::Windows::System::UserAuthenticationStatus>{ using type = enum_category; };
683
698
  template <> struct category<winrt::Windows::System::UserPictureSize>{ using type = enum_category; };
684
699
  template <> struct category<winrt::Windows::System::UserType>{ using type = enum_category; };
@@ -726,6 +741,7 @@ WINRT_EXPORT namespace winrt::impl
726
741
  template <> inline constexpr auto& name_v<winrt::Windows::System::ShutdownManager> = L"Windows.System.ShutdownManager";
727
742
  template <> inline constexpr auto& name_v<winrt::Windows::System::TimeZoneSettings> = L"Windows.System.TimeZoneSettings";
728
743
  template <> inline constexpr auto& name_v<winrt::Windows::System::User> = L"Windows.System.User";
744
+ template <> inline constexpr auto& name_v<winrt::Windows::System::UserAgeRange> = L"Windows.System.UserAgeRange";
729
745
  template <> inline constexpr auto& name_v<winrt::Windows::System::UserAuthenticationStatusChangeDeferral> = L"Windows.System.UserAuthenticationStatusChangeDeferral";
730
746
  template <> inline constexpr auto& name_v<winrt::Windows::System::UserAuthenticationStatusChangingEventArgs> = L"Windows.System.UserAuthenticationStatusChangingEventArgs";
731
747
  template <> inline constexpr auto& name_v<winrt::Windows::System::UserChangedEventArgs> = L"Windows.System.UserChangedEventArgs";
@@ -751,6 +767,7 @@ WINRT_EXPORT namespace winrt::impl
751
767
  template <> inline constexpr auto& name_v<winrt::Windows::System::ShutdownKind> = L"Windows.System.ShutdownKind";
752
768
  template <> inline constexpr auto& name_v<winrt::Windows::System::UserAgeConsentGroup> = L"Windows.System.UserAgeConsentGroup";
753
769
  template <> inline constexpr auto& name_v<winrt::Windows::System::UserAgeConsentResult> = L"Windows.System.UserAgeConsentResult";
770
+ template <> inline constexpr auto& name_v<winrt::Windows::System::UserAgeVerificationStatus> = L"Windows.System.UserAgeVerificationStatus";
754
771
  template <> inline constexpr auto& name_v<winrt::Windows::System::UserAuthenticationStatus> = L"Windows.System.UserAuthenticationStatus";
755
772
  template <> inline constexpr auto& name_v<winrt::Windows::System::UserPictureSize> = L"Windows.System.UserPictureSize";
756
773
  template <> inline constexpr auto& name_v<winrt::Windows::System::UserType> = L"Windows.System.UserType";
@@ -827,6 +844,8 @@ WINRT_EXPORT namespace winrt::impl
827
844
  template <> inline constexpr auto& name_v<winrt::Windows::System::ITimeZoneSettingsStatics2> = L"Windows.System.ITimeZoneSettingsStatics2";
828
845
  template <> inline constexpr auto& name_v<winrt::Windows::System::IUser> = L"Windows.System.IUser";
829
846
  template <> inline constexpr auto& name_v<winrt::Windows::System::IUser2> = L"Windows.System.IUser2";
847
+ template <> inline constexpr auto& name_v<winrt::Windows::System::IUser3> = L"Windows.System.IUser3";
848
+ template <> inline constexpr auto& name_v<winrt::Windows::System::IUserAgeRange> = L"Windows.System.IUserAgeRange";
830
849
  template <> inline constexpr auto& name_v<winrt::Windows::System::IUserAuthenticationStatusChangeDeferral> = L"Windows.System.IUserAuthenticationStatusChangeDeferral";
831
850
  template <> inline constexpr auto& name_v<winrt::Windows::System::IUserAuthenticationStatusChangingEventArgs> = L"Windows.System.IUserAuthenticationStatusChangingEventArgs";
832
851
  template <> inline constexpr auto& name_v<winrt::Windows::System::IUserChangedEventArgs> = L"Windows.System.IUserChangedEventArgs";
@@ -909,6 +928,8 @@ WINRT_EXPORT namespace winrt::impl
909
928
  template <> inline constexpr guid guid_v<winrt::Windows::System::ITimeZoneSettingsStatics2>{ 0x555C0DB8,0x39A8,0x49FA,{ 0xB4,0xF6,0xA2,0xC7,0xFC,0x28,0x42,0xEC } }; // 555C0DB8-39A8-49FA-B4F6-A2C7FC2842EC
910
929
  template <> inline constexpr guid guid_v<winrt::Windows::System::IUser>{ 0xDF9A26C6,0xE746,0x4BCD,{ 0xB5,0xD4,0x12,0x01,0x03,0xC4,0x20,0x9B } }; // DF9A26C6-E746-4BCD-B5D4-120103C4209B
911
930
  template <> inline constexpr guid guid_v<winrt::Windows::System::IUser2>{ 0x98BA5628,0xA6E3,0x518E,{ 0x89,0xD9,0xD3,0xB2,0xB1,0x99,0x1A,0x10 } }; // 98BA5628-A6E3-518E-89D9-D3B2B1991A10
931
+ template <> inline constexpr guid guid_v<winrt::Windows::System::IUser3>{ 0x520E18E2,0xF00D,0x53D1,{ 0xA9,0xF6,0x88,0xC6,0x97,0x56,0x1D,0xC0 } }; // 520E18E2-F00D-53D1-A9F6-88C697561DC0
932
+ template <> inline constexpr guid guid_v<winrt::Windows::System::IUserAgeRange>{ 0xD002FFCA,0x8130,0x5F64,{ 0xBE,0x0F,0xE6,0x6A,0xDB,0x64,0xDD,0x12 } }; // D002FFCA-8130-5F64-BE0F-E66ADB64DD12
912
933
  template <> inline constexpr guid guid_v<winrt::Windows::System::IUserAuthenticationStatusChangeDeferral>{ 0x88B59568,0xBB30,0x42FB,{ 0xA2,0x70,0xE9,0x90,0x2E,0x40,0xEF,0xA7 } }; // 88B59568-BB30-42FB-A270-E9902E40EFA7
913
934
  template <> inline constexpr guid guid_v<winrt::Windows::System::IUserAuthenticationStatusChangingEventArgs>{ 0x8C030F28,0xA711,0x4C1E,{ 0xAB,0x48,0x04,0x17,0x9C,0x15,0x93,0x8F } }; // 8C030F28-A711-4C1E-AB48-04179C15938F
914
935
  template <> inline constexpr guid guid_v<winrt::Windows::System::IUserChangedEventArgs>{ 0x086459DC,0x18C6,0x48DB,{ 0xBC,0x99,0x72,0x4F,0xB9,0x20,0x3C,0xCC } }; // 086459DC-18C6-48DB-BC99-724FB9203CCC
@@ -952,6 +973,7 @@ WINRT_EXPORT namespace winrt::impl
952
973
  template <> struct default_interface<winrt::Windows::System::ProtocolForResultsOperation>{ using type = winrt::Windows::System::IProtocolForResultsOperation; };
953
974
  template <> struct default_interface<winrt::Windows::System::RemoteLauncherOptions>{ using type = winrt::Windows::System::IRemoteLauncherOptions; };
954
975
  template <> struct default_interface<winrt::Windows::System::User>{ using type = winrt::Windows::System::IUser; };
976
+ template <> struct default_interface<winrt::Windows::System::UserAgeRange>{ using type = winrt::Windows::System::IUserAgeRange; };
955
977
  template <> struct default_interface<winrt::Windows::System::UserAuthenticationStatusChangeDeferral>{ using type = winrt::Windows::System::IUserAuthenticationStatusChangeDeferral; };
956
978
  template <> struct default_interface<winrt::Windows::System::UserAuthenticationStatusChangingEventArgs>{ using type = winrt::Windows::System::IUserAuthenticationStatusChangingEventArgs; };
957
979
  template <> struct default_interface<winrt::Windows::System::UserChangedEventArgs>{ using type = winrt::Windows::System::IUserChangedEventArgs; };
@@ -1602,6 +1624,22 @@ WINRT_EXPORT namespace winrt::impl
1602
1624
  virtual std::int32_t __stdcall CheckUserAgeConsentGroupAsync(std::int32_t, void**) noexcept = 0;
1603
1625
  };
1604
1626
  };
1627
+ template <> struct abi<winrt::Windows::System::IUser3>
1628
+ {
1629
+ struct WINRT_IMPL_ABI_DECL type : inspectable_abi
1630
+ {
1631
+ virtual std::int32_t __stdcall GetUserAgeRangeAsync(void**) noexcept = 0;
1632
+ virtual std::int32_t __stdcall GetAgeVerificationStatusAsync(void**) noexcept = 0;
1633
+ };
1634
+ };
1635
+ template <> struct abi<winrt::Windows::System::IUserAgeRange>
1636
+ {
1637
+ struct WINRT_IMPL_ABI_DECL type : inspectable_abi
1638
+ {
1639
+ virtual std::int32_t __stdcall get_Lower(std::int32_t*) noexcept = 0;
1640
+ virtual std::int32_t __stdcall get_Upper(std::int32_t*) noexcept = 0;
1641
+ };
1642
+ };
1605
1643
  template <> struct abi<winrt::Windows::System::IUserAuthenticationStatusChangeDeferral>
1606
1644
  {
1607
1645
  struct WINRT_IMPL_ABI_DECL type : inspectable_abi
@@ -2530,6 +2568,26 @@ WINRT_EXPORT namespace winrt::impl
2530
2568
  template <typename D> using type = consume_Windows_System_IUser2<D>;
2531
2569
  };
2532
2570
  template <typename D>
2571
+ struct consume_Windows_System_IUser3
2572
+ {
2573
+ auto GetUserAgeRangeAsync() const;
2574
+ auto GetAgeVerificationStatusAsync() const;
2575
+ };
2576
+ template <> struct consume<winrt::Windows::System::IUser3>
2577
+ {
2578
+ template <typename D> using type = consume_Windows_System_IUser3<D>;
2579
+ };
2580
+ template <typename D>
2581
+ struct consume_Windows_System_IUserAgeRange
2582
+ {
2583
+ [[nodiscard]] auto Lower() const;
2584
+ [[nodiscard]] auto Upper() const;
2585
+ };
2586
+ template <> struct consume<winrt::Windows::System::IUserAgeRange>
2587
+ {
2588
+ template <typename D> using type = consume_Windows_System_IUserAgeRange<D>;
2589
+ };
2590
+ template <typename D>
2533
2591
  struct consume_Windows_System_IUserAuthenticationStatusChangeDeferral
2534
2592
  {
2535
2593
  auto Complete() const;
@@ -492,6 +492,20 @@ WINRT_EXPORT namespace winrt::Windows::System
492
492
  IUser2(std::nullptr_t = nullptr) noexcept {}
493
493
  IUser2(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
494
494
  };
495
+ struct WINRT_IMPL_EMPTY_BASES IUser3 :
496
+ winrt::Windows::Foundation::IInspectable,
497
+ impl::consume_t<IUser3>
498
+ {
499
+ IUser3(std::nullptr_t = nullptr) noexcept {}
500
+ IUser3(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
501
+ };
502
+ struct WINRT_IMPL_EMPTY_BASES IUserAgeRange :
503
+ winrt::Windows::Foundation::IInspectable,
504
+ impl::consume_t<IUserAgeRange>
505
+ {
506
+ IUserAgeRange(std::nullptr_t = nullptr) noexcept {}
507
+ IUserAgeRange(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
508
+ };
495
509
  struct WINRT_IMPL_EMPTY_BASES IUserAuthenticationStatusChangeDeferral :
496
510
  winrt::Windows::Foundation::IInspectable,
497
511
  impl::consume_t<IUserAuthenticationStatusChangeDeferral>
@@ -308,7 +308,7 @@ WINRT_EXPORT namespace winrt::Windows::System
308
308
  static auto AutoUpdateTimeZoneAsync(winrt::Windows::Foundation::TimeSpan const& timeout);
309
309
  };
310
310
  struct WINRT_IMPL_EMPTY_BASES User : winrt::Windows::System::IUser,
311
- impl::require<User, winrt::Windows::System::IUser2>
311
+ impl::require<User, winrt::Windows::System::IUser2, winrt::Windows::System::IUser3>
312
312
  {
313
313
  User(std::nullptr_t) noexcept {}
314
314
  User(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::System::IUser(ptr, take_ownership_from_abi) {}
@@ -319,6 +319,11 @@ WINRT_EXPORT namespace winrt::Windows::System
319
319
  static auto GetFromId(param::hstring const& nonRoamableId);
320
320
  static auto GetDefault();
321
321
  };
322
+ struct WINRT_IMPL_EMPTY_BASES UserAgeRange : winrt::Windows::System::IUserAgeRange
323
+ {
324
+ UserAgeRange(std::nullptr_t) noexcept {}
325
+ UserAgeRange(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::System::IUserAgeRange(ptr, take_ownership_from_abi) {}
326
+ };
322
327
  struct WINRT_IMPL_EMPTY_BASES UserAuthenticationStatusChangeDeferral : winrt::Windows::System::IUserAuthenticationStatusChangeDeferral
323
328
  {
324
329
  UserAuthenticationStatusChangeDeferral(std::nullptr_t) noexcept {}