Parse error for Python with statement

SonarQube 8.9.6.50800, SonarScanner 4.7.0.2747, Python Code Quality and Security 3.4.1.8066

Error observed while running the Sonar scanner on Python 3.9 source code:

08:15:10.500 ERROR: Parse error at line 309 column 71:
  305: with pytest.raises(KeyError):
  306:         product["measurements/group1/group2"]
  307: 
  308:     with (
  -->          patch.object(EmptyTestStore, "__delitem__", return_value=None) as del_method,
  310:         patch.object(EmptyTestStore, "__contains__", return_value=True) as in_method,
  311:     ):
  312:         del product["false_key"]
  313:     del_method

My understanding is that this has been fixed in the Sonar-Python plugin ([SONARPY-860] Parse error on `with` statements with parens - SonarSource) but that this version is not yet available in the SonarQube LTS.

Is it planned to update the SonarQube LTS with regards to this fix?

Hey there.

At this time, we don’t anticipate backporting SONARPY-860 to SonarQube v8.9 LTS. The fix is available starting in SonarQube v9.2 (the latest version if v9.3).

Hi,
ok. Thanks for the quick reply.