summaryrefslogtreecommitdiffstats
path: root/contrib/python/Flask/py3
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2026-04-14 10:41:22 +0300
committerrobot-piglet <[email protected]>2026-04-14 11:02:32 +0300
commit24921a11e128cd2950aef328aaca1d16e8ffb481 (patch)
tree85bf7256a54bc0447e3f90e88272b866a78a543f /contrib/python/Flask/py3
parent22335f13165d76a0d9b74d6c6879c0e6f537162a (diff)
Intermediate changes
commit_hash:de9b43f37f00c824246ccce80a85076d610fbcd9
Diffstat (limited to 'contrib/python/Flask/py3')
-rw-r--r--contrib/python/Flask/py3/flask/scaffold.py7
-rw-r--r--contrib/python/Flask/py3/patches/01-arcadia.patch9
2 files changed, 13 insertions, 3 deletions
diff --git a/contrib/python/Flask/py3/flask/scaffold.py b/contrib/python/Flask/py3/flask/scaffold.py
index 601c1dfd475..4db94cea78b 100644
--- a/contrib/python/Flask/py3/flask/scaffold.py
+++ b/contrib/python/Flask/py3/flask/scaffold.py
@@ -106,7 +106,12 @@ class Scaffold:
self.static_url_path = static_url_path
package_name = import_name
- self.module_loader = pkgutil.find_loader(import_name)
+ try:
+ spec = importlib.util.find_spec(import_name)
+ self.module_loader = spec.loader if spec is not None else None
+ except (ImportError, AttributeError, TypeError, ValueError) as ex:
+ msg = "Error while finding loader for {!r} ({}: {})"
+ raise ImportError(msg.format(import_name, type(ex), ex)) from ex
if self.module_loader and not self.module_loader.is_package(import_name):
package_name = package_name.rsplit('.', 1)[0]
self._builtin_resource_prefix = package_name.replace('.', '/')
diff --git a/contrib/python/Flask/py3/patches/01-arcadia.patch b/contrib/python/Flask/py3/patches/01-arcadia.patch
index 81a5eef35b3..6a73ffc774a 100644
--- a/contrib/python/Flask/py3/patches/01-arcadia.patch
+++ b/contrib/python/Flask/py3/patches/01-arcadia.patch
@@ -11,12 +11,17 @@
from .helpers import locked_cached_property
+from .helpers import send_file
from .helpers import send_from_directory
-@@ -97,6 +99,12 @@ class Scaffold:
+@@ -97,6 +99,17 @@ class Scaffold:
self.static_folder = static_folder # type: ignore
self.static_url_path = static_url_path
+ package_name = import_name
-+ self.module_loader = pkgutil.find_loader(import_name)
++ try:
++ spec = importlib.util.find_spec(import_name)
++ self.module_loader = spec.loader if spec is not None else None
++ except (ImportError, AttributeError, TypeError, ValueError) as ex:
++ msg = "Error while finding loader for {!r} ({}: {})"
++ raise ImportError(msg.format(import_name, type(ex), ex)) from ex
+ if self.module_loader and not self.module_loader.is_package(import_name):
+ package_name = package_name.rsplit('.', 1)[0]
+ self._builtin_resource_prefix = package_name.replace('.', '/')