pyobjc-framework-SecurityInterface 12.2.2__tar.gz → 13.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 (39) hide show
  1. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/Lib/SecurityInterface/_metadata.py +0 -2
  2. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/Lib/pyobjc_framework_SecurityInterface.egg-info/PKG-INFO +6 -6
  3. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/Lib/pyobjc_framework_SecurityInterface.egg-info/SOURCES.txt +2 -2
  4. pyobjc_framework_securityinterface-13.0/Lib/pyobjc_framework_SecurityInterface.egg-info/pyobjc-build-info.txt +3 -0
  5. pyobjc_framework_securityinterface-13.0/Lib/pyobjc_framework_SecurityInterface.egg-info/requires.txt +3 -0
  6. pyobjc_framework_securityinterface-13.0/Modules/_SecurityInterface.m +354 -0
  7. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/Modules/pyobjc-api.h +18 -4
  8. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/Modules/pyobjc-compat.h +0 -18
  9. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PKG-INFO +6 -6
  10. pyobjc_framework_securityinterface-13.0/PyObjCTest/test_sfauthorizationview.py +126 -0
  11. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/test_sfcertificatepanel.py +2 -0
  12. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/test_sfcertificateview.py +1 -2
  13. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/test_sfchooseidentitypanel.py +2 -0
  14. pyobjc_framework_securityinterface-13.0/metadata/SecurityInterface.fwinfo +70 -0
  15. pyobjc_framework_securityinterface-12.2.2/metadata/raw/arm64-26.5.fwinfo → pyobjc_framework_securityinterface-13.0/metadata/raw/arm64-27.fwinfo +2 -3
  16. pyobjc_framework_securityinterface-12.2.2/metadata/raw/x86_64-26.5.fwinfo → pyobjc_framework_securityinterface-13.0/metadata/raw/x86_64-27.fwinfo +2 -3
  17. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/pyobjc_setup.py +7 -7
  18. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/setup.py +1 -1
  19. pyobjc_framework_securityinterface-12.2.2/Lib/pyobjc_framework_SecurityInterface.egg-info/pyobjc-build-info.txt +0 -3
  20. pyobjc_framework_securityinterface-12.2.2/Lib/pyobjc_framework_SecurityInterface.egg-info/requires.txt +0 -3
  21. pyobjc_framework_securityinterface-12.2.2/Modules/_SecurityInterface.m +0 -230
  22. pyobjc_framework_securityinterface-12.2.2/PyObjCTest/test_sfauthorizationview.py +0 -33
  23. pyobjc_framework_securityinterface-12.2.2/metadata/SecurityInterface.fwinfo +0 -164
  24. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/Lib/SecurityInterface/__init__.py +0 -0
  25. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/Lib/pyobjc_framework_SecurityInterface.egg-info/dependency_links.txt +0 -0
  26. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/Lib/pyobjc_framework_SecurityInterface.egg-info/not-zip-safe +0 -0
  27. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/Lib/pyobjc_framework_SecurityInterface.egg-info/top_level.txt +0 -0
  28. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/License.txt +0 -0
  29. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/MANIFEST.in +0 -0
  30. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/__init__.py +0 -0
  31. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/test_securityinterface.py +0 -0
  32. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/test_sfauthorizationpluginview.py +0 -0
  33. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/test_sfcertificatetrustpanel.py +0 -0
  34. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/test_sfchooseidentitytablecellview.py +0 -0
  35. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/test_sfkeychainsavepanel.py +0 -0
  36. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/PyObjCTest/test_sfkeychainsettingspanel.py +0 -0
  37. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/metadata/metadata.ini +0 -0
  38. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/pyproject.toml +0 -0
  39. {pyobjc_framework_securityinterface-12.2.2 → pyobjc_framework_securityinterface-13.0}/setup.cfg +0 -0
@@ -1,7 +1,5 @@
1
1
  # This file is generated by objective.metadata
2
2
  #
3
- # Last update: Sun May 24 11:58:12 2026
4
- #
5
3
  # flake8: noqa
6
4
 
7
5
  import objc, sys
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyobjc-framework-SecurityInterface
3
- Version: 12.2.2
3
+ Version: 13.0
4
4
  Summary: Wrappers for the framework SecurityInterface on macOS
5
5
  Home-page: https://github.com/ronaldoussoren/pyobjc
6
6
  Author: Ronald Oussoren
@@ -17,22 +17,22 @@ Classifier: Operating System :: MacOS :: MacOS X
17
17
  Classifier: Programming Language :: Python
18
18
  Classifier: Programming Language :: Python :: 3
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
- Classifier: Programming Language :: Python :: 3.10
21
20
  Classifier: Programming Language :: Python :: 3.11
22
21
  Classifier: Programming Language :: Python :: 3.12
23
22
  Classifier: Programming Language :: Python :: 3.13
24
23
  Classifier: Programming Language :: Python :: 3.14
25
24
  Classifier: Programming Language :: Python :: 3.15
25
+ Classifier: Programming Language :: Python :: 3.16
26
26
  Classifier: Programming Language :: Python :: Implementation :: CPython
27
27
  Classifier: Programming Language :: Python :: Free Threading :: 3 - Stable
28
28
  Classifier: Programming Language :: Objective C
29
29
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
30
  Classifier: Topic :: Software Development :: User Interfaces
31
- Requires-Python: >=3.10
31
+ Requires-Python: >=3.11
32
32
  Description-Content-Type: text/x-rst; charset=UTF-8
33
- Requires-Dist: pyobjc-core>=12.2.2
34
- Requires-Dist: pyobjc-framework-Cocoa>=12.2.2
35
- Requires-Dist: pyobjc-framework-Security>=12.2.2
33
+ Requires-Dist: pyobjc-core>=13.0
34
+ Requires-Dist: pyobjc-framework-Cocoa>=13.0
35
+ Requires-Dist: pyobjc-framework-Security>=13.0
36
36
  Dynamic: author
37
37
  Dynamic: author-email
38
38
  Dynamic: classifier
@@ -28,5 +28,5 @@ PyObjCTest/test_sfkeychainsavepanel.py
28
28
  PyObjCTest/test_sfkeychainsettingspanel.py
29
29
  metadata/SecurityInterface.fwinfo
30
30
  metadata/metadata.ini
31
- metadata/raw/arm64-26.5.fwinfo
32
- metadata/raw/x86_64-26.5.fwinfo
31
+ metadata/raw/arm64-27.fwinfo
32
+ metadata/raw/x86_64-27.fwinfo
@@ -0,0 +1,3 @@
1
+ macOS 27.2 (26B123)
2
+ Apple clang version 21.0.0 (clang-2100.4.1.1)
3
+ SDK: macOS 27.2
@@ -0,0 +1,3 @@
1
+ pyobjc-core>=13.0
2
+ pyobjc-framework-Cocoa>=13.0
3
+ pyobjc-framework-Security>=13.0
@@ -0,0 +1,354 @@
1
+ #define PY_SSIZE_T_CLEAN
2
+ #include "Python.h"
3
+ #include "pyobjc-api.h"
4
+
5
+ #ifdef USE_STATIC_ANALYZER
6
+ #include "../../pyobjc-core/Modules/objc/python-api-used.h"
7
+ #endif
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import <SecurityInterface/SFAuthorizationView.h>
11
+
12
+ NS_ASSUME_NONNULL_BEGIN
13
+
14
+ static int
15
+ parse_itemset(PyObject* value, AuthorizationItemSet* itemset)
16
+ {
17
+ itemset->items = NULL;
18
+
19
+ if (value == Py_None) {
20
+ return 1;
21
+
22
+ } else {
23
+ PyObject* seq = PySequence_Tuple(value);
24
+ Py_ssize_t i;
25
+ if (seq == NULL) {
26
+ return 0;
27
+ }
28
+ itemset->count = PyTuple_GET_SIZE(seq);
29
+ itemset->items = PyMem_Malloc(sizeof(AuthorizationItem) * PyTuple_GET_SIZE(seq));
30
+ if (itemset->items == NULL) { // LCOV_BR_EXCL_LINE
31
+ // LCOV_EXCL_START
32
+ PyErr_NoMemory();
33
+ return 0;
34
+ // LCOV_EXCL_STOP
35
+ }
36
+
37
+ for (i = 0; i < PyTuple_GET_SIZE(seq); i++) {
38
+ PyObject* cur_seq = PySequence_Tuple(PyTuple_GET_ITEM(seq, i));
39
+ if (cur_seq == NULL) {
40
+ PyErr_Format(PyExc_TypeError, "items[%ld] is not a sequence", (long)i);
41
+ PyMem_Free(itemset->items);
42
+ return 0;
43
+ }
44
+ if (PyTuple_GET_SIZE(cur_seq) != 4) {
45
+ PyErr_Format(PyExc_TypeError, "items[%ld] is not a sequence of 4 items",
46
+ (long)i);
47
+ PyMem_Free(itemset->items);
48
+ return 0;
49
+ }
50
+
51
+ if (!PyBytes_Check(PyTuple_GET_ITEM(cur_seq, 0))) {
52
+ PyErr_Format(PyExc_TypeError, "items[%ld].name is not a byte string",
53
+ (long)i);
54
+ PyMem_Free(itemset->items);
55
+ return 0;
56
+ }
57
+
58
+ itemset->items[i].name = PyBytes_AsString(PyTuple_GET_ITEM(cur_seq, 0));
59
+
60
+ if (PyObjC_PythonToObjC(@encode(size_t), PyTuple_GET_ITEM(cur_seq, 1),
61
+ &(itemset->items[i].valueLength))
62
+ == -1) {
63
+ PyErr_Format(PyExc_TypeError, "items[%ld].valueLength is not an integer",
64
+ (long)i);
65
+ PyMem_Free(itemset->items);
66
+ return 0;
67
+ }
68
+
69
+ if (PyTuple_GET_ITEM(cur_seq, 2) == Py_None) {
70
+ if (itemset->items[i].valueLength != 0) {
71
+ PyErr_Format(PyExc_TypeError,
72
+ "items[%ld].value is None, valueLength != 0", (long)i);
73
+ PyMem_Free(itemset->items);
74
+ return 0;
75
+ }
76
+
77
+ itemset->items[i].value = NULL;
78
+
79
+ } else {
80
+ if (!PyBytes_Check(PyTuple_GET_ITEM(cur_seq, 2))
81
+ || PyBytes_Size(PyTuple_GET_ITEM(cur_seq, 2))
82
+ != (Py_ssize_t)itemset->items[i].valueLength) {
83
+ PyErr_Format(PyExc_TypeError,
84
+ "items[%ld].value is not a byte string of length %ld",
85
+ (long)i, (long)(itemset->items[i].valueLength));
86
+ PyMem_Free(itemset->items);
87
+ return 0;
88
+ }
89
+
90
+ itemset->items[i].value = PyBytes_AsString(PyTuple_GET_ITEM(cur_seq, 2));
91
+ }
92
+
93
+ if (PyObjC_PythonToObjC(@encode(UInt32), PyTuple_GET_ITEM(cur_seq, 3),
94
+ &(itemset->items[i].flags))
95
+ == -1) {
96
+ PyErr_Format(PyExc_TypeError, "items[%ld].flags is not an integer",
97
+ (long)i);
98
+ PyMem_Free(itemset->items);
99
+ return 0;
100
+ }
101
+ }
102
+ }
103
+ return 1;
104
+ }
105
+
106
+ static void
107
+ free_itemset(AuthorizationItemSet* itemset)
108
+ {
109
+ PyMem_Free(itemset->items);
110
+ }
111
+
112
+ static PyObject* _Nullable build_itemset(AuthorizationItemSet* _Nonnull itemset)
113
+ {
114
+ PyObject* result; // = NULL;
115
+ PyObject* t = NULL;
116
+ PyObject* o = NULL;
117
+
118
+ assert(itemset != NULL);
119
+
120
+ UInt32 i;
121
+ result = PyTuple_New(itemset->count);
122
+ if (result == NULL) // LCOV_BR_EXCL_LINE
123
+ return NULL; // LCOV_EXCL_LINE
124
+
125
+ for (i = 0; i < itemset->count; i++) {
126
+ Py_ssize_t packed = -1;
127
+ AuthorizationItem* item = itemset->items + i;
128
+
129
+ assert(item != NULL);
130
+
131
+ t = PyObjC_CreateRegisteredStruct("{AuthorizationItem=^cQ^vI}",
132
+ sizeof("{AuthorizationItem=^cQ^vI}") - 1, NULL,
133
+ &packed);
134
+ if (t == NULL) { // LCOV_BR_EXCL_LINE
135
+ // LCOV_BR_EXCL_START
136
+ if (!PyErr_Occurred()) {
137
+ PyErr_SetString(PyExc_RuntimeError, "No binding for 'AuthorizationItem'");
138
+ }
139
+ goto error;
140
+ // LCOV_BR_EXCL_STOP
141
+ }
142
+
143
+ o = PyBytes_FromString(item->name);
144
+ if (o == NULL) // LCOV_BR_EXCL_LINE
145
+ goto error; // LCOV_EXCL_LINE
146
+
147
+ if (PySequence_SetItem(t, 0, o) == -1) // LCOV_BR_EXCL_LINE
148
+ goto error; // LCOV_EXCL_LINE
149
+
150
+ Py_CLEAR(o);
151
+
152
+ o = PyLong_FromUnsignedLong(item->valueLength);
153
+ if (o == NULL) // LCOV_BR_EXCL_LINE
154
+ goto error; // LCOV_EXCL_LINE
155
+
156
+ if (PySequence_SetItem(t, 1, o) == -1) // LCOV_BR_EXCL_LINE
157
+ goto error; // LCOV_EXCL_LINE
158
+
159
+ Py_CLEAR(o);
160
+
161
+ if (item->value == NULL) {
162
+ o = Py_None;
163
+ Py_INCREF(Py_None);
164
+ } else {
165
+ o = PyBytes_FromStringAndSize(item->value, item->valueLength);
166
+ if (o == NULL) // LCOV_BR_EXCL_LINE
167
+ goto error; // LCOV_EXCL_LINE
168
+ }
169
+
170
+ if (PySequence_SetItem(t, 2, o) == -1) // LCOV_BR_EXCL_LINE
171
+ goto error; // LCOV_EXCL_LINE
172
+
173
+ Py_CLEAR(o);
174
+
175
+ o = PyLong_FromUnsignedLong(item->flags);
176
+ if (o == NULL) // LCOV_BR_EXCL_LINE
177
+ goto error; // LCOV_EXCL_LINE
178
+
179
+ if (PySequence_SetItem(t, 3, o) == -1) // LCOV_BR_EXCL_LINE
180
+ goto error; // LCOV_EXCL_LINE
181
+
182
+ Py_CLEAR(o);
183
+
184
+ PyTuple_SET_ITEM(result, i, t);
185
+ }
186
+ return result;
187
+
188
+ error:
189
+ // LCOV_EXCL_START
190
+ // as
191
+ Py_CLEAR(result);
192
+ Py_CLEAR(t);
193
+ Py_CLEAR(o);
194
+ return NULL;
195
+ // LCOV_EXCL_STOP
196
+ }
197
+
198
+ static PyObject* _Nullable call_authorizationRights(PyObject* method, PyObject* self,
199
+ PyObject* const* arguments
200
+ __attribute__((__unused__)),
201
+ size_t nargs)
202
+ {
203
+ struct objc_super super;
204
+ AuthorizationRights* rights;
205
+ PyObject* py_rights;
206
+
207
+ if (PyObjC_CheckArgCount(method, 0, 0, nargs) == -1) {
208
+ return NULL;
209
+ }
210
+
211
+ Py_BEGIN_ALLOW_THREADS
212
+ @try {
213
+ super.super_class = PyObjCSelector_GetClass(method);
214
+ super.receiver = PyObjCObject_GetObject(self);
215
+
216
+ rights = ((AuthorizationRights * (*)(struct objc_super*, SEL))
217
+ objc_msgSendSuper)(&super, PyObjCSelector_GetSelector(method));
218
+
219
+ } @catch (NSException* localException) { // LCOV_EXCL_LINE
220
+ PyObjCErr_FromObjC(localException); // LCOV_EXCL_LINE
221
+ }
222
+ Py_END_ALLOW_THREADS
223
+
224
+ if (PyErr_Occurred()) // LCOV_BR_EXCL_LINE
225
+ return NULL; // LCOV_EXCL_LINE
226
+
227
+ if (rights == NULL)
228
+ Py_RETURN_NONE;
229
+
230
+ py_rights = build_itemset(rights);
231
+ assert(py_rights || PyErr_Occurred());
232
+ return py_rights;
233
+ }
234
+
235
+ static PyObject* _Nullable call_setAuthorizationRights_(PyObject* method, PyObject* self,
236
+ PyObject* const* arguments,
237
+ size_t nargs)
238
+ {
239
+ struct objc_super super;
240
+ AuthorizationRights rights;
241
+ PyObject* py_rights;
242
+
243
+ rights.items = NULL;
244
+
245
+ if (PyObjC_CheckArgCount(method, 1, 1, nargs) == -1) {
246
+ return NULL;
247
+ }
248
+ py_rights = arguments[0];
249
+
250
+ if (!parse_itemset(py_rights, &rights)) {
251
+ return NULL;
252
+ }
253
+
254
+ Py_BEGIN_ALLOW_THREADS
255
+ @try {
256
+ super.super_class = PyObjCSelector_GetClass(method);
257
+ super.receiver = PyObjCObject_GetObject(self);
258
+
259
+ ((void (*)(struct objc_super*, SEL, AuthorizationRights*))objc_msgSendSuper)(
260
+ &super, PyObjCSelector_GetSelector(method), &rights);
261
+
262
+ } @catch (NSException* localException) { // LCOV_EXCL_LINE
263
+ PyObjCErr_FromObjC(localException); // LCOV_EXCL_LINE
264
+ }
265
+ Py_END_ALLOW_THREADS
266
+
267
+ free_itemset(&rights);
268
+
269
+ if (PyErr_Occurred()) // LCOV_BR_EXCL_LINE
270
+ return NULL; // LCOV_EXCL_LINE
271
+
272
+ Py_INCREF(Py_None);
273
+ return Py_None;
274
+ }
275
+
276
+ static PyMethodDef mod_methods[] = {
277
+ {0, 0, 0, 0} /* sentinel */
278
+ };
279
+
280
+ static int
281
+ mod_exec_module(PyObject* m)
282
+ {
283
+ Class cls;
284
+
285
+ if (PyObjC_ImportAPI(m) == -1) // LCOV_BR_EXCL_LINE
286
+ return -1; // LCOV_EXCL_LINE
287
+
288
+ cls = objc_lookUpClass("SFAuthorizationView");
289
+ if (cls == Nil) { // LCOV_BR_EXCL_LINE
290
+ return 0; // LCOV_EXCL_LINE
291
+ }
292
+
293
+ if (PyObjC_RegisterMethodMapping(cls, @selector(authorizationRights),
294
+ call_authorizationRights,
295
+ PyObjCUnsupportedMethod_IMP)
296
+ < 0) { // LCOV_BR_EXCL_LINE
297
+
298
+ return -1; // LCOV_EXCL_LINE
299
+ }
300
+
301
+ if (PyObjC_RegisterMethodMapping(cls, @selector(setAuthorizationRights:),
302
+ call_setAuthorizationRights_,
303
+ PyObjCUnsupportedMethod_IMP)
304
+ < 0) { // LCOV_BR_EXCL_LINE
305
+
306
+ return -1; // LCOV_EXCL_LINE
307
+ }
308
+
309
+ return 0;
310
+ }
311
+
312
+ static struct PyModuleDef_Slot mod_slots[] = {
313
+ {.slot = Py_mod_exec, .value = (void*)mod_exec_module},
314
+ #if PY_VERSION_HEX >= 0x030c0000
315
+ {
316
+ /* This extension does not use the CPython API other than initializing
317
+ * the module, hence is safe with subinterpreters and per-interpreter
318
+ * GILs
319
+ */
320
+ .slot = Py_mod_multiple_interpreters,
321
+ .value = Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED,
322
+ },
323
+ #endif
324
+ #if PY_VERSION_HEX >= 0x030d0000
325
+ {
326
+ /* The code in this extension should be safe to use without the GIL */
327
+ .slot = Py_mod_gil,
328
+ .value = Py_MOD_GIL_NOT_USED,
329
+ },
330
+ #endif
331
+ {/* Sentinel */
332
+ .slot = 0,
333
+ .value = 0}};
334
+
335
+ static struct PyModuleDef mod_module = {
336
+ .m_base = PyModuleDef_HEAD_INIT,
337
+ .m_name = "_SecurityInterface",
338
+ .m_doc = NULL,
339
+ .m_size = 0,
340
+ .m_methods = mod_methods,
341
+ .m_slots = mod_slots,
342
+ .m_traverse = NULL,
343
+ .m_clear = NULL,
344
+ .m_free = NULL,
345
+ };
346
+
347
+ PyObject* _Nullable PyInit__SecurityInterface(void);
348
+
349
+ PyObject* _Nullable __attribute__((__visibility__("default")))
350
+ PyInit__SecurityInterface(void)
351
+ {
352
+ return PyModuleDef_Init(&mod_module);
353
+ }
354
+ NS_ASSUME_NONNULL_END
@@ -60,6 +60,11 @@ typedef int(RegisterMethodMappingFunctionType)(
60
60
  PyObject* _Nonnull const* _Nonnull, size_t),
61
61
  IMP _Nullable (*_Nonnull)(PyObject* _Nonnull, PyObject* _Nonnull));
62
62
 
63
+ #ifndef PyObjC_FUNCTION_CALL_H
64
+ typedef PyObject* _Nullable (*PyObjC_FunctionCallFunc)(
65
+ PyObject* meth, PyObject* _Nonnull const* _Nonnull args, size_t nargs);
66
+ #endif
67
+
63
68
  struct pyobjc_api {
64
69
  int api_version; /* API version */
65
70
  size_t struct_len; /* Length of this struct */
@@ -117,6 +122,9 @@ struct pyobjc_api {
117
122
 
118
123
  PyObject* _Nullable (*_Nonnull createopaquepointertype)(const char*, const char*,
119
124
  const char*);
125
+ int (*_Nonnull register_functioncaller)(void*, PyObjC_FunctionCallFunc);
126
+ PyObject* _Nullable (*_Nonnull create_registered_struct)(
127
+ const char*, Py_ssize_t, const char* _Nonnull* _Nullable, Py_ssize_t*);
120
128
  };
121
129
 
122
130
  #ifndef PYOBJC_BUILD
@@ -159,6 +167,8 @@ static struct pyobjc_api* PyObjC_API;
159
167
  #define PyObjC_CheckArgCount (PyObjC_API->checkargcount)
160
168
  #define PyObjC_CheckNoKwnames (PyObjC_API->checknokwnames)
161
169
  #define PyObjCCreateOpaquePointerType (PyObjC_API->createopaquepointertype)
170
+ #define PyObjCRegister_FunctionCaller (PyObjC_API->register_functioncaller)
171
+ #define PyObjC_CreateRegisteredStruct (PyObjC_API->create_registered_struct)
162
172
 
163
173
  typedef void (*PyObjC_Function_Pointer)(void);
164
174
  typedef struct PyObjC_function_map {
@@ -178,21 +188,25 @@ static inline int
178
188
  PyObjC_ImportAPI(PyObject* calling_module)
179
189
  {
180
190
  PyObjC_API = (struct pyobjc_api*)PyCapsule_Import("objc." PYOBJC_API_NAME, 0);
181
- if (PyObjC_API == NULL) {
182
- return -1;
191
+ if (PyObjC_API == NULL) { // LCOV_BR_EXCL_LINE
192
+ return -1; // LCOV_EXCL_LINE
183
193
  }
184
- if (PyObjC_API->api_version != PYOBJC_API_VERSION) {
194
+ if (PyObjC_API->api_version != PYOBJC_API_VERSION) { // LCOV_BR_EXCL_LINE
195
+ // LCOV_EXCL_START
185
196
  PyErr_Format(PyExc_RuntimeError,
186
197
  "Wrong version of PyObjC C API (got %d, expected %d)",
187
198
  (int)PyObjC_API->api_version, (int)PYOBJC_API_VERSION);
188
199
  return -1;
200
+ // LCOV_EXCL_STOP
189
201
  }
190
202
 
191
- if (PyObjC_API->struct_len < PyObjC_EXPECTED_STRUCT_SIZE) {
203
+ if (PyObjC_API->struct_len < PyObjC_EXPECTED_STRUCT_SIZE) { // LCOV_EXCL_LINE
204
+ // LCOV_EXCL_START
192
205
  PyErr_Format(PyExc_RuntimeError,
193
206
  "Wrong struct-size of PyObjC C API (got %d, expected %d)",
194
207
  (int)PyObjC_API->struct_len, (int)sizeof(struct pyobjc_api));
195
208
  return -1;
209
+ // LCOV_EXCL_STOP
196
210
  }
197
211
 
198
212
  /* Current pyobjc implementation doesn't allow deregistering
@@ -167,24 +167,6 @@ _PyObjCTuple_GetItem(PyObject* tuple, Py_ssize_t idx)
167
167
  PyGILState_Release(_GILState); \
168
168
  } while (0)
169
169
 
170
- #if PY_VERSION_HEX < 0x030a0000
171
-
172
- static inline PyObject*
173
- Py_NewRef(PyObject* o)
174
- {
175
- Py_INCREF(o);
176
- return o;
177
- }
178
-
179
- static inline PyObject*
180
- Py_XNewRef(PyObject* o)
181
- {
182
- Py_XINCREF(o);
183
- return o;
184
- }
185
-
186
- #endif /* PY_VERSION_HEX < 0x030a0000 */
187
-
188
170
  #if PY_VERSION_HEX < 0x030d0000
189
171
  #define Py_BEGIN_CRITICAL_SECTION(value) \
190
172
  { \
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyobjc-framework-SecurityInterface
3
- Version: 12.2.2
3
+ Version: 13.0
4
4
  Summary: Wrappers for the framework SecurityInterface on macOS
5
5
  Home-page: https://github.com/ronaldoussoren/pyobjc
6
6
  Author: Ronald Oussoren
@@ -17,22 +17,22 @@ Classifier: Operating System :: MacOS :: MacOS X
17
17
  Classifier: Programming Language :: Python
18
18
  Classifier: Programming Language :: Python :: 3
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
- Classifier: Programming Language :: Python :: 3.10
21
20
  Classifier: Programming Language :: Python :: 3.11
22
21
  Classifier: Programming Language :: Python :: 3.12
23
22
  Classifier: Programming Language :: Python :: 3.13
24
23
  Classifier: Programming Language :: Python :: 3.14
25
24
  Classifier: Programming Language :: Python :: 3.15
25
+ Classifier: Programming Language :: Python :: 3.16
26
26
  Classifier: Programming Language :: Python :: Implementation :: CPython
27
27
  Classifier: Programming Language :: Python :: Free Threading :: 3 - Stable
28
28
  Classifier: Programming Language :: Objective C
29
29
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
30
  Classifier: Topic :: Software Development :: User Interfaces
31
- Requires-Python: >=3.10
31
+ Requires-Python: >=3.11
32
32
  Description-Content-Type: text/x-rst; charset=UTF-8
33
- Requires-Dist: pyobjc-core>=12.2.2
34
- Requires-Dist: pyobjc-framework-Cocoa>=12.2.2
35
- Requires-Dist: pyobjc-framework-Security>=12.2.2
33
+ Requires-Dist: pyobjc-core>=13.0
34
+ Requires-Dist: pyobjc-framework-Cocoa>=13.0
35
+ Requires-Dist: pyobjc-framework-Security>=13.0
36
36
  Dynamic: author
37
37
  Dynamic: author-email
38
38
  Dynamic: classifier
@@ -0,0 +1,126 @@
1
+ import SecurityInterface
2
+ import Security
3
+ from PyObjCTools.TestSupport import TestCase
4
+
5
+
6
+ class TestSFAuthorizationViewHelper(SecurityInterface.NSObject):
7
+ def authorizationViewShouldDeauthorize_(self, v):
8
+ return 1
9
+
10
+
11
+ class TestSFAuthorizationView(TestCase):
12
+ def test_constants(self):
13
+ self.assertEqual(SecurityInterface.SFAuthorizationStartupState, 0)
14
+ self.assertEqual(SecurityInterface.SFAuthorizationViewLockedState, 1)
15
+ self.assertEqual(SecurityInterface.SFAuthorizationViewInProgressState, 2)
16
+ self.assertEqual(SecurityInterface.SFAuthorizationViewUnlockedState, 3)
17
+
18
+ def test_classes(self):
19
+ SecurityInterface.SFAuthorizationView
20
+
21
+ def test_methods(self):
22
+ self.assertResultIsBOOL(SecurityInterface.SFAuthorizationView.updateStatus_)
23
+ self.assertArgIsBOOL(SecurityInterface.SFAuthorizationView.setAutoupdate_, 0)
24
+ self.assertArgIsBOOL(
25
+ SecurityInterface.SFAuthorizationView.setAutoupdate_interval_, 0
26
+ )
27
+ self.assertArgIsBOOL(SecurityInterface.SFAuthorizationView.setEnabled_, 0)
28
+ self.assertResultIsBOOL(SecurityInterface.SFAuthorizationView.isEnabled)
29
+ self.assertResultIsBOOL(SecurityInterface.SFAuthorizationView.authorize_)
30
+ self.assertResultIsBOOL(SecurityInterface.SFAuthorizationView.deauthorize_)
31
+
32
+ def test_protocol_methods(self):
33
+ # Informal protocol
34
+ self.assertResultIsBOOL(
35
+ TestSFAuthorizationViewHelper.authorizationViewShouldDeauthorize_
36
+ )
37
+
38
+ def test_manual(self):
39
+ view = SecurityInterface.SFAuthorizationView.alloc().initWithFrame_(
40
+ ((0, 0), (300, 300))
41
+ )
42
+ self.assertIsInstance(view, SecurityInterface.SFAuthorizationView)
43
+
44
+ with self.assertRaisesRegex(TypeError, "expected no arguments, got 1"):
45
+ view.authorizationRights(1)
46
+
47
+ rights = view.authorizationRights()
48
+ self.assertIs(rights, None)
49
+
50
+ with self.assertRaisesRegex(TypeError, "expected 1 arguments, got 2"):
51
+ view.setAuthorizationRights_(None, 1)
52
+
53
+ view.setAuthorizationRights_(None)
54
+ rights = [
55
+ Security.AuthorizationItem(
56
+ name=Security.kAuthorizationRightExecute,
57
+ valueLength=11,
58
+ value=b"/usr/bin/id",
59
+ flags=0,
60
+ ),
61
+ Security.AuthorizationItem(
62
+ name=Security.kAuthorizationEnvironmentPrompt,
63
+ valueLength=0,
64
+ value=None,
65
+ flags=0,
66
+ ),
67
+ ]
68
+
69
+ view.setAuthorizationRights_(rights)
70
+
71
+ rights = view.authorizationRights()
72
+ self.assertEqual(
73
+ rights,
74
+ (
75
+ (
76
+ Security.AuthorizationItem(
77
+ name=b"system.privilege.admin",
78
+ valueLength=11,
79
+ value=b"/usr/bin/id",
80
+ flags=0,
81
+ ),
82
+ (
83
+ Security.AuthorizationItem(
84
+ name=b"prompt", valueLength=0, value=None, flags=0
85
+ )
86
+ ),
87
+ )
88
+ ),
89
+ )
90
+
91
+ with self.assertRaisesRegex(TypeError, "'int' object is not iterable"):
92
+ view.setAuthorizationRights_(42)
93
+
94
+ with self.assertRaisesRegex(TypeError, r"items\[0\] is not a sequence"):
95
+ view.setAuthorizationRights_([42])
96
+
97
+ with self.assertRaisesRegex(
98
+ TypeError, r"items\[0\] is not a sequence of 4 items"
99
+ ):
100
+ view.setAuthorizationRights_([()])
101
+
102
+ with self.assertRaisesRegex(TypeError, r"items\[0\].name is not a byte string"):
103
+ view.setAuthorizationRights_([("key", 5, b"value", 0)])
104
+
105
+ with self.assertRaisesRegex(
106
+ TypeError, r"items\[0\].valueLength is not an integer"
107
+ ):
108
+ view.setAuthorizationRights_([(b"key", "5", b"value", 0)])
109
+
110
+ with self.assertRaisesRegex(
111
+ TypeError, r"items\[0\].value is not a byte string of length 5"
112
+ ):
113
+ view.setAuthorizationRights_([(b"key", 5, "value", 0)])
114
+
115
+ with self.assertRaisesRegex(
116
+ TypeError, r"items\[0\].value is None, valueLength != 0"
117
+ ):
118
+ view.setAuthorizationRights_([(b"key", 5, None, 0)])
119
+
120
+ with self.assertRaisesRegex(
121
+ TypeError, r"items\[0\].value is not a byte string of length 5"
122
+ ):
123
+ view.setAuthorizationRights_([(b"key", 5, "val", 0)])
124
+
125
+ with self.assertRaisesRegex(TypeError, r"items\[0\].flags is not an integer"):
126
+ view.setAuthorizationRights_([(b"key", 5, b"value", "0")])
@@ -43,4 +43,6 @@ class TestSFCertificatePanel(TestCase):
43
43
  self.assertArgIsBOOL(SecurityInterface.SFCertificatePanel.setShowsHelp_, 0)
44
44
  self.assertResultIsBOOL(SecurityInterface.SFCertificatePanel.showsHelp)
45
45
 
46
+ def test_protocol_methods(self):
47
+ # Informal protocol
46
48
  self.assertResultIsBOOL(TestSFCertificatePanelHelper.certificatePanelShowHelp_)
@@ -1,9 +1,8 @@
1
1
  import SecurityInterface
2
- from PyObjCTools.TestSupport import TestCase, expectedFailure
2
+ from PyObjCTools.TestSupport import TestCase
3
3
 
4
4
 
5
5
  class TestSFCertificateView(TestCase):
6
- @expectedFailure
7
6
  def test_constants(self):
8
7
  # Constant is not present on 10.12
9
8
  self.assertHasAttr(