Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- The dict needs to live in the module where the deprecated attributes are; so here it needs to be hazmat.__deprecated_attributes__. (Maybe it would be less confusing to put this in hazmat.py, I don't know.) - Don't export the symbols from trio.hazmat using normal mechanisms; that overrides the __deprecated_attributes__ mechanism. - Then since they're no longer in hazmat, we can't say that trio.hazmat.Value resolves to the value trio.hazmat.Value, so point the __deprecated_attributes__ entries directly at trio._core._result.* - In fact, let's stop exporting them from trio._core entirely. - And then this reveals two tests that were still referring to trio._core.Error, so fix those. Confirmed manually that with these changes I get correct values and warnings for accessing the public attributes: In [2]: trio.hazmat.Result /home/njs/.user-python3.5-64bit/bin/ipython:1: TrioDeprecationWarning: trio.hazmat.Result is deprecated since Trio 0.5.0; use outcome.Outcome instead (#494) #!/home/njs/.user-python3.5-64bit/bin/python3.5 Out[2]: trio._core._result.Result # class In [3]: trio.hazmat.Value /home/njs/.user-python3.5-64bit/bin/ipython:1: TrioDeprecationWarning: trio.hazmat.Value is deprecated since Trio 0.5.0; use outcome.Value instead (#494) #!/home/njs/.user-python3.5-64bit/bin/python3.5 Out[3]: outcome.Value # class In [4]: trio.hazmat.Error /home/njs/.user-python3.5-64bit/bin/ipython:1: TrioDeprecationWarning: trio.hazmat.Error is deprecated since Trio 0.5.0; use outcome.Error instead (#494) #!/home/njs/.user-python3.5-64bit/bin/python3.5 Out[4]: outcome.Error # class
- Loading branch information