Skip to content

[PyROOT][7501] Fix initialization of C++ data members via attribute s…#8036

Merged
etejedor merged 1 commit intoroot-project:masterfrom
etejedor:array-class-members
May 6, 2021
Merged

[PyROOT][7501] Fix initialization of C++ data members via attribute s…#8036
etejedor merged 1 commit intoroot-project:masterfrom
etejedor:array-class-members

Conversation

@etejedor etejedor requested a review from vepadulano April 29, 2021 09:00
@etejedor etejedor self-assigned this Apr 29, 2021
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu16/nortcxxmod.
Running on sft-ubuntu-1604-3.cern.ch:/build/workspace/root-pullrequests-build
See console output.

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-fedora30/cxx14.
Running on root-fedora30-2.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-fedora31/noimt.
Running on root-fedora-31-2.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-performance-centos8-multicore/default.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-04-29T10:07:15.595Z] C:\build\workspace\root-pullrequests-build\build\bin\libcppyy3_8.pyd : fatal error LNK1120: 1 unresolved externals [C:\build\workspace\root-pullrequests-build\build\bindings\pyroot\cppyy\CPyCppyy\cppyy3_8.vcxproj]

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1014/python3.
Running on macphsft17.dyndns.cern.ch:/build/jenkins/workspace/root-pullrequests-build
See console output.

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11.0/cxx17.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2021-04-29T10:23:22.971Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:194:21: warning: 'destroy' is deprecated [-Wdeprecated-declarations]
  • [2021-04-29T10:23:29.555Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:194:21: warning: 'destroy' is deprecated [-Wdeprecated-declarations]
  • [2021-04-29T10:23:29.555Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:128:24: warning: 'destroy' is deprecated [-Wdeprecated-declarations]
  • [2021-04-29T10:23:29.555Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:140:54: warning: 'max_size' is deprecated [-Wdeprecated-declarations]
  • [2021-04-29T10:23:29.555Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:99:21: warning: 'construct' is deprecated [-Wdeprecated-declarations]
  • [2021-04-29T10:23:29.556Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:99:21: warning: 'construct<ROOT::VecOps::RVec<unsigned long>>' is deprecated [-Wdeprecated-declarations]
  • [2021-04-29T10:23:29.556Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:99:21: warning: 'construct' is deprecated [-Wdeprecated-declarations]
  • [2021-04-29T10:23:29.556Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:99:21: warning: 'construct<unsigned long>' is deprecated [-Wdeprecated-declarations]
  • [2021-04-29T10:23:29.556Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:140:54: warning: 'max_size' is deprecated [-Wdeprecated-declarations]
  • [2021-04-29T10:23:29.556Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/math/vecops/inc/ROOT/RAdoptAllocator.hxx:128:24: warning: 'destroy' is deprecated [-Wdeprecated-declarations]

And 1453 more

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

@etejedor
Copy link
Copy Markdown
Contributor Author

@phsft-bot build

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

Copy link
Copy Markdown
Member

@vepadulano vepadulano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding this 😄 This is my first review of cppyy code so it's mostly questions and doubts, feel free to merge as it is!

Comment on lines +210 to +212
auto res = PyObject_SetAttrString(holder, (char*)attr_name.str().c_str(), target);
return res != -1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading at the the signature of PyObject_SetAttrString, I have the following two questions:

  1. The second argument accepts a const char *, which is already the return type of attr_name.str().c_str(), is the extra (char*) needed?
  2. The return value of PyObject_SetAttrString should be 0 on success and 1 on failure according to the documentation. If this is true and there are no other cases not reported in the docs, these lines could be substituted by
Suggested change
auto res = PyObject_SetAttrString(holder, (char*)attr_name.str().c_str(), target);
return res != -1;
return PyObject_SetAttrString(holder, attr_name.str().c_str(), target) == 0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for 1, and I'll break the str().c_str() chain. 2 is fine either way 😄

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ad 1.: the (char*) is for older pythons and still appears in older code throughout CPyCppyy, so is retained for consistency. Ad 2.: it's -1 on failure, not 1 and it is likewise by convention: -1 is the common failure report across the C-API, whereas 0 is not a common success report across same.

// info/status
uint64_t fFlags;
Cppyy::TCppScope_t fCurScope;
PyObject* fPyContext;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking it would be nice to have somewhere a few more docs about why this is needed. Maybe referincing the linked issue and saying the context will be used to set a lifeline to help in keeping the temporary arrays alive?
Maybe, Here could be a good place?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'll add some explanation!

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-04-29T21:23:08.882Z] C:\build\workspace\root-pullrequests-build\build\bin\libcppyy3_8.pyd : fatal error LNK1120: 1 unresolved externals [C:\build\workspace\root-pullrequests-build\build\bindings\pyroot\cppyy\CPyCppyy\cppyy3_8.vcxproj]

@etejedor
Copy link
Copy Markdown
Contributor Author

Build failure on Windows to be checked with @bellenot when he is back, not merging for the moment.

@etejedor etejedor force-pushed the array-class-members branch from 9bfda2c to bf64b00 Compare April 30, 2021 08:17
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-04-30T12:04:33.197Z] C:\build\workspace\root-pullrequests-build\build\bin\libcppyy3_8.pyd : fatal error LNK1120: 1 unresolved externals [C:\build\workspace\root-pullrequests-build\build\bindings\pyroot\cppyy\CPyCppyy\cppyy3_8.vcxproj]

@etejedor etejedor force-pushed the array-class-members branch from bf64b00 to c216afe Compare May 4, 2021 09:29
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-fedora30/cxx14, ROOT-fedora31/noimt, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-05-04T11:23:49.988Z] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\utility(312,1): fatal error C1060: compiler is out of heap space (compiling source file C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\tools\clang\lib\ASTMatchers\ASTMatchFinder.cpp) [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\tools\clang\lib\ASTMatchers\obj.clangASTMatchers.vcxproj]
  • [2021-05-04T11:23:49.988Z] C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\tools\clang\lib\CodeGen\CGDeclCXX.cpp(751,67): fatal error C1060: compiler is out of heap space [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\tools\clang\lib\CodeGen\obj.clangCodeGen.vcxproj]
  • [2021-05-04T11:23:49.988Z] C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\include\llvm/ADT/DenseMap.h(73,1): fatal error C1060: compiler is out of heap space (compiling source file C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\tools\clang\lib\Frontend\DependencyFile.cpp) [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\tools\clang\lib\Frontend\obj.clangFrontend.vcxproj]
  • [2021-05-04T11:23:49.988Z] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\xutility(132,48): fatal error C1060: compiler is out of heap space (compiling source file C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\lib\Target\NVPTX\NVPTXInstrInfo.cpp) [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\lib\Target\NVPTX\LLVMNVPTXCodeGen.vcxproj]
  • [2021-05-04T11:23:49.988Z] C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\include\llvm/Support/TrailingObjects.h(224,1): fatal error C1060: compiler is out of heap space (compiling source file C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\tools\clang\lib\CodeGen\CGCXX.cpp) [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\tools\clang\lib\CodeGen\obj.clangCodeGen.vcxproj]
  • [2021-05-04T11:23:49.988Z] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\xtree(715,1): fatal error C1060: compiler is out of heap space (compiling source file C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\tools\clang\lib\Frontend\InterfaceStubFunctionsConsumer.cpp) [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\tools\clang\lib\Frontend\obj.clangFrontend.vcxproj]
  • [2021-05-04T11:23:49.988Z] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\utility(122,1): fatal error C1060: compiler is out of heap space (compiling source file C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\tools\clang\lib\CodeGen\CGAtomic.cpp) [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\tools\clang\lib\CodeGen\obj.clangCodeGen.vcxproj]
  • [2021-05-04T11:23:49.989Z] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\vector(1706,1): fatal error C1060: compiler is out of heap space (compiling source file C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\tools\clang\lib\Frontend\PrecompiledPreamble.cpp) [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\tools\clang\lib\Frontend\obj.clangFrontend.vcxproj]
  • [2021-05-04T11:23:49.989Z] C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\include\llvm/ADT/SmallPtrSet.h(359,1): fatal error C1060: compiler is out of heap space (compiling source file C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\tools\clang\lib\Frontend\CompilerInstance.cpp) [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\tools\clang\lib\Frontend\obj.clangFrontend.vcxproj]
  • [2021-05-04T11:23:49.989Z] C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\include\llvm/Support/Casting.h(229,1): fatal error C1060: compiler is out of heap space (compiling source file C:\build\workspace\root-pullrequests-build\root\interpreter\llvm\src\lib\Target\NVPTX\NVPTXFrameLowering.cpp) [C:\build\workspace\root-pullrequests-build\build\interpreter\llvm\src\lib\Target\NVPTX\LLVMNVPTXCodeGen.vcxproj]

And 229 more

@bellenot
Copy link
Copy Markdown
Member

bellenot commented May 4, 2021

@phsft-bot build just on windows10/cxx14

@phsft-bot
Copy link
Copy Markdown

Starting build on windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
See console output.

@bellenot
Copy link
Copy Markdown
Member

bellenot commented May 4, 2021

@phsft-bot build just on windows10/cxx14

@phsft-bot
Copy link
Copy Markdown

Starting build on windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-05-04T15:55:23.911Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/rootCommon.cmake:134:
  • [2021-05-04T15:55:23.911Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:2 (include):
  • [2021-05-04T15:55:23.911Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1121 (file):
  • [2021-05-04T15:55:23.911Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1122 (ctest_start):

@bellenot
Copy link
Copy Markdown
Member

bellenot commented May 4, 2021

@phsft-bot build just on windows10/cxx14

@phsft-bot
Copy link
Copy Markdown

Starting build on windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Failing tests:

@bellenot
Copy link
Copy Markdown
Member

bellenot commented May 6, 2021

@phsft-bot build just on windows10/cxx14

@phsft-bot
Copy link
Copy Markdown

Starting build on windows10/cxx14
How to customize builds

@etejedor etejedor merged commit 1aa2eb0 into root-project:master May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem initialising C++ class members from PyROOT through object properties

5 participants