diff --git a/.azure-pipelines/azure-pipelines-linux.yml b/.azure-pipelines/azure-pipelines-linux.yml index 3f72c4cb6..1934312a8 100755 --- a/.azure-pipelines/azure-pipelines-linux.yml +++ b/.azure-pipelines/azure-pipelines-linux.yml @@ -12,7 +12,6 @@ jobs: CONFIG: linux_64_target_platformlinux-64 UPLOAD_PACKAGES: 'True' DOCKER_IMAGE: condaforge/linux-anvil-comp7 - maxParallel: 8 timeoutInMinutes: 360 steps: diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml index 2be27d43f..62135182b 100755 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ b/.azure-pipelines/azure-pipelines-osx.yml @@ -14,7 +14,6 @@ jobs: osx_arm64_target_platformosx-arm64: CONFIG: osx_arm64_target_platformosx-arm64 UPLOAD_PACKAGES: 'True' - maxParallel: 8 timeoutInMinutes: 360 steps: diff --git a/.azure-pipelines/azure-pipelines-win.yml b/.azure-pipelines/azure-pipelines-win.yml index ab8cb2ba0..1fd8ea12d 100755 --- a/.azure-pipelines/azure-pipelines-win.yml +++ b/.azure-pipelines/azure-pipelines-win.yml @@ -11,7 +11,6 @@ jobs: win_64_: CONFIG: win_64_ UPLOAD_PACKAGES: 'True' - maxParallel: 4 timeoutInMinutes: 360 variables: CONDA_BLD_PATH: D:\\bld\\ @@ -53,7 +52,7 @@ jobs: - task: CondaEnvironment@1 inputs: - packageSpecs: 'python=3.6 conda-build conda conda-forge::conda-forge-ci-setup=3 pip' # Optional + packageSpecs: 'python=3.6 conda-build conda "conda-forge-ci-setup=3" pip' # Optional installOptions: "-c conda-forge" updateConda: true displayName: Install conda-build and activate environment diff --git a/.ci_support/linux_64_target_platformlinux-64.yaml b/.ci_support/linux_64_target_platformlinux-64.yaml index de9068a25..aade51ab0 100644 --- a/.ci_support/linux_64_target_platformlinux-64.yaml +++ b/.ci_support/linux_64_target_platformlinux-64.yaml @@ -43,7 +43,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.8' +- '3.9' readline: - '8.0' sqlite: @@ -54,5 +54,8 @@ tk: - '8.6' xz: - '5.2' +zip_keys: +- - c_compiler_version + - cxx_compiler_version zlib: - '1.2' diff --git a/.ci_support/linux_aarch64_target_platformlinux-aarch64.yaml b/.ci_support/linux_aarch64_target_platformlinux-aarch64.yaml index eb4f7c8f5..b3d839edd 100644 --- a/.ci_support/linux_aarch64_target_platformlinux-aarch64.yaml +++ b/.ci_support/linux_aarch64_target_platformlinux-aarch64.yaml @@ -5,7 +5,7 @@ bzip2: c_compiler: - gcc c_compiler_version: -- '7.5' +- '7' cdt_arch: - aarch64 cdt_name: @@ -17,7 +17,7 @@ channel_targets: cxx_compiler: - gxx cxx_compiler_version: -- '7.5' +- '7' docker_image: - condaforge/linux-anvil-aarch64 libffi: @@ -49,7 +49,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.8' +- '3.9' readline: - '8.0' sqlite: @@ -60,5 +60,8 @@ tk: - '8.6' xz: - '5.2' +zip_keys: +- - c_compiler_version + - cxx_compiler_version zlib: - '1.2' diff --git a/.ci_support/linux_ppc64le_target_platformlinux-ppc64le.yaml b/.ci_support/linux_ppc64le_target_platformlinux-ppc64le.yaml index 3d1ce2e1d..a28fd1389 100644 --- a/.ci_support/linux_ppc64le_target_platformlinux-ppc64le.yaml +++ b/.ci_support/linux_ppc64le_target_platformlinux-ppc64le.yaml @@ -41,7 +41,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.8' +- '3.9' readline: - '8.0' sqlite: @@ -50,5 +50,8 @@ target_platform: - linux-ppc64le xz: - '5.2' +zip_keys: +- - c_compiler_version + - cxx_compiler_version zlib: - '1.2' diff --git a/.ci_support/osx_64_target_platformosx-64.yaml b/.ci_support/osx_64_target_platformosx-64.yaml index 14e4195ce..fd50d1a48 100644 --- a/.ci_support/osx_64_target_platformosx-64.yaml +++ b/.ci_support/osx_64_target_platformosx-64.yaml @@ -45,7 +45,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.8' +- '3.9' readline: - '8.0' sqlite: @@ -56,5 +56,8 @@ tk: - '8.6' xz: - '5.2' +zip_keys: +- - c_compiler_version + - cxx_compiler_version zlib: - '1.2' diff --git a/.ci_support/osx_arm64_target_platformosx-arm64.yaml b/.ci_support/osx_arm64_target_platformosx-arm64.yaml index e7eec25e8..3751da619 100644 --- a/.ci_support/osx_arm64_target_platformosx-arm64.yaml +++ b/.ci_support/osx_arm64_target_platformosx-arm64.yaml @@ -45,7 +45,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.8' +- '3.9' readline: - '8.0' sqlite: @@ -56,5 +56,8 @@ tk: - '8.6' xz: - '5.2' +zip_keys: +- - c_compiler_version + - cxx_compiler_version zlib: - '1.2' diff --git a/.ci_support/win_64_.yaml b/.ci_support/win_64_.yaml index 98bb6f528..7113321cb 100644 --- a/.ci_support/win_64_.yaml +++ b/.ci_support/win_64_.yaml @@ -17,7 +17,7 @@ pin_run_as_build: sqlite: max_pin: x python: -- '3.8' +- '3.9' sqlite: - '3' target_platform: diff --git a/.gitattributes b/.gitattributes index a00d650a3..9060b272b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,7 +4,6 @@ *.diff binary meta.yaml text eol=lf build.sh text eol=lf -recipe/tests/prefix-replacement/build-and-test.sh text eof=lf bld.bat text eol=crlf # github helper pieces to make some files not show up in diffs automatically diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6243a31d1..315f8a8d1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @isuruf @jakirkham @jjhelmus @mingwandroid @msarahan @ocefpaf @pelson @scopatz \ No newline at end of file +* @isuruf @jakirkham @jjhelmus @mbargull @mingwandroid @msarahan @ocefpaf @pelson @scopatz \ No newline at end of file diff --git a/.scripts/build_steps.sh b/.scripts/build_steps.sh index b06ffc167..7dd5260cd 100755 --- a/.scripts/build_steps.sh +++ b/.scripts/build_steps.sh @@ -19,7 +19,7 @@ conda-build: CONDARC -conda install --yes --quiet conda-forge-ci-setup=3 conda-build pip -c conda-forge +conda install --yes --quiet "conda-forge-ci-setup=3" conda-build pip -c conda-forge # set up the condarc setup_conda_rc "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" @@ -41,13 +41,25 @@ if [[ "${HOST_PLATFORM}" != "${BUILD_PLATFORM}" ]]; then EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --no-test" fi -conda build "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ - --suppress-variables ${EXTRA_CB_OPTIONS:-} \ - --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" -validate_recipe_outputs "${FEEDSTOCK_NAME}" -if [[ "${UPLOAD_PACKAGES}" != "False" ]]; then - upload_package --validate --feedstock-name="${FEEDSTOCK_NAME}" "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" +if [[ "${BUILD_WITH_CONDA_DEBUG:-0}" == 1 ]]; then + if [[ "x${BUILD_OUTPUT_ID:-}" != "x" ]]; then + EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --output-id ${BUILD_OUTPUT_ID}" + fi + conda debug "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ + ${EXTRA_CB_OPTIONS:-} \ + --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" + # Drop into an interactive shell + /bin/bash +else + conda build "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ + --suppress-variables ${EXTRA_CB_OPTIONS:-} \ + --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" + validate_recipe_outputs "${FEEDSTOCK_NAME}" + + if [[ "${UPLOAD_PACKAGES}" != "False" ]]; then + upload_package --validate --feedstock-name="${FEEDSTOCK_NAME}" "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" + fi fi touch "${FEEDSTOCK_ROOT}/build_artifacts/conda-forge-build-done-${CONFIG}" \ No newline at end of file diff --git a/.scripts/run_docker_build.sh b/.scripts/run_docker_build.sh index e4d5baba3..87ba4db04 100755 --- a/.scripts/run_docker_build.sh +++ b/.scripts/run_docker_build.sh @@ -74,6 +74,8 @@ docker run ${DOCKER_RUN_ARGS} \ -e CI \ -e FEEDSTOCK_NAME \ -e CPU_COUNT \ + -e BUILD_WITH_CONDA_DEBUG \ + -e BUILD_OUTPUT_ID \ -e BINSTAR_TOKEN \ -e FEEDSTOCK_TOKEN \ -e STAGING_BINSTAR_TOKEN \ diff --git a/.scripts/run_osx_build.sh b/.scripts/run_osx_build.sh index d64afd097..3675dacfb 100755 --- a/.scripts/run_osx_build.sh +++ b/.scripts/run_osx_build.sh @@ -23,7 +23,7 @@ source ${HOME}/miniforge3/etc/profile.d/conda.sh conda activate base echo -e "\n\nInstalling conda-forge-ci-setup=3 and conda-build." -conda install -n base --quiet --yes conda-forge-ci-setup=3 conda-build pip +conda install -n base --quiet --yes "conda-forge-ci-setup=3" conda-build pip diff --git a/README.md b/README.md index e876d31f3..9eb853af4 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,14 @@ Home: https://www.python.org/ Package license: Python-2.0 -Feedstock license: BSD-3-Clause +Feedstock license: [BSD-3-Clause](https://github.com/conda-forge/python-feedstock/blob/master/LICENSE.txt) Summary: General purpose programming language +Development: https://docs.python.org/devguide/ + +Documentation: https://www.python.org/doc/versions/ + Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in @@ -194,6 +198,7 @@ Feedstock Maintainers * [@isuruf](https://github.com/isuruf/) * [@jakirkham](https://github.com/jakirkham/) * [@jjhelmus](https://github.com/jjhelmus/) +* [@mbargull](https://github.com/mbargull/) * [@mingwandroid](https://github.com/mingwandroid/) * [@msarahan](https://github.com/msarahan/) * [@ocefpaf](https://github.com/ocefpaf/) diff --git a/build-locally.py b/build-locally.py index 8f7ecca4f..3453cfe68 100755 --- a/build-locally.py +++ b/build-locally.py @@ -12,6 +12,10 @@ def setup_environment(ns): os.environ["CONFIG"] = ns.config os.environ["UPLOAD_PACKAGES"] = "False" + if ns.debug: + os.environ["BUILD_WITH_CONDA_DEBUG"] = "1" + if ns.output_id: + os.environ["BUILD_OUTPUT_ID"] = ns.output_id def run_docker_build(ns): @@ -51,6 +55,14 @@ def verify_config(ns): def main(args=None): p = ArgumentParser("build-locally") p.add_argument("config", default=None, nargs="?") + p.add_argument( + "--debug", + action="store_true", + help="Setup debug environment using `conda debug`", + ) + p.add_argument( + "--output-id", help="If running debug, specify the output to setup." + ) ns = p.parse_args(args=args) verify_config(ns) diff --git a/recipe/build_base.bat b/recipe/build_base.bat index 35f08dd79..c39cd6459 100644 --- a/recipe/build_base.bat +++ b/recipe/build_base.bat @@ -16,7 +16,14 @@ if "%ARCH%"=="64" ( set BUILD_PATH=win32 ) -set PY_VER=39 +for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( + set "VERNODOTS=%%i%%j" +) + +:: Make sure the "python" value in conda_build_config.yaml is up to date. +for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( + if NOT "%PY_VER%"=="%%i.%%j" exit 1 +) set "OPENSSL_DIR=%LIBRARY_PREFIX%" set "SQLITE3_DIR=%LIBRARY_PREFIX%" @@ -52,7 +59,7 @@ if errorlevel 1 exit 1 cd .. :: Populate the root package directory -for %%x in (python%PY_VER%%_D%.dll python3%_D%.dll python%_D%.exe pythonw%_D%.exe venvlauncher%_D%.exe venvwlauncher%_D%.exe) do ( +for %%x in (python%VERNODOTS%%_D%.dll python3%_D%.dll python%_D%.exe pythonw%_D%.exe venvlauncher%_D%.exe venvwlauncher%_D%.exe) do ( if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x ( copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX% ) else ( @@ -60,7 +67,7 @@ for %%x in (python%PY_VER%%_D%.dll python3%_D%.dll python%_D%.exe pythonw%_D%.ex ) ) -for %%x in (python%_D%.pdb python%PY_VER%%_D%.pdb pythonw%_D%.pdb) do ( +for %%x in (python%_D%.pdb python%VERNODOTS%%_D%.pdb pythonw%_D%.pdb) do ( if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x ( copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX% ) else ( @@ -142,7 +149,7 @@ if errorlevel 1 exit 1 :: Populate the libs directory if not exist %PREFIX%\libs mkdir %PREFIX%\libs -if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python%PY_VER%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python%PY_VER%%_D%.lib %PREFIX%\libs\ +if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%_D%.lib %PREFIX%\libs\ if errorlevel 1 exit 1 if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib %PREFIX%\libs\ if errorlevel 1 exit 1 diff --git a/recipe/build_base.sh b/recipe/build_base.sh index 8d672ce28..298f6d5cf 100644 --- a/recipe/build_base.sh +++ b/recipe/build_base.sh @@ -60,6 +60,9 @@ fi ABIFLAGS=${DBG} VERABI=${VER}${DBG} +# Make sure the "python" value in conda_build_config.yaml is up to date. +test "${PY_VER}" = "${VER}" + # This is the mechanism by which we fall back to default gcc, but having it defined here # would probably break the build by using incorrect settings and/or importing files that # do not yet exist. diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index 25a28eacb..0621731e2 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -1,5 +1,5 @@ python: - - 3.8 + - 3.9 c_compiler: # [win] - vs2017 # [win] cxx_compiler: # [win] diff --git a/recipe/meta.yaml b/recipe/meta.yaml index c7a5c3a12..2f0daa2cf 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -4,7 +4,7 @@ {% set ver2 = '.'.join(version.split('.')[0:2]) %} {% set ver2nd = ''.join(version.split('.')[0:2]) %} {% set ver3nd = ''.join(version.split('.')[0:3]) %} -{% set build_number = 3 %} +{% set build_number = 4 %} # Sanitize build system env. var tweak parameters # (passed to the build scripts via script_env). @@ -80,6 +80,7 @@ source: - patches/0030-gh21564.patch - patches/0031-gh21228.patch - patches/0032-Fix-TZPATH-on-windows.patch + - patches/0033-gh22674.patch # TODO :: Depend on our own packages for these: - url: https://github.com/python/cpython-source-deps/archive/xz-5.2.2.zip # [win] @@ -347,6 +348,7 @@ extra: - isuruf - jakirkham - jjhelmus + - mbargull - mingwandroid - msarahan - pelson diff --git a/recipe/patches/0033-gh22674.patch b/recipe/patches/0033-gh22674.patch new file mode 100644 index 000000000..741dacbee --- /dev/null +++ b/recipe/patches/0033-gh22674.patch @@ -0,0 +1,51 @@ +From c2fe794b81af88b232fddaefaa7460d444941548 Mon Sep 17 00:00:00 2001 +From: Yannick Jadoul +Date: Mon, 12 Oct 2020 23:06:19 +0200 +Subject: [PATCH] bpo-42015: Reorder dereferencing calls in meth_dealloc, to + make sure m_self is kept alive long enough (GH-22670) (cherry picked from + commit 04b8631d84a870dda456ef86039c1baf34d08500) + +Co-authored-by: Yannick Jadoul +--- + .../next/C API/2020-10-12-20-13-58.bpo-42015.X4H2_V.rst | 3 +++ + Objects/methodobject.c | 6 ++++-- + 2 files changed, 7 insertions(+), 2 deletions(-) + create mode 100644 Misc/NEWS.d/next/C API/2020-10-12-20-13-58.bpo-42015.X4H2_V.rst + +diff --git a/Misc/NEWS.d/next/C API/2020-10-12-20-13-58.bpo-42015.X4H2_V.rst b/Misc/NEWS.d/next/C API/2020-10-12-20-13-58.bpo-42015.X4H2_V.rst +new file mode 100644 +index 0000000000000..d77619f64bb17 +--- /dev/null ++++ b/Misc/NEWS.d/next/C API/2020-10-12-20-13-58.bpo-42015.X4H2_V.rst +@@ -0,0 +1,3 @@ ++Fix potential crash in deallocating method objects when dynamically ++allocated `PyMethodDef`'s lifetime is managed through the ``self`` ++argument of a `PyCFunction`. +diff --git a/Objects/methodobject.c b/Objects/methodobject.c +index 5659f2143d182..7b430416c5a04 100644 +--- a/Objects/methodobject.c ++++ b/Objects/methodobject.c +@@ -164,9 +164,11 @@ meth_dealloc(PyCFunctionObject *m) + if (m->m_weakreflist != NULL) { + PyObject_ClearWeakRefs((PyObject*) m); + } ++ // Dereference class before m_self: PyCFunction_GET_CLASS accesses ++ // PyMethodDef m_ml, which could be kept alive by m_self ++ Py_XDECREF(PyCFunction_GET_CLASS(m)); + Py_XDECREF(m->m_self); + Py_XDECREF(m->m_module); +- Py_XDECREF(PyCFunction_GET_CLASS(m)); + PyObject_GC_Del(m); + } + +@@ -243,9 +245,9 @@ meth_get__qualname__(PyCFunctionObject *m, void *closure) + static int + meth_traverse(PyCFunctionObject *m, visitproc visit, void *arg) + { ++ Py_VISIT(PyCFunction_GET_CLASS(m)); + Py_VISIT(m->m_self); + Py_VISIT(m->m_module); +- Py_VISIT(PyCFunction_GET_CLASS(m)); + return 0; + } +