Skip to content

Commit

Permalink
Merge branch 'main' of github.com:python/cpython into pythongh-102251
Browse files Browse the repository at this point in the history
  • Loading branch information
sunmy2019 committed May 30, 2023
2 parents ea8e894 + d593074 commit 5dbb8c3
Show file tree
Hide file tree
Showing 359 changed files with 3,988 additions and 30,375 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ FROM docker.io/library/fedora:37

ENV CC=clang

ENV WASI_SDK_VERSION=19
ENV WASI_SDK_VERSION=20
ENV WASI_SDK_PATH=/opt/wasi-sdk

ENV WASMTIME_HOME=/opt/wasmtime
ENV WASMTIME_VERSION=7.0.0
ENV WASMTIME_VERSION=9.0.1
ENV WASMTIME_CPU_ARCH=x86_64

RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \
Expand Down
17 changes: 12 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"-y",
"which",
"zsh",
"fish"
"fish",
// For umask fix below.
"/usr/bin/setfacl"
],
"updateContentCommand": {
// Using the shell for `nproc` usage.
Expand All @@ -22,6 +24,11 @@
"html"
]
},
"postCreateCommand": {
// https://github.com/orgs/community/discussions/26026
"umask fix: workspace": ["sudo", "setfacl", "-bnR", "."],
"umask fix: /tmp": ["sudo", "setfacl", "-bnR", "/tmp"]
},
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -31,10 +38,10 @@
"maelvalais.autoconf",
// C auto-complete.
"ms-vscode.cpptools",
// To view built docs.
"ms-vscode.live-server"
// https://github.com/microsoft/vscode-python/issues/18073
// "ms-python.python"
// To view HTML build of docs.
"ms-vscode.live-server",
// Python auto-complete.
"ms-python.python"
],
"settings": {
"C_Cpp.default.compilerPath": "/usr/bin/clang",
Expand Down
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*.zip binary

# Specific binary files
Lib/test/sndhdrdata/sndhdr.* binary
PC/classicAppCompat.* binary

# Text files that should not be subject to eol conversion
Expand Down
81 changes: 74 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ permissions:
contents: read

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

jobs:
Expand All @@ -37,8 +37,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
run-docs: ${{ steps.docs-changes.outputs.run-docs || false }}
run_tests: ${{ steps.check.outputs.run_tests }}
run_hypothesis: ${{ steps.check.outputs.run_hypothesis }}
config_hash: ${{ steps.config_hash.outputs.hash }}
steps:
- uses: actions/checkout@v3
- name: Check for source changes
Expand Down Expand Up @@ -74,6 +76,32 @@ jobs:
echo "Run hypothesis tests"
echo "run_hypothesis=true" >> $GITHUB_OUTPUT
fi
- name: Compute hash for config cache key
id: config_hash
run: |
echo "hash=${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}" >> $GITHUB_OUTPUT
- name: Get a list of the changed documentation-related files
if: github.event_name == 'pull_request'
id: changed-docs-files
uses: Ana06/get-changed-files@v2.2.0
with:
filter: |
Doc/**
Misc/**
.github/workflows/reusable-docs.yml
- name: Check for docs changes
if: >-
github.event_name == 'pull_request'
&& steps.changed-docs-files.outputs.added_modified_renamed != ''
id: docs-changes
run: |
echo "run-docs=true" >> "${GITHUB_OUTPUT}"
check-docs:
name: Docs
needs: check_source
if: fromJSON(needs.check_source.outputs.run-docs)
uses: ./.github/workflows/reusable-docs.yml

check_generated_files:
name: 'Check if generated files are up to date'
Expand All @@ -83,6 +111,11 @@ jobs:
if: needs.check_source.outputs.run_tests == 'true'
steps:
- uses: actions/checkout@v3
- name: Restore config.cache
uses: actions/cache@v3
with:
path: config.cache
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
- uses: actions/setup-python@v3
- name: Install Dependencies
run: sudo ./.github/workflows/posix-deps-apt.sh
Expand All @@ -99,7 +132,7 @@ jobs:
- name: Configure CPython
run: |
# Build Python with the libpython dynamic library
./configure --with-pydebug --enable-shared
./configure --config-cache --with-pydebug --enable-shared
- name: Regenerate autoconf files with container image
run: make regen-configure
- name: Build CPython
Expand Down Expand Up @@ -180,6 +213,11 @@ jobs:
PYTHONSTRICTEXTENSIONBUILD: 1
steps:
- uses: actions/checkout@v3
- name: Restore config.cache
uses: actions/cache@v3
with:
path: config.cache
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
- name: Install Homebrew dependencies
run: brew install pkg-config openssl@1.1 xz gdbm tcl-tk
- name: Configure CPython
Expand All @@ -188,6 +226,7 @@ jobs:
LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
./configure \
--config-cache \
--with-pydebug \
--prefix=/opt/python-dev \
--with-openssl="$(brew --prefix openssl@1.1)"
Expand Down Expand Up @@ -240,9 +279,18 @@ jobs:
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
- name: Bind mount sources read-only
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
- name: Restore config.cache
uses: actions/cache@v3
with:
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
- name: Configure CPython out-of-tree
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
run: |
../cpython-ro-srcdir/configure \
--config-cache \
--with-pydebug \
--with-openssl=$OPENSSL_DIR
- name: Build CPython out-of-tree
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: make -j4
Expand Down Expand Up @@ -273,6 +321,11 @@ jobs:
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
steps:
- uses: actions/checkout@v3
- name: Restore config.cache
uses: actions/cache@v3
with:
path: config.cache
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
- name: Register gcc problem matcher
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
- name: Install Dependencies
Expand All @@ -297,7 +350,7 @@ jobs:
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1.2
- name: Configure CPython
run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR
run: ./configure --config-cache --with-pydebug --with-openssl=$OPENSSL_DIR
- name: Build CPython
run: make -j4
- name: Display build info
Expand All @@ -306,7 +359,7 @@ jobs:
run: ./python Lib/test/ssltests.py

test_hypothesis:
name: "Hypothesis Tests on Ubuntu"
name: "Hypothesis tests on Ubuntu"
runs-on: ubuntu-20.04
timeout-minutes: 60
needs: check_source
Expand Down Expand Up @@ -347,9 +400,18 @@ jobs:
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
- name: Bind mount sources read-only
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
- name: Restore config.cache
uses: actions/cache@v3
with:
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
- name: Configure CPython out-of-tree
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: ../cpython-ro-srcdir/configure --with-pydebug --with-openssl=$OPENSSL_DIR
run: |
../cpython-ro-srcdir/configure \
--config-cache \
--with-pydebug \
--with-openssl=$OPENSSL_DIR
- name: Build CPython out-of-tree
working-directory: ${{ env.CPYTHON_BUILDDIR }}
run: make -j4
Expand Down Expand Up @@ -417,6 +479,11 @@ jobs:
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
steps:
- uses: actions/checkout@v3
- name: Restore config.cache
uses: actions/cache@v3
with:
path: config.cache
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
- name: Register gcc problem matcher
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
- name: Install Dependencies
Expand Down Expand Up @@ -445,7 +512,7 @@ jobs:
- name: Configure ccache action
uses: hendrikmuhs/ccache-action@v1.2
- name: Configure CPython
run: ./configure --with-address-sanitizer --without-pymalloc
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
- name: Build CPython
run: make -j4
- name: Display build info
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build_msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ on:
- '3.*'
paths:
- 'Tools/msi/**'
- '.github/workflows/build_msi.yml'
pull_request:
branches:
- 'main'
- '3.*'
paths:
- 'Tools/msi/**'
- '.github/workflows/build_msi.yml'

permissions:
contents: read
Expand All @@ -33,4 +35,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build CPython installer
run: .\Tools\msi\build.bat -${{ matrix.type }}
run: .\Tools\msi\build.bat --doc -${{ matrix.type }}
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
name: Docs

on:
workflow_call:
workflow_dispatch:
#push:
# branches:
# - 'main'
# - '3.12'
# - '3.11'
# - '3.10'
# - '3.9'
# - '3.8'
# - '3.7'
# paths:
# - 'Doc/**'
pull_request:
branches:
- 'main'
- '3.12'
- '3.11'
- '3.10'
- '3.9'
- '3.8'
- '3.7'
paths:
- 'Doc/**'
- 'Misc/**'
- '.github/workflows/doc.yml'

permissions:
contents: read
Expand Down
14 changes: 14 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ build:
python: "3"

commands:
# https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition
#
# Cancel building pull requests when there aren't changes in the Doc directory.
#
# If there are no changes (git diff exits with 0) we force the command to return with 183.
# This is a special exit code on Read the Docs that will cancel the build immediately.
- |
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && [ "$(git diff --quiet origin/main -- Doc/ .readthedocs.yml; echo $?)" -eq 0 ];
then
echo "No changes to Doc/ - exiting the build.";
exit 183;
fi
- make -C Doc venv html
- mkdir _readthedocs
- mv Doc/build/html _readthedocs/html

12 changes: 6 additions & 6 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ Accessing attributes of extension types
The string should be static, no copy is made of it.
.. c:member:: Py_ssize_t PyMemberDef.offset
.. c:member:: Py_ssize_t offset
The offset in bytes that the member is located on the type’s object struct.
Expand Down Expand Up @@ -625,23 +625,23 @@ Defining Getters and Setters
Structure to define property-like access for a type. See also description of
the :c:member:`PyTypeObject.tp_getset` slot.
.. c:member:: const char* PyGetSetDef.name
.. c:member:: const char* name
attribute name
.. c:member:: getter PyGetSetDef.get
.. c:member:: getter get
C function to get the attribute.
.. c:member:: setter PyGetSetDef.set
.. c:member:: setter set
Optional C function to set or delete the attribute, if omitted the attribute is readonly.
.. c:member:: const char* PyGetSetDef.doc
.. c:member:: const char* doc
optional docstring
.. c:member:: void* PyGetSetDef.closure
.. c:member:: void* closure
Optional function pointer, providing additional data for getter and setter.
Expand Down

0 comments on commit 5dbb8c3

Please sign in to comment.