Skip to content

[PyROOT] Functions with const char* arguments can't accept ROOT.nullptr #10954

@guitargeek

Description

@guitargeek

Describe the bug

It is not possible to pass ROOT.nullptr to a function that takes a const char*.

Expected behavior

A ROOT.nullptr should by accepted by cppyy overloads when a const char* is expected.

In RooFit, it happens often that the user is expected to pass nullptr, for example in RooAbsArg::setStringAttribute(), where passing a nullptr removes an attribute with a given name. So it would be great if PyROOT supports that!

To Reproduce

import ROOT

ROOT.gInterpreter.Declare("""
void foo(char*) {}
void bar(const char*) {}
""")

ROOT.foo(ROOT.nullptr) # works!
ROOT.bar(ROOT.nullptr) # doesn't work

Setup

ROOT master on Arch Linux.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions