mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-02-03 22:14:33 +08:00
* fix: vs2022 compilation, issue #3477 * silence warning for python 2.7 * disable warning around mbstowcs call * move disable warning code closer to call site * turn on vs2022 ci test * ci: don't run helpers on Windows 2022 & Python 3.5 * limit workaround for stdlib shipped with vs2022 or later * fix for: limit workaround for stdlib shipped with vs2022 or later * fix 2 for: limit workaround for stdlib shipped with vs2022 or later * comment * ci: add a Windows 2019 run * ci: add Python 2.7 check too Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
This commit is contained in:
parent
b4939fcbfb
commit
a224d0cca5
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
runs-on: [ubuntu-latest, windows-latest, macos-latest]
|
runs-on: [ubuntu-latest, windows-2022, macos-latest]
|
||||||
python:
|
python:
|
||||||
- '2.7'
|
- '2.7'
|
||||||
- '3.5'
|
- '3.5'
|
||||||
@ -37,19 +37,24 @@ jobs:
|
|||||||
# present), or add new keys to an existing matrix element if all the
|
# present), or add new keys to an existing matrix element if all the
|
||||||
# existing keys match.
|
# existing keys match.
|
||||||
#
|
#
|
||||||
# We support an optional keys: args, for cmake args
|
# We support an optional key: args, for cmake args
|
||||||
include:
|
include:
|
||||||
# Just add a key
|
# Just add a key
|
||||||
- runs-on: ubuntu-latest
|
- runs-on: ubuntu-latest
|
||||||
python: 3.6
|
python: '3.6'
|
||||||
args: >
|
args: >
|
||||||
-DPYBIND11_FINDPYTHON=ON
|
-DPYBIND11_FINDPYTHON=ON
|
||||||
- runs-on: windows-latest
|
- runs-on: windows-latest
|
||||||
python: 3.6
|
python: '3.6'
|
||||||
args: >
|
args: >
|
||||||
-DPYBIND11_FINDPYTHON=ON
|
-DPYBIND11_FINDPYTHON=ON
|
||||||
- runs-on: macos-latest
|
- runs-on: macos-latest
|
||||||
python: pypy-2.7
|
python: 'pypy-2.7'
|
||||||
|
# Inject a couple Windows 2019 runs
|
||||||
|
- runs-on: windows-2019
|
||||||
|
python: '3.9'
|
||||||
|
- runs-on: windows-2019
|
||||||
|
python: '2.7'
|
||||||
|
|
||||||
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
|
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
|
||||||
runs-on: ${{ matrix.runs-on }}
|
runs-on: ${{ matrix.runs-on }}
|
||||||
@ -181,6 +186,7 @@ jobs:
|
|||||||
# setuptools
|
# setuptools
|
||||||
- name: Setuptools helpers test
|
- name: Setuptools helpers test
|
||||||
run: pytest tests/extra_setuptools
|
run: pytest tests/extra_setuptools
|
||||||
|
if: "!(matrix.python == '3.5' && matrix.runs-on == 'windows-2022')"
|
||||||
|
|
||||||
|
|
||||||
deadsnakes:
|
deadsnakes:
|
||||||
|
|||||||
@ -154,6 +154,14 @@
|
|||||||
// C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
|
// C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
|
||||||
# pragma warning(disable: 4505)
|
# pragma warning(disable: 4505)
|
||||||
# if defined(_DEBUG) && !defined(Py_DEBUG)
|
# if defined(_DEBUG) && !defined(Py_DEBUG)
|
||||||
|
// Workaround for a VS 2022 issue.
|
||||||
|
// NOTE: This workaround knowingly violates the Python.h include order requirement:
|
||||||
|
// https://docs.python.org/3/c-api/intro.html#include-files
|
||||||
|
// See https://github.com/pybind/pybind11/pull/3497 for full context.
|
||||||
|
# include <yvals.h>
|
||||||
|
# if _MSVC_STL_VERSION >= 143
|
||||||
|
# include <crtdefs.h>
|
||||||
|
# endif
|
||||||
# define PYBIND11_DEBUG_MARKER
|
# define PYBIND11_DEBUG_MARKER
|
||||||
# undef _DEBUG
|
# undef _DEBUG
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
@ -102,6 +102,13 @@ inline wchar_t *widen_chars(const char *safe_arg) {
|
|||||||
wchar_t *widened_arg = Py_DecodeLocale(safe_arg, nullptr);
|
wchar_t *widened_arg = Py_DecodeLocale(safe_arg, nullptr);
|
||||||
#else
|
#else
|
||||||
wchar_t *widened_arg = nullptr;
|
wchar_t *widened_arg = nullptr;
|
||||||
|
|
||||||
|
// warning C4996: 'mbstowcs': This function or variable may be unsafe.
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4996)
|
||||||
|
#endif
|
||||||
|
|
||||||
# if defined(HAVE_BROKEN_MBSTOWCS) && HAVE_BROKEN_MBSTOWCS
|
# if defined(HAVE_BROKEN_MBSTOWCS) && HAVE_BROKEN_MBSTOWCS
|
||||||
size_t count = strlen(safe_arg);
|
size_t count = strlen(safe_arg);
|
||||||
# else
|
# else
|
||||||
@ -111,6 +118,11 @@ inline wchar_t *widen_chars(const char *safe_arg) {
|
|||||||
widened_arg = new wchar_t[count + 1];
|
widened_arg = new wchar_t[count + 1];
|
||||||
mbstowcs(widened_arg, safe_arg, count + 1);
|
mbstowcs(widened_arg, safe_arg, count + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return widened_arg;
|
return widened_arg;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user