mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Improve Python and Linenoise
This change reinvents all the GNU Readline features I discovered that I couldn't live without, e.g. UTF-8, CTRL-R search and CTRL-Y yanking. It now feels just as good in terms of user interface from the subconscious workflow perspective. It's real nice to finally have an embeddable line reader that's actually good with a 30 kb footprint and a bsd-2 license. This change adds a directory to the examples folder, explaining how the new Python compiler may be used. Some of the bugs with Python binaries have been addressed but overall it's still a work in progress.
This commit is contained in:
parent
ad52387b74
commit
51904e2687
35 changed files with 3541 additions and 8587 deletions
21
third_party/python/Lib/_bootlocale.py
vendored
21
third_party/python/Lib/_bootlocale.py
vendored
|
@ -1,21 +1,2 @@
|
|||
"""A minimal subset of the locale module used at interpreter startup
|
||||
(imported by the _io module), in order to reduce startup time.
|
||||
|
||||
Don't import directly from third-party code; use the `locale` module instead!
|
||||
"""
|
||||
|
||||
import sys
|
||||
import _locale
|
||||
|
||||
def getpreferredencoding(do_setlocale=True):
|
||||
assert not do_setlocale
|
||||
result = _locale.nl_langinfo(_locale.CODESET)
|
||||
if not result and sys.platform in ('darwin', 'cosmo'):
|
||||
# nl_langinfo can return an empty string
|
||||
# when the setting has an invalid value.
|
||||
# Default to UTF-8 in that case because
|
||||
# UTF-8 is the default charset on OSX and
|
||||
# returning nothing will crash the
|
||||
# interpreter.
|
||||
result = 'UTF-8'
|
||||
return result
|
||||
return 'UTF-8'
|
||||
|
|
5
third_party/python/Lib/re.py
vendored
5
third_party/python/Lib/re.py
vendored
|
@ -123,10 +123,7 @@ import enum
|
|||
import sre_compile
|
||||
import sre_parse
|
||||
import functools
|
||||
try:
|
||||
import _locale
|
||||
except ImportError:
|
||||
_locale = None
|
||||
import _locale
|
||||
|
||||
# public symbols
|
||||
__all__ = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue