summaryrefslogtreecommitdiffstats
path: root/Doc/library/inspect.rst
Commit message (Collapse)AuthorAgeFilesLines
* Issue #24400: Introduce a distinct type for 'async def' coroutines.Yury Selivanov2015-06-221-19/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of changes: 1. Coroutines now have a distinct, separate from generators type at the C level: PyGen_Type, and a new typedef PyCoroObject. PyCoroObject shares the initial segment of struct layout with PyGenObject, making it possible to reuse existing generators machinery. The new type is exposed as 'types.CoroutineType'. As a consequence of having a new type, CO_GENERATOR flag is no longer applied to coroutines. 2. Having a separate type for coroutines made it possible to add an __await__ method to the type. Although it is not used by the interpreter (see details on that below), it makes coroutines naturally (without using __instancecheck__) conform to collections.abc.Coroutine and collections.abc.Awaitable ABCs. [The __instancecheck__ is still used for generator-based coroutines, as we don't want to add __await__ for generators.] 3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to allow passing native coroutines to the YIELD_FROM opcode. Before this change, 'yield from o' expression was compiled to: (o) GET_ITER LOAD_CONST YIELD_FROM Now, we use GET_YIELD_FROM_ITER instead of GET_ITER. The reason for adding a new opcode is that GET_ITER is used in some contexts (such as 'for .. in' loops) where passing a coroutine object is invalid. 4. Add two new introspection functions to the inspec module: getcoroutinestate(c) and getcoroutinelocals(c). 5. inspect.iscoroutine(o) is updated to test if 'o' is a native coroutine object. Before this commit it used abc.Coroutine, and it was requested to update inspect.isgenerator(o) to use abc.Generator; it was decided, however, that inspect functions should really be tailored for checking for native types. 6. sys.set_coroutine_wrapper(w) API is updated to work with only native coroutines. Since types.coroutine decorator supports any type of callables now, it would be confusing that it does not work for all types of coroutines. 7. Exceptions logic in generators C implementation was updated to raise clearer messages for coroutines: Before: TypeError("generator raised StopIteration") After: TypeError("coroutine raised StopIteration")
* Issue 22357: Merge from 3.4Yury Selivanov2015-05-301-0/+11
|\
| * Issue 22357: Document __qualname__ in inspect.rstYury Selivanov2015-05-301-0/+11
| |
* | Issue 20438: Add a note about deprecating old inspect APIs to whatsnew.Yury Selivanov2015-05-221-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, deprecate formatargspec, formatargvalues, and getargvalues functions. Since we are deprecating 'getfullargspec' function in 3.5 (documentation only, no DeprecationWarning), it makes sense to also deprecate functions designed to be directly used with it. In 3.6 we will remove 'getargsspec' function (was deprecated since Python 3.0), and start raising DeprecationWarnings in other 'getarg*' family of functions. We can remove them in 3.7 or later. Also, it is worth noting, that Signature API does not provide 100% of functionality that deprecated APIs have. It is important to do a soft deprecation of outdated APIs in 3.5 to gather users feedback, and improve Signature object.
* | Issue 20438: Deprecate inspect.getargspec() and friends.Yury Selivanov2015-05-221-6/+7
| |
* | Issue 24180: Fixes by Berker Peksag.Yury Selivanov2015-05-211-7/+5
| |
* | Issue 24180: Documentation for PEP 492 changes.Yury Selivanov2015-05-211-0/+41
| |
* | Issue 20691: Add follow_wrapped arg to inspect.signature/from_callable.Yury Selivanov2015-05-201-4/+10
| |
* | Add versionadded directive for BoundArguments.apply_defaults().Berker Peksag2015-05-161-0/+2
| |
* | Issue 24190: Add inspect.BoundArguments.apply_defaults() method.Yury Selivanov2015-05-161-21/+20
| |
* | Issue 24191: Document BoundArguments.signatureYury Selivanov2015-05-141-0/+4
|\ \ | |/
| * Issue 24191: Document BoundArguments.signatureYury Selivanov2015-05-141-0/+4
| |
| * docs.inspect: Fix BoundArguments example. Issue #22998.Yury Selivanov2014-12-051-1/+2
| |
* | Issue #15582: inspect.getdoc() now follows inheritance chains.Serhiy Storchaka2015-04-031-0/+3
| |
* | docs.inspect: Fix BoundArguments example. Issue #22998.Yury Selivanov2014-12-051-1/+2
| |
* | merge with 3.4Georg Brandl2014-10-311-10/+13
|\ \ | |/
| * #22613: minor other fixes in library docs (thanks Jacques Ducasse)Georg Brandl2014-10-311-10/+13
| |
| * Merge in all documentation changes since branching 3.4.0rc1.Larry Hastings2014-03-161-0/+5
| |
* | Issue #16808: inspect.stack() now returns a named tuple instead of a tuple.Antoine Pitrou2014-08-241-2/+8
| | | | | | | | Patch by Daniel Shahaf.
* | Issue #21205: Complete the "versionchanged" note in inspect documentationVictor Stinner2014-06-161-1/+3
| |
* | Issue #21205: Add a new ``__qualname__`` attribute to generator, the qualifiedVictor Stinner2014-06-161-0/+14
| | | | | | | | | | | | | | name, and use it in the representation of a generator (``repr(gen)``). The default name of the generator (``__name__`` attribute) is now get from the function instead of the code. Use ``gen.gi_code.co_name`` to get the name of the code.
* | inspect: Make Signature and Parameter hashable. Issue #20334.Yury Selivanov2014-04-081-2/+2
| |
* | inspect.docs: Document that Signature and Parameter are now picklable (issue ↵Yury Selivanov2014-03-291-0/+6
| | | | | | | | #20726)
* | inspect.docs: Fix indentation and version-added for Signature.from_callableYury Selivanov2014-03-291-1/+3
| |
* | inspect.Signature: Add 'Signature.from_callable' classmethod. Closes #17373Yury Selivanov2014-03-271-0/+12
| |
* | Improve descriptions of introspection changesNick Coghlan2014-03-081-0/+5
|/ | | | | | | | | Several of the introspection changes in Python 3.4 are indirect, where inspect module changes affected pydoc, and those in turn affected the help builtin. This update adds versionchanged notes in the key locations, as well as more coverage in the What's New document (in particular, a note in the porting section regarding the expanded domain for inspect.getfullargspec).
* inspect.doc: Soften the note about inspect.signature not supportingYury Selivanov2014-01-301-2/+2
| | | | all builtin functions.
* inspect.docs: Document constructors for Signature & Parameter #20442Yury Selivanov2014-01-301-2/+11
|
* inspect.signature: Use '/' to separate positional-only parameters fromYury Selivanov2014-01-271-3/+6
| | | | the rest in Signature.__str__. #20356
* doc/inspect: Clarify docs for __defaults__, add docs for __kwdefaults__ #20380Yury Selivanov2014-01-271-1/+6
|
* Issue #20189: Four additional builtin types (PyTypeObject,Larry Hastings2014-01-241-0/+3
| | | | | | PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type) have been modified to provide introspection information for builtins. Also: many additional Lib, test suite, and Argument Clinic fixes.
* merge 3.3 (closes #20108)Benjamin Peterson2014-01-021-1/+1
|\
| * remove bracketsBenjamin Peterson2014-01-021-1/+1
| |
* | Assorted 3.4 What's New updatesNick Coghlan2013-10-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | - cross-references and attributions for inspect changes - note improvements to inspect and pydoc handling of metaclasses and dynamic attributes (courtesy of the enum PEP) - group all CPython implementation specific changes into a common section - add see also links for most of the PEPs - fix the see also link for the release PEP - add suitable caveats on Argument Clinic inclusion - clarify the change to __wrapped__ handling
* | Close #19030: inspect.getmembers and inspect.classify_class_attrsEthan Furman2013-10-181-3/+3
| | | | | | | | | | | | | | | | | | | | Order of search is now: 1. Try getattr 2. If that throws an exception, check __dict__ directly 3. If still not found, walk the mro looking for the eldest class that has the attribute (e.g. things returned by __getattr__) 4. If none of that works (e.g. due to a buggy __dir__, __getattr__, etc. method or missing __slot__ attribute), ignore the attribute entirely.
* | Issue #18758: Fixed and improved cross-references.Serhiy Storchaka2013-10-131-2/+3
|\ \ | |/
| * Issue #18758: Fixed and improved cross-references.Serhiy Storchaka2013-10-131-2/+3
| |
* | Close #18626: add a basic CLI for the inspect moduleNick Coghlan2013-09-221-0/+17
| |
* | Close #18929: inspect.classify_class_attrs will now search the metaclasses ↵Ethan Furman2013-09-151-2/+3
| | | | | | | | (last) to find where an attr was defined.
* | Issue #17934: Add a clear() method to frame objects, to help clean up ↵Antoine Pitrou2013-08-051-0/+4
| | | | | | | | expensive details (local variables) and break reference cycles.
* | Close #13266: Add inspect.unwrapNick Coghlan2013-07-281-0/+17
|/ | | | Initial patch by Daniel Urban and Aaron Iles
* Closes #4159: add LaTeX tabular column specifications to tables that ↵Georg Brandl2013-03-281-0/+2
| | | | otherwise are cut off or have overlapping text.
* Issue #16243: add example for inspect.formatargspecAndrew Svetlov2012-10-261-2/+9
| | | | Patch by Berker Peksag.
* Mention that "defaults" can be None for inspect.getfullargspec.Larry Hastings2012-09-211-5/+6
| | | | Also minor formatting cleanups.
* #15831: merge with 3.2Ezio Melotti2012-09-141-2/+2
|\
* | Review of signature docs.Georg Brandl2012-08-141-65/+62
| |
* | Minor update of docs for inspect module.Andrew Svetlov2012-08-131-1/+1
| |
* | Issue #15151: PEP 362 — document signature and related classes for inspect.pyAndrew Svetlov2012-08-131-0/+268
| | | | | | | | Initial patch by Yury Selivanov
* | Fix documentation for inspect module to pass doctestAndrew Svetlov2012-08-091-5/+5
| |
* | Close #15387: inspect.getmodulename() now uses a new ↵Nick Coghlan2012-07-181-3/+12
| | | | | | | | importlib.machinery.all_suffixes() API rather than the deprecated inspect.getmoduleinfo()