Skip to content

Commit 561fded

Browse files
Merge pull request #1 from python/master
Add Hint for Type Narrowing When Using Optional Types
2 parents 0c10367 + 7237d55 commit 561fded

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+2603
-1211
lines changed

.github/workflows/test.yml

+58-24
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,22 @@ jobs:
7171
tox_extra_args: "-n 4"
7272
test_mypyc: true
7373

74+
- name: Test suit with py313-dev-ubuntu, mypyc-compiled
75+
python: '3.13-dev'
76+
arch: x64
77+
os: ubuntu-latest
78+
toxenv: py
79+
tox_extra_args: "-n 4"
80+
test_mypyc: true
81+
# - name: Test suit with py314-dev-ubuntu
82+
# python: '3.14-dev'
83+
# arch: x64
84+
# os: ubuntu-latest
85+
# toxenv: py
86+
# tox_extra_args: "-n 4"
87+
# allow_failure: true
88+
# test_mypyc: true
89+
7490
- name: mypyc runtime tests with py39-macos
7591
python: '3.9.18'
7692
arch: x64
@@ -119,51 +135,69 @@ jobs:
119135
MYPY_FORCE_TERMINAL_WIDTH: 200
120136
# Pytest
121137
PYTEST_ADDOPTS: --color=yes
138+
122139
steps:
123140
- uses: actions/checkout@v4
124-
- uses: actions/setup-python@v5
125-
with:
126-
python-version: ${{ matrix.python }}
127-
architecture: ${{ matrix.arch }}
141+
128142
- name: Debug build
129143
if: ${{ matrix.debug_build }}
130144
run: |
131145
PYTHONVERSION=${{ matrix.python }}
132146
PYTHONDIR=~/python-debug/python-$PYTHONVERSION
133147
VENV=$PYTHONDIR/env
134148
./misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV
149+
# TODO: does this do anything? env vars aren't passed to the next step right
135150
source $VENV/bin/activate
151+
- name: Latest Dev build
152+
if: ${{ endsWith(matrix.python, '-dev') }}
153+
run: |
154+
sudo apt-get update
155+
sudo apt-get install -y --no-install-recommends \
156+
build-essential gdb lcov libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev \
157+
libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev
158+
git clone --depth 1 https://github.com/python/cpython.git /tmp/cpython --branch $( echo ${{ matrix.python }} | sed 's/-dev//' )
159+
cd /tmp/cpython
160+
echo git rev-parse HEAD; git rev-parse HEAD
161+
git show --no-patch
162+
./configure --prefix=/opt/pythondev
163+
make -j$(nproc)
164+
sudo make install
165+
sudo ln -s /opt/pythondev/bin/python3 /opt/pythondev/bin/python
166+
sudo ln -s /opt/pythondev/bin/pip3 /opt/pythondev/bin/pip
167+
echo "/opt/pythondev/bin" >> $GITHUB_PATH
168+
- uses: actions/setup-python@v5
169+
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
170+
with:
171+
python-version: ${{ matrix.python }}
172+
architecture: ${{ matrix.arch }}
173+
136174
- name: Install tox
137-
run: pip install setuptools==68.2.2 tox==4.11.0
175+
run: |
176+
echo PATH; echo $PATH
177+
echo which python; which python
178+
echo which pip; which pip
179+
echo python version; python -c 'import sys; print(sys.version)'
180+
echo debug build; python -c 'import sysconfig; print(bool(sysconfig.get_config_var("Py_DEBUG")))'
181+
echo os.cpu_count; python -c 'import os; print(os.cpu_count())'
182+
echo os.sched_getaffinity; python -c 'import os; print(len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
183+
pip install setuptools==68.2.2 tox==4.11.0
184+
138185
- name: Compiled with mypyc
139186
if: ${{ matrix.test_mypyc }}
140187
run: |
141188
pip install -r test-requirements.txt
142189
CC=clang MYPYC_OPT_LEVEL=0 MYPY_USE_MYPYC=1 pip install -e .
190+
143191
- name: Setup tox environment
144192
run: |
145-
tox run -e ${{ matrix.toxenv }} --notest
146-
python -c 'import os; print("os.cpu_count", os.cpu_count(), "os.sched_getaffinity", len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
193+
tox run -e ${{ matrix.toxenv }} --notes
147194
- name: Test
148195
run: tox run -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }}
196+
continue-on-error: ${{ matrix.allow_failure == 'true' }}
149197

150-
python-nightly:
151-
runs-on: ubuntu-latest
152-
name: Test suite with Python nightly
153-
steps:
154-
- uses: actions/checkout@v3
155-
- uses: actions/setup-python@v4
156-
with:
157-
python-version: '3.13-dev'
158-
- name: Install tox
159-
run: pip install setuptools==68.2.2 tox==4.11.0
160-
- name: Setup tox environment
161-
run: tox run -e py --notest
162-
- name: Test
163-
run: tox run -e py --skip-pkg-install -- "-n 4"
164-
continue-on-error: true
165-
- name: Mark as a success
166-
run: exit 0
198+
- name: Mark as success (check failures manually)
199+
if: ${{ matrix.allow_failure == 'true' }}
200+
run: exit 0
167201

168202
python_32bits:
169203
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)