Skip to content

Commit b596867

Browse files
Merge branch 'main' into fix-compression-block-decompress-error-handling
2 parents 433d43f + 4d89056 commit b596867

13 files changed

Lines changed: 136 additions & 37 deletions

File tree

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/deprecations/pending-removal-in-3.20.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Pending removal in Python 3.20
2121
- :mod:`re`
2222
- :mod:`socketserver`
2323
- :mod:`tabnanny`
24+
- :mod:`tarfile`
2425
- :mod:`tkinter.font`
2526
- :mod:`tkinter.ttk`
2627
- :mod:`wsgiref.simple_server`

Doc/reference/datamodel.rst

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

22612261
Changing hash values affects the iteration order of sets.
22622262
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.

Doc/whatsnew/3.15.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,7 @@ New deprecations
15491549
- :mod:`re`
15501550
- :mod:`socketserver`
15511551
- :mod:`tabnanny`
1552+
- :mod:`tarfile`
15521553
- :mod:`tkinter.font`
15531554
- :mod:`tkinter.ttk`
15541555
- :mod:`wsgiref.simple_server`

Lib/tarfile.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"""Read from and write to tar format archives.
2929
"""
3030

31-
version = "0.9.0"
3231
__author__ = "Lars Gust\u00e4bel (lars@gustaebel.de)"
3332
__credits__ = "Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend."
3433

@@ -3137,5 +3136,15 @@ def main():
31373136
if args.verbose:
31383137
print('{!r} file created.'.format(tar_name))
31393138

3139+
3140+
def __getattr__(name):
3141+
if name == "version":
3142+
from warnings import _deprecated
3143+
3144+
_deprecated("version", remove=(3, 20))
3145+
return "0.9.0" # Do not change
3146+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
3147+
3148+
31403149
if __name__ == '__main__':
31413150
main()

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_tarfile.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4836,6 +4836,16 @@ def test_ignore_invalid_offset_headers(self):
48364836
self.assertEqual(members[0].offset, expected_offset)
48374837

48384838

4839+
class TestModule(unittest.TestCase):
4840+
def test_deprecated_version(self):
4841+
with self.assertWarnsRegex(
4842+
DeprecationWarning,
4843+
"'version' is deprecated and slated for removal in Python 3.20",
4844+
) as cm:
4845+
getattr(tarfile, "version")
4846+
self.assertEqual(cm.filename, __file__)
4847+
4848+
48394849
def setUpModule():
48404850
os_helper.unlink(TEMPDIR)
48414851
os.makedirs(TEMPDIR)
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.

0 commit comments

Comments
 (0)