summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
Commit message (Collapse)AuthorAgeFilesLines
* inspect: Fix BoundArguments.apply_defaults to handle empty argumentsYury Selivanov2016-03-021-0/+7
| | | | Patch by Frederick Wagner (issue #26347)
* Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties.Serhiy Storchaka2015-10-291-2/+2
| | | | Original patch by John Mark Vandenberg.
* Issue #24485: Function source inspection fails on closures.Meador Inge2015-07-241-1/+0
| | | | | | | | | | | | The fix for Issue #21217 introduced a regression that caused `inspect.getsource` to return incorrect results on nested functions. The root cause of the regression was due to switching the implementation to analyze the underlying bytecode instead of the source code. This commit switches things back to analyzing the source code in a more complete way. The original bug and the regression are both fixed by the new source code analysis.
* Issue #24485: Revert backwards compatibility breaking changes of #21217.Yury Selivanov2015-07-231-0/+5
|
* Issue #24669: Fix inspect.getsource() for 'async def' functions.Yury Selivanov2015-07-211-0/+2
| | | | Patch by Kai Groner.
* Issue #24206: Fixed __eq__ and __ne__ methods of inspect classes.Serhiy Storchaka2015-07-181-23/+55
|\
| * Issue #24206: Fixed __eq__ and __ne__ methods of inspect classes.Serhiy Storchaka2015-07-181-22/+54
| |
* | Issue #24400: Resurrect inspect.isawaitable()Yury Selivanov2015-07-031-0/+23
| | | | | | | | | | | | | | | | collections.abc.Awaitable and collections.abc.Coroutine no longer use __instancecheck__ hook to detect generator-based coroutines. inspect.isawaitable() can be used to detect generator-based coroutines and to distinguish them from regular generator objects.
* | Issue #24541: Drop test_inspect.test_eightteen unittest; update docsYury Selivanov2015-07-011-8/+0
| | | | | | | | Suggested by Martin Panter.
* | Issue #24541: Update comment in test_inspect.test_eightteenYury Selivanov2015-07-011-1/+1
| |
* | Issue #24400: Fix failing unittestYury Selivanov2015-07-011-1/+1
| |
* | Issue #24400: Remove inspect.isawaitable().Yury Selivanov2015-06-301-25/+0
| | | | | | | | | | | | isawaitable() was added before collections.abc.Awaitable; now, with Awaitable, it is no longer needed (we don't have ishashable() or isiterable() methods in the inspect module either).
* | Issue #24400: Introduce a distinct type for 'async def' coroutines.Yury Selivanov2015-06-221-3/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #23934: Fix inspect.signature to fail correctly for builtin types.Yury Selivanov2015-05-301-1/+6
| | | | | | | | Initial patch by James Powell.
* | Issue 24298: Fix signature() to properly unwrap wrappers around bound methodsYury Selivanov2015-05-281-0/+13
|\ \ | |/
| * Issue 24298: Fix signature() to properly unwrap wrappers around bound methodsYury Selivanov2015-05-281-0/+13
| |
* | Issue 20438: Deprecate inspect.getargspec() and friends.Yury Selivanov2015-05-221-1/+2
| |
* | Issue 23898: Fix inspect.classify_class_attrs() to work with __eq__Yury Selivanov2015-05-211-0/+15
|\ \ | |/ | | | | Patch by Mike Bayer.
| * Issue 23898: Fix inspect.classify_class_attrs() to work with __eq__Yury Selivanov2015-05-211-0/+15
| |
* | Issue 24248: Deprecate inspect.Signature.from_function and .from_builtinYury Selivanov2015-05-211-12/+2
| |
* | Issue 20691: Add follow_wrapped arg to inspect.signature/from_callable.Yury Selivanov2015-05-201-2/+14
| |
* | Issue 24205: Improve inspect.Signature.bind() error messages.Yury Selivanov2015-05-191-11/+19
| |
* | Issue 24190: Add inspect.BoundArguments.apply_defaults() method.Yury Selivanov2015-05-161-0/+35
| |
* | Issue 24208: Fix tests -- don't create a tempdir in __init__.Yury Selivanov2015-05-161-5/+3
| |
* | Issue 24200: Fix broken unittest.Yury Selivanov2015-05-151-1/+1
| |
* | inspect: Remove "0x..." IDs from Signature objects' __repr__Yury Selivanov2015-05-151-2/+1
| | | | | | | | Issue 24200.
* | Issue 22547: Implement informative __repr__ for inspect.BoundArgumentsYury Selivanov2015-05-141-0/+7
| |
* | inspect: Test that BoundArguments.__eq__ repects the order of paramsYury Selivanov2015-05-141-0/+6
| |
* | PEP 0492 -- Coroutines with async and await syntax. Issue #24017.Yury Selivanov2015-05-121-4/+68
| |
* | Issue #9517: Move script_helper to the support package.Berker Peksag2015-05-061-1/+1
| | | | | | | | Patch by Christie Wilson.
* | Issue #21217: inspect.getsourcelines() now tries to compute the start andAntoine Pitrou2015-04-141-1/+10
| | | | | | | | | | end lines from the code object, fixing an issue when a lambda function is used as decorator argument. Patch by Thomas Ballinger.
* | Issue #20586: Argument Clinic now ensures signatures on functions without ↵Zachary Ware2015-04-131-0/+3
| | | | | | | | docstrings.
* | Actually run the builtins Argument Clinic testNick Coghlan2015-04-131-53/+58
| |
* | Issue #15582: inspect.getdoc() now follows inheritance chains.Serhiy Storchaka2015-04-031-1/+22
| |
* | Issue #23641: Cleaned out legacy dunder names from tests and docs.Serhiy Storchaka2015-03-121-1/+1
|\ \ | |/ | | | | | | Fixed 2 to 3 porting bug in pynche.ColorDB. Added few tests for __truediv__, __floordiv__ and __matmul__.
| * Issue #23641: Cleaned out legacy dunder names from tests and docs.Serhiy Storchaka2015-03-121-1/+1
| | | | | | | | Fixed 2 to 3 porting bug in pynche.ColorDB.
| * inspect: Fix getsource() to load updated source of reloaded moduleYury Selivanov2014-12-081-1/+32
| | | | | | | | Issue #1218234. Initial patch by Berker Peksag.
* | inspect: Fix getsource() to load updated source of reloaded moduleYury Selivanov2014-12-081-1/+32
| | | | | | | | Issue #1218234. Initial patch by Berker Peksag.
* | Merge: #12780: update inspect test skipIf for PEP 3147.R David Murray2014-10-031-4/+5
|\ \ | |/
| * #12780: update inspect test skipIf for PEP 3147.R David Murray2014-10-031-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | The test needs to be skipped if unicodedata is either part of the main binary (a repackaging of cpython on Windows?) or has python source (pypy?). PEP 3147 makes __file__ point to the .py source, so we need to change the extension check from looking for the old .pyc/.pyo to just looking for .py. Note that this skip should never trigger on CPython itself, so one could argue it should be dropped instead. But since it exists, why risk breaking someone else's python.
| * inspect: Validate that __signature__ is None or an instance of Signature.Yury Selivanov2014-06-231-0/+7
| | | | | | | | Closes #21801.
| * inspect.signautre: Fix functools.partial support. Issue #21117Yury Selivanov2014-04-081-20/+79
| |
| * inspect: Fix getcallargs() to fail correctly if more than 3 args are missing.Yury Selivanov2014-03-271-0/+6
| | | | | | | | Patch by Jeremiah Lowin. Closes #20817.
| * inspect: Fix getcallargs() to raise correct TypeErrorYury Selivanov2014-03-271-0/+8
| | | | | | | | | | ... for missing keyword-only arguments. Patch by Jeremiah Lowin. Closes #20816.
| * Issue #20786: Fix signatures for dict.__delitem__ and property.__delete__Yury Selivanov2014-03-021-0/+5
| |
| * inspect.signature: Check for function-like objects before builtins. Issue #17159Yury Selivanov2014-02-211-0/+16
| |
| * inspect: Fix getfullargspec to support builtin module-level functions. Issue ↵Yury Selivanov2014-02-211-0/+7
| | | | | | | | #20711
| * inspect: Fix getfullargspec() to not to follow __wrapped__ chainsYury Selivanov2014-02-191-0/+40
| | | | | | | | Initial patch by Nick Coghlan.
| * Mangle __parameters in __annotations__ dict properly. Issue #20625.Yury Selivanov2014-02-181-0/+16
| |
* | inspect: Fix getsource() to support decorated functions.Yury Selivanov2014-09-261-0/+3
| | | | | | | | Issue #1764286. Patch by Claudiu Popa.