Skip to content

Commit 196575b

Browse files
authored
Merge branch '3.12' into pythongh-106242-3.12
2 parents eadabd8 + 91d935b commit 196575b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+29020
-27145
lines changed

Doc/c-api/typeobj.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Quick Reference
147147
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
148148
| :c:member:`~PyTypeObject.tp_vectorcall` | :c:type:`vectorcallfunc` | | | | | |
149149
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
150-
| [:c:member:`~PyTypeObject.tp_watched`] | char | | | | | |
150+
| [:c:member:`~PyTypeObject.tp_watched`] | unsigned char | | | | | |
151151
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
152152

153153
.. [#slots]
@@ -2141,7 +2141,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
21412141
.. versionadded:: 3.9 (the field exists since 3.8 but it's only used since 3.9)
21422142

21432143

2144-
.. c:member:: char PyTypeObject.tp_watched
2144+
.. c:member:: unsigned char PyTypeObject.tp_watched
21452145
21462146
Internal. Do not use.
21472147

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
('c:func', 'sprintf'),
9595
('c:func', 'stat'),
9696
('c:func', 'system'),
97+
('c:func', 'time'),
9798
('c:func', 'vsnprintf'),
9899
# Standard C types
99100
('c:type', 'FILE'),

Doc/data/python3.12.abi

Lines changed: 26457 additions & 26464 deletions
Large diffs are not rendered by default.

Doc/includes/typestruct.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@ typedef struct _typeobject {
8282
vectorcallfunc tp_vectorcall;
8383

8484
/* bitset of which type-watchers care about this type */
85-
char tp_watched;
85+
unsigned char tp_watched;
8686
} PyTypeObject;

Doc/library/ctypes.rst

Lines changed: 43 additions & 42 deletions
Large diffs are not rendered by default.

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ Doc/library/configparser.rst
6969
Doc/library/contextlib.rst
7070
Doc/library/copy.rst
7171
Doc/library/csv.rst
72-
Doc/library/ctypes.rst
7372
Doc/library/datetime.rst
7473
Doc/library/dbm.rst
7574
Doc/library/decimal.rst

Include/cpython/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ struct _typeobject {
227227
vectorcallfunc tp_vectorcall;
228228

229229
/* bitset of which type-watchers care about this type */
230-
char tp_watched;
230+
unsigned char tp_watched;
231231
};
232232

233233
/* This struct is used by the specializer

Include/internal/pycore_object.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ _PyType_HasFeature(PyTypeObject *type, unsigned long feature) {
152152

153153
extern void _PyType_InitCache(PyInterpreterState *interp);
154154

155+
extern void _PyObject_InitState(PyInterpreterState *interp);
155156

156157
/* Inline functions trading binary compatibility for speed:
157158
_PyObject_Init() is the fast version of PyObject_Init(), and
@@ -271,8 +272,8 @@ extern void _PyDebug_PrintTotalRefs(void);
271272

272273
#ifdef Py_TRACE_REFS
273274
extern void _Py_AddToAllObjects(PyObject *op, int force);
274-
extern void _Py_PrintReferences(FILE *);
275-
extern void _Py_PrintReferenceAddresses(FILE *);
275+
extern void _Py_PrintReferences(PyInterpreterState *, FILE *);
276+
extern void _Py_PrintReferenceAddresses(PyInterpreterState *, FILE *);
276277
#endif
277278

278279

Include/internal/pycore_object_state.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@ extern "C" {
1111
struct _py_object_runtime_state {
1212
#ifdef Py_REF_DEBUG
1313
Py_ssize_t interpreter_leaks;
14-
#else
15-
int _not_used;
1614
#endif
15+
int _not_used;
1716
};
1817

1918
struct _py_object_state {
2019
#ifdef Py_REF_DEBUG
2120
Py_ssize_t reftotal;
22-
#else
23-
int _not_used;
2421
#endif
22+
#ifdef Py_TRACE_REFS
23+
/* Head of circular doubly-linked list of all objects. These are linked
24+
* together via the _ob_prev and _ob_next members of a PyObject, which
25+
* exist only in a Py_TRACE_REFS build.
26+
*/
27+
PyObject refchain;
28+
#endif
29+
int _not_used;
2530
};
2631

2732

Include/internal/pycore_runtime_init.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ extern PyTypeObject _PyExc_MemoryError;
101101
{ .threshold = 10, }, \
102102
}, \
103103
}, \
104+
.object_state = _py_object_state_INIT(INTERP), \
104105
.dtoa = _dtoa_state_INIT(&(INTERP)), \
105106
.dict_state = _dict_state_INIT, \
106107
.func_state = { \
@@ -130,6 +131,16 @@ extern PyTypeObject _PyExc_MemoryError;
130131
.context_ver = 1, \
131132
}
132133

134+
#ifdef Py_TRACE_REFS
135+
# define _py_object_state_INIT(INTERP) \
136+
{ \
137+
.refchain = {&INTERP.object_state.refchain, &INTERP.object_state.refchain}, \
138+
}
139+
#else
140+
# define _py_object_state_INIT(INTERP) \
141+
{ 0 }
142+
#endif
143+
133144

134145
// global objects
135146

Lib/doctest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ def _find_lineno(self, obj, source_lines):
11101110
if source_lines is None:
11111111
return None
11121112
pat = re.compile(r'^\s*class\s*%s\b' %
1113-
getattr(obj, '__name__', '-'))
1113+
re.escape(getattr(obj, '__name__', '-')))
11141114
for i, line in enumerate(source_lines):
11151115
if pat.match(line):
11161116
lineno = i

Lib/multiprocessing/spawn.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ def _check_not_importing_main():
150150
...
151151
152152
The "freeze_support()" line can be omitted if the program
153-
is not going to be frozen to produce an executable.''')
153+
is not going to be frozen to produce an executable.
154+
155+
To fix this issue, refer to the "Safe importing of main module"
156+
section in https://docs.python.org/3/library/multiprocessing.html
157+
''')
154158

155159

156160
def get_preparation_data(name):

Lib/re/_compiler.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,6 @@ def _compile(code, pattern, flags):
100100
emit(ANY_ALL)
101101
else:
102102
emit(ANY)
103-
elif op is POSSESSIVE_REPEAT:
104-
# gh-106052: Possessive quantifiers do not work when the
105-
# subpattern contains backtracking, i.e. "(?:ab?c)*+".
106-
# Implement it as equivalent greedy qualifier in atomic group.
107-
p = [(MAX_REPEAT, av)]
108-
p = [(ATOMIC_GROUP, p)]
109-
_compile(code, p, flags)
110103
elif op in REPEATING_CODES:
111104
if flags & SRE_FLAG_TEMPLATE:
112105
raise error("internal: unsupported template operator %r" % (op,))

Lib/shutil.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,10 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0,
11561156
supports_root_dir = getattr(func, 'supports_root_dir', False)
11571157
save_cwd = None
11581158
if root_dir is not None:
1159+
stmd = os.stat(root_dir).st_mode
1160+
if not stat.S_ISDIR(stmd):
1161+
raise NotADirectoryError(errno.ENOTDIR, 'Not a directory', root_dir)
1162+
11591163
if supports_root_dir:
11601164
# Support path-like base_name here for backwards-compatibility.
11611165
base_name = os.fspath(base_name)

Lib/test/test_bytes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ def do_tests(setitem):
13541354
except ValueError:
13551355
pass
13561356
try:
1357-
setitem(b, 0, None)
1357+
setitem(b, 0, object())
13581358
self.fail("Didn't raise TypeError")
13591359
except TypeError:
13601360
pass

0 commit comments

Comments
 (0)