Skip to content

"modernize" makeopcodetargets.py #64220

Closed

Description

@ericsnowcurrently
BPO 20021
Nosy @brettcannon, @vstinner, @bitdancer, @ericsnowcurrently, @berkerpeksag, @serhiy-storchaka
Files
  • issue20021.diff
  • issue20021_2.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-03-26.06:30:27.520>
    created_at = <Date 2013-12-19.04:11:25.741>
    labels = ['easy', 'type-feature', 'library']
    title = '"modernize" makeopcodetargets.py'
    updated_at = <Date 2016-03-26.06:30:27.519>
    user = 'https://github.com/ericsnowcurrently'

    bugs.python.org fields:

    activity = <Date 2016-03-26.06:30:27.519>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-03-26.06:30:27.520>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2013-12-19.04:11:25.741>
    creator = 'eric.snow'
    dependencies = []
    files = ['36745', '40670']
    hgrepos = []
    issue_num = 20021
    keywords = ['patch', 'easy']
    message_count = 12.0
    messages = ['206577', '227703', '240387', '240393', '252257', '262425', '262427', '262431', '262432', '262471', '262472', '262486']
    nosy_count = 8.0
    nosy_names = ['brett.cannon', 'vstinner', 'Arfrever', 'r.david.murray', 'python-dev', 'eric.snow', 'berker.peksag', 'serhiy.storchaka']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue20021'
    versions = ['Python 3.6']

    Activity

    1. ericsnowcurrently commented on Dec 19, 2013

      @ericsnowcurrently
      MemberAuthor

      Python/makeopcodetargets.py uses deprecated imp APIs. It should be refactored to use newer import-related APIs.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Dec 19, 2013
    3. berkerpeksag commented on Sep 27, 2014

      @berkerpeksag
      Member

      Here's a patch.

    4. bitdancer commented on Apr 9, 2015

      @bitdancer
      Member

      The comment about staying compatibler with 2.3 is now clearly out of date :)

    5. berkerpeksag commented on Apr 9, 2015

      @berkerpeksag
      Member

      I think makeopcodetargets.py should still be compatible with Python 2 (2.6 or 2.7 at least) since it uses the system Python.

      I'd suggest closing this as "rejected" (or just commit the ``with open(...):`` part of the patch and update the outdated comment).

    6. serhiy-storchaka commented on Oct 4, 2015

      @serhiy-storchaka
      Member

      Some of the buildbots have Python 2.5 as their system Python.

      Here is a patch that is compatible with older Python versions.

    7. berkerpeksag commented on Mar 25, 2016

      @berkerpeksag
      Member

      Victor went with a different solution in f682b620c64d.

    8. serhiy-storchaka commented on Mar 25, 2016

      @serhiy-storchaka
      Member

      f682b620c64d looks incorrect to me. It makes makeopcodetargets.py to use the opcode module of Python that executes the script. Instead the script should use the opcode module from the same source tree as the script.

      I think f682b620c64d should be reverted.

    9. vstinner commented on Mar 25, 2016

      @vstinner
      Member

      Victor went with a different solution in f682b620c64d.

      Oh sorry, I wasn't aware of this old issue. My motivation was to get ride of the deprecated imp module, this script looks to be the latest part of the Python which uses the imp module (except of deliberate unit tests on the imp module).

      f682b620c64d looks incorrect to me. It makes makeopcodetargets.py to use the opcode module of Python that executes the script. Instead the script should use the opcode module from the same source tree as the script.

      Ah, this was unclear to me. It looks overcomplicated code to just import a module. Can't we simply use import, but ensure that the running python executable belongs to the current source tree?

      Or does it matter to be able to use an external python program?

      I think f682b620c64d should be reverted.

      Don't hesitate to rework the code to importlib if you want to ensure that Lib/opcode.py is imported.

      But please don't revert the whole change, I changed other things.

    10. vstinner commented on Mar 25, 2016

      @vstinner
      Member

      issue20021_2.diff looks good to me.

    11. python-dev commented on Mar 26, 2016

      python-devmannequin
      Mannequin

      New changeset 6ceceb052394 by Victor Stinner in branch 'default':
      makeopcodetargets.py: we need to import Lib/opcode.py
      https://hg.python.org/cpython/rev/6ceceb052394

    12. vstinner commented on Mar 26, 2016

      @vstinner
      Member

      Or does it matter to be able to use an external python program?

      Oh wait, I misunderstood how the script is used. I understood that the script must be run manually only when a new opcode is added and so is rarely used and only used with the built Python program.

      In fact, the script is part of the build process! I completely missed that, sorry. I searched how it was used but I missed the build process.

      So yes, it matters to support Python 2 and Python 3 in Python/makeopcodetargets.py.

      I pushed Serhiy's patch issue20021_2.diff.

    13. serhiy-storchaka commented on Mar 26, 2016

      @serhiy-storchaka
      Member

      Thank you Victor.

    14. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      easystdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions