You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ak...@apache.org on 2025/11/10 11:18:56 UTC

(buildstream) branch abderrahim/ruamel-yaml-malformed created (now 5323c3934)

This is an automated email from the ASF dual-hosted git repository.

akitouni pushed a change to branch abderrahim/ruamel-yaml-malformed
in repository https://gitbox.apache.org/repos/asf/buildstream.git


      at 5323c3934 _yaml: fix confusing error message

This branch includes the following new commits:

     new 5323c3934 _yaml: fix confusing error message

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(buildstream) 01/01: _yaml: fix confusing error message

Posted by ak...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

akitouni pushed a commit to branch abderrahim/ruamel-yaml-malformed
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 5323c39341acb461513e07a1e160cf4147b29d78
Author: Abderrahim Kitouni <ab...@codethink.co.uk>
AuthorDate: Mon Nov 10 12:18:02 2025 +0100

    _yaml: fix confusing error message
    
    This moves the ruamel-yaml CParser import instantiation outside of try-catch.
    The catch reports 'Severely malformed YAML', which isn't the case if you you
    cant't import CParser
---
 src/buildstream/_yaml.pyx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/buildstream/_yaml.pyx b/src/buildstream/_yaml.pyx
index c962bb881..dc2bc95ce 100644
--- a/src/buildstream/_yaml.pyx
+++ b/src/buildstream/_yaml.pyx
@@ -293,10 +293,10 @@ cpdef MappingNode load(str filename, str shortname, bint copy_tree=False, object
 cpdef MappingNode load_data(str data, int file_index=node._SYNTHETIC_FILE_INDEX, str file_name=None, bint copy_tree=False):
     cdef Representer rep
 
-    try:
-        rep = Representer(file_index)
-        parser = yaml.CParser(data)
+    rep = Representer(file_index)
+    parser = yaml.CParser(data)
 
+    try:
         try:
             while parser.check_event():
                 rep.handle_event(parser.get_event())