ctypes.CDLL on Linux creates a "main program" object when passed an empty string
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 46/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- operating-systems
Research direction
Start by running the reported ctypes.CDLL('') reproducer on Linux and compare it with a missing library name. Trace the ctypes.CDLL loading path and make the empty-string case raise an exception rather than create a dummy object; done when that behavior is covered by a regression test.
Written by the indexing model from the issue text.
Description
Bug report
ctypes.CDLL throws an exception when it can't find a library in the path pointed at by its name argument; however, if name is an empty string a dummy object is created:
>>> import ctypes
>>> ctypes.CDLL('')
<CDLL '', handle 7fb30d2d3190 at 0x7fb30c2caa60>
I don't think this is correct, since that dummy object will break things when trying to use it later on.
Your environment
- CPython versions tested on: 3.8.10, 3.10.8
- Operating system and architecture: Ubuntu 20.04.5 LTS for x86_64
This doesn't happen on Windows with Python 3.10.7; there I see an exception being thrown for the empty string.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 558
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python/cpython
-
docs pending
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
stdlib type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
build type-bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
stdlib topic-email type-feature
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
🐛 Bug 🔔 Pending processing
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
jumpserver/jumpserver#17584 ·