1 comment:
Patchset:
I wanted to detect and fix other uses of load_source but I have ran out of time to work on this. I'm submitting the patch in the hope it's useful.
To view, visit change 4894238. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Jacobo Aragunde Pérez.
Patch set 3:Code-Review +1
1 comment:
Patchset:
Thanks!
To view, visit change 4894238. To unsubscribe, or for help writing mail filters, visit settings.
To view, visit change 4894238. To unsubscribe, or for help writing mail filters, visit settings.
Chromium LUCI CQ submitted this change.
Replace imp.load_source with importlib equivalent.
The imp module has been deprecated for years and the function
load_source was even removed from the documentation long ago.
It will be removed in Python 3.12, which will be part of Fedora
version 39, due in late October 2023.
Bug: 1487454
Change-Id: If06a2f139225b62c7bdc70c3eaef6e5acb8972d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4894238
Reviewed-by: Mustafa Emre Acer <mea...@chromium.org>
Commit-Queue: Jacobo Aragunde Pérez <jara...@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1214660}
---
M components/resources/protobufs/binary_proto_generator.py
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/components/resources/protobufs/binary_proto_generator.py b/components/resources/protobufs/binary_proto_generator.py
index 2a1802dc..8b9de65 100755
--- a/components/resources/protobufs/binary_proto_generator.py
+++ b/components/resources/protobufs/binary_proto_generator.py
@@ -9,7 +9,7 @@
"""
from __future__ import print_function
import abc
-import imp
+from importlib import util as imp_util
import optparse
import os
import re
@@ -68,7 +68,11 @@
raise ImportError(fullname)
filepath = self._fullname_to_filepath(fullname)
- return imp.load_source(fullname, filepath)
+ spec = imp_util.spec_from_file_location(fullname, filepath)
+ loaded = imp_util.module_from_spec(spec)
+ spec.loader.exec_module(loaded)
+
+ return loaded
class BinaryProtoGenerator:
To view, visit change 4894238. To unsubscribe, or for help writing mail filters, visit settings.