summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. ↵Miss Islington (bot)2020-03-051-1/+1
| | | | | | | | | | | (GH-18786) `list(sys.modules.items())` was apparently not immune to "dictionary changed size during iteration" errors. Tested internally using an integration test that has run into this a couple of times in the past two years. With this patch applied, the test is no longer flaky. (cherry picked from commit 85cf1d514b84dc9a4bcb40e20a12e1d82ff19f20) Co-authored-by: Gregory P. Smith <gps@google.com>
* bpo-34706: Preserve subclassing in inspect.Signature.from_callable ↵Miss Islington (bot)2019-09-131-1/+1
| | | | | | | | | | | | | (GH-16108) (GH-16114) 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-38059: Using sys.exit() over exit() in inspect.py (GH-15666)Miss Islington (bot)2019-09-091-2/+2
| | | | | | Constants added by the site module like exit() "should not be used in programs" (cherry picked from commit e3c59a75279b0df4e7553d6f0031e202de434e43) Co-authored-by: Alan Yee <alanyee@users.noreply.github.com>
* bpo-37173: Show passed class in inspect.getfile error (GH-13861)Miss Islington (bot)2019-06-081-3/+3
| | | | | | | | | | | | | | | 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-33594: Add deprecation info in inspect.py module (GH-7036)Miss Islington (bot)2018-10-201-7/+15
| | | | | (cherry picked from commit ded87d804e2a85b2a3ea9e7a11384b41fafdfa29) Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
* bpo-34871: inspect: Don't pollute sys.modules (GH-9696) (#9701)Miss Islington (bot)2018-10-041-1/+1
| | | | | | https://bugs.python.org/issue34871 (cherry picked from commit 6f85b826b527e240551613aeec3118a5469e3a33) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* bpo-6700: Fix inspect.getsourcelines for module level frames/tracebacks ↵Miss Islington (bot)2018-08-241-1/+6
| | | | | | | (GH-8864) (cherry picked from commit 91cb298f811961277fd4cc4a32211899d48bedcb) Co-authored-by: Vladimir Matveev <v2matveev@outlook.com>
* bpo-33582: Remove duplicate space in inspect.formatargspec() deprecation ↵Miss Islington (bot)2018-06-121-1/+1
| | | | | | | warning (GH-7655) (GH-7657) (cherry picked from commit 41254ebd5e4f40a2e095d8aaea60bf3973de4647) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-33582: Emit deprecation warning for `formatargspec` (GH-6994)Miss Islington (bot)2018-06-111-2/+14
| | | | | (cherry picked from commit 46c5cd0f6e22bdfbdd3f0b18f1d01eda754e7e11) Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
* bpo-33197: Update a error message of invalid inspect.Parameters. (GH-6636) ↵Miss Islington (bot)2018-05-291-16/+31
| | | | | | | (GH-7204) (cherry picked from commit a9cab433bbf02f3a1de59d14dc8f583181ffe2d5) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* bpo-33009: Fix inspect.signature() for single-parameter partialmethods. ↵Miss Islington (bot)2018-03-061-1/+2
| | | | | | | (GH-6004) (cherry picked from commit 8a387219bdfb6ee34928d6168ac42ca559f11c9a) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-32991: Restore expectation that inspect.getfile raises TypeError on ↵Miss Islington (bot)2018-03-061-2/+2
| | | | | | | | | | | | namespace package (GH-5980) (GH-5997) * bpo-32991: Add test capturing expectation. DocTestFinder.find should return an empty list for doctests in a namespace package. * bpo-32991: Restore expectation that inspect.getfile on a namespace package raises TypeError. (cherry picked from commit b9650a04a81355c8a7dcd0464c28febfb4bfc0a9) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-32678: inspect: Import ast lazily (GH-5344)INADA Naoki2018-01-271-1/+3
|
* bpo-32265: Classify class and static methods of builtin types. (#4776)Serhiy Storchaka2017-12-151-2/+2
| | | | Add types.ClassMethodDescriptorType for unbound class methods.
* bpo-32157: Removed explicit quotes around %r and {!r}. (#4582)Serhiy Storchaka2017-11-281-2/+2
|
* bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)Dong-hee Na2017-11-151-2/+5
|
* bpo-30639: Lazily compute repr for error (#2132)Thomas Kluyver2017-10-241-2/+3
|
* bpo-25532: Protect against infinite loops in inspect.unwrap() (#1717)Thomas Kluyver2017-05-231-3/+6
| | | | | | | | | 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-30296 Remove unnecessary tuples, lists, sets, and dicts (#1489)Jon Dufresne2017-05-181-1/+1
| | | | | | | | * Replaced list(<generator expression>) with list comprehension * Replaced dict(<generator expression>) with dict comprehension * Replaced set(<list literal>) with set literal * Replaced builtin func(<list comprehension>) with func(<generator expression>) when supported (e.g. any(), all(), tuple(), min(), & max())
* bpo-30149: Fix partialmethod without explicit self parameter (#1308)Dong-hee Na2017-05-171-4/+9
|
* bpo-29822: Make inspect.isabstract() work during __init_subclass__. (#678)Nate2017-04-241-1/+22
| | | | | | | 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-26985: Add missing info of code object in inspect documentation (GH-1090)Xiang Zhang2017-04-131-12/+18
|
* Issue #15812: Merge from 3.5Berker Peksag2017-01-031-1/+0
|\
| * Issue #15812: Delete redundant max(start, 0)Berker Peksag2017-01-031-1/+0
| | | | | | | | Noticed by Serhiy Storchaka.
* | Issue #15812: Merge from 3.5Berker Peksag2017-01-021-1/+1
|\ \ | |/
| * Issue #15812: inspect.getframeinfo() now correctly shows the first line of a ↵Berker Peksag2017-01-021-1/+1
| | | | | | | | | | | | context Patch by Sam Breese.
* | Issue #27172: Undeprecate inspect.getfullargspec()Nick Coghlan2016-12-021-17/+25
| | | | | | | | | | | | This is still useful for single source Python 2/3 code migrating away from inspect.getargspec(), but that wasn't clear with the documented deprecation in place.
* | Merge 3.5 (issue #28639)Yury Selivanov2016-11-091-2/+2
|\ \ | |/
| * Issue #28639: Fix inspect.isawaitable to always return boolYury Selivanov2016-11-091-2/+2
| | | | | | | | Patch by Justin Mayfield.
* | docs/inspect: clarify iscoroutinefunction; add docs for isasyncgen*Yury Selivanov2016-11-081-2/+7
| |
* | Issue #27989: Tweak inspect.formatannotation() to improve pydoc rendering of ↵Guido van Rossum2016-10-221-0/+2
|\ \ | |/ | | | | function annotations. Ivan L. (3.5->3.6)
| * Issue #27989: Tweak inspect.formatannotation() to improve pydoc rendering of ↵Guido van Rossum2016-10-221-0/+2
| | | | | | | | function annotations. Ivan L.
* | Issue #28003: Implement PEP 525 -- Asynchronous Generators.Yury Selivanov2016-09-091-0/+7
| |
* | Issue #27993: Merge plural fixes from 3.5Martin Panter2016-09-071-3/+2
|\ \ | |/
| * Issue #27993: Fix problems with plural objects in docs and commentsMartin Panter2016-09-071-3/+2
| |
* | Issue #19611: handle implicit parameters in inspect.signatureNick Coghlan2016-06-041-0/+14
| | | | | | | | | | | | | | | | 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-2/+0
|\ \ | |/
| * inspect: Fix BoundArguments.apply_defaults to handle empty argumentsYury Selivanov2016-03-021-2/+0
| | | | | | | | Patch by Frederick Wagner (issue #26347)
* | Issue #25486: Resurrect inspect.getargspec in 3.6. Backout a565aad5d6e1.Yury Selivanov2016-01-111-0/+25
| | | | | | | | | | 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-6/+7
|\ \ | |/ | | | | Original patch by John Mark Vandenberg.
| * Issue #25503: Fixed inspect.getdoc() for inherited docstrings of properties.Serhiy Storchaka2015-10-291-6/+7
| | | | | | | | Original patch by John Mark Vandenberg.
* | Issue #13248: Delete remaining references of inspect.getargspec().Berker Peksag2015-07-311-5/+2
| | | | | | | | Noticed by Yaroslav Halchenko.
* | Issue #24485: Function source inspection fails on closures.Meador Inge2015-07-241-4/+22
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | 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-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | 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.getmoduleinfo() from 3.6 (deprecated in 3.3)Yury Selivanov2015-07-231-17/+0
| |
* | Issue #13248: Remove inspect.getargspec from 3.6 (deprecated from 3.0)Yury Selivanov2015-07-231-25/+0
|/
* Issue #24485: Revert backwards compatibility breaking changes of #21217.Yury Selivanov2015-07-231-18/+2
|
* Issue #24669: Fix inspect.getsource() for 'async def' functions.Yury Selivanov2015-07-211-1/+1
| | | | Patch by Kai Groner.
* Issue #24206: Fixed __eq__ and __ne__ methods of inspect classes.Serhiy Storchaka2015-07-181-22/+19
|\
| * Issue #24206: Fixed __eq__ and __ne__ methods of inspect classes.Serhiy Storchaka2015-07-181-16/+10
| |