civodul pushed a commit to branch main
in repository guile.

commit 5abb24efe4ab59a835a94eea6d6dd4be5da4ccba
Author: Hannes Müller <>
AuthorDate: Sat Dec 21 16:55:13 2024 +0100

    Fix make-custom-port in case encoding is #f
    
    * module/ice-9/custom-ports.scm (make-custom-port): Code fails if
    (fluid-ref %default-port-encoding) returns #f. In fact this was the
    case why readline support on MSYS2 failed for guile 3.0.10, ref.
    https://github.com/msys2/MSYS2-packages/issues/5079
    But later used canonicalize-encoding is prepared to handle #f for
    encoding. So allow encoding to also handle this case.
    
    Co-authored-by: Ludovic Courtès <l...@gnu.org>
---
 module/ice-9/custom-ports.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/module/ice-9/custom-ports.scm b/module/ice-9/custom-ports.scm
index 6010fd94f..c4376db7b 100644
--- a/module/ice-9/custom-ports.scm
+++ b/module/ice-9/custom-ports.scm
@@ -127,7 +127,7 @@
           (id "custom-port")
           (print (make-default-print #:id id))
           (truncate default-truncate)
-          (encoding (string->symbol (fluid-ref %default-port-encoding)))
+          (encoding (and=> (fluid-ref %default-port-encoding) string->symbol))
           (conversion-strategy (fluid-ref %default-port-conversion-strategy))
           (close-on-gc? #f))
   "Create a custom port whose behavior is determined by the methods passed

Reply via email to