Gracefully degrade when loading libreadline fails#807
Gracefully degrade when loading libreadline fails#807jayvdb wants to merge 2 commits intopython-cmd2:masterfrom
Conversation
libreadline may not be loadable for many reasons, especially in environments where a packager is using zipapp or PyOxidizer. Avoid critical failure; degrade gracefully to operating without libreadline and notify the user this has happened. Related to python-cmd2#802
Codecov Report
@@ Coverage Diff @@
## master #807 +/- ##
=========================================
- Coverage 97.3% 97.2% -0.11%
=========================================
Files 14 14
Lines 3493 3501 +8
=========================================
+ Hits 3399 3403 +4
- Misses 94 98 +4
Continue to review full report at Codecov.
|
|
Let me know if I need to build convoluted tests to reach these. |
| import ctypes | ||
| readline_lib = ctypes.CDLL(readline.__file__) | ||
| try: | ||
| import ctypes |
There was a problem hiding this comment.
Why would an import of ctypes fail?
There was a problem hiding this comment.
ctypes is a module. It doesnt need to exist, and is one of the first to be disabled in embedded Python, especially on new arch/platforms where the entire gcc toolchain isnt available/stable yet. In a completely static build of Python with all needed modules built in, there is no need for ctypes, and it adds bloat.
|
We are comfortable with cmd2 working in typical desktop environments running standard Python distributions as well as in containers like docker. If we choose to add exception handling to this code later, one of our authors will do it. |
libreadline may not be loadable for many reasons, especially
in environments where a packager is using zipapp or PyOxidizer.
Avoid critical failure; degrade gracefully to operating without
libreadline and notify the user this has happened.
Related to #802