displayhook should accept any object, not just integers.
displayhook and excepthook may be assigned to, so they should be
Callable values rather than function definitions. That way it's fine
to assign a function with different argument names. Their dunder
variants are supposed to be constant.
While it may eventually be useful to mark the exceptions that can be
raised from a function or method, the semantics are currently undefined
and unclear.
* Add ExcInfo and OptExcInfo type aliases
* Implement StartResponse using a protocol
* Mark stub-only types with an underscore
* Remove wrong TODO note
python/mypy#1178 is about variable-length tuples, while exc_info()
always returns a tuple with length 3. Ideally, exc_info() would
return Union[Tuple[Type[_E], _E, TracebackType], Tuple[None, None, None]],
but that is a different issue.
* Add __getattr__ to ModuleType.
Modules can contain anything, so give them a generic "__getattr__(name) -> Any".
This makes code like the following type-check, in pytype:
sys.modules.get("random").randint
* undo Python 3 change
* Revert "undo Python 3 change"
This reverts commit 96cf2d529e374a754f1ba681f0fc81aab25f81ef.
* Revert "Add __getattr__ to ModuleType."
This reverts commit 3ac1cf8a3b25dabfe386fbf34aef680fb1acd112.
* In stdlib/2/, make sys.modules a Dict[str, Any].
(Instead of Dict[str, ModuleType])
Same as stdlib/3/.