@@ -196,50 +196,10 @@ object_getattr(EdgeObject *o, PyObject *name)
196196 ) {
197197 return EdgeRecordDesc_GetDataclassFields ((PyObject * )o -> desc );
198198 }
199-
200- // getattr(obj, "@...") for link property
201- int prefixed = PyUnicode_Tailmatch (
202- name , at_sign_ptr , 0 , PY_SSIZE_T_MAX , -1
203- );
204- if (prefixed == -1 ) {
205- return NULL ;
206- }
207- if (prefixed ) {
208- PyObject * stripped = PyUnicode_Substring (
209- name , 1 , PyUnicode_GET_LENGTH (name )
210- );
211- if (stripped == NULL ) {
212- return NULL ;
213- }
214- ret = EdgeRecordDesc_Lookup (
215- (PyObject * )o -> desc , stripped , & pos );
216- Py_DECREF (stripped );
217- switch (ret ) {
218- case L_ERROR :
219- return NULL ;
220-
221- case L_NOT_FOUND :
222- case L_LINK :
223- case L_PROPERTY :
224- return PyObject_GenericGetAttr ((PyObject * )o , name );
225-
226- case L_LINKPROP : {
227- PyObject * val = EdgeObject_GET_ITEM (o , pos );
228- Py_INCREF (val );
229- return val ;
230- }
231-
232- default :
233- abort ();
234- }
235- }
236-
237199 return PyObject_GenericGetAttr ((PyObject * )o , name );
238200 }
239201
240202 case L_LINKPROP :
241- return PyObject_GenericGetAttr ((PyObject * )o , name );
242-
243203 case L_LINK :
244204 case L_PROPERTY : {
245205 PyObject * val = EdgeObject_GET_ITEM (o , pos );
@@ -256,77 +216,51 @@ static PyObject *
256216object_getitem (EdgeObject * o , PyObject * name )
257217{
258218 Py_ssize_t pos ;
259- int prefixed = 0 ;
260- PyObject * stripped = name ;
261- if (PyUnicode_Check (name )) {
262- prefixed = PyUnicode_Tailmatch (
263- name , at_sign_ptr , 0 , PY_SSIZE_T_MAX , -1
264- );
265- if (prefixed == -1 ) {
266- return NULL ;
267- }
268- if (prefixed ) {
269- stripped = PyUnicode_Substring (
270- name , 1 , PyUnicode_GET_LENGTH (name )
271- );
272- if (stripped == NULL ) {
273- return NULL ;
274- }
275- }
276- }
277-
278219 edge_attr_lookup_t ret = EdgeRecordDesc_Lookup (
279- (PyObject * )o -> desc , stripped , & pos
220+ (PyObject * )o -> desc , name , & pos
280221 );
281- if (prefixed ) {
282- Py_DECREF (stripped );
283- }
284222 switch (ret ) {
285223 case L_ERROR :
286224 return NULL ;
287225
288226 case L_PROPERTY :
227+ PyErr_Format (
228+ PyExc_TypeError ,
229+ "property %R should be accessed via dot notation" ,
230+ name );
231+ return NULL ;
232+
233+ case L_LINKPROP : {
234+ PyObject * val = EdgeObject_GET_ITEM (o , pos );
235+ Py_INCREF (val );
236+ return val ;
237+ }
238+
239+ case L_NOT_FOUND : {
240+ int prefixed = 0 ;
241+ if (PyUnicode_Check (name )) {
242+ prefixed = PyUnicode_Tailmatch (
243+ name , at_sign_ptr , 0 , PY_SSIZE_T_MAX , -1
244+ );
245+ if (prefixed == -1 ) {
246+ return NULL ;
247+ }
248+ }
289249 if (prefixed ) {
290250 PyErr_Format (
291251 PyExc_KeyError ,
292252 "link property %R does not exist" ,
293253 name );
294- } else {
295- PyErr_Format (
296- PyExc_TypeError ,
297- "property %R should be accessed via dot notation" ,
298- name );
299- }
300- return NULL ;
301-
302- case L_LINKPROP :
303- if (prefixed ) {
304- PyObject * val = EdgeObject_GET_ITEM (o , pos );
305- Py_INCREF (val );
306- return val ;
307254 } else {
308255 PyErr_Format (
309256 PyExc_TypeError ,
310257 "link property %R should be accessed with '@' prefix" ,
311258 name );
312- return NULL ;
313259 }
314-
315- case L_NOT_FOUND :
316- PyErr_Format (
317- PyExc_KeyError ,
318- "link property %R does not exist" ,
319- name );
320260 return NULL ;
261+ }
321262
322263 case L_LINK : {
323- if (prefixed ) {
324- PyErr_Format (
325- PyExc_KeyError ,
326- "link property %R does not exist" ,
327- name );
328- return NULL ;
329- }
330264 int res = PyErr_WarnEx (
331265 PyExc_DeprecationWarning ,
332266 "getting link on object is deprecated since 1.0, "
0 commit comments