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

PyStructSequence_UnnamedField unavailable on Windows #88386

Closed
johnboy2 mannequin opened this issue May 23, 2021 · 3 comments
Closed

PyStructSequence_UnnamedField unavailable on Windows #88386

johnboy2 mannequin opened this issue May 23, 2021 · 3 comments
Labels
3.11 bug and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error

Comments

@johnboy2
Copy link
Mannequin

johnboy2 mannequin commented May 23, 2021

BPO 44220
Nosy @pfmoore, @tjguk, @encukou, @zware, @zooba, @johnboy2, @Fidget-Spinner
PRs
  • bpo-44220: Export PyStructSequence_UnnamedField in C API #26331
  • 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-10-21.09:06:51.822>
    created_at = <Date 2021-05-23.23:40:00.590>
    labels = ['interpreter-core', 'type-bug', 'OS-windows', '3.11']
    title = 'PyStructSequence_UnnamedField unavailable on Windows'
    updated_at = <Date 2021-10-21.09:06:51.819>
    user = 'https://github.com/johnboy2'

    bugs.python.org fields:

    activity = <Date 2021-10-21.09:06:51.819>
    actor = 'petr.viktorin'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-21.09:06:51.822>
    closer = 'petr.viktorin'
    components = ['Interpreter Core', 'Windows']
    creation = <Date 2021-05-23.23:40:00.590>
    creator = 'johnboy2'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44220
    keywords = ['patch']
    message_count = 3.0
    messages = ['394226', '404572', '404574']
    nosy_count = 7.0
    nosy_names = ['paul.moore', 'tim.golden', 'petr.viktorin', 'zach.ware', 'steve.dower', 'johnboy2', 'kj']
    pr_nums = ['26331']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue44220'
    versions = ['Python 3.11']

    @johnboy2
    Copy link
    Mannequin Author

    johnboy2 mannequin commented May 23, 2021

    The symbol "PyStructSequence_UnnnamedField" is not *explicitly* marked for export, causing it to be omitted from python3x.dll on Windows -- and thus unavailable to Windows extension modules.

    Attempting to use this symbol then fails at link time:
    test.obj : error LNK2001: unresolved external symbol PyStructSequence_UnnamedField
    build\lib.win-amd64-3.7\test.cp39-win_amd64.pyd : fatal error LNK1120: 1 unresolved externals

    The fact that the symbol is missing can also be demonstrated via ctypes:
    import ctypes
    from pathlib import Path
    import sys

      python_dll = ctypes.CDLL(str(Path(sys.executable).parent / 'python3.dll'))

    # These don't raise at all
    python_dll.PyTuple_Type
    python_dll.PyStructSequence_New

    # Raises AttributeError
    python_dll.PyStructSequence_UnnamedField

    @johnboy2 johnboy2 mannequin added 3.7 (EOL) end of life 3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error labels May 23, 2021
    @encukou
    Copy link
    Member

    encukou commented Oct 21, 2021

    New changeset 2cbf50e by Ken Jin in branch 'main':
    bpo-44220: Export PyStructSequence_UnnamedField in the limited API (GH-26331)
    2cbf50e

    @encukou
    Copy link
    Member

    encukou commented Oct 21, 2021

    It should be available in python3x.dll (e.g. pyhon310.dll).
    It is not available in python3.dll (the stable ABI), until Python 3.11.

    @encukou encukou added 3.11 bug and security fixes and removed 3.7 (EOL) end of life 3.9 only security fixes labels Oct 21, 2021
    @encukou encukou closed this as completed Oct 21, 2021
    @encukou encukou added 3.11 bug and security fixes and removed 3.7 (EOL) end of life 3.9 only security fixes labels Oct 21, 2021
    @encukou encukou closed this as completed Oct 21, 2021
    @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 bug and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant