winrt-runtime 4.2.0__tar.gz → 4.2.1__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.
- {winrt_runtime-4.2.0/python/winrt_runtime.egg-info → winrt_runtime-4.2.1}/PKG-INFO +2 -2
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/_winrt.pyi +2 -2
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1/python/winrt_runtime.egg-info}/PKG-INFO +2 -2
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt_runtime.egg-info/SOURCES.txt +1 -0
- winrt_runtime-4.2.1/python/winrt_runtime.egg-info/requires.txt +1 -0
- winrt_runtime-4.2.1/requirements.txt +1 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/_winrt.cpp +20 -84
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/_winrt_array.h +2 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/_winrt_box.cpp +2 -0
- winrt_runtime-4.2.1/src/_winrt_box.h +44 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/_winrt_buffer.cpp +108 -1
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/errors.cpp +2 -11
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/abi.h +2 -4
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/errors.h +9 -5
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/interp.cpp +6 -59
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/interp.h +5 -4
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/members.cpp +88 -41
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/members.h +4 -1
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/module_state.h +22 -14
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/objects.h +11 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/table.cpp +4 -4
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/table.h +9 -0
- winrt_runtime-4.2.1/version.txt +1 -0
- winrt_runtime-4.2.0/python/winrt_runtime.egg-info/requires.txt +0 -1
- winrt_runtime-4.2.0/requirements.txt +0 -1
- winrt_runtime-4.2.0/version.txt +0 -1
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/LICENSE +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/MANIFEST.in +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/README.md +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/pyproject.toml +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/__pyinstaller/__init__.py +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/__pyinstaller/hook-winrt.py +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/py.typed +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/runtime/__init__.py +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/runtime/_internals.py +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/runtime/interop.py +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/runtime/py.typed +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/system/__init__.py +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/system/hresult.py +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt/system/py.typed +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt_runtime.egg-info/dependency_links.txt +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt_runtime.egg-info/entry_points.txt +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/python/winrt_runtime.egg-info/top_level.txt +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/setup.cfg +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/setup.py +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/_winrt_array.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/_winrt_buffer.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/arrays.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/arrays.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/async.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/async.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/callbacks.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/callbacks.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/collections.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/collections.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/compose.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/compose.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/delegates.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/delegates.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/enums.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/enums.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/generics.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/generics.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/handles.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/implements.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/implements.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/Windows.Foundation.Collections.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/Windows.Foundation.Metadata.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/Windows.Foundation.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/Windows.Storage.Streams.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/Windows.Storage.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/base.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/base_macros.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Devices.Geolocation.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Devices.Geolocation.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Foundation.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Foundation.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Foundation.2.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Collections.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Collections.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Collections.2.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Metadata.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Metadata.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Foundation.Metadata.2.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.2.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.FileProperties.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.FileProperties.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.FileProperties.2.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.Provider.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.Provider.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.Provider.2.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.Search.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.Search.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.Search.2.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.Streams.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.Streams.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.Storage.Streams.2.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.System.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.System.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.System.2.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.System.RemoteSystems.0.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/cppwinrt/winrt/impl/Windows.System.RemoteSystems.1.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pythoncapi_compat.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/array.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/async.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/base.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/buffer.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/convert.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/handles.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/prelude.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/throw_helpers.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/traits.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/include/pywinrt/wrappers.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/metaclass.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/numerics-buffer.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/numerics-buffer.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/numerics-statics.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/numerics-statics.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/numerics-traits.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/numerics-values.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/numerics.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/numerics.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/objects.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/protocols.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/protocols.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/pycollections.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/pycollections.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/pymapping.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/pymapping.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/pysequence.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/pysequence.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/runtime.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/runtime.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/shapes-generated.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/shapes.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/shapes.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/structs.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/structs.h +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/types.cpp +0 -0
- {winrt_runtime-4.2.0 → winrt_runtime-4.2.1}/src/types.h +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: winrt-runtime
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.1
|
|
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
|
|
@@ -20,7 +20,7 @@ Classifier: Typing :: Typed
|
|
|
20
20
|
Requires-Python: >=3.11
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: typing_extensions>=4.
|
|
23
|
+
Requires-Dist: typing_extensions>=4.13.0
|
|
24
24
|
Dynamic: license-file
|
|
25
25
|
|
|
26
26
|
# winrt-runtime
|
|
@@ -82,8 +82,8 @@ def unbox_date_time(value: Object, /) -> datetime: ...
|
|
|
82
82
|
def unbox_time_span(value: Object, /) -> timedelta: ...
|
|
83
83
|
|
|
84
84
|
# Reads a projection table and returns its contents as plain Python objects, so
|
|
85
|
-
# that test/test_table.py can check that the generator's writer and
|
|
86
|
-
# module's reader agree on the format. The shape of the result follows
|
|
85
|
+
# that test/projection/test_table.py can check that the generator's writer and
|
|
86
|
+
# this module's reader agree on the format. The shape of the result follows
|
|
87
87
|
# runtime/src/table-format.md rather than a type of its own.
|
|
88
88
|
def read_table(data: Buffer, /) -> dict[str, Any]: ...
|
|
89
89
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: winrt-runtime
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.1
|
|
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
|
|
@@ -20,7 +20,7 @@ Classifier: Typing :: Typed
|
|
|
20
20
|
Requires-Python: >=3.11
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: typing_extensions>=4.
|
|
23
|
+
Requires-Dist: typing_extensions>=4.13.0
|
|
24
24
|
Dynamic: license-file
|
|
25
25
|
|
|
26
26
|
# winrt-runtime
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
typing_extensions>=4.13.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
typing_extensions>=4.13.0
|
|
@@ -8,10 +8,13 @@
|
|
|
8
8
|
#include <libloaderapi.h>
|
|
9
9
|
|
|
10
10
|
#include <pywinrt/base.h>
|
|
11
|
+
#include "_winrt_array.h"
|
|
12
|
+
#include "_winrt_box.h"
|
|
11
13
|
#include "module_state.h"
|
|
12
14
|
#include "implements.h"
|
|
13
15
|
#include "members.h"
|
|
14
16
|
#include "objects.h"
|
|
17
|
+
#include "table.h"
|
|
15
18
|
#include "types.h"
|
|
16
19
|
#include <winrt/base.h>
|
|
17
20
|
|
|
@@ -555,12 +558,6 @@ namespace py::cpp::_winrt
|
|
|
555
558
|
|
|
556
559
|
// END: class _winrt.Object:
|
|
557
560
|
|
|
558
|
-
// BEGIN: class _winrt.Array:
|
|
559
|
-
|
|
560
|
-
extern PyType_Spec Array_type_spec;
|
|
561
|
-
|
|
562
|
-
// END: class _winrt.Array:
|
|
563
|
-
|
|
564
561
|
// BEGIN: class _winrt.MappingIter:
|
|
565
562
|
|
|
566
563
|
// This class is used to wrap the iterator returned by IMap/IMapView so
|
|
@@ -860,6 +857,15 @@ namespace py::cpp::_winrt
|
|
|
860
857
|
*/
|
|
861
858
|
static std::atomic<module_state*> main_state{};
|
|
862
859
|
|
|
860
|
+
/**
|
|
861
|
+
* Lets go of wrap_async_func, the one reference the state owns that is not
|
|
862
|
+
* a handle. The members go after it, in the reverse of their order.
|
|
863
|
+
*/
|
|
864
|
+
module_state::~module_state()
|
|
865
|
+
{
|
|
866
|
+
Py_XDECREF(wrap_async_func);
|
|
867
|
+
}
|
|
868
|
+
|
|
863
869
|
static int module_traverse(PyObject* module, visitproc visit, void* arg) noexcept
|
|
864
870
|
{
|
|
865
871
|
auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
|
|
@@ -927,66 +933,9 @@ namespace py::cpp::_winrt
|
|
|
927
933
|
main_state.compare_exchange_strong(
|
|
928
934
|
expected, nullptr, std::memory_order_acq_rel);
|
|
929
935
|
|
|
930
|
-
std::destroy_at(
|
|
931
|
-
std::destroy_at(&state->object_type);
|
|
932
|
-
std::destroy_at(&state->array_type);
|
|
933
|
-
std::destroy_at(&state->mapping_iter_type);
|
|
934
|
-
std::destroy_at(&state->projected_method_type);
|
|
935
|
-
std::destroy_at(&state->to_uuid_func);
|
|
936
|
-
std::destroy_at(&state->uuid_type);
|
|
937
|
-
Py_XDECREF(state->wrap_async_func);
|
|
938
|
-
|
|
939
|
-
std::destroy_at(&state->type_cache);
|
|
940
|
-
|
|
941
|
-
std::destroy_at(&state->type_entries);
|
|
942
|
-
std::destroy_at(&state->generic_types);
|
|
943
|
-
std::destroy_at(&state->buffer_exports);
|
|
944
|
-
std::destroy_at(&state->kept_factories);
|
|
945
|
-
|
|
946
|
-
std::destroy_at(&state->projections);
|
|
936
|
+
std::destroy_at(state);
|
|
947
937
|
}
|
|
948
938
|
|
|
949
|
-
// Not using a header file for thes because setuptools doesn't have a nice
|
|
950
|
-
// way to pick up private header files.
|
|
951
|
-
PyObject* box_boolean(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
952
|
-
PyObject* box_int8(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
953
|
-
PyObject* box_uint8(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
954
|
-
PyObject* box_int16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
955
|
-
PyObject* box_uint16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
956
|
-
PyObject* box_int32(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
957
|
-
PyObject* box_uint32(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
958
|
-
PyObject* box_int64(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
959
|
-
PyObject* box_uint64(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
960
|
-
PyObject* box_single(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
961
|
-
PyObject* box_double(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
962
|
-
PyObject* box_char16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
963
|
-
PyObject* box_string(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
964
|
-
PyObject* box_guid(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
965
|
-
PyObject* box_date_time(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
966
|
-
PyObject* box_time_span(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
967
|
-
PyObject* unbox_boolean(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
968
|
-
PyObject* unbox_int8(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
969
|
-
PyObject* unbox_uint8(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
970
|
-
PyObject* unbox_int16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
971
|
-
PyObject* unbox_uint16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
972
|
-
PyObject* unbox_int32(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
973
|
-
PyObject* unbox_uint32(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
974
|
-
PyObject* unbox_int64(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
975
|
-
PyObject* unbox_uint64(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
976
|
-
PyObject* unbox_single(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
977
|
-
PyObject* unbox_double(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
978
|
-
PyObject* unbox_char16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
979
|
-
PyObject* unbox_string(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
980
|
-
PyObject* unbox_guid(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
981
|
-
PyObject* unbox_date_time(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
982
|
-
PyObject* unbox_time_span(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
983
|
-
PyObject* read_table(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
984
|
-
PyObject* as_interface(PyObject* /*unused*/, PyObject* args) noexcept;
|
|
985
|
-
PyObject* get_activation_factory(PyObject* /*unused*/, PyObject* args) noexcept;
|
|
986
|
-
PyObject* wrap_interface(PyObject* /*unused*/, PyObject* args) noexcept;
|
|
987
|
-
PyObject* interface_pointer(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
988
|
-
PyObject* hresult_error(PyObject* /*unused*/, PyObject* args) noexcept;
|
|
989
|
-
|
|
990
939
|
static PyMethodDef module_methods[]{
|
|
991
940
|
{"init_apartment", init_apartment, METH_O, "initialize the apartment"},
|
|
992
941
|
{"uninit_apartment",
|
|
@@ -1054,8 +1003,8 @@ namespace py::cpp::_winrt
|
|
|
1054
1003
|
METH_O,
|
|
1055
1004
|
PyDoc_STR(
|
|
1056
1005
|
"Reads a projection table and returns its contents as plain Python objects. "
|
|
1057
|
-
"This is how test/test_table.py checks that the generator's
|
|
1058
|
-
"runtime's reader agree on the format.")},
|
|
1006
|
+
"This is how test/projection/test_table.py checks that the generator's "
|
|
1007
|
+
"writer and the runtime's reader agree on the format.")},
|
|
1059
1008
|
{"as_interface",
|
|
1060
1009
|
as_interface,
|
|
1061
1010
|
METH_VARARGS,
|
|
@@ -1096,23 +1045,11 @@ namespace py::cpp::_winrt
|
|
|
1096
1045
|
static const auto kSTA
|
|
1097
1046
|
= static_cast<long>(winrt::apartment_type::single_threaded);
|
|
1098
1047
|
|
|
1099
|
-
// CPython allocates the state
|
|
1100
|
-
//
|
|
1101
|
-
//
|
|
1102
|
-
auto state =
|
|
1103
|
-
|
|
1104
|
-
std::construct_at(&state->object_type);
|
|
1105
|
-
std::construct_at(&state->array_type);
|
|
1106
|
-
std::construct_at(&state->mapping_iter_type);
|
|
1107
|
-
std::construct_at(&state->projected_method_type);
|
|
1108
|
-
std::construct_at(&state->to_uuid_func);
|
|
1109
|
-
std::construct_at(&state->uuid_type);
|
|
1110
|
-
std::construct_at(&state->type_cache);
|
|
1111
|
-
std::construct_at(&state->projections);
|
|
1112
|
-
std::construct_at(&state->type_entries);
|
|
1113
|
-
std::construct_at(&state->generic_types);
|
|
1114
|
-
std::construct_at(&state->buffer_exports);
|
|
1115
|
-
std::construct_at(&state->kept_factories);
|
|
1048
|
+
// CPython allocates the state just before this runs, and does not call
|
|
1049
|
+
// traverse, clear or free before it has, so constructing it first is
|
|
1050
|
+
// what lets those three assume it.
|
|
1051
|
+
auto state = std::construct_at(
|
|
1052
|
+
reinterpret_cast<module_state*>(PyModule_GetState(module)));
|
|
1116
1053
|
|
|
1117
1054
|
// The slot below says the same, but CPython only enforces it in an
|
|
1118
1055
|
// interpreter configured to check, which a legacy subinterpreter on a
|
|
@@ -1193,7 +1130,6 @@ namespace py::cpp::_winrt
|
|
|
1193
1130
|
state->projected_method_type = std::move(projected_method_type);
|
|
1194
1131
|
state->to_uuid_func = std::move(to_uuid_func);
|
|
1195
1132
|
state->uuid_type = std::move(uuid_type);
|
|
1196
|
-
state->wrap_async_func = nullptr; // lazy-initialized
|
|
1197
1133
|
|
|
1198
1134
|
main_state.store(state, std::memory_order_release);
|
|
1199
1135
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Boxing a Python value as the IReference<T> that WinRT takes where a parameter
|
|
2
|
+
// is an Object, and unboxing one: winrt._winrt.box_*() and unbox_*(), which
|
|
3
|
+
// winrt.system exports.
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include <Python.h>
|
|
8
|
+
|
|
9
|
+
namespace py::cpp::_winrt
|
|
10
|
+
{
|
|
11
|
+
PyObject* box_boolean(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
12
|
+
PyObject* box_int8(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
13
|
+
PyObject* box_uint8(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
14
|
+
PyObject* box_int16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
15
|
+
PyObject* box_uint16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
16
|
+
PyObject* box_int32(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
17
|
+
PyObject* box_uint32(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
18
|
+
PyObject* box_int64(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
19
|
+
PyObject* box_uint64(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
20
|
+
PyObject* box_single(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
21
|
+
PyObject* box_double(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
22
|
+
PyObject* box_char16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
23
|
+
PyObject* box_string(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
24
|
+
PyObject* box_guid(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
25
|
+
PyObject* box_date_time(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
26
|
+
PyObject* box_time_span(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
27
|
+
|
|
28
|
+
PyObject* unbox_boolean(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
29
|
+
PyObject* unbox_int8(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
30
|
+
PyObject* unbox_uint8(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
31
|
+
PyObject* unbox_int16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
32
|
+
PyObject* unbox_uint16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
33
|
+
PyObject* unbox_int32(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
34
|
+
PyObject* unbox_uint32(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
35
|
+
PyObject* unbox_int64(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
36
|
+
PyObject* unbox_uint64(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
37
|
+
PyObject* unbox_single(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
38
|
+
PyObject* unbox_double(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
39
|
+
PyObject* unbox_char16(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
40
|
+
PyObject* unbox_string(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
41
|
+
PyObject* unbox_guid(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
42
|
+
PyObject* unbox_date_time(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
43
|
+
PyObject* unbox_time_span(PyObject* /*unused*/, PyObject* obj) noexcept;
|
|
44
|
+
} // namespace py::cpp::_winrt
|
|
@@ -38,13 +38,56 @@ __CRT_UUID_DECL(
|
|
|
38
38
|
|
|
39
39
|
namespace py::cpp::_winrt
|
|
40
40
|
{
|
|
41
|
+
/**
|
|
42
|
+
* A Python buffer as an IBuffer.
|
|
43
|
+
*
|
|
44
|
+
* It marshals by value, as Windows.Storage.Streams.Buffer does, rather than
|
|
45
|
+
* with the free-threaded marshaler that C++/WinRT gives an object by
|
|
46
|
+
* default. A buffer passed to a service in another process, as a GATT write
|
|
47
|
+
* passes its value to the Bluetooth service, then arrives there as a copy
|
|
48
|
+
* of its bytes. Marshaled by reference, it arrives as a proxy, the service
|
|
49
|
+
* never reads through it, and the write fails with ACCESS_DENIED.
|
|
50
|
+
*
|
|
51
|
+
* COM calls the IMarshal methods on whatever thread marshals the buffer,
|
|
52
|
+
* and the buffer marshaler reads Length, Capacity and Buffer() there, in
|
|
53
|
+
* MarshalInterface, to copy the bytes. That thread need not hold the GIL,
|
|
54
|
+
* and the thread that does may be waiting for the call to return, so
|
|
55
|
+
* nothing here but final_release() takes the GIL or touches a Python
|
|
56
|
+
* object: the view is taken once, with the GIL, when the buffer is made,
|
|
57
|
+
* and holds the memory still until it is released, so its pointer and size
|
|
58
|
+
* are plain values that any thread may read, and the length is atomic. The
|
|
59
|
+
* view is released only when the last reference goes, on whatever thread
|
|
60
|
+
* that is, and final_release() takes the GIL for it as the runtime's other
|
|
61
|
+
* objects do.
|
|
62
|
+
*/
|
|
41
63
|
struct PyWinRTBuffer : winrt::implements<
|
|
42
64
|
PyWinRTBuffer,
|
|
43
65
|
winrt::Windows::Storage::Streams::IBuffer,
|
|
44
66
|
Windows::Storage::Streams::IBufferByteAccess,
|
|
45
|
-
IPywinrtBuffer
|
|
67
|
+
IPywinrtBuffer,
|
|
68
|
+
::IMarshal>
|
|
46
69
|
{
|
|
47
70
|
private:
|
|
71
|
+
/**
|
|
72
|
+
* Calls @p f with the marshaler that Windows provides for IBuffer
|
|
73
|
+
* implementations (RoGetBufferMarshaler), the one that
|
|
74
|
+
* Windows.Storage.Streams.Buffer and .NET's WindowsRuntimeBuffer use.
|
|
75
|
+
*
|
|
76
|
+
* It is asked for on every call rather than kept, so there is nothing
|
|
77
|
+
* for two threads to fill in at once, and it takes no GIL.
|
|
78
|
+
*/
|
|
79
|
+
template <typename F>
|
|
80
|
+
static HRESULT with_buffer_marshaler(F&& f) noexcept
|
|
81
|
+
{
|
|
82
|
+
winrt::com_ptr<::IMarshal> marshaler;
|
|
83
|
+
if (HRESULT const hr = ::RoGetBufferMarshaler(marshaler.put()); FAILED(hr))
|
|
84
|
+
{
|
|
85
|
+
return hr;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return f(marshaler.get());
|
|
89
|
+
}
|
|
90
|
+
|
|
48
91
|
py::buffer_view buffer;
|
|
49
92
|
/// How many of the bytes hold data: none at first for WinRT to fill,
|
|
50
93
|
/// all of them for it to read, and what a writer sets after it has
|
|
@@ -130,6 +173,70 @@ namespace py::cpp::_winrt
|
|
|
130
173
|
value = read_only;
|
|
131
174
|
return S_OK;
|
|
132
175
|
}
|
|
176
|
+
|
|
177
|
+
HRESULT __stdcall GetUnmarshalClass(
|
|
178
|
+
REFIID riid,
|
|
179
|
+
void* pv,
|
|
180
|
+
DWORD dest_context,
|
|
181
|
+
void* reserved,
|
|
182
|
+
DWORD flags,
|
|
183
|
+
CLSID* clsid) noexcept final
|
|
184
|
+
{
|
|
185
|
+
return with_buffer_marshaler([&](::IMarshal* marshaler) {
|
|
186
|
+
return marshaler->GetUnmarshalClass(
|
|
187
|
+
riid, pv, dest_context, reserved, flags, clsid);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
HRESULT __stdcall GetMarshalSizeMax(
|
|
192
|
+
REFIID riid,
|
|
193
|
+
void* pv,
|
|
194
|
+
DWORD dest_context,
|
|
195
|
+
void* reserved,
|
|
196
|
+
DWORD flags,
|
|
197
|
+
DWORD* size) noexcept final
|
|
198
|
+
{
|
|
199
|
+
return with_buffer_marshaler([&](::IMarshal* marshaler) {
|
|
200
|
+
return marshaler->GetMarshalSizeMax(
|
|
201
|
+
riid, pv, dest_context, reserved, flags, size);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
HRESULT __stdcall MarshalInterface(
|
|
206
|
+
IStream* stream,
|
|
207
|
+
REFIID riid,
|
|
208
|
+
void* pv,
|
|
209
|
+
DWORD dest_context,
|
|
210
|
+
void* reserved,
|
|
211
|
+
DWORD flags) noexcept final
|
|
212
|
+
{
|
|
213
|
+
return with_buffer_marshaler([&](::IMarshal* marshaler) {
|
|
214
|
+
return marshaler->MarshalInterface(
|
|
215
|
+
stream, riid, pv, dest_context, reserved, flags);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
HRESULT __stdcall UnmarshalInterface(
|
|
220
|
+
IStream* stream, REFIID riid, void** object) noexcept final
|
|
221
|
+
{
|
|
222
|
+
return with_buffer_marshaler([&](::IMarshal* marshaler) {
|
|
223
|
+
return marshaler->UnmarshalInterface(stream, riid, object);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
HRESULT __stdcall ReleaseMarshalData(IStream* stream) noexcept final
|
|
228
|
+
{
|
|
229
|
+
return with_buffer_marshaler([&](::IMarshal* marshaler) {
|
|
230
|
+
return marshaler->ReleaseMarshalData(stream);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
HRESULT __stdcall DisconnectObject(DWORD reserved) noexcept final
|
|
235
|
+
{
|
|
236
|
+
return with_buffer_marshaler([&](::IMarshal* marshaler) {
|
|
237
|
+
return marshaler->DisconnectObject(reserved);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
133
240
|
};
|
|
134
241
|
|
|
135
242
|
} // namespace py::cpp::_winrt
|
|
@@ -38,9 +38,6 @@ namespace
|
|
|
38
38
|
return "event";
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// The kind is read from another module, so it can hold a value this
|
|
42
|
-
// one does not know about, and calling that an event would be a
|
|
43
|
-
// guess rather than an answer.
|
|
44
41
|
return "member";
|
|
45
42
|
}
|
|
46
43
|
|
|
@@ -393,18 +390,12 @@ void py::set_member_not_available_error(py::member_not_available const& info) no
|
|
|
393
390
|
info.interface_name);
|
|
394
391
|
}
|
|
395
392
|
|
|
396
|
-
void py::set_call_error(
|
|
397
|
-
py::call_error error, py::member_site const* site, Py_ssize_t arg_count) noexcept
|
|
393
|
+
void py::set_call_error(py::call_error error, py::member_site const* site) noexcept
|
|
398
394
|
{
|
|
399
395
|
switch (error)
|
|
400
396
|
{
|
|
401
397
|
case call_error::invalid_arg_count:
|
|
402
|
-
|
|
403
|
-
// even count, which it only fails to do with a Python error already set
|
|
404
|
-
if (arg_count != -1)
|
|
405
|
-
{
|
|
406
|
-
PyErr_SetString(PyExc_TypeError, "invalid parameter count");
|
|
407
|
-
}
|
|
398
|
+
PyErr_SetString(PyExc_TypeError, "invalid parameter count");
|
|
408
399
|
break;
|
|
409
400
|
|
|
410
401
|
case call_error::keyword_arguments:
|
|
@@ -144,8 +144,7 @@ namespace py
|
|
|
144
144
|
*/
|
|
145
145
|
enum class call_error
|
|
146
146
|
{
|
|
147
|
-
/// No overload takes this many arguments.
|
|
148
|
-
/// alongside; -1 means a Python exception is already pending.
|
|
147
|
+
/// No overload takes this many arguments.
|
|
149
148
|
invalid_arg_count,
|
|
150
149
|
/// Keyword arguments were passed to a member that takes none.
|
|
151
150
|
keyword_arguments,
|
|
@@ -184,8 +183,7 @@ namespace py
|
|
|
184
183
|
void set_error(error_info const& info) noexcept;
|
|
185
184
|
PyObject* take_raised_exception() noexcept;
|
|
186
185
|
void restore_raised_exception(PyObject* exception) noexcept;
|
|
187
|
-
void set_call_error(
|
|
188
|
-
call_error error, member_site const* site, Py_ssize_t arg_count) noexcept;
|
|
186
|
+
void set_call_error(call_error error, member_site const* site) noexcept;
|
|
189
187
|
int32_t report_unraisable(PyObject* source) noexcept;
|
|
190
188
|
int32_t async_wait(
|
|
191
189
|
winrt::Windows::Foundation::IInspectable const& async,
|
|
@@ -44,18 +44,17 @@ namespace py
|
|
|
44
44
|
const member_site site{
|
|
45
45
|
member_kind::method, 0, type_name, nullptr, nullptr, site_is_constructor};
|
|
46
46
|
|
|
47
|
-
set_call_error(call_error::cannot_instantiate, &site
|
|
47
|
+
set_call_error(call_error::cannot_instantiate, &site);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
inline WINRT_IMPL_NOINLINE void set_invalid_arg_count_error(
|
|
51
|
-
Py_ssize_t arg_count) noexcept
|
|
50
|
+
inline WINRT_IMPL_NOINLINE void set_invalid_arg_count_error() noexcept
|
|
52
51
|
{
|
|
53
|
-
set_call_error(call_error::invalid_arg_count, nullptr
|
|
52
|
+
set_call_error(call_error::invalid_arg_count, nullptr);
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
inline WINRT_IMPL_NOINLINE void set_invalid_kwd_args_error() noexcept
|
|
57
56
|
{
|
|
58
|
-
set_call_error(call_error::keyword_arguments, nullptr
|
|
57
|
+
set_call_error(call_error::keyword_arguments, nullptr);
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
[[noreturn]] inline WINRT_IMPL_NOINLINE void throw_member_not_available(
|
|
@@ -241,3 +240,8 @@ namespace py
|
|
|
241
240
|
}
|
|
242
241
|
}
|
|
243
242
|
} // namespace py
|
|
243
|
+
|
|
244
|
+
namespace py::cpp::_winrt
|
|
245
|
+
{
|
|
246
|
+
PyObject* hresult_error(PyObject* /*unused*/, PyObject* args) noexcept;
|
|
247
|
+
} // namespace py::cpp::_winrt
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
#include "delegates.h"
|
|
28
28
|
#include "generics.h"
|
|
29
29
|
#include "interp.h"
|
|
30
|
+
#include "members.h"
|
|
30
31
|
#include "module_state.h"
|
|
31
32
|
#include "objects.h"
|
|
32
33
|
#include "protocols.h"
|
|
@@ -1113,11 +1114,9 @@ namespace py::interp
|
|
|
1113
1114
|
}
|
|
1114
1115
|
|
|
1115
1116
|
/**
|
|
1116
|
-
* Lays out the block of storage a call's outputs are received into
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
* imported when the descriptor was built could not be measured then, so a
|
|
1120
|
-
* member with one is measured here instead, once.
|
|
1117
|
+
* Lays out the block of storage a call's outputs are received into, for
|
|
1118
|
+
* an overload that the build left unprepared because it receives or
|
|
1119
|
+
* passes by reference a struct, which is measured here instead, once.
|
|
1121
1120
|
*
|
|
1122
1121
|
* The structs are resolved first, which can import their packages, so
|
|
1123
1122
|
* that the layout itself is done holding the build lock and nothing that
|
|
@@ -1163,59 +1162,7 @@ namespace py::interp
|
|
|
1163
1162
|
return true;
|
|
1164
1163
|
}
|
|
1165
1164
|
|
|
1166
|
-
|
|
1167
|
-
uint32_t widest = 1;
|
|
1168
|
-
|
|
1169
|
-
for (uint16_t i = 0; i < overload.arg_count; i++)
|
|
1170
|
-
{
|
|
1171
|
-
auto& arg = overload.args[i];
|
|
1172
|
-
if (!needs_storage(arg))
|
|
1173
|
-
{
|
|
1174
|
-
continue;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
uint32_t size{};
|
|
1178
|
-
uint32_t align{};
|
|
1179
|
-
|
|
1180
|
-
if (arg.category == table::param_category::receive_array)
|
|
1181
|
-
{
|
|
1182
|
-
// The count and the elements, which the two array slots point
|
|
1183
|
-
// at; what the elements are does not change what receives
|
|
1184
|
-
// them.
|
|
1185
|
-
size = sizeof(array_out);
|
|
1186
|
-
align = alignof(array_out);
|
|
1187
|
-
}
|
|
1188
|
-
else if (arg.code == table::type_code::struct_)
|
|
1189
|
-
{
|
|
1190
|
-
auto const info = load_published(arg.info);
|
|
1191
|
-
size = info->size;
|
|
1192
|
-
align = info->align;
|
|
1193
|
-
}
|
|
1194
|
-
else
|
|
1195
|
-
{
|
|
1196
|
-
try
|
|
1197
|
-
{
|
|
1198
|
-
auto const layout = table::get_value_layout(arg.code);
|
|
1199
|
-
size = layout.size;
|
|
1200
|
-
align = layout.align;
|
|
1201
|
-
}
|
|
1202
|
-
catch (...)
|
|
1203
|
-
{
|
|
1204
|
-
to_PyErr();
|
|
1205
|
-
return false;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
cursor = align_up(cursor, align);
|
|
1210
|
-
arg.out_offset = static_cast<uint16_t>(cursor);
|
|
1211
|
-
cursor += size;
|
|
1212
|
-
widest = std::max(widest, align);
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
overload.out_size = static_cast<uint16_t>(align_up(cursor, widest));
|
|
1216
|
-
publish(overload.prepared, true);
|
|
1217
|
-
|
|
1218
|
-
return true;
|
|
1165
|
+
return lay_out_outputs(overload);
|
|
1219
1166
|
}
|
|
1220
1167
|
|
|
1221
1168
|
/**
|
|
@@ -1247,7 +1194,7 @@ namespace py::interp
|
|
|
1247
1194
|
}
|
|
1248
1195
|
}
|
|
1249
1196
|
|
|
1250
|
-
set_invalid_arg_count_error(
|
|
1197
|
+
set_invalid_arg_count_error();
|
|
1251
1198
|
return nullptr;
|
|
1252
1199
|
}
|
|
1253
1200
|
|
|
@@ -178,10 +178,11 @@ namespace py::interp
|
|
|
178
178
|
uint16_t arg_count;
|
|
179
179
|
/// Bytes of storage the outputs need, including their alignment.
|
|
180
180
|
uint16_t out_size;
|
|
181
|
-
/// Whether @c out_size and the output offsets are final.
|
|
182
|
-
///
|
|
183
|
-
///
|
|
184
|
-
///
|
|
181
|
+
/// Whether @c out_size and the output offsets are final. A struct is
|
|
182
|
+
/// measured from its type entry, which the build does not resolve,
|
|
183
|
+
/// because resolving one can import another package, so an overload
|
|
184
|
+
/// that receives a struct or passes one by reference is laid out on
|
|
185
|
+
/// its first call instead.
|
|
185
186
|
bool prepared;
|
|
186
187
|
arg_desc* args;
|
|
187
188
|
};
|