1
// Copyright 2014, Kay Hayen, mailto:kay.hayen@gmail.com
3
// Part of "Nuitka", an optimizing Python compiler that is compatible and
4
// integrates with CPython, but also works on its own.
6
// Licensed under the Apache License, Version 2.0 (the "License");
7
// you may not use this file except in compliance with the License.
8
// You may obtain a copy of the License at
10
// http://www.apache.org/licenses/LICENSE-2.0
12
// Unless required by applicable law or agreed to in writing, software
13
// distributed under the License is distributed on an "AS IS" BASIS,
14
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
// See the License for the specific language governing permissions and
16
// limitations under the License.
18
#ifndef __NUITKA_VARIABLES_PARAMETERS_H__
19
#define __NUITKA_VARIABLES_PARAMETERS_H__
21
class PyObjectLocalParameterVariableWithDel
24
explicit PyObjectLocalParameterVariableWithDel( PyObject *object )
26
assertObject( object );
28
this->object = object;
31
explicit PyObjectLocalParameterVariableWithDel()
36
void setVariableValue( PyObject *object )
38
assertObject( object );
39
assert( this->object == NULL);
40
this->object = object;
43
~PyObjectLocalParameterVariableWithDel()
45
Py_XDECREF( this->object );
48
inline bool isInitialized() const
50
return this->object != NULL;
55
PyObjectLocalParameterVariableWithDel( const PyObjectLocalParameterVariableWithDel &other ) { assert( false ); }
61
class PyObjectLocalParameterVariableNoDel
65
explicit PyObjectLocalParameterVariableNoDel( PyObject *object )
67
assertObject( object );
69
this->object = object;
72
explicit PyObjectLocalParameterVariableNoDel()
77
void setVariableValue( PyObject *object )
79
assertObject( object );
80
assert( this->object == NULL);
81
this->object = object;
84
~PyObjectLocalParameterVariableNoDel()
86
assertObject( this->object );
88
Py_DECREF( this->object );
91
inline bool isInitialized() const
98
PyObjectLocalParameterVariableNoDel( const PyObjectLocalParameterVariableNoDel &other ) { assert( false ); }