Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Replace imp.load_source with importlib equivalent. [chromium/src : main]

45 views
Skip to first unread message

Jacobo Aragunde Pérez (Gerrit)

unread,
Oct 24, 2023, 4:50:17 AM10/24/23
to Mustafa Emre Acer, Pi-Hsun Shih, Chromium LUCI CQ, chromium...@chromium.org

View Change

1 comment:

  • Patchset:

    • Patch Set #3:

      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.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: If06a2f139225b62c7bdc70c3eaef6e5acb8972d2
Gerrit-Change-Number: 4894238
Gerrit-PatchSet: 3
Gerrit-Owner: Jacobo Aragunde Pérez <jara...@igalia.com>
Gerrit-Reviewer: Jacobo Aragunde Pérez <jara...@igalia.com>
Gerrit-CC: Mustafa Emre Acer <mea...@chromium.org>
Gerrit-CC: Pi-Hsun Shih <pih...@chromium.org>
Gerrit-Comment-Date: Tue, 24 Oct 2023 08:50:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Mustafa Emre Acer (Gerrit)

unread,
Oct 24, 2023, 1:57:01 PM10/24/23
to Jacobo Aragunde Pérez, Pi-Hsun Shih, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Jacobo Aragunde Pérez.

Patch set 3:Code-Review +1

View Change

1 comment:

To view, visit change 4894238. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: If06a2f139225b62c7bdc70c3eaef6e5acb8972d2
Gerrit-Change-Number: 4894238
Gerrit-PatchSet: 3
Gerrit-Owner: Jacobo Aragunde Pérez <jara...@igalia.com>
Gerrit-Reviewer: Jacobo Aragunde Pérez <jara...@igalia.com>
Gerrit-Reviewer: Mustafa Emre Acer <mea...@chromium.org>
Gerrit-CC: Pi-Hsun Shih <pih...@chromium.org>
Gerrit-Attention: Jacobo Aragunde Pérez <jara...@igalia.com>
Gerrit-Comment-Date: Tue, 24 Oct 2023 17:56:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

Jacobo Aragunde Pérez (Gerrit)

unread,
Oct 25, 2023, 2:12:47 AM10/25/23
to Mustafa Emre Acer, Pi-Hsun Shih, Chromium LUCI CQ, chromium...@chromium.org

Patch set 3:Commit-Queue +2

View Change

1 comment:

To view, visit change 4894238. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: If06a2f139225b62c7bdc70c3eaef6e5acb8972d2
Gerrit-Change-Number: 4894238
Gerrit-PatchSet: 3
Gerrit-Owner: Jacobo Aragunde Pérez <jara...@igalia.com>
Gerrit-Reviewer: Jacobo Aragunde Pérez <jara...@igalia.com>
Gerrit-Reviewer: Mustafa Emre Acer <mea...@chromium.org>
Gerrit-CC: Pi-Hsun Shih <pih...@chromium.org>
Gerrit-Comment-Date: Wed, 25 Oct 2023 06:12:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

Chromium LUCI CQ (Gerrit)

unread,
Oct 25, 2023, 2:21:19 AM10/25/23
to Jacobo Aragunde Pérez, Mustafa Emre Acer, Pi-Hsun Shih, chromium...@chromium.org

Chromium LUCI CQ submitted this change.

View Change

Approvals: Mustafa Emre Acer: Looks good to me Jacobo Aragunde Pérez: Commit
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.

Gerrit-MessageType: merged
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: If06a2f139225b62c7bdc70c3eaef6e5acb8972d2
Gerrit-Change-Number: 4894238
Gerrit-PatchSet: 4
Gerrit-Owner: Jacobo Aragunde Pérez <jara...@igalia.com>
Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
Gerrit-Reviewer: Jacobo Aragunde Pérez <jara...@igalia.com>
Gerrit-Reviewer: Mustafa Emre Acer <mea...@chromium.org>
Reply all
Reply to author
Forward
0 new messages