omz / Pythonista-Issues

Issue tracker for Pythonista (iOS)
168 stars 14 forks source link

property name issues #381

Open jsbain opened 7 years ago

jsbain commented 7 years ago

I have encoutered a few properties that have been fooling objc_util. Also some which produce invalid encodings, or at least encodings that objc_util cannot parse:

For context, I am making a little view heirachy browser, and though it could be useful to pop up an objc instance browser (show property values, etc). This is mostly working, but certain property names get mangled by ObjCInstance ethod. The offending bit seems to be this regex:

-> sel_name_match = re.search(r'G(.*?)(:?,.*?|$)', prop_attrs)

As an example, of a prop_attrs that fails:

ObjCInstanceMethod(UIApplication.sharedApplication(), 'lastLocationWhereFirstTouchCameDown')

returns a method with a name Point=ff}...

(Pdb) prop_attrs
'T{CGPoint=ff},N,G_lastLocationWhereFirstTouchCameDown,S_setLastLocationWhereFirstTouchCameDown:,V_lastLocationWhereFirstTouchCameDown'

I am not sure if property_getAttributes changed somewhere, or if this situation is so rare (G in the return type) that it was never an issue. It seems as if maybe the regex needs to look for a comma before the G, so as not to get confused by the CGPoint.

<_sre.SRE_Match object; span=(3, 14), match='GPoint=ff},'>

jsbain commented 7 years ago

(sorry, to clarify, this issue is about property names being invalid when calling the objc method... there is a separate but relates issue with return type encodings)