diff options
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-pint/0001-dataclass-frozen-True-for-Python-3.13-compatibility.patch')
-rw-r--r-- | meta-python/recipes-devtools/python/python3-pint/0001-dataclass-frozen-True-for-Python-3.13-compatibility.patch | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pint/0001-dataclass-frozen-True-for-Python-3.13-compatibility.patch b/meta-python/recipes-devtools/python/python3-pint/0001-dataclass-frozen-True-for-Python-3.13-compatibility.patch new file mode 100644 index 000000000..6f9b0f5bc --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-pint/0001-dataclass-frozen-True-for-Python-3.13-compatibility.patch | |||
@@ -0,0 +1,116 @@ | |||
1 | From dc729d5b6574e1c44ec12e13b68c2b900e4a7ba1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Simon Willison <swillison@gmail.com> | ||
3 | Date: Fri, 12 Jul 2024 17:23:21 -0700 | ||
4 | Subject: [PATCH] @dataclass(frozen=True) for Python 3.13 compatibility | ||
5 | |||
6 | Upstream-Status: Submitted [https://github.com/hgrecco/pint/pull/2037] | ||
7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
8 | --- | ||
9 | pint/errors.py | 24 ++++++++++++------------ | ||
10 | 1 file changed, 12 insertions(+), 12 deletions(-) | ||
11 | |||
12 | diff --git a/pint/errors.py b/pint/errors.py | ||
13 | index 59d3b45..f080f52 100644 | ||
14 | --- a/pint/errors.py | ||
15 | +++ b/pint/errors.py | ||
16 | @@ -81,12 +81,12 @@ class WithDefErr: | ||
17 | return DefinitionError(self.name, self.__class__, msg) | ||
18 | |||
19 | |||
20 | -@dataclass(frozen=False) | ||
21 | +@dataclass(frozen=True) | ||
22 | class PintError(Exception): | ||
23 | """Base exception for all Pint errors.""" | ||
24 | |||
25 | |||
26 | -@dataclass(frozen=False) | ||
27 | +@dataclass(frozen=True) | ||
28 | class DefinitionError(ValueError, PintError): | ||
29 | """Raised when a definition is not properly constructed.""" | ||
30 | |||
31 | @@ -102,7 +102,7 @@ class DefinitionError(ValueError, PintError): | ||
32 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
33 | |||
34 | |||
35 | -@dataclass(frozen=False) | ||
36 | +@dataclass(frozen=True) | ||
37 | class DefinitionSyntaxError(ValueError, PintError): | ||
38 | """Raised when a textual definition has a syntax error.""" | ||
39 | |||
40 | @@ -115,7 +115,7 @@ class DefinitionSyntaxError(ValueError, PintError): | ||
41 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
42 | |||
43 | |||
44 | -@dataclass(frozen=False) | ||
45 | +@dataclass(frozen=True) | ||
46 | class RedefinitionError(ValueError, PintError): | ||
47 | """Raised when a unit or prefix is redefined.""" | ||
48 | |||
49 | @@ -130,7 +130,7 @@ class RedefinitionError(ValueError, PintError): | ||
50 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
51 | |||
52 | |||
53 | -@dataclass(frozen=False) | ||
54 | +@dataclass(frozen=True) | ||
55 | class UndefinedUnitError(AttributeError, PintError): | ||
56 | """Raised when the units are not defined in the unit registry.""" | ||
57 | |||
58 | @@ -150,13 +150,13 @@ class UndefinedUnitError(AttributeError, PintError): | ||
59 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
60 | |||
61 | |||
62 | -@dataclass(frozen=False) | ||
63 | +@dataclass(frozen=True) | ||
64 | class PintTypeError(TypeError, PintError): | ||
65 | def __reduce__(self): | ||
66 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
67 | |||
68 | |||
69 | -@dataclass(frozen=False) | ||
70 | +@dataclass(frozen=True) | ||
71 | class DimensionalityError(PintTypeError): | ||
72 | """Raised when trying to convert between incompatible units.""" | ||
73 | |||
74 | @@ -183,7 +183,7 @@ class DimensionalityError(PintTypeError): | ||
75 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
76 | |||
77 | |||
78 | -@dataclass(frozen=False) | ||
79 | +@dataclass(frozen=True) | ||
80 | class OffsetUnitCalculusError(PintTypeError): | ||
81 | """Raised on ambiguous operations with offset units.""" | ||
82 | |||
83 | @@ -208,7 +208,7 @@ class OffsetUnitCalculusError(PintTypeError): | ||
84 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
85 | |||
86 | |||
87 | -@dataclass(frozen=False) | ||
88 | +@dataclass(frozen=True) | ||
89 | class LogarithmicUnitCalculusError(PintTypeError): | ||
90 | """Raised on inappropriate operations with logarithmic units.""" | ||
91 | |||
92 | @@ -233,7 +233,7 @@ class LogarithmicUnitCalculusError(PintTypeError): | ||
93 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
94 | |||
95 | |||
96 | -@dataclass(frozen=False) | ||
97 | +@dataclass(frozen=True) | ||
98 | class UnitStrippedWarning(UserWarning, PintError): | ||
99 | msg: str | ||
100 | |||
101 | @@ -241,13 +241,13 @@ class UnitStrippedWarning(UserWarning, PintError): | ||
102 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
103 | |||
104 | |||
105 | -@dataclass(frozen=False) | ||
106 | +@dataclass(frozen=True) | ||
107 | class UnexpectedScaleInContainer(Exception): | ||
108 | def __reduce__(self): | ||
109 | return self.__class__, tuple(getattr(self, f.name) for f in fields(self)) | ||
110 | |||
111 | |||
112 | -@dataclass(frozen=False) | ||
113 | +@dataclass(frozen=True) | ||
114 | class UndefinedBehavior(UserWarning, PintError): | ||
115 | msg: str | ||
116 | |||