A Python Interpreter written in Rust
The online demo gh-pages. CI will auto-build the demo and push to this repo.
RustPython documentation
The main website for RustPython and wasm demo
Short string embedding for Box<str>
An MT19937 Mersenne Twister rng implementation, with the goal of being compatible with CPython's _random module.
python game engine that runs in browser
Rust implementation of the modified MergeSort used in Python and Java
startedRustPython/RustPython
started time in 3 hours
startedRustPython/RustPython
started time in 7 hours
fork wannaphong/demo
The online demo gh-pages. CI will auto-build the demo and push to this repo.
https://rustpython.github.io/demo/
fork in 9 hours
push eventRustPython/RustPython
commit sha d6012427ce61ef4ee95bd0c9138871004f573710
Use std::os::raw::c_* instead of libc::c_* for wasm compat
push time in 10 hours
A Python Interpreter written in Rust
fork in 11 hours
PR opened RustPython/RustPython
This is sort of a big lump change, and there aren't necessarily tests to prove it, since there aren't any tests in test_struct.py that verify the native ordering -- even though there's padding now and correct alignment/size, the tests that I unskipped aren't related to that :disappointed: . Still, I think this is cleaner then it was before; there's an enum for the codes now, and finding the pack() function for a code is a bit cleaner now/respects endianness/architecture
pr created time in 11 hours
push eventRustPython/RustPython
commit sha e34bd026923bc87df105592eaa8cbaad912f1406
Use a static type for struct.error
push time in 12 hours
push eventRustPython/RustPython
commit sha 5fe3d65ff1b3d497c261ec3af3de7e823ac78132
Update pystruct + array
push time in 13 hours
push eventRustPython/RustPython
commit sha 736bcb75e9fdb196740367fff94ab818fa0a22b0
Update pystruct + array
push time in 13 hours
push eventRustPython/RustPython
commit sha 89adfcd5284c622748a3152baa5fbca2ba22a86e
Update pystruct + array
push time in 13 hours
push eventRustPython/RustPython
commit sha 1f8213082cdc170f31655f8cbd6064125a033bab
py* macro raises better error for duplicated item
commit sha d54cfaf3f4e6a84a7fcd82f4d7327eead8fb9968
Keep source code order for module items
commit sha 91eb4d42e05ce011c9738cf21c4e833b9fbe971b
direct call io_open for initialization
commit sha 5b32064cd6cd9200e93a35bd767f7f683e0aa848
trait StaticType
commit sha 34a2038e1765f6aa9bb74ea4efc807c272846462
Use StaticType::static_class() rather than vm.class
commit sha 4add0220ae16876376a737adebfb3da0967ddcde
PyValue::class() returns ref
commit sha f41124fddb6e63c9c664f07bae039c6628fb6b37
Use unreachable_unsafe for static_type()
commit sha ecf1120bee6177aac51465e5c86428f7815d7d43
Clean up static-type affected apis
commit sha 3b78c6068b37f2229fdd67ddc867e3ee799c00f0
vm.class() only for non-static types
commit sha 57bf7afdd98bcf400ea5e31c9e812cfafec60129
every PyStructSequence is StaticType
commit sha 0c505f9893522e829c0337995c6d43594314aeb1
sys.windowsversion is now static type, no need to be owned somewhere
commit sha 2ebec89d9f836cf66ee54fcb491e77e34bf65005
Merge pull request #2238 from youknowone/static-type Trait for static type
commit sha 8bbbe9e6a2351d6ca5ee536ca16b934ee5fbca39
Update pystruct + array
push time in 13 hours
issue commentRustPython/RustPython
Implement variable mangling for private fields
@HyeockJinKim yep, go ahead!
comment created time in 15 hours
issue commentRustPython/RustPython
Implement variable mangling for private fields
If this issue is okay, would it be okay for me to try it?
comment created time in 20 hours
issue openedRustPython/RustPython
Implement variable mangling for private fields
Feature
<!-- What Python feature is missing from RustPython? Give a short description of the feature and how you ran into its absence. -->
In cpython
>>> class A:
... def __init__(self):
... self.__a = 1
...
>>> a = A()
>>> a.__a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'A' object has no attribute '__a'
>>> a._A__a
1
In Rustpython
>>>>> class A:
..... def __init__(self):
..... self.__a = 1
.....
>>>>> a = A()
>>>>> a.__a
1
In python, the field of the class starting with __ is a private field,
and mangling is performed to prevent external access to the same variable.
Currently, this has not been done in Rustpython.
Python Documentation
https://github.com/python/cpython/blob/3185267400be853404f22a1e06bb9fe1210735c7/Python/compile.c#L254-L256 In cpython, it is probably mangled using the above function.
<!-- Give a link to the feature in the CPython documentation (https://docs.python.org/3/) in order to assist in its implementation. -->
created time in 21 hours
startedRustPython/RustPython
started time in 21 hours
startedRustPython/RustPython
started time in a day
push eventRustPython/RustPython
commit sha b0f9589471b4f872ef6a7402343f7ff19feed0d7
Update dependencies
commit sha 79d5872942d43b89be4125d5bdf1e01fd9333763
Expose PyGetSet in builtins
commit sha cb9c9ec4cf62ca2572b03cfe14da22db05c93295
Add some utility methods to function::Args and PyBaseException
commit sha c61759bd924b6292a9c89bc111da0c10d9acd32e
Rework some of the _js module
commit sha efa809bd173a2483cfb14b13d3a31fd6d7f85595
Merge pull request #2290 from RustPython/coolreader18/update-browser Update the browser module
commit sha 1f8213082cdc170f31655f8cbd6064125a033bab
py* macro raises better error for duplicated item
commit sha d54cfaf3f4e6a84a7fcd82f4d7327eead8fb9968
Keep source code order for module items
commit sha 91eb4d42e05ce011c9738cf21c4e833b9fbe971b
direct call io_open for initialization
commit sha 5b32064cd6cd9200e93a35bd767f7f683e0aa848
trait StaticType
commit sha 34a2038e1765f6aa9bb74ea4efc807c272846462
Use StaticType::static_class() rather than vm.class
commit sha 4add0220ae16876376a737adebfb3da0967ddcde
PyValue::class() returns ref
commit sha f41124fddb6e63c9c664f07bae039c6628fb6b37
Use unreachable_unsafe for static_type()
commit sha ecf1120bee6177aac51465e5c86428f7815d7d43
Clean up static-type affected apis
commit sha 3b78c6068b37f2229fdd67ddc867e3ee799c00f0
vm.class() only for non-static types
commit sha 57bf7afdd98bcf400ea5e31c9e812cfafec60129
every PyStructSequence is StaticType
commit sha 0c505f9893522e829c0337995c6d43594314aeb1
sys.windowsversion is now static type, no need to be owned somewhere
commit sha 2ebec89d9f836cf66ee54fcb491e77e34bf65005
Merge pull request #2238 from youknowone/static-type Trait for static type
commit sha 543c2a22566131605d26f9eeabda99190c306622
Change CodeObject to be generic over the constant representation
commit sha 4c8fdc49c7ca5675552739e8b0993f426b90d22b
Update compiler to output codeobj.constants, use insta for snapshot testing
commit sha 5176864aa9441b50b1d6398fd0e686ecacf52a20
Update rustpython_vm to differentiate between bytecode::CodeObject and builtins::code::CodeObject
push time in a day
create barnchRustPython/RustPython
branch : coolreader18/rework-pystruct
created branch time in a day
startedRustPython/RustPython
started time in a day
Pull request review commentRustPython/RustPython
use crate::{builtins, exceptions, py_io, version}; /* * The magic sys module. */+const MAXSIZE: usize = std::isize::MAX as usize;
https://github.com/RustPython/RustPython/pull/2284#discussion_r507437781
comment created time in a day
startedRustPython/RustPython
started time in a day
push eventRustPython/RustPython
commit sha 1f8213082cdc170f31655f8cbd6064125a033bab
py* macro raises better error for duplicated item
commit sha d54cfaf3f4e6a84a7fcd82f4d7327eead8fb9968
Keep source code order for module items
commit sha 91eb4d42e05ce011c9738cf21c4e833b9fbe971b
direct call io_open for initialization
commit sha 5b32064cd6cd9200e93a35bd767f7f683e0aa848
trait StaticType
commit sha 34a2038e1765f6aa9bb74ea4efc807c272846462
Use StaticType::static_class() rather than vm.class
commit sha 4add0220ae16876376a737adebfb3da0967ddcde
PyValue::class() returns ref
commit sha f41124fddb6e63c9c664f07bae039c6628fb6b37
Use unreachable_unsafe for static_type()
commit sha ecf1120bee6177aac51465e5c86428f7815d7d43
Clean up static-type affected apis
commit sha 3b78c6068b37f2229fdd67ddc867e3ee799c00f0
vm.class() only for non-static types
commit sha 57bf7afdd98bcf400ea5e31c9e812cfafec60129
every PyStructSequence is StaticType
commit sha 0c505f9893522e829c0337995c6d43594314aeb1
sys.windowsversion is now static type, no need to be owned somewhere
commit sha 2ebec89d9f836cf66ee54fcb491e77e34bf65005
Merge pull request #2238 from youknowone/static-type Trait for static type
push time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
startedRustPython/RustPython
started time in a day
Pull request review commentRustPython/RustPython
settrace() -- set the global debug tracing function let getwindowsversion = WindowsVersion::make_class(ctx); extend_module!(vm, module, { "getwindowsversion" => named_function!(ctx, sys, getwindowsversion),- "_getwindowsversion_type" => getwindowsversion, // XXX: This is not a python spec but required by current RustPython implementation
@BasixKOR I am going to remove this fake exposed type ;)
comment created time in a day
Pull request review commentRustPython/RustPython
JIT: Adding multiply and division for int type + mixing float & int type
impl<'a, 'b> FunctionCompiler<'a, 'b> { }); Ok(()) }- _ => Err(JitCompileError::NotSupported),- },- (JitType::Float, JitType::Float) => match op {- BinaryOperator::Add => {- self.stack.push(JitValue {- val: self.builder.ins().fadd(a.val, b.val),- ty: JitType::Float,- });- Ok(())- }- BinaryOperator::Subtract => {- self.stack.push(JitValue {- val: self.builder.ins().fsub(a.val, b.val),- ty: JitType::Float,- });- Ok(())- } BinaryOperator::Multiply => { self.stack.push(JitValue {- val: self.builder.ins().fmul(a.val, b.val),- ty: JitType::Float,+ val: self.builder.ins().imul(a.val, b.val),+ ty: JitType::Int, }); Ok(()) } BinaryOperator::Divide => {- self.stack.push(JitValue {- val: self.builder.ins().fdiv(a.val, b.val),- ty: JitType::Float,- });- Ok(())+ // Convert the operands to floats and perform the+ // division.+ let fa = self.builder.ins().fcvt_from_sint(types::F64, a.val);+ let fb = self.builder.ins().fcvt_from_sint(types::F64, b.val);+ self.add_binary_operator_float(op, fa, fb) } _ => Err(JitCompileError::NotSupported), },- _ => Err(JitCompileError::NotSupported),+ (JitType::Int, JitType::Float) => {+ let fa = self.builder.ins().fcvt_from_sint(types::F64, a.val);+ self.add_binary_operator_float(op, fa, b.val)+ }+ (JitType::Float, JitType::Int) => {+ let fb = self.builder.ins().fcvt_from_sint(types::F64, b.val);
I don't think it's possible to throw an exception yet; right now I think we just trap on overflow, without any sort of recovery
comment created time in 2 days
startedRustPython/RustPython
started time in 2 days
startedRustPython/RustPython
started time in 2 days
startedRustPython/RustPython
started time in 2 days
startedRustPython/RustPython
started time in 2 days
Pull request review commentRustPython/RustPython
JIT: Adding multiply and division for int type + mixing float & int type
impl<'a, 'b> FunctionCompiler<'a, 'b> { }); Ok(()) }- _ => Err(JitCompileError::NotSupported),- },- (JitType::Float, JitType::Float) => match op {- BinaryOperator::Add => {- self.stack.push(JitValue {- val: self.builder.ins().fadd(a.val, b.val),- ty: JitType::Float,- });- Ok(())- }- BinaryOperator::Subtract => {- self.stack.push(JitValue {- val: self.builder.ins().fsub(a.val, b.val),- ty: JitType::Float,- });- Ok(())- } BinaryOperator::Multiply => { self.stack.push(JitValue {- val: self.builder.ins().fmul(a.val, b.val),- ty: JitType::Float,+ val: self.builder.ins().imul(a.val, b.val),+ ty: JitType::Int, }); Ok(()) } BinaryOperator::Divide => {- self.stack.push(JitValue {- val: self.builder.ins().fdiv(a.val, b.val),- ty: JitType::Float,- });- Ok(())+ // Convert the operands to floats and perform the+ // division.+ let fa = self.builder.ins().fcvt_from_sint(types::F64, a.val);+ let fb = self.builder.ins().fcvt_from_sint(types::F64, b.val);+ self.add_binary_operator_float(op, fa, fb) } _ => Err(JitCompileError::NotSupported), },- _ => Err(JitCompileError::NotSupported),+ (JitType::Int, JitType::Float) => {+ let fa = self.builder.ins().fcvt_from_sint(types::F64, a.val);+ self.add_binary_operator_float(op, fa, b.val)+ }+ (JitType::Float, JitType::Int) => {+ let fb = self.builder.ins().fcvt_from_sint(types::F64, b.val);
I think division by zero can be handled in f64/f64 operation because it is part of them (though it is not supported yet). But the overflow error is out of f64 operation so need to be handled before going to the f64 operation step.
Unfortunately, I don't know that much about JIT yet either. @skinny121 @coolreader18 Do you have any hint for that?
comment created time in 2 days
Pull request review commentRustPython/RustPython
JIT: Adding multiply and division for int type + mixing float & int type
impl<'a, 'b> FunctionCompiler<'a, 'b> { }); Ok(()) }- _ => Err(JitCompileError::NotSupported),- },- (JitType::Float, JitType::Float) => match op {- BinaryOperator::Add => {- self.stack.push(JitValue {- val: self.builder.ins().fadd(a.val, b.val),- ty: JitType::Float,- });- Ok(())- }- BinaryOperator::Subtract => {- self.stack.push(JitValue {- val: self.builder.ins().fsub(a.val, b.val),- ty: JitType::Float,- });- Ok(())- } BinaryOperator::Multiply => { self.stack.push(JitValue {- val: self.builder.ins().fmul(a.val, b.val),- ty: JitType::Float,+ val: self.builder.ins().imul(a.val, b.val),+ ty: JitType::Int, }); Ok(()) } BinaryOperator::Divide => {- self.stack.push(JitValue {- val: self.builder.ins().fdiv(a.val, b.val),- ty: JitType::Float,- });- Ok(())+ // Convert the operands to floats and perform the+ // division.+ let fa = self.builder.ins().fcvt_from_sint(types::F64, a.val);+ let fb = self.builder.ins().fcvt_from_sint(types::F64, b.val);+ self.add_binary_operator_float(op, fa, fb) } _ => Err(JitCompileError::NotSupported), },- _ => Err(JitCompileError::NotSupported),+ (JitType::Int, JitType::Float) => {+ let fa = self.builder.ins().fcvt_from_sint(types::F64, a.val);+ self.add_binary_operator_float(op, fa, b.val)+ }+ (JitType::Float, JitType::Int) => {+ let fb = self.builder.ins().fcvt_from_sint(types::F64, b.val);
You are right, this is not handled yet. Note that also the division by zero is not handled by the jit yet. I was not sure how to implement exception throwing for such cases and left it therefore out.
Can you give me a pointer how to throw an exception from the JIT code?
comment created time in 2 days
Pull request review commentRustPython/RustPython
JIT: Adding multiply and division for int type + mixing float & int type
impl<'a, 'b> FunctionCompiler<'a, 'b> { }); Ok(()) }- _ => Err(JitCompileError::NotSupported),- },- (JitType::Float, JitType::Float) => match op {- BinaryOperator::Add => {- self.stack.push(JitValue {- val: self.builder.ins().fadd(a.val, b.val),- ty: JitType::Float,- });- Ok(())- }- BinaryOperator::Subtract => {- self.stack.push(JitValue {- val: self.builder.ins().fsub(a.val, b.val),- ty: JitType::Float,- });- Ok(())- } BinaryOperator::Multiply => { self.stack.push(JitValue {- val: self.builder.ins().fmul(a.val, b.val),- ty: JitType::Float,+ val: self.builder.ins().imul(a.val, b.val),+ ty: JitType::Int, }); Ok(()) } BinaryOperator::Divide => {- self.stack.push(JitValue {- val: self.builder.ins().fdiv(a.val, b.val),- ty: JitType::Float,- });- Ok(())+ // Convert the operands to floats and perform the+ // division.+ let fa = self.builder.ins().fcvt_from_sint(types::F64, a.val);+ let fb = self.builder.ins().fcvt_from_sint(types::F64, b.val);+ self.add_binary_operator_float(op, fa, fb) } _ => Err(JitCompileError::NotSupported), },- _ => Err(JitCompileError::NotSupported),+ (JitType::Int, JitType::Float) => {+ let fa = self.builder.ins().fcvt_from_sint(types::F64, a.val);+ self.add_binary_operator_float(op, fa, b.val)+ }+ (JitType::Float, JitType::Int) => {+ let fb = self.builder.ins().fcvt_from_sint(types::F64, b.val);
What happens if b.val value is doesn't fit in f64? this is OverflowError case without jit.
comment created time in 2 days
push eventRustPython/pyckitup
commit sha 430b43610fa4bd6f21f2980c5342da55b7c0f650
deploy: b97b06ad1b3b8d5c3b28501a2a1cd3479ae1d501
push time in 2 days
push eventRustPython/pyckitup
commit sha 14c56ed7d04f7d7b13c3e4ed6215f79268d82992
deploy: 6eae1b9fba22ae391e715a44cecc4930b19ca6d0
push time in 2 days
push eventRustPython/pyckitup
commit sha 35ff1870564b57e612f7c1f2e1dba8745d549f9c
deploy: a0a6a6726015c54d656a114f821852af96d5db78
push time in 2 days
push eventRustPython/pyckitup
commit sha b97b06ad1b3b8d5c3b28501a2a1cd3479ae1d501
Make an options struct to pass to run()
push time in 2 days
push eventRustPython/pyckitup
commit sha 6eae1b9fba22ae391e715a44cecc4930b19ca6d0
Make an options struct to pass to run()
push time in 2 days
push eventRustPython/pyckitup
commit sha a0a6a6726015c54d656a114f821852af96d5db78
Make an options struct to pass to run()
push time in 2 days
Pull request review commentRustPython/RustPython
+#[cfg(not(feature = "threading"))]+mod non_threading {+ use crate::lock::OnceCell;+ pub type StaticCell<T> = std::thread::LocalKey<OnceCell<&'static T>>;++ #[macro_export]+ macro_rules! static_cells {+ // process multiple declarations+ ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty;) => (+ std::thread_local! {+ $(#[$attr])* $vis static $name: $crate::lock::OnceCell<&'static $t> = $crate::lock::OnceCell::new();+ }+ );+ }+}+#[cfg(not(feature = "threading"))]+pub use non_threading::*;++#[cfg(feature = "threading")]+mod threading {+ use crate::lock::OnceCell;++ pub struct StaticKey<T> {+ inner: T,+ }++ impl<T> StaticKey<T> {+ pub const fn new(inner: T) -> Self {+ Self { inner }+ }++ pub fn with<F, R>(&self, f: F) -> R+ where+ F: FnOnce(&T) -> R,+ {+ f(&self.inner)+ }+ }++ pub type StaticCell<T> = StaticKey<OnceCell<&'static T>>;
Yes, that should be possible. But this is easier by providing exact same API with LocalKey.
At the same time, the reference of immutable static variable is practically just same as permanently leaked reference.
So I agree that I was able to do it, but still don't have any reason to do it (yet).
Let me know if i am missing something.
comment created time in 2 days
Pull request review commentRustPython/RustPython
generic and efficiency way to consume iterable object
pub fn get_all<T: TryFromObject>(vm: &VirtualMachine, iter_obj: &PyObjectRef) -> Ok(elements) } +pub fn try_map<F, R>(vm: &VirtualMachine, iter_obj: &PyObjectRef, mut f: F) -> PyResult<Vec<R>>+where+ F: FnMut(PyObjectRef) -> PyResult<R>,+{+ let cap = length_hint(vm, iter_obj.clone())?.unwrap_or(0);+ // TODO: fix extend to do this check (?), see test_extend in Lib/test/list_tests.py,+ // https://github.com/python/cpython/blob/master/Objects/listobject.c#L934-L940
link to cpython master will be broken one day. link to specific tag will be better.
comment created time in 2 days
Pull request review commentRustPython/RustPython
generic and efficiency way to consume iterable object
pub fn get_all<T: TryFromObject>(vm: &VirtualMachine, iter_obj: &PyObjectRef) -> Ok(elements) } +pub fn try_map<F, R>(vm: &VirtualMachine, iter_obj: &PyObjectRef, mut f: F) -> PyResult<Vec<R>>+where+ F: FnMut(PyObjectRef) -> PyResult<R>,+{+ let cap = length_hint(vm, iter_obj.clone())?.unwrap_or(0);+ // TODO: fix extend to do this check (?), see test_extend in Lib/test/list_tests.py,+ // https://github.com/python/cpython/blob/master/Objects/listobject.c#L934-L940+ if cap >= isize::max_value() as usize {
I think this is sys.maxsize but just found there is no way to access to the const in rust side.
comment created time in 2 days
Pull request review commentRustPython/RustPython
+#[cfg(not(feature = "threading"))]+mod non_threading {+ use crate::lock::OnceCell;+ pub type StaticCell<T> = std::thread::LocalKey<OnceCell<&'static T>>;++ #[macro_export]+ macro_rules! static_cells {+ // process multiple declarations+ ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty;) => (+ std::thread_local! {+ $(#[$attr])* $vis static $name: $crate::lock::OnceCell<&'static $t> = $crate::lock::OnceCell::new();+ }+ );+ }+}+#[cfg(not(feature = "threading"))]+pub use non_threading::*;++#[cfg(feature = "threading")]+mod threading {+ use crate::lock::OnceCell;++ pub struct StaticKey<T> {+ inner: T,+ }++ impl<T> StaticKey<T> {+ pub const fn new(inner: T) -> Self {+ Self { inner }+ }++ pub fn with<F, R>(&self, f: F) -> R+ where+ F: FnOnce(&T) -> R,+ {+ f(&self.inner)+ }+ }++ pub type StaticCell<T> = StaticKey<OnceCell<&'static T>>;
I think you should be able to make this OnceCell<T> -- try modeling the non-threading version after the OnceCell API, rather than modeling the threading version off the LocalKey API, since OnceCell can provide a &'static T by itself, but LocalKey should still need the Box::leak() stuff.
comment created time in 2 days
startedRustPython/RustPython
started time in 2 days
pull request commentRustPython/RustPython
generic and efficiency way to consume iterable object
#2125 fixed
comment created time in 2 days
startedRustPython/RustPython
started time in 3 days
startedRustPython/RustPython
started time in 3 days
startedRustPython/RustPython
started time in 3 days
startedRustPython/RustPython
started time in 3 days
push eventRustPython/RustPython
commit sha 68de4aa4e28c59b6f671cadae4af7c84c808d628
Clean up remove map_basic
push time in 3 days
delete branch RustPython/RustPython
delete branch : coolreader18/update-browser
delete time in 3 days
push eventRustPython/RustPython
commit sha b0f9589471b4f872ef6a7402343f7ff19feed0d7
Update dependencies
commit sha 79d5872942d43b89be4125d5bdf1e01fd9333763
Expose PyGetSet in builtins
commit sha cb9c9ec4cf62ca2572b03cfe14da22db05c93295
Add some utility methods to function::Args and PyBaseException
commit sha c61759bd924b6292a9c89bc111da0c10d9acd32e
Rework some of the _js module
commit sha efa809bd173a2483cfb14b13d3a31fd6d7f85595
Merge pull request #2290 from RustPython/coolreader18/update-browser Update the browser module
push time in 3 days
PR merged RustPython/RustPython
cc @phorward
Main relevant changes:
- Move
Promiseto the_jsmodule - Rename
JsValue/JsErrortoJSValue/JSErrorto fit with Python naming conventions - If an exception bubbles up to js and it's a
JSError, throw the jsvalue inside it browser.jsclosure -> JSClosure
class JSClosure:
value: Optional[JSValue]
destroyed: bool
detached: bool
destroy(self)
detach(self) -> JSValue
JSClosure.destroy() decreases the refcount of the inner python function that gets called, and makes the js function uncallable. JSValue.detach() makes it so the inner function never gets dropped. If anyone has any API critiques, I'd love to hear them; I'm not really sure if having destroyed and detached completely orthogonal to each other is the best way to do things.
pr closed time in 3 days
Pull request review commentRustPython/RustPython
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef { let element = Element::make_class(ctx); - py_module!(vm, "browser", {+ py_module!(vm, "_browser", {
comment created time in 3 days
push eventRustPython/RustPython
commit sha 2cc76c2e06ac713c2bfff5e8ed713694e0991765
Use disassembly for snapshot testing
push time in 3 days
push eventRustPython/RustPython
commit sha 1055b287b0896418c9f1dd0571b8332b7c3b7a3d
Remove optimization unit test
push time in 3 days
PR closed RustPython/RustPython
WebAssembly Demo is 1735 commits behind master.
https://github.com/RustPython/RustPython/blob/master/wasm/README.md#updating-the-demo
pr closed time in 3 days
pull request commentRustPython/RustPython
I'm going to close this for now; because of this PR, we're running double CI when we push to master, so we can reopen or make another PR when we're ready to merge to release.
comment created time in 3 days
push eventRustPython/RustPython
commit sha 240e3f54a88ea69c479995c20c00ed3e474b93db
Fix wasm
push time in 3 days
push eventRustPython/RustPython
commit sha ce097617f7412b13fbce1c4a063feb5a26e228fc
fix memoryview is not pickleable
commit sha 023bf6c3ba82e131dbf5bbef2463676eeb94a81d
Basic block support in JIT
commit sha 80d168cc745cb6317f3580e440d2e1892034f1f3
Implement Unary minus/plus
commit sha abf5ab467b4398849c0ca060d2efedef686e2f73
implement bool conversion for float
commit sha 70b05cf620d911a5dcac3db024c8920810badc7a
bool support
commit sha 682107ce818521d580e8c16c6a0e445ee6eebc08
factor out LoadConst
commit sha d8875cb660220c9359ae6e91805c20c45b3b6513
constant boolean
commit sha 7b345d060c2683b58669a0779af7398018c2b616
Add bool tests
commit sha c4d4432666664ed18e1f78122f015aeda8c77e52
JumpIfTrue
commit sha 7aebbc80e1b3cca8b58ea91aa91885a68f8b0b42
cargo fmt
commit sha 9f24797bc8f16ef98e418549f1dd6782c80a4840
basic loop support
commit sha bef5b54ea18b08a4af90616087c0bb26dee7805a
Merge pull request #2292 from qingshi163/dev6 fix memoryview is not pickleable
commit sha ee047b9c30571c0ef383d2cb654de750a43c7d09
Merge pull request #2278 from evilpie/basic_block Basic block support in JIT
commit sha f9c7989983b74f796ed26dba83b746285aaeac56
Change CodeObject to be generic over the constant representation
commit sha 848dc3a9a836c84d9712d85a9f1818822d364330
Update compiler to output codeobj.constants, use insta for snapshot testing
commit sha 408931bdf7ed8eb942f136cdc49b5ea14de05f36
Update rustpython_vm to differentiate between bytecode::CodeObject and builtins::code::CodeObject
commit sha 461cdf611771553aa5a1bf10e0bc057b8a9e7c64
Update rustpython_jit to work with codeobj.constants vec
commit sha 1bf2e00aa24eec993f0a8a77888f7e98ff2cd58e
Fix mini_repl and make ctx.new_code_object() more ergonomic
commit sha b4aad697ddf2a44e88643af781d4a82b28bca7cd
Fix clippy lints
push time in 3 days
startedRustPython/RustPython
started time in 3 days
pull request commentRustPython/RustPython
Thanks for contributing!
comment created time in 3 days
push eventRustPython/RustPython
commit sha 023bf6c3ba82e131dbf5bbef2463676eeb94a81d
Basic block support in JIT
commit sha 80d168cc745cb6317f3580e440d2e1892034f1f3
Implement Unary minus/plus
commit sha abf5ab467b4398849c0ca060d2efedef686e2f73
implement bool conversion for float
commit sha 70b05cf620d911a5dcac3db024c8920810badc7a
bool support
commit sha 682107ce818521d580e8c16c6a0e445ee6eebc08
factor out LoadConst
commit sha d8875cb660220c9359ae6e91805c20c45b3b6513
constant boolean
commit sha 7b345d060c2683b58669a0779af7398018c2b616
Add bool tests
commit sha c4d4432666664ed18e1f78122f015aeda8c77e52
JumpIfTrue
commit sha 7aebbc80e1b3cca8b58ea91aa91885a68f8b0b42
cargo fmt
commit sha 9f24797bc8f16ef98e418549f1dd6782c80a4840
basic loop support
commit sha ee047b9c30571c0ef383d2cb654de750a43c7d09
Merge pull request #2278 from evilpie/basic_block Basic block support in JIT
push time in 3 days
push eventRustPython/RustPython
commit sha ce097617f7412b13fbce1c4a063feb5a26e228fc
fix memoryview is not pickleable
commit sha bef5b54ea18b08a4af90616087c0bb26dee7805a
Merge pull request #2292 from qingshi163/dev6 fix memoryview is not pickleable
push time in 3 days
push eventRustPython/RustPython
commit sha 148ed988a0f1fe16675abb072dae97739de12a58
Update rustpython_jit to work with codeobj.constants vec
push time in 3 days
PR opened RustPython/RustPython
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|---|---|---|---|---|
./rustpython-norm benchmarks/pystone.py 50000 |
7.610 ± 0.181 | 7.369 | 7.927 | 1.09 ± 0.03 |
./rustpython-opt3 benchmarks/pystone.py 50000 |
6.999 ± 0.088 | 6.888 | 7.145 | 1.00 |
A bit faster, and should be in general better for memory usage. This also paves the way to string interning; ctx.unwrap_constant() can intern strings and that should also improve memory usage and performance (due to str hash caching and identity comparison in dicts).
pr created time in 3 days
create barnchRustPython/RustPython
branch : coolreader18/pyobj-constants
created branch time in 3 days
startedRustPython/RustPython
started time in 3 days
pull request commentRustPython/RustPython
I decided to add basic loop support. We really only needed to handle the case where multiple jump instructions point to the same target, as well as targets before the jump.
comment created time in 3 days
push eventRustPython/RustPython
commit sha c61759bd924b6292a9c89bc111da0c10d9acd32e
Rework some of the _js module
push time in 3 days
Pull request review commentRustPython/RustPython
pub fn make_module(vm: &VirtualMachine) -> PyObjectRef { let element = Element::make_class(ctx); - py_module!(vm, "browser", {+ py_module!(vm, "_browser", {
It doesn't actually change anything but import _browser; _browser.__name__, if you look at the source of browser.py you can see that it imports * from _browser. _browser has stuff like fetch and document, browser wraps it and also provides some other functions that are easy to implement in Python. It's like the built-in posix/nt vs the Python os.
comment created time in 4 days