Skip to content

Commit 568f57f

Browse files
committed
temp
1 parent 3d608dd commit 568f57f

File tree

7 files changed

+45
-1
lines changed

7 files changed

+45
-1
lines changed

Lib/logging/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import logging, socket, os, pickle, struct, time, re
2727
from stat import ST_DEV, ST_INO, ST_MTIME
2828
import queue
29-
import threading
29+
# import threading
3030

3131
#
3232
# Some constants...

parser/src/parser.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,31 @@ mod tests {
369369
)
370370
}
371371

372+
#[test]
373+
fn test_parse_dict_comprehension() {
374+
let source = String::from("{x1: x2 for y in z}");
375+
let parse_ast = parse_expression(&source).unwrap();
376+
assert_eq!(
377+
parse_ast,
378+
ast::Expression {
379+
location: ast::Location::new(1, 1),
380+
node: ast::ExpressionType::Comprehension {
381+
kind: Box::new(ast::ComprehensionKind::Dict {
382+
key: mk_ident("x1", 1, 2),
383+
value: mk_ident("x2", 1, 6),
384+
}),
385+
generators: vec![ast::Comprehension {
386+
location: ast::Location::new(1, 9),
387+
target: mk_ident("y", 1, 13),
388+
iter: mk_ident("z", 1, 18),
389+
ifs: vec![],
390+
is_async: false,
391+
}],
392+
}
393+
}
394+
);
395+
}
396+
372397
#[test]
373398
fn test_parse_list_comprehension() {
374399
let source = String::from("[x for y in z]");

tests/snippets/ints.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,13 @@ def __int__(self):
273273

274274
assert int(F(1.2)) == 3
275275

276+
class BadInt(int):
277+
def __int__(self):
278+
return 42.0
279+
280+
with assertRaises(TypeError):
281+
int(BadInt())
282+
276283
assert isinstance((0).__round__(), int)
277284
assert isinstance((1).__round__(), int)
278285
assert (0).__round__() == 0

vm/src/pyobject.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ impl PyContext {
392392
)
393393
}
394394

395+
#[inline(always)]
395396
pub fn new_bool(&self, b: bool) -> PyObjectRef {
396397
if b {
397398
self.true_value.clone().into_object()

vm/src/stdlib/socket.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
598598
"inet_ntoa" => ctx.new_rustfunc(socket_inet_ntoa),
599599
"gethostname" => ctx.new_rustfunc(socket_gethostname),
600600
"htonl" => ctx.new_rustfunc(socket_htonl),
601+
"has_ipv6" => ctx.new_bool(false),
601602
});
602603

603604
extend_module_platform_specific(vm, module)

vm/src/stdlib/thread.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ fn allocate_lock(vm: &VirtualMachine) -> PyResult {
4848
vm.invoke(&lock_class.into_object(), vec![])
4949
}
5050

51+
fn unimplemented(_vm: &VirtualMachine) {
52+
unimplemented!()
53+
}
54+
5155
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
5256
let ctx = &vm.ctx;
5357

@@ -63,5 +67,9 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
6367
"get_ident" => ctx.new_rustfunc(get_ident),
6468
"allocate_lock" => ctx.new_rustfunc(allocate_lock),
6569
"TIMEOUT_MAX" => ctx.new_float(TIMEOUT_MAX),
70+
"start_new_thread" => ctx.new_rustfunc(unimplemented),
71+
"_set_sentinel" => ctx.new_rustfunc(unimplemented),
72+
"error" => ctx.exceptions.base_exception_type.clone(),
73+
"stack_size" => ctx.new_rustfunc(unimplemented),
6674
})
6775
}

vm/src/sysmodule.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ settrace() -- set the global debug tracing function
378378
"exec_prefix" => ctx.new_str(exec_prefix.to_string()),
379379
"base_exec_prefix" => ctx.new_str(base_exec_prefix.to_string()),
380380
"exit" => ctx.new_rustfunc(sys_exit),
381+
"base_exec_prefix" => ctx.new_str("".to_string()), // dummy
382+
"exec_prefix" => ctx.new_str("".to_string()), // dummy
381383
});
382384

383385
modules.set_item("sys", module.clone(), vm).unwrap();

0 commit comments

Comments
 (0)