|
11 | 11 | Because USE_SHELL has no instance state, this module does not include tests of pickling
|
12 | 12 | and multiprocessing:
|
13 | 13 |
|
14 |
| -- Just as with a simple class attribute, when a class attribute with custom logic is |
15 |
| -later settoa newvalue,it may have either its initial value orthenew value when |
16 |
| -accessed from a worker process, depending on the process start method. With "fork", |
17 |
| - changes are preserved. With "spawn" or "forkserver", re-importing the modules causes |
18 |
| - initial values to be set. Then the value in the parent at the time it dispatches the |
19 |
| - task is only set in the children if the parent has the task set it, or if it is set as |
20 |
| - a side effect of importing needed modules, or of unpickling objects passed to the |
21 |
| - child (for example, if it is set in a top-level statement of the module that defines |
22 |
| - the function submitted for the child worker process to call). |
| 14 | +- Just as with a simple class attribute, when a class attribute with custom logic is set |
| 15 | + toanothervalue,even before a worker process is created that usestheclass, the |
| 16 | +worker process may see either the initial or new value, depending on the process start |
| 17 | +method. With "fork",changes are preserved. With "spawn" or "forkserver", re-importing |
| 18 | +the modules causesinitial values to be set. Then the value in the parent at the time |
| 19 | +it dispatches thetask is only set in the children if the parent has the task set it, |
| 20 | +or if it is set asa side effect of importing needed modules, or of unpickling objects |
| 21 | +passed to thechild (for example, if it is set in a top-level statement of the module |
| 22 | +that definesthe function submitted for the child worker process to call). |
23 | 23 |
|
24 | 24 | - When an attribute gains new logic provided by a property or custom descriptor, and the
|
25 | 25 | attribute involves instance-level state, incomplete or corrupted pickling can break
|
26 |
| - multiprocessing. (For example,if an instance attribute is reimplemented using a |
| 26 | + multiprocessing. (For example,when an instance attribute is reimplemented using a |
27 | 27 | descriptor that stores data in a global WeakKeyDictionary, pickled instances should be
|
28 | 28 | tested to ensure they are still working correctly.) But nothing like that applies
|
29 | 29 | here, because instance state is not involved. Although the situation is inherently
|
|
35 | 35 | A note on metaclass conflicts
|
36 | 36 | =============================
|
37 | 37 |
|
38 |
| -The most important DeprecationWarning is forthecode ``Git.USE_SHELL = True``, which is |
39 |
| -a security risk. But this warning may not be possible to implement without a custom |
| 38 | +The most important DeprecationWarning is for codelike``Git.USE_SHELL = True``, which |
| 39 | +isa security risk. But this warning may not be possible to implement without a custom |
40 | 40 | metaclass. This is because a descriptor in a class can customize all forms of attribute
|
41 | 41 | access on its instances, but can only customize getting an attribute on the class.
|
42 | 42 | Retrieving a descriptor from a class calls its ``__get__`` method (if defined), but
|
|