Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork940
Commit7545b80
committed
Add __all__ in git.exc, adjust __init__.py imports
The git.exc module imports exceptions from gitdb.exc to republishthem, as well as defining its own (also for use from outside). Butbecause it did not define __all__, the intent for the exceptions itimported was unclear, since names that are introduced by importsand not present in __all__ are not generally considered public,even when __all__ is absent and a "*" import would reimport them.This rectifies that by adding __all__ and listing both imported andnewly introduced exceptions explicitly in it. Although thisstrictly expands which names are public under typical conventions,it strictly contracts which names are imported by a "*" import,because the presence of __all__ suppresses names not listed in itfrom being imported that way. However, because under typicalconventions those other names are not considered public, and theywere not even weakly documented as public, this should be okay.(Even though this is not a breaking change, in that code it wouldbreak would already technically be broken... if it turns out thatit is common to wrongly rely on the availabiliy of those names,then this may need to be revisited and slightly modified.)This brings the readily identified public interface of git.exc inline with what is weakly implied (and intended) by its docstring.This also modifies __init__.py accordingly: The top-level gitmodule has for some time used a "*" import on git.exc, causingthe extra names originally meant as implementation details to beincluded. Because its own __all__ was dynamically generated untilc862845,#1659 also added8edc53b to retain the formerly presentnames in __all__. So the change here imports those names from themodules that deliberately provide them, to preserve compatibility.1 parent8197e90 commit7545b80
2 files changed
+34
-4
lines changedLines changed: 6 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
11 | 10 |
| |
| 11 | + | |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
| 41 | + | |
| 42 | + | |
41 | 43 |
| |
| 44 | + | |
42 | 45 |
| |
43 | 46 |
| |
44 | 47 |
| |
| |||
53 | 56 |
| |
54 | 57 |
| |
55 | 58 |
| |
| 59 | + | |
56 | 60 |
| |
57 | 61 |
| |
58 | 62 |
| |
|
Lines changed: 28 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 |
| - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
9 | 36 |
| |
10 | 37 |
| |
11 | 38 |
| |
| |||
14 | 41 |
| |
15 | 42 |
| |
16 | 43 |
| |
17 |
| - | |
18 | 44 |
| |
19 | 45 |
| |
20 | 46 |
| |
|
0 commit comments
Comments
(0)