* [Buildroot] [PATCH] package/python-django: add patch to fix crash with .pyc-only builds
@ 2024-02-19 11:30 Marcus Hoffmann via buildroot
2024-02-19 20:53 ` Yann E. MORIN
0 siblings, 1 reply; 2+ messages in thread
From: Marcus Hoffmann via buildroot @ 2024-02-19 11:30 UTC (permalink / raw)
To: buildroot; +Cc: James Hilliard, Oli Vogt, Asaf Kahlon
Backport an upstream patch that fixes django auth and admin apps not
working in .pyc only builds.
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/6148209453
Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
---
...d-sensitive_variables-sensitive_post.patch | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 package/python-django/0001-Fixed-sensitive_variables-sensitive_post.patch
diff --git a/package/python-django/0001-Fixed-sensitive_variables-sensitive_post.patch b/package/python-django/0001-Fixed-sensitive_variables-sensitive_post.patch
new file mode 100644
index 0000000000..90dc9c7dd0
--- /dev/null
+++ b/package/python-django/0001-Fixed-sensitive_variables-sensitive_post.patch
@@ -0,0 +1,45 @@
+From d294b7679f2cb51c7231d6a7fb22e76eb74e49ec Mon Sep 17 00:00:00 2001
+From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
+Date: Sat, 17 Feb 2024 08:15:59 +0100
+Subject: [PATCH] Fixed #35187 -- Fixed
+ @sensitive_variables/sensitive_post_parameters decorators crash with
+ .pyc-only builds.
+
+Thanks Jon Janzen for the implementation idea.
+
+Thanks Marcus Hoffmann for the report.
+
+Regression in 38e391e95fe5258bc6d2467332dc9cd44ce6ba52.
+Backport of d1be05b3e9209fd0787841c71a95819d81061187 from main
+
+Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
+Upstream: https://github.com/django/django/commit/41a4bba817f139f3cfd94f04e728e046560c9a18
+---
+ django/views/decorators/debug.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/django/views/decorators/debug.py b/django/views/decorators/debug.py
+index 7ea8a540de..6540fc0651 100644
+--- a/django/views/decorators/debug.py
++++ b/django/views/decorators/debug.py
+@@ -47,7 +47,6 @@ def sensitive_variables(*variables):
+
+ try:
+ file_path = inspect.getfile(wrapped_func)
+- _, first_file_line = inspect.getsourcelines(wrapped_func)
+ except TypeError: # Raises for builtins or native functions.
+ raise ValueError(
+ f"{func.__name__} cannot safely be wrapped by "
+@@ -55,7 +54,8 @@ def sensitive_variables(*variables):
+ "Python file (not a builtin or from a native extension)."
+ )
+ else:
+- key = hash(f"{file_path}:{first_file_line}")
++ first_line_number = wrapped_func.__code__.co_firstlineno
++ key = hash(f"{file_path}:{first_line_number}")
+
+ if variables:
+ coroutine_functions_to_sensitive_variables[key] = variables
+--
+2.34.1
+
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Buildroot] [PATCH] package/python-django: add patch to fix crash with .pyc-only builds
2024-02-19 11:30 [Buildroot] [PATCH] package/python-django: add patch to fix crash with .pyc-only builds Marcus Hoffmann via buildroot
@ 2024-02-19 20:53 ` Yann E. MORIN
0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2024-02-19 20:53 UTC (permalink / raw)
To: Marcus Hoffmann; +Cc: James Hilliard, Oli Vogt, Asaf Kahlon, buildroot
Marcus, All,
On 2024-02-19 12:30 +0100, Marcus Hoffmann via buildroot spake thusly:
> Backport an upstream patch that fixes django auth and admin apps not
> working in .pyc only builds.
>
> Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/6148209453
>
> Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
Applied to master, thanks.
Thanks for handling the report with upstream! 👍
Regards,
Yann E. MORIN.
> ---
> ...d-sensitive_variables-sensitive_post.patch | 45 +++++++++++++++++++
> 1 file changed, 45 insertions(+)
> create mode 100644 package/python-django/0001-Fixed-sensitive_variables-sensitive_post.patch
>
> diff --git a/package/python-django/0001-Fixed-sensitive_variables-sensitive_post.patch b/package/python-django/0001-Fixed-sensitive_variables-sensitive_post.patch
> new file mode 100644
> index 0000000000..90dc9c7dd0
> --- /dev/null
> +++ b/package/python-django/0001-Fixed-sensitive_variables-sensitive_post.patch
> @@ -0,0 +1,45 @@
> +From d294b7679f2cb51c7231d6a7fb22e76eb74e49ec Mon Sep 17 00:00:00 2001
> +From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
> +Date: Sat, 17 Feb 2024 08:15:59 +0100
> +Subject: [PATCH] Fixed #35187 -- Fixed
> + @sensitive_variables/sensitive_post_parameters decorators crash with
> + .pyc-only builds.
> +
> +Thanks Jon Janzen for the implementation idea.
> +
> +Thanks Marcus Hoffmann for the report.
> +
> +Regression in 38e391e95fe5258bc6d2467332dc9cd44ce6ba52.
> +Backport of d1be05b3e9209fd0787841c71a95819d81061187 from main
> +
> +Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
> +Upstream: https://github.com/django/django/commit/41a4bba817f139f3cfd94f04e728e046560c9a18
> +---
> + django/views/decorators/debug.py | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/django/views/decorators/debug.py b/django/views/decorators/debug.py
> +index 7ea8a540de..6540fc0651 100644
> +--- a/django/views/decorators/debug.py
> ++++ b/django/views/decorators/debug.py
> +@@ -47,7 +47,6 @@ def sensitive_variables(*variables):
> +
> + try:
> + file_path = inspect.getfile(wrapped_func)
> +- _, first_file_line = inspect.getsourcelines(wrapped_func)
> + except TypeError: # Raises for builtins or native functions.
> + raise ValueError(
> + f"{func.__name__} cannot safely be wrapped by "
> +@@ -55,7 +54,8 @@ def sensitive_variables(*variables):
> + "Python file (not a builtin or from a native extension)."
> + )
> + else:
> +- key = hash(f"{file_path}:{first_file_line}")
> ++ first_line_number = wrapped_func.__code__.co_firstlineno
> ++ key = hash(f"{file_path}:{first_line_number}")
> +
> + if variables:
> + coroutine_functions_to_sensitive_variables[key] = variables
> +--
> +2.34.1
> +
> --
> 2.34.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-19 20:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-19 11:30 [Buildroot] [PATCH] package/python-django: add patch to fix crash with .pyc-only builds Marcus Hoffmann via buildroot
2024-02-19 20:53 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox