Commit Graph

19 Commits

Author SHA1 Message Date
kb1000 bb7ec408cb Use pythoncapi-compat to simplify Python C API backwards compatibility 2024-04-08 10:57:28 +01:00
baldurk 9f4f0e6aa1 Update copyright years to 2024 2024-02-12 11:04:52 +00:00
baldurk d47e79ae07 Update copyright years to 2023 2023-02-01 12:23:32 +00:00
baldurk 9df7d40241 Fix compilation on python version update on mac CI 2022-11-02 12:22:33 +00:00
baldurk fcdea67879 Update copyright years to 2022 2022-02-17 17:38:32 +00:00
baldurk dcaabf42e9 Allow python to register custom event filters 2021-07-01 15:15:01 +01:00
baldurk 026da176bb Update copyright years to 2021 2021-01-13 13:56:10 +00:00
baldurk 6bc4e007a0 Fix C++ invokes being responsible for destroying python callbacks
* If the last refcount on a python lambda/temp function is released when a
  wrapping std::function is destroyed in a C++ invoke, we can't destroy it
  safely. Instead we queue up that decref and process it the next chance we're
  able (which is either when the current execution finishes for a python shell
  execution, or on the next function call which handles extensions).
2020-12-03 14:55:02 +00:00
baldurk 916c431dfa Compile fixes 2020-11-18 19:05:03 +00:00
baldurk ab2f4e4046 Fix exception handling in wrapped python callbacks 2020-11-18 15:41:20 +00:00
baldurk 2916c0f9f7 Update copyright years to 2020 2020-01-06 16:20:45 +00:00
baldurk 86ff87863e Update copyright years to 2019 2019-02-01 18:32:13 +00:00
baldurk 1720d321e5 Set general global handle for extension registration work
* When calling the register() function there is no frame or globals, so we need
  to set an internal handle external to that.
* This means functions that get wrapped know that there's a global handler for
  exceptions, which just prints to the log. Otherwise they think they're running
  synchronously and write to an invalid exception handling object.
2018-10-23 15:36:35 +01:00
baldurk 9e6a5e692e Keep a reference to python function object in wrapped lambda
* This will rarely be relevant, but it ensures if the function is decref'd and
  the lambda is still alive, that we keep the python object alive until we are
  done with it. The primary case for this is persistent callbacks where the
  module is then reloaded.
2018-10-23 14:23:10 +01:00
baldurk 58de3fa8a5 Walk stackframe to find _renderdoc_internal
* When calling functions in modules, the globals are namespaced to the module
2018-10-18 19:36:21 +01:00
baldurk e305029ddd Update copyright years to 2018 2018-01-01 17:55:29 +00:00
baldurk 2e74989b69 Allow None when converting std::function types
* It just creates an empty callback
2018-01-01 17:31:22 +00:00
baldurk 4c0347f856 Fix compile errors with python bindings on callbacks with return values 2018-01-01 17:31:21 +00:00
baldurk 9db71b803a Change python wrapping of arrays to be more pythonic, by reference
* Previously we would convert from python to C++ arrays immediately by
  copying, and vice-versa convert TO python immediately by creating a
  new python list by copying.
* This however behaves rather poorly in common situations, e.g.:
  > foo.bar.append(5)
  Would not append 5 to foo.bar, but copy foo.bar to a temporary, append
  5 to it, then destroy it leaving foo.bar untouched.
* Instead we leave the C++ array type as a pointer for as long as we can
  and instead implement the python sequence API as extensions/slots that
  work in-place on the original array.
2017-11-03 16:19:41 +00:00