sphinx-contrib / matlabdomain

A Sphinx extension for documenting Matlab code
http://sphinxcontrib-matlabdomain.readthedocs.io/
Other
70 stars 45 forks source link

Bug: Failure on parfor statements in class methods #116

Closed Funky185540 closed 3 years ago

Funky185540 commented 3 years ago

Compilation in Sphinx fails (Goes to an infinite loop) when parfor statements are contained in methods in classes somewhere in the code.

The "complexity" of the statement seemingly doesn't play a role. Also note that the "faulty" method doesn't even need to be referenced in the sphinx docs, it's enough if it exists.

Steps to reproduce it

Grab a copy of this very github repo, go to docs/src/ and place this code in a file called 'test.m' in it:

classdef test
    %TEST Summary of this class goes here
    %
    %   Detailed explanation goes here

    properties
        Property1
    end

    methods
        function obj = test(inputArg1,inputArg2)
            %TEST Construct an instance of this class
            %
            %   Detailed explanation goes here
            obj.Property1 = inputArg1 + inputArg2;
            parfor i = 1:10
            end
        end

        function outputArg = method1(obj,inputArg)
            %METHOD1 Summary of this method goes here
            %
            %   Detailed explanation goes here
            outputArg = obj.Property1 + inputArg;
        end
    end
end

The code is what Matlab generates by default as a class template. Do not touch any of the example code in the other files, leave it as is and try to compile the docs: make html

Expected output

The docs compile and are generated in the build output folder.

Actual output

The compilation doesn't finish, the compilation thread spins into an infinite loop.

Observations

If you remove the code for "method1" entirely, the bug disappears and the docs compile properly.

joeced commented 3 years ago

Thanks for the report - very detailed! The new version will be out tomorrow.