Skip to content

Commit 5281c71

Browse files
committed
Add additional comments
1 parent f585253 commit 5281c71

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Python/ceval.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ match_class_attr(PyThreadState *tstate, PyObject *subject, PyObject *type,
709709
PyObject *name, PyObject *seen)
710710
{
711711
assert(PyUnicode_CheckExact(name));
712+
// Only check for duplicates if seen is not NULL.
712713
if (seen != NULL) {
713714
assert(PySet_CheckExact(seen));
714715
if (PySet_Contains(seen, name) || PySet_Add(seen, name)) {
@@ -751,6 +752,8 @@ _PyEval_MatchClass(PyThreadState *tstate, PyObject *subject, PyObject *type,
751752
}
752753
// So far so good:
753754
PyObject *seen = NULL;
755+
// Only check for duplicates if there is at least one positional attribute
756+
// and two or more attributes in total.
754757
if (nargs > 0 && nattrs > 1) {
755758
seen = PySet_New(NULL);
756759
if (seen == NULL) {

0 commit comments

Comments
 (0)