mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-17 01:51:39 +09:00
Make incognito a CodeFlag bit
This commit is contained in:
@@ -103,7 +103,7 @@ impl PyCodeRef {
|
||||
}
|
||||
|
||||
#[pyproperty]
|
||||
fn co_flags(self) -> u8 {
|
||||
fn co_flags(self) -> u16 {
|
||||
self.code.flags.bits()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ impl FrameRef {
|
||||
|
||||
#[pyproperty]
|
||||
fn f_globals(self, vm: &VirtualMachine) -> PyResult<PyDictRef> {
|
||||
if self.code.incognito {
|
||||
if self.code.incognito() {
|
||||
Err(vm.new_type_error("Can't get f_globals on an incognito frame".to_owned()))
|
||||
} else {
|
||||
Ok(self.scope.globals.clone())
|
||||
@@ -40,7 +40,7 @@ impl FrameRef {
|
||||
|
||||
#[pyproperty]
|
||||
fn f_locals(self, vm: &VirtualMachine) -> PyResult<PyDictRef> {
|
||||
if self.code.incognito {
|
||||
if self.code.incognito() {
|
||||
Err(vm.new_type_error("Can't get f_locals on an incognito frame".to_owned()))
|
||||
} else {
|
||||
Ok(self.scope.get_locals())
|
||||
|
||||
@@ -281,7 +281,7 @@ impl PyFunction {
|
||||
|
||||
#[pyproperty(magic)]
|
||||
fn globals(&self, vm: &VirtualMachine) -> PyResult<PyDictRef> {
|
||||
if self.code.incognito {
|
||||
if self.code.incognito() {
|
||||
Err(vm.new_type_error("Can't get __globals__ on an incognito function".to_owned()))
|
||||
} else {
|
||||
Ok(self.scope.globals.clone())
|
||||
|
||||
Reference in New Issue
Block a user