Fix bug  #7343

Addressing issue [#7343](https://github.com/sympy/sympy/issues/7343)