mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
Finish bringing SVN into line with latest version of PEP 343 by getting rid of all remaining references to context objects that I could find. Without a __context__() method context objects no longer exist. Also get test_with working again, and adopt a suggestion from Neal for decimal.Context.get_manager()
This commit is contained in:
parent
1b06a1d4e3
commit
afd5e63e24
8 changed files with 101 additions and 120 deletions
|
@ -2173,7 +2173,7 @@ for name in rounding_functions:
|
|||
|
||||
del name, val, globalname, rounding_functions
|
||||
|
||||
class WithStatementContext(object):
|
||||
class ContextManager(object):
|
||||
"""Helper class to simplify Context management.
|
||||
|
||||
Sample usage:
|
||||
|
@ -2248,8 +2248,8 @@ class Context(object):
|
|||
s.append('traps=[' + ', '.join([t.__name__ for t, v in self.traps.items() if v]) + ']')
|
||||
return ', '.join(s) + ')'
|
||||
|
||||
def context_manager(self):
|
||||
return WithStatementContext(self.copy())
|
||||
def get_manager(self):
|
||||
return ContextManager(self.copy())
|
||||
|
||||
def clear_flags(self):
|
||||
"""Reset all flags to zero"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue