Merge pull request #6470 from youknowone/common-fix

Mark unrunnable test_threading. Fix SSL args names. Add args to sysconfigdata
This commit is contained in:
Jeong, YunWon
2025-12-23 16:09:57 +09:00
committed by GitHub
6 changed files with 42 additions and 13 deletions

3
Lib/test/test_os.py vendored
View File

@@ -3491,6 +3491,7 @@ class SpawnTests(unittest.TestCase):
self.assertEqual(exitcode, self.exitcode)
@requires_os_func('spawnle')
@unittest.skipIf(sys.platform == 'win32', "TODO: RUSTPYTHON; fix spawnve on Windows")
def test_spawnle(self):
program, args = self.create_args(with_env=True)
exitcode = os.spawnle(os.P_WAIT, program, *args, self.env)
@@ -3519,6 +3520,7 @@ class SpawnTests(unittest.TestCase):
self.assertEqual(exitcode, self.exitcode)
@requires_os_func('spawnve')
@unittest.skipIf(sys.platform == 'win32', "TODO: RUSTPYTHON; fix spawnve on Windows")
def test_spawnve(self):
program, args = self.create_args(with_env=True)
exitcode = os.spawnve(os.P_WAIT, program, args, self.env)
@@ -3627,6 +3629,7 @@ class SpawnTests(unittest.TestCase):
self.assertEqual(exitcode, 0)
@requires_os_func('spawnve')
@unittest.skipIf(sys.platform == 'win32', "TODO: RUSTPYTHON; fix spawnve on Windows")
def test_spawnve_invalid_env(self):
self._test_invalid_env(os.spawnve)

View File

@@ -447,7 +447,6 @@ class TestSysConfig(unittest.TestCase):
_main()
self.assertTrue(len(output.getvalue().split('\n')) > 0)
@unittest.expectedFailure # TODO: RUSTPYTHON
@unittest.skipIf(sys.platform == "win32", "Does not apply to Windows")
def test_ldshared_value(self):
ldflags = sysconfig.get_config_var('LDFLAGS')

View File

@@ -229,6 +229,7 @@ class ThreadTests(BaseTestCase):
# PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently)
# exposed at the Python level. This test relies on ctypes to get at it.
@unittest.skip("TODO: RUSTPYTHON; expects @cpython_only")
def test_PyThreadState_SetAsyncExc(self):
ctypes = import_module("ctypes")
@@ -332,6 +333,7 @@ class ThreadTests(BaseTestCase):
finally:
threading._start_new_thread = _start_new_thread
@unittest.skip("TODO: RUSTPYTHON; ctypes.pythonapi is not supported")
def test_finalize_running_thread(self):
# Issue 1402: the PyGILState_Ensure / _Release functions may be called
# very late on python exit: on deallocation of a running thread for

View File

@@ -1543,10 +1543,10 @@ mod _ssl {
#[pymethod]
fn get_ca_certs(
&self,
binary_form: OptionalArg<bool>,
args: GetCertArgs,
vm: &VirtualMachine,
) -> PyResult<Vec<PyObjectRef>> {
let binary_form = binary_form.unwrap_or(false);
let binary_form = args.binary_form.unwrap_or(false);
let ctx = self.ctx();
#[cfg(ossl300)]
let certs = ctx.cert_store().all_certificates();
@@ -2259,6 +2259,12 @@ mod _ssl {
password: Option<PyObjectRef>,
}
#[derive(FromArgs)]
struct GetCertArgs {
#[pyarg(any, optional)]
binary_form: OptionalArg<bool>,
}
// Err is true if the socket is blocking
type SocketDeadline = Result<Instant, bool>;
@@ -2516,10 +2522,10 @@ mod _ssl {
#[pymethod]
fn getpeercert(
&self,
binary: OptionalArg<bool>,
args: GetCertArgs,
vm: &VirtualMachine,
) -> PyResult<Option<PyObjectRef>> {
let binary = binary.unwrap_or(false);
let binary = args.binary_form.unwrap_or(false);
let stream = self.connection.read();
if !stream.ssl().is_init_finished() {
return Err(vm.new_value_error("handshake not done yet"));

View File

@@ -841,6 +841,12 @@ mod _ssl {
password: OptionalArg<PyObjectRef>,
}
#[derive(FromArgs)]
struct GetCertArgs {
#[pyarg(any, optional)]
binary_form: OptionalArg<bool>,
}
#[pyclass(with(Constructor), flags(BASETYPE))]
impl PySSLContext {
// Helper method to convert DER certificate bytes to Python dict
@@ -1688,12 +1694,8 @@ mod _ssl {
}
#[pymethod]
fn get_ca_certs(
&self,
binary_form: OptionalArg<bool>,
vm: &VirtualMachine,
) -> PyResult<PyListRef> {
let binary_form = binary_form.unwrap_or(false);
fn get_ca_certs(&self, args: GetCertArgs, vm: &VirtualMachine) -> PyResult<PyListRef> {
let binary_form = args.binary_form.unwrap_or(false);
let ca_certs_der = self.ca_certs_der.read();
let mut certs = Vec::new();
@@ -3444,10 +3446,10 @@ mod _ssl {
#[pymethod]
fn getpeercert(
&self,
binary_form: OptionalArg<bool>,
args: GetCertArgs,
vm: &VirtualMachine,
) -> PyResult<Option<PyObjectRef>> {
let binary = binary_form.unwrap_or(false);
let binary = args.binary_form.unwrap_or(false);
// Check if handshake is complete
if !*self.handshake_done.lock() {

View File

@@ -1,3 +1,5 @@
// spell-checker: words LDSHARED ARFLAGS CPPFLAGS CCSHARED BASECFLAGS BLDSHARED
pub(crate) use _sysconfigdata::make_module;
#[pymodule]
@@ -18,6 +20,21 @@ pub(crate) mod _sysconfigdata {
"MULTIARCH" => MULTIARCH,
// enough for tests to stop expecting urandom() to fail after restricting file resources
"HAVE_GETRANDOM" => 1,
// Compiler configuration for native extension builds
"CC" => "cc",
"CXX" => "c++",
"CFLAGS" => "",
"CPPFLAGS" => "",
"LDFLAGS" => "",
"LDSHARED" => "cc -shared",
"CCSHARED" => "",
"SHLIB_SUFFIX" => ".so",
"SO" => ".so",
"AR" => "ar",
"ARFLAGS" => "rcs",
"OPT" => "",
"BASECFLAGS" => "",
"BLDSHARED" => "cc -shared",
}
include!(concat!(env!("OUT_DIR"), "/env_vars.rs"));
vars