Skip to content

Commit e002191

Browse files
committed
pyproperty -> pygetset
Though it actually create a getset descriptor, we didn't change the name because its concept was a property for writers. Now we have `pymember`, another property-like descriptor. So naming them under same level would be less confusing instead of telling everybody "it is a getset but we call it pyproperty"
1 parent 05e13b6 commit e002191

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+230
-230
lines changed

derive/src/pyclass.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl std::fmt::Display for AttrName {
3333
Self::Method => "pymethod",
3434
Self::ClassMethod => "pyclassmethod",
3535
Self::StaticMethod => "pystaticmethod",
36-
Self::GetSet => "pyproperty",
36+
Self::GetSet => "pygetset",
3737
Self::Slot => "pyslot",
3838
Self::Attr => "pyattr",
3939
Self::ExtendClass => "extend_class",
@@ -50,7 +50,7 @@ impl FromStr for AttrName {
5050
"pymethod" => Self::Method,
5151
"pyclassmethod" => Self::ClassMethod,
5252
"pystaticmethod" => Self::StaticMethod,
53-
"pyproperty" => Self::GetSet,
53+
"pygetset" => Self::GetSet,
5454
"pyslot" => Self::Slot,
5555
"pyattr" => Self::Attr,
5656
"extend_class" => Self::ExtendClass,
@@ -406,7 +406,7 @@ struct MethodItem {
406406
inner: ContentItemInner<AttrName>,
407407
}
408408

409-
/// #[pyproperty]
409+
/// #[pygetset]
410410
struct GetSetItem {
411411
inner: ContentItemInner<AttrName>,
412412
}

derive/src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub(crate) const ALL_ALLOWED_NAMES: &[&str] = &[
1515
"pymethod",
1616
"pyclassmethod",
1717
"pystaticmethod",
18-
"pyproperty",
18+
"pygetset",
1919
"pyfunction",
2020
"pyclass",
2121
"pyexception",

stdlib/src/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,14 +686,14 @@ mod array {
686686
self.array.write()
687687
}
688688

689-
#[pyproperty]
689+
#[pygetset]
690690
fn typecode(&self, vm: &VirtualMachine) -> PyStrRef {
691691
vm.ctx
692692
.intern_str(self.read().typecode().to_string())
693693
.to_owned()
694694
}
695695

696-
#[pyproperty]
696+
#[pygetset]
697697
fn itemsize(&self) -> usize {
698698
self.read().itemsize()
699699
}

stdlib/src/bz2.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ mod _bz2 {
126126
Ok(vm.ctx.new_bytes(buf.to_vec()))
127127
}
128128

129-
#[pyproperty]
129+
#[pygetset]
130130
fn eof(&self) -> bool {
131131
let state = self.state.lock();
132132
state.eof
133133
}
134134

135-
#[pyproperty]
135+
#[pygetset]
136136
fn unused_data(&self, vm: &VirtualMachine) -> PyBytesRef {
137137
// Data found after the end of the compressed stream.
138138
// If this attribute is accessed before the end of the stream
@@ -152,7 +152,7 @@ mod _bz2 {
152152
// }
153153
}
154154

155-
#[pyproperty]
155+
#[pygetset]
156156
fn needs_input(&self) -> bool {
157157
// False if the decompress() method can provide more
158158
// decompressed data before requiring new uncompressed input.

stdlib/src/contextvars.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ mod _contextvars {
101101

102102
#[pyclass(with(Initializer))]
103103
impl ContextVar {
104-
#[pyproperty]
104+
#[pygetset]
105105
fn name(&self) -> String {
106106
self.name.clone()
107107
}
@@ -174,12 +174,12 @@ mod _contextvars {
174174

175175
#[pyclass(with(Initializer))]
176176
impl ContextToken {
177-
#[pyproperty]
177+
#[pygetset]
178178
fn var(&self, _vm: &VirtualMachine) -> PyObjectRef {
179179
unimplemented!("Token.var() is currently under construction")
180180
}
181181

182-
#[pyproperty]
182+
#[pygetset]
183183
fn old_value(&self, _vm: &VirtualMachine) -> PyObjectRef {
184184
unimplemented!("Token.old_value() is currently under construction")
185185
}

stdlib/src/hashlib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ mod hashlib {
8080
Ok(PyHasher::new("md5", HashWrapper::md5()).into_pyobject(vm))
8181
}
8282

83-
#[pyproperty]
83+
#[pygetset]
8484
fn name(&self) -> String {
8585
self.name.clone()
8686
}
8787

88-
#[pyproperty]
88+
#[pygetset]
8989
fn digest_size(&self) -> usize {
9090
self.read().digest_size()
9191
}

stdlib/src/mmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ mod mmap {
541541
))
542542
}
543543

544-
#[pyproperty]
544+
#[pygetset]
545545
fn closed(&self) -> bool {
546546
self.closed.load()
547547
}

stdlib/src/pystruct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,12 @@ pub(crate) mod _struct {
258258

259259
#[pyclass(with(Constructor))]
260260
impl PyStruct {
261-
#[pyproperty]
261+
#[pygetset]
262262
fn format(&self) -> PyStrRef {
263263
self.format.clone()
264264
}
265265

266-
#[pyproperty]
266+
#[pygetset]
267267
#[inline]
268268
fn size(&self) -> usize {
269269
self.spec.size

stdlib/src/re.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ mod re {
343343
self.sub(repl, text, vm)
344344
}
345345

346-
#[pyproperty]
346+
#[pygetset]
347347
fn pattern(&self, vm: &VirtualMachine) -> PyResult<PyStrRef> {
348348
Ok(vm.ctx.new_str(self.pattern.clone()))
349349
}

stdlib/src/socket.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,15 +1504,15 @@ mod _socket {
15041504
Ok(self.sock()?.shutdown(how)?)
15051505
}
15061506

1507-
#[pyproperty(name = "type")]
1507+
#[pygetset(name = "type")]
15081508
fn kind(&self) -> i32 {
15091509
self.kind.load()
15101510
}
1511-
#[pyproperty]
1511+
#[pygetset]
15121512
fn family(&self) -> i32 {
15131513
self.family.load()
15141514
}
1515-
#[pyproperty]
1515+
#[pygetset]
15161516
fn proto(&self) -> i32 {
15171517
self.proto.load()
15181518
}

0 commit comments

Comments
 (0)