The interaction of H or He atoms with a core of edge and screw dislocations (SDs), with Burgers vector a0/2 〈111〉, is studied by means of ab initio calculations. The results show that the edge dislocations are stronger traps for H and He compared to the SDs, while the H/He affinity to both types of dislocation is significantly weaker than to a single vacancy. The lowest energy atomic configurations are rationalized on the basis of the charge density distribution and elasticity theory considerations. The results obtained contribute to the rationalization of the thermal desorption spectroscopy analysis by attributing certain peaks of the release of plasma components to the detrapping from dislocations. Complementary molecular statics (MS) calculations are performed to validate the accuracy of the recently developed W-H-He embedded atom method (EAM) and bond-order potentials. It is revealed that the EAM potential can reproduce correctly the magnitude of the interaction of H with both dislocations as compared to the ab initio results. All the potentials underestimate significantly the He-dislocation interaction and cannot describe correctly the lowest energy positions for H and He around the dislocation core. The reason for the discrepancy between ab initio and the MS results is rationalized by the analysis of the fully relaxed atomic configurations. © 2017 SCK•CEN.