Skip to content

Commit

Permalink
Merge branch 'main' into patch-3
Browse files Browse the repository at this point in the history
  • Loading branch information
Evorage authored Jun 6, 2022
2 parents 5b262f7 + 8584981 commit 6aedc77
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Doc/library/asyncio-sync.rst
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ Barrier

Put the barrier into a broken state. This causes any active or future
calls to :meth:`wait` to fail with the :class:`BrokenBarrierError`.
Use this for example if one of the taks needs to abort, to avoid infinite
Use this for example if one of the tasks needs to abort, to avoid infinite
waiting tasks.

.. attribute:: parties
Expand Down
55 changes: 55 additions & 0 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,61 @@ Deprecated
==========


Pending Removal in Python 3.13
==============================

The following modules and APIs have been deprecated in earlier Python releases,
and will be removed in Python 3.13.

Modules (see :pep:`594`):

* :mod:`aifc`
* :mod:`audioop`
* :mod:`cgi`
* :mod:`cgitb`
* :mod:`chunk`
* :mod:`crypt`
* :mod:`imghdr`
* :mod:`mailcap`
* :mod:`msilib`
* :mod:`nis`
* :mod:`nntplib`
* :mod:`ossaudiodev`
* :mod:`pipes`
* :mod:`sndhdr`
* :mod:`spwd`
* :mod:`sunau`
* :mod:`telnetlib`
* :mod:`uu`
* :mod:`xdrlib`

APIs:

* :class:`configparser.LegacyInterpolation` (:gh:`90765`)
* :func:`locale.getdefaultlocale` (:gh:`90817`)
* :meth:`turtle.RawTurtle.settiltangle` (:gh:`50096`)
* :func:`unittest.findTestCases` (:gh:`50096`)
* :func:`unittest.makeSuite` (:gh:`50096`)
* :func:`unittest.getTestCaseNames` (:gh:`50096`)
* :class:`webbrowser.MacOSX` (:gh:`86421`)

Pending Removal in Future Versions
==================================

The following APIs were deprecated in earlier Python versions and will be removed,
although there is currently no date scheduled for their removal.

* :class:`typing.Text` (:gh:`92332`)

* Currently Python accepts numeric literals immediately followed by keywords,
for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing
and ambiguous expressions like ``[0x1for x in y]`` (which can be
interpreted as ``[0x1 for x in y]`` or ``[0x1f or x in y]``).
A syntax warning is raised if the numeric literal is
immediately followed by one of keywords :keyword:`and`, :keyword:`else`,
:keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`.
In a future release it will be changed to a syntax error. (:gh:`87999`)


Removed
=======
Expand Down
5 changes: 4 additions & 1 deletion Lib/test/support/os_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,10 @@ def create_empty_file(filename):
def open_dir_fd(path):
"""Open a file descriptor to a directory."""
assert os.path.isdir(path)
dir_fd = os.open(path, os.O_RDONLY)
flags = os.O_RDONLY
if hasattr(os, "O_DIRECTORY"):
flags |= os.O_DIRECTORY
dir_fd = os.open(path, flags)
try:
yield dir_fd
finally:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asyncio/test_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ async def c4(result):
self.assertTrue(t1.result())
race_tasks = [t2, t3, t4]
done_tasks = [t for t in race_tasks if t.done() and t.result()]
self.assertTrue(2, len(done_tasks))
self.assertEqual(2, len(done_tasks))

# cleanup locked semaphore
sem.release()
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -3993,7 +3993,7 @@ class PathTConverterTests(unittest.TestCase):
('access', False, (os.F_OK,), None),
('chflags', False, (0,), None),
('lchflags', False, (0,), None),
('open', False, (0,), getattr(os, 'close', None)),
('open', False, (os.O_RDONLY,), getattr(os, 'close', None)),
]

def test_path_t_converter(self):
Expand Down Expand Up @@ -4365,6 +4365,7 @@ def test_fd(self):
st = os.stat(entry.name, dir_fd=fd, follow_symlinks=False)
self.assertEqual(entry.stat(follow_symlinks=False), st)

@unittest.skipIf(support.is_wasi, "WASI maps '' to cwd")
def test_empty_path(self):
self.assertRaises(FileNotFoundError, os.scandir, '')

Expand Down
11 changes: 9 additions & 2 deletions Lib/test/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
os_helper.TESTFN + '-dummy-symlink')

requires_32b = unittest.skipUnless(
# Emscripten has 32 bits pointers, but support 64 bits syscall args.
sys.maxsize < 2**32 and not support.is_emscripten,
# Emscripten/WASI have 32 bits pointers, but support 64 bits syscall args.
sys.maxsize < 2**32 and not (support.is_emscripten or support.is_wasi),
'test is only meaningful on 32-bit builds'
)

Expand Down Expand Up @@ -547,6 +547,7 @@ def test_readv_overflow_32bits(self):

@unittest.skipUnless(hasattr(posix, 'dup'),
'test needs posix.dup()')
@unittest.skipIf(support.is_wasi, "WASI does not have dup()")
def test_dup(self):
fp = open(os_helper.TESTFN)
try:
Expand All @@ -564,6 +565,7 @@ def test_confstr(self):

@unittest.skipUnless(hasattr(posix, 'dup2'),
'test needs posix.dup2()')
@unittest.skipIf(support.is_wasi, "WASI does not have dup2()")
def test_dup2(self):
fp1 = open(os_helper.TESTFN)
fp2 = open(os_helper.TESTFN)
Expand Down Expand Up @@ -1212,6 +1214,7 @@ def test_sched_setaffinity(self):
# bpo-47205: does not raise OSError on FreeBSD
self.assertRaises(OSError, posix.sched_setaffinity, -1, mask)

@unittest.skipIf(support.is_wasi, "No dynamic linking on WASI")
def test_rtld_constants(self):
# check presence of major RTLD_* constants
posix.RTLD_LAZY
Expand Down Expand Up @@ -1406,6 +1409,10 @@ def test_utime_dir_fd(self):
# whoops! using both together not supported on this platform.
pass

@unittest.skipIf(
support.is_wasi,
"WASI: symlink following on path_link is not supported"
)
@unittest.skipUnless(
hasattr(os, "link") and os.link in os.supports_dir_fd,
"test needs dir_fd support in os.link()"
Expand Down
3 changes: 3 additions & 0 deletions Tools/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ are:
call read/write/accept on a file descriptor that is passed into the process.
- ``socket.gethostname()`` and host name resolution APIs like
``socket.gethostbyname()`` are not implemented and always fail.
- ``open(2)`` checks flags more strictly. Caller must pass either
``O_RDONLY``, ``O_RDWR``, or ``O_WDONLY`` to ``os.open``. Directory file
descriptors must be created with flags ``O_RDONLY | O_DIRECTORY``.
- ``chmod(2)`` is not available. It's not possible to modify file permissions,
yet. A future version of WASI may provide a limited ``set_permissions`` API.
- User/group related features like ``os.chown()``, ``os.getuid``, etc. are
Expand Down

0 comments on commit 6aedc77

Please sign in to comment.