Opened 8 years ago

Closed 8 years ago

#18249 closed defect (fixed)

Introspection for builtin functions

Reported by: SimonKing Owned by:
Priority: major Milestone: sage-6.7
Component: misc Keywords:
Cc: Merged in:
Authors: Simon King Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: e478d5b (Commits, GitHub, GitLab) Commit: e478d5b842268da0314778105e6801f316d7070c
Dependencies: #17814 Stopgaps:

Status badges

Description (last modified by SimonKing)

Up to now, the attempt to inspect Python builtins with ? results in a TypeError, raised by Python's inspect module. This is when the argspec or the source file is requested.

I suggest to return generic information. With the attached branch, we get

sage: range?
range(stop) -> list of integers range(start, stop[, step]) -> list of

Return a list containing an arithmetic progression of integers.
range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.
When step is given, it specifies the increment (or decrement). For
example, range(4) returns [0, 1, 2, 3].  The end point is omitted!
These are exactly the valid indices for a list of 4 elements.
Init docstring: x.__init__(...) initializes x; see help(type(x)) for signature
Type:           builtin_function_or_method

Change History (8)

comment:1 Changed 8 years ago by SimonKing

Branch: u/SimonKing/introspection_for_builtin_functions

comment:2 Changed 8 years ago by SimonKing

Authors: Simon King
Commit: dffa7659dc2f0129458fa7394b851fa018f91363
Component: PLEASE CHANGEmisc
Dependencies: #17814
Description: modified (diff)
Status: newneeds_review

New commits:

30543e7Avoid source inspection for cached cython methods without arguments
a0b829dMake a cached function/method work with default argspec when introspection fails
831173bMerge branch 't/17814/make_calling_a_cached_method_independent_of_source_code_inspection' into t/17814/rebased-make_calling_a_cached_method_independent_of_source_code_inspection
b340eebUse embedded signature for introspection
0e8ef00Catch syntax error when extraction of signature fails
dffa765Introspection of builtins returns generic data instead of raising an error

comment:3 Changed 8 years ago by vbraun

Reviewers: Volker Braun
Status: needs_reviewneeds_work

Merge conflict, can you merge in 6.7.beta3

Code looks good, set to positive review when you are done.

comment:4 Changed 8 years ago by SimonKing

Can someone else please do the merge, I will be too busy till next week.

comment:5 Changed 8 years ago by jdemeyer

Branch: u/SimonKing/introspection_for_builtin_functionsu/jdemeyer/introspection_for_builtin_functions

comment:6 Changed 8 years ago by jdemeyer

Commit: dffa7659dc2f0129458fa7394b851fa018f91363e478d5b842268da0314778105e6801f316d7070c
Status: needs_workneeds_review

New commits:

e478d5bMerge tag '6.7.beta3' into t/18249/introspection_for_builtin_functions

comment:7 Changed 8 years ago by vbraun

Status: needs_reviewpositive_review

comment:8 Changed 8 years ago by vbraun

Branch: u/jdemeyer/introspection_for_builtin_functionse478d5b842268da0314778105e6801f316d7070c
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.