Commit Graph

34 Commits

Author SHA1 Message Date
Shantanu a997d527fa sys: update for py39 (#4018) 2020-05-16 16:52:56 -07:00
Shantanu 5a2f4c8cde sys: various fixes (#3762)
* sys: simplify _getframe

* sys: mark positional-only args

* sys: fix platform availability

* sys: remove settscdump

This function is no longer documented in 3.6 and above (and doesn't
exist on master, was removed in 4fd64b9a6aba9e6e1a5d).
In 3.5 documentation it's mentioned that it's only available if Python
was compiled with a special flag:
https://docs.python.org/3.5/library/sys.html#sys.settscdump

* sys: update whitelists
2020-02-21 20:58:42 -08:00
Jan Verbeek 95cafc0b7c sys: Correct types of sys.displayhook, sys.excepthook and variants (#3673)
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.
2020-01-29 11:25:35 +01:00
Sebastian Rittau 107eaeb3d2 Add sys.addaudithook() and audit() (#3455) 2019-11-11 13:22:28 -08:00
Ran Benita e55dad5dd0 sys: add pycache_prefix (#3454)
New in Python 3.8:
https://docs.python.org/3.8/library/sys.html#sys.pycache_prefix
2019-11-10 23:09:45 +01:00
秋葉 ce8d1da5ce Add sys._debugmallocstats (#3401) 2019-10-23 14:31:43 +02:00
Sebastian Rittau 0501e2b329 Annotations for remaining Python 3.8 additions (#3358)
* Add os.add_dll_directory()
* Add memfd_create() and flags
* Add type annotation to flags
* Add stat_result.st_reparse_tag and flags
* Add ncurses_version
* Add Path.link_to()
* Add Picker.reducer_override()
* Add plistlib.UID
* Add has_dualstack_ipv6() and create_server()
* Add shlex.join()
* Add SSL methods and fields
* Add Python 3.8 statistics functions and classes
* Remove obsolete sys.subversion
* Add sys.unraisablehook
* Add threading.excepthook
* Add get_native_id() and Thread.native_id
* Add Python 3.8 tkinter methods
* Add CLOCK_UPTIME_RAW
* Add SupportsIndex
* Add typing.get_origin() and get_args()
* Add unicodedata.is_normalized
* Add unittest.mock.AsyncMock

Currently this is just an alias for Any like Mock and MagicMock. All of
these classes should probably be sub-classing Any and add their own
methods. See also #3224.

* Add unittest cleanup methods
* Add IsolatedAsyncioTestCase
* Add ElementTree.canonicalize() and C14NWriterTarget
* cProfile.Profile can be used as a context manager
* Add asyncio task name handling
* mmap.flush() now always returns None
* Add posonlyargcount to CodeType
2019-10-14 09:53:48 +02:00
Sebastian Rittau de26a3d109 Remove raise statements from function bodies (#3355)
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.
2019-10-13 21:51:43 +02:00
Rebecca Chen 03b38d4d2e Add sys.flags.utf8_mode. (#3205)
This is new in Python 3.7:
https://docs.python.org/3/library/sys.html#sys.flags
2019-08-23 12:06:21 -07:00
Sebastian Rittau 9ccf9356bf Remove Python 3.4 support (#3147)
Closes #3123
2019-07-27 10:58:21 +02:00
Ran Benita 4ae4714e00 sys: refine the return type of sys.exc_info() (#3111) 2019-07-11 10:43:37 +02:00
Dominic 5b63540b4b Add sys.breakpointhook() and sys.__breakpointhook__ (#2991)
Closes #2979
2019-05-16 11:58:54 +02:00
Sebastian Rittau 25ac4d6af4 Implement StartResponse using a protocol (#2392)
* 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.
2018-08-17 08:36:00 -07:00
Josh Holland 347595bafb Make argument to sys.settrace optional (#2309) 2018-07-04 10:15:30 -07:00
Yusuke Miyazaki 1ae2ba0fbe Use sys.platform instead of comments (#2286) 2018-07-03 08:13:04 -07:00
Sebastian Rittau b05e99297c Drop Python 3.3 support from several stubs (#2266)
* Drop Python 3.3 support from importlib stubs

* Drop Python 3.3 support from html and symbol stubs
2018-06-20 16:46:11 -07:00
Andrew Svetlov 252d79981b Add a stub for sys.implementation (#2097) 2018-05-06 08:40:56 -07:00
Jelle Zijlstra 7cd2016931 add sys.base_exec_prefix and sys.base_prefix (#2047)
See https://docs.python.org/3/library/sys.html#sys.base_exec_prefix.

Required for https://github.com/python/mypy/pull/4888
2018-04-11 13:59:44 -07:00
Jelle Zijlstra 7cfbc7d17f more 3.7 features (#2015) 2018-04-06 11:09:11 -07:00
rchen152 38dc8f5a6a Switch usages of mypy_extensions.NoReturn over to typing.NoReturn. (#1942)
* Change mypy_extensions.NoReturn to typing.NoReturn everywhere.
2018-03-05 12:42:29 -08:00
Carl Meyer 9e76d44b09 Fix sys.setprofile annotation. (#1679)
`sys.setprofile(None)` is valid, and is in fact the only way to clear a profiler once set.
2017-10-23 15:26:58 -04:00
Jelle Zijlstra 4ea6c1cffb sys: clean up (#1545)
- More precise types for trace and profile functions
- Remove redundant comments
2017-08-21 13:54:55 -07:00
Mike Patek 0e7b2e1acf Add 'sys.is_finalizing' function (#898)
Fixes #856
2017-01-30 10:25:39 -08:00
David Fisher 2cb8e184cc Add NoReturn (#811)
* Add NoReturn
2017-01-04 13:38:05 -08:00
Lukasz Langa 68a49c2c2e Fixing flake8 E111, E114, E116, E203, E225, E262 errors 2016-12-20 01:39:18 -08:00
Lukasz Langa 147772950f Fixing flake8 E265 errors 2016-12-20 00:16:44 -08:00
Lukasz Langa fe0e3744cc Fixing flake8 E261 errors 2016-12-19 22:09:35 -08:00
Sebastian Meßmer 96ba62503b Use concrete type in sys.excepthook() (#547)
This is necessary, because exception formatting functions like `traceback.format_exception()` expect to get `Type[BaseException]`, but sys.excepthook only provided `type`
2016-09-14 08:03:41 -07:00
Valérian Rousset 4e55f0561f Improve traceback (#465) 2016-08-10 11:18:35 -07:00
Valérian Rousset c40a260b47 fix sys.exc_info return type (#246) 2016-06-06 08:52:40 -07:00
Valérian Rousset a32d8a9da6 add types to sys.getrefcount (#237) 2016-06-02 00:27:37 -07:00
Valérian Rousset ff94f6def0 specifiy Callable in sys.call_tracing (#230) 2016-05-30 09:32:56 -07:00
Tim Abbott a648f5eee1 Fix incorrect sys.exit() type. 2016-02-05 11:28:16 -08:00
Guido van Rossum 8c2118bace Move contents of builtins/* to stdlib/*. This simplifies finding stubs. 2016-01-12 12:53:18 -08:00