Skip to content

Commit 1fdbe8a

Browse files
committed
Merge branch 'main' into module-setdelattr
2 parents 7d88eb8 + adfc118 commit 1fdbe8a

File tree

11 files changed

+32
-27
lines changed

11 files changed

+32
-27
lines changed

Doc/library/enum.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ Data Types
241241
>>> list(reversed(Color))
242242
[<Color.BLUE: 3>, <Color.GREEN: 2>, <Color.RED: 1>]
243243

244+
.. versionadded:: 3.11
245+
246+
Before 3.11 ``enum`` used ``EnumMeta`` type, which is kept as an alias.
247+
244248

245249
.. class:: Enum
246250

Lib/test/test_module.py renamed to Lib/test/test_module/__init__.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -126,29 +126,29 @@ def test_weakref(self):
126126
self.assertIs(wr(), None)
127127

128128
def test_module_getattr(self):
129-
import test.good_getattr as gga
130-
from test.good_getattr import test
129+
import test.test_module.good_getattr as gga
130+
from test.test_module.good_getattr import test
131131
self.assertEqual(test, "There is test")
132132
self.assertEqual(gga.x, 1)
133133
self.assertEqual(gga.y, 2)
134134
with self.assertRaisesRegex(AttributeError,
135135
"Deprecated, use whatever instead"):
136136
gga.yolo
137137
self.assertEqual(gga.whatever, "There is whatever")
138-
del sys.modules['test.good_getattr']
138+
del sys.modules['test.test_module.good_getattr']
139139

140140
def test_module_getattr_errors(self):
141-
import test.bad_getattr as bga
142-
from test import bad_getattr2
141+
import test.test_module.bad_getattr as bga
142+
from test.test_module import bad_getattr2
143143
self.assertEqual(bga.x, 1)
144144
self.assertEqual(bad_getattr2.x, 1)
145145
with self.assertRaises(TypeError):
146146
bga.nope
147147
with self.assertRaises(TypeError):
148148
bad_getattr2.nope
149-
del sys.modules['test.bad_getattr']
150-
if 'test.bad_getattr2' in sys.modules:
151-
del sys.modules['test.bad_getattr2']
149+
del sys.modules['test.test_module.bad_getattr']
150+
if 'test.test_module.bad_getattr2' in sys.modules:
151+
del sys.modules['test.test_module.bad_getattr2']
152152

153153
def test_module_setattr(self):
154154
import test.good_setattr as gsa
@@ -198,30 +198,30 @@ def test_module_delattr_errors(self):
198198
del sys.modules['test.bad_delattr2']
199199

200200
def test_module_dir(self):
201-
import test.good_getattr as gga
201+
import test.test_module.good_getattr as gga
202202
self.assertEqual(dir(gga), ['a', 'b', 'c'])
203-
del sys.modules['test.good_getattr']
203+
del sys.modules['test.test_module.good_getattr']
204204

205205
def test_module_dir_errors(self):
206-
import test.bad_getattr as bga
207-
from test import bad_getattr2
206+
import test.test_module.bad_getattr as bga
207+
from test.test_module import bad_getattr2
208208
with self.assertRaises(TypeError):
209209
dir(bga)
210210
with self.assertRaises(TypeError):
211211
dir(bad_getattr2)
212-
del sys.modules['test.bad_getattr']
213-
if 'test.bad_getattr2' in sys.modules:
214-
del sys.modules['test.bad_getattr2']
212+
del sys.modules['test.test_module.bad_getattr']
213+
if 'test.test_module.bad_getattr2' in sys.modules:
214+
del sys.modules['test.test_module.bad_getattr2']
215215

216216
def test_module_getattr_tricky(self):
217-
from test import bad_getattr3
217+
from test.test_module import bad_getattr3
218218
# these lookups should not crash
219219
with self.assertRaises(AttributeError):
220220
bad_getattr3.one
221221
with self.assertRaises(AttributeError):
222222
bad_getattr3.delgetattr
223-
if 'test.bad_getattr3' in sys.modules:
224-
del sys.modules['test.bad_getattr3']
223+
if 'test.test_module.bad_getattr3' in sys.modules:
224+
del sys.modules['test.test_module.bad_getattr3']
225225

226226
def test_module_repr_minimal(self):
227227
# reprs when modules have no __file__, __name__, or __loader__
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Makefile.pre.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,6 +2212,7 @@ TESTSUBDIRS= idlelib/idle_test \
22122212
test/test_importlib/resources/zipdata02 \
22132213
test/test_importlib/source \
22142214
test/test_json \
2215+
test/test_module \
22152216
test/test_peg_generator \
22162217
test/test_sqlite3 \
22172218
test/test_tkinter \

Modules/faulthandler.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/* Allocate at maximum 100 MiB of the stack to raise the stack overflow */
2727
#define STACK_OVERFLOW_MAX_SIZE (100 * 1024 * 1024)
2828

29-
#define PUTS(fd, str) _Py_write_noraise(fd, str, strlen(str))
29+
#define PUTS(fd, str) (void)_Py_write_noraise(fd, str, strlen(str))
3030

3131

3232
// clang uses __attribute__((no_sanitize("undefined")))
@@ -576,7 +576,7 @@ faulthandler_thread(void *unused)
576576
/* Timeout => dump traceback */
577577
assert(st == PY_LOCK_FAILURE);
578578

579-
_Py_write_noraise(thread.fd, thread.header, (int)thread.header_len);
579+
(void)_Py_write_noraise(thread.fd, thread.header, (int)thread.header_len);
580580

581581
errmsg = _Py_DumpTracebackThreads(thread.fd, thread.interp, NULL);
582582
ok = (errmsg == NULL);

Python/pylifecycle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
# undef BYTE
5858
#endif
5959

60-
#define PUTS(fd, str) _Py_write_noraise(fd, str, (int)strlen(str))
60+
#define PUTS(fd, str) (void)_Py_write_noraise(fd, str, (int)strlen(str))
6161

6262

6363
#ifdef __cplusplus

Python/traceback.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#define OFF(x) offsetof(PyTracebackObject, x)
2727

28-
#define PUTS(fd, str) _Py_write_noraise(fd, str, (int)strlen(str))
28+
#define PUTS(fd, str) (void)_Py_write_noraise(fd, str, (int)strlen(str))
2929
#define MAX_STRING_LENGTH 500
3030
#define MAX_FRAME_DEPTH 100
3131
#define MAX_NTHREADS 100
@@ -1047,7 +1047,7 @@ _Py_DumpDecimal(int fd, size_t value)
10471047
value /= 10;
10481048
} while (value);
10491049

1050-
_Py_write_noraise(fd, ptr, end - ptr);
1050+
(void)_Py_write_noraise(fd, ptr, end - ptr);
10511051
}
10521052

10531053
/* Format an integer as hexadecimal with width digits into fd file descriptor.
@@ -1072,7 +1072,7 @@ _Py_DumpHexadecimal(int fd, uintptr_t value, Py_ssize_t width)
10721072
value >>= 4;
10731073
} while ((end - ptr) < width || value);
10741074

1075-
_Py_write_noraise(fd, ptr, end - ptr);
1075+
(void)_Py_write_noraise(fd, ptr, end - ptr);
10761076
}
10771077

10781078
void
@@ -1125,7 +1125,7 @@ _Py_DumpASCII(int fd, PyObject *text)
11251125
}
11261126
if (!need_escape) {
11271127
// The string can be written with a single write() syscall
1128-
_Py_write_noraise(fd, str, size);
1128+
(void)_Py_write_noraise(fd, str, size);
11291129
goto done;
11301130
}
11311131
}
@@ -1135,7 +1135,7 @@ _Py_DumpASCII(int fd, PyObject *text)
11351135
if (' ' <= ch && ch <= 126) {
11361136
/* printable ASCII character */
11371137
char c = (char)ch;
1138-
_Py_write_noraise(fd, &c, 1);
1138+
(void)_Py_write_noraise(fd, &c, 1);
11391139
}
11401140
else if (ch <= 0xff) {
11411141
PUTS(fd, "\\x");

Python/tracemalloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ tracemalloc_get_traceback(unsigned int domain, uintptr_t ptr)
12471247
}
12481248

12491249

1250-
#define PUTS(fd, str) _Py_write_noraise(fd, str, (int)strlen(str))
1250+
#define PUTS(fd, str) (void)_Py_write_noraise(fd, str, (int)strlen(str))
12511251

12521252
static void
12531253
_PyMem_DumpFrame(int fd, frame_t * frame)

0 commit comments

Comments
 (0)