You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/01/03 17:45:25 UTC

[buildstream] branch tristan/test-workflows updated: _types.pyx: Fixing new error from updated sphinx

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

tvb pushed a commit to branch tristan/test-workflows
in repository https://gitbox.apache.org/repos/asf/buildstream.git


The following commit(s) were added to refs/heads/tristan/test-workflows by this push:
     new e1b96c1  _types.pyx: Fixing new error from updated sphinx
e1b96c1 is described below

commit e1b96c185d4a2e202ba753a5278b2c278f7038c0
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Mon Jan 4 02:40:36 2021 +0900

    _types.pyx: Fixing new error from updated sphinx
    
    Our docs build does not specify a specific version of sphinx, and in
    a recent update of sphinx, it will try to mess around with docstring
    annotations on loaded python objects.
    
    Our MetaFastEnum class raises a ValueError when attempting to dynamically
    set a new attribute on the FastEnum, sphinx is happy to ignore an
    AttributeError in this case, but has the opinion that a ValueError is
    not a valid error for this problem, and thus ignores ValueError, causing
    the docs build to break.
    
    We don't really care if it is a ValueError or AttributeError that happens
    in this case, we rather only care that it be raised as a BUG at runtime
    if a value is assigned dynamically, so lets raise an AttributeError instead
    and satisfy sphinx's opinion.
---
 src/buildstream/_types.pyx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/buildstream/_types.pyx b/src/buildstream/_types.pyx
index 0f8d369..ac65c50 100644
--- a/src/buildstream/_types.pyx
+++ b/src/buildstream/_types.pyx
@@ -76,7 +76,7 @@ class MetaFastEnum(type):
         return "<fastenum '{}'>".format(self.__name__)
 
     def __setattr__(self, key, value):
-        raise ValueError("Adding new values dynamically is not supported")
+        raise AttributeError("Adding new values dynamically is not supported")
 
     def __iter__(self):
         return iter(self._value_to_entry.values())