Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit 208684f

Browse files
committed
generate code from PyWinRT v1.0.0-beta.4
1 parent 0519bcc commit 208684f

File tree

1,125 files changed

+8312
-6726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,125 files changed

+8312
-6726
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions

generate.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
param ([switch]$skipNugetInstall)
22

3-
$pywinrt_version = '1.0.0-beta.3'
3+
$pywinrt_version = '1.0.0-beta.4'
44
$cppwinrt_version = '2.0.220110.5'
55
$windows_sdk_version = '10.0.22000.0'
66
$repoRootPath = (Get-Item $PSScriptRoot).FullName

pywinrt/winsdk/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.3
1+
# WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
22

33
from . import _winrt
44

@@ -7,7 +7,7 @@ def _import_ns_module(ns):
77
import importlib.util
88

99
try:
10-
module_name = "_winsdk_" + ns.replace('.', '_')
10+
module_name = f"_winsdk_{ns.replace('.', '_')}"
1111

1212
loader = importlib.machinery.ExtensionFileLoader(module_name, _winrt.__file__)
1313
spec = importlib.util.spec_from_loader(module_name, loader)

pywinrt/winsdk/_winrt.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.3
1+
# WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
22

33

44
import sys
5+
from typing import Iterable, Optional
56

67
if sys.version_info >= (3, 9):
78
from typing import Annotated
@@ -40,4 +41,5 @@ def uninit_apartment() -> None: ...
4041
def initialize_with_window(obj: Object, hwnd: int) -> None: ...
4142

4243
class Object:
43-
...
44+
@classmethod
45+
def __init_subclass__(cls, /, interfaces: Optional[Iterable[type]] = None, **kwargs) -> None: ...

pywinrt/winsdk/src/_winrt.cpp

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
1-
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.3
1+
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
22

33
#include "pybase.h"
44
#include <Shobjidl.h>
55
#include <winrt/base.h>
66

7-
PyObject* create_python_type(PyType_Spec* type_spec, PyObject* base_type) noexcept
8-
{
9-
if (base_type != nullptr)
10-
{
11-
return PyType_FromSpecWithBases(type_spec, base_type);
12-
}
13-
else
14-
{
15-
return PyType_FromSpec(type_spec);
16-
}
17-
}
18-
7+
/**
8+
* Adds a Python type to a Python module.
9+
*
10+
* @param module The module to add the type to.
11+
* @param type_name A valid Python identifier.
12+
* @param type_spec The Python type spec.
13+
* @param base_type The base type, a tuple of base types or nullptr to use the base
14+
* slot.
15+
* @returns A new reference to the type object or nullptr on error.
16+
*/
1917
PyTypeObject* py::register_python_type(
2018
PyObject* module,
2119
const char* const type_name,
2220
PyType_Spec* type_spec,
23-
PyObject* base_type)
21+
PyObject* base_type) noexcept
2422
{
25-
py::pyobj_handle type_object{create_python_type(type_spec, base_type)};
23+
py::pyobj_handle type_object{PyType_FromSpecWithBases(type_spec, base_type)};
24+
2625
if (!type_object)
2726
{
28-
throw winrt::hresult_error();
27+
return nullptr;
2928
}
30-
if (PyModule_AddObject(module, type_name, type_object.get()) != 0)
29+
30+
if (PyModule_AddObject(module, type_name, type_object.get()) == -1)
3131
{
32-
throw winrt::hresult_error();
32+
return nullptr;
3333
}
34+
3435
return reinterpret_cast<PyTypeObject*>(type_object.detach());
3536
}
3637

@@ -180,6 +181,11 @@ static int module_exec(PyObject* module) noexcept
180181
py::winrt_type<py::Object>::python_type = py::register_python_type(
181182
module, _type_name_Object, &Object_type_spec, nullptr);
182183

184+
if (!py::winrt_type<py::Object>::python_type)
185+
{
186+
return -1;
187+
}
188+
183189
if (PyModule_AddIntConstant(module, "MTA", kMTA) == -1)
184190
{
185191
return -1;

pywinrt/winsdk/src/py.Windows.AI.MachineLearning.Preview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.3
1+
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
22

33
#include "pybase.h"
44
#include "py.Windows.AI.MachineLearning.Preview.h"

pywinrt/winsdk/src/py.Windows.AI.MachineLearning.Preview.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.3
1+
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
22

33
#pragma once
44

pywinrt/winsdk/src/py.Windows.AI.MachineLearning.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.3
1+
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
22

33
#include "pybase.h"
44
#include "py.Windows.AI.MachineLearning.h"

pywinrt/winsdk/src/py.Windows.AI.MachineLearning.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.3
1+
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
22

33
#pragma once
44

pywinrt/winsdk/src/py.Windows.ApplicationModel.Activation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.3
1+
// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.4
22

33
#include "pybase.h"
44
#include "py.Windows.ApplicationModel.Activation.h"

0 commit comments

Comments
 (0)