Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Method works correct in QGIS 2. I found some differences between pyqgis2 API: qgis.org/api/2.18/qgsvectorlayer_8cpp_source.html (QGIS2 :line 2732) and pyqgis3 API: qgis.org/api/2.18/qgsvectorlayer_8cpp_source.html (QGIS2 :line 2732) And one more interesting fact: Working time increase proportionally to the number of user-selected features (Working_time ≈ n*5 min, where n - number of user-selected features). And I still did not find solution this problem. If someone have some idea please share with me.