This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Riccardo Coccioli
Recipients Riccardo Coccioli, docs@python
Date 2020-10-12.09:00:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602493243.32.0.577845482202.issue42011@roundup.psfhosted.org>
In-reply-to
Content
The documentation for the logging.Filter().filter() method states:

#-----
Is the specified record to be logged? Returns 0 for no, nonzero for yes. If deemed appropriate, the record may be modified in-place.
#-----

While its implementation returns a boolean in Lib/logging/__init__.py.
Moreover the most recent version of mypy (0.790) reports it as an error if a custom class inherit from logging.Filter and implement a filter() method that returns an int as specified in the documentation:

#-----
error: Return type "int" of "filter" incompatible with return type "bool" in supertype "Filter"  [override]
#-----

P.S. As a side note, the API for filter() is quite counter-intuitive as it requires the filter() method to return False to filter out the record and True to include it.
History
Date User Action Args
2020-10-12 09:00:43Riccardo Cocciolisetrecipients: + Riccardo Coccioli, docs@python
2020-10-12 09:00:43Riccardo Cocciolisetmessageid: <1602493243.32.0.577845482202.issue42011@roundup.psfhosted.org>
2020-10-12 09:00:43Riccardo Cocciolilinkissue42011 messages
2020-10-12 09:00:43Riccardo Cocciolicreate