| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 43a1869 commit 2c47c65
25 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -302,6 +302,16 @@ extern void _Py_skiproot(const wchar_t *path, Py_ssize_t size, Py_ssize_t *drvsi | |||
| 302 | 302 | // Export for 'select' shared extension (Argument Clinic code) | |
| 303 | 303 | PyAPI_FUNC(int) _PyLong_FileDescriptor_Converter(PyObject *, void *); | |
| 304 | 304 | ||
| 305 | + #ifdef MS_WINDOWS | ||
| 306 | + /* Windows uses long long for offsets */ | ||
| 307 | + typedef long long Py_off_t; | ||
| 308 | + #else | ||
| 309 | + typedef off_t Py_off_t; | ||
| 310 | + #endif | ||
| 311 | + | ||
| 312 | + // Export for '_ssl' and 'zlib' shared extensions (Argument Clinic code) | ||
| 313 | + PyAPI_FUNC(int) _Py_Off_t_Converter(PyObject *, void *); | ||
| 314 | + | ||
| 305 | 315 | // Export for test_peg_generator | |
| 306 | 316 | PyAPI_FUNC(char*) _Py_UniversalNewlineFgetsWithSize(char *, int, FILE*, PyObject *, size_t*); | |
| 307 | 317 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3561,18 +3561,23 @@ def test_cli_converters(self): | |||
| 3561 | 3561 | """) | |
| 3562 | 3562 | expected_converters = ( | |
| 3563 | 3563 | "bool", | |
| 3564 | + "BOOL", | ||
| 3564 | 3565 | "byte", | |
| 3565 | 3566 | "char", | |
| 3566 | 3567 | "defining_class", | |
| 3567 | 3568 | "double", | |
| 3569 | + "DWORD", | ||
| 3568 | 3570 | "fildes", | |
| 3569 | 3571 | "float", | |
| 3572 | + "HANDLE", | ||
| 3570 | 3573 | "int", | |
| 3571 | 3574 | "long", | |
| 3572 | 3575 | "long_long", | |
| 3573 | 3576 | "object", | |
| 3577 | + "pid_t", | ||
| 3574 | 3578 | "Py_buffer", | |
| 3575 | 3579 | "Py_complex", | |
| 3580 | + "Py_off_t", | ||
| 3576 | 3581 | "Py_ssize_t", | |
| 3577 | 3582 | "Py_UNICODE", | |
| 3578 | 3583 | "PyByteArrayObject", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + Argument Clinic: the ``pid_t``, ``Py_off_t``, ``HANDLE``, ``DWORD`` and | ||
| 2 | + ``BOOL`` converters, previously defined in 9 different files, are now | ||
| 3 | + provided by Argument Clinic itself. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | #include "exports.h" | |
| 6 | 6 | ||
| 7 | + #include "pycore_fileutils.h" // Py_off_t | ||
| 7 | 8 | #include "pycore_moduleobject.h" // _PyModule_GetState() | |
| 8 | 9 | #include "pycore_typeobject.h" // _PyType_GetModuleState() | |
| 9 | 10 | #include "structmember.h" | |
@@ -94,8 +95,6 @@ extern int _PyIO_trap_eintr(void); | |||
| 94 | 95 | ||
| 95 | 96 | #ifdef MS_WINDOWS | |
| 96 | 97 | ||
| 97 | - /* Windows uses long long for offsets */ | ||
| 98 | - typedef long long Py_off_t; | ||
| 99 | 98 | # define PyLong_AsOff_t PyLong_AsLongLong | |
| 100 | 99 | # define PyLong_FromOff_t PyLong_FromLongLong | |
| 101 | 100 | # define PY_OFF_T_MAX LLONG_MAX | |
@@ -106,7 +105,6 @@ typedef long long Py_off_t; | |||
| 106 | 105 | #else | |
| 107 | 106 | ||
| 108 | 107 | /* Other platforms use off_t */ | |
| 109 | - typedef off_t Py_off_t; | ||
| 110 | 108 | #if (SIZEOF_OFF_T == SIZEOF_SIZE_T) | |
| 111 | 109 | # define PyLong_AsOff_t PyLong_AsSsize_t | |
| 112 | 110 | # define PyLong_FromOff_t PyLong_FromSsize_t | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,22 +9,6 @@ | |||
| 9 | 9 | ||
| 10 | 10 | #include "multiprocessing.h" | |
| 11 | 11 | ||
| 12 | - /*[python input] | ||
| 13 | - class HANDLE_converter(CConverter): | ||
| 14 | - type = "HANDLE" | ||
| 15 | - format_unit = '"F_HANDLE"' | ||
| 16 | - | ||
| 17 | - def parse_arg(self, argname, displayname, *, limited_capi): | ||
| 18 | - return self.format_code(""" | ||
| 19 | - {paramname} = PyLong_AsVoidPtr({argname}); | ||
| 20 | - if (!{paramname} && PyErr_Occurred()) {{{{ | ||
| 21 | - goto exit; | ||
| 22 | - }}}} | ||
| 23 | - """, | ||
| 24 | - argname=argname) | ||
| 25 | - | ||
| 26 | - [python start generated code]*/ | ||
| 27 | - /*[python end generated code: output=da39a3ee5e6b4b0d input=3cf0318efc6a8772]*/ | ||
| 28 | 12 | ||
| 29 | 13 | /*[clinic input] | |
| 30 | 14 | module _multiprocessing | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,22 +84,6 @@ module _posixsubprocess | |||
| 84 | 84 | [clinic start generated code]*/ | |
| 85 | 85 | /*[clinic end generated code: output=da39a3ee5e6b4b0d input=c62211df27cf7334]*/ | |
| 86 | 86 | ||
| 87 | - /*[python input] | ||
| 88 | - class pid_t_converter(CConverter): | ||
| 89 | - type = 'pid_t' | ||
| 90 | - format_unit = '" _Py_PARSE_PID "' | ||
| 91 | - | ||
| 92 | - def parse_arg(self, argname, displayname, *, limited_capi): | ||
| 93 | - return self.format_code(""" | ||
| 94 | - {paramname} = PyLong_AsPid({argname}); | ||
| 95 | - if ({paramname} == -1 && PyErr_Occurred()) {{{{ | ||
| 96 | - goto exit; | ||
| 97 | - }}}} | ||
| 98 | - """, | ||
| 99 | - argname=argname) | ||
| 100 | - [python start generated code]*/ | ||
| 101 | - /*[python end generated code: output=da39a3ee5e6b4b0d input=c94349aa1aad151d]*/ | ||
| 102 | - | ||
| 103 | 87 | #include "clinic/_posixsubprocess.c.h" | |
| 104 | 88 | ||
| 105 | 89 | /* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -281,7 +281,7 @@ class _remote_debugging.RemoteUnwinder "RemoteUnwinderObject *" "&RemoteUnwinder | |||
| 281 | 281 | /*[clinic input] | |
| 282 | 282 | @permit_long_summary | |
| 283 | 283 | _remote_debugging.RemoteUnwinder.__init__ | |
| 284 | - pid: int | ||
| 284 | + pid: pid_t | ||
| 285 | 285 | * | |
| 286 | 286 | all_threads: bool = False | |
| 287 | 287 | only_active_thread: bool = False | |
@@ -334,14 +334,14 @@ other runtime data. | |||
| 334 | 334 | ||
| 335 | 335 | static int | |
| 336 | 336 | _remote_debugging_RemoteUnwinder___init___impl(RemoteUnwinderObject *self, | |
| 337 | - int pid, int all_threads, | ||
| 337 | + pid_t pid, int all_threads, | ||
| 338 | 338 | int only_active_thread, | |
| 339 | 339 | int mode, int debug, | |
| 340 | 340 | int skip_non_matching_threads, | |
| 341 | 341 | int native, int gc, | |
| 342 | 342 | int opcodes, int cache_frames, | |
| 343 | 343 | int stats) | |
| 344 | - /*[clinic end generated code: output=0031f743f4b9ad52 input=9d25ae328d62626d]*/ | ||
| 344 | + /*[clinic end generated code: output=acfe554c8a92cf6b input=3b5a5ad153709125]*/ | ||
| 345 | 345 | { | |
| 346 | 346 | // Validate that all_threads and only_active_thread are not both True | |
| 347 | 347 | if (all_threads && only_active_thread) { | |
@@ -1376,7 +1376,7 @@ cleanup_runtime_offsets(RuntimeOffsets *offsets) | |||
| 1376 | 1376 | } | |
| 1377 | 1377 | ||
| 1378 | 1378 | static int | |
| 1379 | - init_runtime_offsets(RuntimeOffsets *offsets, int pid, int debug) | ||
| 1379 | + init_runtime_offsets(RuntimeOffsets *offsets, pid_t pid, int debug) | ||
| 1380 | 1380 | { | |
| 1381 | 1381 | offsets->debug = debug; | |
| 1382 | 1382 | if (_Py_RemoteDebug_InitProcHandle(&offsets->handle, pid) < 0) { | |
@@ -1414,7 +1414,7 @@ class _remote_debugging.GCMonitor "GCMonitorObject *" "&GCMonitor_Type" | |||
| 1414 | 1414 | /*[clinic input] | |
| 1415 | 1415 | @permit_long_summary | |
| 1416 | 1416 | _remote_debugging.GCMonitor.__init__ | |
| 1417 | - pid: int | ||
| 1417 | + pid: pid_t | ||
| 1418 | 1418 | * | |
| 1419 | 1419 | debug: bool = False | |
| 1420 | 1420 | ||
@@ -1437,9 +1437,9 @@ a running Python process. | |||
| 1437 | 1437 | [clinic start generated code]*/ | |
| 1438 | 1438 | ||
| 1439 | 1439 | static int | |
| 1440 | - _remote_debugging_GCMonitor___init___impl(GCMonitorObject *self, int pid, | ||
| 1440 | + _remote_debugging_GCMonitor___init___impl(GCMonitorObject *self, pid_t pid, | ||
| 1441 | 1441 | int debug) | |
| 1442 | - /*[clinic end generated code: output=2cdf351c2f6335db input=03da0b2d3282ae1b]*/ | ||
| 1442 | + /*[clinic end generated code: output=03b4c92bef0673ad input=dcc6ee2ec5a16fa1]*/ | ||
| 1443 | 1443 | { | |
| 1444 | 1444 | return init_runtime_offsets(&self->offsets, pid, debug); | |
| 1445 | 1445 | } | |
@@ -2226,7 +2226,7 @@ _remote_debugging_zstd_available_impl(PyObject *module) | |||
| 2226 | 2226 | /*[clinic input] | |
| 2227 | 2227 | _remote_debugging.get_child_pids | |
| 2228 | 2228 | ||
| 2229 | - pid: int | ||
| 2229 | + pid: pid_t | ||
| 2230 | 2230 | Process ID of the parent process | |
| 2231 | 2231 | * | |
| 2232 | 2232 | recursive: bool = True | |
@@ -2248,24 +2248,24 @@ list is returned. | |||
| 2248 | 2248 | [clinic start generated code]*/ | |
| 2249 | 2249 | ||
| 2250 | 2250 | static PyObject * | |
| 2251 | - _remote_debugging_get_child_pids_impl(PyObject *module, int pid, | ||
| 2251 | + _remote_debugging_get_child_pids_impl(PyObject *module, pid_t pid, | ||
| 2252 | 2252 | int recursive) | |
| 2253 | - /*[clinic end generated code: output=1ae2289c6b953e4b input=c6437b52e2fdd880]*/ | ||
| 2253 | + /*[clinic end generated code: output=fa3dfd1b02eed29b input=3325d95e9f39d75d]*/ | ||
| 2254 | 2254 | { | |
| 2255 | - return enumerate_child_pids((pid_t)pid, recursive); | ||
| 2255 | + return enumerate_child_pids(pid, recursive); | ||
| 2256 | 2256 | } | |
| 2257 | 2257 | ||
| 2258 | 2258 | /*[clinic input] | |
| 2259 | 2259 | _remote_debugging.is_python_process | |
| 2260 | 2260 | ||
| 2261 | - pid: int | ||
| 2261 | + pid: pid_t | ||
| 2262 | 2262 | ||
| 2263 | 2263 | Check if a process is a Python process. | |
| 2264 | 2264 | [clinic start generated code]*/ | |
| 2265 | 2265 | ||
| 2266 | 2266 | static PyObject * | |
| 2267 | - _remote_debugging_is_python_process_impl(PyObject *module, int pid) | ||
| 2268 | - /*[clinic end generated code: output=22947dc8afcac362 input=13488e28c7295d84]*/ | ||
| 2267 | + _remote_debugging_is_python_process_impl(PyObject *module, pid_t pid) | ||
| 2268 | + /*[clinic end generated code: output=63541478c889e536 input=ff998fef4aeef433]*/ | ||
| 2269 | 2269 | { | |
| 2270 | 2270 | proc_handle_t handle; | |
| 2271 | 2271 | ||
@@ -2288,7 +2288,7 @@ _remote_debugging_is_python_process_impl(PyObject *module, int pid) | |||
| 2288 | 2288 | /*[clinic input] | |
| 2289 | 2289 | _remote_debugging.get_gc_stats | |
| 2290 | 2290 | ||
| 2291 | - pid: int | ||
| 2291 | + pid: pid_t | ||
| 2292 | 2292 | * | |
| 2293 | 2293 | all_interpreters: bool = False | |
| 2294 | 2294 | If True, return GC statistics from all interpreters. | |
@@ -2314,9 +2314,9 @@ Get garbage collector statistics from external Python process. | |||
| 2314 | 2314 | [clinic start generated code]*/ | |
| 2315 | 2315 | ||
| 2316 | 2316 | static PyObject * | |
| 2317 | - _remote_debugging_get_gc_stats_impl(PyObject *module, int pid, | ||
| 2317 | + _remote_debugging_get_gc_stats_impl(PyObject *module, pid_t pid, | ||
| 2318 | 2318 | int all_interpreters) | |
| 2319 | - /*[clinic end generated code: output=d9dce5f7add149bb input=a2a08a45a8f0b119]*/ | ||
| 2319 | + /*[clinic end generated code: output=dd33199ccb6a56e9 input=41399e77788aa369]*/ | ||
| 2320 | 2320 | { | |
| 2321 | 2321 | RuntimeOffsets offsets; | |
| 2322 | 2322 | if (init_runtime_offsets(&offsets, pid, /*debug=*/1) < 0) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments