Skip to content

Commit a4189c0

Browse files
Merge branch 'main' into docs/cached-deprecation-fix
2 parents 94d0199 + 11eec7a commit a4189c0

File tree

14 files changed

+139
-52
lines changed

14 files changed

+139
-52
lines changed

Doc/c-api/frame.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ See also :ref:`Reflection <reflection>`.
5050
5151
Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer
5252
frame.
53+
This raises no exceptions.
5354
5455
.. versionadded:: 3.9
5556

Doc/c-api/typeobj.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,52 @@ and :c:data:`PyType_Type` effectively act as defaults.)
14991499
It will be removed in a future version of CPython
15001500

15011501

1502+
.. c:macro:: Py_TPFLAGS_HAVE_VERSION_TAG
1503+
1504+
This is a :term:`soft deprecated` macro that does nothing.
1505+
Historically, this would indicate that the
1506+
:c:member:`~PyTypeObject.tp_version_tag` field was available and
1507+
initialized.
1508+
1509+
1510+
.. c:macro:: Py_TPFLAGS_INLINE_VALUES
1511+
1512+
This bit indicates that instances of this type will have an "inline values"
1513+
array (containing the object's attributes) placed directly after the end
1514+
of the object.
1515+
1516+
This requires that :c:macro:`Py_TPFLAGS_HAVE_GC` is set.
1517+
1518+
**Inheritance:**
1519+
1520+
This flag is not inherited.
1521+
1522+
.. versionadded:: 3.13
1523+
1524+
1525+
.. c:macro:: Py_TPFLAGS_IS_ABSTRACT
1526+
1527+
This bit indicates that this is an abstract type and therefore cannot
1528+
be instantiated.
1529+
1530+
**Inheritance:**
1531+
1532+
This flag is not inherited.
1533+
1534+
.. seealso::
1535+
:mod:`abc`
1536+
1537+
1538+
.. c:macro:: Py_TPFLAGS_HAVE_STACKLESS_EXTENSION
1539+
1540+
Internal. Do not set or unset this flag.
1541+
Historically, this was a reserved flag for use in Stackless Python.
1542+
1543+
.. warning::
1544+
This flag is present in header files, but is not be used.
1545+
This may be removed in a future version of CPython.
1546+
1547+
15021548
.. c:member:: const char* PyTypeObject.tp_doc
15031549
15041550
.. corresponding-type-slot:: Py_tp_doc

Doc/reference/datamodel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2254,7 +2254,7 @@ Basic customization
22542254
This is intended to provide protection against a denial-of-service caused
22552255
by carefully chosen inputs that exploit the worst case performance of a
22562256
dict insertion, *O*\ (*n*\ :sup:`2`) complexity. See
2257-
http://ocert.org/advisories/ocert-2011-003.html for details.
2257+
https://ocert.org/advisories/ocert-2011-003.html for details.
22582258

22592259
Changing hash values affects the iteration order of sets.
22602260
Python has never made guarantees about this ordering

Doc/using/cmdline.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ Miscellaneous options
390390
Hash randomization is intended to provide protection against a
391391
denial-of-service caused by carefully chosen inputs that exploit the worst
392392
case performance of a dict construction, *O*\ (*n*\ :sup:`2`) complexity. See
393-
http://ocert.org/advisories/ocert-2011-003.html for details.
393+
https://ocert.org/advisories/ocert-2011-003.html for details.
394394

395395
:envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash
396396
seed secret.

Lib/locale.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,6 @@ def _getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
570570
except (ImportError, AttributeError):
571571
pass
572572
else:
573-
# make sure the code/encoding values are valid
574-
if sys.platform == "win32" and code and code[:2] == "0x":
575-
# map windows language identifier to language name
576-
code = windows_locale.get(int(code, 0))
577573
# ...add other platform-specific processing here, if
578574
# necessary...
579575
return code, encoding

Lib/test/test_free_threading/test_str.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,22 @@ def reader_func():
6969
for reader in readers:
7070
reader.join()
7171

72+
def test_maketrans_dict_concurrent_modification(self):
73+
for _ in range(5):
74+
d = {2000: 'a'}
75+
76+
def work(dct):
77+
for i in range(100):
78+
str.maketrans(dct)
79+
dct[2000 + i] = chr(i % 16)
80+
dct.pop(2000 + i, None)
81+
82+
threading_helper.run_concurrently(
83+
work,
84+
nthreads=5,
85+
args=(d,),
86+
)
87+
7288

7389
if __name__ == "__main__":
7490
unittest.main()

Lib/test/test_py_compile.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ def test_quiet(self):
239239
with self.assertRaises(py_compile.PyCompileError):
240240
py_compile.compile(bad_coding, self.pyc_path, doraise=True, quiet=1)
241241

242+
def test_utf7_decoded_cr_compiles(self):
243+
with open(self.source_path, 'wb') as file:
244+
file.write(b"#coding=U7+AA0''\n")
245+
246+
pyc_path = py_compile.compile(self.source_path, self.pyc_path, doraise=True)
247+
self.assertEqual(pyc_path, self.pyc_path)
248+
self.assertTrue(os.path.exists(self.pyc_path))
249+
242250

243251
class PyCompileTestsWithSourceEpoch(PyCompileTestsBase,
244252
unittest.TestCase,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a crash in the free-threaded build when the dictionary argument to
2+
:meth:`str.maketrans` is concurrently modified.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Fixed a ``SystemError`` in the parser when an encoding cookie (for example,
2+
UTF-7) decodes to carriage returns (``\r``). Newlines are now normalized after
3+
decoding in the string tokenizer.
4+
5+
Patch by Pablo Galindo.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed Windows 95 compatibility for :func:`locale.getdefaultlocale`.

0 commit comments

Comments
 (0)