mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 11:14:38 +08:00
Fix decorator on functions with defaults
This commit is contained in:
1 parent
8535ba9a56
commit
7fffc57255
2 files changed
+13
-2
No files matched your search
@@ -15,6 +15,16 @@ c = add(10, 3)
|
||||
assert c == 14
|
||||
|
||||
|
||||
@logged
|
||||
def add3(a, b, c=2):
|
||||
return a + b + c
|
||||
|
||||
|
||||
d = add3(12, 5)
|
||||
|
||||
assert d == 20
|
||||
|
||||
|
||||
def f(func): return lambda: 42
|
||||
class A: pass
|
||||
a = A()
|
||||
|
||||
+3
-2
@@ -585,6 +585,9 @@ impl Compiler {
|
||||
let was_in_function_def = self.in_function_def;
|
||||
self.in_loop = false;
|
||||
self.in_function_def = true;
|
||||
|
||||
self.prepare_decorators(decorator_list)?;
|
||||
|
||||
let mut flags = self.enter_function(name, args)?;
|
||||
|
||||
let (new_body, doc_str) = get_doc(body);
|
||||
@@ -598,8 +601,6 @@ impl Compiler {
|
||||
self.emit(Instruction::ReturnValue);
|
||||
let code = self.pop_code_object();
|
||||
|
||||
self.prepare_decorators(decorator_list)?;
|
||||
|
||||
// Prepare type annotations:
|
||||
let mut num_annotations = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user