Skip to content

Commit ec75888

Browse files
authored
Merge pull request #6470 from youknowone/common-fix
Mark unrunnable test_threading. Fix SSL args names. Add args to sysconfigdata
2 parents 2342006 + df523cb commit ec75888

6 files changed

Lines changed: 42 additions & 13 deletions

File tree

‎Lib/test/test_os.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3491,6 +3491,7 @@ def test_spawnl(self):
34913491
self.assertEqual(exitcode, self.exitcode)
34923492

34933493
@requires_os_func('spawnle')
3494+
@unittest.skipIf(sys.platform == 'win32', "TODO: RUSTPYTHON; fix spawnve on Windows")
34943495
def test_spawnle(self):
34953496
program, args = self.create_args(with_env=True)
34963497
exitcode = os.spawnle(os.P_WAIT, program, *args, self.env)
@@ -3519,6 +3520,7 @@ def test_spawnv(self):
35193520
self.assertEqual(exitcode, self.exitcode)
35203521

35213522
@requires_os_func('spawnve')
3523+
@unittest.skipIf(sys.platform == 'win32', "TODO: RUSTPYTHON; fix spawnve on Windows")
35223524
def test_spawnve(self):
35233525
program, args = self.create_args(with_env=True)
35243526
exitcode = os.spawnve(os.P_WAIT, program, args, self.env)
@@ -3627,6 +3629,7 @@ def _test_invalid_env(self, spawn):
36273629
self.assertEqual(exitcode, 0)
36283630

36293631
@requires_os_func('spawnve')
3632+
@unittest.skipIf(sys.platform == 'win32', "TODO: RUSTPYTHON; fix spawnve on Windows")
36303633
def test_spawnve_invalid_env(self):
36313634
self._test_invalid_env(os.spawnve)
36323635

‎Lib/test/test_sysconfig.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ def test_main(self):
447447
_main()
448448
self.assertTrue(len(output.getvalue().split('\n')) > 0)
449449

450-
@unittest.expectedFailure # TODO: RUSTPYTHON
451450
@unittest.skipIf(sys.platform == "win32", "Does not apply to Windows")
452451
def test_ldshared_value(self):
453452
ldflags = sysconfig.get_config_var('LDFLAGS')

‎Lib/test/test_threading.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ def f(mutex):
229229

230230
# PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently)
231231
# exposed at the Python level. This test relies on ctypes to get at it.
232+
@unittest.skip("TODO: RUSTPYTHON; expects @cpython_only")
232233
def test_PyThreadState_SetAsyncExc(self):
233234
ctypes = import_module("ctypes")
234235

@@ -332,6 +333,7 @@ def fail_new_thread(*args):
332333
finally:
333334
threading._start_new_thread = _start_new_thread
334335

336+
@unittest.skip("TODO: RUSTPYTHON; ctypes.pythonapi is not supported")
335337
def test_finalize_running_thread(self):
336338
# Issue 1402: the PyGILState_Ensure / _Release functions may be called
337339
# very late on python exit: on deallocation of a running thread for

‎crates/stdlib/src/openssl.rs‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,10 +1543,10 @@ mod _ssl {
15431543
#[pymethod]
15441544
fn get_ca_certs(
15451545
&self,
1546-
binary_form: OptionalArg<bool>,
1546+
args: GetCertArgs,
15471547
vm: &VirtualMachine,
15481548
) -> PyResult<Vec<PyObjectRef>> {
1549-
let binary_form = binary_form.unwrap_or(false);
1549+
let binary_form = args.binary_form.unwrap_or(false);
15501550
let ctx = self.ctx();
15511551
#[cfg(ossl300)]
15521552
let certs = ctx.cert_store().all_certificates();
@@ -2259,6 +2259,12 @@ mod _ssl {
22592259
password: Option<PyObjectRef>,
22602260
}
22612261

2262+
#[derive(FromArgs)]
2263+
struct GetCertArgs {
2264+
#[pyarg(any, optional)]
2265+
binary_form: OptionalArg<bool>,
2266+
}
2267+
22622268
// Err is true if the socket is blocking
22632269
type SocketDeadline = Result<Instant, bool>;
22642270

@@ -2516,10 +2522,10 @@ mod _ssl {
25162522
#[pymethod]
25172523
fn getpeercert(
25182524
&self,
2519-
binary: OptionalArg<bool>,
2525+
args: GetCertArgs,
25202526
vm: &VirtualMachine,
25212527
) -> PyResult<Option<PyObjectRef>> {
2522-
let binary = binary.unwrap_or(false);
2528+
let binary = args.binary_form.unwrap_or(false);
25232529
let stream = self.connection.read();
25242530
if !stream.ssl().is_init_finished() {
25252531
return Err(vm.new_value_error("handshake not done yet"));

‎crates/stdlib/src/ssl.rs‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,12 @@ mod _ssl {
841841
password: OptionalArg<PyObjectRef>,
842842
}
843843

844+
#[derive(FromArgs)]
845+
struct GetCertArgs {
846+
#[pyarg(any, optional)]
847+
binary_form: OptionalArg<bool>,
848+
}
849+
844850
#[pyclass(with(Constructor), flags(BASETYPE))]
845851
impl PySSLContext {
846852
// Helper method to convert DER certificate bytes to Python dict
@@ -1688,12 +1694,8 @@ mod _ssl {
16881694
}
16891695

16901696
#[pymethod]
1691-
fn get_ca_certs(
1692-
&self,
1693-
binary_form: OptionalArg<bool>,
1694-
vm: &VirtualMachine,
1695-
) -> PyResult<PyListRef> {
1696-
let binary_form = binary_form.unwrap_or(false);
1697+
fn get_ca_certs(&self, args: GetCertArgs, vm: &VirtualMachine) -> PyResult<PyListRef> {
1698+
let binary_form = args.binary_form.unwrap_or(false);
16971699
let ca_certs_der = self.ca_certs_der.read();
16981700

16991701
let mut certs = Vec::new();
@@ -3444,10 +3446,10 @@ mod _ssl {
34443446
#[pymethod]
34453447
fn getpeercert(
34463448
&self,
3447-
binary_form: OptionalArg<bool>,
3449+
args: GetCertArgs,
34483450
vm: &VirtualMachine,
34493451
) -> PyResult<Option<PyObjectRef>> {
3450-
let binary = binary_form.unwrap_or(false);
3452+
let binary = args.binary_form.unwrap_or(false);
34513453

34523454
// Check if handshake is complete
34533455
if !*self.handshake_done.lock() {

‎crates/vm/src/stdlib/sysconfigdata.rs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// spell-checker: words LDSHARED ARFLAGS CPPFLAGS CCSHARED BASECFLAGS BLDSHARED
2+
13
pub(crate) use _sysconfigdata::make_module;
24

35
#[pymodule]
@@ -18,6 +20,21 @@ pub(crate) mod _sysconfigdata {
1820
"MULTIARCH" => MULTIARCH,
1921
// enough for tests to stop expecting urandom() to fail after restricting file resources
2022
"HAVE_GETRANDOM" => 1,
23+
// Compiler configuration for native extension builds
24+
"CC" => "cc",
25+
"CXX" => "c++",
26+
"CFLAGS" => "",
27+
"CPPFLAGS" => "",
28+
"LDFLAGS" => "",
29+
"LDSHARED" => "cc -shared",
30+
"CCSHARED" => "",
31+
"SHLIB_SUFFIX" => ".so",
32+
"SO" => ".so",
33+
"AR" => "ar",
34+
"ARFLAGS" => "rcs",
35+
"OPT" => "",
36+
"BASECFLAGS" => "",
37+
"BLDSHARED" => "cc -shared",
2138
}
2239
include!(concat!(env!("OUT_DIR"), "/env_vars.rs"));
2340
vars

0 commit comments

Comments
 (0)