Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
Functions
Typedefs
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerations
a
c
d
e
f
h
i
k
l
m
o
p
r
s
t
v
w
Enumerator
a
b
c
d
e
i
l
m
n
o
p
r
t
u
Related Functions
b
g
h
o
s
t
Files
File List
File Members
All
_
a
c
g
h
j
n
o
p
s
t
u
v
w
Functions
a
c
g
h
j
n
o
p
s
t
u
v
w
Variables
Typedefs
a
g
n
p
s
t
u
Enumerations
Enumerator
Macros
_
a
g
n
p
s
t
u
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
py3Compat.h
Go to the documentation of this file.
1
//
2
// Copyright 2020 Pixar
3
//
4
// Licensed under the terms set forth in the LICENSE.txt file available at
5
// https://openusd.org/license.
6
//
7
#ifndef PXR_BASE_TF_PY_3_COMPAT_H
8
#define PXR_BASE_TF_PY_3_COMPAT_H
9
12
13
#include "
pxr/pxr.h
"
14
15
#include "
pxr/base/tf/pySafePython.h
"
16
17
PXR_NAMESPACE_OPEN_SCOPE
18
19
// Python 3 migrating helpers:
20
#if PY_MAJOR_VERSION >= 3
21
22
// These flags are needed in python 2 only, stub them out in python 3.
23
// In python 3 this behavior is the default. See PEP-3118
24
#define TfPy_TPFLAGS_HAVE_NEWBUFFER 0
25
#define TfPy_TPFLAGS_HAVE_GETCHARBUFFER 0
26
27
#define TfPyBytes_Check PyBytes_Check
28
#define TfPyString_Check(a) (PyBytes_Check(a) || PyUnicode_Check(a))
29
#define TfPyString_AsString PyUnicode_AsUTF8
30
31
// PyInt -> PyLong remapping
32
#define TfPyInt_Check PyLong_Check
33
// Note: Slightly different semantics, the macro does not do any error checking
34
#define TfPyInt_AS_LONG PyLong_AsLong
35
36
// Method and module names that are changed in python 3
37
#define TfPyIteratorNextMethodName "__next__"
38
#define TfPyClassMethodFuncName "__func__"
39
#define TfPyBoolBuiltinFuncName "__bool__"
40
#define TfPyBuiltinModuleName "builtins"
41
42
#else
// Python 2
43
44
#define TfPy_TPFLAGS_HAVE_NEWBUFFER Py_TPFLAGS_HAVE_NEWBUFFER
45
#define TfPy_TPFLAGS_HAVE_GETCHARBUFFER Py_TPFLAGS_HAVE_GETCHARBUFFER
46
47
#define TfPyBytes_Check PyString_Check
48
#define TfPyString_Check PyString_Check
49
#define TfPyString_AsString PyString_AsString
50
51
#define TfPyInt_Check PyInt_Check
52
#define TfPyInt_AS_LONG PyInt_AS_LONG
53
54
#define TfPyIteratorNextMethodName "next"
55
#define TfPyClassMethodFuncName "im_func"
56
#define TfPyBoolBuiltinFuncName "__nonzero__"
57
#define TfPyBuiltinModuleName "__builtin__"
58
59
#endif
60
61
PXR_NAMESPACE_CLOSE_SCOPE
62
63
#endif
// PXR_BASE_TF_PY_3_COMPAT_H
pxr.h
pySafePython.h
Intended to replace a direct include of Python.h, which causes several build problems with certain co...
pxr
base
tf
py3Compat.h
© Copyright 2024, Pixar Animation Studios. |
Terms of Use
| Generated on Thu Oct 24 2024 22:27:06 by
1.9.6