Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXT_SUFFIX is missing '.sl' on HP-UX #89122

Closed
florinspatar mannequin opened this issue Aug 20, 2021 · 9 comments
Closed

EXT_SUFFIX is missing '.sl' on HP-UX #89122

florinspatar mannequin opened this issue Aug 20, 2021 · 9 comments
Labels
3.11 only security fixes extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@florinspatar
Copy link
Mannequin

florinspatar mannequin commented Aug 20, 2021

BPO 44959
Nosy @vstinner, @ambv, @mattip, @pablogsal, @miss-islington, @florinspatar
PRs
  • bpo-44959: Added fallback to extension modules with '.sl' suffix on HP-UX #27857
  • [3.10] bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX (GH-27857) #29152
  • [3.9] bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX (GH-27857) #29153
  • Files
  • python-hpux-extension-suffixes.patch: proposed fixing patch
  • 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 2021-09-08.12:43:39.125>
    created_at = <Date 2021-08-20.09:34:42.974>
    labels = ['extension-modules', 'type-bug', '3.11']
    title = "EXT_SUFFIX is missing '.sl' on HP-UX"
    updated_at = <Date 2021-11-18.16:19:28.080>
    user = 'https://github.com/florinspatar'

    bugs.python.org fields:

    activity = <Date 2021-11-18.16:19:28.080>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-09-08.12:43:39.125>
    closer = 'vstinner'
    components = ['Extension Modules']
    creation = <Date 2021-08-20.09:34:42.974>
    creator = 'florinspatar'
    dependencies = []
    files = ['50227']
    hgrepos = []
    issue_num = 44959
    keywords = ['patch']
    message_count = 9.0
    messages = ['399945', '399947', '399955', '399959', '401379', '404742', '404747', '404751', '406552']
    nosy_count = 7.0
    nosy_names = ['vstinner', 'lukasz.langa', 'python-dev', 'mattip', 'pablogsal', 'miss-islington', 'florinspatar']
    pr_nums = ['27857', '29152', '29153']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue44959'
    versions = ['Python 3.11']

    @florinspatar
    Copy link
    Mannequin Author

    florinspatar mannequin commented Aug 20, 2021

    On HP-UX, python can no longer find extension modules with the '.sl' suffix.

    [fspatar@hpux1131:/cust/fspatar/buildtest/hp-ux/11.31/build]> ~/tmp/investigation3/old/bin/python3
    Python 3.8.11 (default, Aug  3 2021, 06:15:31) 
    [GCC 4.2.4] on hp-ux-pa
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import M2Crypto
    Traceback (most recent call last):
      File "/cust/fspatar/buildtest/hp-ux/11.31/build/M2Crypto/m2crypto.py", line 16, in swig_import_helper
        fp, pathname, description = imp.find_module('_m2crypto', [dirname(__file__)])
      File "/h/fspatar/tmp/investigation3/old/lib/python3.8/imp.py", line 296, in find_module
        raise ImportError(_ERR_MSG.format(name), name=name)
    ImportError: No module named '_m2crypto'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/cust/fspatar/buildtest/hp-ux/11.31/build/M2Crypto/__init__.py", line 37, in <module>
        from M2Crypto import (ASN1, AuthCookie, BIO, BN, DH, DSA, EVP, Engine, Err,
      File "/cust/fspatar/buildtest/hp-ux/11.31/build/M2Crypto/ASN1.py", line 15, in <module>
        from M2Crypto import BIO, m2, py27plus, six, has_typing
      File "/cust/fspatar/buildtest/hp-ux/11.31/build/M2Crypto/BIO.py", line 9, in <module>
        from M2Crypto import m2, py27plus, six, has_typing
      File "/cust/fspatar/buildtest/hp-ux/11.31/build/M2Crypto/m2.py", line 30, in <module>
        from M2Crypto.m2crypto import *
      File "/cust/fspatar/buildtest/hp-ux/11.31/build/M2Crypto/m2crypto.py", line 26, in <module>
        _m2crypto = swig_import_helper()
      File "/cust/fspatar/buildtest/hp-ux/11.31/build/M2Crypto/m2crypto.py", line 18, in swig_import_helper
        import _m2crypto
    ModuleNotFoundError: No module named '_m2crypto'

    This works fine in python 3.8.5

    [fspatar@hpux1131:/cust/fspatar/buildtest/hp-ux/11.31/build]> /opt/OPSWbuildtools/2.0.5/python/3.8.5.04/bin/python3
    Python 3.8.5 (default, Jul 28 2021, 08:38:55) 
    [GCC 4.2.4] on hp-ux-pa
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import M2Crypto

    It seems to be related to recent changes from https://bugs.python.org/issue42604

    Given the file name is _m2crypto.sl, python 3.8.11 can no longer find it. Based on https://www.python.org/dev/peps/pep-3149/#pep-384, my understanding is that python should search for the following file names when extension module _m2crypto is imported (in this order):

    _m2crypto.cpython-38.sl
    _m2crypto.so

    Python can only load the extension module if the file name is _m2crypto.cpython-38.sl

    [fspatar@hpux1131:/cust/fspatar/buildtest/hp-ux/11.31/build]> ~/tmp/investigation3/old/bin/python3
    Python 3.8.11 (default, Aug  3 2021, 06:15:31) 
    [GCC 4.2.4] on hp-ux-pa
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _imp
    >>> _imp.extension_suffixes()
    ['.cpython-38.sl']
    >>> 
    
    [fspatar@hpux1131:/cust/fspatar/buildtest/hp-ux/11.31/build]> /opt/OPSWbuildtools/2.0.5/python/3.8.5.04/bin/python3
    Python 3.8.5 (default, Jul 28 2021, 08:38:55) 
    [GCC 4.2.4] on hp-ux-pa
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _imp
    >>> _imp.extension_suffixes()
    ['.sl']
    >>>

    @florinspatar florinspatar mannequin added 3.8 only security fixes extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Aug 20, 2021
    @vstinner
    Copy link
    Member

    Can you please try to convert your patch into a GitHub pull request?

    @mattip
    Copy link
    Contributor

    mattip commented Aug 20, 2021

    I assume you tried and succeeded with your patch. Could you post what _imp.extension_suffixes() reports after the patch?

    I am a bit confused because you said the following, should the last line be _m2crypto.sl and not _m2crypto.sl ?

    my understanding is that python should search for the following file names when extension module _m2crypto is imported (in this order):

    _m2crypto.cpython-38.sl
    _m2crypto.so

    @florinspatar
    Copy link
    Mannequin Author

    florinspatar mannequin commented Aug 20, 2021

    @mattip
    Yes, the patch fixed the issue and the extension module import works.

    With the patch applied:

    [fspatar@hpux1131:/cust/fspatar/buildtest/hp-ux/11.31/build]> /opt/OPSWbuildtools/2.0.5/python/3.8.11.01/bin/python3
    Python 3.8.11 (default, Aug  4 2021, 03:13:01) 
    [GCC 4.2.4] on hp-ux-pa
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _imp
    >>> _imp.extension_suffixes()
    ['.cpython-38.sl', '.sl']
    >>> 

    Sorry for the confusion; I meant python should search for the following file names when extension module _m2crypto is imported (in this order):

    _m2crypto.cpython-38.sl
    _m2crypto.sl

    @vstinner
    I'm working on the pull request.

    @vstinner
    Copy link
    Member

    vstinner commented Sep 8, 2021

    New changeset 2396fa6 by Florin Spătar in branch 'main':
    bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX (GH-27857)
    2396fa6

    @vstinner vstinner added 3.11 only security fixes and removed 3.8 only security fixes labels Sep 8, 2021
    @vstinner vstinner closed this as completed Sep 8, 2021
    @vstinner vstinner added 3.11 only security fixes and removed 3.8 only security fixes labels Sep 8, 2021
    @vstinner vstinner closed this as completed Sep 8, 2021
    @florinspatar
    Copy link
    Mannequin Author

    florinspatar mannequin commented Oct 22, 2021

    Can this be merged to python 3.10 as well? Thanks

    @vstinner
    Copy link
    Member

    Can this be merged to python 3.10 as well? Thanks

    It's unclear to me if it's a new feature or a bugfix. But since the change is trivial, I'm fine with backporting it as a bugfix to 3.9 and 3.10 branches.

    @miss-islington
    Copy link
    Contributor

    New changeset aa8c344 by Miss Islington (bot) in branch '3.9':
    bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX (GH-27857)
    aa8c344

    @ambv
    Copy link
    Contributor

    ambv commented Nov 18, 2021

    New changeset 6d66de9 by Miss Islington (bot) in branch '3.10':
    bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX (GH-27857) (GH-29152)
    6d66de9

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants