Skip to content

Delay-loading of python dll is impossible when using some C macros #76552

Open

Description

@PierreChatelier
BPO 32371
Nosy @pfmoore, @tjguk, @zware, @zooba, @isidentical
Files
  • PythonFromC.zip
  • 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 = None
    created_at = <Date 2017-12-19.13:13:18.859>
    labels = ['build', '3.8', 'OS-windows']
    title = 'Delay-loading of python dll is impossible when using some C macros'
    updated_at = <Date 2019-11-19.15:28:56.506>
    user = 'https://bugs.python.org/PierreChatelier'

    bugs.python.org fields:

    activity = <Date 2019-11-19.15:28:56.506>
    actor = 'Pierre Chatelier'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Windows']
    creation = <Date 2017-12-19.13:13:18.859>
    creator = 'Pierre Chatelier'
    dependencies = []
    files = ['48721']
    hgrepos = []
    issue_num = 32371
    keywords = []
    message_count = 6.0
    messages = ['308639', '356921', '356958', '356971', '356972', '356973']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower', 'Pierre Chatelier', 'BTaskaya']
    pr_nums = []
    priority = 'normal'
    resolution = 'works for me'
    stage = 'resolved'
    status = 'open'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue32371'
    versions = ['Python 3.8']

    Activity

    1. PierreChatelier commented on Dec 19, 2017

      PierreChateliermannequin
      MannequinAuthor

      Delay-loading of the python DLL is impossible when using some C macros.

      For instance, PyLong_Check() is OK, but PyBool_Check() or PyFunc_Check()
      will eventually raise a link error.

      This is due to the fact that PyBool_Check() directly use the PyBool_Type symbol instead of getting a reference through a function.

      For the same reason, Py_False and Py_True are problematic.

    2. added
      build
      on Dec 19, 2017
    3. isidentical commented on Nov 18, 2019

      @isidentical
      SponsorMember

      Can you give us a case where we can reproduce this locally?

    4. PierreChatelier commented on Nov 19, 2019

      PierreChateliermannequin
      MannequinAuthor

      Can't reproduce any more.
      It might have been specific to the Visual Studio version I used at that time.

    5. zware commented on Nov 19, 2019

      @zware
      Member

      Thanks for reporting back. If you find that you can provide a reliable reproducer later, do please reopen and attach it.

    6. PierreChatelier commented on Nov 19, 2019

      PierreChateliermannequin
      MannequinAuthor

      Just reproduced and solved it at the same time !
      It happened with Debug build, where I linked to pythonxx.lib instead of pythonxx_d.lib, because I did not download the debug binaries.
      Ultimately : my fault.

    7. PierreChatelier commented on Nov 19, 2019

      PierreChateliermannequin
      MannequinAuthor

      Aaand finally there is still something : it depends on the call context. Once in a C++/CLI class, the link bug occurs again.
      Here is attached a minimal project.

    8. 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

      3.8 (EOL)OS-windowsbuild

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions