1. Armin Rigo
  2. cpython-withatomic

Commits

Guido van Rossum  committed f997ded

New special case in comparisons: None is smaller than any other object
(unless the object's type overrides this comparison).

  • Participants
  • Parent commits 239c737
  • Branches legacy-trunk

Comments (0)

Files changed (1)

File Objects/object.c

View file
  • Ignore whitespace
 		PyErr_Clear();
 	}
 
+	/* None is smaller than anything */
+	if (v == Py_None)
+		return -1;
+	if (w == Py_None)
+		return 1;
+
 	/* different type: compare type names */
 	if (v->ob_type->tp_as_number)
 		vname = "";