← 输入框|github.com|刷新
Skip to content

Did something change with void return of Modules functions? #1328

Closed

Description

@eddelbuettel

Fresh CRAN email reports that my RcppCNPy package now differs between the saveAndLoad.Rout it creates and the saveAndLoad.Rout.save I have in the package, in particular calls to npySave() now return a NULL but did not before. This is a standard Rcpp Modules binding of a void function (see here).

Did we change anything in how this is generated within Rcpp? I cannot think of anything. Am I missing something?

Activity

  1. Enchufa2 commented on Sep 3, 2024

    @Enchufa2
    Member

    I don't think we changed anything, and it works fine here with v4.4.1. All NOTEs you got are from r-devel machines, so I'd say something changed there. Of course void functions always return NULL at the R side, but something was invisible() and now it is not anymore in r-devel, apparently.

  2. Enchufa2 commented on Sep 3, 2024

    @Enchufa2
    Member

    Mmmh... wait a sec... I had a problem with the package versions and I can reproduce it now with r-release. This is strange. Maybe we did change something, but didn't appear until this?

  3. eddelbuettel commented on Sep 3, 2024

    @eddelbuettel
    MemberAuthor

    We could ask @kurthornik if he recalls when this started to appear.

  4. Enchufa2 commented on Sep 3, 2024

    @Enchufa2
    Member

    Ok. Meanwhile, bisecting...

  5. Enchufa2 commented on Sep 3, 2024

    @Enchufa2
    Member

    Ok, so 4075b5c introduced the change.

    Before the commit:

    > RcppCNPy::npySave@.Data
    function (filename, object, mode = "w", checkPath = TRUE) 
    {
        .External(list(name = "InternalFunction_invoke", address = <pointer: 0x55d82015a630>, 
            dll = list(name = "Rcpp", path = "/home/iucar/R/x86_64-redhat-linux-gnu-library/4.4/Rcpp/libs/Rcpp.so", 
                dynamicLookup = TRUE, handle = <pointer: 0x55d8200bbcf0>, 
                info = <pointer: 0x55d81e6e9c80>, forceSymbols = FALSE), 
            numParameters = -1L), <pointer: 0x55d81fce3ad0>, filename, 
            object, mode, checkPath)
        invisible(NULL)
    }

    After the commit:

    > RcppCNPy::npySave@.Data
    function (filename, object, mode = "w", checkPath = TRUE) 
    {
        .External(list(name = "InternalFunction_invoke", address = <pointer: 0x55d82015a630>, 
            dll = list(name = "Rcpp", path = "/home/iucar/R/x86_64-redhat-linux-gnu-library/4.4/Rcpp/libs/Rcpp.so", 
                dynamicLookup = TRUE, handle = <pointer: 0x55d8200bbcf0>, 
                info = <pointer: 0x55d81e6e9c80>, forceSymbols = FALSE), 
            numParameters = -1L), <pointer: 0x55d81fce3ad0>, filename, 
            object, mode, checkPath)
    }
  6. eddelbuettel commented on Sep 3, 2024

    @eddelbuettel
    MemberAuthor

    That's what I suspected when I glanced at our changelog. We may have dropped an invisible there somewhere.

  7. eddelbuettel commented on Sep 3, 2024

    @eddelbuettel
    MemberAuthor

    @andrjohns Quick ping :) Not the most burning of fires, but I have to do a minor maintenance release because void functions in Modules now return NULL whereas they used to be silent. You wouldn't have a quick guess as to whether this slipped in when you overhauled this so nicely for variadic arguments?

  8. Enchufa2 commented on Sep 3, 2024

    @Enchufa2
    Member

    The logic that creates such a call is here, and depends on the detection of whether the RESULT_TYPE is void here. I checked and is_void is FALSE when RcppCNPy is built. This means that the RESULT_TYPE is incorrect with variadic arguments.

  9. andrjohns commented on Sep 3, 2024

    @andrjohns
    Contributor

    Off the top of my head, I think this is because the call function (invoked by the module definition) is returning R_NilValue for void-returning functions here

    I'll have a proper look/debug tomorrow though

  10. Enchufa2 commented on Sep 3, 2024

    @Enchufa2
    Member

    Also, the generated file has a specific specialization for void that uses void_type here, and this is what returns "void" here.

  11. Enchufa2 commented on Sep 4, 2024

    @Enchufa2
    Member

    @andrjohns You may want to start your debugging from the module-regression branch, where I added a few tests that check that void module functions correctly return invisibly (3 are failing now, which are functions exposed via Modules).

  12. Enchufa2 commented on Oct 1, 2024

    @Enchufa2
    Member

    @andrjohns Just a kind reminder here. A rough estimate of your time availability for this would be appreciated, even if that's a null value, in order to plan our own efforts over here. Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions