pytohn-decopatch fails to build with Python 3.13 in Fedora Rawhide (41). Build failure - Python now always strips the whitespaces from docstrings. =================================== FAILURES =================================== __________________ test_doc_add_tag_function[flat_mode=False] __________________ flat_mode = False @pytest.mark.parametrize('flat_mode', [False, True], ids="flat_mode={}".format) def test_doc_add_tag_function(flat_mode): """ Tests that the @add_tag example from doc (functions only) works """ if not flat_mode: @function_decorator def add_tag(tag='hi!'): """ Example decorator to add a 'tag' attribute to a function. :param tag: the 'tag' value to set on the decorated function (default 'hi!). """ def apply_decorator(f): """ This is the method that will be called when your decorator is used on a function `f`. It should return the replacement for this function (it can be the same object, or another one, not even a function!) """ setattr(f, 'tag', tag) return f return apply_decorator else: @function_decorator def add_tag(tag='hi!', f=DECORATED): """ Example decorator to add a 'tag' attribute to a function. :param tag: the 'tag' value to set on the decorated function (default 'hi!). """ setattr(f, 'tag', tag) return f @add_tag def foo(): pass assert foo.tag == 'hi!' @add_tag() def foo(): pass assert foo.tag == 'hi!' @add_tag('hello') def foo(): pass assert foo.tag == 'hello' # manual mode add_tag()(foo) assert foo.tag == 'hi!' # signature and help assert "%s%s" % (add_tag.__name__, signature(add_tag)) == "add_tag(tag='hi!')" print(help(add_tag)) > assert add_tag.__doc__ == """ Example decorator to add a 'tag' attribute to a function. :param tag: the 'tag' value to set on the decorated function (default 'hi!). """ E assert "\nExample decorator to add a 'tag' attribute to a function.\n:param tag: the 'tag' value to set on the decorated function (default 'hi!).\n" == "\n Example decorator to add a 'tag' attribute to a function.\n :param tag: the 'tag' value to set on the decorated function (default 'hi!).\n " E E - Example decorator to add a 'tag' attribute to a function. E ? ------------ E + Example decorator to add a 'tag' attribute to a function. E - :param tag: the 'tag' value to set on the decorated function (default 'hi!). E ? ------------ E + :param tag: the 'tag' value to set on the decorated function (default 'hi!). E - tests/test_doc.py:72: AssertionError ----------------------------- Captured stdout call ----------------------------- Help on function add_tag in module tests.test_doc: add_tag(tag='hi!') Example decorator to add a 'tag' attribute to a function. :param tag: the 'tag' value to set on the decorated function (default 'hi!). None __________________ test_doc_add_tag_function[flat_mode=True] ___________________ flat_mode = True @pytest.mark.parametrize('flat_mode', [False, True], ids="flat_mode={}".format) def test_doc_add_tag_function(flat_mode): """ Tests that the @add_tag example from doc (functions only) works """ if not flat_mode: @function_decorator def add_tag(tag='hi!'): """ Example decorator to add a 'tag' attribute to a function. :param tag: the 'tag' value to set on the decorated function (default 'hi!). """ def apply_decorator(f): """ This is the method that will be called when your decorator is used on a function `f`. It should return the replacement for this function (it can be the same object, or another one, not even a function!) """ setattr(f, 'tag', tag) return f return apply_decorator else: @function_decorator def add_tag(tag='hi!', f=DECORATED): """ Example decorator to add a 'tag' attribute to a function. :param tag: the 'tag' value to set on the decorated function (default 'hi!). """ setattr(f, 'tag', tag) return f @add_tag def foo(): pass assert foo.tag == 'hi!' @add_tag() def foo(): pass assert foo.tag == 'hi!' @add_tag('hello') def foo(): pass assert foo.tag == 'hello' # manual mode add_tag()(foo) assert foo.tag == 'hi!' # signature and help assert "%s%s" % (add_tag.__name__, signature(add_tag)) == "add_tag(tag='hi!')" print(help(add_tag)) > assert add_tag.__doc__ == """ Example decorator to add a 'tag' attribute to a function. :param tag: the 'tag' value to set on the decorated function (default 'hi!). """ E assert "\nExample decorator to add a 'tag' attribute to a function.\n:param tag: the 'tag' value to set on the decorated function (default 'hi!).\n" == "\n Example decorator to add a 'tag' attribute to a function.\n :param tag: the 'tag' value to set on the decorated function (default 'hi!).\n " E E - Example decorator to add a 'tag' attribute to a function. E ? ------------ E + Example decorator to add a 'tag' attribute to a function. E - :param tag: the 'tag' value to set on the decorated function (default 'hi!). E ? ------------ E + :param tag: the 'tag' value to set on the decorated function (default 'hi!). E - tests/test_doc.py:72: AssertionError ----------------------------- Captured stdout call ----------------------------- Help on function add_tag in module tests.test_doc: add_tag(tag='hi!') Example decorator to add a 'tag' attribute to a function. :param tag: the 'tag' value to set on the decorated function (default 'hi!). None =========================== short test summary info ============================ FAILED tests/test_doc.py::test_doc_add_tag_function[flat_mode=False] - assert... FAILED tests/test_doc.py::test_doc_add_tag_function[flat_mode=True] - assert ... ================== 2 failed, 184 passed, 80 skipped in 1.13s =================== Let us know here if you have any questions. Python 3.13 is planned to be included in Fedora 41.
Has been rebuilt against Python 3.13 in rawhide. Closing.