This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/python/intern/bpy_driver.h
Campbell Barton 00c7e760b3 Python: add opcodes for safe py-drivers
The following opcodes have been added, see [0] for details:

- LIST_TO_TUPLE: convert a list to a tuple,
  use for constructing lists/tuples in some cases.

- LIST_EXTEND: use for constructing lists with unpacking.

- SET_UPDATE: use for constructing sets with unpacking.

- CONTAINS_OP: check if `a in b` generally useful.

When writing tests these op-codes where needed for basic operations
and can be safely supported.

Add note why dictionary manipulation op-codes have been left out.

Also restrict namsepace access to anything with an underscore prefix
since these may be undocumented.

[0]: https://docs.python.org/3.10/library/dis.html
2022-07-12 16:05:13 +10:00

37 lines
978 B
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup pythonintern
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
/**
* For faster execution we keep a special dictionary for py-drivers, with
* the needed modules and aliases.
*/
int bpy_pydriver_create_dict(void);
/**
* For PyDrivers
* (drivers using one-line Python expressions to express relationships between targets).
*/
extern PyObject *bpy_pydriver_Dict;
extern bool BPY_driver_secure_bytecode_test_ex(PyObject *expr_code,
PyObject *namespace_array[],
const bool verbose,
const char *error_prefix);
extern bool BPY_driver_secure_bytecode_test(PyObject *expr_code,
PyObject *namespace,
const bool verbose);
#ifdef __cplusplus
}
#endif