Skip to content

Commit

Permalink
Merge branch 'main' into docs/dbm-bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland committed Jan 31, 2024
2 parents b92fbce + b25b746 commit 7563706
Show file tree
Hide file tree
Showing 31 changed files with 263 additions and 160 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ Doc/c-api/stable.rst @encukou
**/*zipfile/_path/* @jaraco

# Argument Clinic
/Tools/clinic/** @erlend-aasland @AlexWaygood
/Lib/test/test_clinic.py @erlend-aasland @AlexWaygood
/Tools/clinic/** @erlend-aasland
/Lib/test/test_clinic.py @erlend-aasland
Doc/howto/clinic.rst @erlend-aasland

# Subinterpreters
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/jit.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
name: JIT
on:
pull_request:
paths: '**jit**'
paths:
- '**jit**'
- 'Python/bytecodes.c'
push:
paths: '**jit**'
paths:
- '**jit**'
- 'Python/bytecodes.c'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
jit:
name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }})
Expand All @@ -16,6 +25,7 @@ jobs:
- i686-pc-windows-msvc/msvc
- x86_64-pc-windows-msvc/msvc
- x86_64-apple-darwin/clang
- aarch64-apple-darwin/clang
- x86_64-unknown-linux-gnu/gcc
- x86_64-unknown-linux-gnu/clang
- aarch64-unknown-linux-gnu/gcc
Expand All @@ -36,9 +46,12 @@ jobs:
compiler: msvc
- target: x86_64-apple-darwin/clang
architecture: x86_64
runner: macos-latest
runner: macos-13
compiler: clang
- target: aarch64-apple-darwin/clang
architecture: aarch64
runner: macos-14
compiler: clang
exclude: test_embed
- target: x86_64-unknown-linux-gnu/gcc
architecture: x86_64
runner: ubuntu-latest
Expand Down Expand Up @@ -80,7 +93,7 @@ jobs:
brew install llvm@${{ matrix.llvm }}
export SDKROOT="$(xcrun --show-sdk-path)"
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
make all --jobs 3
make all --jobs 4
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
- name: Native Linux
Expand All @@ -91,6 +104,7 @@ jobs:
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
make all --jobs 4
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
- name: Emulated Linux
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/require-pr-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ permissions:
jobs:
label:
name: DO-NOT-MERGE / unresolved review
if: github.repository_owner == 'python'
runs-on: ubuntu-latest
timeout-minutes: 10

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,5 @@ Python/frozen_modules/MANIFEST
/python
!/Python/

# main branch only: ABI files are not checked/maintained
# main branch only: ABI files are not checked/maintained.
Doc/data/python*.abi
115 changes: 55 additions & 60 deletions Doc/library/dbm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ the Oracle Berkeley DB.
.. |flag_n| replace::
Always create a new, empty database, open for reading and writing.

.. |mode_param_doc| replace::
The Unix file access mode of the file (default: octal ``0o666``),
used only when the database has to be created.

.. |incompat_note| replace::
The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are incompatible
and can not be used interchangeably.
Expand All @@ -69,14 +73,13 @@ the Oracle Berkeley DB.
:type file: :term:`path-like object`

:param str flag:
* ``'r'`` (default), |flag_r|
* ``'w'``, |flag_w|
* ``'c'``, |flag_c|
* ``'n'``, |flag_n|
* ``'r'`` (default): |flag_r|
* ``'w'``: |flag_w|
* ``'c'``: |flag_c|
* ``'n'``: |flag_n|

:param int mode:
The Unix file access mode of the file (default: octal ``0o666``),
used only when the database has to be created.
|mode_param_doc|

.. versionchanged:: 3.11
*file* accepts a :term:`path-like object`.
Expand Down Expand Up @@ -167,49 +170,47 @@ functionality like crash tolerance.

.. function:: open(filename, flag="r", mode=0o666, /)

Open a GDBM database and return a :class:`!gdbm` object. The *filename*
argument is the name of the database file.
Open a GDBM database and return a :class:`!gdbm` object.

The optional *flag* argument can be:
:param filename:
The database file to open.
:type filename: :term:`path-like object`

:param str flag:
* ``'r'`` (default): |flag_r|
* ``'w'``: |flag_w|
* ``'c'``: |flag_c|
* ``'n'``: |flag_n|

.. csv-table::
:header: "Value", "Meaning"
The following additional characters may be appended
to control how the database is opened:

``'r'`` (default), |flag_r|
``'w'``, |flag_w|
``'c'``, |flag_c|
``'n'``, |flag_n|
* ``'f'``: Open the database in fast mode.
Writes to the database will not be synchronized.
* ``'s'``: Synchronized mode.
Changes to the database will be written immediately to the file.
* ``'u'``: Do not lock database.

The following additional characters may be appended to the flag to control
how the database is opened:
Not all flags are valid for all versions of GDBM.
See the :data:`open_flags` member for a list of supported flag characters.

+---------+--------------------------------------------+
| Value | Meaning |
+=========+============================================+
| ``'f'`` | Open the database in fast mode. Writes |
| | to the database will not be synchronized. |
+---------+--------------------------------------------+
| ``'s'`` | Synchronized mode. This will cause changes |
| | to the database to be immediately written |
| | to the file. |
+---------+--------------------------------------------+
| ``'u'`` | Do not lock database. |
+---------+--------------------------------------------+
:param int mode:
|mode_param_doc|

:raises error:
If an invalid *flag* argument is passed.

.. versionchanged:: 3.11
*filename* accepts a :term:`path-like object`.

Not all flags are valid for all versions of GDBM. The module constant
:const:`open_flags` is a string of supported flag characters. The exception
:exc:`error` is raised if an invalid flag is specified.
.. data:: open_flags

The optional *mode* argument is the Unix mode of the file, used only when the
database has to be created. It defaults to octal ``0o666``.
A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` supports.

:class:`!gdbm` objects behave similar to :term:`mappings <mapping>`,
but :meth:`!items` and :meth:`!values` methods are not supported.
The following methods are also provided:

.. versionchanged:: 3.11
Accepts :term:`path-like object` for filename.

.. method:: gdbm.firstkey()

It's possible to loop over every key in the database using this method and the
Expand Down Expand Up @@ -291,22 +292,20 @@ This module can be used with the "classic" NDBM interface or the
.. function:: open(filename, flag="r", mode=0o666, /)

Open an NDBM database and return an :class:`!ndbm` object.
The *filename* argument is the name of the database file
(without the :file:`.dir` or :file:`.pag` extensions).

The optional *flag* argument must be one of these values:

.. csv-table::
:header: "Value", "Meaning"
:param filename:
The basename of the database file
(without the :file:`.dir` or :file:`.pag` extensions).
:type filename: :term:`path-like object`

``'r'`` (default), |flag_r|
``'w'``, |flag_w|
``'c'``, |flag_c|
``'n'``, |flag_n|
:param str flag:
* ``'r'`` (default): |flag_r|
* ``'w'``: |flag_w|
* ``'c'``: |flag_c|
* ``'n'``: |flag_n|

The optional *mode* argument is the Unix mode of the file, used only when the
database has to be created. It defaults to octal ``0o666`` (and will be
modified by the prevailing umask).
:param int mode:
|mode_param_doc|

:class:`!ndbm` objects behave similar to :term:`mappings <mapping>`,
but :meth:`!items` and :meth:`!values` methods are not supported.
Expand Down Expand Up @@ -374,25 +373,21 @@ The :mod:`!dbm.dumb` module defines the following:
:type database: :term:`path-like object`

:param str flag:
.. csv-table::
:header: "Value", "Meaning"

``'r'``, |flag_r|
``'w'``, |flag_w|
``'c'`` (default), |flag_c|
``'n'``, |flag_n|
* ``'r'``: |flag_r|
* ``'w'``: |flag_w|
* ``'c'`` (default): |flag_c|
* ``'n'``: |flag_n|

:param int mode:
The Unix file access mode of the file (default: ``0o666``),
used only when the database has to be created.
|mode_param_doc|

.. warning::
It is possible to crash the Python interpreter when loading a database
with a sufficiently large/complex entry due to stack depth limitations in
Python's AST compiler.

.. versionchanged:: 3.5
:func:`open` always creates a new database when *flag* is ``'n'``.
:func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``.

.. versionchanged:: 3.8
A database opened read-only if *flag* is ``'r'``.
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/test.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ guidelines to be followed:
arg = (1, 2, 3)

When using this pattern, remember that all classes that inherit from
:class:`unittest.TestCase` are run as tests. The :class:`Mixin` class in the example above
:class:`unittest.TestCase` are run as tests. The :class:`!TestFuncAcceptsSequencesMixin` class in the example above
does not have any data and so can't be run by itself, thus it does not
inherit from :class:`unittest.TestCase`.

Expand Down
6 changes: 3 additions & 3 deletions Lib/_pydatetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@ def fromtimestamp(cls, timestamp, tz=None):
def utcfromtimestamp(cls, t):
"""Construct a naive UTC datetime from a POSIX timestamp."""
import warnings
warnings.warn("datetime.utcfromtimestamp() is deprecated and scheduled "
warnings.warn("datetime.datetime.utcfromtimestamp() is deprecated and scheduled "
"for removal in a future version. Use timezone-aware "
"objects to represent datetimes in UTC: "
"datetime.datetime.fromtimestamp(t, datetime.UTC).",
Expand All @@ -1827,8 +1827,8 @@ def now(cls, tz=None):
def utcnow(cls):
"Construct a UTC datetime from time.time()."
import warnings
warnings.warn("datetime.utcnow() is deprecated and scheduled for "
"removal in a future version. Instead, Use timezone-aware "
warnings.warn("datetime.datetime.utcnow() is deprecated and scheduled for "
"removal in a future version. Use timezone-aware "
"objects to represent datetimes in UTC: "
"datetime.datetime.now(datetime.UTC).",
DeprecationWarning,
Expand Down
2 changes: 1 addition & 1 deletion Lib/mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ def _default_mime_types():
'.tiff' : 'image/tiff',
'.tif' : 'image/tiff',
'.ico' : 'image/vnd.microsoft.icon',
'.webp' : 'image/webp',
'.ras' : 'image/x-cmu-raster',
'.pnm' : 'image/x-portable-anymap',
'.pbm' : 'image/x-portable-bitmap',
Expand Down Expand Up @@ -587,7 +588,6 @@ def _default_mime_types():
'.pict': 'image/pict',
'.pct' : 'image/pict',
'.pic' : 'image/pict',
'.webp': 'image/webp',
'.xul' : 'text/xul',
}

Expand Down
5 changes: 2 additions & 3 deletions Lib/pathlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,8 @@ class Path(_abc.PathBase, PurePath):
as_uri = PurePath.as_uri

@classmethod
def _unsupported(cls, method_name):
msg = f"{cls.__name__}.{method_name}() is unsupported on this system"
raise UnsupportedOperation(msg)
def _unsupported_msg(cls, attribute):
return f"{cls.__name__}.{attribute} is unsupported on this system"

def __init__(self, *args, **kwargs):
if kwargs:
Expand Down
Loading

0 comments on commit 7563706

Please sign in to comment.