Compare commits

...

78 Commits

Author SHA1 Message Date
Ole André Vadla Ravnås 0f50b58a04 subprojects: Prepare for release 2026-02-13 22:48:36 +01:00
Ole André Vadla Ravnås f63ea5903f subprojects: Bump outdated 2026-02-13 22:47:43 +01:00
Ole André Vadla Ravnås a99767e501 subprojects: Prepare for release 2026-02-13 15:12:36 +01:00
Ole André Vadla Ravnås 07bbd3d488 subprojects: Bump outdated 2026-02-13 15:09:57 +01:00
Ole André Vadla Ravnås 81403cf383 subprojects: Bump outdated 2026-02-12 20:46:27 +01:00
Ole André Vadla Ravnås 2ea0b944a2 subprojects: Bump outdated 2026-02-12 13:27:14 +01:00
Ole André Vadla Ravnås 35c412c6cf subprojects: Bump outdated 2026-02-07 21:19:57 +01:00
Ole André Vadla Ravnås ec4524d155 submodules: Bump releng 2026-02-07 21:19:57 +01:00
Ole André Vadla Ravnås d9d53a89cc service: Fix Service.request() GVariant lifetime
The variant unmarshal helpers returned floating GVariants. When these
values were stored in containers, the floating reference was consumed.

Service.request() later unref'd the same GVariant, leading to refcount
underflow and memory corruption, or appearing to work by accident when
the memory was not yet reused.

Ensure all unmarshalled GVariants are non-floating before returning them
so that Service.request() always owns a full reference.
2026-01-29 14:59:10 +01:00
Ole André Vadla Ravnås dfb002de49 variant: Fix signedness in uint64 marshaling 2026-01-29 12:46:38 +01:00
Ole André Vadla Ravnås 0f56e44abd variant: Add support for additional GVariant types
This adds support for:
- Additional integer types: byte, int16, uint16, int32, uint32
- Tuples
- Nested variants in any context
2026-01-29 12:45:54 +01:00
Ole André Vadla Ravnås d28a2a4988 subprojects: Prepare for release 2026-01-23 22:31:27 +01:00
Ole André Vadla Ravnås 1fc39289ef subprojects: Bump outdated 2026-01-23 22:30:37 +01:00
Ole André Vadla Ravnås 2c757a08f3 subprojects: Prepare for release 2026-01-20 23:12:51 +01:00
Ole André Vadla Ravnås fc735c048f subprojects: Bump outdated 2026-01-20 23:09:30 +01:00
Ole André Vadla Ravnås 4d84536160 subprojects: Bump outdated 2026-01-20 20:26:47 +01:00
Ole André Vadla Ravnås 9e51c78c5c submodules: Bump releng 2026-01-20 20:26:47 +01:00
Ole André Vadla Ravnås a6d51e8384 subprojects: Bump outdated 2026-01-20 18:54:35 +01:00
Ole André Vadla Ravnås 3e80ed726d submodules: Bump releng 2026-01-20 18:54:35 +01:00
Ole André Vadla Ravnås 985410b6ff subprojects: Prepare for release 2026-01-17 08:43:35 +01:00
Ole André Vadla Ravnås 21c7b9ee6a subprojects: Bump outdated 2026-01-17 00:24:37 +01:00
Ole André Vadla Ravnås 7fba1cdc67 subprojects: Bump outdated 2026-01-16 15:32:05 +01:00
Ole André Vadla Ravnås a709856e2a subprojects: Bump outdated 2026-01-16 13:44:50 +01:00
Ole André Vadla Ravnås c3afe6089d submodules: Bump releng 2026-01-16 13:44:49 +01:00
Ole André Vadla Ravnås 6435a78d13 subprojects: Bump outdated 2026-01-15 18:08:16 +01:00
Ole André Vadla Ravnås 09175036ea submodules: Bump releng 2026-01-15 18:08:16 +01:00
Ole André Vadla Ravnås e0c90c5203 subprojects: Bump outdated 2026-01-11 00:48:16 +01:00
Abhi 9f463fb602 Fix regressions reported by mypi and black (#269) 2026-01-07 09:14:51 +01:00
Ole André Vadla Ravnås 9fdee2270f subprojects: Bump outdated 2026-01-06 22:40:32 +01:00
Ole André Vadla Ravnås 6e536a56b1 submodules: Bump releng 2026-01-06 22:40:32 +01:00
Ole André Vadla Ravnås 74925d082e subprojects: Prepare for release 2025-12-15 21:28:40 +01:00
Etienne Maheux bf1245ddb0 typing: Remove generic @overload on handlers
Generic @overload definitions on signal handlers were masking
type-checking errors.
2025-12-15 21:23:57 +01:00
Etienne Maheux 0f247e9439 typing: Improve @cancellable; add flag literals
Refine @cancellable typing to better model control flow and
introduce Literal types for optional Compiler flags to
improve static checking and autocomplete.
2025-12-15 21:23:57 +01:00
Ole André Vadla Ravnås 17aae5fe5c subprojects: Bump outdated 2025-12-15 21:17:51 +01:00
Ole André Vadla Ravnås 477a90534e submodules: Bump releng 2025-12-15 21:17:51 +01:00
Ole André Vadla Ravnås c87cdca293 subprojects: Prepare for release 2025-11-05 18:59:11 +01:00
Ole André Vadla Ravnås 30968b3805 subprojects: Bump outdated 2025-11-05 18:57:30 +01:00
Ole André Vadla Ravnås 5e3f27d0cb subprojects: Prepare for release 2025-11-04 10:30:58 +01:00
Ole André Vadla Ravnås 904461eb01 subprojects: Bump outdated 2025-11-04 10:29:40 +01:00
Ole André Vadla Ravnås dc652faa90 package-manager: Plug leak in specs option parsing 2025-11-04 10:23:37 +01:00
Ole André Vadla Ravnås f5ba22ad36 compiler: Expose platform and externals options 2025-11-04 10:23:00 +01:00
Ole André Vadla Ravnås dccb6810ca subprojects: Prepare for release 2025-11-01 00:38:17 +01:00
Ole André Vadla Ravnås 82441c6d61 subprojects: Bump outdated 2025-11-01 00:36:38 +01:00
Ole André Vadla Ravnås 323dca48c2 subprojects: Prepare for release 2025-10-31 20:24:11 +01:00
Ole André Vadla Ravnås ef71f0fa92 subprojects: Bump outdated 2025-10-31 20:21:50 +01:00
Ole André Vadla Ravnås e92e829f6d subprojects: Prepare for release 2025-10-29 16:48:00 +01:00
Ole André Vadla Ravnås 5793fb5528 subprojects: Bump outdated 2025-10-29 16:45:57 +01:00
Ole André Vadla Ravnås cac6993d87 subprojects: Prepare for release 2025-10-24 15:25:21 +02:00
Ole André Vadla Ravnås 714b7f8626 subprojects: Bump outdated 2025-10-24 15:23:52 +02:00
Ole André Vadla Ravnås ab0b9e98ae submodules: Bump releng 2025-10-24 15:23:52 +02:00
Ole André Vadla Ravnås 19a7fa4f45 subprojects: Prepare for release 2025-10-11 19:22:55 +02:00
Ole André Vadla Ravnås 38552a368a subprojects: Bump outdated 2025-10-11 11:47:08 +02:00
Ole André Vadla Ravnås 38724cab58 subprojects: Bump outdated 2025-10-11 11:09:13 +02:00
Ole André Vadla Ravnås b60d085ad9 subprojects: Bump outdated 2025-10-01 10:53:01 +02:00
Ole André Vadla Ravnås 1a4afbcc62 subprojects: Bump outdated 2025-10-01 10:50:11 +02:00
Ole André Vadla Ravnås 9e15cab647 subprojects: Prepare for release 2025-09-19 17:16:25 +02:00
Ole André Vadla Ravnås 9ef1c9c1f7 subprojects: Bump outdated 2025-09-19 17:14:35 +02:00
Ole André Vadla Ravnås 3da6af4759 subprojects: Prepare for release 2025-09-18 07:39:44 +02:00
Ole André Vadla Ravnås a9075822b1 subprojects: Bump outdated 2025-09-17 22:10:34 +02:00
Ole André Vadla Ravnås 2e61509c04 submodules: Bump releng 2025-09-17 22:10:34 +02:00
Ole André Vadla Ravnås aa9396c6b0 subprojects: Prepare for release 2025-09-15 22:57:06 +02:00
Ole André Vadla Ravnås 6530b2a7d4 subprojects: Bump outdated 2025-09-15 22:12:16 +02:00
Ole André Vadla Ravnås 2d833af062 subprojects: Bump outdated 2025-09-11 10:32:08 +02:00
Ole André Vadla Ravnås 9f6ab2d384 subprojects: Prepare for release 2025-08-20 12:07:22 +02:00
Ole André Vadla Ravnås a005f1bf4c subprojects: Bump outdated 2025-08-20 12:06:15 +02:00
Ole André Vadla Ravnås 59a24aa48f subprojects: Prepare for release 2025-08-12 10:15:48 +02:00
Ole André Vadla Ravnås 782d626419 subprojects: Bump outdated 2025-08-12 09:48:45 +02:00
Ole André Vadla Ravnås 3aa122f4fd subprojects: Prepare for release 2025-08-02 09:42:51 +02:00
Ole André Vadla Ravnås ef315fc0ad subprojects: Bump outdated 2025-08-02 08:53:40 +02:00
Ole André Vadla Ravnås daf93eea54 subprojects: Bump outdated 2025-08-01 20:21:16 +02:00
Ole André Vadla Ravnås 5d02a36906 submodules: Bump releng 2025-08-01 20:21:16 +02:00
Ole André Vadla Ravnås ba8daa423d subprojects: Bump outdated 2025-08-01 18:18:22 +02:00
Ole André Vadla Ravnås afb27bfa7c subprojects: Bump outdated 2025-08-01 15:48:53 +02:00
Ole André Vadla Ravnås 93a201acf2 submodules: Bump releng 2025-08-01 15:48:53 +02:00
Ole André Vadla Ravnås ca1cdad96a subprojects: Prepare for release 2025-07-24 11:16:46 +02:00
Ole André Vadla Ravnås fbc83cc9bf subprojects: Bump outdated 2025-07-24 11:15:23 +02:00
Ole André Vadla Ravnås b838e1df9a subprojects: Prepare for release 2025-07-21 15:06:22 +02:00
Ole André Vadla Ravnås e2409be987 subprojects: Bump outdated 2025-07-21 15:04:50 +02:00
5 changed files with 181 additions and 117 deletions
+10
View File
@@ -754,8 +754,13 @@ class Compiler(Object):
self,
entrypoint: str,
project_root: Optional[str] = None,
output_format: Optional[str] = None,
bundle_format: Optional[str] = None,
type_check: Optional[str] = None,
source_maps: Optional[str] = None,
compression: Optional[str] = None,
platform: Optional[str] = None,
externals: Optional[Sequence[str]] = None,
) -> str:
"""
Build an agent.
@@ -766,8 +771,13 @@ class Compiler(Object):
self,
entrypoint: str,
project_root: Optional[str] = None,
output_format: Optional[str] = None,
bundle_format: Optional[str] = None,
type_check: Optional[str] = None,
source_maps: Optional[str] = None,
compression: Optional[str] = None,
platform: Optional[str] = None,
externals: Optional[Sequence[str]] = None,
) -> None:
"""
Continuously build an agent.
+115 -29
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2023 Ole André Vadla Ravnås <oleavr@nowsecure.com>
* Copyright (C) 2013-2026 Ole André Vadla Ravnås <oleavr@nowsecure.com>
* Copyright (C) 2024 Håvard Sørbø <havard@hsorbo.no>
*
* Licence: wxWindows Library Licence, Version 3.1
@@ -378,6 +378,7 @@ static PyObject * PyGObject_marshal_variant (GVariant * variant);
static PyObject * PyGObject_marshal_variant_byte_array (GVariant * variant);
static PyObject * PyGObject_marshal_variant_dict (GVariant * variant);
static PyObject * PyGObject_marshal_variant_array (GVariant * variant);
static PyObject * PyGObject_marshal_variant_tuple (GVariant * variant);
static gboolean PyGObject_unmarshal_variant (PyObject * value, GVariant ** variant);
static gboolean PyGObject_unmarshal_variant_from_mapping (PyObject * mapping, GVariant ** variant);
static gboolean PyGObject_unmarshal_variant_from_sequence (PyObject * sequence, GVariant ** variant);
@@ -533,7 +534,8 @@ static void PyCompiler_dealloc (PyCompiler * self);
static PyObject * PyCompiler_build (PyCompiler * self, PyObject * args, PyObject * kw);
static PyObject * PyCompiler_watch (PyCompiler * self, PyObject * args, PyObject * kw);
static gboolean PyCompiler_set_options (FridaCompilerOptions * options, const gchar * project_root_value, const gchar * output_format_value,
const gchar * bundle_format_value, const gchar * type_check_value, const gchar * source_maps_value, const gchar * compression_value);
const gchar * bundle_format_value, const gchar * type_check_value, const gchar * source_maps_value, const gchar * compression_value,
const gchar * platform_value, PyObject * externals_value);
static int PyPackageManager_init (PyPackageManager * self, PyObject * args, PyObject * kw);
static void PyPackageManager_dealloc (PyPackageManager * self);
@@ -1748,10 +1750,20 @@ PyGObject_marshal_variant (GVariant * variant)
{
case G_VARIANT_CLASS_STRING:
return PyGObject_marshal_string (g_variant_get_string (variant, NULL));
case G_VARIANT_CLASS_BYTE:
return PyLong_FromLong (g_variant_get_byte (variant));
case G_VARIANT_CLASS_INT16:
return PyLong_FromLong (g_variant_get_int16 (variant));
case G_VARIANT_CLASS_UINT16:
return PyLong_FromUnsignedLong (g_variant_get_uint16 (variant));
case G_VARIANT_CLASS_INT32:
return PyLong_FromLong (g_variant_get_int32 (variant));
case G_VARIANT_CLASS_UINT32:
return PyLong_FromUnsignedLong (g_variant_get_uint32 (variant));
case G_VARIANT_CLASS_INT64:
return PyLong_FromLongLong (g_variant_get_int64 (variant));
case G_VARIANT_CLASS_UINT64:
return PyLong_FromLongLong (g_variant_get_uint64 (variant));
return PyLong_FromUnsignedLongLong (g_variant_get_uint64 (variant));
case G_VARIANT_CLASS_DOUBLE:
return PyFloat_FromDouble (g_variant_get_double (variant));
case G_VARIANT_CLASS_BOOLEAN:
@@ -1764,6 +1776,19 @@ PyGObject_marshal_variant (GVariant * variant)
return PyGObject_marshal_variant_dict (variant);
return PyGObject_marshal_variant_array (variant);
case G_VARIANT_CLASS_TUPLE:
return PyGObject_marshal_variant_tuple (variant);
case G_VARIANT_CLASS_VARIANT:
{
GVariant * inner;
PyObject * result;
inner = g_variant_get_variant (variant);
result = PyGObject_marshal_variant (inner);
g_variant_unref (inner);
return result;
}
default:
break;
}
@@ -1822,13 +1847,6 @@ PyGObject_marshal_variant_array (GVariant * variant)
for (i = 0; (child = g_variant_iter_next_value (&iter)) != NULL; i++)
{
if (g_variant_is_of_type (child, G_VARIANT_TYPE_VARIANT))
{
GVariant * inner = g_variant_get_variant (child);
g_variant_unref (child);
child = inner;
}
PyList_SetItem (list, i, PyGObject_marshal_variant (child));
g_variant_unref (child);
@@ -1837,6 +1855,28 @@ PyGObject_marshal_variant_array (GVariant * variant)
return list;
}
static PyObject *
PyGObject_marshal_variant_tuple (GVariant * variant)
{
GVariantIter iter;
PyObject * tuple;
guint i;
GVariant * child;
g_variant_iter_init (&iter, variant);
tuple = PyTuple_New (g_variant_iter_n_children (&iter));
for (i = 0; (child = g_variant_iter_next_value (&iter)) != NULL; i++)
{
PyTuple_SetItem (tuple, i, PyGObject_marshal_variant (child));
g_variant_unref (child);
}
return tuple;
}
static gboolean
PyGObject_unmarshal_variant (PyObject * value, GVariant ** variant)
{
@@ -1846,14 +1886,14 @@ PyGObject_unmarshal_variant (PyObject * value, GVariant ** variant)
PyGObject_unmarshal_string (value, &str);
*variant = g_variant_new_take_string (str);
*variant = g_variant_ref_sink (g_variant_new_take_string (str));
return TRUE;
}
if (PyBool_Check (value))
{
*variant = g_variant_new_boolean (value == Py_True);
*variant = g_variant_ref_sink (g_variant_new_boolean (value == Py_True));
return TRUE;
}
@@ -1866,14 +1906,14 @@ PyGObject_unmarshal_variant (PyObject * value, GVariant ** variant)
if (l == -1 && PyErr_Occurred ())
return FALSE;
*variant = g_variant_new_int64 (l);
*variant = g_variant_ref_sink (g_variant_new_int64 (l));
return TRUE;
}
if (PyFloat_Check (value))
{
*variant = g_variant_new_double (PyFloat_AsDouble (value));
*variant = g_variant_ref_sink (g_variant_new_double (PyFloat_AsDouble (value)));
return TRUE;
}
@@ -1887,7 +1927,7 @@ PyGObject_unmarshal_variant (PyObject * value, GVariant ** variant)
PyBytes_AsStringAndSize (value, &buffer, &length);
copy = g_memdup2 (buffer, length);
*variant = g_variant_new_from_data (G_VARIANT_TYPE_BYTESTRING, copy, length, TRUE, g_free, copy);
*variant = g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE_BYTESTRING, copy, length, TRUE, g_free, copy));
return TRUE;
}
@@ -1933,12 +1973,13 @@ PyGObject_unmarshal_variant_from_mapping (PyObject * mapping, GVariant ** varian
g_variant_builder_add (&builder, "{sv}", PyBytes_AsString (key_bytes), raw_value);
g_variant_unref (raw_value);
Py_DecRef (key_bytes);
}
Py_DecRef (items);
*variant = g_variant_builder_end (&builder);
*variant = g_variant_ref_sink (g_variant_builder_end (&builder));
return TRUE;
@@ -1983,10 +2024,11 @@ PyGObject_unmarshal_variant_from_sequence (PyObject * sequence, GVariant ** vari
else
g_variant_builder_add (&builder, "v", raw_value);
g_variant_unref (raw_value);
Py_DecRef (val);
}
*variant = g_variant_builder_end (&builder);
*variant = g_variant_ref_sink (g_variant_builder_end (&builder));
return TRUE;
@@ -2886,7 +2928,7 @@ PyDevice_spawn (PyDevice * self, PyObject * args, PyObject * kw)
goto invalid_dict_value;
}
g_hash_table_insert (aux, raw_key, g_variant_ref_sink (raw_value));
g_hash_table_insert (aux, raw_key, raw_value);
}
}
@@ -4904,8 +4946,8 @@ static PyObject *
PyCompiler_build (PyCompiler * self, PyObject * args, PyObject * kw)
{
PyObject * result;
static char * keywords[] =
{ "entrypoint", "project_root", "output_format", "bundle_format", "type_check", "source_maps", "compression", NULL };
static char * keywords[] = { "entrypoint", "project_root", "output_format", "bundle_format", "type_check", "source_maps", "compression",
"platform", "externals", NULL };
const char * entrypoint;
const char * project_root = NULL;
const char * output_format = NULL;
@@ -4913,17 +4955,19 @@ PyCompiler_build (PyCompiler * self, PyObject * args, PyObject * kw)
const char * type_check = NULL;
const char * source_maps = NULL;
const char * compression = NULL;
const char * platform = NULL;
PyObject * externals = NULL;
FridaBuildOptions * options;
GError * error = NULL;
gchar * bundle;
if (!PyArg_ParseTupleAndKeywords (args, kw, "s|ssssss", keywords, &entrypoint, &project_root, &output_format, &bundle_format, &type_check,
&source_maps, &compression))
if (!PyArg_ParseTupleAndKeywords (args, kw, "s|sssssssO", keywords, &entrypoint, &project_root, &output_format, &bundle_format,
&type_check, &source_maps, &compression, &platform, &externals))
return NULL;
options = frida_build_options_new ();
if (!PyCompiler_set_options (FRIDA_COMPILER_OPTIONS (options), project_root, output_format, bundle_format, type_check, source_maps,
compression))
compression, platform, externals))
goto invalid_option_value;
Py_BEGIN_ALLOW_THREADS
@@ -4950,8 +4994,8 @@ invalid_option_value:
static PyObject *
PyCompiler_watch (PyCompiler * self, PyObject * args, PyObject * kw)
{
static char * keywords[] =
{ "entrypoint", "project_root", "output_format", "bundle_format", "type_check", "source_maps", "compression", NULL };
static char * keywords[] = { "entrypoint", "project_root", "output_format", "bundle_format", "type_check", "source_maps", "compression",
"platform", "externals", NULL };
const char * entrypoint;
const char * project_root = NULL;
const char * output_format = NULL;
@@ -4959,16 +5003,18 @@ PyCompiler_watch (PyCompiler * self, PyObject * args, PyObject * kw)
const char * type_check = NULL;
const char * source_maps = NULL;
const char * compression = NULL;
const char * platform = NULL;
PyObject * externals = NULL;
FridaWatchOptions * options;
GError * error = NULL;
if (!PyArg_ParseTupleAndKeywords (args, kw, "s|ssssss", keywords, &entrypoint, &project_root, &output_format, &bundle_format, &type_check,
&source_maps, &compression))
if (!PyArg_ParseTupleAndKeywords (args, kw, "s|sssssssO", keywords, &entrypoint, &project_root, &output_format, &bundle_format,
&type_check, &source_maps, &compression, &platform, &externals))
return NULL;
options = frida_watch_options_new ();
if (!PyCompiler_set_options (FRIDA_COMPILER_OPTIONS (options), project_root, output_format, bundle_format, type_check, source_maps,
compression))
compression, platform, externals))
goto invalid_option_value;
Py_BEGIN_ALLOW_THREADS
@@ -4991,7 +5037,8 @@ invalid_option_value:
static gboolean
PyCompiler_set_options (FridaCompilerOptions * options, const gchar * project_root_value, const gchar * output_format_value,
const gchar * bundle_format_value, const gchar * type_check_value, const gchar * source_maps_value, const gchar * compression_value)
const gchar * bundle_format_value, const gchar * type_check_value, const gchar * source_maps_value, const gchar * compression_value,
const gchar * platform_value, PyObject * externals_value)
{
if (project_root_value != NULL)
frida_compiler_options_set_project_root (options, project_root_value);
@@ -5046,6 +5093,43 @@ PyCompiler_set_options (FridaCompilerOptions * options, const gchar * project_ro
frida_compiler_options_set_compression (options, compression);
}
if (platform_value != NULL)
{
FridaJsPlatform platform;
if (!PyGObject_unmarshal_enum (platform_value, FRIDA_TYPE_JS_PLATFORM, &platform))
return FALSE;
frida_compiler_options_set_platform (options, platform);
}
if (externals_value != NULL)
{
gint n, i;
n = PySequence_Size (externals_value);
if (n == -1)
return FALSE;
for (i = 0; i != n; i++)
{
PyObject * element;
gchar * external = NULL;
element = PySequence_GetItem (externals_value, i);
if (element == NULL)
return FALSE;
PyGObject_unmarshal_string (element, &external);
Py_DecRef (element);
if (external == NULL)
return FALSE;
frida_compiler_options_add_external (options, external);
g_free (external);
}
}
return TRUE;
}
@@ -5208,6 +5292,8 @@ PyPackageManager_parse_install_options (const gchar * project_root, const char *
goto propagate_error;
frida_package_install_options_add_spec (options, spec);
g_free (spec);
}
}
+54 -86
View File
@@ -33,10 +33,15 @@ if sys.version_info >= (3, 8):
else:
from typing_extensions import Literal, TypedDict
if sys.version_info >= (3, 11):
from typing import NotRequired
if sys.version_info >= (3, 10):
from typing import ParamSpec
else:
from typing_extensions import NotRequired
from typing_extensions import ParamSpec
if sys.version_info >= (3, 11):
from typing import NotRequired, cast
else:
from typing_extensions import NotRequired, cast
from . import _frida
@@ -72,15 +77,18 @@ def _filter_missing_kwargs(d: MutableMapping[Any, Any]) -> None:
d.pop(key)
R = TypeVar("R")
P = ParamSpec("P")
R = TypeVar("R", covariant=True)
def cancellable(f: Callable[..., R]) -> Callable[..., R]:
def cancellable(f: Callable[P, R]) -> Callable[P, R]:
# currently there is no way to type properly the extended callable with optional cancellable parameter
# ref: https://github.com/python/typing/discussions/1905#discussioncomment-11696995
@functools.wraps(f)
def wrapper(*args: Any, **kwargs: Any) -> R:
def wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
cancellable = kwargs.pop("cancellable", None)
if cancellable is not None:
with cancellable:
with cast(Cancellable, cancellable):
return f(*args, **kwargs)
return f(*args, **kwargs)
@@ -351,9 +359,6 @@ class Script:
@overload
def on(self, signal: Literal["message"], callback: ScriptMessageCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Add a signal handler
@@ -370,9 +375,6 @@ class Script:
@overload
def off(self, signal: Literal["message"], callback: ScriptMessageCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Remove a signal handler
@@ -693,34 +695,22 @@ class Session:
_filter_missing_kwargs(kwargs)
return PortalMembership(self._impl.join_portal(address, **kwargs))
@overload
def on(
self,
signal: Literal["detached"],
callback: SessionDetachedCallback,
) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
) -> None:
"""
Add a signal handler
"""
self._impl.on(signal, callback)
@overload
def off(
self,
signal: Literal["detached"],
callback: SessionDetachedCallback,
) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
) -> None:
"""
Remove a signal handler
"""
@@ -763,9 +753,6 @@ class Bus:
@overload
def on(self, signal: Literal["message"], callback: BusMessageCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Add a signal handler
@@ -782,9 +769,6 @@ class Bus:
@overload
def off(self, signal: Literal["message"], callback: BusMessageCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Remove a signal handler
@@ -842,9 +826,6 @@ class Service:
@overload
def on(self, signal: Literal["message"], callback: ServiceMessageCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Add a signal handler
@@ -858,9 +839,6 @@ class Service:
@overload
def off(self, signal: Literal["message"], callback: ServiceMessageCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Remove a signal handler
@@ -1144,9 +1122,6 @@ class Device:
@overload
def on(self, signal: Literal["lost"], callback: DeviceLostCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Add a signal handler
@@ -1178,9 +1153,6 @@ class Device:
@overload
def off(self, signal: Literal["lost"], callback: DeviceLostCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Remove a signal handler
@@ -1298,9 +1270,6 @@ class DeviceManager:
@overload
def on(self, signal: Literal["changed"], callback: DeviceManagerChangedCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Add a signal handler
@@ -1317,9 +1286,6 @@ class DeviceManager:
@overload
def off(self, signal: Literal["changed"], callback: DeviceManagerChangedCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Remove a signal handler
@@ -1490,9 +1456,6 @@ class PortalService:
@overload
def on(self, signal: Literal["message"], callback: PortalServiceMessageCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Add a signal handler
@@ -1554,6 +1517,13 @@ CompilerFinishedCallback = Callable[[], None]
CompilerOutputCallback = Callable[[str], None]
CompilerDiagnosticsCallback = Callable[[List[CompilerDiagnostic]], None]
CompilerOutputFormat = Literal["unescaped", "hex-bytes", "c-string"]
CompilerBundleFormat = Literal["esm", "iife"]
CompilerTypeCheck = Literal["full", "none"]
CompilerSourceMaps = Literal["included", "omitted"]
CompilerCompression = Literal["none", "terser"]
CompilerPlatform = Literal["neutral", "gum", "browser"]
class Compiler:
def __init__(self) -> None:
@@ -1567,19 +1537,23 @@ class Compiler:
self,
entrypoint: str,
project_root: Optional[str] = None,
output_format: Optional[str] = None,
bundle_format: Optional[str] = None,
type_check: Optional[str] = None,
source_maps: Optional[str] = None,
compression: Optional[str] = None,
output_format: Optional[CompilerOutputFormat] = None,
bundle_format: Optional[CompilerBundleFormat] = None,
type_check: Optional[CompilerTypeCheck] = None,
source_maps: Optional[CompilerSourceMaps] = None,
compression: Optional[CompilerCompression] = None,
platform: Optional[CompilerPlatform] = None,
externals: Optional[Sequence[str]] = None,
) -> str:
kwargs = {
kwargs: dict[str, Any] = {
"project_root": project_root,
"output_format": output_format,
"bundle_format": bundle_format,
"type_check": type_check,
"source_maps": source_maps,
"compression": compression,
"platform": platform,
"externals": externals,
}
_filter_missing_kwargs(kwargs)
return self._impl.build(entrypoint, **kwargs)
@@ -1589,19 +1563,23 @@ class Compiler:
self,
entrypoint: str,
project_root: Optional[str] = None,
output_format: Optional[str] = None,
bundle_format: Optional[str] = None,
type_check: Optional[str] = None,
source_maps: Optional[str] = None,
compression: Optional[str] = None,
output_format: Optional[CompilerOutputFormat] = None,
bundle_format: Optional[CompilerBundleFormat] = None,
type_check: Optional[CompilerTypeCheck] = None,
source_maps: Optional[CompilerSourceMaps] = None,
compression: Optional[CompilerCompression] = None,
platform: Optional[CompilerPlatform] = None,
externals: Optional[Sequence[str]] = None,
) -> None:
kwargs = {
kwargs: dict[str, Any] = {
"project_root": project_root,
"output_format": output_format,
"bundle_format": bundle_format,
"type_check": type_check,
"source_maps": source_maps,
"compression": compression,
"platform": platform,
"externals": externals,
}
_filter_missing_kwargs(kwargs)
return self._impl.watch(entrypoint, **kwargs)
@@ -1618,10 +1596,11 @@ class Compiler:
@overload
def on(self, signal: Literal["diagnostics"], callback: CompilerDiagnosticsCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Add a signal handler
"""
self._impl.on(signal, callback)
@overload
@@ -1636,10 +1615,11 @@ class Compiler:
@overload
def off(self, signal: Literal["diagnostics"], callback: CompilerDiagnosticsCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
"""
Remove a signal handler
"""
self._impl.off(signal, callback)
@@ -1711,22 +1691,10 @@ class PackageManager:
_filter_missing_kwargs(kwargs)
return self._impl.install(**kwargs)
@overload
def on(self, signal: Literal["install-progress"], callback: PackageManagerInstallProgressCallback) -> None: ...
@overload
def on(self, signal: str, callback: Callable[..., Any]) -> None: ...
def on(self, signal: str, callback: Callable[..., Any]) -> None:
def on(self, signal: Literal["install-progress"], callback: PackageManagerInstallProgressCallback) -> None:
self._impl.on(signal, callback)
@overload
def off(self, signal: Literal["install-progress"], callback: PackageManagerInstallProgressCallback) -> None: ...
@overload
def off(self, signal: str, callback: Callable[..., Any]) -> None: ...
def off(self, signal: str, callback: Callable[..., Any]) -> None:
def off(self, signal: Literal["install-progress"], callback: PackageManagerInstallProgressCallback) -> None:
self._impl.off(signal, callback)
+1 -1
Submodule releng updated: 38daa4fd6a...7ed66fe687
+1 -1
View File
@@ -1,6 +1,6 @@
[wrap-git]
url = https://github.com/frida/frida-core.git
revision = 17.2.12
revision = 17.7.1
depth = 1
[provide]