-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathbuffermethods_gen.go
More file actions
68 lines (49 loc) · 1.27 KB
/
buffermethods_gen.go
File metadata and controls
68 lines (49 loc) · 1.27 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
// Code generated by gen_types. DO NOT EDIT.
package py
// #include "utils.h"
import "C"
import (
"unsafe"
)
// BufferMethods represents an arbitrary Python type that implements the Buffer
// Protocol.
type BufferMethods struct {
o C.PyObject
}
var _ Object = (*BufferMethods)(nil)
func (b *BufferMethods) c() *C.PyObject {
return (*C.PyObject)(unsafe.Pointer(b))
}
// Base returns a BaseObject pointer that gives access to the generic methods on
// that type for this object.
func (b *BufferMethods) Base() *BaseObject {
return (*BaseObject)(unsafe.Pointer(b))
}
// Type returns a pointer to the Type that represents the type of this object in
// Python.
func (b *BufferMethods) Type() *Type {
return newType(c(b).ob_type)
}
// Decref decrements b's reference count, b may not be nil.
func (b *BufferMethods) Decref() {
obj := (*C.PyObject)(unsafe.Pointer(b))
refcnt := (*int)(unsafe.Pointer(&obj.anon0[0]))
if *refcnt == C._Py_IMMORTAL_REFCNT {
return
}
*refcnt--
if *refcnt == 0 {
C._Py_Dealloc(obj)
}
}
// Incref increments b's reference count, b may not be nil.
func (b *BufferMethods) Incref() {
refcnt := (*int)(unsafe.Pointer(&(*C.PyObject)(unsafe.Pointer(b)).anon0[0]))
if *refcnt == C._Py_IMMORTAL_REFCNT {
return
}
*refcnt++
}
/*
set fields:
*/