Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-10833

PyROOT FutureWarning in ROOT.py

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 6.20/02, 6.20/04
    • Fix Version/s: master, 6.22/00, 6.20/08
    • Component/s: PyROOT
    • Labels:
      None
    • Environment:

      x86_64-centos7-gcc48-opt

      Description

      ROOT.py set_size() calls buf.SetSize(), which is deprecated in TPyBufferFactory.cxx.

      I encountered this with TGraph::GetX(), eg.

      >>> import ROOT
      >>> g=ROOT.TGraph(5)
      >>> x=g.GetX()
       /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.20.04/x86_64-centos7-gcc48-opt/lib/ROOT.py:723: FutureWarning: buffer.SetSize(N) is deprecated and will disappear in a future version of ROOT. Instead, use buffer.reshape((N,))
       buf.SetSize(self.GetN())
      >>> list(x)
       [0.0, 0.0, 0.0, 0.0, 0.0] 
      

      I can't see a way to fix this in user code, except by filtering the warning:

      warnings.filterwarnings("ignore", category=FutureWarning)

      but obviously that's not ideal.

      This seems to have appeared with ROOT 6.20. It was not there in 6.18.

        Attachments

          Activity

            People

            • Assignee:
              etejedor Enric Tejedor Saavedra
              Reporter:
              adye Tim Adye
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: