| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 02c2f00 commit 46df79f
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,8 +5,11 @@ | |||
| 5 | 5 | including deprecation warnings, while others verify that other aspects of attribute | |
| 6 | 6 | access are not inadvertently broken by mechanisms introduced to issue the warnings. | |
| 7 | 7 | ||
| 8 | - A note on multiprocessing: Because USE_SHELL has no instance state, this module does not | ||
| 9 | - include tests of pickling and multiprocessing. | ||
| 8 | + A note on multiprocessing | ||
| 9 | + ========================= | ||
| 10 | + | ||
| 11 | + Because USE_SHELL has no instance state, this module does not include tests of pickling | ||
| 12 | + and multiprocessing: | ||
| 10 | 13 | ||
| 11 | 14 | - Just as with a simple class attribute, when a class attribute with custom logic is | |
| 12 | 15 | later set to a new value, it may have either its initial value or the new value when | |
@@ -28,6 +31,26 @@ | |||
| 28 | 31 | ||
| 29 | 32 | - That USE_SHELL cannot be set on instances, and that when retrieved on instances it | |
| 30 | 33 | always gives the same value as on the class, is covered in the tests here. | |
| 34 | + | ||
| 35 | + A note on metaclass conflicts | ||
| 36 | + ============================= | ||
| 37 | + | ||
| 38 | + The most important DeprecationWarning is for the code ``Git.USE_SHELL = True``, which is | ||
| 39 | + a security risk. But this warning may not be possible to implement without a custom | ||
| 40 | + metaclass. This is because a descriptor in a class can customize all forms of attribute | ||
| 41 | + access on its instances, but can only customize getting an attribute on the class. | ||
| 42 | + Retrieving a descriptor from a class calls its ``__get__`` method (if defined), but | ||
| 43 | + replacing or deleting it does not call its ``__set__`` or ``__delete__`` methods. | ||
| 44 | + | ||
| 45 | + Adding a metaclass is a potentially breaking change. This is because derived classes | ||
| 46 | + that use an unrelated metaclass, whether directly or by inheriting from a class such as | ||
| 47 | + abc.ABC that uses one, will raise TypeError when defined. These would have to be | ||
| 48 | + modified to use a newly introduced metaclass that is a lower bound of both. Subclasses | ||
| 49 | + remain unbroken in the far more typical case that they use no custom metaclass. | ||
| 50 | + | ||
| 51 | + The tests in this module do not establish whether the danger of setting Git.USE_SHELL to | ||
| 52 | + True is high enough, and applications of deriving from Git and using an unrelated custom | ||
| 53 | + metaclass marginal enough, to justify introducing a metaclass to issue the warnings. | ||
| 31 | 54 | """ | |
| 32 | 55 | ||
| 33 | 56 | import contextlib | |
| Back | FazBrowse Home | New Git URL |
0 commit comments