Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9fd1cc

Browse files
committed
Rewrite impls to be automatic
1 parent fb23d7c commit c9fd1cc

File tree

1 file changed

+6
-38
lines changed

1 file changed

+6
-38
lines changed

vm/src/stdlib/contextvars.rs

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,29 @@ pub(crate) use _contextvars::make_module;
22

33
#[pymodule]
44
mod _contextvars {
5-
use crate::builtins::PyTypeRef;
6-
use crate::pyobject::PyClassImpl;
7-
use crate::pyobject::PyContext;
8-
use crate::slots::PyTypeSlots;
9-
105
#[pyattr]
116
#[pyclass(name = "Context")]
127
#[derive(Debug, Default)]
138
struct Context {}
149

15-
impl PyClassImpl for Context {
16-
const TP_FLAGS: crate::slots::PyTpFlags = crate::slots::PyTpFlags::DEFAULT;
17-
18-
fn impl_extend_class(_ctx: &PyContext, _class: &PyTypeRef) {
19-
// TODO: RUSTPYTHON
20-
}
21-
22-
fn extend_slots(_slots: &mut PyTypeSlots) {
23-
// TODO: RUSTPYTHON
24-
}
25-
}
10+
#[pyimpl]
11+
impl Context {}
2612

2713
#[pyattr]
2814
#[pyclass(name = "ContextVar")]
2915
#[derive(Debug, Default)]
3016
struct ContextVar {}
3117

32-
impl PyClassImpl for ContextVar {
33-
const TP_FLAGS: crate::slots::PyTpFlags = crate::slots::PyTpFlags::DEFAULT;
34-
35-
fn impl_extend_class(_ctx: &PyContext, _class: &PyTypeRef) {
36-
// TODO: RUSTPYTHON
37-
}
38-
39-
fn extend_slots(_slots: &mut PyTypeSlots) {
40-
// TODO: RUSTPYTHON
41-
}
42-
}
18+
#[pyimpl]
19+
impl ContextVar {}
4320

4421
#[pyattr]
4522
#[pyclass(name = "Token")]
4623
#[derive(Debug, Default)]
4724
struct ContextToken {}
4825

49-
impl PyClassImpl for ContextToken {
50-
const TP_FLAGS: crate::slots::PyTpFlags = crate::slots::PyTpFlags::DEFAULT;
51-
52-
fn impl_extend_class(_ctx: &PyContext, _class: &PyTypeRef) {
53-
// TODO: RUSTPYTHON
54-
}
55-
56-
fn extend_slots(_slots: &mut PyTypeSlots) {
57-
// TODO: RUSTPYTHON
58-
}
59-
}
26+
#[pyimpl]
27+
impl ContextToken {}
6028

6129
#[pyfunction]
6230
fn copy_context() {}

0 commit comments

Comments
 (0)