Merge lp:~jelmer/brz/python-compat into lp:brz/3.3
- python-compat
- Merge into 3.3
Status: | Needs review |
---|---|
Proposed branch: | lp:~jelmer/brz/python-compat |
Merge into: | lp:brz/3.3 |
Diff against target: |
147 lines (+16/-63) 3 files modified
breezy/bzr/_static_tuple_c.c (+14/-13) breezy/bzr/_str_helpers.pxd (+2/-2) breezy/python-compat.h (+0/-48) |
To merge this branch: | bzr merge lp:~jelmer/brz/python-compat |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+431801@code.launchpad.net |
Commit message
Drop python 2 compat code.
Description of the change
Drop python 2 compat code.
The Breezy Bot (the-breezy-bot) wrote : | # |
The Breezy Bot (the-breezy-bot) wrote : | # |
The attempt to merge lp:~jelmer/brz/python-compat into lp:brz/3.3 failed. Below is the output from the failed tests.
Collecting setuptools-gettext
Using cached setuptools_
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.
Installing collected packages: setuptools-gettext
Successfully installed setuptools-
Obtaining file://
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: merge3 in /usr/lib/
Requirement already satisfied: dulwich>=0.20.23 in /usr/lib/
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/
Requirement already satisfied: configobj in /usr/lib/
Requirement already satisfied: pyyaml in /usr/lib/
Requirement already satisfied: fastbencode in /usr/lib/
Requirement already satisfied: patiencediff in /usr/lib/
Collecting fastimport
Using cached fastimport-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/
Collecting python-subunit
Using cached python_
Collecting testtools
Using cached testtools-
Requirement already satisfied: setuptools in ./lib/python3.
Collecting sphinx
Using cached sphinx-
Collecting sphinx-epytext
Using cached sphinx-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: gpg in /usr/lib/
Collecting pyinotify
Using cached pyinotify-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: httplib2 in /usr/lib/
Collecting keyring
Using cached keyring-
Requirement already satisfied: lazr.restfulcli
...
The Breezy Bot (the-breezy-bot) wrote : | # |
The attempt to merge lp:~jelmer/brz/python-compat into lp:brz/3.3 failed. Below is the output from the failed tests.
Collecting setuptools-gettext
Downloading setuptools_
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.
Installing collected packages: setuptools-gettext
Successfully installed setuptools-
Obtaining file://
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: patiencediff in /usr/lib/
Requirement already satisfied: dulwich>=0.20.23 in /usr/lib/
Requirement already satisfied: fastbencode in /usr/lib/
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/
Requirement already satisfied: configobj in /usr/lib/
Requirement already satisfied: merge3 in /usr/lib/
Requirement already satisfied: pyyaml in /usr/lib/
Collecting pyinotify
Downloading pyinotify-
━━
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/
Requirement already satisfied: setuptools in ./lib/python3.
Collecting sphinx-epytext
Downloading sphinx-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting sphinx
Downloading sphinx-
━━
Collecting testtools
Downloading testtools-
━━
Collecting python-subunit
Downloading python_
━━
Collecting fastimport
Downloading fastimport-
━━
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: gpg in /usr/lib/
The Breezy Bot (the-breezy-bot) wrote : | # |
The attempt to merge lp:~jelmer/brz/python-compat into lp:brz/3.3 failed. Below is the output from the failed tests.
Collecting setuptools-gettext
Downloading setuptools_
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.
Installing collected packages: setuptools-gettext
Successfully installed setuptools-
Obtaining file://
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: merge3 in /usr/lib/
Requirement already satisfied: patiencediff in /usr/lib/
Requirement already satisfied: dulwich>=0.20.23 in /usr/lib/
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/
Requirement already satisfied: pyyaml in /usr/lib/
Requirement already satisfied: fastbencode in /usr/lib/
Requirement already satisfied: configobj in /usr/lib/
Collecting fastimport
Downloading fastimport-
━━
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/
Collecting testtools
Downloading testtools-
━━
Collecting python-subunit
Downloading python_
━━
Requirement already satisfied: gpg in /usr/lib/
Collecting sphinx
Downloading sphinx-
━━
Requirement already satisfied: setuptools in ./lib/python3.
Collecting sphinx-epytext
Downloading sphinx-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting pyinotify
Downloading pyinotify-
━━
Preparing metadata (setup.py): started
Preparing metada...
The Breezy Bot (the-breezy-bot) wrote : | # |
The attempt to merge lp:~jelmer/brz/python-compat into lp:brz/3.3 failed. Command exited with 1.
Below is the output from the failed tests.
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.10-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/tmp/
The Breezy Bot (the-breezy-bot) wrote : | # |
The attempt to merge lp:~jelmer/brz/python-compat into lp:brz/3.3 failed. Command exited with 1.
Below is the output from the failed tests.
Collecting setuptools-gettext
Downloading setuptools_
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.
Installing collected packages: setuptools-gettext
Successfully installed setuptools-
Obtaining file://
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/
Requirement already satisfied: pyyaml in /usr/lib/
Requirement already satisfied: dulwich>=0.20.23 in /usr/lib/
Requirement already satisfied: merge3 in /usr/lib/
Requirement already satisfied: fastbencode in /usr/lib/
Requirement already satisfied: patiencediff in /usr/lib/
Requirement already satisfied: configobj in /usr/lib/
Collecting python-subunit
Downloading python_
━━
Collecting testtools
Downloading testtools-
━━
Requirement already satisfied: gpg in /usr/lib/
Collecting fastimport
Downloading fastimport-
━━
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting sphinx
Downloading sphinx-
━━
Collecting sphinx-epytext
Downloading sphinx-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: setuptools in ./lib/python3.
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/
Requirement already satisfied: httplib2 in /usr/lib/
Collecting keyring
Downloading keyring-
The Breezy Bot (the-breezy-bot) wrote : | # |
The attempt to merge lp:~jelmer/brz/python-compat into lp:brz/3.3 failed. Command exited with 1.
Below is the output from the failed tests.
Collecting setuptools-gettext
Downloading setuptools_
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.
Installing collected packages: setuptools-gettext
Successfully installed setuptools-
Obtaining file://
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: configobj in /usr/lib/
Requirement already satisfied: dulwich>=0.20.23 in /usr/lib/
Requirement already satisfied: merge3 in /usr/lib/
Requirement already satisfied: fastbencode in /usr/lib/
Requirement already satisfied: pyyaml in /usr/lib/
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/
Requirement already satisfied: patiencediff in /usr/lib/
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/
Collecting fastimport
Downloading fastimport-
━━
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting sphinx
Downloading sphinx-
━━
Collecting sphinx-epytext
Downloading sphinx-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: setuptools in ./lib/python3.
Requirement already satisfied: gpg in /usr/lib/
Collecting python-subunit
Downloading python_
━━
Collecting testtools
Downloading testtools-
━━
Requirement already satisfied: httplib2 in /usr/lib/
Collecting keyring
Downloading keyring-
Unmerged revisions
- 7665. By Jelmer Vernooij
-
Drop python 2 compat code.
Preview Diff
1 | === modified file 'breezy/bzr/_static_tuple_c.c' |
2 | --- breezy/bzr/_static_tuple_c.c 2022-07-16 19:07:39 +0000 |
3 | +++ breezy/bzr/_static_tuple_c.c 2022-10-19 10:13:59 +0000 |
4 | @@ -809,7 +809,7 @@ |
5 | Py_ssize_t res; |
6 | |
7 | res = _PyObject_SIZE(&StaticTuple_Type) + (int)self->size * sizeof(void*); |
8 | - return PyInt_FromSsize_t(res); |
9 | + return PyLong_FromSsize_t(res); |
10 | } |
11 | |
12 | |
13 | @@ -906,10 +906,7 @@ |
14 | 0, /* tp_getattro */ |
15 | 0, /* tp_setattro */ |
16 | 0, /* tp_as_buffer */ |
17 | - /* Py_TPFLAGS_CHECKTYPES tells the number operations that they shouldn't |
18 | - * try to 'coerce' but instead stuff like 'add' will check it arguments. |
19 | - */ |
20 | - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags*/ |
21 | + Py_TPFLAGS_DEFAULT, /* tp_flags*/ |
22 | StaticTuple_doc, /* tp_doc */ |
23 | /* gc.get_referents checks the IS_GC flag before it calls tp_traverse |
24 | * And we don't include this object in the garbage collector because we |
25 | @@ -993,32 +990,36 @@ |
26 | } |
27 | |
28 | |
29 | -PYMOD_INIT_FUNC(_static_tuple_c) |
30 | +PyMODINIT_FUNC PyInit_static_tuple_c(void) |
31 | { |
32 | PyObject* m; |
33 | |
34 | StaticTuple_Type.tp_getattro = PyObject_GenericGetAttr; |
35 | if (PyType_Ready(&StaticTuple_Type) < 0) { |
36 | - return PYMOD_ERROR; |
37 | + return NULL; |
38 | } |
39 | |
40 | - PYMOD_CREATE(m, "_static_tuple_c", |
41 | - "C implementation of a StaticTuple structure", |
42 | - static_tuple_c_methods); |
43 | + static struct PyModuleDef moduledef = { |
44 | + PyModuleDef_HEAD_INIT, |
45 | + "_static_tuple_c", |
46 | + "C implementation of a StaticTuple structure", -1, |
47 | + static_tuple_c_methods |
48 | + }; |
49 | + m = PyModule_Create(&moduledef); |
50 | if (m == NULL) { |
51 | - return PYMOD_ERROR; |
52 | + return NULL; |
53 | } |
54 | |
55 | Py_INCREF(&StaticTuple_Type); |
56 | PyModule_AddObject(m, "StaticTuple", (PyObject *)&StaticTuple_Type); |
57 | if (import_breezy__bzr___simple_set_pyx() == -1) { |
58 | - return PYMOD_ERROR; |
59 | + return NULL; |
60 | } |
61 | setup_interned_tuples(m); |
62 | setup_empty_tuple(m); |
63 | setup_c_api(m); |
64 | |
65 | - return PYMOD_SUCCESS(m); |
66 | + return m; |
67 | } |
68 | |
69 | // vim: tabstop=4 sw=4 expandtab |
70 | |
71 | === modified file 'breezy/bzr/_str_helpers.pxd' |
72 | --- breezy/bzr/_str_helpers.pxd 2020-06-08 19:42:53 +0000 |
73 | +++ breezy/bzr/_str_helpers.pxd 2022-10-19 10:13:59 +0000 |
74 | @@ -21,7 +21,6 @@ |
75 | |
76 | cdef extern from "python-compat.h": |
77 | object PyBytes_FromStringAndSize (char *, Py_ssize_t) |
78 | - object PyBytes_InternFromStringAndSize (char *, Py_ssize_t) |
79 | |
80 | |
81 | cdef inline void* _my_memrchr(void *s, int c, size_t n): # cannot_raise |
82 | @@ -49,4 +48,5 @@ |
83 | if size < 0: |
84 | raise AssertionError( |
85 | 'tried to create a string with an invalid size: %d' % size) |
86 | - return PyBytes_InternFromStringAndSize(s, size) |
87 | + # For now, don't intern on Python 3 |
88 | + return PyBytes_FromStringAndSize(s, size) |
89 | |
90 | === modified file 'breezy/python-compat.h' |
91 | --- breezy/python-compat.h 2020-11-19 12:13:38 +0000 |
92 | +++ breezy/python-compat.h 2022-10-19 10:13:59 +0000 |
93 | @@ -29,54 +29,6 @@ |
94 | #define inline __inline |
95 | #endif |
96 | |
97 | -#if PY_MAJOR_VERSION >= 3 |
98 | - |
99 | -#define PyInt_FromSsize_t PyLong_FromSsize_t |
100 | - |
101 | -/* On Python 3 just don't intern bytes for now */ |
102 | -#define PyBytes_InternFromStringAndSize PyBytes_FromStringAndSize |
103 | - |
104 | -/* In Python 3 the Py_TPFLAGS_CHECKTYPES behaviour is on by default */ |
105 | -#define Py_TPFLAGS_CHECKTYPES 0 |
106 | - |
107 | -#define PYMOD_ERROR NULL |
108 | -#define PYMOD_SUCCESS(val) val |
109 | -#define PYMOD_INIT_FUNC(name) PyMODINIT_FUNC PyInit_##name(void) |
110 | -#define PYMOD_CREATE(ob, name, doc, methods) do { \ |
111 | - static struct PyModuleDef moduledef = { \ |
112 | - PyModuleDef_HEAD_INIT, name, doc, -1, methods \ |
113 | - }; \ |
114 | - ob = PyModule_Create(&moduledef); \ |
115 | - } while(0) |
116 | - |
117 | -#else |
118 | - |
119 | -#define PyBytes_Type PyString_Type |
120 | -#define PyBytes_CheckExact PyString_CheckExact |
121 | -#define PyBytes_FromStringAndSize PyString_FromStringAndSize |
122 | -inline PyObject* PyBytes_InternFromStringAndSize(const char *v, Py_ssize_t len) |
123 | -{ |
124 | - PyObject *obj = PyString_FromStringAndSize(v, len); |
125 | - if (obj != NULL) { |
126 | - PyString_InternInPlace(&obj); |
127 | - } |
128 | - return obj; |
129 | -} |
130 | - |
131 | -/* Lazy hide Python 3.3 only functions, callers must avoid on 2.7 anyway */ |
132 | -#define PyUnicode_AsUTF8AndSize(u, size) NULL |
133 | - |
134 | -#define PYMOD_ERROR |
135 | -#define PYMOD_SUCCESS(val) |
136 | -#define PYMOD_INIT_FUNC(name) void init##name(void) |
137 | -#define PYMOD_CREATE(ob, name, doc, methods) do { \ |
138 | - ob = Py_InitModule3(name, methods, doc); \ |
139 | - } while(0) |
140 | - |
141 | -#endif |
142 | - |
143 | -#define BrzPy_EnterRecursiveCall(where) (Py_EnterRecursiveCall(where) == 0) |
144 | - |
145 | #if defined(_WIN32) || defined(WIN32) |
146 | /* Defining WIN32_LEAN_AND_MEAN makes including windows quite a bit |
147 | * lighter weight. |
The attempt to merge lp:~jelmer/brz/python-compat into lp:brz/3.3 failed. Below is the output from the failed tests.
Collecting setuptools-gettext gettext- 0.1.1-py3- none-any. whl (10 kB) 10/site- packages (from setuptools-gettext) (65.5.0) gettext- 0.1.1 /tmp/tarmac/ branch. _6hf7_33 python3/ dist-packages (from breezy==3.3.1.dev0) (0.0.12) python3/ dist-packages (from breezy==3.3.1.dev0) (0.0.8) python3/ dist-packages (from breezy==3.3.1.dev0) (5.0.6) python3/ dist-packages (from breezy==3.3.1.dev0) (1.26.12) python3/ dist-packages (from breezy==3.3.1.dev0) (0.20.46) python3/ dist-packages (from breezy==3.3.1.dev0) (5.4.1) python3/ dist-packages (from breezy==3.3.1.dev0) (0.2.3) python3/ dist-packages (from breezy==3.3.1.dev0) (1.18.0) 0.9.6.tar. gz (60 kB) python3/ dist-packages (from breezy==3.3.1.dev0) (1.10.17) 2.5.0-py3- none-any. whl (181 kB) subunit- 1.4.0-py2. py3-none- any.whl (106 kB) 0.9.14. tar.gz (41 kB) epytext- 0.0.4.tar. gz (3.6 kB) 10/site- packages (from breezy==3.3.1.dev0) (65.5.0) 5.3.0-py3- none-any. whl (3.2 MB) python3/ dist-packages (from launchpadlib> =1.6.3- >breezy= =3.3.1. dev0) (0.20.4) 23.9.3- py3-none- any.whl (35 kB) ent>=0. 9.19 in /usr/lib/ python3/ dist-packages (from launchpadlib> =1.6.3- >breezy= =3.3.1. dev0) (0.14.5)
Using cached setuptools_
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.
Installing collected packages: setuptools-gettext
Successfully installed setuptools-
Obtaining file://
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: fastbencode in /usr/lib/
Requirement already satisfied: merge3 in /usr/lib/
Requirement already satisfied: configobj in /usr/lib/
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/
Requirement already satisfied: dulwich>=0.20.23 in /usr/lib/
Requirement already satisfied: pyyaml in /usr/lib/
Requirement already satisfied: patiencediff in /usr/lib/
Requirement already satisfied: gpg in /usr/lib/
Collecting pyinotify
Using cached pyinotify-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/
Collecting testtools
Using cached testtools-
Collecting python-subunit
Using cached python_
Collecting fastimport
Using cached fastimport-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting sphinx-epytext
Using cached sphinx-
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: setuptools in ./lib/python3.
Collecting sphinx
Using cached sphinx-
Requirement already satisfied: httplib2 in /usr/lib/
Collecting keyring
Using cached keyring-
Requirement already satisfied: lazr.restfulcli
...