| 59 | |
| 60 | |
| 61 | def __getattr__(name): |
| 62 | if name == "OpenWrapper": |
| 63 | # bpo-43680: Until Python 3.9, _pyio.open was not a static method and |
| 64 | # builtins.open was set to OpenWrapper to not become a bound method |
| 65 | # when set to a class variable. _io.open is a built-in function whereas |
| 66 | # _pyio.open is a Python function. In Python 3.10, _pyio.open() is now |
| 67 | # a static method, and builtins.open() is now io.open(). |
| 68 | import warnings |
| 69 | warnings.warn('OpenWrapper is deprecated, use open instead', |
| 70 | DeprecationWarning, stacklevel=2) |
| 71 | global OpenWrapper |
| 72 | OpenWrapper = open |
| 73 | return OpenWrapper |
| 74 | raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |
| 75 | |
| 76 | |
| 77 | # Pretend this exception was created here. |