R David Murray
b55f944fa9
Merge: #12780 : update inspect test skipIf for PEP 3147.
2014-10-03 11:16:08 -04:00
R David Murray
32562d7da3
#12780 : update inspect test skipIf for PEP 3147.
...
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.
2014-10-03 11:15:38 -04:00
Yury Selivanov
081bbf6b28
inspect: Fix getsource() to support decorated functions.
...
Issue #1764286 . Patch by Claudiu Popa.
2014-09-26 17:34:54 -04:00
Yury Selivanov
08d4a4f488
inspect.Signature: Fix discrepancy between __eq__ and __hash__.
...
Issue #20334 . Thanks to Antony Lee for bug report & initial patch.
2014-09-12 15:48:02 -04:00
Antoine Pitrou
cdcafb78b2
Issue #16808 : inspect.stack() now returns a named tuple instead of a tuple.
...
Patch by Daniel Shahaf.
2014-08-24 10:50:28 -04:00
Nick Coghlan
f9e227e5a9
Issue #20184 : Add signature introspection for 30 of the builtins
...
Also adds a test to test_inspect to track progress on builtin
introspection support, to ensure it doesn't regress in the future.
2014-08-17 14:01:19 +10:00
Yury Selivanov
42407abe24
inspect: Validate that __signature__ is None or an instance of Signature.
...
Closes #21801 .
2014-06-23 10:23:50 -07:00
Yury Selivanov
c0f964fd55
inspect: Validate that __signature__ is None or an instance of Signature.
...
Closes #21801 .
2014-06-23 10:21:04 -07:00
Yury Selivanov
67ae50ee1c
inspect: Make Signature and Parameter hashable. Issue #20334 .
2014-04-08 11:46:50 -04:00
Yury Selivanov
3f73ca23cf
inspect.signautre: Fix functools.partial support. Issue #21117
2014-04-08 11:30:45 -04:00
Yury Selivanov
0fceaf45e2
inspect.signautre: Fix functools.partial support. Issue #21117
2014-04-08 11:28:02 -04:00
Yury Selivanov
dccfa13cdb
inspect: Fix getcallargs() to fail correctly if more than 3 args are missing.
...
Patch by Jeremiah Lowin. Closes #20817 .
2014-03-27 18:42:52 -04:00
Yury Selivanov
2542b66bb0
inspect: Fix getcallargs() to fail correctly if more than 3 args are missing.
...
Patch by Jeremiah Lowin. Closes #20817 .
2014-03-27 18:42:52 -04:00
Yury Selivanov
875df20e8a
inspect: Fix getcallargs() to raise correct TypeError
...
... for missing keyword-only arguments. Patch by Jeremiah Lowin.
Closes #20816 .
2014-03-27 18:23:03 -04:00
Yury Selivanov
b1d060bf8b
inspect: Fix getcallargs() to raise correct TypeError
...
... for missing keyword-only arguments. Patch by Jeremiah Lowin.
Closes #20816 .
2014-03-27 18:23:03 -04:00
Yury Selivanov
374375dd26
inspect.signature: Improve repr of Signature and Parameter. Closes #20378
2014-03-27 12:41:53 -04:00
Yury Selivanov
da39645ad3
inspect.Signature: Add 'Signature.from_callable' classmethod. Closes #17373
2014-03-27 12:09:24 -04:00
Yury Selivanov
a5d63dd7b8
inspect.signature: Make Signature and Parameter picklable. Closes #20726
2014-03-27 11:31:43 -04:00
Yury Selivanov
d930d85f12
Issue #20786 : Fix signatures for dict.__delitem__ and property.__delete__
2014-03-02 12:25:27 -05:00
Yury Selivanov
056e265491
Issue #20786 : Fix signatures for dict.__delitem__ and property.__delete__
2014-03-02 12:25:27 -05:00
Yury Selivanov
a773de040d
inspect.signature: Check for function-like objects before builtins. Issue #17159
2014-02-21 18:30:53 -05:00
Yury Selivanov
8c185ee12e
inspect: Fix getfullargspec to support builtin module-level functions. Issue #20711
2014-02-21 01:32:42 -05:00
Yury Selivanov
57d240ef64
inspect: Fix getfullargspec() to not to follow __wrapped__ chains
...
Initial patch by Nick Coghlan.
2014-02-19 16:27:23 -05:00
Yury Selivanov
34ce99f66d
Mangle __parameters in __annotations__ dict properly. Issue #20625 .
2014-02-18 12:49:41 -05:00
Yury Selivanov
8dfb4576a9
inspect.signature: Check for function-like objects before builtins. Issue #17159
2014-02-21 18:30:53 -05:00
Yury Selivanov
d224b6a796
inspect: Fix getfullargspec to support builtin module-level functions. Issue #20711
2014-02-21 01:32:42 -05:00
Yury Selivanov
ff385b89f4
inspect: Fix getfullargspec() to not to follow __wrapped__ chains
...
Initial patch by Nick Coghlan.
2014-02-19 16:27:23 -05:00
Yury Selivanov
026019f89b
Mangle __parameters in __annotations__ dict properly. Issue #20625 .
2014-02-18 12:49:41 -05:00
Larry Hastings
2623c8c23c
Issue #20530 : Argument Clinic's signature format has been revised again.
...
The new syntax is highly human readable while still preventing false
positives. The syntax also extends Python syntax to denote "self" and
positional-only parameters, allowing inspect.Signature objects to be
totally accurate for all supported builtins in Python 3.4.
2014-02-08 22:15:29 -08:00
Serhiy Storchaka
f28ba369dd
Issue #20532 : Tests which use _testcapi now are marked as CPython only.
2014-02-07 10:10:55 +02:00
Yury Selivanov
7d2bfed7a2
inspect.signature: Add (restore) support for builtin classes #20473
2014-02-03 02:46:07 -05:00
Yury Selivanov
145dff8567
inspect.tests: Fix tests to work on python built with '--without-doc-strings' #20471
2014-02-01 13:49:29 -05:00
Yury Selivanov
63da7c7b0c
inspect.signature: Support duck-types of Python functions (Cython, for instance) #17159
2014-01-31 14:48:37 -05:00
Yury Selivanov
0860a0bd3f
inspect.classify_class_attrs: Classify object.__new__ and __init__ correctly #18801
2014-01-31 14:28:44 -05:00
Yury Selivanov
0486f819c9
inspect.signature: Make sure that if a callable object has '_patialmethod'
...
attribute, that attribute is an instance of 'functools.partialmethod'.
2014-01-29 12:18:59 -05:00
Yury Selivanov
4cb939174c
inspect.test.getfullargspec: Add a unittest to ensure correct annotations
...
handling #17481
2014-01-29 11:54:12 -05:00
Yury Selivanov
d82eddcf05
inspect.getfullargspec: Use inspect.signature API behind the scenes #17481
2014-01-29 11:24:39 -05:00
Yury Selivanov
07a9e452ac
inspect.Signature: ensure that non-default params don't follow default ones #20427
2014-01-29 10:58:16 -05:00
Yury Selivanov
76c6c593ed
inspect.signature: Add support for decorated (wrapped) builtins #20425
2014-01-29 10:52:57 -05:00
Yury Selivanov
b77511da92
inspect.Signature: Make from_builtin to raise an exception if no signature can
...
be provided #20422
2014-01-29 10:46:14 -05:00
Yury Selivanov
38b0d5a778
inspect.Signature.bind: Fix pos-only params with defaults; fix *args in named args #19140
...
Initial patch by Yann Kaiser (epsy).
2014-01-28 17:27:39 -05:00
Yury Selivanov
62560fb19a
inspect.signature: Handle bound methods with '(*args)' signature correctly #20401
2014-01-28 12:26:24 -05:00
Yury Selivanov
d65bc70db0
inspect.tests: Remove redundant unittest
...
The removed unittest duplicates the other one (test_signature_on_builtins_no_signature)
2014-01-28 12:19:52 -05:00
Yury Selivanov
e7dcc5e97a
inspect.signature: Support classes without user-defined __init__/__new__ #20308
2014-01-27 19:29:45 -05:00
Yury Selivanov
da5fe4f2da
inspect.signature: Add support for 'functools.partialmethod' #20223
2014-01-27 17:28:37 -05:00
Yury Selivanov
2393dca472
inspect.signature: Use '/' to separate positional-only parameters from
...
the rest in Signature.__str__. #20356
2014-01-27 15:07:58 -05:00
Yury Selivanov
2eed8b7da0
inspect.getfile: Don't crash on classes without '__module__' attribute #20372
...
Some classes defined in C may not have the '__module__' attribute, so
we now handle this case to avoid having unexepected AttributeError.
2014-01-27 13:24:56 -05:00
Larry Hastings
5c66189e88
Issue #20189 : Four additional builtin types (PyTypeObject,
...
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.
2014-01-24 06:17:25 -08:00
Larry Hastings
2a727916c5
Issue #20226 : Major improvements to Argument Clinic.
...
* You may now specify an expression as the default value for a
parameter! Example: "sys.maxsize - 1". This support is
intentionally quite limited; you may only use values that
can be represented as static C values.
* Removed "doc_default", simplified support for "c_default"
and "py_default". (I'm not sure we still even need
"py_default", but I'm leaving it in for now in case a
use presents itself.)
* Parameter lines support a trailing '\\' as a line
continuation character, allowing you to break up long lines.
* The argument parsing code generated when supporting optional
groups now uses PyTuple_GET_SIZE instead of PyTuple_GetSize,
leading to a 850% speedup in parsing. (Just kidding, this
is an unmeasurable difference.)
* A bugfix for the recent regression where the generated
prototype from pydoc for builtins would be littered with
unreadable "=<object ...>"" default values for parameters
that had no default value.
* Converted some asserts into proper failure messages.
* Many doc improvements and fixes.
2014-01-16 11:32:01 -08:00
Larry Hastings
16c5191ab3
Issue #20144 : Argument Clinic now supports simple constants as parameter
...
default values. inspect.Signature correspondingly supports them in
__text_signature__ fields for builtins.
2014-01-07 11:53:01 -08:00