pyobjc-framework-CFNetwork 9.1b1__tar.gz → 9.2__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 (43) hide show
  1. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/Lib/CFNetwork/_metadata.py +26 -26
  2. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/Lib/pyobjc_framework_CFNetwork.egg-info/PKG-INFO +1 -1
  3. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/Lib/pyobjc_framework_CFNetwork.egg-info/SOURCES.txt +1 -0
  4. pyobjc-framework-CFNetwork-9.2/Lib/pyobjc_framework_CFNetwork.egg-info/requires.txt +2 -0
  5. pyobjc-framework-CFNetwork-9.2/Modules/_manual.m +626 -0
  6. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/Modules/pyobjc-compat.h +10 -0
  7. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PKG-INFO +1 -1
  8. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/metadata/CFNetwork.fwinfo +9 -6
  9. pyobjc-framework-CFNetwork-9.2/pyproject.toml +3 -0
  10. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/setup.py +8 -2
  11. pyobjc-framework-CFNetwork-9.1b1/Lib/pyobjc_framework_CFNetwork.egg-info/requires.txt +0 -2
  12. pyobjc-framework-CFNetwork-9.1b1/Modules/_manual.m +0 -318
  13. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/LICENSE.txt +0 -0
  14. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/Lib/CFNetwork/__init__.py +0 -0
  15. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/Lib/pyobjc_framework_CFNetwork.egg-info/dependency_links.txt +0 -0
  16. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/Lib/pyobjc_framework_CFNetwork.egg-info/not-zip-safe +0 -0
  17. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/Lib/pyobjc_framework_CFNetwork.egg-info/top_level.txt +0 -0
  18. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/MANIFEST.in +0 -0
  19. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/Modules/pyobjc-api.h +0 -0
  20. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/__init__.py +0 -0
  21. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/proxy.pac +0 -0
  22. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfftpstream.py +0 -0
  23. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfhost.py +0 -0
  24. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfhttpauthentication.py +0 -0
  25. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfhttpmessage.py +0 -0
  26. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfhttpstream.py +0 -0
  27. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfnetservices.py +0 -0
  28. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfnetwork.py +0 -0
  29. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfnetworkdiagnostics.py +0 -0
  30. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfnetworkerrors.py +0 -0
  31. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfproxysupport.py +0 -0
  32. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/PyObjCTest/test_cfsocketstream.py +0 -0
  33. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/README.txt +0 -0
  34. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/metadata/metadata.ini +0 -0
  35. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/metadata/raw/arm64-12.0.fwinfo +0 -0
  36. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/metadata/raw/arm64-12.3.fwinfo +0 -0
  37. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/metadata/raw/x86_64-10.10.fwinfo +0 -0
  38. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/metadata/raw/x86_64-10.15.fwinfo +0 -0
  39. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/metadata/raw/x86_64-10.16.fwinfo +0 -0
  40. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/metadata/raw/x86_64-12.0.fwinfo +0 -0
  41. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/metadata/raw/x86_64-12.3.fwinfo +0 -0
  42. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/pyobjc_setup.py +0 -0
  43. {pyobjc-framework-CFNetwork-9.1b1 → pyobjc-framework-CFNetwork-9.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  # This file is generated by objective.metadata
2
2
  #
3
- # Last update: Sun Feb 20 18:30:45 2022
3
+ # Last update: Fri May 19 21:48:40 2023
4
4
  #
5
5
  # flake8: noqa
6
6
 
@@ -48,6 +48,7 @@ misc.update(
48
48
  }
49
49
  )
50
50
  misc.update({})
51
+ misc.update({})
51
52
  functions = {
52
53
  "CFNetworkExecuteProxyAutoConfigurationURL": (
53
54
  b"^{__CFRunLoopSource=}^{__CFURL=}^{__CFURL=}^?^{_CFStreamClientContext=q^v^?^?^?}",
@@ -99,11 +100,17 @@ functions = {
99
100
  ),
100
101
  "CFNetServiceBrowserSearchForDomains": (
101
102
  b"Z^{__CFNetServiceBrowser=}Z^{_CFStreamError=qi}",
103
+ "",
104
+ {"arguments": {2: {"type_modifier": "o"}}},
102
105
  ),
103
106
  "CFNetServiceUnscheduleFromRunLoop": (
104
107
  b"v^{__CFNetService=}^{__CFRunLoop=}^{__CFString=}",
105
108
  ),
106
- "CFNetServiceMonitorStop": (b"v^{__CFNetServiceMonitor=}^{_CFStreamError=qi}",),
109
+ "CFNetServiceMonitorStop": (
110
+ b"v^{__CFNetServiceMonitor=}^{_CFStreamError=qi}",
111
+ "",
112
+ {"arguments": {1: {"type_modifier": "o"}}},
113
+ ),
107
114
  "CFNetworkCopySystemProxySettings": (
108
115
  b"^{__CFDictionary=}",
109
116
  "",
@@ -191,7 +198,11 @@ functions = {
191
198
  b"v^{__CFNetServiceMonitor=}^{__CFRunLoop=}^{__CFString=}",
192
199
  ),
193
200
  "CFHostScheduleWithRunLoop": (b"v^{__CFHost=}^{__CFRunLoop=}^{__CFString=}",),
194
- "CFNetServiceMonitorStart": (b"Z^{__CFNetServiceMonitor=}i^{_CFStreamError=qi}",),
201
+ "CFNetServiceMonitorStart": (
202
+ b"Z^{__CFNetServiceMonitor=}i^{_CFStreamError=qi}",
203
+ "",
204
+ {"arguments": {2: {"type_modifier": "o"}}},
205
+ ),
195
206
  "CFHostGetNames": (
196
207
  b"^{__CFArray=}^{__CFHost=}^Z",
197
208
  "",
@@ -281,6 +292,8 @@ functions = {
281
292
  ),
282
293
  "CFNetServiceBrowserStopSearch": (
283
294
  b"v^{__CFNetServiceBrowser=}^{_CFStreamError=qi}",
295
+ "",
296
+ {"arguments": {1: {"type_modifier": "o"}}},
284
297
  ),
285
298
  "CFHTTPMessageApplyCredentials": (
286
299
  b"Z^{__CFHTTPMessage=}^{_CFHTTPAuthentication=}^{__CFString=}^{__CFString=}^{_CFStreamError=qi}",
@@ -298,27 +311,6 @@ functions = {
298
311
  "",
299
312
  {"retval": {"already_cfretained": True}},
300
313
  ),
301
- "CFNetServiceBrowserCreate": (
302
- b"^{__CFNetServiceBrowser=}^{__CFAllocator=}^?^{CFNetServiceClientContext=q^v^?^?^?}",
303
- "",
304
- {
305
- "retval": {"already_cfretained": True},
306
- "arguments": {
307
- 1: {
308
- "callable": {
309
- "retval": {"type": b"v"},
310
- "arguments": {
311
- 0: {"type": b"^{__CFNetServiceBrowser=}"},
312
- 1: {"type": b"Q"},
313
- 2: {"type": b"@"},
314
- 3: {"type": b"^{_CFStreamError=qi}"},
315
- 4: {"type": b"^v"},
316
- },
317
- }
318
- }
319
- },
320
- },
321
- ),
322
314
  "CFNetServiceGetTargetHost": (b"^{__CFString=}^{__CFNetService=}",),
323
315
  "CFNetworkCopyProxiesForAutoConfigurationScript": (
324
316
  b"^{__CFArray=}^{__CFString=}^{__CFURL=}^^{__CFError=}",
@@ -339,7 +331,11 @@ functions = {
339
331
  "",
340
332
  {"retval": {"already_cfretained": True}},
341
333
  ),
342
- "CFNetServiceRegister": (b"Z^{__CFNetService=}^{_CFStreamError=qi}",),
334
+ "CFNetServiceRegister": (
335
+ b"Z^{__CFNetService=}^{_CFStreamError=qi}",
336
+ "",
337
+ {"arguments": {1: {"type_modifier": "o"}}},
338
+ ),
343
339
  "CFHTTPMessageCopySerializedMessage": (
344
340
  b"^{__CFData=}^{__CFHTTPMessage=}",
345
341
  "",
@@ -427,7 +423,11 @@ functions = {
427
423
  {"arguments": {3: {"type_modifier": "o"}}},
428
424
  ),
429
425
  "CFHTTPMessageIsRequest": (b"Z^{__CFHTTPMessage=}",),
430
- "CFNetServiceResolve": (b"Z^{__CFNetService=}^{_CFStreamError=qi}",),
426
+ "CFNetServiceResolve": (
427
+ b"Z^{__CFNetService=}^{_CFStreamError=qi}",
428
+ "",
429
+ {"arguments": {1: {"type_modifier": "o"}}},
430
+ ),
431
431
  "CFHTTPMessageCopyBody": (
432
432
  b"^{__CFData=}^{__CFHTTPMessage=}",
433
433
  "",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyobjc-framework-CFNetwork
3
- Version: 9.1b1
3
+ Version: 9.2
4
4
  Summary: Wrappers for the framework CFNetwork on macOS
5
5
  Home-page: https://github.com/ronaldoussoren/pyobjc
6
6
  Author: Ronald Oussoren
@@ -2,6 +2,7 @@ LICENSE.txt
2
2
  MANIFEST.in
3
3
  README.txt
4
4
  pyobjc_setup.py
5
+ pyproject.toml
5
6
  setup.py
6
7
  Lib/CFNetwork/__init__.py
7
8
  Lib/CFNetwork/_metadata.py
@@ -0,0 +1,2 @@
1
+ pyobjc-core>=9.2
2
+ pyobjc-framework-Cocoa>=9.2
@@ -0,0 +1,626 @@
1
+ #define Py_LIMITED_API 0x03060000
2
+ #define PY_SSIZE_T_CLEAN
3
+ #include "Python.h"
4
+ #include "pyobjc-api.h"
5
+
6
+ #import <CoreServices/CoreServices.h>
7
+ #if PyObjC_BUILD_RELEASE > 1008
8
+ #import <CFNetwork/CFNetwork.h>
9
+ #endif
10
+
11
+ static const void*
12
+ mod_retain(const void* info)
13
+ {
14
+ PyGILState_STATE state = PyGILState_Ensure();
15
+ Py_INCREF((PyObject*)info);
16
+ PyGILState_Release(state);
17
+ return info;
18
+ }
19
+
20
+ static void
21
+ mod_release(const void* info)
22
+ {
23
+ PyGILState_STATE state = PyGILState_Ensure();
24
+ Py_DECREF((PyObject*)info);
25
+ PyGILState_Release(state);
26
+ }
27
+
28
+ static CFStreamClientContext mod_CFStreamClientContext = {
29
+ 0, NULL, (void* (*)(void*))mod_retain, (void (*)(void*))mod_release, NULL};
30
+
31
+ static CFHostClientContext mod_CFHostClientContext = {0, NULL, mod_retain, mod_release,
32
+ 0};
33
+
34
+ static CFNetServiceClientContext mod_CFNetServiceClientContext = {0, NULL, mod_retain,
35
+ mod_release, 0};
36
+
37
+ #if PyObjC_BUILD_RELEASE >= 1005
38
+ static void
39
+ m_CFProxyAutoConfigurationResultCallback(void* _context, CFArrayRef proxyList,
40
+ CFErrorRef error)
41
+ {
42
+ PyObject* context = (PyObject*)_context;
43
+
44
+ PyGILState_STATE state = PyGILState_Ensure();
45
+
46
+ PyObject* py_func = PyTuple_GetItem(context, 0);
47
+ PyObject* py_ctx = PyTuple_GetItem(context, 1);
48
+
49
+ PyObject* py_list = PyObjC_IdToPython((NSObject*)(NSArray*)proxyList);
50
+ if (py_list == NULL) {
51
+ PyObjCErr_ToObjCWithGILState(&state);
52
+ return;
53
+ }
54
+ PyObject* py_error = PyObjC_IdToPython((NSObject*)(NSError*)error);
55
+ if (py_error == NULL) {
56
+ Py_DECREF(py_list);
57
+ PyObjCErr_ToObjCWithGILState(&state);
58
+ return;
59
+ }
60
+
61
+ PyObject* rv = PyObject_CallFunction(py_func, "ONN", py_ctx, py_list, py_error);
62
+
63
+ if (rv == NULL) {
64
+ PyObjCErr_ToObjCWithGILState(&state);
65
+ return;
66
+ }
67
+ Py_DECREF(rv);
68
+
69
+ PyGILState_Release(state);
70
+ }
71
+ #endif
72
+
73
+ static void
74
+ mod_CFNetServiceClientCallBack(CFNetServiceRef service, CFStreamError* error,
75
+ void* _context)
76
+ {
77
+ PyObject* context = (PyObject*)_context;
78
+
79
+ PyGILState_STATE state = PyGILState_Ensure();
80
+
81
+ PyObject* py_func = PyTuple_GetItem(context, 0);
82
+ PyObject* py_ctx = PyTuple_GetItem(context, 1);
83
+
84
+ PyObject* py_service = PyObjC_IdToPython((NSObject*)service);
85
+ if (py_service == NULL) {
86
+ PyObjCErr_ToObjCWithGILState(&state);
87
+ return;
88
+ }
89
+ PyObject* py_error = PyObjC_ObjCToPython("{_CFStreamError=qi}", (void*)error);
90
+ if (py_error == NULL) {
91
+ Py_DECREF(py_service);
92
+ PyObjCErr_ToObjCWithGILState(&state);
93
+ return;
94
+ }
95
+
96
+ PyObject* rv = PyObject_CallFunction(py_func, "NNO", py_service, py_error, py_ctx);
97
+
98
+ if (rv == NULL) {
99
+ PyObjCErr_ToObjCWithGILState(&state);
100
+ return;
101
+ }
102
+ Py_DECREF(rv);
103
+
104
+ PyGILState_Release(state);
105
+ }
106
+
107
+ static void
108
+ mod_CFNetServiceMonitorClientCallBack(CFNetServiceMonitorRef monitor,
109
+ CFNetServiceRef service,
110
+ CFNetServiceMonitorType typeInfo, CFDataRef rdata,
111
+ CFStreamError* error, void* _context)
112
+ {
113
+ PyObject* context = (PyObject*)_context;
114
+
115
+ PyGILState_STATE state = PyGILState_Ensure();
116
+
117
+ PyObject* py_func = PyTuple_GetItem(context, 0);
118
+ PyObject* py_ctx = PyTuple_GetItem(context, 1);
119
+
120
+ PyObject* py_monitor = PyObjC_IdToPython((NSObject*)monitor);
121
+ if (py_monitor == NULL) {
122
+ PyObjCErr_ToObjCWithGILState(&state);
123
+ return;
124
+ }
125
+
126
+ PyObject* py_service = PyObjC_IdToPython((NSObject*)service);
127
+ if (py_service == NULL) {
128
+ Py_DECREF(py_monitor);
129
+ PyObjCErr_ToObjCWithGILState(&state);
130
+ return;
131
+ }
132
+
133
+ PyObject* py_typeInfo =
134
+ PyObjC_ObjCToPython(@encode(CFNetServiceMonitorType), &typeInfo);
135
+ if (py_typeInfo == NULL) {
136
+ Py_DECREF(py_monitor);
137
+ Py_DECREF(py_service);
138
+ PyObjCErr_ToObjCWithGILState(&state);
139
+ return;
140
+ }
141
+
142
+ PyObject* py_rdata = PyObjC_IdToPython((NSObject*)rdata);
143
+ if (py_rdata == NULL) {
144
+ Py_DECREF(py_monitor);
145
+ Py_DECREF(py_service);
146
+ Py_DECREF(py_typeInfo);
147
+ PyObjCErr_ToObjCWithGILState(&state);
148
+ return;
149
+ }
150
+
151
+ PyObject* py_error = PyObjC_ObjCToPython("{_CFStreamError=qi}", (void*)error);
152
+ if (py_error == NULL) {
153
+ Py_DECREF(py_monitor);
154
+ Py_DECREF(py_service);
155
+ Py_DECREF(py_typeInfo);
156
+ Py_DECREF(py_rdata);
157
+ PyObjCErr_ToObjCWithGILState(&state);
158
+ return;
159
+ }
160
+
161
+ PyObject* rv = PyObject_CallFunction(py_func, "NNNNNO", py_monitor, py_service,
162
+ py_typeInfo, py_rdata, py_error, py_ctx);
163
+
164
+ if (rv == NULL) {
165
+ PyObjCErr_ToObjCWithGILState(&state);
166
+ return;
167
+ }
168
+ Py_DECREF(rv);
169
+
170
+ PyGILState_Release(state);
171
+ }
172
+
173
+ static void
174
+ m_CFHostClientCallBack(CFHostRef host, CFHostInfoType typeInfo,
175
+ const CFStreamError* error, void* _context)
176
+ {
177
+ PyObject* context = (PyObject*)_context;
178
+
179
+ PyGILState_STATE state = PyGILState_Ensure();
180
+
181
+ PyObject* py_func = PyTuple_GetItem(context, 0);
182
+ PyObject* py_ctx = PyTuple_GetItem(context, 1);
183
+
184
+ PyObject* py_host = PyObjC_IdToPython((NSObject*)host);
185
+ if (py_host == NULL) {
186
+ PyObjCErr_ToObjCWithGILState(&state);
187
+ return;
188
+ }
189
+ PyObject* py_info = PyObjC_ObjCToPython(@encode(CFHostInfoType), &typeInfo);
190
+ if (py_info == NULL) {
191
+ Py_DECREF(py_host);
192
+ PyObjCErr_ToObjCWithGILState(&state);
193
+ return;
194
+ }
195
+
196
+ PyObject* py_error = PyObjC_ObjCToPython("{_CFStreamError=qi}", (void*)error);
197
+ if (py_error == NULL) {
198
+ Py_DECREF(py_host);
199
+ Py_DECREF(py_info);
200
+ PyObjCErr_ToObjCWithGILState(&state);
201
+ return;
202
+ }
203
+
204
+ PyObject* rv =
205
+ PyObject_CallFunction(py_func, "NNNO", py_host, py_info, py_error, py_ctx);
206
+
207
+ if (rv == NULL) {
208
+ PyObjCErr_ToObjCWithGILState(&state);
209
+ return;
210
+ }
211
+ Py_DECREF(rv);
212
+
213
+ PyGILState_Release(state);
214
+ }
215
+
216
+ static PyObject*
217
+ m_CFNetworkExecuteProxyAutoConfigurationScript(PyObject* mod __attribute__((__unused__)),
218
+ PyObject* args)
219
+ {
220
+ CFStringRef script;
221
+ CFURLRef url;
222
+ PyObject* callback;
223
+ PyObject* ctx;
224
+ PyObject* py_script;
225
+ PyObject* py_url;
226
+
227
+ if (!PyArg_ParseTuple(args, "OOOO", &py_script, &py_url, &callback, &ctx)) {
228
+ return NULL;
229
+ }
230
+
231
+ if (depythonify_python_object(py_script, (id*)&script) == -1) {
232
+ return NULL;
233
+ }
234
+
235
+ if (depythonify_python_object(py_url, (id*)&url) == -1) {
236
+ return NULL;
237
+ }
238
+
239
+ PyObject* py_context = Py_BuildValue("OO", callback, ctx);
240
+ if (py_context == NULL) {
241
+ return NULL;
242
+ }
243
+
244
+ CFStreamClientContext context = mod_CFStreamClientContext;
245
+ context.info = py_context;
246
+
247
+ CFRunLoopSourceRef ref = NULL;
248
+
249
+ Py_BEGIN_ALLOW_THREADS
250
+ @try {
251
+ ref = CFNetworkExecuteProxyAutoConfigurationScript(
252
+ script, url, m_CFProxyAutoConfigurationResultCallback, &context);
253
+ } @catch (NSException* localException) {
254
+ PyObjCErr_FromObjC(localException);
255
+ ref = NULL;
256
+ }
257
+ Py_END_ALLOW_THREADS
258
+
259
+ Py_DECREF(py_context);
260
+
261
+ if (PyErr_Occurred()) {
262
+ return NULL;
263
+ }
264
+
265
+ PyObject* rv = PyObjC_IdToPython((NSObject*)ref);
266
+
267
+ return rv;
268
+ }
269
+
270
+ static PyObject*
271
+ m_CFNetworkExecuteProxyAutoConfigurationURL(PyObject* mod __attribute__((__unused__)),
272
+ PyObject* args)
273
+ {
274
+ CFURLRef script;
275
+ CFURLRef url;
276
+ PyObject* callback;
277
+ PyObject* ctx;
278
+ PyObject* py_script;
279
+ PyObject* py_url;
280
+
281
+ if (!PyArg_ParseTuple(args, "OOOO", &py_script, &py_url, &callback, &ctx)) {
282
+ return NULL;
283
+ }
284
+
285
+ if (depythonify_python_object(py_script, (id*)&script) == -1) {
286
+ return NULL;
287
+ }
288
+
289
+ if (depythonify_python_object(py_url, (id*)&url) == -1) {
290
+ return NULL;
291
+ }
292
+
293
+ PyObject* py_context = Py_BuildValue("OO", callback, ctx);
294
+ if (py_context == NULL) {
295
+ return NULL;
296
+ }
297
+
298
+ CFStreamClientContext context = mod_CFStreamClientContext;
299
+ context.info = py_context;
300
+
301
+ CFRunLoopSourceRef ref = NULL;
302
+
303
+ Py_BEGIN_ALLOW_THREADS
304
+ @try {
305
+ ref = CFNetworkExecuteProxyAutoConfigurationURL(
306
+ script, url, m_CFProxyAutoConfigurationResultCallback, &context);
307
+ } @catch (NSException* localException) {
308
+ PyObjCErr_FromObjC(localException);
309
+ ref = NULL;
310
+ }
311
+ Py_END_ALLOW_THREADS
312
+
313
+ Py_DECREF(py_context);
314
+
315
+ if (PyErr_Occurred()) {
316
+ return NULL;
317
+ }
318
+
319
+ PyObject* rv = PyObjC_IdToPython((NSObject*)ref);
320
+
321
+ return rv;
322
+ }
323
+
324
+ static PyObject*
325
+ m_CFHostSetClient(PyObject* mod __attribute__((__unused__)), PyObject* args)
326
+ {
327
+ CFHostRef host;
328
+ PyObject* callback;
329
+ PyObject* ctx;
330
+ PyObject* py_host;
331
+ Boolean ok = 0;
332
+
333
+ if (!PyArg_ParseTuple(args, "OOO", &py_host, &callback, &ctx)) {
334
+ return NULL;
335
+ }
336
+
337
+ if (depythonify_python_object(py_host, (id*)&host) == -1) {
338
+ return NULL;
339
+ }
340
+ if (callback == Py_None) {
341
+ Py_BEGIN_ALLOW_THREADS
342
+ @try {
343
+ ok = CFHostSetClient(host, NULL, NULL);
344
+ } @catch (NSException* localException) {
345
+ PyObjCErr_FromObjC(localException);
346
+ }
347
+ Py_END_ALLOW_THREADS
348
+
349
+ if (PyErr_Occurred()) {
350
+ return NULL;
351
+ }
352
+
353
+ return PyBool_FromLong(!!ok);
354
+ }
355
+
356
+ PyObject* py_context = Py_BuildValue("OO", callback, ctx);
357
+ if (py_context == NULL) {
358
+ return NULL;
359
+ }
360
+
361
+ CFHostClientContext context = mod_CFHostClientContext;
362
+ context.info = py_context;
363
+
364
+ Py_BEGIN_ALLOW_THREADS
365
+ @try {
366
+ ok = CFHostSetClient(host, m_CFHostClientCallBack, &context);
367
+ } @catch (NSException* localException) {
368
+ PyObjCErr_FromObjC(localException);
369
+ }
370
+ Py_END_ALLOW_THREADS
371
+
372
+ Py_DECREF(py_context);
373
+
374
+ if (PyErr_Occurred()) {
375
+ return NULL;
376
+ }
377
+
378
+ return PyBool_FromLong(!!ok);
379
+ }
380
+
381
+ static void
382
+ mod_CFNetServiceBrowserClientCallBack(CFNetServiceBrowserRef browser, CFOptionFlags flags,
383
+ CFTypeRef domainOrService, CFStreamError* error,
384
+ void* _context)
385
+ {
386
+ PyObject* context = (PyObject*)_context;
387
+
388
+ PyGILState_STATE state = PyGILState_Ensure();
389
+
390
+ PyObject* py_func = PyTuple_GetItem(context, 0);
391
+ PyObject* py_ctx = PyTuple_GetItem(context, 1);
392
+
393
+ PyObject* py_browser = PyObjC_IdToPython((NSObject*)browser);
394
+ if (py_browser == NULL) {
395
+ PyObjCErr_ToObjCWithGILState(&state);
396
+ return;
397
+ }
398
+ PyObject* py_flags = PyObjC_ObjCToPython(@encode(CFOptionFlags), &flags);
399
+ if (py_flags == NULL) {
400
+ Py_DECREF(py_browser);
401
+ PyObjCErr_ToObjCWithGILState(&state);
402
+ return;
403
+ }
404
+
405
+ PyObject* py_domainOrService = PyObjC_ObjCToPython("@", &domainOrService);
406
+ if (py_domainOrService == NULL) {
407
+ Py_DECREF(py_browser);
408
+ Py_DECREF(py_flags);
409
+ PyObjCErr_ToObjCWithGILState(&state);
410
+ return;
411
+ }
412
+
413
+ PyObject* py_error = PyObjC_ObjCToPython(@encode(CFStreamError), (void*)error);
414
+ if (py_error == NULL) {
415
+ Py_DECREF(py_browser);
416
+ Py_DECREF(py_flags);
417
+ Py_DECREF(py_domainOrService);
418
+ PyObjCErr_ToObjCWithGILState(&state);
419
+ return;
420
+ }
421
+
422
+ PyObject* rv = PyObject_CallFunction(py_func, "NNNNO", py_browser, py_flags,
423
+ py_domainOrService, py_error, py_ctx);
424
+
425
+ if (rv == NULL) {
426
+ PyObjCErr_ToObjCWithGILState(&state);
427
+ return;
428
+ }
429
+ Py_DECREF(rv);
430
+
431
+ PyGILState_Release(state);
432
+ }
433
+
434
+ static PyObject*
435
+ mod_CFNetServiceBrowserCreate(PyObject* mod __attribute__((__unused__)), PyObject* args)
436
+ {
437
+ CFAllocatorRef allocator;
438
+ PyObject* callback;
439
+ PyObject* ctx;
440
+ PyObject* py_allocator;
441
+
442
+ if (!PyArg_ParseTuple(args, "OOO", &py_allocator, &callback, &ctx)) {
443
+ return NULL;
444
+ }
445
+
446
+ if (depythonify_python_object(py_allocator, (id*)&allocator) == -1) {
447
+ return NULL;
448
+ }
449
+
450
+ PyObject* py_context = Py_BuildValue("OO", callback, ctx);
451
+ if (py_context == NULL) {
452
+ return NULL;
453
+ }
454
+
455
+ CFNetServiceClientContext context = mod_CFNetServiceClientContext;
456
+ context.info = py_context;
457
+
458
+ CFNetServiceBrowserRef ref = NULL;
459
+
460
+ Py_BEGIN_ALLOW_THREADS
461
+ @try {
462
+ ref = CFNetServiceBrowserCreate(
463
+ allocator, mod_CFNetServiceBrowserClientCallBack, &context);
464
+ } @catch (NSException* localException) {
465
+ PyObjCErr_FromObjC(localException);
466
+ ref = NULL;
467
+ }
468
+ Py_END_ALLOW_THREADS
469
+
470
+ Py_DECREF(py_context);
471
+
472
+ if (PyErr_Occurred()) {
473
+ return NULL;
474
+ }
475
+
476
+ PyObject* rv = PyObjC_IdToPython((NSObject*)ref);
477
+
478
+ return rv;
479
+ }
480
+
481
+ static PyObject*
482
+ mod_CFNetServiceSetClient(PyObject* mod __attribute__((__unused__)), PyObject* args)
483
+ {
484
+ CFNetServiceRef service;
485
+ PyObject* callback;
486
+ PyObject* ctx;
487
+ PyObject* py_service;
488
+
489
+ if (!PyArg_ParseTuple(args, "OOO", &py_service, &callback, &ctx)) {
490
+ return NULL;
491
+ }
492
+
493
+ if (depythonify_python_object(py_service, (id*)&service) == -1) {
494
+ return NULL;
495
+ }
496
+
497
+ PyObject* py_context = Py_BuildValue("OO", callback, ctx);
498
+ if (py_context == NULL) {
499
+ return NULL;
500
+ }
501
+
502
+ CFNetServiceClientContext context = mod_CFNetServiceClientContext;
503
+ context.info = py_context;
504
+
505
+ Boolean ok = NO;
506
+
507
+ Py_BEGIN_ALLOW_THREADS
508
+ @try {
509
+ ok = CFNetServiceSetClient(service, mod_CFNetServiceClientCallBack, &context);
510
+ } @catch (NSException* localException) {
511
+ PyObjCErr_FromObjC(localException);
512
+ ok = NO;
513
+ }
514
+ Py_END_ALLOW_THREADS
515
+
516
+ Py_DECREF(py_context);
517
+
518
+ if (PyErr_Occurred()) {
519
+ return NULL;
520
+ }
521
+
522
+ PyObject* rv = ok ? Py_True : Py_False;
523
+ Py_INCREF(rv);
524
+
525
+ return rv;
526
+ }
527
+
528
+ static PyObject*
529
+ mod_CFNetServiceMonitorCreate(PyObject* mod __attribute__((__unused__)), PyObject* args)
530
+ {
531
+ CFAllocatorRef allocator;
532
+ CFNetServiceRef service;
533
+ PyObject* callback;
534
+ PyObject* ctx;
535
+ PyObject* py_allocator;
536
+ PyObject* py_service;
537
+
538
+ if (!PyArg_ParseTuple(args, "OOOO", &py_allocator, &py_service, &callback, &ctx)) {
539
+ return NULL;
540
+ }
541
+
542
+ if (depythonify_python_object(py_allocator, (id*)&allocator) == -1) {
543
+ return NULL;
544
+ }
545
+
546
+ if (depythonify_python_object(py_service, (id*)&service) == -1) {
547
+ return NULL;
548
+ }
549
+
550
+ PyObject* py_context = Py_BuildValue("OO", callback, ctx);
551
+ if (py_context == NULL) {
552
+ return NULL;
553
+ }
554
+
555
+ CFNetServiceClientContext context = mod_CFNetServiceClientContext;
556
+ context.info = py_context;
557
+
558
+ CFNetServiceMonitorRef ref = NULL;
559
+
560
+ Py_BEGIN_ALLOW_THREADS
561
+ @try {
562
+ ref = CFNetServiceMonitorCreate(
563
+ allocator, service, mod_CFNetServiceMonitorClientCallBack, &context);
564
+ } @catch (NSException* localException) {
565
+ PyObjCErr_FromObjC(localException);
566
+ ref = NULL;
567
+ }
568
+ Py_END_ALLOW_THREADS
569
+
570
+ Py_DECREF(py_context);
571
+
572
+ if (PyErr_Occurred()) {
573
+ return NULL;
574
+ }
575
+
576
+ PyObject* rv = PyObjC_IdToPython((NSObject*)ref);
577
+
578
+ return rv;
579
+ }
580
+
581
+ static PyMethodDef mod_methods[] = {
582
+ #if PyObjC_BUILD_RELEASE >= 1005
583
+ {"CFNetworkExecuteProxyAutoConfigurationScript",
584
+ (PyCFunction)m_CFNetworkExecuteProxyAutoConfigurationScript, METH_VARARGS,
585
+ "CFNetworkExecuteProxyAutoConfigurationScript(arg0, arg1, arg2, arg3)"},
586
+ #endif /* OSX >= 10.5 */
587
+ #if PyObjC_BUILD_RELEASE >= 1005
588
+ {"CFNetworkExecuteProxyAutoConfigurationURL",
589
+ (PyCFunction)m_CFNetworkExecuteProxyAutoConfigurationURL, METH_VARARGS,
590
+ "CFNetworkExecuteProxyAutoConfigurationURL(arg0, arg1, arg2, arg3)"},
591
+ #endif /* OSX >= 10.5 */
592
+
593
+ {"CFHostSetClient", (PyCFunction)m_CFHostSetClient, METH_VARARGS,
594
+ "CFHostSetClient(arg0, arg1, arg2)"},
595
+ {"CFNetServiceBrowserCreate", (PyCFunction)mod_CFNetServiceBrowserCreate,
596
+ METH_VARARGS, "CFNetServiceBrowserCreate(arg0, arg1, arg2)"},
597
+ {"CFNetServiceSetClient", (PyCFunction)mod_CFNetServiceSetClient, METH_VARARGS,
598
+ "CFNetServiceSetClient(arg0, arg1, arg2)"},
599
+ {"CFNetServiceMonitorCreate", (PyCFunction)mod_CFNetServiceMonitorCreate,
600
+ METH_VARARGS, "CFNetServiceMonitorCreate(arg0, arg1, arg2, arg3)"},
601
+ {
602
+ 0,
603
+ 0,
604
+ 0,
605
+ }};
606
+
607
+ static struct PyModuleDef mod_module = {
608
+ PyModuleDef_HEAD_INIT, "_manual", NULL, 0, mod_methods, NULL, NULL, NULL, NULL};
609
+
610
+ PyObject* PyInit__manual(void);
611
+
612
+ PyObject* __attribute__((__visibility__("default"))) PyInit__manual(void)
613
+ {
614
+ PyObject* m;
615
+
616
+ m = PyModule_Create(&mod_module);
617
+ if (!m) {
618
+ return NULL;
619
+ }
620
+
621
+ if (PyObjC_ImportAPI(m) < 0) {
622
+ return NULL;
623
+ }
624
+
625
+ return m;
626
+ }
@@ -305,6 +305,14 @@ NS_ASSUME_NONNULL_BEGIN
305
305
  #define MAC_OS_X_VERSION_13_3 130300
306
306
  #endif
307
307
 
308
+ #ifndef MAC_OS_X_VERSION_13_4
309
+ #define MAC_OS_X_VERSION_13_4 130400
310
+ #endif
311
+
312
+ #ifndef MAC_OS_X_VERSION_13_5
313
+ #define MAC_OS_X_VERSION_13_5 130500
314
+ #endif
315
+
308
316
  /*
309
317
  *
310
318
  * End of Cocoa definitions
@@ -503,6 +511,8 @@ _PyObjCTuple_GetItem(PyObject* tuple, Py_ssize_t idx)
503
511
  PyGILState_Release(_GILState); \
504
512
  } while (0)
505
513
 
514
+ extern PyObject* _Nullable PyObjC_get_tp_dict(PyTypeObject* _Nonnull tp);
515
+
506
516
  NS_ASSUME_NONNULL_END
507
517
 
508
518
  #endif /* PyObjC_COMPAT_H */
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyobjc-framework-CFNetwork
3
- Version: 9.1b1
3
+ Version: 9.2
4
4
  Summary: Wrappers for the framework CFNetwork on macOS
5
5
  Home-page: https://github.com/ronaldoussoren/pyobjc
6
6
  Author: Ronald Oussoren
@@ -466,6 +466,7 @@
466
466
  }
467
467
  },
468
468
  "CFNetServiceBrowserCreate": {
469
+ "ignore": true,
469
470
  "args": {
470
471
  "0": {},
471
472
  "1": {
@@ -513,7 +514,7 @@
513
514
  "CFNetServiceBrowserSearchForDomains": {
514
515
  "args": {
515
516
  "0": {},
516
- "2": {}
517
+ "2": {"type_modifier": "o" }
517
518
  }
518
519
  },
519
520
  "CFNetServiceBrowserSearchForServices": {
@@ -527,7 +528,7 @@
527
528
  "CFNetServiceBrowserStopSearch": {
528
529
  "args": {
529
530
  "0": {},
530
- "1": {}
531
+ "1": {"type_modifier": "o" }
531
532
  }
532
533
  },
533
534
  "CFNetServiceBrowserUnscheduleFromRunLoop": {
@@ -632,6 +633,7 @@
632
633
  "retval": {}
633
634
  },
634
635
  "CFNetServiceMonitorCreate": {
636
+ "ignore": true,
635
637
  "args": {
636
638
  "0": {},
637
639
  "1": {},
@@ -683,13 +685,13 @@
683
685
  "CFNetServiceMonitorStart": {
684
686
  "args": {
685
687
  "0": {},
686
- "2": {}
688
+ "2": { "type_modifier": "o"}
687
689
  }
688
690
  },
689
691
  "CFNetServiceMonitorStop": {
690
692
  "args": {
691
693
  "0": {},
692
- "1": {}
694
+ "1": { "type_modifier": "o"}
693
695
  }
694
696
  },
695
697
  "CFNetServiceMonitorUnscheduleFromRunLoop": {
@@ -702,7 +704,7 @@
702
704
  "CFNetServiceRegister": {
703
705
  "args": {
704
706
  "0": {},
705
- "1": {}
707
+ "1": { "type_modifier": "o" }
706
708
  }
707
709
  },
708
710
  "CFNetServiceRegisterWithOptions": {
@@ -714,7 +716,7 @@
714
716
  "CFNetServiceResolve": {
715
717
  "args": {
716
718
  "0": {},
717
- "1": {}
719
+ "1": { "type_modifier": "o"}
718
720
  }
719
721
  },
720
722
  "CFNetServiceResolveWithTimeout": {
@@ -731,6 +733,7 @@
731
733
  }
732
734
  },
733
735
  "CFNetServiceSetClient": {
736
+ "ignore": true,
734
737
  "args": {
735
738
  "0": {},
736
739
  "1": {
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -12,9 +12,15 @@ for information on how to use this framework and PyObjC's documentation
12
12
  for general tips and tricks regarding the translation between Python
13
13
  and (Objective-)C frameworks
14
14
  """
15
- from pyobjc_setup import Extension, setup
15
+ import os
16
+ import sys
16
17
 
17
- VERSION = "9.1b1"
18
+ sys.path.insert(0, os.path.dirname(__file__))
19
+
20
+
21
+ from pyobjc_setup import Extension, setup # noqa: E402
22
+
23
+ VERSION = "9.2"
18
24
 
19
25
  setup(
20
26
  name="pyobjc-framework-CFNetwork",
@@ -1,2 +0,0 @@
1
- pyobjc-core>=9.1b1
2
- pyobjc-framework-Cocoa>=9.1b1
@@ -1,318 +0,0 @@
1
- #define Py_LIMITED_API 0x03060000
2
- #define PY_SSIZE_T_CLEAN
3
- #include "Python.h"
4
- #include "pyobjc-api.h"
5
-
6
- #import <CoreServices/CoreServices.h>
7
- #if PyObjC_BUILD_RELEASE > 1008
8
- #import <CFNetwork/CFNetwork.h>
9
- #endif
10
-
11
- static const void*
12
- mod_retain(const void* info)
13
- {
14
- PyGILState_STATE state = PyGILState_Ensure();
15
- Py_INCREF((PyObject*)info);
16
- PyGILState_Release(state);
17
- return info;
18
- }
19
-
20
- static void
21
- mod_release(const void* info)
22
- {
23
- PyGILState_STATE state = PyGILState_Ensure();
24
- Py_DECREF((PyObject*)info);
25
- PyGILState_Release(state);
26
- }
27
-
28
- static CFStreamClientContext mod_CFStreamClientContext = {
29
- 0, NULL, (void* (*)(void*))mod_retain, (void (*)(void*))mod_release, NULL};
30
-
31
- static CFHostClientContext mod_CFHostClientContext = {0, NULL, mod_retain, mod_release,
32
- 0};
33
-
34
- #if PyObjC_BUILD_RELEASE >= 1005
35
- static void
36
- m_CFProxyAutoConfigurationResultCallback(void* _context, CFArrayRef proxyList,
37
- CFErrorRef error)
38
- {
39
- PyObject* context = (PyObject*)_context;
40
-
41
- PyGILState_STATE state = PyGILState_Ensure();
42
-
43
- PyObject* py_func = PyTuple_GetItem(context, 0);
44
- PyObject* py_ctx = PyTuple_GetItem(context, 1);
45
-
46
- PyObject* py_list = PyObjC_IdToPython((NSObject*)(NSArray*)proxyList);
47
- if (py_list == NULL) {
48
- PyObjCErr_ToObjCWithGILState(&state);
49
- return;
50
- }
51
- PyObject* py_error = PyObjC_IdToPython((NSObject*)(NSError*)error);
52
- if (py_error == NULL) {
53
- Py_DECREF(py_list);
54
- PyObjCErr_ToObjCWithGILState(&state);
55
- return;
56
- }
57
-
58
- PyObject* rv = PyObject_CallFunction(py_func, "ONN", py_ctx, py_list, py_error);
59
-
60
- if (rv == NULL) {
61
- PyObjCErr_ToObjCWithGILState(&state);
62
- return;
63
- }
64
- Py_DECREF(rv);
65
-
66
- PyGILState_Release(state);
67
- }
68
- #endif
69
-
70
- static void
71
- m_CFHostClientCallBack(CFHostRef host, CFHostInfoType typeInfo,
72
- const CFStreamError* error, void* _context)
73
- {
74
- PyObject* context = (PyObject*)_context;
75
-
76
- PyGILState_STATE state = PyGILState_Ensure();
77
-
78
- PyObject* py_func = PyTuple_GetItem(context, 0);
79
- PyObject* py_ctx = PyTuple_GetItem(context, 1);
80
-
81
- PyObject* py_host = PyObjC_IdToPython((NSObject*)host);
82
- if (py_host == NULL) {
83
- PyObjCErr_ToObjCWithGILState(&state);
84
- return;
85
- }
86
- PyObject* py_info = PyObjC_ObjCToPython(@encode(CFHostInfoType), &typeInfo);
87
- if (py_info == NULL) {
88
- Py_DECREF(py_host);
89
- PyObjCErr_ToObjCWithGILState(&state);
90
- return;
91
- }
92
-
93
- PyObject* py_error = PyObjC_ObjCToPython("{_CFStreamError=qi}", (void*)error);
94
- if (py_error == NULL) {
95
- Py_DECREF(py_host);
96
- Py_DECREF(py_info);
97
- PyObjCErr_ToObjCWithGILState(&state);
98
- return;
99
- }
100
-
101
- PyObject* rv =
102
- PyObject_CallFunction(py_func, "NNNO", py_host, py_info, py_error, py_ctx);
103
-
104
- if (rv == NULL) {
105
- PyObjCErr_ToObjCWithGILState(&state);
106
- return;
107
- }
108
- Py_DECREF(rv);
109
-
110
- PyGILState_Release(state);
111
- }
112
-
113
- static PyObject*
114
- m_CFNetworkExecuteProxyAutoConfigurationScript(PyObject* mod __attribute__((__unused__)),
115
- PyObject* args)
116
- {
117
- CFStringRef script;
118
- CFURLRef url;
119
- PyObject* callback;
120
- PyObject* ctx;
121
- PyObject* py_script;
122
- PyObject* py_url;
123
-
124
- if (!PyArg_ParseTuple(args, "OOOO", &py_script, &py_url, &callback, &ctx)) {
125
- return NULL;
126
- }
127
-
128
- if (depythonify_python_object(py_script, (id*)&script) == -1) {
129
- return NULL;
130
- }
131
-
132
- if (depythonify_python_object(py_url, (id*)&url) == -1) {
133
- return NULL;
134
- }
135
-
136
- PyObject* py_context = Py_BuildValue("OO", callback, ctx);
137
- if (py_context == NULL) {
138
- return NULL;
139
- }
140
-
141
- CFStreamClientContext context = mod_CFStreamClientContext;
142
- context.info = py_context;
143
-
144
- CFRunLoopSourceRef ref = NULL;
145
-
146
- Py_BEGIN_ALLOW_THREADS
147
- @try {
148
- ref = CFNetworkExecuteProxyAutoConfigurationScript(
149
- script, url, m_CFProxyAutoConfigurationResultCallback, &context);
150
- } @catch (NSException* localException) {
151
- PyObjCErr_FromObjC(localException);
152
- ref = NULL;
153
- }
154
- Py_END_ALLOW_THREADS
155
-
156
- Py_DECREF(py_context);
157
-
158
- if (PyErr_Occurred()) {
159
- return NULL;
160
- }
161
-
162
- PyObject* rv = PyObjC_IdToPython((NSObject*)ref);
163
-
164
- return rv;
165
- }
166
-
167
- static PyObject*
168
- m_CFNetworkExecuteProxyAutoConfigurationURL(PyObject* mod __attribute__((__unused__)),
169
- PyObject* args)
170
- {
171
- CFURLRef script;
172
- CFURLRef url;
173
- PyObject* callback;
174
- PyObject* ctx;
175
- PyObject* py_script;
176
- PyObject* py_url;
177
-
178
- if (!PyArg_ParseTuple(args, "OOOO", &py_script, &py_url, &callback, &ctx)) {
179
- return NULL;
180
- }
181
-
182
- if (depythonify_python_object(py_script, (id*)&script) == -1) {
183
- return NULL;
184
- }
185
-
186
- if (depythonify_python_object(py_url, (id*)&url) == -1) {
187
- return NULL;
188
- }
189
-
190
- PyObject* py_context = Py_BuildValue("OO", callback, ctx);
191
- if (py_context == NULL) {
192
- return NULL;
193
- }
194
-
195
- CFStreamClientContext context = mod_CFStreamClientContext;
196
- context.info = py_context;
197
-
198
- CFRunLoopSourceRef ref = NULL;
199
-
200
- Py_BEGIN_ALLOW_THREADS
201
- @try {
202
- ref = CFNetworkExecuteProxyAutoConfigurationURL(
203
- script, url, m_CFProxyAutoConfigurationResultCallback, &context);
204
- } @catch (NSException* localException) {
205
- PyObjCErr_FromObjC(localException);
206
- ref = NULL;
207
- }
208
- Py_END_ALLOW_THREADS
209
-
210
- Py_DECREF(py_context);
211
-
212
- if (PyErr_Occurred()) {
213
- return NULL;
214
- }
215
-
216
- PyObject* rv = PyObjC_IdToPython((NSObject*)ref);
217
-
218
- return rv;
219
- }
220
-
221
- static PyObject*
222
- m_CFHostSetClient(PyObject* mod __attribute__((__unused__)), PyObject* args)
223
- {
224
- CFHostRef host;
225
- PyObject* callback;
226
- PyObject* ctx;
227
- PyObject* py_host;
228
- Boolean ok = 0;
229
-
230
- if (!PyArg_ParseTuple(args, "OOO", &py_host, &callback, &ctx)) {
231
- return NULL;
232
- }
233
-
234
- if (depythonify_python_object(py_host, (id*)&host) == -1) {
235
- return NULL;
236
- }
237
- if (callback == Py_None) {
238
- Py_BEGIN_ALLOW_THREADS
239
- @try {
240
- ok = CFHostSetClient(host, NULL, NULL);
241
- } @catch (NSException* localException) {
242
- PyObjCErr_FromObjC(localException);
243
- }
244
- Py_END_ALLOW_THREADS
245
-
246
- if (PyErr_Occurred()) {
247
- return NULL;
248
- }
249
-
250
- return PyBool_FromLong(!!ok);
251
- }
252
-
253
- PyObject* py_context = Py_BuildValue("OO", callback, ctx);
254
- if (py_context == NULL) {
255
- return NULL;
256
- }
257
-
258
- CFHostClientContext context = mod_CFHostClientContext;
259
- context.info = py_context;
260
-
261
- Py_BEGIN_ALLOW_THREADS
262
- @try {
263
- ok = CFHostSetClient(host, m_CFHostClientCallBack, &context);
264
- } @catch (NSException* localException) {
265
- PyObjCErr_FromObjC(localException);
266
- }
267
- Py_END_ALLOW_THREADS
268
-
269
- Py_DECREF(py_context);
270
-
271
- if (PyErr_Occurred()) {
272
- return NULL;
273
- }
274
-
275
- return PyBool_FromLong(!!ok);
276
- }
277
-
278
- static PyMethodDef mod_methods[] = {
279
- #if PyObjC_BUILD_RELEASE >= 1005
280
- {"CFNetworkExecuteProxyAutoConfigurationScript",
281
- (PyCFunction)m_CFNetworkExecuteProxyAutoConfigurationScript, METH_VARARGS,
282
- "CFNetworkExecuteProxyAutoConfigurationScript(arg0, arg1, arg2, arg3)"},
283
- #endif /* OSX >= 10.5 */
284
- #if PyObjC_BUILD_RELEASE >= 1005
285
- {"CFNetworkExecuteProxyAutoConfigurationURL",
286
- (PyCFunction)m_CFNetworkExecuteProxyAutoConfigurationURL, METH_VARARGS,
287
- "CFNetworkExecuteProxyAutoConfigurationURL(arg0, arg1, arg2, arg3)"},
288
- #endif /* OSX >= 10.5 */
289
-
290
- {"CFHostSetClient", (PyCFunction)m_CFHostSetClient, METH_VARARGS,
291
- "CFHostSetClient(arg0, arg1, arg2)"},
292
-
293
- {
294
- 0,
295
- 0,
296
- 0,
297
- }};
298
-
299
- static struct PyModuleDef mod_module = {
300
- PyModuleDef_HEAD_INIT, "_manual", NULL, 0, mod_methods, NULL, NULL, NULL, NULL};
301
-
302
- PyObject* PyInit__manual(void);
303
-
304
- PyObject* __attribute__((__visibility__("default"))) PyInit__manual(void)
305
- {
306
- PyObject* m;
307
-
308
- m = PyModule_Create(&mod_module);
309
- if (!m) {
310
- return NULL;
311
- }
312
-
313
- if (PyObjC_ImportAPI(m) < 0) {
314
- return NULL;
315
- }
316
-
317
- return m;
318
- }