Description: pylint >=2.13 has changed args in ScopeConsumer, fixing it accordingly
Author: Nilesh Patra <nilesh@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021889
Forwarded: not-needed, aleady fixed upstream
Last-Update: 2022-10-16
--- a/pylint_django/augmentations/__init__.py
+++ b/pylint_django/augmentations/__init__.py
@@ -314,7 +314,16 @@
                 continue
         new_things[name] = stmts
 
-    consumer._atomic = ScopeConsumer(new_things, consumer.consumed, consumer.scope_type)  # pylint: disable=W0212
+    # ScopeConsumer changed between pylint 2.12 and 2.13
+    # see https://github.com/PyCQA/pylint/issues/5970#issuecomment-1078778393
+    if hasattr(consumer, "consumed_uncertain"):
+        # this is pylint >= 2.13, and the ScopeConsumer tuple has an additional field
+        sc_args = (new_things, consumer.consumed, consumer.consumed_uncertain, consumer.scope_type)
+    else:
+        # this is <2.13 and does not have the consumer_uncertain field
+        sc_args = (new_things, consumer.consumed, consumer.scope_type)
+
+    consumer._atomic = ScopeConsumer(*sc_args)  # pylint: disable=W0212
     self._to_consume = [consumer]  # pylint: disable=W0212
 
     return orig_method(self, node)
