summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-17735: inspect.findsource now raises OSError when co_lineno is out of ↵Miss Islington (bot)2020-12-041-0/+11
| | | | | | | | range (GH-23633) This can happen when a file was edited after it was imported. (cherry picked from commit 2e0760bb2edb595050aff82f236cd32b44d3dfb3) Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
* bpo-42116: Fix inspect.getsource handling of trailing comments (GH-23630)Miss Islington (bot)2020-12-041-4/+19
| | | | | (cherry picked from commit 6e1eec71f59c344fb23c7977061dc2c97b77d51b) Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
* bpo-38478: Correctly handle keyword argument with same name as ↵Miss Islington (bot)2019-10-151-0/+10
| | | | | | | positional-only parameter (GH-16800) (cherry picked from commit f3ef06a7cb347ab7bd3cc2b0b3dcebe4f9ff36f9) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.8] bpo-37206: Unrepresentable default values no longer represented as ↵Serhiy Storchaka2019-09-141-2/+2
| | | | | | | | | | None. (GH-13933) (GH-16141) In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all. (cherry picked from commit 279f44678c8b84a183f9eeb85e0b086228154497) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-34706: Preserve subclassing in inspect.Signature.from_callable ↵Miss Islington (bot)2019-09-131-2/+9
| | | | | | | | | | | | | (GH-16108) (GH-16113) https://bugs.python.org/issue34706 Specifically in the case of a class that does not override its constructor signature inherited from object. These are Buck Evan @bukzor's changes cherrypicked from GH-9344. (cherry picked from commit 5b9ff7a0dcb16d6f5c3cd4f1f52e0ca6a4bde586) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* bpo-37173: Show passed class in inspect.getfile error (GH-13861)Miss Islington (bot)2019-06-081-0/+18
| | | | | | | | | | | | | | | Currently, inspect.getfile(str) will report nonsense: ```pytb >>> inspect.getfile(str) TypeError: <module 'builtins' (built-in)> is a built-in class ``` This fixes that https://bugs.python.org/issue37173 (cherry picked from commit d407d2a7265f6102e51a1d62b3fd28b4f7a78d16) Co-authored-by: Philipp A <flying-sheep@web.de>
* bpo-37099: Silence DeprecationWarning in test_inspect (GH-13679)Xtreak2019-05-301-6/+9
| | | | | | Fix DeprecationWarning introduced in aee19f54f6fe45f6b3c906987941e5a8af4468e9 https://bugs.python.org/issue37099
* bpo-36785: PEP 574 implementation (GH-7076)Antoine Pitrou2019-05-261-6/+5
|
* bpo-36751: Undeprecate getfullargspec (GH-13245)Pablo Galindo2019-05-161-34/+20
|
* bpo-36542: Allow to overwrite the signature for Python functions. (GH-12705)Serhiy Storchaka2019-05-061-0/+11
|
* bpo-36751: Deprecate getfullargspec and report positional-only args as ↵Pablo Galindo2019-04-301-34/+42
| | | | | | | | regular args (GH-13016) * bpo-36751: Deprecate getfullargspec and report positional-only args as regular args * Use inspect.signature in testhelpers
* bpo-36540: PEP 570 -- Implementation (GH-12701)Pablo Galindo2019-04-291-12/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the implementation of PEP570: Python positional-only parameters. * Update Grammar/Grammar with new typedarglist and varargslist * Regenerate grammar files * Update and regenerate AST related files * Update code object * Update marshal.c * Update compiler and symtable * Regenerate importlib files * Update callable objects * Implement positional-only args logic in ceval.c * Regenerate frozen data * Update standard library to account for positional-only args * Add test file for positional-only args * Update other test files to account for positional-only args * Add News entry * Update inspect module and related tests
* bpo-33261: guard access to __code__ attribute in inspect (GH-6448)Jeroen Demeyer2019-04-021-0/+1
|
* bpo-36326: Let inspect.getdoc() find docstrings for __slots__ (GH-12498)Raymond Hettinger2019-03-251-0/+9
|
* bpo-34890: Make iscoroutinefunction, isgeneratorfunction and ↵Pablo Galindo2018-10-261-1/+26
| | | | | | | | | | | isasyncgenfunction work with functools.partial (GH-9903) inspect.isfunction() processes both inspect.isfunction(func) and inspect.isfunction(partial(func, arg)) correctly but some other functions in the inspect module (iscoroutinefunction, isgeneratorfunction and isasyncgenfunction) lack this functionality. This commits adds a new check in the mentioned functions in the inspect module so they can work correctly with arbitrarily nested partial functions.
* bpo-34871: Fix two typos in test_inspect.py (GH-9698)Chih-Hsuan Yen2018-10-041-2/+2
| | | | | | `arg` is misspelled as `agr`. I noticed this when playing with https://bugs.python.org/issue34871 https://bugs.python.org/issue34871
* bpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks ↵Vladimir Matveev2018-08-241-2/+12
| | | | (GH-8864)
* bpo-33582: Emit deprecation warning for `formatargspec` (GH-6994)Matthias Bussonnier2018-06-111-4/+6
|
* bpo-33197: Update a error message of invalid inspect.Parameters. (GH-6636)Dong-hee Na2018-05-291-3/+22
|
* bpo-26103: Fix inspect.isdatadescriptor() and a data descriptor definition. ↵Aaron Hall, MBA2018-05-201-1/+56
| | | | | | (GH-1959) Look for '__set__' or '__delete__'.
* bpo-33009: Fix inspect.signature() for single-parameter partialmethods. ↵Yury Selivanov2018-03-061-0/+10
| | | | (GH-6004)
* bpo-32697: Definition order of kwonly params is now guaranteed preserved. ↵larryhastings2018-01-281-0/+47
| | | | | | (#5391) Definition order of kwonly params is now guaranteed preserved.
* bpo-31778: Make ast.literal_eval() more strict. (#4035)Serhiy Storchaka2018-01-041-1/+1
| | | | Addition and subtraction of arbitrary numbers no longer allowed.
* bpo-32265: Classify class and static methods of builtin types. (#4776)Serhiy Storchaka2017-12-151-1/+14
| | | | Add types.ClassMethodDescriptorType for unbound class methods.
* bpo-32297: Few misspellings found in Python source code comments. (#4803)Mike2017-12-141-1/+1
| | | | | | | | * Fix multiple typos in code comments * Add spacing in comments (test_logging.py, test_math.py) * Fix spaces at the beginning of comments in test_logging.py
* bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)Dong-hee Na2017-11-151-2/+2
|
* bpo-30639: Lazily compute repr for error (#2132)Thomas Kluyver2017-10-241-0/+8
|
* PEP 553 built-in breakpoint() function (bpo-31353) (#3355)Barry Warsaw2017-10-051-1/+2
| | | Implement PEP 553, built-in breakpoint() with support from sys.breakpointhook(), along with documentation and tests. Closes bpo-31353
* bpo-31462: Remove trailing whitespaces. (#3564)Serhiy Storchaka2017-09-141-1/+1
|
* bpo-25532: Protect against infinite loops in inspect.unwrap() (#1717)Thomas Kluyver2017-05-231-0/+18
| | | | | | | | | Some objects (like test mocks) auto-generate new objects on attribute access, which can lead to an infinite loop in inspect.unwrap(). Ensuring references are retained to otherwise temporary objects and capping the size of the memo dict turns this case into a conventional exception instead.
* bpo-30149: Fix partialmethod without explicit self parameter (#1308)Dong-hee Na2017-05-171-0/+35
|
* bpo-29822: Make inspect.isabstract() work during __init_subclass__. (#678)Nate2017-04-241-0/+24
| | | | | | | At the time when an abstract base class' __init_subclass__ runs, ABCMeta.__new__ has not yet finished running, so in the presence of __init_subclass__, inspect.isabstract() can no longer depend only on TPFLAGS_IS_ABSTRACT.
* bpo-16355: Clarify when inspect.getcomments() returns None (#428)Marco Buttu2017-03-171-0/+5
| | | Initial patch by Vajrasky Kok.
* Issue #15812: Merge from 3.6Berker Peksag2017-01-021-0/+5
|\
| * Issue #15812: Merge from 3.5Berker Peksag2017-01-021-0/+5
| |\
| | * Issue #15812: inspect.getframeinfo() now correctly shows the first line of a ↵Berker Peksag2017-01-021-0/+5
| | | | | | | | | | | | | | | | | | context Patch by Sam Breese.
* | | Remove unused imports.Serhiy Storchaka2016-12-161-3/+0
|/ /
* | Issue #28003: Implement PEP 525 -- Asynchronous Generators.Yury Selivanov2016-09-091-1/+11
| |
* | Issue #19611: handle implicit parameters in inspect.signatureNick Coghlan2016-06-041-0/+26
| | | | | | | | | | | | | | | | inspect.signature now reports the implicit ``.0`` parameters generated by the compiler for comprehension and generator expression scopes as if they were positional-only parameters called ``implicit0``. Patch by Jelle Zijlstra.
* | Merge 3.5 (issue #26347)Yury Selivanov2016-03-021-0/+7
|\ \ | |/
| * inspect: Fix BoundArguments.apply_defaults to handle empty argumentsYury Selivanov2016-03-021-0/+7
| | | | | | | | Patch by Frederick Wagner (issue #26347)
* | Replace noop constant statement with expressionVictor Stinner2016-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | * Constant statements will be ignored and the compiler will emit a SyntaxWarning. * Replace constant statement (ex: "1") with an expression statement (ex: "x=1"). * test_traceback: use context manager on the file. Issue #26204.
* | subprocess._optim_args_from_interpreter_flags()Victor Stinner2016-01-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | Issue #26100: * Add subprocess._optim_args_from_interpreter_flags() * Add test.support.optim_args_from_interpreter_flags() * Use new functions in distutils, test_cmd_line_script, test_compileall and test_inspect The change enables test_details() test of test_inspect when -O or -OO command line option is used.
* | Issue #25486: Resurrect inspect.getargspec in 3.6. Backout a565aad5d6e1.Yury Selivanov2016-01-111-5/+35
| | | | | | | | | | The decision is that we shouldn't remove popular APIs (however long they are depreacted) from Python 3, while 2.7 is still around and supported.
* | Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties.Serhiy Storchaka2015-10-291-2/+2
|\ \ | |/ | | | | Original patch by John Mark Vandenberg.
| * Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties.Serhiy Storchaka2015-10-291-2/+2
| | | | | | | | Original patch by John Mark Vandenberg.
* | Issue #13248: Delete remaining references of inspect.getargspec().Berker Peksag2015-07-311-1/+1
| | | | | | | | Noticed by Yaroslav Halchenko.
* | 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: 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 #13248: Remove inspect.getargspec from 3.6 (deprecated from 3.0)Yury Selivanov2015-07-231-35/+5
|/