[New-bugs-announce] [issue24748] Change of behavior for importlib between 3.4 and 3.5 with DLL loading

Etienne Fortin report at bugs.python.org
Wed Jul 29 15:20:27 CEST 2015


New submission from Etienne Fortin:

The pywin32 package use imp.load_dynamic() to load a DLL with Windows specific type. On Python 3.4+ imp.load_dynamic() point to the following code which use the newer importlib module:

        import importlib.machinery
        loader = importlib.machinery.ExtensionFileLoader(name, path)
        return loader.load_module()

In pywin32 a mechanism is used to be able to have part of a module globals defined in python (pywintypes.py), and the reminder in a DLL (pywintypesXX.dll). The code in pywin32 between 3.4 and 3.5 is the same.

In Python 3.4, calling imp.load_dynamic(), which point to the code above, inside the python part of the module definition loads the types defined in the DLL.

In Python 3.5, calling imp.load_dynamic(), which also points to the code above, inside the python part of the module definition reloads the same python module, not the DLL. Even though a path to a DLL is given AND when doing introspection of the module it clearly points to the specified DLL. 

This is a change of behavior that breaks pywin32, but possibly other modules that rely on this behavior.

----------
components: Extension Modules, Windows
files: pywintypes.py
messages: 247573
nosy: ebfortin, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Change of behavior for importlib between 3.4 and 3.5 with DLL loading
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file40055/pywintypes.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24748>
_______________________________________


More information about the New-bugs-announce mailing list