Commit 0e4d772
authored
Don't close drivers & sessions in finalizer (#1183)
No longer implicitly closing drivers and sessions in `__del__()`
(finalizer/destructor). Make sure to call `.close()` on them explicitly or use
them in a `with` statement.
A deprecation warning has been emitted in such cases before.
Relying on `__del__` leads to hard to follow control flow and can result in
surprising behavior as there is no guarantee when that the finalizer will be
called if ever. A ResourceWarning is emitted instead.
See also: https://docs.python.org/3/reference/datamodel.html#object.__del__1 parent 27f5e83 commit 0e4d772
File tree
5 files changed
+8
-72
lines changed- src/neo4j
- _async
- work
- _sync
- work
5 files changed
+8
-72
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
| |||
509 | 508 | | |
510 | 509 | | |
511 | 510 | | |
512 | | - | |
513 | | - | |
514 | 511 | | |
515 | 512 | | |
516 | 513 | | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | 514 | | |
530 | 515 | | |
531 | 516 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 25 | + | |
29 | 26 | | |
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
33 | | - | |
34 | 30 | | |
35 | 31 | | |
36 | 32 | | |
| |||
74 | 70 | | |
75 | 71 | | |
76 | 72 | | |
| 73 | + | |
| 74 | + | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | | - | |
81 | | - | |
82 | 78 | | |
83 | 79 | | |
84 | 80 | | |
85 | 81 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 82 | | |
101 | 83 | | |
102 | 84 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments