Skip to content

Segfault when calling MolToSmiles on submol #9270

Description

@ricrogz

Someone reported that this code results in a segmentation fault:

from rdkit import Chem

Chem.SetUseLegacyStereoPerception(False) 

smi = 'CC1/C=C(/C)[O][Ir]23(<-[O]=1)([c]1ccccc1c1cncc[n]->21)[c]1ccccc1c1cncc[n]->31'
mol = Chem.MolFromSmiles(smi)

atomidx = 7
rad = 3
env = Chem.FindAtomEnvironmentOfRadiusN(mol, rad, atomidx)
submol = Chem.PathToSubmol(mol, env)

# all good (apparently)

print(f'{Chem.MolToSmiles(submol)=}')  # segfault

They report that with 2025.09.6 this code printed Chem.MolToSmiles(submol)='c[c](c)[Ir]1([O]/C=C\\C(C)=[O]->1)([c](c)c)(<-[n](c)c)<-[n](c)c'

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions