-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathBaseException.hpp
More file actions
67 lines (44 loc) · 1.72 KB
/
Copy pathBaseException.hpp
File metadata and controls
67 lines (44 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include "PyObject.hpp"
namespace py {
class BaseException : public PyBaseObject
{
friend class ::Heap;
template<typename T> friend struct klass;
friend BaseException *as<>(PyObject *obj);
friend const BaseException *as<>(const PyObject *obj);
protected:
PyTuple *m_args{ nullptr };
PyObject *m_dict{ nullptr };
PyTraceback *m_traceback{ nullptr };
PyObject *m_context{ nullptr };
PyObject *m_cause{ nullptr };
bool m_suppress_context{ false };
BaseException(PyType *type);
BaseException(PyType *type, PyTuple *args);
BaseException(const TypePrototype &type, PyTuple *args);
BaseException(PyTuple *args);
public:
static PyResult<BaseException *> create(PyTuple *args);
std::string what() const;
static PyResult<PyObject *> __new__(const PyType *type, PyTuple *args, PyDict *kwargs);
PyResult<int32_t> __init__(PyTuple *args, PyDict *kwargs);
PyResult<PyObject *> __repr__() const;
PyResult<PyObject *> __str__() const;
std::string to_string() const override;
PyTuple *args() const { return m_args; }
PyTraceback *traceback() const { return m_traceback; }
void set_traceback(PyTraceback *tb) { m_traceback = tb; }
PyObject *cause() const { return m_cause; }
void set_cause(PyObject *cause) { m_cause = cause; }
PyObject *context() const { return m_context; }
void set_context(PyObject *context) { m_context = context; }
bool suppress_context() const { return m_suppress_context; }
void set_suppress_context(bool suppress) { m_suppress_context = suppress; }
std::string format_traceback() const;
static std::function<std::unique_ptr<TypePrototype>()> type_factory();
PyType *static_type() const override;
static PyType *class_type();
void visit_graph(Visitor &) override;
};
}// namespace py