/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: Breezy landing bot
  • Author(s): Martin
  • Date: 2018-07-12 09:48:13 UTC
  • mfrom: (7032.2.2 chk_map_pyx_py3)
  • Revision ID: breezy.the.bot@gmail.com-20180712094813-9wrz8x5twprjtp46
Make _chk_map_pyx module work on Python 3

Merged from https://code.launchpad.net/~gz/brz/chk_map_pyx_py3/+merge/349385

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#define PyInt_FromSsize_t PyLong_FromSsize_t
31
31
 
 
32
/* On Python 3 just don't intern bytes for now */
 
33
#define PyBytes_InternFromStringAndSize PyBytes_FromStringAndSize
 
34
 
32
35
/* In Python 3 the Py_TPFLAGS_CHECKTYPES behaviour is on by default */
33
36
#define Py_TPFLAGS_CHECKTYPES 0
34
37
 
46
49
 
47
50
#define PyBytes_Type PyString_Type
48
51
#define PyBytes_CheckExact PyString_CheckExact
 
52
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
 
53
inline PyObject* PyBytes_InternFromStringAndSize(const char *v, Py_ssize_t len)
 
54
{
 
55
    PyObject *obj = PyString_FromStringAndSize(v, len);
 
56
    if (obj != NULL) {
 
57
        PyString_InternInPlace(&obj);
 
58
    }
 
59
    return obj;
 
60
}
49
61
 
50
62
/* Lazy hide Python 3.3 only functions, callers must avoid on 2.7 anyway */
51
63
#define PyUnicode_AsUTF8AndSize(u, size) NULL