Commit dafabf9
authored
Fix Tempfile#{dup,clone}
Instead of storing the delegate in @tmpfile, use __getobj__, since
delegate library already handles dup/clone for that. Copy the
unlinked, mode, and opts instance variables to the returned object
when using dup/clone.
Split the close/unlink finalizer into two finalizers. The close
finalizer always closes when any Tempfile instance is GCed, since
each Tempfile instance uses a separate file descriptor. The unlink
finalizer unlinks only when the original and all duped/cloned
Tempfiles are GCed, since all share the same path.
For Tempfile#open, undefine the close finalizer after closing the
current file, the redefine the close finalizer with the new file.
Fixes [Bug #19441]1 parent d6ddf78 commit dafabf9
2 files changed
+70
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
| 156 | + | |
155 | 157 | | |
156 | 158 | | |
157 | | - | |
| 159 | + | |
158 | 160 | | |
159 | 161 | | |
160 | | - | |
| 162 | + | |
| 163 | + | |
161 | 164 | | |
162 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
163 | 185 | | |
164 | 186 | | |
165 | 187 | | |
166 | 188 | | |
167 | 189 | | |
| 190 | + | |
168 | 191 | | |
169 | | - | |
170 | | - | |
| 192 | + | |
| 193 | + | |
171 | 194 | | |
172 | 195 | | |
173 | 196 | | |
174 | | - | |
| 197 | + | |
175 | 198 | | |
176 | 199 | | |
177 | 200 | | |
| |||
228 | 251 | | |
229 | 252 | | |
230 | 253 | | |
231 | | - | |
| 254 | + | |
232 | 255 | | |
233 | 256 | | |
234 | 257 | | |
235 | 258 | | |
236 | 259 | | |
237 | | - | |
| 260 | + | |
238 | 261 | | |
239 | 262 | | |
240 | 263 | | |
241 | 264 | | |
242 | 265 | | |
243 | 266 | | |
244 | 267 | | |
245 | | - | |
| 268 | + | |
246 | 269 | | |
247 | 270 | | |
248 | 271 | | |
249 | 272 | | |
250 | 273 | | |
251 | | - | |
252 | | - | |
| 274 | + | |
| 275 | + | |
253 | 276 | | |
254 | | - | |
| 277 | + | |
255 | 278 | | |
256 | 279 | | |
257 | 280 | | |
258 | 281 | | |
259 | 282 | | |
260 | 283 | | |
261 | | - | |
| 284 | + | |
262 | 285 | | |
263 | 286 | | |
264 | 287 | | |
265 | 288 | | |
266 | 289 | | |
267 | 290 | | |
268 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
269 | 296 | | |
270 | | - | |
271 | 297 | | |
272 | 298 | | |
273 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
274 | 311 | | |
275 | 312 | | |
276 | 313 | | |
277 | | - | |
| 314 | + | |
278 | 315 | | |
279 | | - | |
280 | 316 | | |
281 | | - | |
| 317 | + | |
282 | 318 | | |
283 | 319 | | |
284 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
66 | 82 | | |
67 | 83 | | |
68 | 84 | | |
| |||
0 commit comments