8000 Fix issue with incorrect exc message · python/cpython@89b5b21 · GitHub
[go: up one dir, main page]

Skip to content

Commit 89b5b21

Browse files
committed
Fix issue with incorrect exc message
1 parent a041466 commit 89b5b21

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Lib/test/test_property.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ def _format_exc_msg(self, msg):
307307
name = self.prop[0].name
308308

309309
if name is None:
310-
return msg
310+
return '^{}$'.format(msg)
311311

312-
return "{} {}".format(msg, name)
312+
return "^{} {}$".format(msg, name)
313313

314314
@classmethod
315315
def setUpClass(cls):

Objects/descrobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ property_descr_get(PyObject *self, PyObject *obj, PyObject *type)
15901590

15911591
propertyobject *gs = (propertyobject *)self;
15921592
if (gs->prop_get == NULL) {
1593-
if (gs->prop_name != Py_None) {
1593+
if (gs->prop_name != NULL) {
15941594
PyErr_Format(PyExc_AttributeError, "unreadable attribute %S", gs->prop_name);
15951595
} else {
15961596
PyErr_SetString(PyExc_AttributeError, "unreadable attribute");
@@ -1613,7 +1613,7 @@ property_descr_set(PyObject *self, PyObject *obj, PyObject *value)
16131613
else
16141614
func = gs->prop_set;
16151615
if (func == NULL) {
1616-
if (gs->prop_name != Py_None) {
1616+
if (gs->prop_name != NULL) {
16171617
PyErr_Format(PyExc_AttributeError,
16181618
value == NULL ?
16191619
"can't delete attribute %S" :

0 commit comments

Comments
 (0)
0