This is an archive of the discontinued Mercurial Phabricator instance.

py3: check for None before comparing with integers
ClosedPublic

Authored by pulkit on May 19 2018, 10:41 AM.

Details

Summary

Comparing None and integers on Python 3 is not allowed and raise error.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.May 19 2018, 10:41 AM
This revision was automatically updated to reflect the committed changes.
yuja added a subscriber: yuja.May 21 2018, 9:11 AM
  • a/mercurial/revlog.py

+++ b/mercurial/revlog.py
@@ -846,7 +846,7 @@

def rawsize(self, rev):
    """return the length of the uncompressed text for a given revision"""
    l = self.index[rev][2]
  • if l >= 0:

+ if l is not None and l >= 0:

Ugh, rawsize could be None? It smells like a bug.