Commit ded5e90
committed
Undeprecate
It seems like we were trying to deprecate passing `nil` to
Gem::Version.new. This breaks existing code, and I don't think there is
a good reason to deprecate this usage.
I believe what we want to prevent is the following code:
```ruby
Gem::Specification.new do |spec|
spec.version = nil
# suddenly the spec version is 0!
p spec.version
end
```
This commit allows people to manually construct `Gem::Version.new(nil)`,
but when someone assigns `nil` as the Gem specification version, it sets
the spec version to `nil` (making the specification invalid). People
who manually construct `Gem::Version` objects and use nil should be
allowed to do it, and `Gem::Version.new(nil) == Gem::Version.new("0")`,
but people who assign `nil` in a gemspec will get an invalid gemspec.
I think deprecation started
[here](#2203) but there doesn't
seem to be a reason to do it.
Fixes #9052Gem::Version.new(nil)
1 parent 4f85e02 commit ded5e90
File tree
5 files changed
+43
-55
lines changed- lib/rubygems
- test/rubygems
5 files changed
+43
-55
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2517 | 2517 | | |
2518 | 2518 | | |
2519 | 2519 | | |
2520 | | - | |
| 2520 | + | |
2521 | 2521 | | |
2522 | 2522 | | |
2523 | 2523 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
175 | | - | |
176 | | - | |
| 174 | + | |
177 | 175 | | |
178 | 176 | | |
179 | 177 | | |
| |||
182 | 180 | | |
183 | 181 | | |
184 | 182 | | |
185 | | - | |
186 | 183 | | |
187 | 184 | | |
188 | 185 | | |
189 | 186 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | 187 | | |
195 | 188 | | |
196 | 189 | | |
| |||
206 | 199 | | |
207 | 200 | | |
208 | 201 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | 202 | | |
218 | 203 | | |
219 | 204 | | |
| |||
224 | 209 | | |
225 | 210 | | |
226 | 211 | | |
227 | | - | |
| 212 | + | |
228 | 213 | | |
229 | 214 | | |
230 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 140 | + | |
145 | 141 | | |
146 | 142 | | |
147 | 143 | | |
| |||
151 | 147 | | |
152 | 148 | | |
153 | 149 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 150 | + | |
159 | 151 | | |
160 | 152 | | |
161 | 153 | | |
| |||
165 | 157 | | |
166 | 158 | | |
167 | 159 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
| 160 | + | |
173 | 161 | | |
174 | 162 | | |
175 | 163 | | |
| |||
179 | 167 | | |
180 | 168 | | |
181 | 169 | | |
182 | | - | |
183 | | - | |
184 | | - | |
| 170 | + | |
185 | 171 | | |
186 | 172 | | |
187 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1247 | 1247 | | |
1248 | 1248 | | |
1249 | 1249 | | |
1250 | | - | |
1251 | | - | |
1252 | | - | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
1253 | 1261 | | |
1254 | | - | |
1255 | | - | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
1256 | 1281 | | |
1257 | 1282 | | |
1258 | 1283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
| |||
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 52 | + | |
61 | 53 | | |
62 | 54 | | |
63 | 55 | | |
| |||
0 commit comments