/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/python-compat.h

  • Committer: Jelmer Vernooij
  • Date: 2020-03-22 01:35:14 UTC
  • mfrom: (7490.7.6 work)
  • mto: This revision was merged to the branch mainline in revision 7499.
  • Revision ID: jelmer@jelmer.uk-20200322013514-7vw1ntwho04rcuj3
merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#ifndef _BZR_PYTHON_COMPAT_H
26
26
#define _BZR_PYTHON_COMPAT_H
27
27
 
 
28
#ifdef _MSC_VER
 
29
#define inline __inline
 
30
#endif
 
31
 
28
32
#if PY_MAJOR_VERSION >= 3
29
33
 
30
34
#define PyInt_FromSsize_t PyLong_FromSsize_t
31
35
 
 
36
/* On Python 3 just don't intern bytes for now */
 
37
#define PyBytes_InternFromStringAndSize PyBytes_FromStringAndSize
 
38
 
32
39
/* In Python 3 the Py_TPFLAGS_CHECKTYPES behaviour is on by default */
33
40
#define Py_TPFLAGS_CHECKTYPES 0
34
41
 
46
53
 
47
54
#define PyBytes_Type PyString_Type
48
55
#define PyBytes_CheckExact PyString_CheckExact
 
56
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
 
57
inline PyObject* PyBytes_InternFromStringAndSize(const char *v, Py_ssize_t len)
 
58
{
 
59
    PyObject *obj = PyString_FromStringAndSize(v, len);
 
60
    if (obj != NULL) {
 
61
        PyString_InternInPlace(&obj);
 
62
    }
 
63
    return obj;
 
64
}
49
65
 
50
66
/* Lazy hide Python 3.3 only functions, callers must avoid on 2.7 anyway */
51
67
#define PyUnicode_AsUTF8AndSize(u, size) NULL
59
75
 
60
76
#endif
61
77
 
 
78
#define BrzPy_EnterRecursiveCall(where) (Py_EnterRecursiveCall(where) == 0)
 
79
 
62
80
#if defined(_WIN32) || defined(WIN32)
63
81
    /* Defining WIN32_LEAN_AND_MEAN makes including windows quite a bit
64
82
     * lighter weight.