Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
PyPy
cffi
Commits
56ce956f2e0d
Commit
5a225525
authored
Jul 05, 2015
by
Armin Rigo
Browse files
Expand the explanation of the hack
parent
08e9e358f971
Changes
1
Hide whitespace changes
Inline
Side-by-side
doc/source/using.rst
View file @
56ce956f
...
...
@@ -534,9 +534,14 @@ callback object too early, when it is still in use.
``onerror`` itself fails---then the value of ``error`` will be
used, if any.
Note the following hack: in ``onerror``, you can access some of the
original callback arguments by attempting to read
``traceback.tb_frame.f_locals['argname']``.
Note the following hack: in ``onerror``, you can access the original
callback arguments as follows. First check if ``traceback`` is not
None (it is None e.g. if the whole function ran successfully but
there was an error converting the value returned: this occurs after
the call). If ``traceback`` is not None, then ``traceback.tb_frame``
is the frame of the outermost function, i.e. directly the one invoked
by the callback handler. So you can get the value of ``argname`` in
that frame by reading ``traceback.tb_frame.f_locals['argname']``.
FFI Interface
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment