Skip to content
Snippets Groups Projects
Select Git revision
  • main default protected
  • blm_dev_chan
  • release/1.4.0 protected
  • widgets_draw
  • return_of_melodic_demo
  • task_cleanup
  • mixer2
  • dx/fb-save-restore
  • dx/dldldld
  • fpletz/flake
  • dx/jacksense-headset-mic-only
  • release/1.3.0 protected
  • fil3s-limit-filesize
  • allow-reloading-sunmenu
  • wifi-json-error-handling
  • app_text_viewer
  • shoegaze-fps
  • media_has_video_has_audio
  • fil3s-media
  • more-accurate-battery
  • v1.4.0
  • v1.3.0
  • v1.2.0
  • v1.2.0+rc1
  • v1.1.1
  • v1.1.0
  • v1.1.0+rc1
  • v1.0.0
  • v1.0.0+rc6
  • v1.0.0+rc5
  • v1.0.0+rc4
  • v1.0.0+rc3
  • v1.0.0+rc2
  • v1.0.0+rc1
34 results

objfun.c

  • dx's avatar
    0154c9ad
    micropython: add __argspec__ to function objects · 0154c9ad
    dx authored
    Returns a tuple that is somewhat compatible to inspect.FullArgSpec():
    
     * args: implemented
     * varargs: implemented (either None or "args")
     * varkw: implemented (either None or "kwargs")
     * defaults: not implemented, always None (not too difficult tbh)
     * kwonlyargs: implemented
     * kwonlydefaults: not implemented, always None
     * annotations: not implemented, always None
    
    Inspired by mp_setup_code_state_helper() in bc.c which is the function
    that reads the prelude of the bytecode to prepare a function to be
    called, and also is the function that raises TypeError when you call it
    wrong.
    
    MP_BC_PRELUDE_SIG_DECODE() and MP_BC_PRELUDE_SIZE_DECODE() are two
    macros that put a bunch of variables in your function, that's where all
    the n_*_args variables come from.
    0154c9ad
    History
    micropython: add __argspec__ to function objects
    dx authored
    Returns a tuple that is somewhat compatible to inspect.FullArgSpec():
    
     * args: implemented
     * varargs: implemented (either None or "args")
     * varkw: implemented (either None or "kwargs")
     * defaults: not implemented, always None (not too difficult tbh)
     * kwonlyargs: implemented
     * kwonlydefaults: not implemented, always None
     * annotations: not implemented, always None
    
    Inspired by mp_setup_code_state_helper() in bc.c which is the function
    that reads the prelude of the bytecode to prepare a function to be
    called, and also is the function that raises TypeError when you call it
    wrong.
    
    MP_BC_PRELUDE_SIG_DECODE() and MP_BC_PRELUDE_SIZE_DECODE() are two
    macros that put a bunch of variables in your function, that's where all
    the n_*_args variables come from.