Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Doc/c-api/frame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ See also :ref:`Reflection <reflection>`.
Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer
frame.
This raises no exceptions.
.. versionadded:: 3.9
Expand Down
46 changes: 46 additions & 0 deletions Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1499,6 +1499,52 @@ and :c:data:`PyType_Type` effectively act as defaults.)
It will be removed in a future version of CPython


.. c:macro:: Py_TPFLAGS_HAVE_VERSION_TAG

This is a :term:`soft deprecated` macro that does nothing.
Historically, this would indicate that the
:c:member:`~PyTypeObject.tp_version_tag` field was available and
initialized.


.. c:macro:: Py_TPFLAGS_INLINE_VALUES

This bit indicates that instances of this type will have an "inline values"
array (containing the object's attributes) placed directly after the end
of the object.

This requires that :c:macro:`Py_TPFLAGS_HAVE_GC` is set.

**Inheritance:**

This flag is not inherited.

.. versionadded:: 3.13


.. c:macro:: Py_TPFLAGS_IS_ABSTRACT

This bit indicates that this is an abstract type and therefore cannot
be instantiated.

**Inheritance:**

This flag is not inherited.

.. seealso::
:mod:`abc`


.. c:macro:: Py_TPFLAGS_HAVE_STACKLESS_EXTENSION

Internal. Do not set or unset this flag.
Historically, this was a reserved flag for use in Stackless Python.

.. warning::
This flag is present in header files, but is not be used.
This may be removed in a future version of CPython.


.. c:member:: const char* PyTypeObject.tp_doc

.. corresponding-type-slot:: Py_tp_doc
Expand Down
1 change: 1 addition & 0 deletions Doc/deprecations/pending-removal-in-3.20.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Pending removal in Python 3.20
- :mod:`re`
- :mod:`socketserver`
- :mod:`tabnanny`
- :mod:`tarfile`
- :mod:`tkinter.font`
- :mod:`tkinter.ttk`
- :mod:`wsgiref.simple_server`
Expand Down
2 changes: 1 addition & 1 deletion Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2256,7 +2256,7 @@ Basic customization
This is intended to provide protection against a denial-of-service caused
by carefully chosen inputs that exploit the worst case performance of a
dict insertion, *O*\ (*n*\ :sup:`2`) complexity. See
http://ocert.org/advisories/ocert-2011-003.html for details.
https://ocert.org/advisories/ocert-2011-003.html for details.

Changing hash values affects the iteration order of sets.
Python has never made guarantees about this ordering
Expand Down
2 changes: 1 addition & 1 deletion Doc/using/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Miscellaneous options
Hash randomization is intended to provide protection against a
denial-of-service caused by carefully chosen inputs that exploit the worst
case performance of a dict construction, *O*\ (*n*\ :sup:`2`) complexity. See
http://ocert.org/advisories/ocert-2011-003.html for details.
https://ocert.org/advisories/ocert-2011-003.html for details.

:envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash
seed secret.
Expand Down
1 change: 1 addition & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,7 @@ New deprecations
- :mod:`re`
- :mod:`socketserver`
- :mod:`tabnanny`
- :mod:`tarfile`
- :mod:`tkinter.font`
- :mod:`tkinter.ttk`
- :mod:`wsgiref.simple_server`
Expand Down
11 changes: 10 additions & 1 deletion Lib/tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"""Read from and write to tar format archives.
"""

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

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


def __getattr__(name):
if name == "version":
from warnings import _deprecated

_deprecated("version", remove=(3, 20))
return "0.9.0" # Do not change
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


if __name__ == '__main__':
main()
16 changes: 16 additions & 0 deletions Lib/test/test_free_threading/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ def reader_func():
for reader in readers:
reader.join()

def test_maketrans_dict_concurrent_modification(self):
for _ in range(5):
d = {2000: 'a'}

def work(dct):
for i in range(100):
str.maketrans(dct)
dct[2000 + i] = chr(i % 16)
dct.pop(2000 + i, None)

threading_helper.run_concurrently(
work,
nthreads=5,
args=(d,),
)


if __name__ == "__main__":
unittest.main()
8 changes: 8 additions & 0 deletions Lib/test/test_py_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@ def test_quiet(self):
with self.assertRaises(py_compile.PyCompileError):
py_compile.compile(bad_coding, self.pyc_path, doraise=True, quiet=1)

def test_utf7_decoded_cr_compiles(self):
with open(self.source_path, 'wb') as file:
file.write(b"#coding=U7+AA0''\n")

pyc_path = py_compile.compile(self.source_path, self.pyc_path, doraise=True)
self.assertEqual(pyc_path, self.pyc_path)
self.assertTrue(os.path.exists(self.pyc_path))


class PyCompileTestsWithSourceEpoch(PyCompileTestsBase,
unittest.TestCase,
Expand Down
10 changes: 10 additions & 0 deletions Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4836,6 +4836,16 @@ def test_ignore_invalid_offset_headers(self):
self.assertEqual(members[0].offset, expected_offset)


class TestModule(unittest.TestCase):
def test_deprecated_version(self):
with self.assertWarnsRegex(
DeprecationWarning,
"'version' is deprecated and slated for removal in Python 3.20",
) as cm:
getattr(tarfile, "version")
self.assertEqual(cm.filename, __file__)


def setUpModule():
os_helper.unlink(TEMPDIR)
os.makedirs(TEMPDIR)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a crash in the free-threaded build when the dictionary argument to
:meth:`str.maketrans` is concurrently modified.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fixed a ``SystemError`` in the parser when an encoding cookie (for example,
UTF-7) decodes to carriage returns (``\r``). Newlines are now normalized after
decoding in the string tokenizer.

Patch by Pablo Galindo.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The ``version`` attribute of the :mod:`tarfile` module is deprecated and
slated for removal in Python 3.20.
79 changes: 65 additions & 14 deletions Modules/_testinternalcapi/clinic/test_lock.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading