cling failure when accessing `std::map` elements from Python
I maintainer di solito rispondono entro 1 giorno
@guitargeek ci sta già lavorando.
Dal 19/1/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Check duplicate issues.
- Checked for duplicates
Description
Consider the following program
import ROOT
ROOT.gInterpreter.Declare(r"""
struct S{};
std::map<std::string, std::vector<std::unique_ptr<S>>> mymap;
mymap["a"] = std::vector<std::unique_ptr<S>>();
""")
# For some reason, uncommenting the following line will prevent the program from crashing
# print(ROOT.mymap)
for key, value in ROOT.mymap:
print(key, value)
Running this program in master shows no issues:
$: python test_map.py
a {}
But I suspect there is a real problem hidden in this code. By applying this simple patch https://github.com/root-project/root/pull/20946, the same program crashes
*** Break *** illegal instruction
[...]
make_dtor_wrapperFailed to compile
==== SOURCE BEGIN ====
__attribute__((used)) extern "C" void __dtor_0(void* obj, unsigned long nary, int withFree)
{
if (withFree) {
if (!nary) {
delete (std::_Rb_tree_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::unique_ptr<S, std::default_delete<S> >, std::allocator<std::unique_ptr<S, std::default_delete<S> > > > > >*) obj;
}
else {
delete[] (std::_Rb_tree_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::unique_ptr<S, std::default_delete<S> >, std::allocator<std::unique_ptr<S, std::default_delete<S> > > > > >*) obj;
}
}
else {
typedef std::_Rb_tree_iterator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::unique_ptr<S, std::default_delete<S> >, std::allocator<std::unique_ptr<S, std::default_delete<S> > > > > > Nm;
if (!nary) {
((Nm*)obj)->~Nm();
}
else {
do {
(((Nm*)obj)+(--nary))->~Nm();
} while (nary);
}
}
}
I attach the full stacktrace here
Something that looks odd is the presence of const std::basic_string in part of the output from above, while the std::map I create uses just std::basic_string, I don't know if it's related to the issue.
Reproducer
See above
ROOT version
Master with patch https://github.com/root-project/root/pull/20946
Installation method
Build from source
Operating system
Linux
Additional context
No response
- Lingua principale
- C++
- Stelle
- 3.3k
- Fork
- 1.6k
- Merge medio
- 2g 16h
- PR unite (30g)
- 194
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di root-project/root
-
thisroot.sh: wrong ROOTSYS in zsh when the shell's command line has a newlineForse già presa @dpiparo l’ha presa 3 giorni fa. Apertabug in:Build System
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
root-project/root#23746 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[tmva][sofie] Inputs of unsupported type (e.g. float16) give code that does not compile instead of an errorForse già presa @lmoneta l’ha presa 12 giorni fa. ApertaAI-Assisted bug in:SOFIE
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
root-project/root#23655 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 71/100
root-project/root#23790 ·
I maintainer di solito rispondono entro 1 giorno
-
bug in:Core Libraries
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
root-project/root#23777 ·
I maintainer di solito rispondono entro 1 giorno
-
`TChain::GetEntries` internal caching ineffective?Forse già presa @pcanal l’ha presa 5 giorni fa. Apertaimprovement in:TTree
root-project/root#23738 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di root-project/root
Issue simili
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Niko1221/Strata#3673 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
bug P4
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
open-astro/AlpacaBridge#1520 ·
I maintainer di solito rispondono entro 1 giorno
-
[Docs] CONTRIBUTING still says FreeType 2.14.3 and TabLabel.h says ImGui 1.92.9b after the bumpsForse già presa @mgradwohl l’ha presa oggi. Apertaagent:WSL documentation LOW
Difficoltà 1/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno