Opened 7 years ago
Closed 7 years ago
#18249 closed defect (fixed)
Introspection for builtin functions
Reported by:  SimonKing  Owned by:  

Priority:  major  Milestone:  sage6.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: 
Description (last modified by )
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? Docstring: range(stop) > list of integers range(start, stop[, step]) > list of integers Return a list containing an arithmetic progression of integers. range(i, j) returns [i, i+1, i+2, ..., j1]; 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 File: Type: builtin_function_or_method
Change History (8)
comment:1 Changed 7 years ago by
 Branch set to u/SimonKing/introspection_for_builtin_functions
comment:2 Changed 7 years ago by
 Commit set to dffa7659dc2f0129458fa7394b851fa018f91363
 Component changed from PLEASE CHANGE to misc
 Dependencies set to #17814
 Description modified (diff)
 Status changed from new to needs_review
 Type changed from PLEASE CHANGE to defect
comment:3 Changed 7 years ago by
 Reviewers set to Volker Braun
 Status changed from needs_review to needs_work
Merge conflict, can you merge in 6.7.beta3
Code looks good, set to positive review when you are done.
comment:4 Changed 7 years ago by
Can someone else please do the merge, I will be too busy till next week.
comment:5 Changed 7 years ago by
 Branch changed from u/SimonKing/introspection_for_builtin_functions to u/jdemeyer/introspection_for_builtin_functions
comment:6 Changed 7 years ago by
 Commit changed from dffa7659dc2f0129458fa7394b851fa018f91363 to e478d5b842268da0314778105e6801f316d7070c
 Status changed from needs_work to needs_review
New commits:
e478d5b  Merge tag '6.7.beta3' into t/18249/introspection_for_builtin_functions

comment:7 Changed 7 years ago by
 Status changed from needs_review to positive_review
comment:8 Changed 7 years ago by
 Branch changed from u/jdemeyer/introspection_for_builtin_functions to e478d5b842268da0314778105e6801f316d7070c
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
New commits:
Avoid source inspection for cached cython methods without arguments
Make a cached function/method work with default argspec when introspection fails
Merge branch 't/17814/make_calling_a_cached_method_independent_of_source_code_inspection' into t/17814/rebasedmake_calling_a_cached_method_independent_of_source_code_inspection
Use embedded signature for introspection
Catch syntax error when extraction of signature fails
Introspection of builtins returns generic data instead of raising an error