Function: python-shell--encode-string

python-shell--encode-string is a byte-compiled function defined in python.el.gz.

Signature

(python-shell--encode-string ARG1)

Documentation

Encode TEXT as a valid Python string.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defalias 'python-shell--encode-string
  (let ((fun (if (and (fboundp 'json-serialize)
                      (>= emacs-major-version 28))
                 'json-serialize
               (require 'json)
               'json-encode-string)))
    (lambda (text)
      (if (stringp text)
          (funcall fun text)
        (signal 'wrong-type-argument (list 'stringp text)))))
  "Encode TEXT as a valid Python string.")