classification
Title: Documentation of ctypes.CDLL does not correspond to code
Type: Stage:
Components: ctypes Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: madphysicist
Priority: normal Keywords:

Created on 2020-10-21 22:02 by madphysicist, last changed 2020-10-21 22:12 by madphysicist.

Messages (3)
msg379261 - (view) Author: Joseph Fox-Rabinovitz (madphysicist) * Date: 2020-10-21 22:02
ctypes.CDLL initializer defined in version 3.8 and beyond as

```
def __init__(self, name, mode=DEFAULT_MODE, handle=None,
             use_errno=False,
             use_last_error=False,
             winmode=None):
```

Documentation says `winmode=0`:

```
class ctypes.CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
```

Loading of normal DLL from custom directory works when `winmode=0`, but when `winmode=None` To reproduce, any combination of adding the fol += der containing the DLL to `os.evia ron['PATH']`, `os.add_dll_directory(...)`

Discoveryos.pathsep + ... triggered by https://stackoverflow.co, `sys.path.appen

Worked prior to 3.8 because there was no `winmode` parameter, and d(...)` does not change the behavior.m/q/`mode` was passed in directly, 59330863/298873`ctypes0. .DEFAULT_MODE == 0`.

I don't know whether it's better to update the code, the docs, or something else, but based on current info, would prefer updating the code.Some info summarized in https://stackoverflow.com/a/{8,9,}64472088/2988730.

Link to do pagecscorresponding : https://docs.python.org/3.10/library/ctypes.html#ctypes.CDLL
730.
Link to GitHub code: https://github.com/python/cpython/blob/3.{8,9}/Lib/ctypes/__init__.py#L340
msg379262 - (view) Author: Joseph Fox-Rabinovitz (madphysicist) * Date: 2020-10-21 22:10
Company firewall mutilated the text. Here is another attempt:

ctypes.CDLL initializer defined in version 3.8 and beyond as

```
def __init__(self, name, mode=DEFAULT_MODE, handle=None,
             use_errno=False,
             use_last_error=False,
             winmode=None):
```

Documentation says `winmode=0`:

```
class ctypes.CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
```

Loading of normal DLL from custom directory works when `winmode=0`, but not when `winmode=None`. To reproduce, any combination of adding the folder containing the DLL via `os.eviron['PATH'] += os.pathsep + ...`, `os.add_dll_directory(...)`, `sys.path.append(...)` does not change the behavior.

Worked prior to 3.8 because there was no `parameter, and `mode` was passed in direcCompany firewall mutilated the text. Here is another attempt:

ctypes.CDLL initializer defined in version 3.8 and beyond as

```
def __init__(self, name, mode=DEFAULT_MODE, handle=None,
             use_errno=False,
             use_last_error=False,
             winmode=None):
```

Documentation says `winmode=0`:

```
class ctypes.CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
```

Loading of normal DLL from custom directory works when `winmode=0`, but not when `winmode=None`. To reproduce, any combination of adding the folder containing the DLL via `os.eviron['PATH'] += os.pathsep + ...`, `os.add_dll_directory(...)`, `sys.path.append(...)` does not change the behavior.

Worked prior to 3.8 because there was no `winmode` parameter, `mode` was passed in diretly, and `ctypes.DEFAULT_MODE == 0`.

I don't know whether it's better to update the code, the docs, or something else, but based on current info, would prefer updating the code.

Discovery triggered by https://stackoverflow.com/q/59330863/2988730.
Some info summarized in https://stackoverflow.com/a/64472088/2988730.

yink to docs: https://docs.python.org/3.{8,9,10}/library/ctypes.html#ctypes.CDLL
Link to GitHub code: https://github.com/python/cpython/blob/3.{8,9}/Lib/ctypes/__init__.py#L340t.ly, `ctyp. .DEFAULT_MODE == 0`.
I don't know whether it's better to update the code, the docs, or something else, but based on current info, would prefer updating the code.

Discovery triggered by https://stackoverflow.com/q/59330863/2988730.
Some info summarized in https://stackoverflow.com/a/64472088/2988730.

yink to docs: https://docs.python.org/3.{8,9,10}/library/ctypes.html#ctypes.CDLL
Link to GitHub code: https://github.com/python/cpython/blob/3.{8,9}/Lib/ctypes/__init__.py#L340
msg379263 - (view) Author: Joseph Fox-Rabinovitz (madphysicist) * Date: 2020-10-21 22:12
Last attempt before I give up:

ctypes.CDLL initializer defined in version 3.8 and beyond as

```
def __init__(self, name, mode=DEFAULT_MODE, handle=None,
             use_errno=False,
             use_last_error=False,
             winmode=None):
```

Documentation says `winmode=0`:

```
class ctypes.CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
```

Loading of normal DLL from custom directory works when `winmode=0`, but not when `winmode=None`. To reproduce, any combination of adding the folder containing the DLL via `os.eviron['PATH'] += os.pathsep + ...`, `os.add_dll_directory(...)`, `sys.path.append(...)` does not change the behavior.

Worked prior to 3.8 because there was no `winmode` parameter, `mode` was passed in diretly, and `ctypes.DEFAULT_MODE == 0`.

I don't know whether it's better to update the code, the docs, or something else, but based on current info, would prefer updating the code.

Discovery triggered by https://stackoverflow.com/q/59330863/2988730.
Some info summarized in https://stackoverflow.com/a/64472088/2988730.

Link to docs: https://docs.python.org/3.{8,9,10}/library/ctypes.html#ctypes.CDLL
Link to GitHub code: https://github.com/python/cpython/blob/3.{8,9}/Lib/ctypes/__init__.py#L340
History
Date User Action Args
2020-10-21 22:12:43madphysicistsetmessages: + msg379263
2020-10-21 22:10:45madphysicistsetmessages: + msg379262
2020-10-21 22:02:35madphysicistsettitle: Documentation of -> Documentation of ctypes.CDLL does not correspond to code
2020-10-21 22:02:15madphysicistcreate