8000 bpo-27794: Add `name` attribute to `property` class by uriyyo · Pull Request #23967 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-27794: Add name attribute to property class #23967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove strip call from docs, remove extra blank line
  • Loading branch information
uriyyo committed Dec 29, 2020
commit 2c8376932dea5cd30166b48353a5800f612930ca
6 changes: 3 additions & 3 deletions Doc/howto/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -943,17 +943,17 @@ here is a pure Python equivalent:
if obj is None:
return self
if self.fget is None:
raise AttributeError(f'unreadable attribute {self._name}'.strip())
raise AttributeError(f'unreadable attribute {self._name}')
return self.fget(obj)

def __set__(self, obj, value):
if self.fset is None:
raise AttributeError(f'can\'t set attribute {self._name}'.strip())
raise AttributeError(f'can\'t set attribute {self._name}')
self.fset(obj, value)

def __delete__(self, obj):
if self.fdel is None:
raise AttributeError(f'can\'t delete attribute {self._name}'.strip())
raise AttributeError(f'can\'t delete attribute {self._name}')
self.fdel(obj)

def getter(self, fget):
Expand Down
1 change: 0 additions & 1 deletion Objects/descrobject.c
Original file line number Diff line number Diff line change
53DF Expand Up @@ -1554,7 +1554,6 @@ property_set_name(PyObject *self, PyObject *args) {
Py_RETURN_NONE;
}


static PyMethodDef property_methods[] = {
{"getter", property_getter, METH_O, getter_doc},
{"setter", property_setter, METH_O, setter_doc},
Expand Down
0