File: fix-pylint.patch

package info (click to toggle)
pylint-django 2.0.13-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 660 kB
  • sloc: python: 1,807; sh: 13; makefile: 5
file content (25 lines) | stat: -rw-r--r-- 1,256 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)