Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure that bool(obj) is True for QGIS API objects
bool(obj) in Python has the following semantics: 1. if the object has __bool__() method, return its value 2. if the object has __len__() method, return its value 3. return True So for objects in QGIS API that implement __len__() method, we were getting unexpected behavior - for example, "if layer: ..." would evaluate as False in case the layer was empty, while the usual expectation is that any reference to an object that is not None should evaluate to True.
- Loading branch information
Showing with 60 additions and 0 deletions.
- +6 −0 python/core/auto_generated/qgsfeaturesource.sip.in
- +6 −0 python/core/auto_generated/qgsfeaturestore.sip.in
- +6 −0 python/core/auto_generated/qgsfields.sip.in
- +6 −0 python/core/auto_generated/qgsmaplayerstore.sip.in
- +6 −0 python/core/auto_generated/qgsvectorlayercache.sip.in
- +6 −0 src/core/qgsfeaturesource.h
- +6 −0 src/core/qgsfeaturestore.h
- +6 −0 src/core/qgsfields.h
- +6 −0 src/core/qgsmaplayerstore.h
- +6 −0 src/core/qgsvectorlayercache.h